diff --git a/.c3i/authorized_users.yml b/.c3i/authorized_users.yml index 0fd98c325c7a66..2975b9dfc05e45 100644 --- a/.c3i/authorized_users.yml +++ b/.c3i/authorized_users.yml @@ -994,3 +994,29 @@ authorized_users: - kletoz - agilemapper - ZXfkSIE +- RubenRBS +- Alex-PLACET +- antekone +- ambroff +- tiolan +- MateuszMiekicki +- EricAtORS +- calebkiage +- bennyhuo +- ashuels +- jjcasmar +- kaipenglu +- ashley-b +- psmitsu +- Viatorus +- mkoviazin +- shtanko-sv +- larshg +- Wuqiqi123 +- OzanCansel +- marlamb +- alexsmedin +- n-morales +- calebgray +- technic +- guillaume-michel diff --git a/.c3i/config_v1.yml b/.c3i/config_v1.yml index be12d2a2a3026c..870d10c9cf172d 100644 --- a/.c3i/config_v1.yml +++ b/.c3i/config_v1.yml @@ -3,7 +3,7 @@ id: 'conan-io/conan-center-index' conan: - version: 1.53.0 + version: 1.56.0 artifactory: url: "https://c3i.jfrog.io/c3i" @@ -33,13 +33,18 @@ slack: # Things related to Jenkins jobs tasks: - conan_v2_run_export: true + conan_v2_run_export: false write_comments: true detailed_status_checks: true update_labels: true automatic_merge: reviews_required_total: 2 # Reviews that a PR needs so it can be merged reviews_required_team: 1 # Reviews from the Conan team that a PR needs so it can be merged +# Temporarily disable feedback from Conan v2 + # cci_wait_for_multibranch: # CCI jobs should wait for other multibranch job for that same PR + # job_name: "prod-v2/cci" # e.g. "cci-v2/cci" -> this means waiting for cci-v2/cci/PR- + # timeout_seconds: 600 # Maximum time to wait for the multibranch job + # merge_messages: true # Merge messages from the multibranch job waited for # Profile configurations to build packages configurations: @@ -159,7 +164,7 @@ node_labels: Windows: x86_64: "Visual Studio": - default: "windows20221024" + default: "windows20221212" Macos: x86_64: "apple-clang": @@ -184,7 +189,6 @@ pod_size: large: - "pcl" - "duckdb" - - "cppfront" xlarge: - "llvm" - "opengv" diff --git a/.c3i/config_v2.yml b/.c3i/config_v2.yml index b6da2e14522493..20dcee62abb552 100644 --- a/.c3i/config_v2.yml +++ b/.c3i/config_v2.yml @@ -3,7 +3,7 @@ id: 'conan-io/conan-center-index-staging-v2' conan: - version: 2.0.0-pre + version: 2.0.0-beta7 artifactory: url: "https://c3i.jfrog.io/c3i" @@ -30,6 +30,7 @@ github: # Things related to Jenkins jobs: tasks: + feedback_title: "Conan v2 pipeline (informative, not required for merge)" write_comments: false detailed_status_checks: false update_labels: false @@ -87,7 +88,7 @@ node_labels: Windows: x86_64: "msvc": - default: "windows20221024" + default: "windows20221212" Macos: x86_64: "apple-clang": diff --git a/.c3i/reviewers.yml b/.c3i/reviewers.yml index 3192836104f73f..e722f8b159e064 100644 --- a/.c3i/reviewers.yml +++ b/.c3i/reviewers.yml @@ -69,3 +69,6 @@ reviewers: - user: "jwillikers" type: "community" request_reviews: false + - user: "RubenRBS" + type: "team" + request_reviews: false diff --git a/.github/ISSUE_TEMPLATE/center_conan_io.md b/.github/ISSUE_TEMPLATE/center_conan_io.md deleted file mode 100644 index f95bb699d06072..00000000000000 --- a/.github/ISSUE_TEMPLATE/center_conan_io.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: 'ConanCenter: Web UI Bugs Or Requests' -about: 'Bugs or feature requests for the Web UI of ConanCenter at https://conan.io/center' -title: '[conan.io/center] SHORT DESCRIPTION' -labels: conan.io/center ---- - - diff --git a/.github/ISSUE_TEMPLATE/center_conan_io.yml b/.github/ISSUE_TEMPLATE/center_conan_io.yml new file mode 100644 index 00000000000000..0662c491c99580 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/center_conan_io.yml @@ -0,0 +1,18 @@ +name: 'ConanCenter: Web UI Bugs Or Requests' +description: Bugs or feature requests for the Web UI of ConanCenter at https://conan.io/center +title: '[conan.io/center] SHORT DESCRIPTION' +labels: 'conan.io/center' +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to submit a report. + **Please don't forget to update the issue title.** + - type: textarea + id: contents + attributes: + label: What is your problem/feature request? + description: Please be as specific as possible! + placeholder: Hi! I would like for ConanCenter to ... + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/package_bug.yml b/.github/ISSUE_TEMPLATE/package_bug.yml index 5ac1a60d6437de..2c6e3356c879b2 100644 --- a/.github/ISSUE_TEMPLATE/package_bug.yml +++ b/.github/ISSUE_TEMPLATE/package_bug.yml @@ -1,81 +1,87 @@ name: 'Package: Bug Report' -description: 'Report a bug, something does not work as it supposed to' +description: 'Report a bug, something does not work as it is supposed to' title: '[package] /: SHORT DESCRIPTION' labels: bug body: -- 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._ - - 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: markdown + attributes: + value: | + Thanks for taking the time to submit a report. + **Please don't forget to update the issue title.** + Include all applicable information to help us reproduce + - type: textarea + id: description + attributes: + label: Description + description: | + What is not working? What were you expecting? Are there any workarounds? + Remember that a missing profile or a short log will make extremely difficult + to investigate your case or provide any help, please be as specific as possible. + placeholder: Include all applicable information with details to help us reproduce your problem + validations: + required: true + - type: textarea + id: env + attributes: + label: Package and Environment Details + description: (Include every applicable attribute) + value: | + * Package Name/Version: **zlib/1.2.8** + * Operating System+version: **Linux Ubuntu 18.04** + * Compiler+version: **GCC 8** + * 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 + id: profile + attributes: + label: Conan profile + description: Output of `conan profile show default` or `conan profile show ` if a 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 + id: steps + attributes: + label: Steps to reproduce + description: Which commands did you run? + placeholder: conan install -r conancenter foobar/0.1.0@ -pr:b=default -pr:h=default + validations: + required: true + - type: textarea + id: logs + attributes: + label: Logs + description: Include/Attach the entire command output here. + value: | +
Click to expand log -- type: textarea - attributes: - label: Package and Environment Details - description: (include every applicable attribute) - value: | - * Package Name/Version: **zlib/1.2.8** - * Operating System+version: **Linux Ubuntu 18.04** - * Compiler+version: **GCC 8** - * 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 + ``` + Put your log output here + ``` -- 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: 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 the entire command output here. - value: | -
Click to expand log - - ``` - Put your log output here - ``` - -
- validations: - required: true +
+ validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/package_request.md b/.github/ISSUE_TEMPLATE/package_request.md deleted file mode 100644 index 2d23c97fae995d..00000000000000 --- a/.github/ISSUE_TEMPLATE/package_request.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -name: 'Package: Completely New Recipe' -about: 'If would like to see a completely new recipe' -title: '[request] /' -labels: 'library request' ---- - -### Package Details - * Package Name/Version: **cmake/3.15.3** - * Website: **https://cmake.org/** - * Source code: **https://github.com/Kitware/CMake** - - -### Description Of The Library / Tool diff --git a/.github/ISSUE_TEMPLATE/package_request.yml b/.github/ISSUE_TEMPLATE/package_request.yml new file mode 100644 index 00000000000000..3c08e512048664 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/package_request.yml @@ -0,0 +1,42 @@ +name: 'Package: Completely New Recipe' +description: If you would like to see a completely new recipe +title: '[request] /' +labels: 'library request' +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to submit your request. + **Please don't forget to update the issue title.** + - type: input + id: package + attributes: + label: Package Name/Version + placeholder: cmake/3.25.1 + validations: + required: true + - type: input + id: website + attributes: + label: Webpage + placeholder: https://cmake.org + validations: + required: true + - type: input + id: sources + attributes: + label: Source code + placeholder: https://github.com/Kitware/CMake + validations: + required: true + - type: textarea + id: description + attributes: + label: Description of the library/tool + description: | + Give us some context about this library/tool. + What is it about? + placeholder: | + CMake is an open-source, cross-platform family of tools designed to build, test and package software. + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/package_upstream_update.md b/.github/ISSUE_TEMPLATE/package_upstream_update.md deleted file mode 100644 index 15db0006187467..00000000000000 --- a/.github/ISSUE_TEMPLATE/package_upstream_update.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -name: 'Package: New Version' -about: 'If an existing package recipe needs an update for a new upstream version' -title: '[request] /' -labels: 'upstream update' ---- - -### Package Details - * Package Name/Version: **cmake/3.15.3** - * Changelog: **https://cmake.org/cmake/help/latest/release/3.15.html** - - -The above mentioned version is newly released by the upstream project and not yet available as a recipe. Please add this version. diff --git a/.github/ISSUE_TEMPLATE/package_upstream_update.yml b/.github/ISSUE_TEMPLATE/package_upstream_update.yml new file mode 100644 index 00000000000000..efbe2c5a38c327 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/package_upstream_update.yml @@ -0,0 +1,33 @@ +name: 'Package: New Version' +description: If an existing package recipe needs an update for a new upstream version +title: '[request] /' +labels: 'upstream update' +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to submit your request. + **Please don't forget to update the issue title.** + - type: input + id: package + attributes: + label: Package Name/Version + placeholder: cmake/3.25.1 + validations: + required: true + - type: input + id: changelog + attributes: + label: Changelog + placeholder: https://cmake.org/cmake/help/latest/release/3.25.html + validations: + required: true + - type: textarea + id: description + attributes: + label: Context about the new update + value: | + The above-mentioned version is newly released by the upstream project and not yet available as a recipe. + Please add this version. + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md deleted file mode 100644 index 226701a9fa97cb..00000000000000 --- a/.github/ISSUE_TEMPLATE/question.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: 'Question' -about: 'If something needs clarification' -title: '[question] SHORT DESCRIPTION' -labels: question ---- - - diff --git a/.github/ISSUE_TEMPLATE/question.yml b/.github/ISSUE_TEMPLATE/question.yml new file mode 100644 index 00000000000000..afe36c847827d0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.yml @@ -0,0 +1,18 @@ +name: Question +description: If something needs clarification +title: '[question] SHORT DESCRIPTION' +labels: 'question' +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill your question. + **Please don't forget to update the issue title.** + - type: textarea + id: question + attributes: + label: What is your question? + description: Please be as specific as possible! + placeholder: Hi! I have a question regarding ... + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/service.md b/.github/ISSUE_TEMPLATE/service.md deleted file mode 100644 index d0b1cf7de19216..00000000000000 --- a/.github/ISSUE_TEMPLATE/service.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: 'Service: Infrastructure Bugs Or Requests' -about: 'Bug or feature requests for Conan Center Index itself' -title: '[service] SHORT DESCRIPTION' -labels: service ---- - - diff --git a/.github/ISSUE_TEMPLATE/service.yml b/.github/ISSUE_TEMPLATE/service.yml new file mode 100644 index 00000000000000..4afdce69c57d64 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/service.yml @@ -0,0 +1,18 @@ +name: 'Service: Infrastructure Bugs Or Requests' +description: Bug or feature requests for Conan Center Index itself +title: '[service] SHORT DESCRIPTION' +labels: 'service' +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to submit a report. + **Please don't forget to update the issue title.** + - type: textarea + id: contents + attributes: + label: What is your problem/feature request? + description: Please be as specific as possible! + placeholder: Hi! I would like for Conan Center Index to ... + validations: + required: true diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 0caa6b85e70496..3f6e08d2479e94 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,10 +1,10 @@ Specify library name and version: **lib/1.0** -This is also a good place to share with all of us **why you are submitting this PR** (specially if it is a new addition to ConanCenter): is it a dependency of other libraries you want to package? Are you the author of the library? Thanks! + + --- - [ ] I've read the [contributing guidelines](https://github.com/conan-io/conan-center-index/blob/master/CONTRIBUTING.md). -- [ ] I've followed the [PEP8](https://www.python.org/dev/peps/pep-0008/) style guides for Python code in the recipes. -- [ ] I've used the [latest](https://github.com/conan-io/conan/releases/latest) Conan client version. +- [ ] I've used a [recent](https://github.com/conan-io/conan/releases/latest) Conan client version close to the [currently deployed](https://github.com/conan-io/conan-center-index/blob/master/.c3i/config_v1.yml#L6). - [ ] I've tried at least one configuration locally with the [conan-center hook](https://github.com/conan-io/hooks.git) activated. diff --git a/.github/workflows/linter-conan-v2.yml b/.github/workflows/linter-conan-v2.yml index 146c807267d261..ed93965afa1979 100644 --- a/.github/workflows/linter-conan-v2.yml +++ b/.github/workflows/linter-conan-v2.yml @@ -6,7 +6,6 @@ on: env: PYTHONPATH: ${{github.workspace}} PYVER: "3.8" - SCORE_THRESHOLD: "9.5" REQUIREMENTS: "pylint==2.14" jobs: @@ -21,16 +20,20 @@ jobs: with: files: | linter/** + .github/workflows/linter-conan-v2.yml + - name: Get Conan v1 version id: parse_conan_v1_version if: steps.changed_files.outputs.any_changed == 'true' uses: mikefarah/yq@master with: cmd: yq '.conan.version' '.c3i/config_v1.yml' + - uses: actions/setup-python@v4 if: steps.changed_files.outputs.any_changed == 'true' with: python-version: ${{ env.PYVER }} + - name: Install requirements if: steps.changed_files.outputs.any_changed == 'true' run: | @@ -40,41 +43,35 @@ jobs: id: linter_recipes if: steps.changed_files.outputs.any_changed == 'true' run: | - pylint --rcfile=linter/pylintrc_recipe recipes/*/*/conanfile.py --output-format=json --output=recipes.json --score=y --fail-under=${{ env.SCORE_THRESHOLD }} + echo '## Linter summary (recipes)' >> $GITHUB_STEP_SUMMARY + i=1 + for file in recipes/*/*/conanfile.py; do + if [[ $i -gt 250 ]] ; then + break + fi + echo "$i - $file" + pylint --rcfile=linter/pylintrc_recipe $file --output-format=json --output=recipes.json --score=y --exit-zero + jq 'map( select(.type=="error")) | group_by (.message)[] | {message: .[0].message, length: length}' recipes.json > recipes2.json + jq -r '" * \(.message): \(.length)"' recipes2.json >> $GITHUB_STEP_SUMMARY + (( i += 1 )) + done - name: Execute linter over all test_package/recipes in the repository id: linter_test_package if: steps.changed_files.outputs.any_changed == 'true' - run: | - pylint --rcfile=linter/pylintrc_testpackage recipes/*/*/test_*/conanfile.py --ignore-paths="recipes/[^/]*/[^/]*/test_v1[^/]*/conanfile.py" --output-format=json --output=test_package.json --score=y --fail-under=${{ env.SCORE_THRESHOLD }} - - - name: Archive production artifacts - if: steps.changed_files.outputs.any_changed == 'true' && always() - uses: actions/upload-artifact@v3 - with: - name: linter-output - path: | - recipes.json - test_package.json - - - name: Create report (recipes) - if: steps.changed_files.outputs.any_changed == 'true' && steps.linter_recipes.outcome != 'skipped' && always() - run: | - echo '## Linter summary (recipes)' >> $GITHUB_STEP_SUMMARY - jq 'map( select(.type=="error")) | group_by (.message)[] | {message: .[0].message, length: length}' recipes.json > recipes2.json - jq -r '" * \(.message): \(.length)"' recipes2.json >> $GITHUB_STEP_SUMMARY - - - name: Create report (test_package) - if: steps.changed_files.outputs.any_changed == 'true' && steps.linter_test_package.outcome != 'skipped' && always() run: | echo '## Linter summary (test_package)' >> $GITHUB_STEP_SUMMARY - jq 'map( select(.type=="error")) | group_by (.message)[] | {message: .[0].message, length: length}' test_package.json > test_package2.json - jq -r '" * \(.message): \(.length)"' test_package2.json >> $GITHUB_STEP_SUMMARY - - - name: Create report - if: steps.changed_files.outputs.any_changed == 'true' && always() - run: | - echo '> Note.- Check uploaded artifacts for a full report.' >> $GITHUB_STEP_SUMMARY + i=1 + for file in recipes/*/*/conanfile.py; do + if [[ $i -gt 250 ]] ; then + break + fi + echo "$i - $file" + pylint --rcfile=linter/pylintrc_testpackage $file --ignore-paths="recipes/[^/]*/[^/]*/test_v1[^/]*/conanfile.py --output-format=json --output=recipes.json --exit-zero + jq 'map( select(.type=="error")) | group_by (.message)[] | {message: .[0].message, length: length}' recipes.json > recipes2.json + jq -r '" * \(.message): \(.length)"' recipes2.json >> $GITHUB_STEP_SUMMARY + (( i += 1 )) + done conanfile_recipe: name: Lint changed conanfile.py (v2 migration) diff --git a/.github/workflows/markdown-links.yml b/.github/workflows/markdown-links.yml new file mode 100644 index 00000000000000..50c393f373fb13 --- /dev/null +++ b/.github/workflows/markdown-links.yml @@ -0,0 +1,18 @@ +name: "[linter] Markdown links" + +on: + pull_request: + paths: + - '**.md' + +jobs: + markdown-link-check-pr: + 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/marldown-links.yml b/.github/workflows/marldown-links.yml deleted file mode 100644 index 63b30bcfe82a85..00000000000000 --- a/.github/workflows/marldown-links.yml +++ /dev/null @@ -1,25 +0,0 @@ -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/docs/adding_packages/README.md b/docs/adding_packages/README.md index b1f20c7adfcbc5..19f9f5b8d930c9 100644 --- a/docs/adding_packages/README.md +++ b/docs/adding_packages/README.md @@ -19,16 +19,6 @@ You can follow the three steps (:one: :two: :three:) described below! :tada: * [`conandata.yml`](#conandatayml) * [The _recipe folder_: `conanfile.py`](#the-_recipe-folder_-conanfilepy) * [Test Folders](#test-folders) - * [How to provide a good recipe](#how-to-provide-a-good-recipe) - * [Header Only](#header-only) - * [CMake](#cmake) - * [Components](#components) - * [Autotools](#autotools) - * [Components](#components-1) - * [No Upstream Build Scripts](#no-upstream-build-scripts) - * [System Packages](#system-packages) - * [Verifying Dependency Version](#verifying-dependency-version) - * [Verifying Dependency Options](#verifying-dependency-options) * [Test the recipe locally](#test-the-recipe-locally) * [Hooks](#hooks) * [Linters](#linters) @@ -63,7 +53,7 @@ The specific steps to add new packages are: * Fork the [conan-center-index](https://github.com/conan-io/conan-center-index) git repository, and then clone it locally. * Copy a template from [package_templates](../package_templates) folder in the recipes/ folder and rename it to the project name (it should be lower-case). Read templates [documentation](../package_templates/README.md) to find more information. -* Make sure you are using the latest [Conan client](https://conan.io/downloads) version, as recipes might evolve introducing features of the newer Conan releases. +* Make sure you are using a recent [Conan client](https://conan.io/downloads) version, as recipes might evolve introducing features of the newer Conan releases. * Commit and Push to GitHub then submit a pull request. * Our automated build service will build 100+ different configurations, and provide messages that indicate if there were any issues found during the pull request on GitHub. @@ -173,68 +163,6 @@ a minimal project to test the package is strictly required. You can read about i Learn more about the ConanCenterIndex requirements in the [test packages](test_packages.md) document. -## How to provide a good recipe - -The [recipes](https://github.com/conan-io/conan-center-index/tree/master/recipes) available in CCI can be used as good examples, you can use them as the base for your recipe. However it is important to note Conan features change over time and our best practices evolve so some minor details may be out of date due to the vast number of recipes. - -### Header Only - -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 [cmake package template](../package_templates/cmake_package). - -#### Components - -Another common use case for CMake based projects, both header only and compiled, is _modeling components_ to match the `find_package` and export the correct targets from Conan's generators. A basic examples of this is [cpu_features](https://github.com/conan-io/conan-center-index/blob/master/recipes/cpu_features/all/conanfile.py), a moderate/intermediate example is [cpprestsdk](https://github.com/conan-io/conan-center-index/blob/master/recipes/cpprestsdk/all/conanfile.py), and a very complex example is [OpenCV](https://github.com/conan-io/conan-center-index/blob/master/recipes/opencv/4.x/conanfile.py). - -### Autotools - -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 - -Many projects offer **pkg-config**'s `*.pc` files which need to be modeled using components. A prime example of this is [Wayland](https://github.com/conan-io/conan-center-index/blob/master/recipes/wayland/all/conanfile.py). - -### No Upstream Build Scripts - -For cases where a project only offers source files, but not a build script, you can add CMake support, but first, contact the upstream and open a PR offering building support. If it's rejected because the author doesn't want any kind of build script, or the project is abandoned, CCI can accept your build script. Take a look at [Bzip2](https://github.com/conan-io/conan-center-index/blob/master/recipes/bzip2/all/CMakeLists.txt) and [DirectShowBaseClasses](https://github.com/conan-io/conan-center-index/blob/master/recipes/directshowbaseclasses/all/CMakeLists.txt) as examples. - -### System Packages - -> :information_source: For exceptional cases where only system packages can be used and a regular Conan package may result in an incompatible and fragile package, a separated system package may be created. See the [FAQs](../faqs.md#can-i-install-packages-from-the-system-package-manager) for more. - -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 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 [`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 -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.") -``` - -### 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 [sdl_image recipe](https://github.com/conan-io/conan-center-index/blob/1b6b496fe9a9be4714f8a0db45274c29b0314fe3/recipes/sdl_image/all/conanfile.py#L93). - -```py - def validate(self): - 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 ### Hooks diff --git a/docs/adding_packages/build_and_package.md b/docs/adding_packages/build_and_package.md index 8918d1c833ea78..b247b29d9faa88 100644 --- a/docs/adding_packages/build_and_package.md +++ b/docs/adding_packages/build_and_package.md @@ -7,30 +7,106 @@ Both methods often use build helpers to build binaries and install them into the ## Contents * [Build Method](#build-method) - * [Package](#package) + * [Package Method](#package-method) + * [Build System Examples](#build-system-examples) + * [Header Only](#header-only) + * [CMake](#cmake) + * [Autotools](#autotools) + * [No Upstream Build Scripts](#no-upstream-build-scripts) + * [System Packages](#system-packages) ## Build Method * `build()` method should focus on build only, not installation. During the build, nothing should be written in `package` folder. Installation step should only occur in `package()` method. -* The build itself should only rely on local files. Nothing should be downloaded from the internet during this step. If external files are required, they should come from `requirements` or `build_requirements` in addition to source files downloaded in `source()` or coming from the recipe itself. +* The build itself should only rely on local files. Nothing should be downloaded from the internet during this step. If external files are required, they should come from `requirements` or `build_requirements` in addition to source files downloaded in `source()` or coming from the recipe itself through `export()` or `export_sources()`. -* Except for CMake and a working build toolchain (compiler, linker, archiver, etc.), the recipe should not assume that any other build tool is installed on the user-build machine (like Meson, autotools, or pkg-config). On Windows, the recipe should not assume that a shell is available (like MSYS2). Therefore, if the build method requires additional tools, they should be added to `build_requirements()`. +* Except for CMake, a working build toolchain (compiler, linker, archiver, etc.), and a "native generator" (`make` on *nix platforms, `mingw32-make` for MinGW, `MSBuild`/`NMake` for Visual Studio), the recipe should not assume that any other build tool is installed on the user-build machine (like Meson, autotools, or pkg-config). On Windows, the recipe should not assume that a shell is available (like MSYS2). Therefore, if the build method requires additional tools, they should be added to `build_requirements()`. + Tools explicitly marked as available by users through conf like `tools.gnu:make_program`, `tools.gnu:pkg_config`, `tools.microsoft.bash:path`, `tools.microsoft.bash:subsystem` should be taken into account to conditionally inject a build requirement (these conf should have precedence over build requirement equivalent hardcoded in the recipe). * It is forbidden to run other conan client commands during build. In other words, if upstream build files call conan under the hood (through `cmake-conan` for example or any other logic), this logic must be removed. * Settings from profile should be honored (`build_type`, `compiler.libcxx`, `compiler.cppstd`, `compiler.runtime` etc). -* These env vars from profile should be honored and properly propagated to underlying build system during the build: `CC`, `CXX`, `CFLAGS`, `CXXFLAGS`, `LDFLAGS`. +* Compiler paths from host profile should be honored and properly propagated to underlying build system during the build: -## Package + | compiler type | conf / env var | + |---------------|----------------| + | C compiler | `c` key of `tools.build:compiler_executables`, otherwise `CC` environment variable | + | C++ compiler | `cpp` key of `tools.build:compiler_executables`, otherwise `CXX` environment variable | + | ASM compiler | `asm` key of `tools.build:compiler_executables`, otherwise `CCAS` environment variable | + | CUDA compiler | `cuda` key of `tools.build:compiler_executables` | + | Fortran compiler | `fortran` key of `tools.build:compiler_executables`, otherwise `FC` environment variable | + | Objective-C compiler | `objc` key of `tools.build:compiler_executables` | + | Objective-C++ compiler | `objcpp` key of `tools.build:compiler_executables` | + | Resource files compiler | `rc` key of `tools.build:compiler_executables`, otherwise `RC` environment variable | + | Archiver | `AR` environment variable | + | Linker | `LD` environment variable | -* CMake config files must be removed (they will be generated for consumers by `cmake_find_package`, `cmake_find_package_multi`, or `CMakeDeps` generators). Use `rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))` or `rm(self, "*.cmake", os.path.join(self.package_folder, "lib"))`. + They should be curated on the fly if underlying build system expects a specific format (no spaces in path, forward slash instead of back slash, etc). -* pkg-config files must be removed (they will be generated for consumers by `pkg_config` or `PkgConfigDeps` generators). Use `rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))` or `rm(self, "*.pc", os.path.join(self.package_folder, "lib"))`. +* These compiler and linker conf from host profile should be honored and propagated to underlying build system during the build: + * `tools.build:cflags` + * `tools.build:cxxflags` + * `tools.build:defines` + * `tools.build:sharedlinklags` + * `tools.build:exelinkflags` + * `tools.apple:enable_bitcode` (only if host OS is `iOS`/`watchOS`/`tvOS`) -* On *nix systems, executables and shared libraries should have empty `RPATH`/`RUNPATH`/`LC_RPATH`. +* Multithread build (if supported by underlying build system): + * if some steps are sensitive to race conditions, monothread should be enforced. + * otherwise multithreaded build should be enabled with a number of cores controlled by `tools.build:jobs` conf from host profile if it is set, otherwise to all cores of build machine. -* On macOS, install name in `LC_ID_DYLIB` section of shared libs must be `@rpath/`. +## Package Method + +* CMake config files must be removed. They will be generated for consumers by `CMakeDeps` generator (or legacy `cmake_find_package`/`cmake_find_package_multi` generators). + +* pkg-config files must be removed. They will be generated for consumers by `PkgConfigDeps` generator (or legacy `pkg_config` generator). + +* On *nix systems, executables and shared libraries should have empty `RPATH`/`RUNPATH`/`LC_RPATH`. Though, a relative path pointing inside package itself is allowed. + +* On Apple OS family: + * shared libs: name field of `LC_ID_DYLIB` load command must be `@rpath/`. + * shared libs & executables: name field of each `LC_LOAD_DYLIB` load command should be `@rpath/` (except those refering to system libs or frameworks). * Installed files must not contain absolute paths specific to build machine. Relative paths to other packages is also forbidden since relative paths of dependencies during build may not be the same for consumers. Hardcoded relative paths pointing to a location in the package itself are allowed. + +* Static and shared flavors of the same library must not be packaged together. + +## Build System Examples + +The [Conan's documentation](https://docs.conan.io) is always a good place for technical details. +General patterns about how they can be used for OSS in ConanCenterIndex can be found in the +[package templates](../package_templates/README.md) sections. These are excellent to copy and start from. + +### Header Only + +If you are looking for header-only projects, you can take a look on [header-only template](../package_templates/header_only). +Also, Conan Docs have 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 [cmake package template](../package_templates/cmake_package). + +Another common use case for CMake based projects, both header only and compiled, is _modeling components_ to match the `find_package` and export the correct targets from Conan's generators. A basic examples of this is [cpu_features](https://github.com/conan-io/conan-center-index/blob/master/recipes/cpu_features/all/conanfile.py), a moderate/intermediate example is [cpprestsdk](https://github.com/conan-io/conan-center-index/blob/master/recipes/cpprestsdk/all/conanfile.py), and a very complex example is [OpenCV](https://github.com/conan-io/conan-center-index/blob/master/recipes/opencv/4.x/conanfile.py). + +### Autotools + +There is an [autotools package template](../package_templates/autotools_package/) amiable to start from. + +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). + +Many projects offer [**pkg-config**'s](https://www.freedesktop.org/wiki/Software/pkg-config/) `*.pc` files which need to be modeled using components. A prime example of this is [Wayland](https://github.com/conan-io/conan-center-index/blob/master/recipes/wayland/all/conanfile.py). + +### No Upstream Build Scripts + +For cases where a project only offers source files, but not a build script, you can add CMake support, but first, contact the upstream and open a PR offering building support. If it's rejected because the author doesn't want any kind of build script, or the project is abandoned, CCI can accept your build script. Take a look at [Bzip2](https://github.com/conan-io/conan-center-index/blob/master/recipes/bzip2/all/CMakeLists.txt) and [DirectShowBaseClasses](https://github.com/conan-io/conan-center-index/blob/master/recipes/directshowbaseclasses/all/CMakeLists.txt) as examples. + +### System Packages + +> **Note**: For exceptional cases where only system packages can be used and a regular Conan package may result in an incompatible and fragile package, a separated system package may be created. See the [FAQs](../faqs.md#can-i-install-packages-from-the-system-package-manager) for more. + +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 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. diff --git a/docs/adding_packages/conanfile_attributes.md b/docs/adding_packages/conanfile_attributes.md index 64d658a2e63030..c420841db7d016 100644 --- a/docs/adding_packages/conanfile_attributes.md +++ b/docs/adding_packages/conanfile_attributes.md @@ -39,32 +39,26 @@ Where the SPDX guidelines do not apply, packages should do the following: ## Settings -All recipes should list the four settings `os`, `arch`, `compiler` and `build_type` so Conan will compute a different package ID -for each combination. There are some particular cases for this general rule: +As a general rule, recipes should set the `settings` attribute to: `os`, `arch`, `compiler` and `build_type`, and let Conan compute the package ID based on the settings. Some exceptions apply, as detailed below. For cases not covered here, please reach out to the Conan Center maintainers team for assistance. The following list is not exhaustive: -* **Recipes for _header only_ libraries** might omit the `settings` attribute, but in any case they should add +* **Recipes for _header only_ libraries** or where the contents of the package are the same irrespective of settings, might omit the `settings` attribute altogether, unless there is any logic conditional on a setting value. If the recipe has options or dependencies, but the contents of the package are invariant irrespective of their values, the following logic must be added to ensure a single, unique package ID: ```python def package_id(self): self.info.clear() ``` -* **Recipes that provide applications** (`b2`, `cmake`, `make`,...) that are generally used as a _build requires_, must list all - the settings as well, but they should remove the `compiler` one in the corresponding method unless the recipe provides also - libraries that are consumed by other packages: +* **Recipes that primarily provide _compiled_ applications** (e.g. `b2`, `cmake`, `make`, ...), which typically applies to packages that are consumed as _tool requires_) must list all + the settings as well, as they are required during package creation. However, it is advised that the `compiler` setting is removed one in the `package_id()` method as follows: ```python def package_id(self): del self.info.settings.compiler ``` - Removing the `compiler` setting reduces the number of configurations generated by the CI, reducing the time and workload and, at the - same time, demonstrates the power of Conan behind the package ID logic. + This reflects those cases where tools are consumed exclusively as executables, irrespective of how they were built. Additionally, this reduces the number of configurations generated by CI. - > **Note** Intentionally, the `build_type` setting should not be removed from the package ID in this case. Preserving this - > setting will ensure that the package ID for Debug and Release configurations will be different and both binaries can be - > available in the Conan cache at the same time. This enable consumers to switch from one configuration to the other in the case - > they want to run or to debug those executables. + > **Note** We do not recommend removing the `build_type` setting on these packages, in order to preserve the ability of consumers to run debug executables should they wish to do so. ## Options diff --git a/docs/adding_packages/dependencies.md b/docs/adding_packages/dependencies.md index 5fbec299727654..ec2c2650598240 100644 --- a/docs/adding_packages/dependencies.md +++ b/docs/adding_packages/dependencies.md @@ -1,20 +1,193 @@ # Dependencies -This section outlines all the practices and guidelines for the `requirements()` and `build_requirements()` methods. This includes everything from "vendored" dependencies to -when and how the versions could be changed. +This section outlines all the practices and guidelines for the `requirements()` and `build_requirements()` methods. This includes everything +from handling "vendored" dependencies to what versions should be used. ## Contents - * [Rules](#rules) + * [List Dependencies](#list-dependencies) + * [Optional Requirements](#optional-requirements) + * [Build Requirements](#build-requirements) + * [Accessing Dependencies](#accessing-dependencies) + * [Handling Requirement's Options](#handling-requirements-options) + * [Verifying Dependency's Version](#verifying-dependencys-version) + * [Passing Requirement's info to `build()`](#passing-requirements-info-to-build) + * [Overriding the provided properties from the consumer](#overriding-the-provided-properties-from-the-consumer) + * [Adherence to Build Service](#adherence-to-build-service) + * [Version Ranges](#version-ranges) + * [Handling "internal" dependencies](#handling-internal-dependencies) -## Rules +## List Dependencies -* [Version range](https://docs.conan.io/en/latest/versioning/version_ranges.html) is not allowed. +Since all ConanCenterIndex recipes are to build and/or package projects they are exclusively done in [`conanfile.py`](https://docs.conan.io/en/latest/reference/conanfile.html). This offers a few +ways to add requirements. The most common way is [requirements](https://docs.conan.io/en/latest/reference/conanfile/methods.html#requirements): + +```py + def requirements(self): + self.requires("fmt/9.1.0") +``` + +> **Note**: With Conan 2.0, you'll also need to pay attention to new properties like the `transitive_header` attributed which is +> needed when a project include a dependencies header files in its public headers. + +When a project supports a range of version of a dependency, it's generally advised to pick the **most recent available in ConanCenter**. +This helps ensure there are fewer conflicts with other, up to-date, recipes that share the same requirement. + +### Optional Requirements + +Many projects support enabling certain features by adding dependencies. In ConanCenterIndex this is done by adding an option, see +[naming recommendation](conanfile_attributes.md#recommended-names), which should be set to match the upstream project's by default. + +```py +class ExampleConan(ConanFile): + options = { + "with_zlib": [True, False], # Possible values + } + default_options = { + "with_zlib": True, # Should match upstream's CMakeLists.txt `option(...)` + } + + def requirements(self): + if self.options.with_zlib: + self.requires("zlib/1.2.13") +``` + +If a dependency was added (or removed) with a release, then the `if` condition could check [`self.version`](https://docs.conan.io/en/latest/reference/conanfile/attributes.html#version). Another common case is +`self.settings.os` dependant requirements which need to be added for certain plaforms. + +### Build Requirements + +In ConanCenter we only assume +[CMake is available](../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). +If a project requires any other specific tool, those can be added as well. We like to do this with [build_requirements](https://docs.conan.io/en/latest/reference/conanfile/methods.html#build-requirements): + +```py + def build_requirements(self): + self.tool_requires("ninja/1.1.0") +``` + +## Accessing Dependencies + +It's fairly common to need to pass information from a dependency to the project. This is the job of the [`generate()`](https://docs.conan.io/en/latest/reference/conanfile/methods.html#generate) method. This +is generally covered by the built-in generators like [`CMakeDeps`](https://docs.conan.io/en/latest/reference/conanfile/tools/cmake/cmakedeps.html) +However the [`self.dependencies`](https://docs.conan.io/en/latest/reference/conanfile/dependencies.html?highlight=generate) are available. + +Alternatively, a project may depend on a specific versions or configuration of a dependency. This use case is again covered by the +[`self.dependencies`](https://docs.conan.io/en/latest/reference/conanfile/dependencies.html?highlight=validate) within the +[`validate()`](https://docs.conan.io/en/latest/reference/conanfile/methods.html#validate) method. Additionally it's possible to suggest the option's values while the graph is built through [`configure()`](https://docs.conan.io/en/latest/reference/conanfile/methods.html#configure-config-options) +this is not guaranteed and not a common practice. + +### Handling Requirement's Options + +Forcing options of dependencies inside a ConanCenter should be avoided, except if it is mandatory for the library to build. +Our general belief is the users input should be the most important; it's unexpected for command line arguments to be over ruled +by specifc recipes. + +You need to use the [`validate()`](https://docs.conan.io/en/latest/reference/conanfile/methods.html#validate) method in order to ensure they check after the Conan graph is completely built. + +Certain projects are dependent on the configuration (also known as options) of a dependency. This can be enforced in a recipe by +accessing the [`options`](https://docs.conan.io/en/latest/reference/conanfile/dependencies.html?highlight=options) field of +the dependency. + +```py + def configure(self): + self.options["foobar"].enable_feature = True # This will still allow users to override this option + + def validate(self): + if not self.dependencies["foobar"].options.enable_feature: + raise ConanInvalidConfiguration(f"{self.ref} requires foobar/*:enable_feature=True.") +``` + +### Verifying Dependency's Version + +Some project requirements need to respect a version constraint, this can be done as follows: + +```py +def validate(self): + if Version(self.dependencies["foobar"].ref.version) < "1.2": + raise ConanInvalidConfiguration(f"{self.ref} requires [foobar>=1.2] to build and work.") +``` + +### Passing Requirement's info to `build()` + +The [`self.dependencies`](https://docs.conan.io/en/latest/reference/conanfile/dependencies.html) are limited to [`generate()`](https://docs.conan.io/en/latest/reference/conanfile/methods.html#generate) and [`validate()`](https://docs.conan.io/en/latest/reference/conanfile/methods.html#validate). This means configuring a projects build scripts +is a touch more complicated when working with unsupported build scripts. + +In general, with [CMake](https://cmake.org/) project, this can be very simple with the [`CMakeToolchain`](https://docs.conan.io/en/latest/reference/conanfile/tools/cmake/cmaketoolchain.html), such as: + +```py + def generate(self): + tc = CMakeToolchain(self) + # deps_cpp_info, deps_env_info and deps_user_info are no longer used + if self.dependencies["dependency"].options.foobar: + tc.variables["DEPENDENCY_LIBPATH"] = self.dependencies["dependency"].cpp_info.libdirs +``` + +This pattern can be recreated for less common build system by, generating a script to call configure or capture the +required values in a YAML files for example. + +> **Note**: This needs to be saved to disk because the [`conan install`](https://docs.conan.io/en/latest/reference/commands/consumer/install.html) and [`conan build`](https://docs.conan.io/en/latest/reference/commands/development/build.html) commands can be separated when +> developing packages so for this reason the `class` may not persists the information. This is a very common workflow, +> even used in ConanCenter in other areas such as testing. + +```py +from conan import ConanFile +from conan.tools.files import save, load + + +class ExampleConan(ConanFile): + _optional_build_args = [] + + @property + def _optional_build_args_filename(self): + return os.path.join(self.recipe_folder, self.folders.generators, "build_args.yml") + + def generate(self): + # This is required as `self.dependencies` is not available in `build()` or `test()` + if self.dependencies["foobar"].options.with_compression: + self._optional_build_args.append("--enable-foobar-compression") + + save(self, self._optional_build_args_filename, file) + + def build(self): + opts_args = load(self, self._optional_build_args_filename) + # Some magic setup + self.run(f"./configure.sh {opts_args}") +``` + +### Overriding the provided properties from the consumer + +> **Note**: This was adding in [Conan 1.55](https://github.com/conan-io/conan/pull/12609) to the generators... we need to +> write docs for when that's available + +## Adherence to Build Service + +It's very rare we layout "rules", most often it's guidelines, however in order to ensure graph and the package generated are usable +for consumer, we do impose some limits on Conan features to provide a smoother first taste to using Conan. + +> **Note**: These are very specific to the ConanCenter being the default remote and may not be relevant to your specifc use case. + +* [Version ranges](https://docs.conan.io/en/latest/versioning/version_ranges.html) are not allowed. * Specify explicit [RREV](https://docs.conan.io/en/latest/versioning/revisions.html) (recipe revision) of dependencies is not allowed. -* Vendoring in library source code should be removed (best effort) to avoid potential ODR violations. If upstream takes care to rename - symbols, it may be acceptable. * Only ConanCenter recipes are allowed in `requires`/`requirements()` and `build_requires`/`build_requirements()`. -* If a requirement is conditional, this condition must not depend on [build context](https://docs.conan.io/en/1.35/devtools/build_requires.html#build-and-host-contexts). Build requirements don't have this constraint. -* Forcing options of dependencies inside a recipe should be avoided, except if it is mandatory for the library - in which case it must - be enforced through the `validate()` methods. +* [`python_requires`](https://docs.conan.io/en/latest/reference/conanfile/other.html#python-requires) are not allowed. + +### Version Ranges + +Version ranges are a useful Conan feature, [documentation here](https://docs.conan.io/en/latest/versioning/version_ranges.html). However, +in the context of ConanCenter they pose a few key challenges when being used generally to consume packages, most notably: + +* Non-Deterministic `package-id`: With version ranges the newest compatible package may yield a different `package_id` than the one built + and published by ConanCenter resulting in frustrating error "no binaries found". For more context + see [this excellent explanation](https://github.com/conan-io/conan-center-index/pull/8831#issuecomment-1024526780). + +* Build Reproducibility: If consumers try to download and build the recipe at a later time, it may resolve to a different package version + that may generate a different binary (that may or may not be compatible). In order to prevent these types of issues, we have decided to + only allow exact requirements versions. This is a complicated issue, + [check this thread](https://github.com/conan-io/conan-center-index/pull/9140#discussion_r795461547) for more information. + +## Handling "internal" dependencies + +Vendoring in library source code should be removed (best effort) to avoid potential ODR violations. If upstream takes care to rename +symbols, it may be acceptable. diff --git a/docs/adding_packages/test_packages.md b/docs/adding_packages/test_packages.md index f8524f848e577f..c37f824816aba2 100644 --- a/docs/adding_packages/test_packages.md +++ b/docs/adding_packages/test_packages.md @@ -29,7 +29,7 @@ Please refer to the [Package Templates](../package_templates/) for the current p When using CMake to test a package, the information should be consumed using the [`CMakeDeps` generator](https://docs.conan.io/en/latest/reference/conanfile/tools/cmake/cmakedeps.html?highlight=cmakedeps). -This typicall will look like a `CMakeLists.txt` which contain lines similar to +This typically will look like a `CMakeLists.txt` which contain lines similar to ```cmake find_package(fmt REQUIRED CONFIG) @@ -37,7 +37,7 @@ find_package(fmt REQUIRED CONFIG) target_link_libraries(test_ranges PRIVATE fmt::fmt) ``` -Refere to the [package template](https://github.com/conan-io/conan-center-index/blob/master/docs/package_templates/cmake_package/all/test_package/CMakeLists.txt) for more examples. +Refer to the [package template](https://github.com/conan-io/conan-center-index/blob/master/docs/package_templates/cmake_package/all/test_package/CMakeLists.txt) for more examples. > **Notes** It's still important to test targets provided by `cmake_find_package[_multi]` generators. > It should help in the migration (and compatibility) with Conan v2. See [v1 test package template](https://github.com/conan-io/conan-center-index/blob/master/docs/package_templates/cmake_package/all/test_v1_package/CMakeLists.txt) for details. diff --git a/docs/changelog.md b/docs/changelog.md index c267cd2dd95486..3d487db19d2c3d 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,40 @@ # Changelog +### 12-January-2023 - 19:33 CET + +- [fix] Fix Conan v2 download/upload recipe commands. + +### 12-January-2023 - 11:21 CET + +- [feature] Add support for Conan v2 beta 7. +- [feature] Check complete Conan version on ValidateInfrastructure. +- [fix] Increase `conan test` timeout value. +- [fix] Fix stage name when calculating build configurations. + +### 10-January-2023 - 15:20 CET + +- [feature] Add entry in config to disable merging labels from the multibranch job. +- [feature] Add timeout to `conan test` command. +- [feature] Add API wrapper support for status page. +- [refactor] Separate build configuration calculation from pull-request interaction (labels/comments). +- [feature] Take main repository from configuration for Tapaholes jobs. + +### 15-December-2022 - 11:12 CET + +- [feature] Set github feeback title via config file (`feedback_title`). +- [fix] Fix log summary html table for shared option with Conan v2. +- [fix] ValidateInfra: Remove same OS version check for Macos nodes. + +### 09-December-2022 - 11:38 CET + +- [feature] Add environment variable to build with different Xcode/apple-clang compilers on Macos agents. +- [feature] Add `MACOSX_DEPLOYMENT_TARGET` and `SDKROOT` env variables to build stages on Macos. +- [feature] Add `LongPathsEnabled` registry key check on Windows to Validate Infrastructure job. +- [fix] Fix git user on commits when updating docs for supported platforms and configurations. +- [fix] Fix getting commit hash when writing GitHub error messages. +- [fix] Fix Conan v2 inspect command. +- [fix] Fix condition when waiting for another job to finish. + ### 14-November-2022 - 11:54 CET - [feature] Disable inactivity count for Access Request job. diff --git a/docs/developing_recipes_locally.md b/docs/developing_recipes_locally.md index a9af9f65023518..afd59e641ddaa4 100644 --- a/docs/developing_recipes_locally.md +++ b/docs/developing_recipes_locally.md @@ -151,10 +151,8 @@ schema validation. There's are to encourage the best possible quality of recipes ```sh # Lint a recipe: - yamllint --config-file linter/yamllint_rules.yml -f standard recipes/fmt/all/conanfile.py - - # Lint the test_package (same command) - yamllint --config-file linter/yamllint_rules.yml -f standard recipes/fmt/all/test_package/conanfile.py + yamllint --config-file linter/yamllint_rules.yml -f standard recipes/config.yml + yamllint --config-file linter/yamllint_rules.yml -f standard recipes/fmt/all/conandata.yml ``` ### Yamlschema diff --git a/docs/error_knowledge_base.md b/docs/error_knowledge_base.md index c58e8eba4b82bd..655573acf72d89 100644 --- a/docs/error_knowledge_base.md +++ b/docs/error_knowledge_base.md @@ -1,5 +1,7 @@ # Errors from the conan-center hook (KB-Hxxx) +These are located at [conan-io/hooks](https://github.com/conan-io/hooks/blob/master/hooks/conan-center.py). + #### **#KB-H001: "DEPRECATED GLOBAL CPPSTD"** `Conan > 1.15` deprecated the usage of the global ``cppstd`` setting in favor of ``compiler.cppstd`` to [manage C++ standard](https://docs.conan.io/en/latest/howtos/manage_cpp_standard.html). As a subsetting of the compiler, it shouldn't be declared in the `conanfile.py`. @@ -63,7 +65,7 @@ Here we use [configure()](https://docs.conan.io/en/latest/reference/conanfile/me #### **#KB-H008: "VERSION RANGES"** -It is not allowed to use [version ranges](https://docs.conan.io/en/latest/versioning/version_ranges.html) for the recipes in Conan center, where the dependency graph should be deterministic. +See [Dependencies Version Ranges](adding_packages/dependencies.md#version-ranges) for details. #### **#KB-H009: "RECIPE FOLDER SIZE"** @@ -110,7 +112,12 @@ The binary packages should contain a folder named `licenses` containing the cont #### **#KB-H013: "DEFAULT PACKAGE LAYOUT"** -The binary packages shouldn't contain any other files or folder except the following: `["lib", "bin", "include", "res", "licenses"]`. If you are packaging an application put all the contents inside the `bin` folder. +The binary packages generally do not need any other files or folder except the following: `["lib", "bin", "include", "res", "licenses"]`. +This closely matches the default [`cpp_info`](https://docs.conan.io/en/latest/reference/conanfile/methods.html#package-info) from the client. +The upstream package layout should be followed as much as possible, if a folder is not in the list (like `"share"`) then an exception +can very easily be added by adding it to [this list of exceptions](https://github.com/conan-io/hooks/blob/d587cfebbf2b31c16e477b79c0c2fd4501f60fc8/hooks/conan-center.py#L1089-L1090). + +> **Note**: We are in the process of evaluating this rule, looking at calculating the size impact for problematic packages #### **#KB-H014: "MATCHING CONFIGURATION"** @@ -445,7 +452,7 @@ class SomeRecipe(ConanFile): There is the case when the package is header-only, but the options affects the generated artifact, (e.g. kanguru, pagmo2 ...), so you need to use `self.info.settings.clear()` instead. -- For "tool" recipes ([example](https://github.com/conan-io/conan-center-index/blob/e604534bbe0ef56bdb1f8513b83404eff02aebc8/recipes/cmake/3.x.x/conanfile.py#L104-L105)) which only provide binaries, see [our packing policy](adding_packages/conanfile_attributes.md#settings) for more, should do as follows: +- @prince-chrismc This needs to a better example; For "tool" recipes ([example](https://github.com/conan-io/conan-center-index/blob/e604534bbe0ef56bdb1f8513b83404eff02aebc8/recipes/cmake/3.x.x/conanfile.py#L104-L105)) which only provide binaries, see [our packaging policy](adding_packages/build_and_package.md) for more, should do as follows: ```python def package_id(self): diff --git a/docs/faqs.md b/docs/faqs.md index 405ebcf4f7f822..6b255f700113e4 100644 --- a/docs/faqs.md +++ b/docs/faqs.md @@ -11,6 +11,7 @@ This section gathers the most common questions from the community related to pac * [Why are CMake find/config files and pkg-config files not packaged?](#why-are-cmake-findconfig-files-and-pkg-config-files-not-packaged) * [Should recipes export a recipe's license?](#should-recipes-export-a-recipes-license) * [Why recipes that use build tools (like CMake) that have packages in Conan Center do not use it as a build require by default?](#why-recipes-that-use-build-tools-like-cmake-that-have-packages-in-conan-center-do-not-use-it-as-a-build-require-by-default) + * [How are rare build systems without generators packaged?](#how-are-rare-build-systems-without-generators-packaged) * [Are python requires allowed in the `conan-center-index`?](#are-python-requires-allowed-in-the-conan-center-index) * [What version should packages use for libraries without official releases?](#what-version-should-packages-use-for-libraries-without-official-releases) * [Is the Jenkins orchestration library publicly available?](#is-the-jenkins-orchestration-library-publicly-available) @@ -38,7 +39,9 @@ This section gathers the most common questions from the community related to pac * [How to consume a graph of shared libraries?](#how-to-consume-a-graph-of-shared-libraries) * [How to watch only specific recipes?](#how-to-watch-only-specific-recipes) * [Is it possible to disable Pylint?](#is-it-possible-to-disable-pylint) - * [How long can I be inactive before being removed from the authorized users list?](#how-long-can-i-be-inactive-before-being-removed-from-the-authorized-users-list) + * [How long can I be inactive before being removed from the authorized users list?](#how-long-can-i-be-inactive-before-being-removed-from-the-authorized-users-list) + * [Can we add package which are parts of bigger projects like Boost?](#can-we-add-package-which-are-parts-of-bigger-projects-like-boost) + * [Can I add my project which I will submit to Boost?](#can-i-add-my-project-which-i-will-submit-to-boost) ## What is the policy on recipe name collisions? @@ -97,11 +100,22 @@ No, recipes do not need to export a recipe license. Recipes and all files contri We generally consider tools like CMake as a standard tool to have installed in your system. Having the `cmake` package as a build require in **all** the recipes that use it will be an overkill, as every build requirement is installed like a requirement and takes time to download. However, `cmake` could still be useful to use in your profile: ``` -[build_requires] +[tool_requires] cmake/3.17.2 ``` -Other packages using more unusual build tools, like `OpenSSL` using `strawberryperl`, will have the build require in the recipe as it is likely that the user that want to build it from sources will not have it installed in their system +Other packages using more unusual build tools should refer to the [Dependencies - Adding Build Requirements](adding_packages/dependencies.md#build-requirements) section for more information. + +## How are rare build systems without generators packaged? + +The C++ ecosystem has a lot of rare, unique and obscure build systems. Some of these are available in ConanCenter but they do not have built-in generators from the main Conan client. +The recipe is expected to encode the specifics of the build system, mapping the `settings`, `options` for the binary configuration, and also mapping `self.dependencies` so the build system can locate the dependencies libraries as required. +For these cases, contributors are asked to help reviewers as much as possible as it's likely we will not have expertise. + +> TODO: Add a link to docs.conan.io which explains how to write a custom generator in the 2.0 sense + +For quality assurance the build service is expected to be green and the [hooks](https://github.com/conan-io/hooks) will ensure the package contents match what is expected given the options. These recipes are more likely to have +inconsistency with other recipes but make for excellent contributions. ## Are python requires allowed in the `conan-center-index`? @@ -242,7 +256,7 @@ The hook [KB-H032](error_knowledge_base.md#KB-H032) does not allow `system_requi system packages at same recipe. There are exceptions where some projects are closer to system drivers or hardware and packaging as a regular library could result -in an incompatible Conan package. To deal with those cases, you are allowed to provide an exclusive Conan package which only installs system packages, see the [How-to](adding_packages/README.md#system-packages) for more. +in an incompatible Conan package. To deal with those cases, you are allowed to provide an exclusive Conan package which only installs system packages, see the [How-to](adding_packages/build_and_package.md#system-packages) for more. ## Why ConanCenter does **not** build and execute tests in recipes @@ -354,15 +368,7 @@ Keep reading in the [consuming recipes section](consuming_recipes.md#isolate-you ## Why are version ranges not allowed? -Version ranges are a useful Conan feature, find the documentation [here](https://docs.conan.io/en/latest/versioning/version_ranges.html). However, in the context of ConanCenter they pose a few key challenges, most notably: - -- Non-Deterministic `package-id` - -With version ranges the newest compatible package may yield a different package-id than the one built and published by ConanCenter resulting in frustrating error "no binaries found". For more context see [this excellent explanation](https://github.com/conan-io/conan-center-index/pull/8831#issuecomment-1024526780). - -- Build Reproducibility - -If consumers try to download and build the recipe at a later time, it may resolve to a different package version that may generate a different binary (that may or may not be compatible). In order to prevent these types of issues, we have decided to only allow exact requirements versions. This is a complicated issue, check [this thread](https://github.com/conan-io/conan-center-index/pull/9140#discussion_r795461547) for more. +See [Dependencies Version Ranges](adding_packages/dependencies.md#version-ranges) for details. ## How to consume a graph of shared libraries? @@ -410,3 +416,15 @@ difficult to understand [linter errors](linters.md), please comment on your pull ## How long can I be inactive before being removed from the authorized users list? Please, read [Inactivity and user removal section](adding_packages/README.md#inactivity-and-user-removal). + +## Can we add package which are parts of bigger projects like Boost? + +Sadly no. There have been many efforts in the past and we feel it's not sustainable given the number of combinations of libraries and version. See #14660 for recent discussions. + +There is one main "boost" recipe with many versions maintained. + +There are good arguments for permitting some boost libraries but we feel doing so is not fair to the rest. + +### Can I add my project which I will submit to Boost? + +Yes, but make sure it does not have Boost in the name. Use the [`author-name` convention](https://github.com/conan-io/conan-center-index/blob/master/docs/faqs.md#what-is-the-policy-on-recipe-name-collisions) so there are no conflicts. diff --git a/docs/package_templates/autotools_package/all/conandata.yml b/docs/package_templates/autotools_package/all/conandata.yml index 0cb43769c334ff..629a5640adc163 100644 --- a/docs/package_templates/autotools_package/all/conandata.yml +++ b/docs/package_templates/autotools_package/all/conandata.yml @@ -17,9 +17,7 @@ patches: 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/autotools_package/all/conanfile.py b/docs/package_templates/autotools_package/all/conanfile.py index 6620e517ff6db5..819b60ea8dd630 100644 --- a/docs/package_templates/autotools_package/all/conanfile.py +++ b/docs/package_templates/autotools_package/all/conanfile.py @@ -75,10 +75,10 @@ def requirements(self): def validate(self): # validate the minimum cpp standard supported. Only for C++ projects - if self.info.settings.compiler.get_safe("cppstd"): + if self.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 self.settings.os not in ["Linux", "FreeBSD", "MacOS"]: + raise ConanInvalidConfiguration(f"{self.ref} is not supported on {self.settings.os}.") # if another tool than the compiler or autotools is required to build the project (pkgconf, bison, flex etc) def build_requirements(self): @@ -97,7 +97,7 @@ def build_requirements(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], strip_root=True) def generate(self): # inject tool_requires env vars in build scope (not needed if there is no tool_requires) @@ -157,7 +157,7 @@ def build(self): def package(self): copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) autotools = Autotools(self) - # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed + # TODO: replace by autotools.install() once Conan 1.54 is available in CCI 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. diff --git a/docs/package_templates/cmake_package/all/conandata.yml b/docs/package_templates/cmake_package/all/conandata.yml index 0cb43769c334ff..629a5640adc163 100644 --- a/docs/package_templates/cmake_package/all/conandata.yml +++ b/docs/package_templates/cmake_package/all/conandata.yml @@ -17,9 +17,7 @@ patches: 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/cmake_package/all/conanfile.py b/docs/package_templates/cmake_package/all/conanfile.py index 13a2108b0e8f3b..ee4c716b4e9d73 100644 --- a/docs/package_templates/cmake_package/all/conanfile.py +++ b/docs/package_templates/cmake_package/all/conanfile.py @@ -75,17 +75,17 @@ def requirements(self): def validate(self): # validate the minimum cpp standard supported. For C++ projects only - if self.info.settings.compiler.cppstd: + if self.settings.compiler.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: + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration( f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." ) # in case it does not work in another configuration, it should validated here too - if is_msvc(self) and self.info.options.shared: + if is_msvc(self) and self.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 CMake is required to build the project (pkgconf, bison, flex etc) @@ -93,7 +93,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], 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 diff --git a/docs/package_templates/cmake_package/all/test_package/CMakeLists.txt b/docs/package_templates/cmake_package/all/test_package/CMakeLists.txt index 00e3c3ca60a6d4..bf37e23371cba0 100644 --- a/docs/package_templates/cmake_package/all/test_package/CMakeLists.txt +++ b/docs/package_templates/cmake_package/all/test_package/CMakeLists.txt @@ -1,7 +1,7 @@ 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 CXX) # if the project uses c++ find_package(package REQUIRED CONFIG) diff --git a/docs/package_templates/header_only/all/conandata.yml b/docs/package_templates/header_only/all/conandata.yml index 0cb43769c334ff..629a5640adc163 100644 --- a/docs/package_templates/header_only/all/conandata.yml +++ b/docs/package_templates/header_only/all/conandata.yml @@ -17,9 +17,7 @@ patches: 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/header_only/all/conanfile.py b/docs/package_templates/header_only/all/conanfile.py index 1f987bd08a8da8..b268d9251b28e4 100644 --- a/docs/package_templates/header_only/all/conanfile.py +++ b/docs/package_templates/header_only/all/conanfile.py @@ -14,21 +14,23 @@ 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-" + # In case it's 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 - # Keep 'hearder-only' as topic + # Do not put "conan" nor the project name in topics. Use topics from the upstream listed on GH + # Keep 'header-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 + # Keep these or explain why it's not required for this particular case + settings = "os", "arch", "compiler", "build_type" + # Do not copy sources to build folder for header only projects, unless you need to apply patches + no_copy_source = True @property def _min_cppstd(self): return 14 - # in case the project requires C++14/17/20/... the minimum compiler version should be listed + # In case the project requires C++14/17/20/... the minimum compiler version should be listed @property def _compilers_minimum_version(self): return { @@ -39,18 +41,18 @@ def _compilers_minimum_version(self): "apple-clang": "5.1", } - # no exports_sources attribute, but export_sources(self) method instead - # this allows finer grain exportation of patches per version + # Use the export_sources(self) method instead of the exports_sources attribute. + # This allows finer grain exportation of patches per version def export_sources(self): export_conandata_patches(self) def layout(self): - # src_folder must use the same source folder name the project + # src_folder must use the same source folder name than the project basic_layout(self, src_folder="src") def requirements(self): - # prefer self.requires method instead of requires attribute - # direct dependencies of header only libs are always transitive since they are included in public headers + # Prefer self.requires method instead of requires attribute + # 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 @@ -58,30 +60,29 @@ def package_id(self): self.info.clear() def validate(self): - # FIXME: `self.settings` is not available in 2.0 but there are plenty of open issues about - # the migration point. For now we are only going to write valid 1.x recipes until we have a proper answer if self.settings.compiler.get_safe("cppstd"): - # validate the minimum cpp standard supported when installing the package. For C++ projects only + # Validate the minimum cpp standard supported when installing the package. For C++ projects only check_min_cppstd(self, self._min_cppstd) minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) if minimum_version and Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration( f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." ) - # in case it does not work in another configuration, it should validated here too + + # In case this library does not work in some another configuration, it should be validated here too if self.settings.os == "Windows": raise ConanInvalidConfiguration(f"{self.ref} can not be used on Windows.") 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) + # Download source package and extract to source folder + get(self, **self.conan_data["sources"][self.version], strip_root=True) - # not mandatory when there is no patch, but will suppress warning message about missing build() method + # Not mandatory when there is no patch, but will suppress warning message about missing build() method def build(self): # The attribute no_copy_source should not be used when applying patches in build apply_conandata_patches(self) - # copy all files to the package folder + # 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( @@ -92,21 +93,24 @@ def package(self): ) def package_info(self): - # folders not used for header-only + # Folders not used for header-only self.cpp_info.bindirs = [] self.cpp_info.libdirs = [] - # if package has an official FindPACKAGE.cmake listed in https://cmake.org/cmake/help/latest/manual/cmake-modules.7.html#find-modules + # Set these to the appropriate values if the 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... self.cpp_info.set_property("cmake_module_file_name", "PACKAGE") self.cpp_info.set_property("cmake_module_target_name", "PACKAGE::PACKAGE") - # if package provides a CMake config file (package-config.cmake or packageConfig.cmake, with package::package target, usually installed in /lib/cmake//) + # Set these to the appropriate values if package provides a CMake config file + # (package-config.cmake or packageConfig.cmake, with package::package target, usually installed in /lib/cmake//) self.cpp_info.set_property("cmake_file_name", "package") self.cpp_info.set_property("cmake_target_name", "package::package") - # if package provides a pkgconfig file (package.pc, usually installed in /lib/pkgconfig/) + # Set this to the appropriate value if the 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 + # Add m, pthread and dl if needed in Linux/FreeBSD if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["dl", "m", "pthread"]) 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 58ff75575bd54b..bf8eccb9b5b0a0 100644 --- a/docs/package_templates/header_only/all/test_package/CMakeLists.txt +++ b/docs/package_templates/header_only/all/test_package/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES C) # if the project is pure C -project(test_package LANGUAGES CXX) # if the project uses c++ +# project(test_package LANGUAGES CXX) # if the project uses c++ find_package(package REQUIRED CONFIG) diff --git a/docs/package_templates/meson_package/all/conandata.yml b/docs/package_templates/meson_package/all/conandata.yml index 9d0f08dfa76d4b..f73df4b4f1645d 100644 --- a/docs/package_templates/meson_package/all/conandata.yml +++ b/docs/package_templates/meson_package/all/conandata.yml @@ -16,9 +16,7 @@ patches: 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 index 3e9e0431e7ed95..32a498ac2564b8 100644 --- a/docs/package_templates/meson_package/all/conanfile.py +++ b/docs/package_templates/meson_package/all/conanfile.py @@ -78,12 +78,12 @@ def requirements(self): def validate(self): # validate the minimum cpp standard supported. For C++ projects only - if self.info.settings.compiler.get_safe("cppstd"): + if self.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: + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration( f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." ) @@ -100,7 +100,7 @@ def build_requirements(self): 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): # default_library and b_staticpic are automatically parsed when self.options.shared and self.options.fpic exist diff --git a/docs/package_templates/msbuild_package/all/conandata.yml b/docs/package_templates/msbuild_package/all/conandata.yml index 0cb43769c334ff..629a5640adc163 100644 --- a/docs/package_templates/msbuild_package/all/conandata.yml +++ b/docs/package_templates/msbuild_package/all/conandata.yml @@ -17,9 +17,7 @@ patches: 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/msbuild_package/all/conanfile.py b/docs/package_templates/msbuild_package/all/conanfile.py index ae7b3c4c2484c2..332dbfb867b379 100644 --- a/docs/package_templates/msbuild_package/all/conanfile.py +++ b/docs/package_templates/msbuild_package/all/conanfile.py @@ -1,7 +1,8 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.microsoft import is_msvc, vs_layout, MSBuildDeps, MSBuildToolchain, MSBuild, VCVars -from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, replace_in_file +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, MSBuild, MSBuildDeps, MSBuildToolchain import os @@ -45,7 +46,7 @@ def configure(self): self.settings.rm_safe("compiler.cppstd") def layout(self): - vs_layout(self) + basic_layout(self, src_folder="src") def requirements(self): # prefer self.requires method instead of requires attribute @@ -61,46 +62,71 @@ 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], strip_root=True) + + @property + def _msbuild_configuration(self): + # Customize to Release when RelWithDebInfo or MinSizeRel, if upstream build files + # don't have RelWithDebInfo and MinSizeRel. + # Moreover: + # - you may have to change these values if upstream build file uses custom configuration names. + # - configuration of MSBuildToolchain/MSBuildDeps & build_type of MSBuild may have to be different. + # Its unusual, but it happens when there is a preSolution/postSolution mapping with different names. + # * build_type attribute of MSBuild should match preSolution + # * configuration attribute of MSBuildToolchain/MSBuildDeps should match postSolution + return "Debug" if self.settings.build_type == "Debug" else "Release" def generate(self): tc = MSBuildToolchain(self) - tc.generate() - tc = MSBuildDeps(self) - tc.generate() - tc = VCVars(self) + tc.configuration = self._msbuild_configuration tc.generate() + # If there are requirements + deps = MSBuildDeps(self) + deps.configuration = self._msbuild_configuration + deps.generate() + def _patch_sources(self): apply_conandata_patches(self) # remove bundled xxhash rm(self, "whateer.*", os.path.join(self.source_folder, "lib")) replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "...", "") + # Allows to inject platform toolset, and props file generated by MSBuildToolchain & MSBuildDeps + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + vcxproj_files = ["path/to/vcxproj_file1", "path/to/vcxproj_file2", "..."] + platform_toolset = MSBuildToolchain(self).toolset + import_conan_generators = "" + for props_file in ["conantoolchain.props", "conandeps.props"]: + props_path = os.path.join(self.generators_folder, props_file) + if os.path.exists(props_path): + import_conan_generators += f"" + for vcxproj_file in vcxproj_files: + replace_in_file( + self, vcxproj_file, + # change this v142 value depending on actual value in vcxproj file + "v142", + f"{platform_toolset}", + ) + if props_path: + replace_in_file( + self, vcxproj_file, + "", + f"{import_conan_generators}", + ) + def build(self): self._patch_sources() # It can be apply_conandata_patches(self) only in case no more patches are needed msbuild = MSBuild(self) - # customize to Release when RelWithDebInfo - msbuild.build_type = "Debug" if self.settings.build_type == "Debug" else "Release" - # use Win32 instead of the default value when building x86 - msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + msbuild.build_type = self._msbuild_configuration # customize according the solution file and compiler version msbuild.build(sln="project_2017.sln") def package(self): - copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - copy( - self, pattern="*.lib", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False - ) - copy( - self, pattern="*.dll", dst=os.path.join(self.package_folder, "bin"), src=self.build_folder, keep_path=False - ) - copy( - self, - pattern="*.h", - dst=os.path.join(self.package_folder, "include"), - src=os.path.join(self.source_folder, "include"), - ) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.lib", src=self.source_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dll", src=self.source_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): self.cpp_info.libs = ["package_lib"] diff --git a/docs/package_templates/prebuilt_tool_package/all/conanfile.py b/docs/package_templates/prebuilt_tool_package/all/conanfile.py index c8a5ae117ab52b..f632b6094174c0 100644 --- a/docs/package_templates/prebuilt_tool_package/all/conanfile.py +++ b/docs/package_templates/prebuilt_tool_package/all/conanfile.py @@ -29,7 +29,7 @@ def package_id(self): # in case some configuration is not supported def validate(self): - if self.info.settings.os == "Macos" and Version(self.info.settings.os.version) < 11: + if self.settings.os == "Macos" and Version(self.settings.os.version) < 11: raise ConanInvalidConfiguration(f"{self.ref} requires OSX >=11.") # do not cache as source, instead, use build folder @@ -41,7 +41,6 @@ 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, ) 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 8fc041e355c5bf..b3a58664b7d6b0 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 @@ -12,7 +12,4 @@ def build_requirements(self): self.tool_requires(self.tested_reference_str) 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") + self.run("tool --version") diff --git a/docs/supported_platforms_and_configurations.md b/docs/supported_platforms_and_configurations.md index d246cd963f72ce..5f68ccf2435ba9 100644 --- a/docs/supported_platforms_and_configurations.md +++ b/docs/supported_platforms_and_configurations.md @@ -44,7 +44,7 @@ For more information see [conan-io/conan-docker-tools](https://github.com/conan- - Compilers: Visual Studio: - 2017 (19.16.27048) - - 2019 (19.29.30146) + - 2019 (19.29.30147) - Release (MT/MD) and Debug (MTd, MDd) - Architectures: x86_64 @@ -77,6 +77,8 @@ For more information see [conan-io/conan-docker-tools](https://github.com/conan- - Python: 3.7.12 - CMake: 3.20.1 - Compilers: Apple-clang versions 11.0.3, 12.0.5, 13.0.0 +- Macos SDK versions (for each apple-clang version respectively): 10.15, 11.3 +- Macos deployment target (`minos`): 11.3 - C++ Standard Library (`libcxx`): `libc++` - Architectures: x86_64, armv8 - Build types: Release, Debug diff --git a/linter/check_layout_src_folder.py b/linter/check_layout_src_folder.py new file mode 100644 index 00000000000000..b7d418884ca458 --- /dev/null +++ b/linter/check_layout_src_folder.py @@ -0,0 +1,44 @@ +from pylint.checkers import BaseChecker +from pylint.interfaces import IAstroidChecker +from astroid import nodes + +WHY_SRC_FOLDER = "Setting the `src_folder` for layouts will help keep an organized and clean workspace when developing recipes locally. " \ + "The extra folder will help ensure there are no collisions between the upstream sources and recipe's exports - which " \ + "also extends to what happens in the cache when creating packages" + + +class LayoutSrcFolder(BaseChecker): + """ + Ensure `src_folder=src` when using built-in layouts + """ + + __implements__ = IAstroidChecker + + name = "conan-layout-src-folder" + msgs = { + "E9012": ( + "layout is missing `src_folder` argument which should be to `src`", + "conan-missing-layout-src-folder", + WHY_SRC_FOLDER, + ), + "E9013": ( + "layout should set `src_folder` to `src`", + "conan-layout-src-folder-is-src", + WHY_SRC_FOLDER, + ), + } + + def visit_call(self, node: nodes.Call) -> None: + if not isinstance(node.func, nodes.Name): + return + + if node.func.name in ["cmake_layout", "bazel_layout", "basic_layout"]: + for kw in node.keywords: + if kw.arg == "src_folder": + if not kw.value or kw.value.as_string().strip("\"'") != "src": + self.add_message( + "conan-layout-src-folder-is-src", node=node, line=node.lineno + ) + break + else: + self.add_message("conan-missing-layout-src-folder", node=node, line=node.lineno) diff --git a/linter/conandata_yaml_linter.py b/linter/conandata_yaml_linter.py index b4a6a859fabe1c..739a4a6ef00da3 100644 --- a/linter/conandata_yaml_linter.py +++ b/linter/conandata_yaml_linter.py @@ -13,6 +13,9 @@ from yaml_linting import file_path +CONANDATA_YAML_URL = "https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md" + + def main(): parser = argparse.ArgumentParser( description="Validate Conan's 'conandata.yaml' file to ConanCenterIndex's requirements." @@ -33,7 +36,6 @@ def main(): ["official", "conan", "portability", "bugfix", "vulnerability"] ), Optional("patch_source"): Str(), - Optional("sha256"): Str(), # Really uncommon # No longer required for v2 recipes with layouts Optional("base_path"): Str(), } @@ -41,41 +43,74 @@ def main(): schema = Map( { "sources": MapPattern(Str(), Any(), minimum_keys=1), - Optional("patches"): MapPattern(Str(), Seq(patch_fields), minimum_keys=1), + Optional("patches"): MapPattern(Str(), Seq(Any()), minimum_keys=1), } ) - with open(args.path) as f: + with open(args.path, encoding="utf-8") as f: content = f.read() try: parsed = load(content, schema) - - if "patches" in parsed: - for version in parsed["patches"]: - patches = parsed["patches"][version] - for i, patch in enumerate(patches): - type = parsed["patches"][version][i]["patch_type"] - if ( - type in ["official", "bugfix", "vulnerability"] - and not "patch_source" in patch - ): - print( - f"::warning file={args.path},line={type.start_line},endline={type.end_line}," - f"title=conandata.yml schema warning" - "::'patch_type' should have 'patch_source' as per https://github.com/conan-io/conan-center-index/blob/master/docs/conandata_yml_format.md#patches-fields" - " it is expected to have a source (e.g. a URL) to where it originates from to help with reviewing and consumers to evaluate patches\n" - ) except YAMLValidationError as error: - e = error.__str__().replace("\n", "%0A") - print( - f"::error file={args.path},line={error.context_mark.line},endline={error.problem_mark.line}," - f"title=conandata.yml schema error" - f"::{e}\n" - ) + pretty_print_yaml_validate_error(args, error) # Error when "source" is missing or when "patches" has no versions + return except BaseException as error: - e = error.__str__().replace("\n", "%0A") - print(f"::error ::{e}") + pretty_print_yaml_validate_error(args, error) # YAML could not be parsed + return + + if "patches" in parsed: + for version in parsed["patches"]: + patches = parsed["patches"][version] + for i, patch in enumerate(patches): + # Individual report errors for each patch object + try: + parsed["patches"][version][i].revalidate(patch_fields) + except YAMLValidationError as error: + pretty_print_yaml_validate_warning(args, error) # Warning when patch fields are not followed + continue + + # Make sure `patch_source` exists where it's encouraged + type = parsed["patches"][version][i]["patch_type"] + if ( + type in ["official", "bugfix", "vulnerability"] + and not "patch_source" in patch + ): + print( + f"::warning file={args.path},line={type.start_line},endline={type.end_line}," + f"title=conandata.yml schema warning" + f"::'patch_type' should have 'patch_source' as per {CONANDATA_YAML_URL}#patch_type" + " it is expected to have a source (e.g. a URL) to where it originates from to help with" + " reviewing and consumers to evaluate patches" + ) + + # v2 migrations suggestion + if "base_path" in parsed["patches"][version][i]: + base_path = parsed["patches"][version][i]["base_path"] + print( + f"::notice file={args.path},line={base_path.start_line},endline={base_path.end_line}," + f"title=conandata.yml v2 migration suggestion" + "::'base_path' should not be required once a recipe has been upgraded to take advantage of" + " layouts (see https://docs.conan.io/en/latest/reference/conanfile/tools/layout.html) and" + " the new helper (see https://docs.conan.io/en/latest/reference/conanfile/tools/files/patches.html#conan-tools-files-apply-conandata-patches)" + ) + + +def pretty_print_yaml_validate_error(args, error): + snippet = error.context_mark.get_snippet().replace("\n", "%0A") + print( + f"::error file={args.path},line={error.context_mark.line},endline={error.problem_mark.line+1}," + f"title=conandata.yml schema error" + f"::Schema outlined in {CONANDATA_YAML_URL}#patches-fields is not followed.%0A%0A{error.problem} in %0A{snippet}%0A" + ) + +def pretty_print_yaml_validate_warning(args, error): + snippet = error.context_mark.get_snippet().replace("\n", "%0A") + print( + f"::warning file={args.path},line={error.context_mark.line},endline={error.problem_mark.line+1}," + f"title=conandata.yml schema warning" + f"::Schema outlined in {CONANDATA_YAML_URL}#patches-fields is not followed.%0A%0A{error.problem} in %0A{snippet}%0A" + ) if __name__ == "__main__": diff --git a/linter/conanv2_transition.py b/linter/conanv2_transition.py index 8c79054c05c256..32f3a3b0924b0e 100644 --- a/linter/conanv2_transition.py +++ b/linter/conanv2_transition.py @@ -9,6 +9,7 @@ from linter.check_import_conanfile import ImportConanFile from linter.check_import_errors import ImportErrorsConanException, ImportErrorsConanInvalidConfiguration, ImportErrors from linter.check_import_tools import ImportTools +from linter.check_layout_src_folder import LayoutSrcFolder def register(linter: PyLinter) -> None: @@ -18,3 +19,4 @@ def register(linter: PyLinter) -> None: linter.register_checker(ImportErrorsConanException(linter)) linter.register_checker(ImportErrorsConanInvalidConfiguration(linter)) linter.register_checker(ImportTools(linter)) + linter.register_checker(LayoutSrcFolder(linter)) diff --git a/recipes/abseil/all/conandata.yml b/recipes/abseil/all/conandata.yml index e507e3661535da..854838a18a2e82 100644 --- a/recipes/abseil/all/conandata.yml +++ b/recipes/abseil/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "20220623.1": + url: "https://github.com/abseil/abseil-cpp/archive/20220623.1.tar.gz" + sha256: "91ac87d30cc6d79f9ab974c51874a704de9c2647c40f6932597329a282217ba8" "20220623.0": url: "https://github.com/abseil/abseil-cpp/archive/20220623.0.tar.gz" sha256: "4208129b49006089ba1d6710845a45e31c59b0ab6bff9e5788a87f55c5abd602" @@ -15,12 +18,18 @@ sources: url: "https://github.com/abseil/abseil-cpp/archive/20200225.3.tar.gz" sha256: "66d4d009050f39c104b03f79bdca9d930c4964016f74bf24867a43fbdbd00d23" patches: + "20220623.1": + - patch_file: "patches/0003-absl-string-libm.patch" + - patch_file: "patches/0005-has-unique-object-representations.patch" + patch_description: "Workaround bug in GCC 7.2" + patch_source: "https://github.com/abseil/abseil-cpp/pull/1250" + patch_type: "portability" "20220623.0": - patch_file: "patches/0003-absl-string-libm.patch" - patch_file: "patches/0005-has-unique-object-representations.patch" patch_description: "Workaround bug in GCC 7.2" patch_source: "https://github.com/abseil/abseil-cpp/pull/1250" - patch_type: "backport" + patch_type: "portability" "20211102.0": - patch_file: "patches/0003-absl-string-libm.patch" "20210324.2": diff --git a/recipes/abseil/all/test_v1_package/conanfile.py b/recipes/abseil/all/test_v1_package/conanfile.py index 9f94318d8f0ec0..5c87f554bbab2b 100644 --- a/recipes/abseil/all/test_v1_package/conanfile.py +++ b/recipes/abseil/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/abseil/config.yml b/recipes/abseil/config.yml index da310ea8a88109..450d16d77019e1 100644 --- a/recipes/abseil/config.yml +++ b/recipes/abseil/config.yml @@ -1,4 +1,6 @@ versions: + "20220623.1": + folder: all "20220623.0": folder: all "20211102.0": diff --git a/recipes/android-ndk/all/conanfile.py b/recipes/android-ndk/all/conanfile.py index cf7fce07c64ba5..bd8d13791737c2 100644 --- a/recipes/android-ndk/all/conanfile.py +++ b/recipes/android-ndk/all/conanfile.py @@ -281,8 +281,13 @@ def package_info(self): # 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++")) + compiler_executables = { + "c": self._define_tool_var("CC", "clang"), + "cpp": self._define_tool_var("CXX", "clang++"), + } + self.conf_info.update("tools.build:compiler_executables", compiler_executables) + self.buildenv_info.define_path("CC", compiler_executables["c"]) + self.buildenv_info.define_path("CXX", compiler_executables["cpp"]) # Versions greater than 23 had the naming convention # changed to no longer include the triplet. @@ -332,8 +337,8 @@ def package_info(self): 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.CC = compiler_executables["c"] + self.env_info.CXX = compiler_executables["cpp"] 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) diff --git a/recipes/apr/all/CMakeLists.txt b/recipes/apr/all/CMakeLists.txt deleted file mode 100644 index bd3083b512cb93..00000000000000 --- a/recipes/apr/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/apr/all/conandata.yml b/recipes/apr/all/conandata.yml index 761248b72bbad5..857d29070602ea 100644 --- a/recipes/apr/all/conandata.yml +++ b/recipes/apr/all/conandata.yml @@ -4,15 +4,10 @@ sources: sha256: "48e9dbf45ae3fdc7b491259ffb6ccf7d63049ffacbc1c0977cced095e4c2d5a2" patches: "1.7.0": - - base_path: "source_subfolder" - patch_file: "patches/0001-cmake-build-only-shared-static.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-apr-config-prefix-env.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-cmake-gen_test_char-use-target.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-autotools-mingw.patch" - - base_path: "source_subfolder" - patch_file: "patches/0005-clang12-apple.patch" - - base_path: "source_subfolder" - patch_file: "patches/0006-sys_siglist-fix.patch" + - patch_file: "patches/0001-cmake-build-only-shared-static.patch" + - patch_file: "patches/0002-apr-config-prefix-env.patch" + - patch_file: "patches/0003-cmake-gen_test_char-use-target.patch" + - patch_file: "patches/0004-autotools-mingw.patch" + - patch_file: "patches/0005-clang12-apple.patch" + - patch_file: "patches/0006-sys_siglist-fix.patch" + - patch_file: "patches/0007-cmake-minimum-required.patch" diff --git a/recipes/apr/all/conanfile.py b/recipes/apr/all/conanfile.py index f11328e35d47d1..ce8e901f10380e 100644 --- a/recipes/apr/all/conanfile.py +++ b/recipes/apr/all/conanfile.py @@ -1,14 +1,26 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, CMake, tools -from conans.errors import ConanException, ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanException, ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path +from conan.tools.scm import Version import os import re -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.53.0" class AprConan(ConanFile): name = "apr" - description = "The Apache Portable Runtime (APR) provides a predictable and consistent interface to underlying platform-specific implementations" + description = ( + "The Apache Portable Runtime (APR) provides a predictable and consistent " + "interface to underlying platform-specific implementations" + ) license = "Apache-2.0" topics = ("apache", "platform", "library") homepage = "https://apr.apache.org/" @@ -26,28 +38,18 @@ class AprConan(ConanFile): "force_apr_uuid": True, } - generators = "cmake" - _autotools = None - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" + def _settings_build(self): + return getattr(self, "settings_build", self.settings) @property def _should_call_autoreconf(self): return self.settings.compiler == "apple-clang" and \ - tools.Version(self.settings.compiler.version) >= "12" and \ + Version(self.settings.compiler.version) >= "12" and \ self.version == "1.7.0" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -55,101 +57,101 @@ 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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + if is_msvc(self): + cmake_layout(self, src_folder="src") + else: + basic_layout(self, src_folder="src") def validate(self): - if hasattr(self, "settings_build") and tools.cross_building(self): - raise ConanInvalidConfiguration("apr cannot be cross compiled due to runtime checks") + if hasattr(self, "settings_build") and cross_building(self): + raise ConanInvalidConfiguration("apr recipe doesn't support cross-build yet due to runtime checks") def build_requirements(self): - if self._should_call_autoreconf: - self.build_requires("libtool/2.4.6") + if not is_msvc(self): + if self._should_call_autoreconf: + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["INSTALL_PDB"] = False - self._cmake.definitions["APR_BUILD_TESTAPR"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - self._autotools.libs = [] - yes_no = lambda v: "yes" if v else "no" - conf_args = [ - "--with-installbuilddir=${prefix}/bin/build-1", - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - ] - if tools.cross_building(self): - # - conf_args.append("apr_cv_mutex_robust_shared=yes") - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return self._autotools + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + if is_msvc(self): + tc = CMakeToolchain(self) + tc.variables["INSTALL_PDB"] = False + tc.variables["APR_BUILD_TESTAPR"] = False + tc.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.configure_args.append("--with-installbuilddir=${prefix}/res/build-1") + if cross_building(self): + tc.configure_args.append("apr_cv_mutex_robust_shared=yes") + tc.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) if self.options.force_apr_uuid: - tools.replace_in_file(os.path.join(self._source_subfolder, "include", "apr.h.in"), + replace_in_file(self, os.path.join(self.source_folder, "include", "apr.h.in"), "@osuuid@", "0") def build(self): self._patch_sources() - if self.settings.compiler == "Visual Studio": - cmake = self._configure_cmake() + if is_msvc(self): + cmake = CMake(self) + cmake.configure() cmake.build(target="libapr-1" if self.options.shared else "apr-1") else: + autotools = Autotools(self) if self._should_call_autoreconf: - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) - autotools = self._configure_autotools() + autotools.autoreconf() + autotools.configure() autotools.make() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - if self.settings.compiler == "Visual Studio": - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + cmake = CMake(self) cmake.install() else: - autotools = self._configure_autotools() - autotools.install() - - os.unlink(os.path.join(self.package_folder, "lib", "libapr-1.la")) - tools.rmdir(os.path.join(self.package_folder, "build-1")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - - apr_rules_mk = os.path.join(self.package_folder, "bin", "build-1", "apr_rules.mk") + autotools = Autotools(self) + # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "build-1")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + fix_apple_shared_install_name(self) + + apr_rules_mk = os.path.join(self.package_folder, "res", "build-1", "apr_rules.mk") apr_rules_cnt = open(apr_rules_mk).read() for key in ("apr_builddir", "apr_builders", "top_builddir"): - apr_rules_cnt, nb = re.subn("^{}=[^\n]*\n".format(key), "{}=$(_APR_BUILDDIR)\n".format(key), apr_rules_cnt, flags=re.MULTILINE) + apr_rules_cnt, nb = re.subn(f"^{key}=[^\n]*\n", f"{key}=$(_APR_BUILDDIR)\n", apr_rules_cnt, flags=re.MULTILINE) if nb == 0: - raise ConanException("Could not find/replace {} in {}".format(key, apr_rules_mk)) + raise ConanException(f"Could not find/replace {key} in {apr_rules_mk}") open(apr_rules_mk, "w").write(apr_rules_cnt) def package_info(self): self.cpp_info.set_property("pkg_config_name", "apr-1") - self.cpp_info.libs = ["libapr-1" if self.settings.compiler == "Visual Studio" and self.options.shared else "apr-1"] + prefix = "lib" if is_msvc(self) and self.options.shared else "" + self.cpp_info.libs = [f"{prefix}apr-1"] + self.cpp_info.resdirs = ["res"] if not self.options.shared: self.cpp_info.defines = ["APR_DECLARE_STATIC"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs = ["dl", "pthread"] + self.cpp_info.system_libs = ["crypt", "dl", "pthread", "rt"] if self.settings.os == "Windows": - self.cpp_info.system_libs = ["rpcrt4"] - - apr_root = tools.unix_path(self.package_folder) - self.output.info("Settings APR_ROOT environment var: {}".format(apr_root)) - self.env_info.APR_ROOT = apr_root + self.cpp_info.system_libs = ["mswsock", "rpcrt4", "ws2_32"] - apr_mk_dir = tools.unix_path(os.path.join(self.package_folder, "bin", "build-1")) - self.env_info._APR_BUILDDIR = apr_mk_dir + # TODO: to remove in conan v2 + self.env_info.APR_ROOT = self.package_folder + self.env_info._APR_BUILDDIR = os.path.join(self.package_folder, "res", "build-1") diff --git a/recipes/apr/all/patches/0003-cmake-gen_test_char-use-target.patch b/recipes/apr/all/patches/0003-cmake-gen_test_char-use-target.patch index b6c4855dd153c2..171d7365eb26e6 100644 --- a/recipes/apr/all/patches/0003-cmake-gen_test_char-use-target.patch +++ b/recipes/apr/all/patches/0003-cmake-gen_test_char-use-target.patch @@ -1,11 +1,16 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -53,7 +53,7 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -49,11 +49,11 @@ CONFIGURE_FILE(include/apr.hwc + ${PROJECT_BINARY_DIR}/apr.h) + + ADD_EXECUTABLE(gen_test_char tools/gen_test_char.c) +-GET_TARGET_PROPERTY(GEN_TEST_CHAR_EXE gen_test_char LOCATION) ++# GET_TARGET_PROPERTY(GEN_TEST_CHAR_EXE gen_test_char LOCATION) ADD_CUSTOM_COMMAND( COMMENT "Generating character tables, apr_escape_test_char.h, for current locale" DEPENDS gen_test_char - COMMAND ${GEN_TEST_CHAR_EXE} > ${PROJECT_BINARY_DIR}/apr_escape_test_char.h -+ COMMAND gen_test_char > ${PROJECT_BINARY_DIR}/apr_escape_test_char.h ++ COMMAND $ > ${PROJECT_BINARY_DIR}/apr_escape_test_char.h OUTPUT ${PROJECT_BINARY_DIR}/apr_escape_test_char.h ) ADD_CUSTOM_TARGET( diff --git a/recipes/apr/all/patches/0007-cmake-minimum-required.patch b/recipes/apr/all/patches/0007-cmake-minimum-required.patch new file mode 100644 index 00000000000000..161b16e8f72696 --- /dev/null +++ b/recipes/apr/all/patches/0007-cmake-minimum-required.patch @@ -0,0 +1,13 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -15,9 +15,9 @@ + # + # Read README.cmake before using this. + ++CMAKE_MINIMUM_REQUIRED(VERSION 3.1) + PROJECT(APR C) + +-CMAKE_MINIMUM_REQUIRED(VERSION 2.8) + + OPTION(APR_INSTALL_PRIVATE_H "Install selected private .h files (for httpd)" OFF) + OPTION(APR_HAVE_IPV6 "IPv6 support" ON) diff --git a/recipes/apr/all/test_package/CMakeLists.txt b/recipes/apr/all/test_package/CMakeLists.txt index f8b971e2db3772..c82ee1f7cca4b1 100644 --- a/recipes/apr/all/test_package/CMakeLists.txt +++ b/recipes/apr/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(apr REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE apr::apr) diff --git a/recipes/apr/all/test_package/conanfile.py b/recipes/apr/all/test_package/conanfile.py index 5c09494bc67c01..98ab55852ad565 100644 --- a/recipes/apr/all/test_package/conanfile.py +++ b/recipes/apr/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 = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/apr/all/test_v1_package/CMakeLists.txt b/recipes/apr/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/apr/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/apr/all/test_v1_package/conanfile.py b/recipes/apr/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/apr/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/archicad-apidevkit/all/conandata.yml b/recipes/archicad-apidevkit/all/conandata.yml new file mode 100644 index 00000000000000..d3788a4383b777 --- /dev/null +++ b/recipes/archicad-apidevkit/all/conandata.yml @@ -0,0 +1,28 @@ +sources: + "26": + Macos: + "x86_64": + - url: "https://stgsswsconan001.blob.core.windows.net/apidevkit/220529.v2022Release.3000.FULL.FIN.MAC64.DevKitAPI.tar.gz" + sha256: "326643eb79619166b6cb8f2858be3b24c1c3e3dd6749d20d2960baa0690f8e9c" + - url: "https://stgsswsconan001.blob.core.windows.net/apidevkit/licenses.zip" + sha256: "ad798e4760d784a84d2708be77b3c8d7562a88ac8cddbc3177f21a6d6e91772a" + Windows: + "x86_64": + - url: "https://stgsswsconan001.blob.core.windows.net/apidevkit/220529.v2022Release.3000.FULL.FIN.WIN64.DevKitAPI.zip" + sha256: "588c411b8bb8263bd417c271bb5a8d01136a802cb60116732ab5c1e2fbbf0558" + - url: "https://stgsswsconan001.blob.core.windows.net/apidevkit/licenses.zip" + sha256: "ad798e4760d784a84d2708be77b3c8d7562a88ac8cddbc3177f21a6d6e91772a" + + "25": + Macos: + "x86_64": + - url: "https://stgsswsconan001.blob.core.windows.net/apidevkit/210709.v2021Release.3006.FULL.FIN.MAC64.DevKitAPI.tar.gz" + sha256: "d692a59bdec7847ef4632e2c6741be064822a91eda2735dcff768985eaf4ec1e" + - url: "https://stgsswsconan001.blob.core.windows.net/apidevkit/licenses.zip" + sha256: "ad798e4760d784a84d2708be77b3c8d7562a88ac8cddbc3177f21a6d6e91772a" + Windows: + "x86_64": + - url: "https://stgsswsconan001.blob.core.windows.net/apidevkit/210519.v2021Release.3002.FULL.FIN.WIN64.DevKitAPI.zip" + sha256: "e7da392408f6150c58f3cba5d4f05118f1eaed4519fdb76895e13aed9ceede97" + - url: "https://stgsswsconan001.blob.core.windows.net/apidevkit/licenses.zip" + sha256: "ad798e4760d784a84d2708be77b3c8d7562a88ac8cddbc3177f21a6d6e91772a" diff --git a/recipes/archicad-apidevkit/all/conanfile.py b/recipes/archicad-apidevkit/all/conanfile.py new file mode 100644 index 00000000000000..55e0ec99e9a6b8 --- /dev/null +++ b/recipes/archicad-apidevkit/all/conanfile.py @@ -0,0 +1,65 @@ +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.52.0" + + +class ArchicadApidevkitConan(ConanFile): + name = "archicad-apidevkit" + description = "The General API Development Kit enables software developers to extend the functionality of Archicad" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://archicadapi.graphisoft.com/" + license = "LicenseRef-LICENSE" + settings = "os", "compiler", "arch", "build_type" + no_copy_source = True + topics = "api", "archicad", "development" + short_paths = True + + def validate(self): + if self.settings.build_type == "Debug": + raise ConanInvalidConfiguration("Debug configuration is not supported") + if is_msvc(self): + # Approximate requirement for toolset >= v142 + check_min_vs(self, "192") + if not self.info.settings.os in ("Macos", "Windows"): + raise ConanInvalidConfiguration( + f"{self.ref} is not supported by the OS {self.info.settings.os}") + if not str(self.settings.arch) in ("x86_64"): + raise ConanInvalidConfiguration( + f"{self.ref} is not supported yet.") + if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) < "16": + raise ConanInvalidConfiguration( + "This recipe does not support this compiler version") + + def build(self): + devkit, licenses = self.conan_data["sources"][self.version][str(self.settings.os)][str(self.settings.arch)] + get(self, **devkit, destination=os.path.join(self.package_folder, "bin"), strip_root=True) + get(self, **licenses, destination=os.path.join(self.package_folder, "licenses"), strip_root=True) + + def package(self): + copy(self, "bin", src=self.build_folder, dst=self.package_folder) + copy(self, "licenses", src=self.build_folder, dst=self.package_folder) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.includedirs = [] + + # These are dependencies of third party vendored libraries + self.cpp_info.system_libs = [ + "WinMM", "MSImg32", "WS2_32", "USP10", "DNSApi"] + if self.settings.os == "Macos": + self.cpp_info.frameworks = ["CoreText", "CoreFoundation", "CoreServices", + "ApplicationServices", "Carbon", "CoreGraphics", "AppKit", "Foundation"] + else: + self.cpp_info.system_libs.extend(["gdiplus", "iphlpapi"]) + + devkit_dir = os.path.join(self.package_folder, "bin") + self.output.info(f"Setting AC_API_DEVKIT_DIR environment variable: {devkit_dir}") + self.env_info.AC_API_DEVKIT_DIR = devkit_dir + self.buildenv_info.define("AC_API_DEVKIT_DIR", devkit_dir) diff --git a/recipes/archicad-apidevkit/all/test_package/CMakeLists.txt b/recipes/archicad-apidevkit/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..7e25d3d3b7690b --- /dev/null +++ b/recipes/archicad-apidevkit/all/test_package/CMakeLists.txt @@ -0,0 +1,44 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package CXX) + +function(SetCompilerOptions target ac_version) + if(ac_version GREATER "26") + target_compile_features("${target}" PUBLIC cxx_std_17) + else() + target_compile_features("${target}" PUBLIC cxx_std_14) + endif() +endfunction() + +set(AC_API_DEVKIT_DIR "$ENV{AC_API_DEVKIT_DIR}" CACHE PATH "API DevKit directory.") + +find_package(archicad-apidevkit REQUIRED CONFIG) + +add_executable(test_package test_gsroot.cpp) +SetCompilerOptions(test_package "${archicad-apidevkit_VERSION}") + +if(WIN32) + target_compile_definitions(test_package PRIVATE UNICODE _UNICODE) +else() + target_compile_definitions(test_package PRIVATE macintosh=1) +endif() + +target_include_directories(test_package SYSTEM PRIVATE "${AC_API_DEVKIT_DIR}/Modules/GSRoot") + +if(WIN32) + target_link_libraries( + test_package PRIVATE + "${AC_API_DEVKIT_DIR}/Modules/GSRoot/Win/GSRootImp.lib" + ) +else() + find_library( + GSROOT_FRAMEWORK GSRoot + PATHS "${AC_API_DEVKIT_DIR}/Frameworks" + ) + + if(NOT GSROOT_FRAMEWORK) + message(FATAL_ERROR "GSRoot not found: ${GSROOT_FRAMEWORK}") + endif() + + target_link_libraries(test_package PRIVATE "${GSROOT_FRAMEWORK}") +endif() diff --git a/recipes/archicad-apidevkit/all/test_package/conanfile.py b/recipes/archicad-apidevkit/all/test_package/conanfile.py new file mode 100644 index 00000000000000..f6d3c68ca3efba --- /dev/null +++ b/recipes/archicad-apidevkit/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualBuildEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/archicad-apidevkit/all/test_package/test_gsroot.cpp b/recipes/archicad-apidevkit/all/test_package/test_gsroot.cpp new file mode 100644 index 00000000000000..8712d2cd553d3e --- /dev/null +++ b/recipes/archicad-apidevkit/all/test_package/test_gsroot.cpp @@ -0,0 +1,10 @@ +#include +#include + +int main () +{ + Gfx::Color someColor; + someColor.SetRed (176); + + return someColor.GetRed () == 176 ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/recipes/archicad-apidevkit/all/test_v1_package/CMakeLists.txt b/recipes/archicad-apidevkit/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..50f1488b009a22 --- /dev/null +++ b/recipes/archicad-apidevkit/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + + +include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +conan_basic_setup(TARGETS KEEP_RPATHS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/archicad-apidevkit/all/test_v1_package/conanfile.py b/recipes/archicad-apidevkit/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..af4b5cc85f42f0 --- /dev/null +++ b/recipes/archicad-apidevkit/all/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +from conan import ConanFile +from conan.tools.build import cross_building +from conans import CMake +from conan.errors import ConanInvalidConfiguration +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/archicad-apidevkit/config.yml b/recipes/archicad-apidevkit/config.yml new file mode 100644 index 00000000000000..ca23918e2d0f42 --- /dev/null +++ b/recipes/archicad-apidevkit/config.yml @@ -0,0 +1,5 @@ +versions: + "25": + folder: all + "26": + folder: all diff --git a/recipes/arrow/all/conandata.yml b/recipes/arrow/all/conandata.yml index 5f295106ef3f41..9d8117ed1a2a86 100644 --- a/recipes/arrow/all/conandata.yml +++ b/recipes/arrow/all/conandata.yml @@ -1,34 +1,31 @@ sources: "10.0.0": - url: "https://github.com/apache/arrow/archive/apache-arrow-10.0.0.tar.gz" - sha256: "2852b21f93ee84185a9d838809c9a9c41bf6deca741bed1744e0fdba6cc19e3f" + url: "https://www.apache.org/dyn/closer.lua/arrow/arrow-10.0.0/apache-arrow-10.0.0.tar.gz?action=download" + sha256: "5b46fa4c54f53e5df0019fe0f9d421e93fc906b625ebe8e89eed010d561f1f12" "8.0.1": - url: "https://github.com/apache/arrow/archive/apache-arrow-8.0.1.tar.gz" - sha256: "e4c86329be769f2c8778aacc8d6220a9a13c90d59d4988f9349d51299dacbd11" + url: "https://www.apache.org/dyn/closer.lua/arrow/arrow-8.0.1/apache-arrow-8.0.1.tar.gz?action=download" + sha256: "82d46929f7574715551da21700f100b39f99c3c4d6790f26cac86d869d64e94e" "8.0.0": - url: "https://github.com/apache/arrow/archive/apache-arrow-8.0.0.tar.gz" - sha256: "19ece12de48e51ce4287d2dee00dc358fbc5ff02f41629d16076f77b8579e272" + url: "https://www.apache.org/dyn/closer.lua/arrow/arrow-8.0.0/apache-arrow-8.0.0.tar.gz?action=download" + sha256: "ad9a05705117c989c116bae9ac70492fe015050e1b80fb0e38fde4b5d863aaa3" "7.0.0": - url: "https://github.com/apache/arrow/archive/apache-arrow-7.0.0.tar.gz" - sha256: "57e13c62f27b710e1de54fd30faed612aefa22aa41fa2c0c3bacd204dd18a8f3" + url: "https://www.apache.org/dyn/closer.lua/arrow/arrow-7.0.0/apache-arrow-7.0.0.tar.gz?action=download" + sha256: "e8f49b149a15ecef4e40fcfab1b87c113c6b1ee186005c169e5cdf95d31a99de" "2.0.0": - url: "https://github.com/apache/arrow/archive/apache-arrow-2.0.0.tar.gz" - sha256: "ea299df9cf440cfc43393ce12ee6d9a4c9d0dfa9fde33c3bc9b70ec25520a844" + url: "https://www.apache.org/dyn/closer.lua/arrow/arrow-2.0.0/apache-arrow-2.0.0.tar.gz?action=download" + sha256: "be0342cc847bb340d86aeaef43596a0b6c1dbf1ede9c789a503d939e01c71fbe" "1.0.0": - url: "https://github.com/apache/arrow/archive/apache-arrow-1.0.0.tar.gz" - sha256: "08fbd4c633c08939850d619ca0224c75d7a0526467c721c0838b8aa7efccb270" + url: "https://www.apache.org/dyn/closer.lua/arrow/arrow-1.0.0/apache-arrow-1.0.0.tar.gz?action=download" + sha256: "86ddb9feb48203a5aaf9cc4f2827525e20a2ca4d7239e492af17e74532ccf243" patches: "10.0.0": - patch_file: "patches/10.0.0-0001-mallctl-takes-size_t.patch" patch_description: "use size_t instead of ssize_t" - patch_type: "backport" - - patch_file: "patches/10.0.0-0002-fix-cmake.patch" - patch_description: "use cci package" patch_type: "conan" "8.0.1": - patch_file: "patches/8.0.0-0003-mallctl-takes-size_t.patch" patch_description: "use size_t instead of ssize_t" - patch_type: "backport" + patch_type: "conan" - patch_file: "patches/8.0.0-0005-install-utils.patch" patch_description: "enable utilis installation" patch_type: "conan" @@ -38,7 +35,7 @@ patches: "8.0.0": - patch_file: "patches/8.0.0-0003-mallctl-takes-size_t.patch" patch_description: "use size_t instead of ssize_t" - patch_type: "backport" + patch_type: "conan" - patch_file: "patches/8.0.0-0005-install-utils.patch" patch_description: "enable utilis installation" patch_type: "conan" @@ -48,7 +45,7 @@ patches: "7.0.0": - patch_file: "patches/7.0.0-0003-mallctl-takes-size_t.patch" patch_description: "use size_t instead of ssize_t" - patch_type: "backport" + patch_type: "conan" - patch_file: "patches/7.0.0-0006-install-utils.patch" patch_description: "enable utilis installation" patch_type: "conan" @@ -58,26 +55,26 @@ patches: "2.0.0": - patch_file: "patches/2.0.0-0003-fix-shared-msvc.patch" patch_description: "make shared enabled in msvc" - patch_type: "backport" + patch_type: "official" - patch_file: "patches/1.0.0-0004-mallctl-takes-size_t.patch" patch_description: "use size_t instead of ssize_t" - patch_type: "backport" + patch_type: "conan" - patch_file: "patches/2.0.0-0005-gandiva-engine.patch" patch_description: "fix grandiva compilation error" - patch_type: "backport" + patch_type: "official" - patch_file: "patches/2.0.0-0008-fix-cmake.patch" patch_description: "use cci package" patch_type: "conan" "1.0.0": - patch_file: "patches/1.0.0-0003-fix-shared-msvc.patch" patch_description: "make shared enabled in msvc" - patch_type: "backport" + patch_type: "official" - patch_file: "patches/1.0.0-0004-mallctl-takes-size_t.patch" patch_description: "use size_t instead of ssize_t" - patch_type: "backport" + patch_type: "conan" - patch_file: "patches/1.0.0-0005-fix-make12-namespace.patch" patch_description: "fix ambiguous `make12` function between std and date" - patch_type: "backport" + patch_type: "official" - patch_file: "patches/1.0.0-0006-fix-cmake.patch" patch_description: "use cci package" patch_type: "conan" diff --git a/recipes/arrow/all/conanfile.py b/recipes/arrow/all/conanfile.py index f541db8ac8c045..28c550276568f1 100644 --- a/recipes/arrow/all/conanfile.py +++ b/recipes/arrow/all/conanfile.py @@ -295,7 +295,7 @@ def _with_thrift(self, required=False): def _with_utf8proc(self, required=False): if required or self.options.with_utf8proc == "auto": - return False + return bool(self._compute() or self.options.gandiva) else: return bool(self.options.with_utf8proc) @@ -376,7 +376,7 @@ def requirements(self): def source(self): get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + filename=f"apache-arrow-{self.version}.tar.gz", 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 @@ -392,6 +392,7 @@ def generate(self): if is_msvc(self): tc.variables["ARROW_USE_STATIC_CRT"] = is_msvc_static_runtime(self) tc.variables["ARROW_DEPENDENCY_SOURCE"] = "SYSTEM" + tc.variables["ARROW_PACKAGE_KIND"] = "conan" # See https://github.com/conan-io/conan-center-index/pull/14903/files#r1057938314 for details tc.variables["ARROW_GANDIVA"] = bool(self.options.gandiva) tc.variables["ARROW_PARQUET"] = self._parquet() tc.variables["ARROW_SUBSTRAIT"] = bool(self.options.get_safe("substrait", False)) @@ -410,6 +411,7 @@ def generate(self): tc.variables["ARROW_CSV"] = bool(self.options.with_csv) tc.variables["ARROW_CUDA"] = bool(self.options.with_cuda) tc.variables["ARROW_JEMALLOC"] = self._with_jemalloc() + tc.variables["jemalloc_SOURCE"] = "SYSTEM" tc.variables["ARROW_MIMALLOC"] = bool(self.options.with_mimalloc) tc.variables["ARROW_JSON"] = bool(self.options.with_json) tc.variables["google_cloud_cpp_SOURCE"] = "SYSTEM" @@ -498,7 +500,7 @@ def generate(self): def _patch_sources(self): apply_conandata_patches(self) - if Version(self.version) >= "7.0.0": + if "7.0.0" <= Version(self.version) < "10.0.0": for filename in glob.glob(os.path.join(self.source_folder, "cpp", "cmake_modules", "Find*.cmake")): if os.path.basename(filename) not in [ "FindArrow.cmake", diff --git a/recipes/arrow/all/patches/10.0.0-0002-fix-cmake.patch b/recipes/arrow/all/patches/10.0.0-0002-fix-cmake.patch deleted file mode 100644 index 62ee1a4570d306..00000000000000 --- a/recipes/arrow/all/patches/10.0.0-0002-fix-cmake.patch +++ /dev/null @@ -1,311 +0,0 @@ -diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt -index 029f13f..3518a23 100644 ---- a/cpp/CMakeLists.txt -+++ b/cpp/CMakeLists.txt -@@ -659,7 +659,7 @@ endif() - - if(ARROW_WITH_BROTLI) - # Order is important for static linking -- set(ARROW_BROTLI_LIBS Brotli::brotlienc Brotli::brotlidec Brotli::brotlicommon) -+ set(ARROW_BROTLI_LIBS brotli::brotlienc brotli::brotlidec brotli::brotlicommon) - list(APPEND ARROW_SHARED_LINK_LIBS ${ARROW_BROTLI_LIBS}) - list(APPEND ARROW_STATIC_LINK_LIBS ${ARROW_BROTLI_LIBS}) - if(Brotli_SOURCE STREQUAL "SYSTEM") -@@ -675,14 +675,21 @@ if(ARROW_WITH_BZ2) - endif() - - if(ARROW_WITH_LZ4) -- list(APPEND ARROW_STATIC_LINK_LIBS LZ4::lz4) -+if (TARGET LZ4::lz4_static) -+ list(APPEND ARROW_STATIC_LINK_LIBS LZ4::lz4_static) - if(lz4_SOURCE STREQUAL "SYSTEM") -- list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS LZ4::lz4) -+ list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS LZ4::lz4_static) - endif() -+else() -+ list(APPEND ARROW_STATIC_LINK_LIBS LZ4::lz4_shared) -+ if(lz4_SOURCE STREQUAL "SYSTEM") -+ list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS LZ4::lz4_shared) -+ endif() -+endif() - endif() - - if(ARROW_WITH_SNAPPY) -- list(APPEND ARROW_STATIC_LINK_LIBS ${Snappy_TARGET}) -+ list(APPEND ARROW_STATIC_LINK_LIBS Snappy::snappy) - if(Snappy_SOURCE STREQUAL "SYSTEM") - list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS ${Snappy_TARGET}) - endif() -diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake -index b7cd31f..78f3df3 100644 ---- a/cpp/cmake_modules/ThirdpartyToolchain.cmake -+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake -@@ -1162,10 +1162,12 @@ endmacro() - - if(ARROW_WITH_SNAPPY) - resolve_dependency(Snappy -- HAVE_ALT -+ USE_CONFIG - TRUE - PC_PACKAGE_NAMES - snappy) -+ -+ if(0) - if(${Snappy_SOURCE} STREQUAL "SYSTEM" AND NOT snappy_PC_FOUND) - get_target_property(SNAPPY_TYPE ${Snappy_TARGET} TYPE) - if(NOT SNAPPY_TYPE STREQUAL "INTERFACE_LIBRARY") -@@ -1180,6 +1182,9 @@ if(ARROW_WITH_SNAPPY) - string(APPEND ARROW_PC_LIBS_PRIVATE " ${SNAPPY_LIB}") - endif() - endif() -+ else() -+ string(APPEND ARROW_PC_LIBS_PRIVATE " ${Snappy_LIBRARIES}") -+ endif() - endif() - - # ---------------------------------------------------------------------- -@@ -1242,7 +1247,7 @@ macro(build_brotli) - endmacro() - - if(ARROW_WITH_BROTLI) -- resolve_dependency(Brotli PC_PACKAGE_NAMES libbrotlidec libbrotlienc) -+ resolve_dependency(brotli PC_PACKAGE_NAMES libbrotlidec libbrotlienc) - endif() - - if(PARQUET_REQUIRE_ENCRYPTION AND NOT ARROW_PARQUET) -@@ -1256,7 +1261,7 @@ if(PARQUET_REQUIRE_ENCRYPTION - OR ARROW_GANDIVA) - set(OpenSSL_SOURCE "SYSTEM") - resolve_dependency(OpenSSL -- HAVE_ALT -+ USE_CONFIG - TRUE - REQUIRED_VERSION - ${ARROW_OPENSSL_REQUIRED_VERSION}) -@@ -1399,22 +1404,14 @@ endmacro() - if(ARROW_NEED_GFLAGS) - set(ARROW_GFLAGS_REQUIRED_VERSION "2.1.0") - resolve_dependency(gflags -- HAVE_ALT -+ USE_CONFIG - TRUE - REQUIRED_VERSION - ${ARROW_GFLAGS_REQUIRED_VERSION} - IS_RUNTIME_DEPENDENCY - FALSE) - -- if(NOT TARGET ${GFLAGS_LIBRARIES}) -- if(TARGET gflags::gflags_shared) -- set(GFLAGS_LIBRARIES gflags::gflags_shared) -- elseif(TARGET gflags-shared) -- set(GFLAGS_LIBRARIES gflags-shared) -- elseif(TARGET gflags_shared) -- set(GFLAGS_LIBRARIES gflags_shared) -- endif() -- endif() -+ set(GFLAGS_LIBRARIES gflags::gflags) - endif() - - # ---------------------------------------------------------------------- -@@ -1638,7 +1635,7 @@ if(ARROW_WITH_PROTOBUF) - set(ARROW_PROTOBUF_REQUIRED_VERSION "2.6.1") - endif() - resolve_dependency(Protobuf -- HAVE_ALT -+ USE_CONFIG - TRUE - REQUIRED_VERSION - ${ARROW_PROTOBUF_REQUIRED_VERSION} -@@ -1770,7 +1767,7 @@ macro(build_substrait) - - add_custom_target(substrait_gen ALL DEPENDS ${SUBSTRAIT_PROTO_GEN_ALL}) - -- set(SUBSTRAIT_INCLUDES ${SUBSTRAIT_CPP_DIR} ${PROTOBUF_INCLUDE_DIR}) -+ set(SUBSTRAIT_INCLUDES ${SUBSTRAIT_CPP_DIR} ${protobuf_INCLUDE_DIR}) - - add_library(substrait STATIC ${SUBSTRAIT_SOURCES}) - set_target_properties(substrait PROPERTIES POSITION_INDEPENDENT_CODE ON) -@@ -1781,6 +1778,8 @@ macro(build_substrait) - list(APPEND ARROW_BUNDLED_STATIC_LIBS substrait) - endmacro() - -+set(CMAKE_VERBOSE_MAKEFILE ON) -+ - if(ARROW_SUBSTRAIT) - # Currently, we can only build Substrait from source. - set(Substrait_SOURCE "BUNDLED") -@@ -1866,7 +1865,10 @@ macro(build_jemalloc) - endmacro() - - if(ARROW_JEMALLOC) -- resolve_dependency(jemalloc) -+ #resolve_dependency(jemalloc) -+ find_package(jemalloc REQUIRED CONFIG) -+ include_directories(SYSTEM "${jemalloc_INCLUDE_DIR}") -+ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${jemalloc_LIBRARIES_TARGETS}) - endif() - - # ---------------------------------------------------------------------- -@@ -2186,7 +2188,7 @@ endmacro() - if(ARROW_WITH_RAPIDJSON) - set(ARROW_RAPIDJSON_REQUIRED_VERSION "1.1.0") - resolve_dependency(RapidJSON -- HAVE_ALT -+ USE_CONFIG - TRUE - REQUIRED_VERSION - ${ARROW_RAPIDJSON_REQUIRED_VERSION} -@@ -2334,19 +2336,29 @@ macro(build_lz4) - BUILD_BYPRODUCTS ${LZ4_STATIC_LIB}) - - file(MAKE_DIRECTORY "${LZ4_PREFIX}/include") -- add_library(LZ4::lz4 STATIC IMPORTED) -- set_target_properties(LZ4::lz4 -- PROPERTIES IMPORTED_LOCATION "${LZ4_STATIC_LIB}" -- INTERFACE_INCLUDE_DIRECTORIES "${LZ4_PREFIX}/include") -- add_dependencies(toolchain lz4_ep) -- add_dependencies(LZ4::lz4 lz4_ep) -- -- list(APPEND ARROW_BUNDLED_STATIC_LIBS LZ4::lz4) -+ if (TARGET LZ4::lz4_static) -+ add_library(LZ4::lz4_static STATIC IMPORTED) -+ set_target_properties(LZ4::lz4_static -+ PROPERTIES IMPORTED_LOCATION "${LZ4_STATIC_LIB}" -+ INTERFACE_INCLUDE_DIRECTORIES "${LZ4_PREFIX}/include") -+ add_dependencies(toolchain lz4_ep) -+ add_dependencies(LZ4::lz4_static lz4_ep) -+ list(APPEND ARROW_BUNDLED_STATIC_LIBS LZ4::lz4_static) -+ else() -+ add_library(LZ4::lz4_shared STATIC IMPORTED) -+ set_target_properties(LZ4::lz4_shared -+ PROPERTIES IMPORTED_LOCATION "${LZ4_SHARED_LIB}" -+ INTERFACE_INCLUDE_DIRECTORIES "${LZ4_PREFIX}/include") -+ add_dependencies(toolchain lz4_ep) -+ add_dependencies(LZ4::lz4_shared lz4_ep) -+ list(APPEND ARROW_BUNDLED_STATIC_LIBS LZ4::lz4_shared) -+ endif() -+ - endmacro() - - if(ARROW_WITH_LZ4) - resolve_dependency(lz4 -- HAVE_ALT -+ USE_CONFIG - TRUE - PC_PACKAGE_NAMES - liblz4) -@@ -2415,7 +2427,7 @@ endmacro() - if(ARROW_WITH_ZSTD) - # ARROW-13384: ZSTD_minCLevel was added in v1.4.0, required by ARROW-13091 - resolve_dependency(zstd -- HAVE_ALT -+ USE_CONFIG - TRUE - PC_PACKAGE_NAMES - libzstd -@@ -2477,7 +2489,7 @@ if(ARROW_WITH_RE2) - # Don't specify "PC_PACKAGE_NAMES re2" here because re2.pc may - # include -std=c++11. It's not compatible with C source and C++ - # source not uses C++ 11. -- resolve_dependency(re2 HAVE_ALT TRUE) -+ resolve_dependency(re2 USE_CONFIG TRUE) - if(${re2_SOURCE} STREQUAL "SYSTEM") - get_target_property(RE2_TYPE re2::re2 TYPE) - if(NOT RE2_TYPE STREQUAL "INTERFACE_LIBRARY") -@@ -3922,7 +3934,7 @@ if(ARROW_WITH_GRPC) - set(gRPC_SOURCE "${Protobuf_SOURCE}") - endif() - resolve_dependency(gRPC -- HAVE_ALT -+ USE_CONFIG - TRUE - REQUIRED_VERSION - ${ARROW_GRPC_REQUIRED_VERSION} -@@ -3939,9 +3951,9 @@ if(ARROW_WITH_GRPC) - get_target_property(GRPC_INCLUDE_DIR gRPC::grpc++ INTERFACE_INCLUDE_DIRECTORIES) - if(GRPC_INCLUDE_DIR MATCHES "^\\$<" - OR # generator expression -- EXISTS "${GRPC_INCLUDE_DIR}/grpcpp/impl/codegen/config_protobuf.h") -+ EXISTS ${GRPC_INCLUDE_DIR}/grpcpp/impl/codegen/config_protobuf.h) - set(GRPCPP_PP_INCLUDE TRUE) -- elseif(EXISTS "${GRPC_INCLUDE_DIR}/grpc++/impl/codegen/config_protobuf.h") -+ elseif(EXISTS ${GRPC_INCLUDE_DIR}/grpc++/impl/codegen/config_protobuf.h) - set(GRPCPP_PP_INCLUDE FALSE) - else() - message(FATAL_ERROR "Cannot find grpc++ headers in ${GRPC_INCLUDE_DIR}") -@@ -4282,8 +4294,11 @@ macro(build_orc) - get_target_property(ORC_SNAPPY_INCLUDE_DIR ${Snappy_TARGET} - INTERFACE_INCLUDE_DIRECTORIES) - get_filename_component(ORC_SNAPPY_ROOT "${ORC_SNAPPY_INCLUDE_DIR}" DIRECTORY) -- -- get_target_property(ORC_LZ4_ROOT LZ4::lz4 INTERFACE_INCLUDE_DIRECTORIES) -+ if (TARGET LZ4::lz4_static) -+ get_target_property(ORC_LZ4_ROOT LZ4::lz4_static INTERFACE_INCLUDE_DIRECTORIES) -+ else() -+ get_target_property(ORC_LZ4_ROOT LZ4::lz4_shared INTERFACE_INCLUDE_DIRECTORIES) -+ endif() - get_filename_component(ORC_LZ4_ROOT "${ORC_LZ4_ROOT}" DIRECTORY) - - get_target_property(ORC_ZSTD_ROOT ${ARROW_ZSTD_LIBZSTD} INTERFACE_INCLUDE_DIRECTORIES) -@@ -4321,16 +4336,29 @@ macro(build_orc) - # Work around CMake bug - file(MAKE_DIRECTORY ${ORC_INCLUDE_DIR}) - -- externalproject_add(orc_ep -- URL ${ORC_SOURCE_URL} -- URL_HASH "SHA256=${ARROW_ORC_BUILD_SHA256_CHECKSUM}" -- BUILD_BYPRODUCTS ${ORC_STATIC_LIB} -- CMAKE_ARGS ${ORC_CMAKE_ARGS} ${EP_LOG_OPTIONS} -- DEPENDS ${ARROW_PROTOBUF_LIBPROTOBUF} -- ${ARROW_ZSTD_LIBZSTD} -- ${Snappy_TARGET} -- LZ4::lz4 -- ZLIB::ZLIB) -+ if (TARGET LZ4::lz4_static) -+ externalproject_add(orc_ep -+ URL ${ORC_SOURCE_URL} -+ URL_HASH "SHA256=${ARROW_ORC_BUILD_SHA256_CHECKSUM}" -+ BUILD_BYPRODUCTS ${ORC_STATIC_LIB} -+ CMAKE_ARGS ${ORC_CMAKE_ARGS} ${EP_LOG_OPTIONS} -+ DEPENDS ${ARROW_PROTOBUF_LIBPROTOBUF} -+ ${ARROW_ZSTD_LIBZSTD} -+ ${Snappy_TARGET} -+ LZ4::lz4_static -+ ZLIB::ZLIB) -+ else() -+ externalproject_add(orc_ep -+ URL ${ORC_SOURCE_URL} -+ URL_HASH "SHA256=${ARROW_ORC_BUILD_SHA256_CHECKSUM}" -+ BUILD_BYPRODUCTS ${ORC_STATIC_LIB} -+ CMAKE_ARGS ${ORC_CMAKE_ARGS} ${EP_LOG_OPTIONS} -+ DEPENDS ${ARROW_PROTOBUF_LIBPROTOBUF} -+ ${ARROW_ZSTD_LIBZSTD} -+ ${Snappy_TARGET} -+ LZ4::lz4_shared -+ ZLIB::ZLIB) -+ endif() - - set(ORC_VENDORED 1) - -@@ -4338,7 +4366,11 @@ macro(build_orc) - set_target_properties(orc::liborc - PROPERTIES IMPORTED_LOCATION "${ORC_STATIC_LIB}" - INTERFACE_INCLUDE_DIRECTORIES "${ORC_INCLUDE_DIR}") -- set(ORC_LINK_LIBRARIES LZ4::lz4 ZLIB::ZLIB ${ARROW_ZSTD_LIBZSTD} ${Snappy_TARGET}) -+ if (TARGET LZ4::lz4_static) -+ set(ORC_LINK_LIBRARIES LZ4::lz4_static ZLIB::ZLIB ${ARROW_ZSTD_LIBZSTD} ${Snappy_TARGET}) -+ else() -+ set(ORC_LINK_LIBRARIES LZ4::lz4_shared ZLIB::ZLIB ${ARROW_ZSTD_LIBZSTD} ${Snappy_TARGET}) -+ endif() - if(NOT MSVC) - if(NOT APPLE) - list(APPEND ORC_LINK_LIBRARIES Threads::Threads) -@@ -4765,7 +4797,7 @@ macro(build_awssdk) - endmacro() - - if(ARROW_S3) -- resolve_dependency(AWSSDK HAVE_ALT TRUE) -+ resolve_dependency(AWSSDK USE_CONFIG TRUE) - - message(STATUS "Found AWS SDK headers: ${AWSSDK_INCLUDE_DIR}") - message(STATUS "Found AWS SDK libraries: ${AWSSDK_LINK_LIBRARIES}") diff --git a/recipes/arsenalgear/all/conanfile.py b/recipes/arsenalgear/all/conanfile.py index 5a83b05e8d8a5d..98dcd780da86b7 100644 --- a/recipes/arsenalgear/all/conanfile.py +++ b/recipes/arsenalgear/all/conanfile.py @@ -8,7 +8,7 @@ import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class ArsenalgearConan(ConanFile): name = "arsenalgear" @@ -35,6 +35,7 @@ def _minimum_cpp_standard(self): def _compilers_minimum_version(self): return { "Visual Studio": "16", + "msvc": "192", "gcc": "8", "clang": "7", "apple-clang": "12.0", @@ -49,17 +50,14 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def requirements(self): if Version(self.version) < "2.0.0": - self.requires("boost/1.80.0") + self.requires("boost/1.81.0") if self.settings.os in ["Linux", "Macos"]: self.requires("exprtk/0.0.1") diff --git a/recipes/arsenalgear/all/test_package/CMakeLists.txt b/recipes/arsenalgear/all/test_package/CMakeLists.txt index e3d45800d41b03..3ff34ca7821231 100644 --- a/recipes/arsenalgear/all/test_package/CMakeLists.txt +++ b/recipes/arsenalgear/all/test_package/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package LANGUAGES CXX) find_package(arsenalgear REQUIRED CONFIG) diff --git a/recipes/arsenalgear/all/test_v1_package/CMakeLists.txt b/recipes/arsenalgear/all/test_v1_package/CMakeLists.txt index 2340ca5c12b920..bc541ea90b5128 100644 --- a/recipes/arsenalgear/all/test_v1_package/CMakeLists.txt +++ b/recipes/arsenalgear/all/test_v1_package/CMakeLists.txt @@ -1,12 +1,9 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(arsenalgear REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE arsenalgear::arsenalgear) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/asio-grpc/all/conandata.yml b/recipes/asio-grpc/all/conandata.yml index d44cb9f84670e8..67c8b715cb2d32 100644 --- a/recipes/asio-grpc/all/conandata.yml +++ b/recipes/asio-grpc/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.4.0": + url: "https://github.com/Tradias/asio-grpc/archive/refs/tags/v2.4.0.tar.gz" + sha256: "d71de4f8de91dc0ad44d6a161fc628496b80622a6f9030dcd4c53b516629b8b7" "2.3.0": url: "https://github.com/Tradias/asio-grpc/archive/refs/tags/v2.3.0.tar.gz" sha256: "eb48e72c98d45d9251fe1cbdca3a72a4d67435a7020357cd33ff717cc5851c01" diff --git a/recipes/asio-grpc/all/conanfile.py b/recipes/asio-grpc/all/conanfile.py index d5f2c6fe82df8f..3bb69661037449 100644 --- a/recipes/asio-grpc/all/conanfile.py +++ b/recipes/asio-grpc/all/conanfile.py @@ -20,11 +20,11 @@ class AsioGrpcConan(ConanFile): no_copy_source = True options = { "backend": ["boost", "asio", "unifex"], - "use_boost_container": ["auto", True, False], + "local_allocator": ["auto", "memory_resource", "boost_container", "recycling_allocator"], } default_options = { "backend": "boost", - "use_boost_container": "auto", + "local_allocator": "auto", } @property @@ -51,17 +51,21 @@ def validate(self): self.output.warn(f"{self.name} requires C++{self._min_cppstd}. Your compiler is unknown. Assuming it supports C++{self._min_cppstd}.") def configure(self): - if self.options.use_boost_container == "auto": + self._local_allocator_option = self.options.local_allocator + if self._local_allocator_option == "auto": libcxx = self.settings.compiler.get_safe("libcxx") compiler_version = Version(self.settings.compiler.version) - self.options.use_boost_container = libcxx and str(libcxx) == "libc++" or \ + prefer_boost_container = libcxx and str(libcxx) == "libc++" or \ (self.settings.compiler == "gcc" and compiler_version < "9") or \ (self.settings.compiler == "clang" and compiler_version < "12" and libcxx and str(libcxx) == "libstdc++") + self._local_allocator_option = "boost_container" if prefer_boost_container else "memory_resource" + if self._local_allocator_option == "recycling_allocator" and self.options.backend == "unifex": + raise ConanInvalidConfiguration(f"{self.name} 'recycling_allocator' cannot be used in combination with the 'unifex' backend.") def requirements(self): - self.requires("grpc/1.50.0") - if self.options.use_boost_container or self.options.backend == "boost": - self.requires("boost/1.80.0") + self.requires("grpc/1.50.1") + if self._local_allocator_option == "boost_container" or self.options.backend == "boost": + self.requires("boost/1.81.0") if self.options.backend == "asio": self.requires("asio/1.24.0") if self.options.backend == "unifex": @@ -69,7 +73,7 @@ def requirements(self): def package_id(self): self.info.clear() - self.info.options.use_boost_container = self.options.use_boost_container + self.info.options.local_allocator = self._local_allocator_option def layout(self): cmake_layout(self, src_folder="src") @@ -79,7 +83,8 @@ def source(self): def generate(self): tc = CMakeToolchain(self) - tc.variables["ASIO_GRPC_USE_BOOST_CONTAINER"] = self.options.use_boost_container + tc.variables["ASIO_GRPC_USE_BOOST_CONTAINER"] = self._local_allocator_option == "boost_container" + tc.variables["ASIO_GRPC_USE_RECYCLING_ALLOCATOR"] = self._local_allocator_option == "recycling_allocator" tc.generate() def build(self): @@ -106,7 +111,7 @@ def package_info(self): self.cpp_info.defines = ["AGRPC_UNIFEX"] self.cpp_info.requires.append("libunifex::unifex") - if self.options.use_boost_container: + if self._local_allocator_option == "boost_container": self.cpp_info.requires.append("boost::container") self.cpp_info.set_property("cmake_file_name", "asio-grpc") diff --git a/recipes/asio-grpc/config.yml b/recipes/asio-grpc/config.yml index 9c1d4210486926..25e51279385fd9 100644 --- a/recipes/asio-grpc/config.yml +++ b/recipes/asio-grpc/config.yml @@ -1,4 +1,6 @@ versions: + "2.4.0": + folder: all "2.3.0": folder: all "2.2.0": diff --git a/recipes/at-spi2-core/config.yml b/recipes/at-spi2-core/config.yml index 75bf09030a3113..21111516a85854 100644 --- a/recipes/at-spi2-core/config.yml +++ b/recipes/at-spi2-core/config.yml @@ -17,3 +17,5 @@ versions: folder: new "2.46.0": folder: new + "2.47.1": + folder: new diff --git a/recipes/at-spi2-core/new/conandata.yml b/recipes/at-spi2-core/new/conandata.yml index 4ea30e6fd2d794..0404ff9bea312f 100644 --- a/recipes/at-spi2-core/new/conandata.yml +++ b/recipes/at-spi2-core/new/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.47.1": + url: "https://ftp.gnome.org/pub/gnome/sources/at-spi2-core/2.47/at-spi2-core-2.47.1.tar.xz" + sha256: "c6ba7c160434edebf09d2936933569c936f6ec972301766f2bdac5a4d418153c" "2.46.0": url: "https://ftp.gnome.org/pub/gnome/sources/at-spi2-core/2.46/at-spi2-core-2.46.0.tar.xz" sha256: "aa0c86c79f7a8d67bae49a5b7a5ab08430c608cffe6e33bf47a72f41ab03c3d0" @@ -9,12 +12,11 @@ sources: sha256: "ba95f346e93108fbb3462c62437081d582154db279b4052dedc52a706828b192" url: "https://ftp.gnome.org/pub/gnome/sources/at-spi2-core/2.45/at-spi2-core-2.45.1.tar.xz" patches: + "2.47.1": + - patch_file: "patches/93.patch" "2.46.0": - - base_path: "source_subfolder" - patch_file: "patches/93.patch" + - patch_file: "patches/93.patch" "2.45.90": - - base_path: "source_subfolder" - patch_file: "patches/93.patch" + - patch_file: "patches/93.patch" "2.45.1": - - base_path: "source_subfolder" - patch_file: "patches/93.patch" + - patch_file: "patches/93.patch" diff --git a/recipes/at-spi2-core/new/conanfile.py b/recipes/at-spi2-core/new/conanfile.py index 389943e02b0015..d40f68c8b3da50 100644 --- a/recipes/at-spi2-core/new/conanfile.py +++ b/recipes/at-spi2-core/new/conanfile.py @@ -1,8 +1,15 @@ -from conans import ConanFile, Meson, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.scm import Version import os +required_conan_version = ">=1.53.0" class AtSpi2CoreConan(ConanFile): name = "at-spi2-core" description = "It provides a Service Provider Interface for the Assistive Technologies available on the GNOME platform and a library against which applications can be linked" @@ -10,7 +17,6 @@ class AtSpi2CoreConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://gitlab.gnome.org/GNOME/at-spi2-core/" license = "LGPL-2.1-or-later" - generators = "pkg_config" provides = "at-spi2-atk", "atk" @@ -26,37 +32,27 @@ class AtSpi2CoreConan(ConanFile): "with_x11": False, } - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - _meson = None - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") if self.options.shared: self.options["glib"].shared = True def build_requirements(self): - self.build_requires("meson/0.62.2") - self.build_requires("pkgconf/1.7.4") + self.tool_requires("meson/1.0.0") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") def requirements(self): - self.requires("glib/2.73.0") + self.requires("glib/2.75.2") if self.options.with_x11: self.requires("xorg/system") - self.requires("dbus/1.12.20") + self.requires("dbus/1.15.2") def validate(self): if self.options.shared and not self.options["glib"].shared: @@ -66,63 +62,67 @@ def validate(self): if self.settings.os != "Linux": raise ConanInvalidConfiguration("only linux is supported by this recipe") + def layout(self): + basic_layout(self, src_folder="src") + self.cpp.package.resdirs = ["res"] + def source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) - - def _configure_meson(self): - if self._meson: - return self._meson - self._meson = Meson(self) - defs = {} - defs["introspection"] = "no" - defs["docs"] = "false" - defs["x11"] = "yes" if self.options.with_x11 else "no" - args=[] - args.append("--datadir=%s" % os.path.join(self.package_folder, "res")) - args.append("--localedir=%s" % os.path.join(self.package_folder, "res")) - args.append("--wrap-mode=nofallback") - self._meson.configure(defs=defs, build_folder=self._build_subfolder, source_folder=self._source_subfolder, pkg_config_paths=".", args=args) - return self._meson + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() + tc = MesonToolchain(self) + if Version(self.version) >= "2.47.1": + tc.project_options["introspection"] = "disabled" + tc.project_options["x11"] = "enabled" if self.options.with_x11 else "disabled" + else: + tc.project_options["introspection"] = "no" + tc.project_options["x11"] = "yes" if self.options.with_x11 else "no" + tc.project_options["docs"] = "false" + tc.generate() + tc = PkgConfigDeps(self) + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - tools.replace_in_file(os.path.join(self._source_subfolder, "bus", "meson.build"), + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "bus", "meson.build"), "if x11_dep.found()", - "if x11_option == 'yes'") - tools.replace_in_file(os.path.join(self._source_subfolder, 'meson.build'), + "if get_option('x11').enabled()" if Version(self.version) >= "2.47.1" + else "if x11_option == 'yes'") + replace_in_file(self, os.path.join(self.source_folder, 'meson.build'), "subdir('tests')", "#subdir('tests')") - tools.replace_in_file(os.path.join(self._source_subfolder, 'meson.build'), + replace_in_file(self, os.path.join(self.source_folder, 'meson.build'), "libxml_dep = dependency('libxml-2.0', version: libxml_req_version)", "#libxml_dep = dependency('libxml-2.0', version: libxml_req_version)") - meson = self._configure_meson() + meson = Meson(self) + meson.configure() meson.build() def package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - meson = self._configure_meson() + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + meson = Meson(self) meson.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "etc")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "etc")) def package_info(self): self.cpp_info.components["atspi"].libs = ['atspi'] self.cpp_info.components["atspi"].includedirs = ["include/at-spi-2.0"] self.cpp_info.components["atspi"].requires = ["dbus::dbus", "glib::glib"] - self.cpp_info.components["atspi"].names["pkg_config"] = "atspi-2" - + self.cpp_info.components["atspi"].set_property("pkg_config_name", "atspi-2") + self.cpp_info.components["atk"].libs = ["atk-1.0"] self.cpp_info.components["atk"].includedirs = ['include/atk-1.0'] self.cpp_info.components["atk"].requires = ["glib::glib"] - self.cpp_info.components["atk"].names['pkg_config'] = 'atk' + self.cpp_info.components["atk"].set_property("pkg_config_name", 'atk') self.cpp_info.components["atk-bridge"].libs = ['atk-bridge-2.0'] self.cpp_info.components["atk-bridge"].includedirs = [os.path.join('include', 'at-spi2-atk', '2.0')] self.cpp_info.components["atk-bridge"].requires = ["dbus::dbus", "atk", "glib::glib", "atspi"] - self.cpp_info.components["atk-bridge"].names['pkg_config'] = 'atk-bridge-2.0' + self.cpp_info.components["atk-bridge"].set_property("pkg_config_name", 'atk-bridge-2.0') def package_id(self): self.info.requires["glib"].full_package_mode() diff --git a/recipes/autoconf/all/conandata.yml b/recipes/autoconf/all/conandata.yml index 97adbd2afcde00..aefee4cae61324 100644 --- a/recipes/autoconf/all/conandata.yml +++ b/recipes/autoconf/all/conandata.yml @@ -2,19 +2,14 @@ sources: "2.71": sha256: "431075ad0bf529ef13cb41e9042c542381103e80015686222b8a9d4abef42a1c" url: "https://ftp.gnu.org/gnu/autoconf/autoconf-2.71.tar.gz" - "2.69": - sha256: "954bd69b391edc12d6a4a51a2dd1476543da5c6bbf05a95b59dc0dd6fd4c2969" - url: "https://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz" patches: "2.71": - - patch_file: "patches/2.71-0001-autom4te-relocatable.patch" + - patch_file: "patches/2.71-0001-relocatable-autoconf.patch" + patch_description: "Replace instances where absolute paths are embedded the generated files" + patch_type: "conan" - patch_file: "patches/2.71-0002-no-perl-path-in-shebang.patch" - - patch_file: "patches/2.71-0003-uppercase-autom4te_perllibdir.patch" - - patch_file: "patches/2.71-0004-no-embedded-m4-paths.patch" - - patch_file: "patches/2.71-0005-disable-man-regeneration.patch" - - patch_file: "patches/2.71-0006-autoconf-no-embedded-trailer_m4-path.patch" - "2.69": - - patch_file: "patches/2.69-0001-autom4te-relocatable.patch" - - patch_file: "patches/2.69-0002-no-perl-path-in-shebang.patch" - - patch_file: "patches/2.69-0003-uppercase-autom4te_perllibdir.patch" - - patch_file: "patches/2.69-0004-no-embedded-m4-paths.patch" + patch_description: "Avoid build machine's perl path to be embedded the generated files" + patch_type: "conan" + - patch_file: "patches/2.71-0003-disable-man-regeneration.patch" + patch_description: "Disable man regeneration" + patch_type: "conan" diff --git a/recipes/autoconf/all/conanfile.py b/recipes/autoconf/all/conanfile.py index ceb06b4b4a4be2..36d4253e0bd5d8 100644 --- a/recipes/autoconf/all/conanfile.py +++ b/recipes/autoconf/all/conanfile.py @@ -4,10 +4,9 @@ from conan.tools.gnu import Autotools, AutotoolsToolchain from conan.tools.layout import basic_layout from conan.tools.microsoft import unix_path, is_msvc -from conans import tools as tools_legacy import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.54.0" class AutoconfConan(ConanFile): @@ -89,8 +88,7 @@ def build(self): def package(self): autotools = Autotools(self) - # TODO: can be replaced by autotools.install() if required_conan_version = ">=1.54.0" - autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + autotools.install() copy(self, "COPYING*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) rmdir(self, os.path.join(self.package_folder, "res", "info")) @@ -101,38 +99,37 @@ def package_info(self): self.cpp_info.includedirs = [] self.cpp_info.resdirs = ["res"] - # TODO: use legacy unix_path for the moment (see https://github.com/conan-io/conan/issues/12499) + # TODO: These variables can be removed since the scripts now locate the resources + # relative to themselves. - dataroot_path = tools_legacy.unix_path(os.path.join(self.package_folder, "res", "autoconf")) + dataroot_path = os.path.join(self.package_folder, "res", "autoconf") self.output.info(f"Defining AC_MACRODIR environment variable: {dataroot_path}") self.buildenv_info.define_path("AC_MACRODIR", dataroot_path) - self.output.info(f"Defining AUTOM4TE_PERLLIBDIR environment variable: {dataroot_path}") - self.buildenv_info.define_path("AUTOM4TE_PERLLIBDIR", dataroot_path) + self.output.info(f"Defining autom4te_perllibdir environment variable: {dataroot_path}") + self.buildenv_info.define_path("autom4te_perllibdir", dataroot_path) bin_path = os.path.join(self.package_folder, "bin") - autoconf_bin = tools_legacy.unix_path(os.path.join(bin_path, "autoconf")) + autoconf_bin = os.path.join(bin_path, "autoconf") self.output.info(f"Defining AUTOCONF environment variable: {autoconf_bin}") self.buildenv_info.define_path("AUTOCONF", autoconf_bin) - autoreconf_bin = tools_legacy.unix_path(os.path.join(bin_path, "autoreconf")) + autoreconf_bin = os.path.join(bin_path, "autoreconf") self.output.info(f"Defining AUTORECONF environment variable: {autoreconf_bin}") self.buildenv_info.define_path("AUTORECONF", autoreconf_bin) - autoheader_bin = tools_legacy.unix_path(os.path.join(bin_path, "autoheader")) + autoheader_bin = os.path.join(bin_path, "autoheader") self.output.info(f"Defining AUTOHEADER environment variable: {autoheader_bin}") self.buildenv_info.define_path("AUTOHEADER", autoheader_bin) - autom4te_bin = tools_legacy.unix_path(os.path.join(bin_path, "autom4te")) + autom4te_bin = os.path.join(bin_path, "autom4te") self.output.info(f"Defining AUTOM4TE environment variable: {autom4te_bin}") self.buildenv_info.define_path("AUTOM4TE", autom4te_bin) # TODO: to remove in conan v2 self.env_info.PATH.append(bin_path) - self.env_info.AC_MACRODIR = dataroot_path - self.env_info.AUTOM4TE_PERLLIBDIR = dataroot_path - self.env_info.AUTOCONF = autoconf_bin - self.env_info.AUTORECONF = autoreconf_bin - self.env_info.AUTOHEADER = autoheader_bin - self.env_info.AUTOM4TE = autom4te_bin + self.env_info.AUTOCONF = "autoconf" + self.env_info.AUTORECONF = "autoreconf" + self.env_info.AUTOHEADER = "autoheader" + self.env_info.AUTOM4TE = "autom4te" diff --git a/recipes/autoconf/all/patches/2.69-0001-autom4te-relocatable.patch b/recipes/autoconf/all/patches/2.69-0001-autom4te-relocatable.patch deleted file mode 100644 index 7c7e3724d37e68..00000000000000 --- a/recipes/autoconf/all/patches/2.69-0001-autom4te-relocatable.patch +++ /dev/null @@ -1,54 +0,0 @@ ---- bin/autom4te.in -+++ bin/autom4te.in -@@ -268,6 +268,13 @@ - if /^\s*(\#.*)?$/; - - my @words = shellwords ($_); -+ # not using: s#AUTOCONF_M4DIR#$pkgdatadir#r to support perl <5.14 -+ my @words_clone = @words; -+ @words = (); -+ foreach ( @words_clone ) { -+ push(@words, do { (my $tmp = $_) =~ s#AUTOCONF_M4DIR#$pkgdatadir#; $tmp }); -+ } -+ - my $type = shift @words; - if ($type eq 'begin-language:') - { ---- lib/autom4te.in -+++ lib/autom4te.in -@@ -106,7 +106,7 @@ - # This intermediate language is used by aclocal to build aclocal.m4. - - begin-language: "Autoconf-without-aclocal-m4" --args: --prepend-include '@pkgdatadir@' -+args: --prepend-include 'AUTOCONF_M4DIR' - args: --cache=autom4te.cache - args: autoconf/autoconf.m4f - args: acsite.m4? -@@ -133,7 +133,7 @@ - ## -------- ## - - begin-language: "Autotest" --args: --prepend-include '@pkgdatadir@' -+args: --prepend-include 'AUTOCONF_M4DIR' - args: autotest/autotest.m4f - args: package.m4? - args: local.at? -@@ -147,7 +147,7 @@ - ## ---- ## - - begin-language: "M4sh" --args: --prepend-include '@pkgdatadir@' -+args: --prepend-include 'AUTOCONF_M4DIR' - args: m4sugar/m4sh.m4f - args: --mode 777 - args: --language M4sugar -@@ -159,7 +159,7 @@ - ## ------- ## - - begin-language: "M4sugar" --args: --prepend-include '@pkgdatadir@' -+args: --prepend-include 'AUTOCONF_M4DIR' - args: m4sugar/m4sugar.m4f - args: --warnings syntax - end-language: "M4sugar" diff --git a/recipes/autoconf/all/patches/2.69-0002-no-perl-path-in-shebang.patch b/recipes/autoconf/all/patches/2.69-0002-no-perl-path-in-shebang.patch deleted file mode 100644 index 1ff7ad736c9449..00000000000000 --- a/recipes/autoconf/all/patches/2.69-0002-no-perl-path-in-shebang.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- bin/autoheader.in -+++ bin/autoheader.in -@@ -1,4 +1,4 @@ --#! @PERL@ -+#! /usr/bin/env perl - # -*- Perl -*- - # @configure_input@ - ---- bin/autom4te.in -+++ bin/autom4te.in -@@ -1,4 +1,4 @@ --#! @PERL@ -w --# -*- perl -*- -+#! /usr/bin/env perl -+# -*- perl -*- -w - # @configure_input@ - ---- bin/autoreconf.in -+++ bin/autoreconf.in -@@ -1,4 +1,4 @@ --#! @PERL@ -w --# -*- perl -*- -+#! /usr/bin/env perl -+# -*- perl -*- -w - # @configure_input@ - ---- bin/autoscan.in -+++ bin/autoscan.in -@@ -1,4 +1,4 @@ --#! @PERL@ -w --# -*- perl -*- -+#! /usr/bin/env perl -+# -*- perl -*- -w - # @configure_input@ - ---- bin/autoupdate.in -+++ bin/autoupdate.in -@@ -1,4 +1,4 @@ --#! @PERL@ -w --# -*- perl -*- -+#! /usr/bin/env perl -+# -*- perl -*- -w - # @configure_input@ - ---- bin/ifnames.in -+++ bin/ifnames.in -@@ -1,4 +1,4 @@ --#! @PERL@ -w --# -*- perl -*- -+#! /usr/bin/env perl -+# -*- perl -*- -w - # @configure_input@ - diff --git a/recipes/autoconf/all/patches/2.69-0003-uppercase-autom4te_perllibdir.patch b/recipes/autoconf/all/patches/2.69-0003-uppercase-autom4te_perllibdir.patch deleted file mode 100644 index 89895c153b4b92..00000000000000 --- a/recipes/autoconf/all/patches/2.69-0003-uppercase-autom4te_perllibdir.patch +++ /dev/null @@ -1,156 +0,0 @@ ---- bin/autoheader.in -+++ bin/autoheader.in -@@ -28,7 +28,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, "$pkgdatadir"; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/autom4te.in -+++ bin/autom4te.in -@@ -24,7 +24,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/autoreconf.in -+++ bin/autoreconf.in -@@ -26,7 +26,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/autoscan.in -+++ bin/autoscan.in -@@ -25,7 +25,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/autoupdate.in -+++ bin/autoupdate.in -@@ -26,7 +26,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/ifnames.in -+++ bin/ifnames.in -@@ -31,7 +31,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/Makefile.in -+++ bin/Makefile.in -@@ -213,7 +213,7 @@ - # others) to `false'. Autoconf provides autom4te, so that doesn't - # apply to us. - MY_AUTOM4TE = \ -- autom4te_perllibdir='$(top_srcdir)'/lib \ -+ AUTOM4TE_PERLLIBDIR='$(top_srcdir)'/lib \ - AUTOM4TE_CFG='$(AUTOM4TE_CFG)' $(top_builddir)/bin/autom4te \ - -B '$(top_builddir)'/lib -B '$(top_srcdir)'/lib # keep ` ' - ---- lib/autoconf/Makefile.in -+++ lib/autoconf/Makefile.in -@@ -229,7 +229,7 @@ - # others) to `false'. Autoconf provides autom4te, so that doesn't - # apply to us. - MY_AUTOM4TE = \ -- autom4te_perllibdir='$(top_srcdir)'/lib \ -+ AUTOM4TE_PERLLIBDIR='$(top_srcdir)'/lib \ - AUTOM4TE_CFG='$(AUTOM4TE_CFG)' $(top_builddir)/bin/autom4te \ - -B '$(top_builddir)'/lib -B '$(top_srcdir)'/lib # keep ` ' - ---- lib/autoscan/Makefile.in -+++ lib/autoscan/Makefile.in -@@ -215,7 +215,7 @@ - # others) to `false'. Autoconf provides autom4te, so that doesn't - # apply to us. - MY_AUTOM4TE = \ -- autom4te_perllibdir='$(top_srcdir)'/lib \ -+ AUTOM4TE_PERLLIBDIR='$(top_srcdir)'/lib \ - AUTOM4TE_CFG='$(AUTOM4TE_CFG)' $(top_builddir)/bin/autom4te \ - -B '$(top_builddir)'/lib -B '$(top_srcdir)'/lib # keep ` ' - ---- lib/autotest/Makefile.in -+++ lib/autotest/Makefile.in -@@ -222,7 +222,7 @@ - # others) to `false'. Autoconf provides autom4te, so that doesn't - # apply to us. - MY_AUTOM4TE = \ -- autom4te_perllibdir='$(top_srcdir)'/lib \ -+ AUTOM4TE_PERLLIBDIR='$(top_srcdir)'/lib \ - AUTOM4TE_CFG='$(AUTOM4TE_CFG)' $(top_builddir)/bin/autom4te \ - -B '$(top_builddir)'/lib -B '$(top_srcdir)'/lib # keep ` ' - ---- lib/freeze.mk -+++ lib/freeze.mk -@@ -31,7 +31,7 @@ - # others) to `false'. Autoconf provides autom4te, so that doesn't - # apply to us. - MY_AUTOM4TE = \ -- autom4te_perllibdir='$(top_srcdir)'/lib \ -+ AUTOM4TE_PERLLIBDIR='$(top_srcdir)'/lib \ - AUTOM4TE_CFG='$(AUTOM4TE_CFG)' $(top_builddir)/bin/autom4te \ - -B '$(top_builddir)'/lib -B '$(top_srcdir)'/lib # keep ` ' - ---- lib/m4sugar/Makefile.in -+++ lib/m4sugar/Makefile.in -@@ -227,7 +227,7 @@ - # others) to `false'. Autoconf provides autom4te, so that doesn't - # apply to us. - MY_AUTOM4TE = \ -- autom4te_perllibdir='$(top_srcdir)'/lib \ -+ AUTOM4TE_PERLLIBDIR='$(top_srcdir)'/lib \ - AUTOM4TE_CFG='$(AUTOM4TE_CFG)' $(top_builddir)/bin/autom4te \ - -B '$(top_builddir)'/lib -B '$(top_srcdir)'/lib # keep ` ' - ---- tests/Makefile.in 2020-01-29 19:10:51.544709041 +0100 -+++ tests/Makefile.in 2020-01-29 19:10:37.143656386 +0100 -@@ -200,7 +200,7 @@ - # others) to `false'. Autoconf provides autom4te, so that doesn't - # apply to us. - MY_AUTOM4TE = \ -- autom4te_perllibdir='$(top_srcdir)'/lib \ -+ AUTOM4TE_PERLLIBDIR='$(top_srcdir)'/lib \ - AUTOM4TE_CFG='$(AUTOM4TE_CFG)' $(top_builddir)/bin/autom4te \ - -B '$(top_builddir)'/lib -B '$(top_srcdir)'/lib # keep ` ' - ---- tests/wrapper.as 2020-01-29 19:10:54.928721413 +0100 -+++ tests/wrapper.as 2020-01-29 19:10:37.143656386 +0100 -@@ -23,8 +23,8 @@ - AUTOHEADER=autoheader - AUTOM4TE=autom4te - AUTOM4TE_CFG='@abs_top_builddir@/lib/autom4te.cfg' --autom4te_perllibdir='@abs_top_srcdir@/lib' --export AUTOCONF AUTOHEADER AUTOM4TE AUTOM4TE_CFG autom4te_perllibdir -+AUTOM4TE_PERLLIBDIR='@abs_top_srcdir@/lib' -+export AUTOCONF AUTOHEADER AUTOM4TE AUTOM4TE_CFG AUTOM4TE_PERLLIBDIR - - case '@wrap_program@' in - ifnames) diff --git a/recipes/autoconf/all/patches/2.69-0004-no-embedded-m4-paths.patch b/recipes/autoconf/all/patches/2.69-0004-no-embedded-m4-paths.patch deleted file mode 100644 index 7b9c4d0bb1d329..00000000000000 --- a/recipes/autoconf/all/patches/2.69-0004-no-embedded-m4-paths.patch +++ /dev/null @@ -1,154 +0,0 @@ ---- bin/autom4te.in -+++ bin/autom4te.in -@@ -87,7 +87,7 @@ - my $freeze = 0; - - # $M4. --my $m4 = $ENV{"M4"} || '@M4@'; -+my $m4 = $ENV{"M4"} || '/usr/bin/env m4'; - # Some non-GNU m4's don't reject the --help option, so give them /dev/null. - fatal "need GNU m4 1.4 or later: $m4" - if system "$m4 --help &1 | grep reload-state >/dev/null"; ---- bin/autoupdate.in -+++ bin/autoupdate.in -@@ -53,7 +53,7 @@ - my @include = ('@pkgdatadir@'); - my $force = 0; - # m4. --my $m4 = $ENV{"M4"} || '@M4@'; -+my $m4 = $ENV{"M4"} || '/usr/bin/env m4'; - - - # $HELP ---- bin/Makefile.in -+++ bin/Makefile.in -@@ -133,7 +133,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- doc/Makefile.in -+++ doc/Makefile.in -@@ -125,7 +125,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- lib/autoconf/Makefile.in -+++ lib/autoconf/Makefile.in -@@ -135,7 +135,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- lib/Autom4te/Makefile.in -+++ lib/Autom4te/Makefile.in -@@ -114,7 +114,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- lib/autoscan/Makefile.in -+++ lib/autoscan/Makefile.in -@@ -131,7 +131,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- lib/autotest/Makefile.in -+++ lib/autotest/Makefile.in -@@ -134,7 +134,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- lib/emacs/Makefile.in -+++ lib/emacs/Makefile.in -@@ -104,7 +104,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- lib/m4sugar/Makefile.in -+++ lib/m4sugar/Makefile.in -@@ -134,7 +134,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- lib/Makefile.in -+++ lib/Makefile.in -@@ -153,7 +153,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- Makefile.in -+++ Makefile.in -@@ -169,7 +169,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- man/Makefile.in -+++ man/Makefile.in -@@ -115,7 +115,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- tests/Makefile.in -+++ tests/Makefile.in -@@ -107,7 +107,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ diff --git a/recipes/autoconf/all/patches/2.71-0001-autom4te-relocatable.patch b/recipes/autoconf/all/patches/2.71-0001-autom4te-relocatable.patch deleted file mode 100644 index 2fc1a3d51a5f7c..00000000000000 --- a/recipes/autoconf/all/patches/2.71-0001-autom4te-relocatable.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- bin/autom4te.in -+++ bin/autom4te.in -@@ -271,6 +271,13 @@ - if /^\s*(\#.*)?$/; - - my @words = shellwords ($_); -+ # not using: s#AUTOCONF_M4DIR#$pkgdatadir#r to support perl <5.14 -+ my @words_clone = @words; -+ @words = (); -+ foreach ( @words_clone ) { -+ push(@words, do { (my $tmp = $_) =~ s#AUTOCONF_M4DIR#$pkgdatadir#; $tmp }); -+ } -+ - my $type = shift @words; - if ($type eq 'begin-language:') - { ---- lib/autom4te.in -+++ lib/autom4te.in -@@ -115,7 +115,7 @@ - # This intermediate language is used by aclocal to build aclocal.m4. - - begin-language: "Autoconf-without-aclocal-m4" --args: --prepend-include '@pkgdatadir@' -+args: --prepend-include 'AUTOCONF_M4DIR' - args: --cache=autom4te.cache - args: autoconf/autoconf.m4f - args: acsite.m4? -@@ -142,7 +142,7 @@ - ## -------- ## - - begin-language: "Autotest" --args: --prepend-include '@pkgdatadir@' -+args: --prepend-include 'AUTOCONF_M4DIR' - args: autotest/autotest.m4f - args: package.m4? - args: local.at? -@@ -156,7 +156,7 @@ - ## ---- ## - - begin-language: "M4sh" --args: --prepend-include '@pkgdatadir@' -+args: --prepend-include 'AUTOCONF_M4DIR' - args: m4sugar/m4sh.m4f - args: --mode 777 - args: --language M4sugar -@@ -168,6 +168,6 @@ - ## ------- ## - - begin-language: "M4sugar" --args: --prepend-include '@pkgdatadir@' -+args: --prepend-include 'AUTOCONF_M4DIR' - args: m4sugar/m4sugar.m4f - end-language: "M4sugar" diff --git a/recipes/autoconf/all/patches/2.71-0001-relocatable-autoconf.patch b/recipes/autoconf/all/patches/2.71-0001-relocatable-autoconf.patch new file mode 100644 index 00000000000000..ab33a00f77cb77 --- /dev/null +++ b/recipes/autoconf/all/patches/2.71-0001-relocatable-autoconf.patch @@ -0,0 +1,275 @@ +diff --git a/Makefile.in b/Makefile.in +index 22a17b3..ac18c85 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -427,7 +427,7 @@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ + LIBOBJS = @LIBOBJS@ + LIBS = @LIBS@ + LTLIBOBJS = @LTLIBOBJS@ +-M4 = @M4@ ++M4 = /usr/bin/env m4 + M4_DEBUGFILE = @M4_DEBUGFILE@ + M4_GNU = @M4_GNU@ + MAKEINFO = @MAKEINFO@ +diff --git a/bin/autoconf.as b/bin/autoconf.as +index 1407739..50ad1de 100644 +--- a/bin/autoconf.as ++++ b/bin/autoconf.as +@@ -89,8 +89,17 @@ exit_missing_arg=' + # restore font-lock: ' + + # Variables. +-: ${AUTOM4TE='@bindir@/@autom4te-name@'} +-: ${trailer_m4='@pkgdatadir@/autoconf/trailer.m4'} ++# Locate autom4ate and support files relative to current script inside package ++SCRIPT_DIR=$(dirname "$as_myself") ++RES_DIR="$SCRIPT_DIR/../res/autoconf" ++if [[ ! -d "$RES_DIR" ]] ++then ++ echo "Autoconf conan package error, unable to locate resource directory at $RES_DIR\n" ++ exit 1 ++fi ++ ++: ${AUTOM4TE="$SCRIPT_DIR/autom4te"} ++: ${trailer_m4="$RES_DIR/autoconf/trailer.m4"} + autom4te_options= + outfile= + verbose=false +diff --git a/bin/autoheader.in b/bin/autoheader.in +index 1cbf509..9bdd1cf 100644 +--- a/bin/autoheader.in ++++ b/bin/autoheader.in +@@ -29,10 +29,13 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ my $pkgdatadir = $ENV{'autom4te_perllibdir'} || "$scriptpath/../res/autoconf"; + unshift @INC, "$pkgdatadir"; + + # Override SHELL. On DJGPP SHELL may not be set to a shell +@@ -54,7 +57,8 @@ use Autom4te::XFile; + our ($config_h, %symbol, %verbatim); + + # Lib files. +-my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++my $autom4te = $ENV{'AUTOM4TE'} || "$scriptpath/@autom4te-name@"; + my $config_h_in; + my @prepend_include; + my @include; +diff --git a/bin/autom4te.in b/bin/autom4te.in +index 7ebe419..42f09b4 100644 +--- a/bin/autom4te.in ++++ b/bin/autom4te.in +@@ -25,10 +25,13 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ my $pkgdatadir = $ENV{'autom4te_perllibdir'} || "$scriptpath/../res/autoconf"; + unshift @INC, $pkgdatadir; + + # Override SHELL. On DJGPP SHELL may not be set to a shell +@@ -48,7 +51,8 @@ use Autom4te::General; + use Autom4te::XFile; + + # Data directory. +-my $pkgdatadir = $ENV{'AC_MACRODIR'} || '@pkgdatadir@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++my $pkgdatadir = $ENV{'AC_MACRODIR'} || "$scriptpath/../res/autoconf"; + + # $LANGUAGE{LANGUAGE} -- Automatic options for LANGUAGE. + my %language; +@@ -91,7 +95,7 @@ my @include; + my $freeze = 0; + + # $M4. +-my $m4 = $ENV{"M4"} || '@M4@'; ++my $m4 = $ENV{"M4"} || '/usr/bin/env m4'; + # Some non-GNU m4's don't reject the --help option, so give them /dev/null. + fatal "need GNU m4 1.4 or later: $m4" + if system "$m4 --help &1 | grep reload-state >/dev/null"; +@@ -271,6 +275,12 @@ sub load_configuration ($) + if /^\s*(\#.*)?$/; + + my @words = shellwords ($_); ++ # not using: s#AUTOCONF_M4DIR#$pkgdatadir#r to support perl <5.14 ++ my @words_clone = @words; ++ @words = (); ++ foreach ( @words_clone ) { ++ push(@words, do { (my $tmp = $_) =~ s#AUTOCONF_M4DIR#$pkgdatadir#; $tmp }); ++ } + my $type = shift @words; + if ($type eq 'begin-language:') + { +diff --git a/bin/autoreconf.in b/bin/autoreconf.in +index ec391a6..2992b16 100644 +--- a/bin/autoreconf.in ++++ b/bin/autoreconf.in +@@ -28,11 +28,14 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + my $buildauxdir; + BEGIN + { +- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ my $pkgdatadir = $ENV{'autom4te_perllibdir'} || "$scriptpath/../res/autoconf"; + unshift @INC, $pkgdatadir; + + $buildauxdir = $ENV{'autom4te_buildauxdir'} || $pkgdatadir . '/build-aux'; +@@ -117,9 +120,10 @@ Written by David J. MacKenzie and Akim Demaille. + "; + + # Lib files. +-my $autoconf = $ENV{'AUTOCONF'} || '@bindir@/@autoconf-name@'; +-my $autoheader = $ENV{'AUTOHEADER'} || '@bindir@/@autoheader-name@'; +-my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++my $autoconf = $ENV{'AUTOCONF'} || "$scriptpath/@autoconf-name@"; ++my $autoheader = $ENV{'AUTOHEADER'} || "$scriptpath/@autoheader-name@"; ++my $autom4te = $ENV{'AUTOM4TE'} || "$scriptpath/@autom4te-name@"; + my $automake = $ENV{'AUTOMAKE'} || 'automake'; + my $aclocal = $ENV{'ACLOCAL'} || 'aclocal'; + my $libtoolize = $ENV{'LIBTOOLIZE'} || 'libtoolize'; +diff --git a/bin/autoscan.in b/bin/autoscan.in +index b89fd1a..6113d62 100644 +--- a/bin/autoscan.in ++++ b/bin/autoscan.in +@@ -27,10 +27,13 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ my $pkgdatadir = $ENV{'autom4te_perllibdir'} || "$scriptpath/../res/autoconf"; + unshift @INC, $pkgdatadir; + + # Override SHELL. On DJGPP SHELL may not be set to a shell +@@ -95,7 +98,8 @@ my %needed_macros = + my $log; + + # Autoconf and lib files. +-my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++my $autom4te = $ENV{'AUTOM4TE'} || "$scriptpath/@autom4te-name@"; + my $autoconf = "$autom4te --language=autoconf"; + my @prepend_include; + my @include = ('@pkgdatadir@'); +diff --git a/bin/autoupdate.in b/bin/autoupdate.in +index c86203a..844dd20 100644 +--- a/bin/autoupdate.in ++++ b/bin/autoupdate.in +@@ -28,10 +28,13 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ my $pkgdatadir = $ENV{'autom4te_perllibdir'} || "$scriptpath/../res/autoconf"; + unshift @INC, $pkgdatadir; + + # Override SHELL. On DJGPP SHELL may not be set to a shell +@@ -51,14 +54,15 @@ use Autom4te::General; + use Autom4te::XFile; + + # Lib files. +-my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++my $autom4te = $ENV{'AUTOM4TE'} || "$scriptpath/@autom4te-name@"; + my $autoconf = "$autom4te --language=autoconf"; + # We need to find m4sugar. + my @prepend_include; + my @include = ('@pkgdatadir@'); + my $force = 0; + # m4. +-my $m4 = $ENV{"M4"} || '@M4@'; ++my $m4 = $ENV{"M4"} || '/usr/bin/env m4'; + + + # $HELP +diff --git a/bin/ifnames.in b/bin/ifnames.in +index b04947f..75d014e 100644 +--- a/bin/ifnames.in ++++ b/bin/ifnames.in +@@ -32,10 +32,13 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ my $pkgdatadir = $ENV{'autom4te_perllibdir'} || "$scriptpath/../res/autoconf"; + unshift @INC, $pkgdatadir; + + # Override SHELL. On DJGPP SHELL may not be set to a shell +diff --git a/lib/autom4te.in b/lib/autom4te.in +index 9e86c9f..bf3ae42 100644 +--- a/lib/autom4te.in ++++ b/lib/autom4te.in +@@ -115,7 +115,7 @@ end-language: "Autoreconf-preselections" + # This intermediate language is used by aclocal to build aclocal.m4. + + begin-language: "Autoconf-without-aclocal-m4" +-args: --prepend-include '@pkgdatadir@' ++args: --prepend-include 'AUTOCONF_M4DIR' + args: --cache=autom4te.cache + args: autoconf/autoconf.m4f + args: acsite.m4? +@@ -142,7 +142,7 @@ end-language: "Autoconf" + ## -------- ## + + begin-language: "Autotest" +-args: --prepend-include '@pkgdatadir@' ++args: --prepend-include 'AUTOCONF_M4DIR' + args: autotest/autotest.m4f + args: package.m4? + args: local.at? +@@ -156,7 +156,7 @@ end-language: "Autotest" + ## ---- ## + + begin-language: "M4sh" +-args: --prepend-include '@pkgdatadir@' ++args: --prepend-include 'AUTOCONF_M4DIR' + args: m4sugar/m4sh.m4f + args: --mode 777 + args: --language M4sugar +@@ -168,6 +168,6 @@ end-language: "M4sh" + ## ------- ## + + begin-language: "M4sugar" +-args: --prepend-include '@pkgdatadir@' ++args: --prepend-include 'AUTOCONF_M4DIR' + args: m4sugar/m4sugar.m4f + end-language: "M4sugar" diff --git a/recipes/autoconf/all/patches/2.71-0005-disable-man-regeneration.patch b/recipes/autoconf/all/patches/2.71-0003-disable-man-regeneration.patch similarity index 100% rename from recipes/autoconf/all/patches/2.71-0005-disable-man-regeneration.patch rename to recipes/autoconf/all/patches/2.71-0003-disable-man-regeneration.patch diff --git a/recipes/autoconf/all/patches/2.71-0003-uppercase-autom4te_perllibdir.patch b/recipes/autoconf/all/patches/2.71-0003-uppercase-autom4te_perllibdir.patch deleted file mode 100644 index f877e630d58f5a..00000000000000 --- a/recipes/autoconf/all/patches/2.71-0003-uppercase-autom4te_perllibdir.patch +++ /dev/null @@ -1,77 +0,0 @@ ---- bin/autoheader.in -+++ bin/autoheader.in -@@ -32,7 +32,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, "$pkgdatadir"; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/autom4te.in -+++ bin/autom4te.in -@@ -28,7 +28,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/autoreconf.in -+++ bin/autoreconf.in -@@ -32,7 +32,7 @@ - my $buildauxdir; - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - $buildauxdir = $ENV{'autom4te_buildauxdir'} || $pkgdatadir . '/build-aux'; ---- bin/autoscan.in -+++ bin/autoscan.in -@@ -30,7 +30,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/autoupdate.in -+++ bin/autoupdate.in -@@ -31,7 +31,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/ifnames.in -+++ bin/ifnames.in -@@ -35,7 +35,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- Makefile.in -+++ Makefile.in -@@ -576,7 +567,7 @@ - # others) to `false'. Autoconf provides autom4te, so that doesn't - # apply to us. - MY_AUTOM4TE = \ -- autom4te_perllibdir='$(top_srcdir)'/lib \ -+ AUTOM4TE_PERLLIBDIR='$(top_srcdir)'/lib \ - AUTOM4TE_CFG='$(AUTOM4TE_CFG)' $(top_build_prefix)bin/autom4te \ - -B '$(top_build_prefix)'lib -B '$(top_srcdir)'/lib # keep ` ' - diff --git a/recipes/autoconf/all/patches/2.71-0004-no-embedded-m4-paths.patch b/recipes/autoconf/all/patches/2.71-0004-no-embedded-m4-paths.patch deleted file mode 100644 index d47835a0e0137d..00000000000000 --- a/recipes/autoconf/all/patches/2.71-0004-no-embedded-m4-paths.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- bin/autom4te.in -+++ bin/autom4te.in -@@ -91,7 +91,7 @@ - my $freeze = 0; - - # $M4. --my $m4 = $ENV{"M4"} || '@M4@'; -+my $m4 = $ENV{"M4"} || '/usr/bin/env m4'; - # Some non-GNU m4's don't reject the --help option, so give them /dev/null. - fatal "need GNU m4 1.4 or later: $m4" - if system "$m4 --help &1 | grep reload-state >/dev/null"; ---- bin/autoupdate.in -+++ bin/autoupdate.in -@@ -58,7 +58,7 @@ - my @include = ('@pkgdatadir@'); - my $force = 0; - # m4. --my $m4 = $ENV{"M4"} || '@M4@'; -+my $m4 = $ENV{"M4"} || '/usr/bin/env m4'; - - - # $HELP ---- Makefile.in -+++ Makefile.in -@@ -427,7 +427,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ diff --git a/recipes/autoconf/all/patches/2.71-0006-autoconf-no-embedded-trailer_m4-path.patch b/recipes/autoconf/all/patches/2.71-0006-autoconf-no-embedded-trailer_m4-path.patch deleted file mode 100644 index a346636c611390..00000000000000 --- a/recipes/autoconf/all/patches/2.71-0006-autoconf-no-embedded-trailer_m4-path.patch +++ /dev/null @@ -1,17 +0,0 @@ -The trailer_m4 environment variable contains build-environment dependent information. -So this variable needs to be overridden by the conanfile. -But Windows has case insensitive environment variables. -Python silently converts lowercase environment variables to uppercase. -Work around this problem by getting the system information from an uppercase environment variable. - ---- bin/autoconf.as -+++ bin/autoconf.as -@@ -90,7 +90,7 @@ - - # Variables. - : ${AUTOM4TE='@bindir@/@autom4te-name@'} --: ${trailer_m4='@pkgdatadir@/autoconf/trailer.m4'} -+: ${trailer_m4="$AC_MACRODIR/autoconf/trailer.m4"} - autom4te_options= - outfile= - verbose=false diff --git a/recipes/autoconf/config.yml b/recipes/autoconf/config.yml index 7eafcfb17c54fe..f45dc3e529288e 100644 --- a/recipes/autoconf/config.yml +++ b/recipes/autoconf/config.yml @@ -1,5 +1,3 @@ versions: "2.71": folder: all - "2.69": - folder: all diff --git a/recipes/automake/all/conandata.yml b/recipes/automake/all/conandata.yml index 24df7aa715c72e..058a6cc80e230c 100644 --- a/recipes/automake/all/conandata.yml +++ b/recipes/automake/all/conandata.yml @@ -16,47 +16,22 @@ sources: sha256: "608a97523f97db32f1f5d5615c98ca69326ced2054c9f82e65bade7fc4c9dea8" patches: "1.16.5": - - base_path: "source_subfolder" - patch_file: "patches/0001-help2man-no-discard-stderr-0.16.4.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-no-perl-path-in-shebang-0.16.4.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.3.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-introduce-automake_perllibdir-0.16.3.patch" + - patch_file: "patches/0001-help2man-no-discard-stderr-1.16.5.patch" + - patch_file: "patches/0002-no-perl-path-in-shebang-1.16.5.patch" + - patch_file: "patches/0003-relocatable-automake-1.16.5.patch" "1.16.4": - - base_path: "source_subfolder" - patch_file: "patches/0001-help2man-no-discard-stderr-0.16.4.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-no-perl-path-in-shebang-0.16.4.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.3.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-introduce-automake_perllibdir-0.16.3.patch" + - patch_file: "patches/0001-help2man-no-discard-stderr-1.16.4.patch" + - patch_file: "patches/0002-no-perl-path-in-shebang-1.16.4.patch" + - patch_file: "patches/0003-relocatable-automake-1.16.4.patch" "1.16.3": - - base_path: "source_subfolder" - patch_file: "patches/0001-help2man-no-discard-stderr-0.16.3.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-no-perl-path-in-shebang-0.16.3.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.3.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-introduce-automake_perllibdir-0.16.3.patch" + - patch_file: "patches/0001-help2man-no-discard-stderr-1.16.3.patch" + - patch_file: "patches/0002-no-perl-path-in-shebang-1.16.3.patch" + - patch_file: "patches/0003-relocatable-automake-1.16.3.patch" "1.16.2": - - base_path: "source_subfolder" - patch_file: "patches/0001-help2man-no-discard-stderr-0.16.2.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-no-perl-path-in-shebang-0.16.2.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.2.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-introduce-automake_perllibdir-0.16.2.patch" + - patch_file: "patches/0001-help2man-no-discard-stderr-1.16.2.patch" + - patch_file: "patches/0002-no-perl-path-in-shebang-1.16.2.patch" + - patch_file: "patches/0003-relocatable-automake-1.16.2.patch" "1.16.1": - - base_path: "source_subfolder" - patch_file: "patches/0001-help2man-no-discard-stderr-0.16.1.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-no-perl-path-in-shebang-0.16.1.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.1.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-introduce-automake_perllibdir-0.16.1.patch" + - patch_file: "patches/0001-help2man-no-discard-stderr-1.16.1.patch" + - patch_file: "patches/0002-no-perl-path-in-shebang-1.16.1.patch" + - patch_file: "patches/0003-relocatable-automake-1.16.1.patch" diff --git a/recipes/automake/all/conanfile.py b/recipes/automake/all/conanfile.py index 472f84cf07d885..25a1e0fbdb40f7 100644 --- a/recipes/automake/all/conanfile.py +++ b/recipes/automake/all/conanfile.py @@ -1,11 +1,17 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.53.0" class AutomakeConan(ConanFile): name = "automake" + package_type = "application" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.gnu.org/software/automake/" description = "Automake is a tool for automatically generating Makefile.in files compliant with the GNU Coding Standards." @@ -13,14 +19,6 @@ class AutomakeConan(ConanFile): license = ("GPL-2.0-or-later", "GPL-3.0-or-later") settings = "os", "arch", "compiler", "build_type" - exports_sources = "patches/*" - - _autotools = None - - @property - def _source_subfolder(self): - return os.path.join(self.source_folder, "source_subfolder") - @property def _version_major_minor(self): [major, minor, _] = self.version.split(".", 2) @@ -30,6 +28,12 @@ def _version_major_minor(self): def _settings_build(self): return getattr(self, "settings_build", self.settings) + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + def configure(self): del self.settings.compiler.cppstd del self.settings.compiler.libcxx @@ -41,7 +45,8 @@ def requirements(self): def build_requirements(self): if hasattr(self, "settings_build"): self.build_requires("autoconf/2.71") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): + if self._settings_build.os == "Windows" and not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.win_bash = True self.build_requires("msys2/cci.latest") def package_id(self): @@ -50,8 +55,8 @@ def package_id(self): del self.info.settings.build_type def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) @property def _datarootdir(self): @@ -61,41 +66,47 @@ def _datarootdir(self): def _automake_libdir(self): return os.path.join(self._datarootdir, "automake-{}".format(self._version_major_minor)) - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - conf_args = [ - "--datarootdir={}".format(tools.unix_path(self._datarootdir)), - "--prefix={}".format(tools.unix_path(self.package_folder)), - ] - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return self._autotools - - def _patch_files(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ + "--datarootdir=${prefix}/res", + ]) + + tc.generate() + + def _patch_sources(self): + apply_conandata_patches(self) if self.settings.os == "Windows": # tracing using m4 on Windows returns Windows paths => use cygpath to convert to unix paths - tools.replace_in_file(os.path.join(self._source_subfolder, "bin", "aclocal.in"), - " $map_traced_defs{$arg1} = $file;", - " $file = `cygpath -u $file`;\n" - " $file =~ s/^\\s+|\\s+$//g;\n" - " $map_traced_defs{$arg1} = $file;") + ac_local_in = os.path.join(self.source_folder, "bin", "aclocal.in") + replace_in_file(self, ac_local_in, + " $map_traced_defs{$arg1} = $file;", + " $file = `cygpath -u $file`;\n" + " $file =~ s/^\\s+|\\s+$//g;\n" + " $map_traced_defs{$arg1} = $file;") + # handle relative paths during aclocal.m4 creation + replace_in_file(self, ac_local_in, "$map{$m} eq $map_traced_defs{$m}", + "abs_path($map{$m}) eq abs_path($map_traced_defs{$m})") def build(self): - self._patch_files() - autotools = self._configure_autotools() + self._patch_sources() + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - self.copy("COPYING*", src=self._source_subfolder, dst="licenses") - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self._datarootdir, "info")) - tools.rmdir(os.path.join(self._datarootdir, "man")) - tools.rmdir(os.path.join(self._datarootdir, "doc")) + copy(self, "COPYING*", src=self.source_folder, dst=os.path.join(self.package_folder,"licenses")) + rmdir(self, os.path.join(self._datarootdir, "info")) + rmdir(self, os.path.join(self._datarootdir, "man")) + rmdir(self, os.path.join(self._datarootdir, "doc")) + + # TODO: consider whether the following is still necessary on Windows if self.settings.os == "Windows": binpath = os.path.join(self.package_folder, "bin") for filename in os.listdir(binpath): @@ -108,33 +119,15 @@ def package_info(self): self.cpp_info.libdirs = [] self.cpp_info.includedirs = [] + # For consumers with new integrations (Conan 1 and 2 compatible): + compile_wrapper = os.path.join(self._automake_libdir, "compile") + lib_wrapper = os.path.join(self._automake_libdir, "ar-lib") + self.conf_info.define("user.automake:compile-wrapper", compile_wrapper) + self.conf_info.define("user.automake:lib-wrapper", lib_wrapper) + + # For legacy Conan 1.x consumers only: + self.user_info.compile = compile_wrapper + self.user_info.ar_lib = lib_wrapper bin_path = os.path.join(self.package_folder, "bin") self.output.info("Appending PATH environment variable:: {}".format(bin_path)) self.env_info.PATH.append(bin_path) - - bin_ext = ".exe" if self.settings.os == "Windows" else "" - - aclocal = tools.unix_path(os.path.join(self.package_folder, "bin", "aclocal" + bin_ext)) - self.output.info("Appending ACLOCAL environment variable with: {}".format(aclocal)) - self.env_info.ACLOCAL.append(aclocal) - - automake_datadir = tools.unix_path(self._datarootdir) - self.output.info("Setting AUTOMAKE_DATADIR to {}".format(automake_datadir)) - self.env_info.AUTOMAKE_DATADIR = automake_datadir - - automake_libdir = tools.unix_path(self._automake_libdir) - self.output.info("Setting AUTOMAKE_LIBDIR to {}".format(automake_libdir)) - self.env_info.AUTOMAKE_LIBDIR = automake_libdir - - automake_perllibdir = tools.unix_path(self._automake_libdir) - self.output.info("Setting AUTOMAKE_PERLLIBDIR to {}".format(automake_perllibdir)) - self.env_info.AUTOMAKE_PERLLIBDIR = automake_perllibdir - - automake = tools.unix_path(os.path.join(self.package_folder, "bin", "automake" + bin_ext)) - self.output.info("Setting AUTOMAKE to {}".format(automake)) - self.env_info.AUTOMAKE = automake - - self.output.info("Append M4 include directories to AUTOMAKE_CONAN_INCLUDES environment variable") - - self.user_info.compile = os.path.join(self._automake_libdir, "compile") - self.user_info.ar_lib = os.path.join(self._automake_libdir, "ar-lib") diff --git a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.3.patch b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.3.patch deleted file mode 100644 index b608f94a120089..00000000000000 --- a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.3.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- Makefile.in -+++ Makefile.in -@@ -711,4 +711,4 @@ - update_mans = \ - $(AM_V_GEN): \ - && $(MKDIR_P) doc \ -- && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --output=$@ -+ && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --no-discard-stderr --output=$@ - diff --git a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.4.patch b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.4.patch deleted file mode 100644 index 0ae00eb737eac9..00000000000000 --- a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.4.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- Makefile.in -+++ Makefile.in -@@ -703,4 +703,4 @@ - update_mans = \ - $(AM_V_GEN): \ - && $(MKDIR_P) doc \ -- && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --output=$@ -+ && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --no-discard-stderr --output=$@ - diff --git a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.1.patch b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.1.patch similarity index 65% rename from recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.1.patch rename to recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.1.patch index 56c09e6ef56108..4472414040ceb1 100644 --- a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.1.patch +++ b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.1.patch @@ -1,11 +1,13 @@ ---- Makefile.in -+++ Makefile.in -@@ -706,7 +706,7 @@ +diff --git a/Makefile.in b/Makefile.in +index c3e934c..b96e108 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -706,7 +706,7 @@ man1_MANS = \ update_mans = \ $(AM_V_GEN): \ && $(MKDIR_P) doc \ - && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --output=$@ + && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --no-discard-stderr --output=$@ - + amhello_sources = \ doc/amhello/configure.ac \ diff --git a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.2.patch b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.2.patch similarity index 65% rename from recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.2.patch rename to recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.2.patch index 9c66ba2afeeb71..8caedb331444e7 100644 --- a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.2.patch +++ b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.2.patch @@ -1,11 +1,13 @@ ---- Makefile.in -+++ Makefile.in -@@ -699,7 +699,7 @@ +diff --git a/Makefile.in b/Makefile.in +index 670f97a..feb1085 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -699,7 +699,7 @@ man1_MANS = \ update_mans = \ $(AM_V_GEN): \ && $(MKDIR_P) doc \ - && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --output=$@ + && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --no-discard-stderr --output=$@ - + amhello_sources = \ doc/amhello/configure.ac \ diff --git a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.3.patch b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.3.patch new file mode 100644 index 00000000000000..e6fc1e37c7a203 --- /dev/null +++ b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.3.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile.in b/Makefile.in +index 3190a66..c599705 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -711,7 +711,7 @@ man1_MANS = \ + update_mans = \ + $(AM_V_GEN): \ + && $(MKDIR_P) doc \ +- && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --output=$@ ++ && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --no-discard-stderr --output=$@ + + checklinkx = $(top_srcdir)/contrib/checklinkx + # that 4-second sleep seems to be what gnu.org likes. diff --git a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.4.patch b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.4.patch new file mode 100644 index 00000000000000..aec1e1e992850a --- /dev/null +++ b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.4.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile.in b/Makefile.in +index bbe2d04..3a0f57e 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -703,7 +703,7 @@ man1_MANS = \ + update_mans = \ + $(AM_V_GEN): \ + && $(MKDIR_P) doc \ +- && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --output=$@ ++ && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --no-discard-stderr --output=$@ + + checklinkx = $(top_srcdir)/contrib/checklinkx + # that 4-second sleep seems to be what gnu.org likes. diff --git a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.5.patch b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.5.patch new file mode 100644 index 00000000000000..c593ef11dafd15 --- /dev/null +++ b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.5.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile.in b/Makefile.in +index 18850e7..ae75282 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -703,7 +703,7 @@ man1_MANS = \ + update_mans = \ + $(AM_V_GEN): \ + && $(MKDIR_P) doc \ +- && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --output=$@ ++ && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --no-discard-stderr --output=$@ + + checklinkx = $(top_srcdir)/contrib/checklinkx + # that 4-second sleep seems to be what gnu.org likes. diff --git a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.2.patch b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.2.patch deleted file mode 100644 index 5e91a18bb5be9f..00000000000000 --- a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.2.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -1,1 +1,1 @@ --#!@PERL@ -w -+#!/usr/bin/env perl -+# -*- perl -*- -w ---- bin/automake.in -+++ bin/automake.in -@@ -1,1 +1,1 @@ --#!@PERL@ -w -+#!/usr/bin/env perl -+# -*- perl -*- -w ---- Makefile.in -+++ Makefile.in -@@ -524,7 +524,7 @@ - PACKAGE_URL = @PACKAGE_URL@ - PACKAGE_VERSION = @PACKAGE_VERSION@ - PATH_SEPARATOR = @PATH_SEPARATOR@ --PERL = @PERL@ -+PERL = /usr/bin/env perl - RELEASE_YEAR = @RELEASE_YEAR@ - SET_MAKE = @SET_MAKE@ - SHELL = @SHELL@ ---- t/ax/test-defs.in -+++ t/ax/test-defs.in -@@ -97,7 +97,7 @@ - # User can override various tools used. Prefer overriding specific for - # that automake testsuite, if they are available. - AWK=${AM_TESTSUITE_AWK-${AWK-'@AWK@'}} --PERL=${AM_TESTSUITE_PERL-${PERL-'@PERL@'}} -+PERL=${AM_TESTSUITE_PERL-${PERL-'/usr/bin/env perl'}} - MAKE=${AM_TESTSUITE_MAKE-${MAKE-'make'}} - YACC=${AM_TESTSUITE_YACC-${YACC-'@YACC@'}} - LEX=${AM_TESTSUITE_LEX-${LEX-'@LEX@'}} diff --git a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.3.patch b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.3.patch deleted file mode 100644 index d13c305ceee18d..00000000000000 --- a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.3.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -1,1 +1,1 @@ --#!@PERL@ -+#!/usr/bin/env perl ---- bin/automake.in -+++ bin/automake.in -@@ -1,1 +1,1 @@ --#!@PERL@ -+#!/usr/bin/env perl ---- Makefile.in -+++ Makefile.in -@@ -535,7 +535,7 @@ - PACKAGE_URL = @PACKAGE_URL@ - PACKAGE_VERSION = @PACKAGE_VERSION@ - PATH_SEPARATOR = @PATH_SEPARATOR@ --PERL = @PERL@ -+PERL = /usr/bin/env perl - RELEASE_YEAR = @RELEASE_YEAR@ - SET_MAKE = @SET_MAKE@ - SHELL = @SHELL@ ---- t/ax/test-defs.in -+++ t/ax/test-defs.in -@@ -97,7 +97,7 @@ - # User can override various tools used. Prefer overriding specific for - # that automake testsuite, if they are available. - AWK=${AM_TESTSUITE_AWK-${AWK-'@AWK@'}} --PERL=${AM_TESTSUITE_PERL-${PERL-'@PERL@'}} -+PERL=${AM_TESTSUITE_PERL-${PERL-'/usr/bin/env perl'}} - MAKE=${AM_TESTSUITE_MAKE-${MAKE-'make'}} - YACC=${AM_TESTSUITE_YACC-${YACC-'@YACC@'}} - LEX=${AM_TESTSUITE_LEX-${LEX-'@LEX@'}} diff --git a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.4.patch b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.4.patch deleted file mode 100644 index 986bcfba267608..00000000000000 --- a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.4.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -1,1 +1,1 @@ --#!@PERL@ -+#!/usr/bin/env perl ---- bin/automake.in -+++ bin/automake.in -@@ -1,1 +1,1 @@ --#!@PERL@ -+#!/usr/bin/env perl ---- Makefile.in -+++ Makefile.in -@@ -527,7 +527,7 @@ - PACKAGE_URL = @PACKAGE_URL@ - PACKAGE_VERSION = @PACKAGE_VERSION@ - PATH_SEPARATOR = @PATH_SEPARATOR@ --PERL = @PERL@ -+PERL = /usr/bin/env perl - RELEASE_YEAR = @RELEASE_YEAR@ - SET_MAKE = @SET_MAKE@ - SHELL = @SHELL@ ---- t/ax/test-defs.in -+++ t/ax/test-defs.in -@@ -97,7 +97,7 @@ - # User can override various tools used. Prefer overriding specific for - # that automake testsuite, if they are available. - AWK=${AM_TESTSUITE_AWK-${AWK-'@AWK@'}} --PERL=${AM_TESTSUITE_PERL-${PERL-'@PERL@'}} -+PERL=${AM_TESTSUITE_PERL-${PERL-'/usr/bin/env perl'}} - MAKE=${AM_TESTSUITE_MAKE-${MAKE-'make'}} - YACC=${AM_TESTSUITE_YACC-${YACC-'@YACC@'}} - LEX=${AM_TESTSUITE_LEX-${LEX-'@LEX@'}} diff --git a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.1.patch b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.1.patch similarity index 60% rename from recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.1.patch rename to recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.1.patch index 3b71368f122614..54ba3ebcf4d591 100644 --- a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.1.patch +++ b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.1.patch @@ -1,10 +1,24 @@ ---- bin/aclocal.in -+++ bin/aclocal.in +diff --git a/Makefile.in b/Makefile.in +index b96e108..dd05843 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -532,7 +532,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ + PACKAGE_URL = @PACKAGE_URL@ + PACKAGE_VERSION = @PACKAGE_VERSION@ + PATH_SEPARATOR = @PATH_SEPARATOR@ +-PERL = @PERL@ ++PERL = /usr/bin/env perl + RELEASE_YEAR = @RELEASE_YEAR@ + SET_MAKE = @SET_MAKE@ + SHELL = @SHELL@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index b3715d9..acf4792 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in @@ -1,8 +1,8 @@ -#!@PERL@ -w --# -*- perl -*- +#!/usr/bin/env perl -+# -*- perl -*- -w + # -*- perl -*- # @configure_input@ -eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' @@ -12,34 +26,26 @@ if 0; # aclocal - create aclocal.m4 by scanning configure.ac ---- bin/automake.in -+++ bin/automake.in +diff --git a/bin/automake.in b/bin/automake.in +index a52a489..0abd5f6 100644 +--- a/bin/automake.in ++++ b/bin/automake.in @@ -1,8 +1,8 @@ -#!@PERL@ -w --# -*- perl -*- +#!/usr/bin/env perl -+# -*- perl -*- -w + # -*- perl -*- # @configure_input@ -eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' -+eval 'case $# in 0) exec /usr/bin/env perl -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' ++eval 'case $# in 0) exec /usr/bin/env perl -S "$0";; *) exec /usr/bin/env perl -S "$0" "$@";; esac' if 0; # automake - create Makefile.in from Makefile.am ---- Makefile.in -+++ Makefile.in -@@ -532,7 +532,7 @@ - PACKAGE_URL = @PACKAGE_URL@ - PACKAGE_VERSION = @PACKAGE_VERSION@ - PATH_SEPARATOR = @PATH_SEPARATOR@ --PERL = @PERL@ -+PERL = /usr/bin/env perl - RELEASE_YEAR = @RELEASE_YEAR@ - SET_MAKE = @SET_MAKE@ - SHELL = @SHELL@ ---- t/ax/test-defs.in -+++ t/ax/test-defs.in -@@ -97,7 +97,7 @@ +diff --git a/t/ax/test-defs.in b/t/ax/test-defs.in +index 5dc2a61..3f53902 100644 +--- a/t/ax/test-defs.in ++++ b/t/ax/test-defs.in +@@ -97,7 +97,7 @@ SHELL=${AM_TESTSUITE_SHELL-'@SHELL@'}; export SHELL # User can override various tools used. Prefer overriding specific for # that automake testsuite, if they are available. AWK=${AM_TESTSUITE_AWK-${AWK-'@AWK@'}} diff --git a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.2.patch b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.2.patch new file mode 100644 index 00000000000000..62935414ace95f --- /dev/null +++ b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.2.patch @@ -0,0 +1,46 @@ +diff --git a/Makefile.in b/Makefile.in +index feb1085..5d2f5cc 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -524,7 +524,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ + PACKAGE_URL = @PACKAGE_URL@ + PACKAGE_VERSION = @PACKAGE_VERSION@ + PATH_SEPARATOR = @PATH_SEPARATOR@ +-PERL = @PERL@ ++PERL = /usr/bin/env perl + RELEASE_YEAR = @RELEASE_YEAR@ + SET_MAKE = @SET_MAKE@ + SHELL = @SHELL@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index 9a20325..0a4eac4 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in +@@ -1,4 +1,4 @@ +-#!@PERL@ -w ++#!/usr/bin/env perl + # aclocal - create aclocal.m4 by scanning configure.ac -*- perl -*- + # @configure_input@ + # Copyright (C) 1996-2020 Free Software Foundation, Inc. +diff --git a/bin/automake.in b/bin/automake.in +index 212cb38..cb077a7 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -1,4 +1,4 @@ +-#!@PERL@ -w ++#!/usr/bin/env perl + # automake - create Makefile.in from Makefile.am -*- perl -*- + # @configure_input@ + # Copyright (C) 1994-2020 Free Software Foundation, Inc. +diff --git a/t/ax/test-defs.in b/t/ax/test-defs.in +index dff88b7..20b012f 100644 +--- a/t/ax/test-defs.in ++++ b/t/ax/test-defs.in +@@ -97,7 +97,7 @@ SHELL=${AM_TESTSUITE_SHELL-'@SHELL@'}; export SHELL + # User can override various tools used. Prefer overriding specific for + # that automake testsuite, if they are available. + AWK=${AM_TESTSUITE_AWK-${AWK-'@AWK@'}} +-PERL=${AM_TESTSUITE_PERL-${PERL-'@PERL@'}} ++PERL=${AM_TESTSUITE_PERL-${PERL-'/usr/bin/env perl'}} + MAKE=${AM_TESTSUITE_MAKE-${MAKE-'make'}} + YACC=${AM_TESTSUITE_YACC-${YACC-'@YACC@'}} + LEX=${AM_TESTSUITE_LEX-${LEX-'@LEX@'}} diff --git a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.3.patch b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.3.patch new file mode 100644 index 00000000000000..1a24e6d5d93a76 --- /dev/null +++ b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.3.patch @@ -0,0 +1,46 @@ +diff --git a/Makefile.in b/Makefile.in +index c599705..8c18ed2 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -535,7 +535,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ + PACKAGE_URL = @PACKAGE_URL@ + PACKAGE_VERSION = @PACKAGE_VERSION@ + PATH_SEPARATOR = @PATH_SEPARATOR@ +-PERL = @PERL@ ++PERL = /usr/bin/env perl + RELEASE_YEAR = @RELEASE_YEAR@ + SET_MAKE = @SET_MAKE@ + SHELL = @SHELL@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index ca2f963..8782f24 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in +@@ -1,4 +1,4 @@ +-#!@PERL@ ++#!/usr/bin/env perl + # aclocal - create aclocal.m4 by scanning configure.ac -*- perl -*- + # @configure_input@ + # Copyright (C) 1996-2020 Free Software Foundation, Inc. +diff --git a/bin/automake.in b/bin/automake.in +index 31c7238..e41b1f5 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -1,4 +1,4 @@ +-#!@PERL@ ++#!/usr/bin/env perl + # automake - create Makefile.in from Makefile.am -*- perl -*- + # @configure_input@ + # Copyright (C) 1994-2020 Free Software Foundation, Inc. +diff --git a/t/ax/test-defs.in b/t/ax/test-defs.in +index dff88b7..20b012f 100644 +--- a/t/ax/test-defs.in ++++ b/t/ax/test-defs.in +@@ -97,7 +97,7 @@ SHELL=${AM_TESTSUITE_SHELL-'@SHELL@'}; export SHELL + # User can override various tools used. Prefer overriding specific for + # that automake testsuite, if they are available. + AWK=${AM_TESTSUITE_AWK-${AWK-'@AWK@'}} +-PERL=${AM_TESTSUITE_PERL-${PERL-'@PERL@'}} ++PERL=${AM_TESTSUITE_PERL-${PERL-'/usr/bin/env perl'}} + MAKE=${AM_TESTSUITE_MAKE-${MAKE-'make'}} + YACC=${AM_TESTSUITE_YACC-${YACC-'@YACC@'}} + LEX=${AM_TESTSUITE_LEX-${LEX-'@LEX@'}} diff --git a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.4.patch b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.4.patch new file mode 100644 index 00000000000000..e4e77c4731fc55 --- /dev/null +++ b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.4.patch @@ -0,0 +1,46 @@ +diff --git a/Makefile.in b/Makefile.in +index 3a0f57e..4bdcf55 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -527,7 +527,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ + PACKAGE_URL = @PACKAGE_URL@ + PACKAGE_VERSION = @PACKAGE_VERSION@ + PATH_SEPARATOR = @PATH_SEPARATOR@ +-PERL = @PERL@ ++PERL = /usr/bin/env perl + RELEASE_YEAR = @RELEASE_YEAR@ + SET_MAKE = @SET_MAKE@ + SHELL = @SHELL@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index f112447..a63ce4d 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in +@@ -1,4 +1,4 @@ +-#!@PERL@ ++#!/usr/bin/env perl + # aclocal - create aclocal.m4 by scanning configure.ac -*- perl -*- + # @configure_input@ + # Copyright (C) 1996-2021 Free Software Foundation, Inc. +diff --git a/bin/automake.in b/bin/automake.in +index f04f5d5..4502558 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -1,4 +1,4 @@ +-#!@PERL@ ++#!/usr/bin/env perl + # automake - create Makefile.in from Makefile.am -*- perl -*- + # @configure_input@ + # Copyright (C) 1994-2021 Free Software Foundation, Inc. +diff --git a/t/ax/test-defs.in b/t/ax/test-defs.in +index c404b0e..381d965 100644 +--- a/t/ax/test-defs.in ++++ b/t/ax/test-defs.in +@@ -97,7 +97,7 @@ SHELL=${AM_TESTSUITE_SHELL-'@SHELL@'}; export SHELL + # User can override various tools used. Prefer overriding specific for + # that automake testsuite, if they are available. + AWK=${AM_TESTSUITE_AWK-${AWK-'@AWK@'}} +-PERL=${AM_TESTSUITE_PERL-${PERL-'@PERL@'}} ++PERL=${AM_TESTSUITE_PERL-${PERL-'/usr/bin/env perl'}} + MAKE=${AM_TESTSUITE_MAKE-${MAKE-'make'}} + YACC=${AM_TESTSUITE_YACC-${YACC-'@YACC@'}} + LEX=${AM_TESTSUITE_LEX-${LEX-'@LEX@'}} diff --git a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.5.patch b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.5.patch new file mode 100644 index 00000000000000..aa3b8311015962 --- /dev/null +++ b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.5.patch @@ -0,0 +1,46 @@ +diff --git a/Makefile.in b/Makefile.in +index ae75282..55844e7 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -527,7 +527,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ + PACKAGE_URL = @PACKAGE_URL@ + PACKAGE_VERSION = @PACKAGE_VERSION@ + PATH_SEPARATOR = @PATH_SEPARATOR@ +-PERL = @PERL@ ++PERL = /usr/bin/env perl + RELEASE_YEAR = @RELEASE_YEAR@ + SET_MAKE = @SET_MAKE@ + SHELL = @SHELL@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index f112447..a63ce4d 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in +@@ -1,4 +1,4 @@ +-#!@PERL@ ++#!/usr/bin/env perl + # aclocal - create aclocal.m4 by scanning configure.ac -*- perl -*- + # @configure_input@ + # Copyright (C) 1996-2021 Free Software Foundation, Inc. +diff --git a/bin/automake.in b/bin/automake.in +index 30babd6..d499bfd 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -1,4 +1,4 @@ +-#!@PERL@ ++#!/usr/bin/env perl + # automake - create Makefile.in from Makefile.am -*- perl -*- + # @configure_input@ + # Copyright (C) 1994-2021 Free Software Foundation, Inc. +diff --git a/t/ax/test-defs.in b/t/ax/test-defs.in +index c404b0e..381d965 100644 +--- a/t/ax/test-defs.in ++++ b/t/ax/test-defs.in +@@ -97,7 +97,7 @@ SHELL=${AM_TESTSUITE_SHELL-'@SHELL@'}; export SHELL + # User can override various tools used. Prefer overriding specific for + # that automake testsuite, if they are available. + AWK=${AM_TESTSUITE_AWK-${AWK-'@AWK@'}} +-PERL=${AM_TESTSUITE_PERL-${PERL-'@PERL@'}} ++PERL=${AM_TESTSUITE_PERL-${PERL-'/usr/bin/env perl'}} + MAKE=${AM_TESTSUITE_MAKE-${MAKE-'make'}} + YACC=${AM_TESTSUITE_YACC-${YACC-'@YACC@'}} + LEX=${AM_TESTSUITE_LEX-${LEX-'@LEX@'}} diff --git a/recipes/automake/all/patches/0003-relocatable-automake-1.16.1.patch b/recipes/automake/all/patches/0003-relocatable-automake-1.16.1.patch new file mode 100644 index 00000000000000..a302e89e70767a --- /dev/null +++ b/recipes/automake/all/patches/0003-relocatable-automake-1.16.1.patch @@ -0,0 +1,106 @@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index acf4792..e0b64de 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in +@@ -24,10 +24,13 @@ eval 'case $# in 0) exec /usr/bin/env perl -S "$0";; *) exec /usr/bin/env perl - + + # Written by Tom Tromey , and + # Alexandre Duret-Lutz . ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + } + +@@ -67,9 +70,16 @@ $perl_threads = 0; + # @system_includes can be augmented with the 'dirlist' file or the + # ACLOCAL_PATH environment variable, and reset with the '--system-acdir' + # option. ++my $scriptpath = abs_path(dirname(__FILE__)); + my @user_includes = (); +-my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION); +-my @system_includes = ('@datadir@/aclocal'); ++my @automake_includes = ("$scriptpath/../res/aclocal-" . $APIVERSION); ++my @system_includes = ("$scriptpath/../res/aclocal"); ++my @conan_includes; ++foreach my $conandir (uniq(split(/[:;]/, $ENV{'AUTOMAKE_CONAN_INCLUDES'} || ""))) ++{ ++ push (@conan_includes, $conandir) if $conandir ne '' && -d $conandir; ++ ++} + + # Whether we should copy M4 file in $user_includes[0]. + my $install = 0; +@@ -451,6 +461,7 @@ sub scan_m4_files () + } + scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); + scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes); ++ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes); + + # Construct a new function that does the searching. We use a + # function (instead of just evaluating $search in the loop) so that +@@ -773,7 +784,7 @@ sub trace_used_macros () + # to silence m4_require warnings". + my $early_m4_code .= "m4_define([m4_require_silent_probe], [-])"; + +- my $traces = ($ENV{AUTOM4TE} || '@am_AUTOM4TE@'); ++ my $traces = ($ENV{AUTOM4TE} || '/usr/bin/env autom4te'); + $traces .= " --language Autoconf-without-aclocal-m4 "; + $traces = "echo '$early_m4_code' | $traces - "; + +diff --git a/bin/automake.in b/bin/automake.in +index 0abd5f6..055c078 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -28,10 +28,13 @@ eval 'case $# in 0) exec /usr/bin/env perl -S "$0";; *) exec /usr/bin/env perl - + package Automake; + + use strict; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + + # Override SHELL. This is required on DJGPP so that system() uses +@@ -5246,7 +5249,7 @@ sub scan_autoconf_traces + sinclude => 1, + ); + +- my $traces = ($ENV{AUTOCONF} || '@am_AUTOCONF@') . " "; ++ my $traces = ($ENV{AUTOCONF} || '/usr/bin/env autoconf') . " "; + + # Use a separator unlikely to be used, not ':', the default, which + # has a precise meaning for AC_CONFIG_FILES and so on. +diff --git a/lib/Automake/Config.in b/lib/Automake/Config.in +index 6edac11..3adeed1 100644 +--- a/lib/Automake/Config.in ++++ b/lib/Automake/Config.in +@@ -20,6 +20,8 @@ use strict; + + use 5.006; + require Exporter; ++use Cwd 'abs_path'; ++use File::Basename; + + our @ISA = qw (Exporter); + our @EXPORT = qw ($APIVERSION $PACKAGE $PACKAGE_BUGREPORT $VERSION +@@ -32,7 +34,8 @@ our $PACKAGE = '@PACKAGE@'; + our $PACKAGE_BUGREPORT = '@PACKAGE_BUGREPORT@'; + our $VERSION = '@VERSION@'; + our $RELEASE_YEAR = '@RELEASE_YEAR@'; +-our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || "$scriptpath/../../@PACKAGE@-@APIVERSION@"; + + our $perl_threads = 0; + # We need at least this version for CLONE support. diff --git a/recipes/automake/all/patches/0003-relocatable-automake-1.16.2.patch b/recipes/automake/all/patches/0003-relocatable-automake-1.16.2.patch new file mode 100644 index 00000000000000..c7d66e2f6959bd --- /dev/null +++ b/recipes/automake/all/patches/0003-relocatable-automake-1.16.2.patch @@ -0,0 +1,106 @@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index 0a4eac4..487b93d 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in +@@ -18,10 +18,13 @@ + + # Written by Tom Tromey , and + # Alexandre Duret-Lutz . ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + } + +@@ -61,9 +64,16 @@ $perl_threads = 0; + # @system_includes can be augmented with the 'dirlist' file or the + # ACLOCAL_PATH environment variable, and reset with the '--system-acdir' + # option. ++my $scriptpath = abs_path(dirname(__FILE__)); + my @user_includes = (); +-my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION); +-my @system_includes = ('@datadir@/aclocal'); ++my @automake_includes = ("$scriptpath/../res/aclocal-" . $APIVERSION); ++my @system_includes = ("$scriptpath/../res/aclocal"); ++my @conan_includes; ++foreach my $conandir (uniq(split(/[:;]/, $ENV{'AUTOMAKE_CONAN_INCLUDES'} || ""))) ++{ ++ push (@conan_includes, $conandir) if $conandir ne '' && -d $conandir; ++ ++} + + # Whether we should copy M4 file in $user_includes[0]. + my $install = 0; +@@ -445,6 +455,7 @@ sub scan_m4_files () + } + scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); + scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes); ++ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes); + + # Construct a new function that does the searching. We use a + # function (instead of just evaluating $search in the loop) so that +@@ -767,7 +778,7 @@ sub trace_used_macros () + # to silence m4_require warnings". + my $early_m4_code .= "m4_define([m4_require_silent_probe], [-])"; + +- my $traces = ($ENV{AUTOM4TE} || '@am_AUTOM4TE@'); ++ my $traces = ($ENV{AUTOM4TE} || '/usr/bin/env autom4te'); + $traces .= " --language Autoconf-without-aclocal-m4 "; + $traces = "echo '$early_m4_code' | $traces - "; + +diff --git a/bin/automake.in b/bin/automake.in +index cb077a7..676593c 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -23,10 +23,13 @@ + package Automake; + + use strict; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + + # Override SHELL. This is required on DJGPP so that system() uses +@@ -5243,7 +5246,7 @@ sub scan_autoconf_traces + sinclude => 1, + ); + +- my $traces = ($ENV{AUTOCONF} || '@am_AUTOCONF@') . " "; ++ my $traces = ($ENV{AUTOCONF} || '/usr/bin/env autoconf') . " "; + + # Use a separator unlikely to be used, not ':', the default, which + # has a precise meaning for AC_CONFIG_FILES and so on. +diff --git a/lib/Automake/Config.in b/lib/Automake/Config.in +index f79b8cd..ed78dd2 100644 +--- a/lib/Automake/Config.in ++++ b/lib/Automake/Config.in +@@ -20,6 +20,8 @@ use strict; + + use 5.006; + require Exporter; ++use Cwd 'abs_path'; ++use File::Basename; + + our @ISA = qw (Exporter); + our @EXPORT = qw ($APIVERSION $PACKAGE $PACKAGE_BUGREPORT $VERSION +@@ -32,7 +34,8 @@ our $PACKAGE = '@PACKAGE@'; + our $PACKAGE_BUGREPORT = '@PACKAGE_BUGREPORT@'; + our $VERSION = '@VERSION@'; + our $RELEASE_YEAR = '@RELEASE_YEAR@'; +-our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || "$scriptpath/../../@PACKAGE@-@APIVERSION@"; + + our $perl_threads = 0; + # We need at least this version for CLONE support. diff --git a/recipes/automake/all/patches/0003-relocatable-automake-1.16.3.patch b/recipes/automake/all/patches/0003-relocatable-automake-1.16.3.patch new file mode 100644 index 00000000000000..2c34ed4d6edbea --- /dev/null +++ b/recipes/automake/all/patches/0003-relocatable-automake-1.16.3.patch @@ -0,0 +1,106 @@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index 8782f24..263ebc2 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in +@@ -22,10 +22,13 @@ + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + } + +@@ -64,9 +67,16 @@ $perl_threads = 0; + # @system_includes can be augmented with the 'dirlist' file or the + # ACLOCAL_PATH environment variable, and reset with the '--system-acdir' + # option. ++my $scriptpath = abs_path(dirname(__FILE__)); + my @user_includes = (); +-my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION); +-my @system_includes = ('@datadir@/aclocal'); ++my @automake_includes = ("$scriptpath/../res/aclocal-" . $APIVERSION); ++my @system_includes = ("$scriptpath/../res/aclocal"); ++my @conan_includes; ++foreach my $conandir (uniq(split(/[:;]/, $ENV{'AUTOMAKE_CONAN_INCLUDES'} || ""))) ++{ ++ push (@conan_includes, $conandir) if $conandir ne '' && -d $conandir; ++ ++} + + # Whether we should copy M4 file in $user_includes[0]. + my $install = 0; +@@ -448,6 +458,7 @@ sub scan_m4_files () + } + scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); + scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes); ++ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes); + + # Construct a new function that does the searching. We use a + # function (instead of just evaluating $search in the loop) so that +@@ -768,7 +779,7 @@ sub trace_used_macros () + # aclocal.m4 is not yet available. + local $ENV{WARNINGS} = 'none'; + +- my $traces = ($ENV{AUTOM4TE} || '@am_AUTOM4TE@'); ++ my $traces = ($ENV{AUTOM4TE} || '/usr/bin/env autom4te'); + $traces .= " --language Autoconf-without-aclocal-m4 "; + + # Support AC_CONFIG_MACRO_DIRS also with older autoconf. +diff --git a/bin/automake.in b/bin/automake.in +index e41b1f5..233a6a3 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -25,10 +25,13 @@ package Automake; + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + + # Override SHELL. This is required on DJGPP so that system() uses +@@ -5254,7 +5257,7 @@ sub scan_autoconf_traces + # and will see its warnings then. + local $ENV{WARNINGS} = 'none'; + +- my $traces = ($ENV{AUTOCONF} || '@am_AUTOCONF@') . " "; ++ my $traces = ($ENV{AUTOCONF} || '/usr/bin/env autoconf') . " "; + + # Use a separator unlikely to be used, not ':', the default, which + # has a precise meaning for AC_CONFIG_FILES and so on. +diff --git a/lib/Automake/Config.in b/lib/Automake/Config.in +index d44e0ab..fba2b81 100644 +--- a/lib/Automake/Config.in ++++ b/lib/Automake/Config.in +@@ -20,6 +20,8 @@ package Automake::Config; + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + use Exporter; + +@@ -34,7 +36,8 @@ our $PACKAGE = '@PACKAGE@'; + our $PACKAGE_BUGREPORT = '@PACKAGE_BUGREPORT@'; + our $VERSION = '@VERSION@'; + our $RELEASE_YEAR = '@RELEASE_YEAR@'; +-our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || "$scriptpath/../../@PACKAGE@-@APIVERSION@"; + + our $perl_threads = 0; + # We need at least this version for CLONE support. diff --git a/recipes/automake/all/patches/0003-relocatable-automake-1.16.4.patch b/recipes/automake/all/patches/0003-relocatable-automake-1.16.4.patch new file mode 100644 index 00000000000000..011c7ddfdc8db1 --- /dev/null +++ b/recipes/automake/all/patches/0003-relocatable-automake-1.16.4.patch @@ -0,0 +1,106 @@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index a63ce4d..e82d65b 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in +@@ -22,10 +22,13 @@ + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + } + +@@ -64,9 +67,16 @@ $perl_threads = 0; + # @system_includes can be augmented with the 'dirlist' file or the + # ACLOCAL_PATH environment variable, and reset with the '--system-acdir' + # option. ++my $scriptpath = abs_path(dirname(__FILE__)); + my @user_includes = (); +-my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION); +-my @system_includes = ('@datadir@/aclocal'); ++my @automake_includes = ("$scriptpath/../res/aclocal-" . $APIVERSION); ++my @system_includes = ("$scriptpath/../res/aclocal"); ++my @conan_includes; ++foreach my $conandir (uniq(split(/[:;]/, $ENV{'AUTOMAKE_CONAN_INCLUDES'} || ""))) ++{ ++ push (@conan_includes, $conandir) if $conandir ne '' && -d $conandir; ++ ++} + + # Whether we should copy M4 file in $user_includes[0]. + my $install = 0; +@@ -448,6 +458,7 @@ sub scan_m4_files () + } + scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); + scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes); ++ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes); + + # Construct a new function that does the searching. We use a + # function (instead of just evaluating $search in the loop) so that +@@ -768,7 +779,7 @@ sub trace_used_macros () + # aclocal.m4 is not yet available. + local $ENV{WARNINGS} = 'none'; + +- my $traces = ($ENV{AUTOM4TE} || '@am_AUTOM4TE@'); ++ my $traces = ($ENV{AUTOM4TE} || '/usr/bin/env autom4te'); + $traces .= " --language Autoconf-without-aclocal-m4 "; + + # Support AC_CONFIG_MACRO_DIRS also with older autoconf. +diff --git a/bin/automake.in b/bin/automake.in +index 4502558..6506946 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -25,10 +25,13 @@ package Automake; + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + + # Override SHELL. This is required on DJGPP so that system() uses +@@ -5280,7 +5283,7 @@ sub scan_autoconf_traces + # and will see its warnings then. + local $ENV{WARNINGS} = 'none'; + +- my $traces = ($ENV{AUTOCONF} || '@am_AUTOCONF@') . " "; ++ my $traces = ($ENV{AUTOCONF} || '/usr/bin/env autoconf') . " "; + + # Use a separator unlikely to be used, not ':', the default, which + # has a precise meaning for AC_CONFIG_FILES and so on. +diff --git a/lib/Automake/Config.in b/lib/Automake/Config.in +index d529f1b..ca98604 100644 +--- a/lib/Automake/Config.in ++++ b/lib/Automake/Config.in +@@ -20,6 +20,8 @@ package Automake::Config; + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + use Exporter; + +@@ -34,7 +36,8 @@ our $PACKAGE = '@PACKAGE@'; + our $PACKAGE_BUGREPORT = '@PACKAGE_BUGREPORT@'; + our $VERSION = '@VERSION@'; + our $RELEASE_YEAR = '@RELEASE_YEAR@'; +-our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || "$scriptpath/../../@PACKAGE@-@APIVERSION@"; + + our $perl_threads = 0; + # We need at least this version for CLONE support. diff --git a/recipes/automake/all/patches/0003-relocatable-automake-1.16.5.patch b/recipes/automake/all/patches/0003-relocatable-automake-1.16.5.patch new file mode 100644 index 00000000000000..56b752f9a116a2 --- /dev/null +++ b/recipes/automake/all/patches/0003-relocatable-automake-1.16.5.patch @@ -0,0 +1,107 @@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index a63ce4d..6224832 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in +@@ -22,10 +22,13 @@ + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + } + +@@ -64,9 +67,16 @@ $perl_threads = 0; + # @system_includes can be augmented with the 'dirlist' file or the + # ACLOCAL_PATH environment variable, and reset with the '--system-acdir' + # option. ++my $scriptpath = abs_path(dirname(__FILE__)); + my @user_includes = (); +-my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION); +-my @system_includes = ('@datadir@/aclocal'); ++my @automake_includes = ("$scriptpath/../res/aclocal-" . $APIVERSION); ++my @system_includes = ("$scriptpath/../res/aclocal"); ++my @conan_includes; ++foreach my $conandir (uniq(split(/[:;]/, $ENV{'AUTOMAKE_CONAN_INCLUDES'} || ""))) ++{ ++ push (@conan_includes, $conandir) if $conandir ne '' && -d $conandir; ++ ++} + + # Whether we should copy M4 file in $user_includes[0]. + my $install = 0; +@@ -448,6 +458,8 @@ sub scan_m4_files () + } + scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); + scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes); ++ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes); ++ + + # Construct a new function that does the searching. We use a + # function (instead of just evaluating $search in the loop) so that +@@ -768,7 +780,7 @@ sub trace_used_macros () + # aclocal.m4 is not yet available. + local $ENV{WARNINGS} = 'none'; + +- my $traces = ($ENV{AUTOM4TE} || '@am_AUTOM4TE@'); ++ my $traces = ($ENV{AUTOM4TE} || '/usr/bin/env autom4te'); + $traces .= " --language Autoconf-without-aclocal-m4 "; + + # Support AC_CONFIG_MACRO_DIRS also with older autoconf. +diff --git a/bin/automake.in b/bin/automake.in +index d499bfd..d4081c9 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -25,10 +25,13 @@ package Automake; + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + + # Override SHELL. This is required on DJGPP so that system() uses +@@ -5280,7 +5283,7 @@ sub scan_autoconf_traces + # and will see its warnings then. + local $ENV{WARNINGS} = 'none'; + +- my $traces = ($ENV{AUTOCONF} || '@am_AUTOCONF@') . " "; ++ my $traces = ($ENV{AUTOCONF} || '/usr/bin/env autoconf') . " "; + + # Use a separator unlikely to be used, not ':', the default, which + # has a precise meaning for AC_CONFIG_FILES and so on. +diff --git a/lib/Automake/Config.in b/lib/Automake/Config.in +index d529f1b..ca98604 100644 +--- a/lib/Automake/Config.in ++++ b/lib/Automake/Config.in +@@ -20,6 +20,8 @@ package Automake::Config; + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + use Exporter; + +@@ -34,7 +36,8 @@ our $PACKAGE = '@PACKAGE@'; + our $PACKAGE_BUGREPORT = '@PACKAGE_BUGREPORT@'; + our $VERSION = '@VERSION@'; + our $RELEASE_YEAR = '@RELEASE_YEAR@'; +-our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || "$scriptpath/../../@PACKAGE@-@APIVERSION@"; + + our $perl_threads = 0; + # We need at least this version for CLONE support. diff --git a/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.1.patch b/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.1.patch deleted file mode 100644 index 458aa275fdbca2..00000000000000 --- a/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.1.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -68,8 +68,8 @@ - # ACLOCAL_PATH environment variable, and reset with the '--system-acdir' - # option. - my @user_includes = (); --my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION); --my @system_includes = ('@datadir@/aclocal'); -+my @automake_includes = ($ENV{"AUTOMAKE_DATADIR"} . '/aclocal-' . $APIVERSION); -+my @system_includes = ($ENV{"AUTOMAKE_DATADIR"} . '/aclocal'); -+my @conan_includes = uniq(split(/[:;]/, $ENV{'AUTOMAKE_CONAN_INCLUDES'} || "")); -- - # Whether we should copy M4 file in $user_includes[0]. - my $install = 0; -@@ -451,6 +451,6 @@ - } - scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); - scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes); -+ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes); -- - # Construct a new function that does the searching. We use a - # function (instead of just evaluating $search in the loop) so that diff --git a/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.2.patch b/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.2.patch deleted file mode 100644 index 3b2e717768c51d..00000000000000 --- a/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.2.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -62,8 +62,8 @@ - # ACLOCAL_PATH environment variable, and reset with the '--system-acdir' - # option. - my @user_includes = (); --my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION); --my @system_includes = ('@datadir@/aclocal'); -+my @automake_includes = ($ENV{"AUTOMAKE_DATADIR"} . '/aclocal-' . $APIVERSION); -+my @system_includes = ($ENV{"AUTOMAKE_DATADIR"} . '/aclocal'); -+my @conan_includes = uniq(split(/[:;]/, $ENV{'AUTOMAKE_CONAN_INCLUDES'} || "")); -- - # Whether we should copy M4 file in $user_includes[0]. - my $install = 0; -@@ -445,6 +445,6 @@ - } - scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); - scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes); -+ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes); -- - # Construct a new function that does the searching. We use a - # function (instead of just evaluating $search in the loop) so that diff --git a/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.3.patch b/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.3.patch deleted file mode 100644 index a762cf7600f69c..00000000000000 --- a/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.3.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -65,8 +65,8 @@ - # ACLOCAL_PATH environment variable, and reset with the '--system-acdir' - # option. - my @user_includes = (); --my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION); --my @system_includes = ('@datadir@/aclocal'); -+my @automake_includes = ($ENV{"AUTOMAKE_DATADIR"} . '/aclocal-' . $APIVERSION); -+my @system_includes = ($ENV{"AUTOMAKE_DATADIR"} . '/aclocal'); -+my @conan_includes = uniq(split(/[:;]/, $ENV{'AUTOMAKE_CONAN_INCLUDES'} || "")); -- - # Whether we should copy M4 file in $user_includes[0]. - my $install = 0; -@@ -448,6 +448,6 @@ - } - scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); - scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes); -+ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes); -- - # Construct a new function that does the searching. We use a - # function (instead of just evaluating $search in the loop) so that diff --git a/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.1.patch b/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.1.patch deleted file mode 100644 index d74ebf2dc56a6b..00000000000000 --- a/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.1.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -27,7 +27,8 @@ - - BEGIN - { -- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') -+ my $pkgdatadir = $ENV{"AUTOMAKE_PERLLIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; -+ unshift (@INC, $pkgdatadir) - unless $ENV{AUTOMAKE_UNINSTALLED}; - } - ---- bin/automake.in -+++ bin/automake.in -@@ -31,7 +31,8 @@ - - BEGIN - { -- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') -+ my $pkgdatadir = $ENV{"AUTOMAKE_PERLLIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; -+ unshift (@INC, $pkgdatadir) - unless $ENV{AUTOMAKE_UNINSTALLED}; - - # Override SHELL. This is required on DJGPP so that system() uses -$ diff --git a/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.2.patch b/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.2.patch deleted file mode 100644 index 07ad7435b932ee..00000000000000 --- a/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.2.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -21,7 +21,8 @@ - - BEGIN - { -- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') -+ my $pkgdatadir = $ENV{"AUTOMAKE_PERLLIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; -+ unshift (@INC, $pkgdatadir) - unless $ENV{AUTOMAKE_UNINSTALLED}; - } - ---- bin/automake.in -+++ bin/automake.in -@@ -26,7 +26,8 @@ - - BEGIN - { -- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') -+ my $pkgdatadir = $ENV{"AUTOMAKE_PERLLIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; -+ unshift (@INC, $pkgdatadir) - unless $ENV{AUTOMAKE_UNINSTALLED}; - - # Override SHELL. This is required on DJGPP so that system() uses -$ diff --git a/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.3.patch b/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.3.patch deleted file mode 100644 index 8c2546f8629f49..00000000000000 --- a/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.3.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -25,7 +25,8 @@ - - BEGIN - { -- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') -+ my $pkgdatadir = $ENV{"AUTOMAKE_PERLLIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; -+ unshift (@INC, $pkgdatadir) - unless $ENV{AUTOMAKE_UNINSTALLED}; - } - ---- bin/automake.in -+++ bin/automake.in -@@ -28,7 +28,8 @@ - - BEGIN - { -- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') -+ my $pkgdatadir = $ENV{"AUTOMAKE_PERLLIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; -+ unshift (@INC, $pkgdatadir) - unless $ENV{AUTOMAKE_UNINSTALLED}; - - # Override SHELL. This is required on DJGPP so that system() uses -$ diff --git a/recipes/automake/all/test_package/conanfile.py b/recipes/automake/all/test_package/conanfile.py index 8362800620a5ab..32063f5e9afe29 100644 --- a/recipes/automake/all/test_package/conanfile.py +++ b/recipes/automake/all/test_package/conanfile.py @@ -1,89 +1,95 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conan.tools.microsoft import is_msvc -from contextlib import contextmanager import os -import shutil -required_conan_version = ">=1.45.0" +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import chdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path + + +required_conan_version = ">=1.53.0" class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - exports_sources = "configure.ac", "Makefile.am", "test_package_1.c", "test_package.cpp" - # DON'T COPY extra.m4 TO BUILD FOLDER!!! test_type = "explicit" + win_bash = True + + _default_cc = { + "gcc": "gcc", + "clang": "clang", + "Visual Studio": "cl -nologo", + "msvc": "cl -nologo", + "apple-clang": "clang", + } + + def _system_compiler(self, cxx=False): + system_cc = self._default_cc.get(str(self.settings.compiler)) + if system_cc and cxx: + if self.settings.compiler == "gcc": + system_cc = "g++" + elif "clang" in self.settings.compiler: + system_cc = "clang++" + return system_cc @property def _settings_build(self): return getattr(self, "settings_build", self.settings) - def requirements(self): - self.requires(self.tested_reference_str) - def build_requirements(self): self.build_requires(self.tested_reference_str) - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): + if self._settings_build.os == "Windows" and not self.conf.get( + "tools.microsoft.bash:path", check_type=str + ): self.build_requires("msys2/cci.latest") - @contextmanager - def _build_context(self): - if is_msvc(self): - with tools.vcvars(self): - with tools.environment_append({"CC": "cl -nologo", "CXX": "cl -nologo",}): - yield - else: - yield + def layout(self): + basic_layout(self, src_folder="src") - _default_cc = { - "gcc": "gcc", - "clang": "clang", - "Visual Studio": "cl -nologo", - "apple-clang": "clang", - } + def generate(self): + tc = AutotoolsToolchain(self) + tc.generate() - @property - def _system_cc(self): - system_cc = os.environ.get("CC", None) - if not system_cc: - system_cc = self._default_cc.get(str(self.settings.compiler)) - return system_cc - - @property - def _user_info(self): - return getattr(self, "user_info_build", self.deps_user_info) - - def _build_scripts(self): - """Test compile script of automake""" - compile_script = self._user_info["automake"].compile - ar_script = self._user_info["automake"].ar_lib - assert os.path.isfile(ar_script) - assert os.path.isfile(compile_script) - - if self._system_cc: - with tools.vcvars(self) if is_msvc(self) else tools.no_op(): - self.run("{} {} test_package_1.c -o script_test".format(tools.unix_path(compile_script), self._system_cc), win_bash=tools.os_info.is_windows) - - def _build_autotools(self): - """Test autoreconf + configure + make""" - with tools.environment_append({"AUTOMAKE_CONAN_INCLUDES": [tools.unix_path(self.source_folder)]}): - self.run("{} -fiv".format(os.environ["AUTORECONF"]), win_bash=tools.os_info.is_windows) - self.run("{} --help".format(os.path.join(self.build_folder, "configure").replace("\\", "/")), win_bash=tools.os_info.is_windows) - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - with self._build_context(): - autotools.configure() - autotools.make() + env = VirtualBuildEnv(self) + env.generate() - def build(self): - for src in self.exports_sources: - shutil.copy(os.path.join(self.source_folder, src), self.build_folder) + env = Environment() - self._build_scripts() - self._build_autotools() + compile_script = unix_path(self, + self.dependencies.build["automake"].conf_info.get("user.automake:compile-wrapper")) - def test(self): - if self._system_cc: - if not tools.cross_building(self): - self.run(os.path.join(".", "script_test"), run_environment=True) + # define CC and CXX such that if the user hasn't already defined it + # via `tools.build:compiler_executables` or buildenv variables, + # we tell autotools to guess the name matching the current setting + # (otherwise it falls back to finding gcc first) + cc = self._system_compiler() + cxx = self._system_compiler(cxx=True) + if cc and cxx: + # Using shell parameter expansion + env.define("CC", f"${{CC-{cc}}}") + env.define("CXX", f"${{CXX-{cxx}}}") + + env.define("COMPILE", compile_script) + env.define("ACLOCAL_PATH", unix_path(self, os.path.join(self.source_folder))) + env.vars(self, scope="build").save_script("automake_build_test") - if not tools.cross_building(self): - self.run(os.path.join(".", "test_package"), run_environment=True) + def build(self): + # Test compilation through compile wrapper script + compiler = self._system_compiler() + source_file = unix_path(self, os.path.join(self.source_folder, "test_package_1.c")) + with chdir(self, self.build_folder): + self.run(f"$COMPILE {compiler} {source_file} -o script_test", env="conanbuild") + + # Build test project + autotools = Autotools(self) + autotools.autoreconf(args=['--debug']) + autotools.configure() + autotools.make() + + def test(self): + if can_run(self): + with chdir(self, self.build_folder): + self.run("./script_test") + self.run("./test_package") diff --git a/recipes/automake/all/test_package/src/Makefile.am b/recipes/automake/all/test_package/src/Makefile.am new file mode 100644 index 00000000000000..655db7f1876cb6 --- /dev/null +++ b/recipes/automake/all/test_package/src/Makefile.am @@ -0,0 +1,4 @@ +# @configure_input@ + +bin_PROGRAMS = test_package +test_package_SOURCES = test_package.cpp diff --git a/recipes/automake/all/test_package/src/configure.ac b/recipes/automake/all/test_package/src/configure.ac new file mode 100644 index 00000000000000..8a7ae1dc34e7f5 --- /dev/null +++ b/recipes/automake/all/test_package/src/configure.ac @@ -0,0 +1,28 @@ +AC_PREREQ([2.69]) +AC_INIT([test_package], [1.0]) +AC_CONFIG_AUX_DIR([build-aux]) +AM_INIT_AUTOMAKE([-Wall -Werror foreign]) + +# Safety checks in case user overwritten --srcdir +AC_CONFIG_SRCDIR([test_package.cpp]) + +AC_CANONICAL_HOST + +# Test includes of extra including directories using conan +AUTOMAKE_TEST_PACKAGE_PREREQ([1.0]) +AUTOMAKE_TEST_PACKAGE_HELLO([argument1], [argument2], [...], [last argument]) + +AC_CONFIG_HEADER([config.h]) + +# Check for CC and CXX compiler +AC_PROG_CC +AC_PROG_CXX +## We can add more checks in this section +# +## Tells automake to create a Makefile +## See https://www.gnu.org/software/automake/manual/html_node/Requirements.html +AC_CONFIG_FILES([Makefile]) +# +## Generate the output +AC_OUTPUT +# diff --git a/recipes/automake/all/test_package/src/extra.m4 b/recipes/automake/all/test_package/src/extra.m4 new file mode 100644 index 00000000000000..69c85f5ac945de --- /dev/null +++ b/recipes/automake/all/test_package/src/extra.m4 @@ -0,0 +1,14 @@ +dnl This file contains a macro to test adding extra include dirs using conan + +AC_DEFUN([AUTOMAKE_TEST_PACKAGE_PREREQ],[ + m4_define([CONAN_MACRO_VERSION], [1.3]) + m4_if(m4_version_compare(CONAN_MACRO_VERSION, [$1]), + -1, + [m4_fatal([extra.m4 version $1 or higher is required, but ]CONAN_MACRO_VERSION[ found])] + ) +])dnl AUTOMAKE_TEST_PACKAGE_PREREQ + +AC_DEFUN([AUTOMAKE_TEST_PACKAGE_HELLO],[ + echo "Hello world from the extra.m4 script!" + echo "My args were: $*" +])dnl diff --git a/recipes/automake/all/test_package/src/test_package.cpp b/recipes/automake/all/test_package/src/test_package.cpp new file mode 100644 index 00000000000000..cd8c2f27c35879 --- /dev/null +++ b/recipes/automake/all/test_package/src/test_package.cpp @@ -0,0 +1,9 @@ +#include "config.h" + +#include +#include + +int main(int argc, char** argv) { + std::cout << "test_package.cpp: " << "hello world from " PACKAGE_NAME "!\n"; + return EXIT_SUCCESS; +} diff --git a/recipes/automake/all/test_package/src/test_package_1.c b/recipes/automake/all/test_package/src/test_package_1.c new file mode 100644 index 00000000000000..9aaff6c18e30d1 --- /dev/null +++ b/recipes/automake/all/test_package/src/test_package_1.c @@ -0,0 +1,7 @@ +#include +#include + +int main() { + puts("test_package.c says 'Hello World'!\n"); + return EXIT_SUCCESS; +} diff --git a/recipes/automake/all/test_v1_package/Makefile.am b/recipes/automake/all/test_v1_package/Makefile.am new file mode 100644 index 00000000000000..655db7f1876cb6 --- /dev/null +++ b/recipes/automake/all/test_v1_package/Makefile.am @@ -0,0 +1,4 @@ +# @configure_input@ + +bin_PROGRAMS = test_package +test_package_SOURCES = test_package.cpp diff --git a/recipes/automake/all/test_v1_package/conanfile.py b/recipes/automake/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..8362800620a5ab --- /dev/null +++ b/recipes/automake/all/test_v1_package/conanfile.py @@ -0,0 +1,89 @@ +from conans import AutoToolsBuildEnvironment, ConanFile, tools +from conan.tools.microsoft import is_msvc +from contextlib import contextmanager +import os +import shutil + +required_conan_version = ">=1.45.0" + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + exports_sources = "configure.ac", "Makefile.am", "test_package_1.c", "test_package.cpp" + # DON'T COPY extra.m4 TO BUILD FOLDER!!! + test_type = "explicit" + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build_requirements(self): + self.build_requires(self.tested_reference_str) + if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): + self.build_requires("msys2/cci.latest") + + @contextmanager + def _build_context(self): + if is_msvc(self): + with tools.vcvars(self): + with tools.environment_append({"CC": "cl -nologo", "CXX": "cl -nologo",}): + yield + else: + yield + + _default_cc = { + "gcc": "gcc", + "clang": "clang", + "Visual Studio": "cl -nologo", + "apple-clang": "clang", + } + + @property + def _system_cc(self): + system_cc = os.environ.get("CC", None) + if not system_cc: + system_cc = self._default_cc.get(str(self.settings.compiler)) + return system_cc + + @property + def _user_info(self): + return getattr(self, "user_info_build", self.deps_user_info) + + def _build_scripts(self): + """Test compile script of automake""" + compile_script = self._user_info["automake"].compile + ar_script = self._user_info["automake"].ar_lib + assert os.path.isfile(ar_script) + assert os.path.isfile(compile_script) + + if self._system_cc: + with tools.vcvars(self) if is_msvc(self) else tools.no_op(): + self.run("{} {} test_package_1.c -o script_test".format(tools.unix_path(compile_script), self._system_cc), win_bash=tools.os_info.is_windows) + + def _build_autotools(self): + """Test autoreconf + configure + make""" + with tools.environment_append({"AUTOMAKE_CONAN_INCLUDES": [tools.unix_path(self.source_folder)]}): + self.run("{} -fiv".format(os.environ["AUTORECONF"]), win_bash=tools.os_info.is_windows) + self.run("{} --help".format(os.path.join(self.build_folder, "configure").replace("\\", "/")), win_bash=tools.os_info.is_windows) + autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) + with self._build_context(): + autotools.configure() + autotools.make() + + def build(self): + for src in self.exports_sources: + shutil.copy(os.path.join(self.source_folder, src), self.build_folder) + + self._build_scripts() + self._build_autotools() + + def test(self): + if self._system_cc: + if not tools.cross_building(self): + self.run(os.path.join(".", "script_test"), run_environment=True) + + if not tools.cross_building(self): + self.run(os.path.join(".", "test_package"), run_environment=True) diff --git a/recipes/automake/all/test_v1_package/configure.ac b/recipes/automake/all/test_v1_package/configure.ac new file mode 100644 index 00000000000000..8a7ae1dc34e7f5 --- /dev/null +++ b/recipes/automake/all/test_v1_package/configure.ac @@ -0,0 +1,28 @@ +AC_PREREQ([2.69]) +AC_INIT([test_package], [1.0]) +AC_CONFIG_AUX_DIR([build-aux]) +AM_INIT_AUTOMAKE([-Wall -Werror foreign]) + +# Safety checks in case user overwritten --srcdir +AC_CONFIG_SRCDIR([test_package.cpp]) + +AC_CANONICAL_HOST + +# Test includes of extra including directories using conan +AUTOMAKE_TEST_PACKAGE_PREREQ([1.0]) +AUTOMAKE_TEST_PACKAGE_HELLO([argument1], [argument2], [...], [last argument]) + +AC_CONFIG_HEADER([config.h]) + +# Check for CC and CXX compiler +AC_PROG_CC +AC_PROG_CXX +## We can add more checks in this section +# +## Tells automake to create a Makefile +## See https://www.gnu.org/software/automake/manual/html_node/Requirements.html +AC_CONFIG_FILES([Makefile]) +# +## Generate the output +AC_OUTPUT +# diff --git a/recipes/automake/all/test_v1_package/extra.m4 b/recipes/automake/all/test_v1_package/extra.m4 new file mode 100644 index 00000000000000..69c85f5ac945de --- /dev/null +++ b/recipes/automake/all/test_v1_package/extra.m4 @@ -0,0 +1,14 @@ +dnl This file contains a macro to test adding extra include dirs using conan + +AC_DEFUN([AUTOMAKE_TEST_PACKAGE_PREREQ],[ + m4_define([CONAN_MACRO_VERSION], [1.3]) + m4_if(m4_version_compare(CONAN_MACRO_VERSION, [$1]), + -1, + [m4_fatal([extra.m4 version $1 or higher is required, but ]CONAN_MACRO_VERSION[ found])] + ) +])dnl AUTOMAKE_TEST_PACKAGE_PREREQ + +AC_DEFUN([AUTOMAKE_TEST_PACKAGE_HELLO],[ + echo "Hello world from the extra.m4 script!" + echo "My args were: $*" +])dnl diff --git a/recipes/automake/all/test_v1_package/test_package.cpp b/recipes/automake/all/test_v1_package/test_package.cpp new file mode 100644 index 00000000000000..cd8c2f27c35879 --- /dev/null +++ b/recipes/automake/all/test_v1_package/test_package.cpp @@ -0,0 +1,9 @@ +#include "config.h" + +#include +#include + +int main(int argc, char** argv) { + std::cout << "test_package.cpp: " << "hello world from " PACKAGE_NAME "!\n"; + return EXIT_SUCCESS; +} diff --git a/recipes/automake/all/test_v1_package/test_package_1.c b/recipes/automake/all/test_v1_package/test_package_1.c new file mode 100644 index 00000000000000..9aaff6c18e30d1 --- /dev/null +++ b/recipes/automake/all/test_v1_package/test_package_1.c @@ -0,0 +1,7 @@ +#include +#include + +int main() { + puts("test_package.c says 'Hello World'!\n"); + return EXIT_SUCCESS; +} diff --git a/recipes/avahi/all/conanfile.py b/recipes/avahi/all/conanfile.py index 1bb65f4a2da31a..9db11a9e8123fd 100644 --- a/recipes/avahi/all/conanfile.py +++ b/recipes/avahi/all/conanfile.py @@ -1,12 +1,13 @@ import os from conan import ConanFile +from conan.tools.env import VirtualBuildEnv from conan.tools.files import copy, get, rmdir, rm from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain, PkgConfigDeps from conan.tools.layout import basic_layout from conan.errors import ConanInvalidConfiguration -required_conan_version = ">=1.51.0" +required_conan_version = ">=1.53.0" class AvahiConan(ConanFile): @@ -33,36 +34,32 @@ def layout(self): basic_layout(self, src_folder="src") def requirements(self): - self.requires("glib/2.74.0") - self.requires("expat/2.4.9") + self.requires("glib/2.75.2") + self.requires("expat/2.5.0") self.requires("libdaemon/0.14") - self.requires("dbus/1.15.0") + self.requires("dbus/1.15.2") self.requires("gdbm/1.19") self.requires("libevent/2.1.12") + def build_requirements(self): + self.tool_requires("glib/2.75.2") + def validate(self): if self.info.settings.os != "Linux": - raise ConanInvalidConfiguration("Only Linux is supported for this package.") + raise ConanInvalidConfiguration(f"{self.ref} only supports Linux.") def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass - try: - del self.settings.compiler.libcxx - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() tc = AutotoolsToolchain(self) tc.configure_args.append("--enable-compat-libdns_sd") tc.configure_args.append("--disable-gtk3") diff --git a/recipes/avahi/all/test_package/conanfile.py b/recipes/avahi/all/test_package/conanfile.py index 704f712573f0d1..0cec595dd1ddc4 100644 --- a/recipes/avahi/all/test_package/conanfile.py +++ b/recipes/avahi/all/test_package/conanfile.py @@ -2,8 +2,7 @@ from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import CMake -from conan.tools.layout import cmake_layout +from conan.tools.cmake import CMake, cmake_layout class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" diff --git a/recipes/avahi/all/test_v1_package/CMakeLists.txt b/recipes/avahi/all/test_v1_package/CMakeLists.txt index abd3bb0df681c0..925ecbe19e448d 100644 --- a/recipes/avahi/all/test_v1_package/CMakeLists.txt +++ b/recipes/avahi/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(Avahi CONFIG REQUIRED) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE avahi::compat-libdns_sd) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/b2/portable/conanfile.py b/recipes/b2/portable/conanfile.py index 5cc7b0cdfb0dcd..9de31b1810ad27 100644 --- a/recipes/b2/portable/conanfile.py +++ b/recipes/b2/portable/conanfile.py @@ -1,9 +1,11 @@ -import os -from contextlib import contextmanager -import conan.tools.files -import conan.tools.layout from conan import ConanFile from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.files import chdir, copy, get +from conan.tools.layout import basic_layout + +from contextlib import contextmanager +import os from six import StringIO required_conan_version = ">=1.47.0" @@ -13,11 +15,11 @@ class B2Conan(ConanFile): name = "b2" homepage = "https://www.bfgroup.xyz/b2/" description = "B2 makes it easy to build C++ projects, everywhere." - topics = ("b2", "installer", "builder", "build", "build-system") + topics = ("installer", "builder", "build", "build-system") license = "BSL-1.0" - settings = "os", "arch" url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch" ''' * use_cxx_env: False, True @@ -45,24 +47,31 @@ class B2Conan(ConanFile): 'acc', 'borland', 'clang', 'como', 'gcc-nocygwin', 'gcc', 'intel-darwin', 'intel-linux', 'intel-win32', 'kcc', 'kylix', 'mingw', 'mipspro', 'pathscale', 'pgi', 'qcc', 'sun', 'sunpro', - 'tru64cxx', 'vacpp', 'vc12', 'vc14', 'vc141', 'vc142', 'vc143'] + 'tru64cxx', 'vacpp', 'vc12', 'vc14', 'vc141', 'vc142', 'vc143', + ] } default_options = { 'use_cxx_env': False, 'toolset': 'auto' } + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + del self.info.options.use_cxx_env + del self.info.options.toolset + def validate(self): + if hasattr(self, "settings_build") and cross_building(self): + raise ConanInvalidConfiguration(f"{self.ref} recipe doesn't support cross-build yet") + if (self.options.toolset == 'cxx' or self.options.toolset == 'cross-cxx') and not self.options.use_cxx_env: raise ConanInvalidConfiguration( "Option toolset 'cxx' and 'cross-cxx' requires 'use_cxx_env=True'") - def layout(self): - conan.tools.layout.basic_layout(self, src_folder="root") - def source(self): - conan.tools.files.get( - self, **self.conan_data["sources"][self.version], strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) @property def _b2_dir(self): @@ -76,10 +85,6 @@ def _b2_engine_dir(self): def _b2_output_dir(self): return os.path.join(self.build_folder, "output") - @property - def _pkg_licenses_dir(self): - return os.path.join(self.package_folder, "licenses") - @property def _pkg_bin_dir(self): return os.path.join(self.package_folder, "bin") @@ -118,7 +123,7 @@ def build(self): # that didn't exist when the build was written. This turns that # into a generic msvc toolset build assuming it could work, # since it's a better version. - with conan.tools.files.chdir(self, self._b2_engine_dir): + with chdir(self, self._b2_engine_dir): with self._bootstrap_env(): buf = StringIO() self.run('guess_toolset && set', output=buf) @@ -134,39 +139,33 @@ def build(self): command += "build" if use_windows_commands else "./build.sh" if b2_toolset != 'auto': command += " "+str(b2_toolset) - with conan.tools.files.chdir(self, self._b2_engine_dir): + with chdir(self, self._b2_engine_dir): with self._bootstrap_env(): self.run(command) self.output.info("Install..") command = os.path.join( self._b2_engine_dir, "b2.exe" if use_windows_commands else "b2") + if b2_toolset not in ["auto", "cxx", "cross-cxx"]: + command += " toolset=" + str(b2_toolset) full_command = \ - ("{0} --ignore-site-config " + - "--prefix={1} " + + (f"{command} --ignore-site-config " + + f"--prefix={self._b2_output_dir} " + "--abbreviate-paths " + "install " + - "b2-install-layout=portable").format(command, self._b2_output_dir) - with conan.tools.files.chdir(self, self._b2_dir): + "b2-install-layout=portable") + with chdir(self, self._b2_dir): self.run(full_command) def package(self): - conan.tools.files.copy( - self, "LICENSE.txt", dst=self._pkg_licenses_dir, src=self.source_folder) - conan.tools.files.copy( - self, "*b2", dst=self._pkg_bin_dir, src=self._b2_output_dir) - conan.tools.files.copy( - self, "*b2.exe", dst=self._pkg_bin_dir, src=self._b2_output_dir) - conan.tools.files.copy( - self, "*.jam", dst=self._pkg_bin_dir, src=self._b2_output_dir) + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*b2", dst=self._pkg_bin_dir, src=self._b2_output_dir) + copy(self, "*b2.exe", dst=self._pkg_bin_dir, src=self._b2_output_dir) + copy(self, "*.jam", dst=self._pkg_bin_dir, src=self._b2_output_dir) def package_info(self): self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] - self.cpp_info.bindirs = ["bin"] - self.buildenv_info.prepend_path("PATH", self._pkg_bin_dir) - self.env_info.path = [self._pkg_bin_dir] - def package_id(self): - del self.info.options.use_cxx_env - del self.info.options.toolset + # TODO: to remove in conan v2 + self.env_info.PATH.append(self._pkg_bin_dir) diff --git a/recipes/benchmark/all/conanfile.py b/recipes/benchmark/all/conanfile.py index 04fc858f5c5ba4..78f24e35596ca5 100644 --- a/recipes/benchmark/all/conanfile.py +++ b/recipes/benchmark/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.build import cross_building from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import copy, get, rmdir -from conan.tools.microsoft import is_msvc +from conan.tools.microsoft import is_msvc, check_min_vs from conan.tools.scm import Version import os @@ -44,9 +44,8 @@ def layout(self): cmake_layout(self, src_folder="src") def validate(self): - if self.info.settings.compiler == "Visual Studio" and Version(self.info.settings.compiler.version) <= "12": - raise ConanInvalidConfiguration(f"{self.ref} doesn't support Visual Studio <= 12") - if Version(self.version) < "1.7.0" and is_msvc(self) and self.info.options.shared: + check_min_vs(self, "190") + if Version(self.version) < "1.7.0" and is_msvc(self) and self.options.shared: raise ConanInvalidConfiguration(f"{self.ref} doesn't support msvc shared builds") def _cmake_new_enough(self, required_version): @@ -65,8 +64,7 @@ def build_requirements(self): self.tool_requires("cmake/3.25.0") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/binutils/all/conanfile.py b/recipes/binutils/all/conanfile.py index 053c82f6e2f69d..524749a89efb56 100644 --- a/recipes/binutils/all/conanfile.py +++ b/recipes/binutils/all/conanfile.py @@ -178,19 +178,6 @@ def package_info(self): self.cpp_info.bindirs = ["bin", target_bindir] absolute_target_bindir = os.path.join(self.package_folder, target_bindir) - binaries = os.listdir(absolute_target_bindir) - self.output.info(f"Binaries built: {', '.join(binaries)}") - for binary_name in binaries: - binary = os.path.join(absolute_target_bindir, binary_name) - if os.path.isfile(binary): - # See https://github.com/conan-io/conan-center-index/pull/14137/files/7ed7a48e2c993bb7e748570ee7ab9d021790c7dc..e93ea8d3d318b0ef8be84816cef615043b5f7fa9#r1022730130 for details - self.output.info(f"Setting {binary_name.upper()}={binary}") - self.buildenv_info.define(f"{binary_name.upper()}", binary) - if self.settings.os == "Macos": - self.output.warn("Binutils does not support an assembler or " - + "linker for macOS. LD and AS were not generated. " - + "Refer to the native Xcode toolchain or cctools " - + "for an assembler and linker.") # v1 exports bindir = os.path.join(self.package_folder, "bin") diff --git a/recipes/bison/all/conandata.yml b/recipes/bison/all/conandata.yml index 67b0780a7f6589..5b0419bb8cd0b9 100644 --- a/recipes/bison/all/conandata.yml +++ b/recipes/bison/all/conandata.yml @@ -14,35 +14,50 @@ sources: patches: "3.8.2": - patch_file: "patches/0001-3.8-create_pipe-uses-O_TEXT-not-O_BINARY-mode.patch" - base_path: "source_subfolder" + patch_description: "use O_TEXT instead of O_BINARY for pipe" + patch_type: "portability" - patch_file: "patches/0002-3.7.6-open-source-file-in-binary-mode-MS-ftell-bug-ks-68337.patch" - base_path: "source_subfolder" + patch_description: "windows: open source file in binary mode" + patch_type: "portability" - patch_file: "patches/0005-gnulib-limit-search-range-of-_setmaxstdio.patch" - base_path: "source_subfolder" + patch_description: "msvc: limit search range of _setmaxstdio" + patch_type: "portability" "3.7.6": - patch_file: "patches/0001-create_pipe-uses-O_TEXT-not-O_BINARY-mode.patch" - base_path: "source_subfolder" + patch_description: "use O_TEXT instead of O_BINARY for pipe" + patch_type: "portability" - patch_file: "patches/0002-3.7.6-open-source-file-in-binary-mode-MS-ftell-bug-ks-68337.patch" - base_path: "source_subfolder" + patch_description: "windows: open source file in binary mode" + patch_type: "portability" - patch_file: "patches/0005-gnulib-limit-search-range-of-_setmaxstdio.patch" - base_path: "source_subfolder" + patch_description: "msvc: limit search range of _setmaxstdio" + patch_type: "portability" "3.7.1": - patch_file: "patches/0001-create_pipe-uses-O_TEXT-not-O_BINARY-mode.patch" - base_path: "source_subfolder" + patch_description: "use O_TEXT instead of O_BINARY for pipe" + patch_type: "portability" - patch_file: "patches/0002-3.7.1-open-source-file-in-binary-mode-MS-ftell-bug-ks-68337.patch" - base_path: "source_subfolder" + patch_description: "windows: open source file in binary mode" + patch_type: "portability" - patch_file: "patches/0005-gnulib-limit-search-range-of-_setmaxstdio.patch" - base_path: "source_subfolder" + patch_description: "msvc: limit search range of _setmaxstdio" + patch_type: "portability" - patch_file: "patches/0006-dont-link-bison-against-libreadline.patch" - base_path: "source_subfolder" + patch_description: "Don't link bison against libreadline" + patch_type: "portability" "3.5.3": - patch_file: "patches/0001-create_pipe-uses-O_TEXT-not-O_BINARY-mode.patch" - base_path: "source_subfolder" + patch_description: "use O_TEXT instead of O_BINARY for pipe" + patch_type: "portability" - patch_file: "patches/0002-3.5.3-open-source-file-in-binary-mode-MS-ftell-bug-ks-68337.patch" - base_path: "source_subfolder" + patch_description: "windows: open source file in binary mode" + patch_type: "portability" - patch_file: "patches/0003-3.5.3-msvc-changes.patch" - base_path: "source_subfolder" + patch_description: "windows: fix build" + patch_type: "portability" - patch_file: "patches/0004-3.5.3-relocatable.patch" - base_path: "source_subfolder" + patch_description: "Relocatable" + patch_type: "portability" - patch_file: "patches/0005-gnulib-limit-search-range-of-_setmaxstdio.patch" - base_path: "source_subfolder" + patch_description: "msvc: limit search range of _setmaxstdio" + patch_type: "portability" diff --git a/recipes/bison/all/conanfile.py b/recipes/bison/all/conanfile.py index 86d0e584d5c460..9a5645894b97c8 100644 --- a/recipes/bison/all/conanfile.py +++ b/recipes/bison/all/conanfile.py @@ -1,11 +1,13 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.files import get, apply_conandata_patches, replace_in_file -from conans import AutoToolsBuildEnvironment, tools -import contextlib +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, replace_in_file +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.54.0" class BisonConan(ConanFile): @@ -23,151 +25,147 @@ class BisonConan(ConanFile): "fPIC": True, } - exports_sources = "patches/*" - - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + @property + def _user_info_build(self): + return getattr(self, "user_info_build", self.deps_user_info) + + def export_sources(self): + export_conandata_patches(self) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): self.requires("m4/1.4.19") def validate(self): - if self.settings.compiler == "Visual Studio" and self.version == "3.8.2": - raise ConanInvalidConfiguration("bison/3.8.2 is not yet ready for Visual Studio, use previous version or open a pull request on https://github.com/conan-io/conan-center-index/pulls") + if is_msvc(self) and self.version == "3.8.2": + raise ConanInvalidConfiguration( + f"{self.ref} is not yet ready for Visual Studio, use previous version " + "or open a pull request on https://github.com/conan-io/conan-center-index/pulls" + ) def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - if self.settings.compiler == "Visual Studio": - self.build_requires("automake/1.16.5") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + if is_msvc(self): + self.tool_requires("automake/1.16.5") if self.settings.os != "Windows": - self.build_requires("flex/2.6.4") + self.tool_requires("flex/2.6.4") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @contextlib.contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): - env = { - "CC": "{} cl -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)), - "CXX": "{} cl -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)), - "CFLAGS": "-{}".format(self.settings.compiler.runtime), - "LD": "link", - "NM": "dumpbin -symbols", - "STRIP": ":", - "AR": "{} lib".format(tools.unix_path(self.deps_user_info["automake"].ar_lib)), - "RANLIB": ":", - } - with tools.environment_append(env): - yield - else: - yield + get(self, **self.conan_data["sources"][self.version], strip_root=True) - @property - def _datarootdir(self): - return os.path.join(self.package_folder, "res") - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - args = [ + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ "--enable-relocatable", "--disable-nls", - "--datarootdir={}".format(os.path.join(self._datarootdir).replace("\\", "/")), - ] - host, build = None, None - if self.settings.os == "Windows": - self._autotools.defines.append("_WINDOWS") + "--datarootdir=${prefix}/res", + ]) if self.settings.compiler == "apple-clang": - args.append("gl_cv_compiler_check_decl_option=") - if self.settings.compiler == "Visual Studio": + tc.configure_args.append("gl_cv_compiler_check_decl_option=") + if is_msvc(self): # Avoid a `Assertion Failed Dialog Box` during configure with build_type=Debug # Visual Studio does not support the %n format flag: # https://docs.microsoft.com/en-us/cpp/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions # Because the %n format is inherently insecure, it is disabled by default. If %n is encountered in a format string, # the invalid parameter handler is invoked, as described in Parameter Validation. To enable %n support, see _set_printf_count_output. - args.extend(["gl_cv_func_printf_directive_n=no", "gl_cv_func_snprintf_directive_n=no", "gl_cv_func_snprintf_directive_n=no"]) - self._autotools.flags.append("-FS") - host, build = False, False - self._autotools.configure(args=args, configure_dir=self._source_subfolder, host=host, build=build) - return self._autotools + tc.configure_args.extend([ + "gl_cv_func_printf_directive_n=no", + "gl_cv_func_snprintf_directive_n=no", + "gl_cv_func_snprintf_directive_n=no", + ]) + tc.extra_cflags.append("-FS") + env = tc.environment() + if is_msvc(self): + compile_wrapper = unix_path(self, self._user_info_build["automake"].compile) + ar_wrapper = unix_path(self, self._user_info_build["automake"].ar_lib) + env.define("CC", f"{compile_wrapper} cl -nologo") + env.define("CXX", f"{compile_wrapper} cl -nologo") + env.define("LD", "link -nologo") + env.define("AR", f"{ar_wrapper} lib") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + tc.generate(env) def _patch_sources(self): apply_conandata_patches(self) + makefile = os.path.join(self.source_folder, "Makefile.in") + yacc = os.path.join(self.source_folder, "src", "yacc.in") + if self.settings.os == "Windows": # replace embedded unix paths by windows paths - replace_in_file(self, os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, makefile, "echo '#define BINDIR \"$(bindir)\"';", "echo '#define BINDIR \"$(shell cygpath -m \"$(bindir)\")\"';") - replace_in_file(self, os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, makefile, "echo '#define PKGDATADIR \"$(pkgdatadir)\"';", "echo '#define PKGDATADIR \"$(shell cygpath -m \"$(pkgdatadir)\")\"';") - replace_in_file(self, os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, makefile, "echo '#define DATADIR \"$(datadir)\"';", "echo '#define DATADIR \"$(shell cygpath -m \"$(datadir)\")\"';") - replace_in_file(self, os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, makefile, "echo '#define DATAROOTDIR \"$(datarootdir)\"';", "echo '#define DATAROOTDIR \"$(shell cygpath -m \"$(datarootdir)\")\"';") - replace_in_file(self, os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, makefile, "dist_man_MANS = $(top_srcdir)/doc/bison.1", "dist_man_MANS =") - replace_in_file(self, os.path.join(self._source_subfolder, "src", "yacc.in"), - "@prefix@", - "${}_ROOT".format(self.name.upper())) - replace_in_file(self, os.path.join(self._source_subfolder, "src", "yacc.in"), - "@bindir@", - "${}_ROOT/bin".format(self.name.upper())) + replace_in_file(self, yacc, "@prefix@", "$CONAN_BISON_ROOT") + replace_in_file(self, yacc, "@bindir@", "$CONAN_BISON_ROOT/bin") def build(self): self._patch_sources() - with self._build_context(): - env_build = self._configure_autotools() - env_build.make() + autotools = Autotools(self) + autotools.configure() + autotools.install() def package(self): - with self._build_context(): - env_build = self._configure_autotools() - env_build.install() - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - - if self.settings.compiler == "Visual Studio": - os.rename(os.path.join(self.package_folder, "lib", "liby.a"), - os.path.join(self.package_folder, "lib", "y.lib")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + if is_msvc(self): + rename(self, os.path.join(self.package_folder, "lib", "liby.a"), + os.path.join(self.package_folder, "lib", "y.lib")) def package_info(self): self.cpp_info.includedirs = [] self.cpp_info.libs = ["y"] + self.cpp_info.resdirs = ["res"] - self.output.info("Setting BISON_ROOT environment variable: {}".format(self.package_folder)) - self.env_info.BISON_ROOT = self.package_folder.replace("\\", "/") + bison_root = self.package_folder.replace("\\", "/") + self.buildenv_info.define_path("CONAN_BISON_ROOT", bison_root) - bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) - self.env_info.PATH.append(bindir) - pkgdir = os.path.join(self._datarootdir, "bison") - self.output.info("Setting the BISON_PKGDATADIR environment variable: {}".format(pkgdir)) - self.env_info.BISON_PKGDATADIR = pkgdir + pkgdir = os.path.join(self.package_folder, "res", "bison") + self.buildenv_info.define_path("BISON_PKGDATADIR", pkgdir) # yacc is a shell script, so requires a shell (such as bash) - self.user_info.YACC = os.path.join(self.package_folder, "bin", "yacc").replace("\\", "/") + yacc = os.path.join(self.package_folder, "bin", "yacc").replace("\\", "/") + self.conf_info.define("user.bison:yacc", yacc) + + # TODO: to remove in conan v2 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) + self.env_info.CONAN_BISON_ROOT = self.package_folder.replace("\\", "/") + self.env_info.BISON_PKGDATADIR = pkgdir + self.user_info.YACC = yacc diff --git a/recipes/bison/all/patches/0003-3.5.3-msvc-changes.patch b/recipes/bison/all/patches/0003-3.5.3-msvc-changes.patch index 3e04d6ae94ee52..56aeeebbeb7df8 100644 --- a/recipes/bison/all/patches/0003-3.5.3-msvc-changes.patch +++ b/recipes/bison/all/patches/0003-3.5.3-msvc-changes.patch @@ -7,11 +7,11 @@ but aren't to avoid a dependency on a already-built flex and bison. #include #include #include /* fileno */ -+#if !defined(_WINDOWS) ++#ifndef _WIN32 #include +#endif #include /* fstat */ -+#if !defined(_WINDOWS) ++#ifndef _WIN32 #include +#endif diff --git a/recipes/bison/all/test_package/CMakeLists.txt b/recipes/bison/all/test_package/CMakeLists.txt index b2e4203587321d..569311ba35a62b 100644 --- a/recipes/bison/all/test_package/CMakeLists.txt +++ b/recipes/bison/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.0) -project(test_package) +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup() - -find_package(BISON) +find_package(BISON REQUIRED) set(BISON_VARS BISON_FOUND @@ -19,13 +16,5 @@ foreach(BISON_VAR ${BISON_VARS}) endif() endforeach() -bison_target(Bison_McParser - mc_parser.yy "${CMAKE_CURRENT_BINARY_DIR}/mc_parser.cpp" -) - -add_library(McParser STATIC - "${CMAKE_CURRENT_BINARY_DIR}/mc_parser.cpp" -) -add_executable(${PROJECT_NAME} test_package.cpp) -set_propertY(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +bison_target(McParser mc_parser.yy "${CMAKE_CURRENT_BINARY_DIR}/mc_parser.cpp") +add_library(${PROJECT_NAME} STATIC ${BISON_McParser_OUTPUTS}) diff --git a/recipes/bison/all/test_package/conanfile.py b/recipes/bison/all/test_package/conanfile.py index 82220fffff8660..dd177dd578622b 100644 --- a/recipes/bison/all/test_package/conanfile.py +++ b/recipes/bison/all/test_package/conanfile.py @@ -1,38 +1,38 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.microsoft import unix_path import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "VirtualBuildEnv", "VirtualRunEnv" + test_type = "explicit" + win_bash = True @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + def layout(self): + cmake_layout(self) + def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires(self.tested_reference_str) + if self._settings_build.os == "Windows": + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() @property def _mc_parser_source(self): return os.path.join(self.source_folder, "mc_parser.yy") - def build(self): - if not tools.cross_building(self, skip_x64_x86=True): - # verify bison may run - self.run("bison --version", run_environment=True) - # verify yacc may run - self.run("yacc --version", run_environment=True, win_bash=tools.os_info.is_windows) - # verify bison may preprocess something - self.run("bison -d {}".format(self._mc_parser_source), run_environment=True) - - # verify CMake integration - cmake = CMake(self) - cmake.configure() - cmake.build() - def test(self): - if not tools.cross_building(self, skip_x64_x86=True): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + self.run("bison --version") + self.run("yacc --version") + self.run(f"bison -d {unix_path(self, self._mc_parser_source)}") diff --git a/recipes/bison/all/test_package/test_package.cpp b/recipes/bison/all/test_package/test_package.cpp deleted file mode 100644 index b00966a007909e..00000000000000 --- a/recipes/bison/all/test_package/test_package.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include - -extern "C" -{ - int yyerror(const char *); -} - -int main() -{ - char error[] = "conan-center-index"; - std::cout << yyerror(error) << std::endl; - return 0; -} diff --git a/recipes/bison/all/test_v1_package/CMakeLists.txt b/recipes/bison/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/bison/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/bison/all/test_v1_package/conanfile.py b/recipes/bison/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..99ccbfcae8665d --- /dev/null +++ b/recipes/bison/all/test_v1_package/conanfile.py @@ -0,0 +1,31 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake" + test_type = "explicit" + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def build_requirements(self): + self.build_requires(self.tested_reference_str) + if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): + self.build_requires("msys2/cci.latest") + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + @property + def _mc_parser_source(self): + return os.path.join(self.source_folder, os.pardir, "test_package", "mc_parser.yy") + + def test(self): + self.run("bison --version") + self.run("yacc --version", win_bash=tools.os_info.is_windows) + self.run(f"bison -d {self._mc_parser_source}") diff --git a/recipes/bitserializer/all/conandata.yml b/recipes/bitserializer/all/conandata.yml index 10234ee527ae71..9b5b2264c84bba 100644 --- a/recipes/bitserializer/all/conandata.yml +++ b/recipes/bitserializer/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.50": + url: "https://bitbucket.com/Pavel_Kisliak/BitSerializer/get/0.50.tar.gz" + sha256: "dc000b6516db60337d5dd56fb1b60e29ce700bd2e6f4e609ca548b84d1f1dcee" "0.44": url: "https://bitbucket.com/Pavel_Kisliak/BitSerializer/get/0.44.tar.gz" sha256: "39ee0b038c9f38a012f96913c9738a68514d2e923431fbd83ddf3f454e02bc6c" diff --git a/recipes/bitserializer/all/conanfile.py b/recipes/bitserializer/all/conanfile.py index aae97523850f3f..de0b409d6488ad 100644 --- a/recipes/bitserializer/all/conanfile.py +++ b/recipes/bitserializer/all/conanfile.py @@ -1,14 +1,19 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get, rmdir, replace_in_file +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class BitserializerConan(ConanFile): name = "bitserializer" - description = "C++ 17 library for serialization to multiple output formats (JSON, XML, YAML)" - topics = ("serialization", "json", "xml") + description = "C++ 17 library for serialization to multiple output formats (JSON, XML, YAML, CSV)" + topics = ("serialization", "json", "xml", "yaml", "csv") url = "https://github.com/conan-io/conan-center-index" homepage = "https://bitbucket.org/Pavel_Kisliak/bitserializer" license = "MIT" @@ -18,98 +23,166 @@ class BitserializerConan(ConanFile): "with_cpprestsdk": [True, False], "with_rapidjson": [True, False], "with_pugixml": [True, False], + "with_rapidyaml": [True, False], + "with_csv": [True, False], } default_options = { "with_cpprestsdk": False, "with_rapidjson": False, "with_pugixml": False, + "with_rapidyaml": False, + "with_csv": False, } no_copy_source = True @property - def _supported_compilers(self): - if tools.Version(self.version) >= "0.44": - return { - "gcc": "8", - "clang": "8", - "Visual Studio": "15", - "apple-clang": "12", - } + def _min_cppstd(self): + return "17" + @property + def _compilers_minimum_version(self): return { "gcc": "8", - "clang": "7", + "clang": "7" if Version(self.version) < "0.44" else "8", "Visual Studio": "15", + "msvc": "191", "apple-clang": "12", } @property - def _source_subfolder(self): - return "source_subfolder" + def _is_header_only(self): + # All components of library are header-only except csv-archive + return not self.options.with_csv + + def _patch_sources(self): + # Remove 'ryml' subdirectory from #include + replace_in_file(self, os.path.join(self.source_folder, "include/bitserializer/rapidyaml_archive.h"), "#include :BitSerializer::cpprestjson-archive> $<$:BitSerializer::rapidjson-archive> - $<$:BitSerializer::pugixml-archive>) + $<$:BitSerializer::pugixml-archive> + $<$:BitSerializer::rapidyaml-archive> + $<$:BitSerializer::csv-archive> +) target_compile_definitions(${PROJECT_NAME} PRIVATE $<$:"WITH_CPPRESTSDK"> $<$:"WITH_RAPIDJSON"> - $<$:"WITH_PUGIXML">) + $<$:"WITH_PUGIXML"> + $<$:"WITH_RAPIDYAML"> + $<$:"WITH_CSV"> +) diff --git a/recipes/bitserializer/all/test_package/conanfile.py b/recipes/bitserializer/all/test_package/conanfile.py index 2aef261cc57120..b681a2801a2f57 100644 --- a/recipes/bitserializer/all/test_package/conanfile.py +++ b/recipes/bitserializer/all/test_package/conanfile.py @@ -1,20 +1,36 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + bitserializerOptions = self.dependencies[self.tested_reference_str].options + tc.variables["WITH_CPPRESTSDK"] = bitserializerOptions.with_cpprestsdk + tc.variables["WITH_RAPIDJSON"] = bitserializerOptions.with_rapidjson + tc.variables["WITH_PUGIXML"] = bitserializerOptions.with_pugixml + tc.variables["WITH_RAPIDYAML"] = bitserializerOptions.with_rapidyaml + tc.variables["WITH_CSV"] = bitserializerOptions.with_csv + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["WITH_CPPRESTSDK"] = self.options["bitserializer"].with_cpprestsdk - cmake.definitions["WITH_RAPIDJSON"] = self.options["bitserializer"].with_rapidjson - cmake.definitions["WITH_PUGIXML"] = self.options["bitserializer"].with_pugixml cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/bitserializer/all/test_package/test_package.cpp b/recipes/bitserializer/all/test_package/test_package.cpp index 643c308b932d27..aba11c808ba190 100644 --- a/recipes/bitserializer/all/test_package/test_package.cpp +++ b/recipes/bitserializer/all/test_package/test_package.cpp @@ -12,6 +12,12 @@ #ifdef WITH_PUGIXML #include #endif +#ifdef WITH_RAPIDYAML +#include +#endif +#ifdef WITH_CSV +#include +#endif #include #include @@ -41,7 +47,7 @@ void TestArchive(const std::string& message) BitSerializer::SerializationOptions serializationOptions; serializationOptions.streamOptions.writeBom = false; - CTest testObj(message); + CTest testObj[1] = { message }; std::stringstream outputStream; BitSerializer::SaveObject(testObj, outputStream, serializationOptions); std::cout << outputStream.str() << std::endl; @@ -66,4 +72,10 @@ int main() { #ifdef WITH_PUGIXML TestArchive("Implementation based on pugixml"); #endif +#ifdef WITH_RAPIDYAML + TestArchive("Implementation based on RapidYaml"); +#endif +#ifdef WITH_CSV + TestArchive("CSV archive (built-in implementation)"); +#endif } diff --git a/recipes/bitserializer/all/test_v1_package/CMakeLists.txt b/recipes/bitserializer/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/bitserializer/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/bitserializer/all/test_v1_package/conanfile.py b/recipes/bitserializer/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..36f5974e9b2f14 --- /dev/null +++ b/recipes/bitserializer/all/test_v1_package/conanfile.py @@ -0,0 +1,22 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["WITH_CPPRESTSDK"] = self.options["bitserializer"].with_cpprestsdk + cmake.definitions["WITH_RAPIDJSON"] = self.options["bitserializer"].with_rapidjson + cmake.definitions["WITH_PUGIXML"] = self.options["bitserializer"].with_pugixml + cmake.definitions["WITH_RAPIDYAML"] = self.options["bitserializer"].with_rapidyaml + cmake.definitions["WITH_CSV"] = self.options["bitserializer"].with_csv + cmake.configure() + cmake.build() + + 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/bitserializer/config.yml b/recipes/bitserializer/config.yml index 3b57b2ed72ef13..31b18058643087 100644 --- a/recipes/bitserializer/config.yml +++ b/recipes/bitserializer/config.yml @@ -1,4 +1,6 @@ versions: + "0.50": + folder: "all" "0.44": folder: "all" "0.10": diff --git a/recipes/bitsery/all/conandata.yml b/recipes/bitsery/all/conandata.yml index 81be1b1c7d44e0..6d53e1633d5bf1 100644 --- a/recipes/bitsery/all/conandata.yml +++ b/recipes/bitsery/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "5.2.3": + url: "https://github.com/fraillt/bitsery/archive/v5.2.3.tar.gz" + sha256: "896d82ab4ccea9899ff2098aa69ad6d25e524ee1d4c747ce3232d0afe3cd05a5" "5.2.2": url: "https://github.com/fraillt/bitsery/archive/v5.2.2.tar.gz" sha256: "5e932c463f16db15228b2546632a5851a502c68e605a1e313b0f1a35c061e4ae" diff --git a/recipes/bitsery/config.yml b/recipes/bitsery/config.yml index 50e396f35efb2a..07e67c2710fe54 100644 --- a/recipes/bitsery/config.yml +++ b/recipes/bitsery/config.yml @@ -1,4 +1,6 @@ versions: + "5.2.3": + folder: all "5.2.2": folder: all "5.2.1": diff --git a/recipes/boost-leaf/all/conandata.yml b/recipes/boost-leaf/all/conandata.yml new file mode 100644 index 00000000000000..42c2ccab249612 --- /dev/null +++ b/recipes/boost-leaf/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.81.0": + url: "https://github.com/boostorg/leaf/archive/refs/tags/1.81.0.tar.gz" + sha256: "6a2bfa8727891e844f1f95c9c68af192f4c5f53b1707acce54290932118b48c0" diff --git a/recipes/boost-leaf/all/conanfile.py b/recipes/boost-leaf/all/conanfile.py new file mode 100644 index 00000000000000..b119ea7a5c58aa --- /dev/null +++ b/recipes/boost-leaf/all/conanfile.py @@ -0,0 +1,94 @@ +from conan import ConanFile +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.build import check_min_cppstd +from conan.errors import ConanInvalidConfiguration +import os + + +required_conan_version = ">=1.50.0" + + +class BoostLEAFConan(ConanFile): + name = "boost-leaf" + license = "BSL-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/boostorg/leaf" + description = ("Lightweight Error Augmentation Framework") + topics = ("multi-platform", "multi-threading", "cpp11", "error-handling", + "header-only", "low-latency", "no-dependencies", "single-header") + settings = "os", "compiler", "arch", "build_type" + no_copy_source = True + deprecated = True + + def configure(self): + raise ConanInvalidConfiguration(f"{self.ref} is deprecated in favor of Boost >=1.75.0") + + def package_id(self): + self.info.clear() + + @property + def _min_cppstd(self): + return "11" + + @property + def _compilers_minimum_version(self): + return { + "gcc": "4.8", + "Visual Studio": "17", + "msvc": "141", + "clang": "3.9", + "apple-clang": "10.0.0" + } + + def requirements(self): + pass + + def validate(self): + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def lazy_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + compiler = str(self.settings.compiler) + version = str(self.settings.compiler.version) + minimum_version = self._compilers_minimum_version.get(compiler, False) + + if minimum_version and lazy_lt_semver(version, minimum_version): + raise ConanInvalidConfiguration( + f"{self.name} {self.version} requires C++{self._min_cppstd}, which your compiler ({compiler}-{version}) does not support") + + def layout(self): + basic_layout(self) + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def package(self): + copy(self, "LICENSE_1_0.txt", dst=os.path.join( + self.package_folder, "licenses"), src=self.source_folder) + copy(self, "*.h", dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include")) + copy(self, "*.hpp", dst=os.path.join(self.package_folder, + "include"), src=os.path.join(self.source_folder, "include")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "boost-leaf") + self.cpp_info.set_property("cmake_target_name", "boost::leaf") + + self.cpp_info.names["cmake_find_package"] = "boost" + self.cpp_info.names["cmake_find_package_multi"] = "boost" + self.cpp_info.filenames["cmake_find_package"] = "boost-leaf" + self.cpp_info.filenames["cmake_find_package_multi"] = "boost-leaf" + self.cpp_info.components["leaf"].names["cmake_find_package"] = "leaf" + self.cpp_info.components["leaf"].names["cmake_find_package_multi"] = "leaf" + + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] diff --git a/recipes/boost-leaf/all/test_package/CMakeLists.txt b/recipes/boost-leaf/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..ca3f81cb32f1b3 --- /dev/null +++ b/recipes/boost-leaf/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) + +find_package(boost-leaf REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} main.cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_EXTENSIONS OFF) +target_link_libraries(${PROJECT_NAME} PRIVATE boost::leaf) diff --git a/recipes/boost-leaf/all/test_package/conanfile.py b/recipes/boost-leaf/all/test_package/conanfile.py new file mode 100644 index 00000000000000..8a5bb47f50c4ce --- /dev/null +++ b/recipes/boost-leaf/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/boost-leaf/all/test_package/main.cpp b/recipes/boost-leaf/all/test_package/main.cpp new file mode 100644 index 00000000000000..b6cf03bce1653a --- /dev/null +++ b/recipes/boost-leaf/all/test_package/main.cpp @@ -0,0 +1,64 @@ +#include +#include + +using namespace boost; + +enum custom_error_t +{ + err1, + err2, + err3, +}; + +leaf::result f1() +{ + return 5; +} + +leaf::result f2() +{ + return 15; +} + +leaf::result g(int a, int b) +{ + int sum = a + b; + if (sum == 20) + { + return leaf::new_error(custom_error_t::err2); + } + return sum; +} + +int main() +{ + leaf::result r = leaf::try_handle_some( + []() -> leaf::result + { + BOOST_LEAF_AUTO(v1, f1()); + BOOST_LEAF_AUTO(v2, f2()); + + return g(v1, v2); + }, + [](leaf::match) -> leaf::result + { + exit(1); + return -1; + }, + [](custom_error_t e) -> leaf::result + { + printf("Error value [%d] handled\n", static_cast(e)); + return 17; + }); + + if (r) + { + printf("value of r = %d\n", r.value()); + } + else + { + printf("r contains an error!\n"); + } + + return 0; +} diff --git a/recipes/boost-leaf/all/test_v1_package/CMakeLists.txt b/recipes/boost-leaf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..3b99781525c3c0 --- /dev/null +++ b/recipes/boost-leaf/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(boost-leaf REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/main.cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_EXTENSIONS OFF) +target_link_libraries(${PROJECT_NAME} PRIVATE boost::leaf) diff --git a/recipes/boost-leaf/all/test_v1_package/conanfile.py b/recipes/boost-leaf/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..25bed518a9fa8f --- /dev/null +++ b/recipes/boost-leaf/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 LibhalTestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = ("cmake", "cmake_find_package_multi") + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join(self.build_folder, "bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/boost-leaf/config.yml b/recipes/boost-leaf/config.yml new file mode 100644 index 00000000000000..80eea4560f8250 --- /dev/null +++ b/recipes/boost-leaf/config.yml @@ -0,0 +1,3 @@ +versions: + "1.81.0": + folder: "all" diff --git a/recipes/boost/all/conandata.yml b/recipes/boost/all/conandata.yml index ca9313ee3988bc..429c6cd2f589d0 100644 --- a/recipes/boost/all/conandata.yml +++ b/recipes/boost/all/conandata.yml @@ -1,278 +1,358 @@ sources: - 1.70.0: - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.70.0/source/boost_1_70_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.70.0/boost_1_70_0.tar.bz2", - ] - sha256: "430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778" - 1.71.0: - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.bz2", - ] - sha256: "d73a8da01e8bf8c7eda40b4c84915071a8c8a0df4a6734537ddde4a8580524ee" - 1.72.0: - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.72.0/source/boost_1_72_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.72.0/boost_1_72_0.tar.bz2", - ] - sha256: "59c9b274bc451cf91a9ba1dd2c7fdcaf5d60b1b3aa83f2c9fa143417cc660722" - 1.73.0: - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.73.0/source/boost_1_73_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.73.0/boost_1_73_0.tar.bz2", - ] - sha256: "4eb3b8d442b426dc35346235c8733b5ae35ba431690e38c6a8263dce9fcbb402" - 1.74.0: - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.74.0/source/boost_1_74_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.74.0/boost_1_74_0.tar.bz2" - ] - sha256: "83bfc1507731a0906e387fc28b7ef5417d591429e51e788417fe9ff025e116b1" - 1.75.0: - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.75.0/source/boost_1_75_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.75.0/boost_1_75_0.tar.bz2" - ] - sha256: "953db31e016db7bb207f11432bef7df100516eeb746843fa0486a222e3fd49cb" - 1.76.0: - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.76.0/boost_1_76_0.tar.bz2" - ] - sha256: "f0397ba6e982c4450f27bf32a2a83292aba035b827a5623a14636ea583318c41" - 1.77.0: - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.77.0/boost_1_77_0.tar.bz2" - ] - sha256: "fc9f85fc030e233142908241af7a846e60630aa7388de9a5fafb1f3a26840854" - 1.78.0: - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.78.0/boost_1_78_0.tar.bz2" - ] - sha256: "8681f175d4bdb26c52222665793eef08490d7758529330f98d3b29dd0735bccc" - 1.79.0: - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.79.0/source/boost_1_79_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.79.0/boost_1_79_0.tar.bz2" - ] - 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" - ] + "1.81.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.81.0/boost_1_81_0.tar.bz2" + sha256: "71feeed900fbccca04a3b4f2f84a7c217186f28a940ed8b7ed4725986baf99fa" + "1.80.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.80.0/source/boost_1_80_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.80.0/boost_1_80_0.tar.bz2" sha256: "1e19565d82e43bc59209a168f5ac899d3ba471d55c7610c677d4ccf2c9c500c0" + "1.79.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.79.0/source/boost_1_79_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.79.0/boost_1_79_0.tar.bz2" + sha256: "475d589d51a7f8b3ba2ba4eda022b170e562ca3b760ee922c146b6c65856ef39" + "1.78.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.78.0/boost_1_78_0.tar.bz2" + sha256: "8681f175d4bdb26c52222665793eef08490d7758529330f98d3b29dd0735bccc" + "1.77.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.77.0/boost_1_77_0.tar.bz2" + sha256: "fc9f85fc030e233142908241af7a846e60630aa7388de9a5fafb1f3a26840854" + "1.76.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.76.0/boost_1_76_0.tar.bz2" + sha256: "f0397ba6e982c4450f27bf32a2a83292aba035b827a5623a14636ea583318c41" + "1.75.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.75.0/source/boost_1_75_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.75.0/boost_1_75_0.tar.bz2" + sha256: "953db31e016db7bb207f11432bef7df100516eeb746843fa0486a222e3fd49cb" + "1.74.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.74.0/source/boost_1_74_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.74.0/boost_1_74_0.tar.bz2" + sha256: "83bfc1507731a0906e387fc28b7ef5417d591429e51e788417fe9ff025e116b1" + "1.73.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.73.0/source/boost_1_73_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.73.0/boost_1_73_0.tar.bz2" + sha256: "4eb3b8d442b426dc35346235c8733b5ae35ba431690e38c6a8263dce9fcbb402" + "1.72.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.72.0/source/boost_1_72_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.72.0/boost_1_72_0.tar.bz2" + sha256: "59c9b274bc451cf91a9ba1dd2c7fdcaf5d60b1b3aa83f2c9fa143417cc660722" + "1.71.0": + url: "https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.bz2" + sha256: "d73a8da01e8bf8c7eda40b4c84915071a8c8a0df4a6734537ddde4a8580524ee" + "1.70.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.70.0/source/boost_1_70_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.70.0/boost_1_70_0.tar.bz2" + sha256: "430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778" patches: - 1.70.0: - - patch_file: "patches/0001-beast-fix-moved-from-executor.patch" - base_path: "source_subfolder" - - patch_file: "patches/bcp_namespace_issues_1_70.patch" - base_path: "source_subfolder" - - patch_file: "patches/boost_build_qcc_fix_debug_build_parameter.patch" - base_path: "source_subfolder" - - patch_file: "patches/boost_core_qnx_cxx_provide___cxa_get_globals.patch" - base_path: "source_subfolder" - - patch_file: "patches/python_base_prefix.patch" - base_path: "source_subfolder" - - patch_file: "patches/solaris_pthread_data.patch" - base_path: "source_subfolder" + "1.81.0": + - patch_file: "patches/boost_1_77_mpi_check.patch" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" + - patch_file: "patches/1.81.0-locale-fail-on-missing-backend.patch" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" + "1.80.0": + - patch_file: "patches/1.80.0-locale-fail-on-missing-backend.patch" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" + - patch_file: "patches/boost_1_77_mpi_check.patch" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" + - patch_file: "patches/1.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" + - 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" + - 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" + - 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" + "1.79.0": - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" - base_path: "source_subfolder" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" + - patch_file: "patches/boost_1_77_mpi_check.patch" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" + - patch_file: "patches/1.69.0-locale-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" + - patch_file: "patches/1.77.0-fiber-mingw.patch" + patch_description: "fix layout=versioned for clang@Macos + mingw@Windows" + patch_type: "conan" + - patch_file: "patches/1.79.0-0001-json-array-erase-relocate.patch" + patch_description: "json::array::erase(it) seg fault on linux" + patch_type: "official" + patch_source: "https://github.com/boostorg/json/issues/692" + - patch_file: "patches/1.79.0-smart_ptr_cw_ppc_msync.patch" + patch_description: "Use msync for PowerPC architectures" + patch_type: "portability" + - patch_file: "patches/1.79.0-geometry_no_rtti.patch" + patch_description: "Fix access specifier preventing use of experimental iterators. Allow more granular control over enabled experimental features." + patch_type: "portability" + patch_source: "https://github.com/boostorg/geometry/discussions/1041" + "1.78.0": + - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" + - patch_file: "patches/boost_1_77_mpi_check.patch" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" + - patch_file: "patches/1.69.0-locale-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" + - patch_file: "patches/1.77.0-type_erasure-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" + - patch_file: "patches/1.77.0-fiber-mingw.patch" + patch_description: "fix layout=versioned for clang@Macos + mingw@Windows" + patch_type: "conan" + - patch_file: "patches/1.78.0-b2-fix-install.patch" + patch_description: "Don't skip install targets if there's no in ureqs" + patch_type: "official" + patch_source: "https://github.com/boostorg/build/pull/113" + "1.77.0": + - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" + - patch_file: "patches/boost_1_77_mpi_check.patch" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" + - patch_file: "patches/1.69.0-locale-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" + - patch_file: "patches/1.77.0-type_erasure-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" + - patch_file: "patches/1.77.0-fiber-mingw.patch" + patch_description: "fix layout=versioned for clang@Macos + mingw@Windows" + patch_type: "conan" + - patch_file: "patches/1.77.0-boost_build-with-newer-b2.patch" + patch_description: "Bump build_requires of 'b2' to '4.7.1' (was '4.5.0')" + patch_type: "conan" + "1.76.0": + - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" - patch_file: "patches/boost_mpi_check.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.69.0-contract-no-system.patch" - base_path: "source_subfolder" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" - patch_file: "patches/1.69.0-locale-no-system.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" + - patch_file: "patches/1.77.0-type_erasure-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" + - patch_file: "patches/1.77.0-boost_build-with-newer-b2.patch" + patch_description: "Bump build_requires of 'b2' to '4.7.1' (was '4.5.0')" + patch_type: "conan" + "1.75.0": + - patch_file: "patches/boost_build_qcc_fix_debug_build_parameter_since_1_74.patch" + patch_description: "" + patch_type: "conan" + - patch_file: "patches/python_base_prefix_since_1_74.patch" + patch_description: "" + patch_type: "conan" + - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" + - patch_file: "patches/boost_mpi_check.patch" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" + - patch_file: "patches/1.69.0-locale-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" + - patch_file: "patches/1.77.0-type_erasure-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" + - patch_file: "patches/1.75.0-boost_build-with-newer-b2.patch" + patch_description: "Bump build_requires of 'b2' to '4.7.1' (was '4.5.0')" + patch_type: "conan" + "1.74.0": + - patch_file: "patches/boost_build_qcc_fix_debug_build_parameter_since_1_74.patch" + patch_description: "" + patch_type: "conan" + - patch_file: "patches/python_base_prefix_since_1_74.patch" + patch_description: "" + patch_type: "conan" + - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" + - patch_file: "patches/boost_mpi_check.patch" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" + - patch_file: "patches/1.69.0-locale-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-random-no-system.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-type_erasure-no-system.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.70.0-boost_build-with-newer-b2.patch" - base_path: "source_subfolder" - 1.71.0: - - patch_file: "patches/bcp_namespace_issues_1_71.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" + - patch_file: "patches/1.75.0-boost_build-with-newer-b2.patch" + patch_description: "Bump build_requires of 'b2' to '4.7.1' (was '4.5.0')" + patch_type: "conan" + "1.73.0": - patch_file: "patches/boost_build_qcc_fix_debug_build_parameter.patch" - base_path: "source_subfolder" - - patch_file: "patches/boost_core_qnx_cxx_provide___cxa_get_globals.patch" - base_path: "source_subfolder" + patch_description: "" + patch_type: "conan" - patch_file: "patches/python_base_prefix.patch" - base_path: "source_subfolder" - - patch_file: "patches/solaris_pthread_data.patch" - base_path: "source_subfolder" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" - base_path: "source_subfolder" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" - patch_file: "patches/boost_mpi_check.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.69.0-contract-no-system.patch" - base_path: "source_subfolder" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" - patch_file: "patches/1.69.0-locale-no-system.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-random-no-system.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-type_erasure-no-system.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.75.0-boost_build-with-newer-b2.patch" - base_path: "source_subfolder" - 1.72.0: + patch_description: "Bump build_requires of 'b2' to '4.7.1' (was '4.5.0')" + patch_type: "conan" + "1.72.0": - patch_file: "patches/bcp_namespace_issues_1_72.patch" - base_path: "source_subfolder" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_build_qcc_fix_debug_build_parameter.patch" - base_path: "source_subfolder" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_core_qnx_cxx_provide___cxa_get_globals.patch" - base_path: "source_subfolder" + patch_description: "" + patch_type: "conan" - patch_file: "patches/python_base_prefix.patch" - base_path: "source_subfolder" + patch_description: "" + patch_type: "conan" - patch_file: "patches/solaris_pthread_data.patch" - base_path: "source_subfolder" + patch_description: "" + patch_type: "conan" - patch_file: "patches/0001-revert-cease-dependence-on-range.patch" - base_path: "source_subfolder" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_log_filesystem_no_deprecated_1_72.patch" - base_path: "source_subfolder" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" - base_path: "source_subfolder" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" - patch_file: "patches/boost_mpi_check.patch" - base_path: "source_subfolder" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" - patch_file: "patches/1.69.0-locale-no-system.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-random-no-system.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-type_erasure-no-system.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.75.0-boost_build-with-newer-b2.patch" - base_path: "source_subfolder" - 1.73.0: + patch_description: "Bump build_requires of 'b2' to '4.7.1' (was '4.5.0')" + patch_type: "conan" + "1.71.0": + - patch_file: "patches/bcp_namespace_issues_1_71.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_build_qcc_fix_debug_build_parameter.patch" - base_path: "source_subfolder" + patch_description: "" + patch_type: "conan" + - patch_file: "patches/boost_core_qnx_cxx_provide___cxa_get_globals.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/python_base_prefix.patch" - base_path: "source_subfolder" + patch_description: "" + patch_type: "conan" + - patch_file: "patches/solaris_pthread_data.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" - base_path: "source_subfolder" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" - patch_file: "patches/boost_mpi_check.patch" - base_path: "source_subfolder" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" + - patch_file: "patches/1.69.0-contract-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-locale-no-system.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-random-no-system.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-type_erasure-no-system.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.75.0-boost_build-with-newer-b2.patch" - base_path: "source_subfolder" - 1.74.0: - - patch_file: "patches/boost_build_qcc_fix_debug_build_parameter_since_1_74.patch" - base_path: "source_subfolder" - - patch_file: "patches/python_base_prefix_since_1_74.patch" - base_path: "source_subfolder" + patch_description: "Bump build_requires of 'b2' to '4.7.1' (was '4.5.0')" + patch_type: "conan" + "1.70.0": + - patch_file: "patches/0001-beast-fix-moved-from-executor.patch" + patch_description: "" + patch_type: "conan" + - patch_file: "patches/bcp_namespace_issues_1_70.patch" + patch_description: "" + patch_type: "conan" + - patch_file: "patches/boost_build_qcc_fix_debug_build_parameter.patch" + patch_description: "" + patch_type: "conan" + - patch_file: "patches/boost_core_qnx_cxx_provide___cxa_get_globals.patch" + patch_description: "" + patch_type: "conan" + - patch_file: "patches/python_base_prefix.patch" + patch_description: "" + patch_type: "conan" + - patch_file: "patches/solaris_pthread_data.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" - base_path: "source_subfolder" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" - patch_file: "patches/boost_mpi_check.patch" - base_path: "source_subfolder" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" + - patch_file: "patches/1.69.0-contract-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-locale-no-system.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-random-no-system.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-type_erasure-no-system.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.75.0-boost_build-with-newer-b2.patch" - base_path: "source_subfolder" - 1.75.0: - - patch_file: "patches/boost_build_qcc_fix_debug_build_parameter_since_1_74.patch" - base_path: "source_subfolder" - - patch_file: "patches/python_base_prefix_since_1_74.patch" - base_path: "source_subfolder" - - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" - base_path: "source_subfolder" - - patch_file: "patches/boost_mpi_check.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.69.0-locale-no-system.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.77.0-type_erasure-no-system.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.75.0-boost_build-with-newer-b2.patch" - base_path: "source_subfolder" - 1.76.0: - - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" - base_path: "source_subfolder" - - patch_file: "patches/boost_mpi_check.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.69.0-locale-no-system.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.77.0-type_erasure-no-system.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.77.0-boost_build-with-newer-b2.patch" - base_path: "source_subfolder" - 1.77.0: - - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" - base_path: "source_subfolder" - - patch_file: "patches/boost_1_77_mpi_check.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.69.0-locale-no-system.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.77.0-type_erasure-no-system.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.77.0-fiber-mingw.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.77.0-boost_build-with-newer-b2.patch" - base_path: "source_subfolder" - 1.78.0: - - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" - base_path: "source_subfolder" - - patch_file: "patches/boost_1_77_mpi_check.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.69.0-locale-no-system.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.77.0-type_erasure-no-system.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.77.0-fiber-mingw.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.78.0-b2-fix-install.patch" - base_path: "source_subfolder" - 1.79.0: - - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" - base_path: "source_subfolder" - - patch_file: "patches/boost_1_77_mpi_check.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.69.0-locale-no-system.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.77.0-fiber-mingw.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.79.0-0001-json-array-erase-relocate.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.79.0-smart_ptr_cw_ppc_msync.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.79.0-geometry_no_rtti.patch" - base_path: "source_subfolder" - patch_type: "portability" - 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_description: "This library links to boost_system, even though that library is header-only" 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_file: "patches/1.70.0-boost_build-with-newer-b2.patch" + patch_description: "Bump build_requires of 'b2' to '4.7.1' (was '4.5.0')" patch_type: "conan" - 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 ff43defcf2c0c7..4f9bb32f663189 100644 --- a/recipes/boost/all/conanfile.py +++ b/recipes/boost/all/conanfile.py @@ -1,26 +1,27 @@ -from conan.tools.apple import is_apple_os -from conan.tools.build import build_jobs, check_min_cppstd, cross_building -from conan.tools.files import apply_conandata_patches, chdir, get, mkdir, rename, replace_in_file, rm, rmdir, save -from conan.tools.microsoft import msvc_runtime_flag from conan import ConanFile from conan.errors import ConanException, ConanInvalidConfiguration -from conans import tools +from conan.tools.apple import is_apple_os, to_apple_arch, XCRun +from conan.tools.build import build_jobs, check_min_cppstd, cross_building, valid_min_cppstd +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import ( + apply_conandata_patches, chdir, collect_libs, copy, export_conandata_patches, + get, mkdir, rename, replace_in_file, rm, rmdir, save +) +from conan.tools.gnu import AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, MSBuildToolchain, msvc_runtime_flag, VCVars from conan.tools.scm import Version import glob +from io import StringIO import os import re -import sys import shlex import shutil +import sys import yaml -try: - from cStringIO import StringIO -except ImportError: - from io import StringIO - -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.53.0" # When adding (or removing) an option, also add this option to the list in @@ -56,23 +57,23 @@ "thread", "timer", "type_erasure", + "url", "wave", ) class BoostConan(ConanFile): name = "boost" - settings = "os", "arch", "compiler", "build_type" description = "Boost provides free peer-reviewed portable C++ source libraries" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.boost.org" license = "BSL-1.0" topics = ("libraries", "cpp") - _options = None - + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], + "fPIC": [True, False], "header_only": [True, False], "error_code_header_only": [True, False], "system_no_deprecated": [True, False], @@ -80,13 +81,12 @@ class BoostConan(ConanFile): "filesystem_no_deprecated": [True, False], "filesystem_use_std_fs": [True, False], "filesystem_version": [None, "3", "4"], - "fPIC": [True, False], "layout": ["system", "versioned", "tagged", "b2-default"], "magic_autolink": [True, False], # enables BOOST_ALL_NO_LIB "diagnostic_definitions": [True, False], # enables BOOST_LIB_DIAGNOSTIC - "python_executable": "ANY", # system default python installation is used, if None - "python_version": "ANY", # major.minor; computed automatically, if None - "namespace": "ANY", # custom boost namespace for bcp, e.g. myboost + "python_executable": [None, "ANY"], # system default python installation is used, if None + "python_version": [None, "ANY"], # major.minor; computed automatically, if None + "namespace": ["ANY"], # custom boost namespace for bcp, e.g. myboost "namespace_alias": [True, False], # enable namespace alias for bcp, boost=myboost "multithreading": [True, False], # enables multithreading support "numa": [True, False], @@ -97,21 +97,22 @@ class BoostConan(ConanFile): "segmented_stacks": [True, False], "debug_level": list(range(0, 14)), "pch": [True, False], - "extra_b2_flags": "ANY", # custom b2 flags + "extra_b2_flags": [None, "ANY"], # custom b2 flags "i18n_backend": ["iconv", "icu", None, "deprecated"], "i18n_backend_iconv": ["libc", "libiconv", "off"], "i18n_backend_icu": [True, False], "visibility": ["global", "protected", "hidden"], - "addr2line_location": "ANY", + "addr2line_location": ["ANY"], "with_stacktrace_backtrace": [True, False], - "buildid": "ANY", - "python_buildid": "ANY", + "buildid": [None, "ANY"], + "python_buildid": [None, "ANY"], "system_use_utf8": [True, False], } options.update({f"without_{_name}": [True, False] for _name in CONFIGURE_OPTIONS}) default_options = { "shared": False, + "fPIC": True, "header_only": False, "error_code_header_only": False, "system_no_deprecated": False, @@ -119,12 +120,11 @@ class BoostConan(ConanFile): "filesystem_no_deprecated": False, "filesystem_use_std_fs": False, "filesystem_version": None, - "fPIC": True, "layout": "system", "magic_autolink": False, "diagnostic_definitions": False, - "python_executable": "None", - "python_version": "None", + "python_executable": None, + "python_version": None, "namespace": "boost", "namespace_alias": False, "multithreading": True, @@ -136,7 +136,7 @@ class BoostConan(ConanFile): "segmented_stacks": False, "debug_level": 0, "pch": True, - "extra_b2_flags": "None", + "extra_b2_flags": None, "i18n_backend": "deprecated", "i18n_backend_iconv": "libc", "i18n_backend_icu": False, @@ -154,12 +154,11 @@ class BoostConan(ConanFile): no_copy_source = True _cached_dependencies = None - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) - def export(self): - self.copy(self._dependency_filename, src="dependencies", dst="dependencies") + copy(self, f"dependencies/{self._dependency_filename}", src=self.recipe_folder, dst=self.export_folder) + + def export_sources(self): + export_conandata_patches(self) @property def _min_compiler_version_default_cxx11(self): @@ -171,6 +170,7 @@ def _min_compiler_version_default_cxx11(self): "gcc": 6, "clang": 6, "Visual Studio": 14, # guess + "msvc": 190, # guess }.get(str(self.settings.compiler)) @property @@ -180,6 +180,7 @@ def _min_compiler_version_nowide(self): "gcc": 5, "clang": 5, "Visual Studio": 14, # guess + "msvc": 190, # guess }.get(str(self.settings.compiler)) @property @@ -222,26 +223,18 @@ def _all_super_modules(self, name): break return dependencies - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _bcp_dir(self): return "custom-boost" @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + def _settings_build(self): + return getattr(self, "settings_build", self.settings) @property def _is_clang_cl(self): return self.settings.os == "Windows" and self.settings.compiler == "clang" - @property - def _zip_bzip2_requires_needed(self): - return not self.options.without_iostreams and not self.options.header_only - @property def _python_executable(self): """ @@ -274,11 +267,12 @@ def config_options(self): # nowide requires a c++11-able compiler + movable std::fstream: change default to not build on compiler with too old default c++ standard or too low compiler.cppstd # json requires a c++11-able compiler: change default to not build on compiler with too old default c++ standard or too low compiler.cppstd - if self.settings.compiler.cppstd: - if not tools.valid_min_cppstd(self, 11): + if self.settings.compiler.get_safe("cppstd"): + if not valid_min_cppstd(self, 11): self.options.without_fiber = True self.options.without_nowide = True self.options.without_json = True + self.options.without_url = True else: version_cxx11_standard_json = self._min_compiler_version_default_cxx11 if version_cxx11_standard_json: @@ -286,10 +280,12 @@ def config_options(self): self.options.without_fiber = True self.options.without_json = True self.options.without_nowide = True + self.options.without_url = True else: self.options.without_fiber = True self.options.without_json = True self.options.without_nowide = True + self.options.without_url = True # iconv is off by default on Windows and Solaris if self._is_windows_platform or self.settings.os == "SunOS": @@ -319,13 +315,13 @@ def disable_math(): except ConanException: pass - if self.settings.compiler.cppstd: - if not tools.valid_min_cppstd(self, 11): + if self.settings.compiler.get_safe("cppstd"): + if not valid_min_cppstd(self, 11): disable_math() else: min_compiler_version = self._min_compiler_version_default_cxx11 if min_compiler_version is None: - self.output.warn("Assuming the compiler supports c++11 by default") + self.output.warning("Assuming the compiler supports c++11 by default") elif Version(self.settings.compiler.version) < min_compiler_version: disable_math() @@ -341,16 +337,38 @@ def disable_wave(): except ConanException: pass - if self.settings.compiler.cppstd: - if not tools.valid_min_cppstd(self, 11): + if self.settings.compiler.get_safe("cppstd"): + if not valid_min_cppstd(self, 11): disable_wave() else: min_compiler_version = self._min_compiler_version_default_cxx11 if min_compiler_version is None: - self.output.warn("Assuming the compiler supports c++11 by default") + self.output.warning("Assuming the compiler supports c++11 by default") elif Version(self.settings.compiler.version) < min_compiler_version: disable_wave() + if Version(self.version) >= "1.81.0": + # Starting from 1.81.0, Boost.Locale requires a c++11 capable compiler + # ==> disable it by default for older compilers or c++ standards + + def disable_locale(): + super_modules = self._all_super_modules("locale") + for smod in super_modules: + try: + setattr(self.options, f"without_{smod}", True) + except ConanException: + pass + + if self.settings.compiler.get_safe("cppstd"): + if not valid_min_cppstd(self, 11): + disable_locale() + else: + min_compiler_version = self._min_compiler_version_default_cxx11 + if min_compiler_version is None: + self.output.warning("Assuming the compiler supports c++11 by default") + elif Version(self.settings.compiler.version) < min_compiler_version: + disable_locale() + @property def _configure_options(self): return self._dependencies["configure_options"] @@ -372,13 +390,13 @@ def _stacktrace_addr2line_available(self): def configure(self): if self.options.header_only: - del self.options.shared - del self.options.fPIC + self.options.rm_safe("shared") + self.options.rm_safe("fPIC") elif self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if self.options.i18n_backend != "deprecated": - self.output.warn("i18n_backend option is deprecated, do not use anymore.") + self.output.warning("i18n_backend option is deprecated, do not use anymore.") if self.options.i18n_backend == "iconv": self.options.i18n_backend_iconv = "libiconv" self.options.i18n_backend_icu = False @@ -389,27 +407,42 @@ def configure(self): self.options.i18n_backend_iconv = "off" self.options.i18n_backend_icu = False if self.options.without_locale: - del self.options.i18n_backend_iconv - del self.options.i18n_backend_icu + self.options.rm_safe("i18n_backend_iconv") + self.options.rm_safe("i18n_backend_icu") if not self.options.without_python: if not self.options.python_version: self.options.python_version = self._detect_python_version() self.options.python_executable = self._python_executable else: - del self.options.python_buildid + self.options.rm_safe("python_buildid") if not self._stacktrace_addr2line_available: - del self.options.addr2line_location + self.options.rm_safe("addr2line_location") if self.options.get_safe("without_stacktrace", True): - del self.options.with_stacktrace_backtrace + self.options.rm_safe("with_stacktrace_backtrace") if self.options.layout == "b2-default": self.options.layout = "versioned" if self.settings.os == "Windows" else "system" if self.options.without_fiber: - del self.options.numa + self.options.rm_safe("numa") + + def layout(self): + basic_layout(self, src_folder="src") + + @property + def _cxx11_boost_libraries(self): + libraries = ["fiber", "json", "nowide", "url"] + if Version(self.version) >= "1.76.0": + libraries.append("math") + if Version(self.version) >= "1.79.0": + libraries.append("wave") + if Version(self.version) >= "1.81.0": + libraries.append("locale") + libraries.sort() + return filter(lambda library: f"without_{library}" in self.options, libraries) def validate(self): if not self.options.multithreading: @@ -421,7 +454,7 @@ def validate(self): if not self.options.get_safe(f"without_{lib}"): raise ConanInvalidConfiguration(f"Boost '{lib}' library requires multi threading") - if self._is_msvc and self._shared and "MT" in msvc_runtime_flag(self): + if is_msvc(self) and self._shared and is_msvc_static_runtime(self): raise ConanInvalidConfiguration("Boost can not be built as shared library with MT runtime.") if not self.options.without_locale and self.options.i18n_backend_iconv == "off" and \ @@ -444,55 +477,19 @@ def validate(self): if not self.options.get_safe("without_nowide", True): # nowide require a c++11-able compiler with movable std::fstream mincompiler_version = self._min_compiler_version_nowide - if mincompiler_version: - if Version(self.settings.compiler.version) < mincompiler_version: - raise ConanInvalidConfiguration("This compiler is too old to build Boost.nowide.") + if mincompiler_version and Version(self.settings.compiler.version) < mincompiler_version: + raise ConanInvalidConfiguration("This compiler is too old to build Boost.nowide.") - if self.settings.compiler.cppstd: + if any([not self.options.get_safe(f"without_{library}", True) for library in self._cxx11_boost_libraries]): + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) else: version_cxx11_standard = self._min_compiler_version_default_cxx11 - if version_cxx11_standard: - if Version(self.settings.compiler.version) < version_cxx11_standard: - raise ConanInvalidConfiguration("Boost.{fiber,json} require a c++11 compiler (please set compiler.cppstd or use a newer compiler)") - else: - self.output.warn("I don't know what the default c++ standard of this compiler is. I suppose it supports c++11 by default.\n" - "This might cause some boost libraries not being built and conan components to fail.") - - if not all((self.options.without_fiber, self.options.get_safe("without_json", True))): - # fiber/json require a c++11-able compiler. - if self.settings.compiler.cppstd: - check_min_cppstd(self, 11) - else: - version_cxx11_standard = self._min_compiler_version_default_cxx11 - if version_cxx11_standard: - if Version(self.settings.compiler.version) < version_cxx11_standard: - raise ConanInvalidConfiguration("Boost.{fiber,json} requires a c++11 compiler (please set compiler.cppstd or use a newer compiler)") - else: - self.output.warn("I don't know what the default c++ standard of this compiler is. I suppose it supports c++11 by default.\n" - "This might cause some boost libraries not being built and conan components to fail.") - - if Version(self.version) >= "1.76.0": - # Starting from 1.76.0, Boost.Math requires a compiler with c++ standard 11 or higher - if not self.options.without_math: - if self.settings.compiler.cppstd: - check_min_cppstd(self, 11) - else: - min_compiler_version = self._min_compiler_version_default_cxx11 - if min_compiler_version is not None: - if Version(self.settings.compiler.version) < min_compiler_version: - raise ConanInvalidConfiguration("Boost.Math requires (boost:)cppstd>=11 (current one is lower)") - - if Version(self.version) >= "1.79.0": - # Starting from 1.79.0, Boost.Wave requires a compiler with c++ standard 11 or higher - if not self.options.without_wave: - if self.settings.compiler.cppstd: - check_min_cppstd(self, 11) - else: - min_compiler_version = self._min_compiler_version_default_cxx11 - if min_compiler_version is not None: - if Version(self.settings.compiler.version) < min_compiler_version: - raise ConanInvalidConfiguration("Boost.Wave requires (boost:)cppstd>=11 (current one is lower)") + if version_cxx11_standard and Version(self.settings.compiler.version) < version_cxx11_standard: + raise ConanInvalidConfiguration( + f"Boost.{{{','.join(self._cxx11_boost_libraries)}}} requires a c++11 compiler " + "(please set compiler.cppstd or use a newer compiler)" + ) def _with_dependency(self, dependency): """ @@ -542,7 +539,7 @@ def requirements(self): if self._with_zstd: self.requires("zstd/1.5.2") if self._with_stacktrace_backtrace: - self.requires("libbacktrace/cci.20210118") + self.requires("libbacktrace/cci.20210118", transitive_headers=True) if self._with_icu: self.requires("icu/72.1") @@ -552,28 +549,32 @@ def requirements(self): def package_id(self): del self.info.options.i18n_backend - if self.options.header_only: - self.info.header_only() - self.info.options.header_only = True + if self.info.options.header_only: + self.info.clear() else: del self.info.options.debug_level del self.info.options.filesystem_version del self.info.options.pch del self.info.options.python_executable # PATH to the interpreter is not important, only version matters - if self.options.without_python: + if self.info.options.without_python: del self.info.options.python_version - else: - self.info.options.python_version = self._python_version def build_requirements(self): if not self.options.header_only: - self.build_requires("b2/4.9.2") + self.tool_requires("b2/4.9.3") def source(self): get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + destination=self.source_folder, strip_root=True) apply_conandata_patches(self) + def generate(self): + if not self.options.header_only: + env = VirtualBuildEnv(self) + env.generate() + vc = VCVars(self) + vc.generate() + ##################### BUILDING METHODS ########################### def _run_python_script(self, script): @@ -586,7 +587,7 @@ def _run_python_script(self, script): command = f'"{self._python_executable}" -c "{script}"' self.output.info(f"running {command}") try: - self.run(command=command, output=output) + self.run(command, output, scope="run") except ConanException: self.output.info("(failed)") return None @@ -638,7 +639,7 @@ def _get_python_var(self, name): NOTE: distutils is deprecated and breaks the recipe since Python 3.10 """ - python_version_parts = self.info.options.python_version.split('.') + python_version_parts = str(self.info.options.python_version).split('.') python_major = int(python_version_parts[0]) python_minor = int(python_version_parts[1]) if(python_major >= 3 and python_minor >= 10): @@ -655,7 +656,6 @@ def _detect_python_version(self): "import sys; " "print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))") - @property def _python_version(self): version = self._detect_python_version() @@ -721,9 +721,10 @@ def _python_library_dir(self): multiarch = self._get_python_var("MULTIARCH") masd = self._get_python_var("multiarchsubdir") with_dyld = self._get_python_var("WITH_DYLD") - if libdir and multiarch and masd: + if libdir and multiarch and masd and not libdir.endswith(masd): if masd.startswith(os.sep): masd = masd[len(os.sep):] + self.output.warning(f"Python libdir candidate thingy: {libdir}") libdir = os.path.join(libdir, masd) if not libdir: @@ -731,8 +732,8 @@ def _python_library_dir(self): libdir = os.path.join(os.path.dirname(libdest), "libs") candidates = [ldlibrary, library] - library_prefixes = [""] if self._is_msvc else ["", "lib"] - library_suffixes = [".lib"] if self._is_msvc else [".so", ".dll.a", ".a"] + library_prefixes = [""] if is_msvc(self) else ["", "lib"] + library_suffixes = [".lib"] if is_msvc(self) else [".so", ".dll.a", ".a"] if with_dyld: library_suffixes.insert(0, ".dylib") @@ -756,102 +757,95 @@ def _python_library_dir(self): raise ConanInvalidConfiguration("couldn't locate python libraries - make sure you have installed python development files") def _clean(self): - src = os.path.join(self.source_folder, self._source_subfolder) clean_dirs = [ os.path.join(self.build_folder, "bin.v2"), os.path.join(self.build_folder, "architecture"), os.path.join(self.source_folder, self._bcp_dir), - os.path.join(src, "dist", "bin"), - os.path.join(src, "stage"), - os.path.join(src, "tools", "build", "src", "engine", "bootstrap"), - os.path.join(src, "tools", "build", "src", "engine", "bin.ntx86"), - os.path.join(src, "tools", "build", "src", "engine", "bin.ntx86_64"), + os.path.join(self.source_folder, "dist", "bin"), + os.path.join(self.source_folder, "stage"), + os.path.join(self.source_folder, "tools", "build", "src", "engine", "bootstrap"), + os.path.join(self.source_folder, "tools", "build", "src", "engine", "bin.ntx86"), + os.path.join(self.source_folder, "tools", "build", "src", "engine", "bin.ntx86_64"), ] for d in clean_dirs: if os.path.isdir(d): - self.output.warn(f"removing '{d}'") + self.output.warning(f"removing '{d}'") shutil.rmtree(d) @property def _b2_exe(self): - return "b2.exe" if tools.os_info.is_windows else "b2" + return "b2.exe" if self._settings_build == "Windows" else "b2" @property def _bcp_exe(self): - folder = os.path.join(self.source_folder, self._source_subfolder, "dist", "bin") - return os.path.join(folder, "bcp.exe" if tools.os_info.is_windows else "bcp") + folder = os.path.join(self.source_folder, "dist", "bin") + return os.path.join(folder, "bcp.exe" if self._settings_build == "Windows" else "bcp") @property def _use_bcp(self): return self.options.namespace != "boost" - @property - def _boost_dir(self): - return self._bcp_dir if self._use_bcp else self._source_subfolder - @property def _boost_build_dir(self): - return os.path.join(self.source_folder, self._source_subfolder, "tools", "build") + return os.path.join(self.source_folder, "tools", "build") def _build_bcp(self): - folder = os.path.join(self.source_folder, self._source_subfolder, "tools", "bcp") - with tools.vcvars(self.settings) if self._is_msvc else tools.no_op(): - with chdir(self, folder): - command = f"{self._b2_exe} -j{build_jobs(self)} --abbreviate-paths toolset={self._toolset}" - command += " -d%d" % self.options.debug_level - self.output.warn(command) - self.run(command, run_environment=True) + folder = os.path.join(self.source_folder, "tools", "bcp") + with chdir(self, folder): + command = f"{self._b2_exe} -j{build_jobs(self)} --abbreviate-paths toolset={self._toolset}" + command += f" -d{self.options.debug_level}" + self.output.warning(command) + self.run(command) def _run_bcp(self): - with tools.vcvars(self.settings) if self._is_msvc or self._is_clang_cl else tools.no_op(): - with chdir(self, self.source_folder): - mkdir(self, self._bcp_dir) - namespace = f"--namespace={self.options.namespace}" - alias = "--namespace-alias" if self.options.namespace_alias else "" - boostdir = f"--boost={self._source_subfolder}" - libraries = {"build", "boost-build.jam", "boostcpp.jam", "boost_install", "headers"} - for d in os.listdir(os.path.join(self._source_subfolder, "boost")): - if os.path.isdir(os.path.join(self._source_subfolder, "boost", d)): - libraries.add(d) - for d in os.listdir(os.path.join(self._source_subfolder, "libs")): - if os.path.isdir(os.path.join(self._source_subfolder, "libs", d)): - libraries.add(d) - libraries = " ".join(libraries) - command = f"{self._bcp_exe} {namespace} {alias} {boostdir} {libraries} {self._bcp_dir}" - self.output.warn(command) - self.run(command) + with chdir(self, self.source_folder): + mkdir(self, self._bcp_dir) + namespace = f"--namespace={self.options.namespace}" + alias = "--namespace-alias" if self.options.namespace_alias else "" + boostdir = f"--boost={self.source_folder}" + libraries = {"build", "boost-build.jam", "boostcpp.jam", "boost_install", "headers"} + for d in os.listdir(os.path.join(self.source_folder, "boost")): + if os.path.isdir(os.path.join(self.source_folder, "boost", d)): + libraries.add(d) + for d in os.listdir(os.path.join(self.source_folder, "libs")): + if os.path.isdir(os.path.join(self.source_folder, "libs", d)): + libraries.add(d) + libraries = " ".join(libraries) + command = f"{self._bcp_exe} {namespace} {alias} {boostdir} {libraries} {self._bcp_dir}" + self.output.warning(command) + self.run(command) def build(self): if cross_building(self, skip_x64_x86=True): # When cross building, do not attempt to run the test-executable (assume they work) - replace_in_file(self, os.path.join(self.source_folder, self._source_subfolder, "libs", "stacktrace", "build", "Jamfile.v2"), + replace_in_file(self, os.path.join(self.source_folder, "libs", "stacktrace", "build", "Jamfile.v2"), "$(>) > $(<)", "echo \"\" > $(<)", strict=False) # Older clang releases require a thread_local variable to be initialized by a constant value - replace_in_file(self, os.path.join(self.source_folder, self._source_subfolder, "boost", "stacktrace", "detail", "libbacktrace_impls.hpp"), + replace_in_file(self, os.path.join(self.source_folder, "boost", "stacktrace", "detail", "libbacktrace_impls.hpp"), "/* thread_local */", "thread_local", strict=False) - replace_in_file(self, os.path.join(self.source_folder, self._source_subfolder, "boost", "stacktrace", "detail", "libbacktrace_impls.hpp"), + replace_in_file(self, os.path.join(self.source_folder, "boost", "stacktrace", "detail", "libbacktrace_impls.hpp"), "/* static __thread */", "static __thread", strict=False) if self.settings.compiler == "apple-clang" or (self.settings.compiler == "clang" and Version(self.settings.compiler.version) < 6): - replace_in_file(self, os.path.join(self.source_folder, self._source_subfolder, "boost", "stacktrace", "detail", "libbacktrace_impls.hpp"), + replace_in_file(self, os.path.join(self.source_folder, "boost", "stacktrace", "detail", "libbacktrace_impls.hpp"), "thread_local", "/* thread_local */") - replace_in_file(self, os.path.join(self.source_folder, self._source_subfolder, "boost", "stacktrace", "detail", "libbacktrace_impls.hpp"), + replace_in_file(self, os.path.join(self.source_folder, "boost", "stacktrace", "detail", "libbacktrace_impls.hpp"), "static __thread", "/* static __thread */") - replace_in_file(self, os.path.join(self.source_folder, self._source_subfolder, "tools", "build", "src", "tools", "gcc.jam"), + replace_in_file(self, os.path.join(self.source_folder, "tools", "build", "src", "tools", "gcc.jam"), "local generic-os = [ set.difference $(all-os) : aix darwin vxworks solaris osf hpux ] ;", "local generic-os = [ set.difference $(all-os) : aix darwin vxworks solaris osf hpux iphone appletv ] ;", strict=False) - replace_in_file(self, os.path.join(self.source_folder, self._source_subfolder, "tools", "build", "src", "tools", "gcc.jam"), + replace_in_file(self, os.path.join(self.source_folder, "tools", "build", "src", "tools", "gcc.jam"), "local no-threading = android beos haiku sgi darwin vxworks ;", "local no-threading = android beos haiku sgi darwin vxworks iphone appletv ;", strict=False) - replace_in_file(self, os.path.join(self.source_folder, self._source_subfolder, "libs", "fiber", "build", "Jamfile.v2"), + replace_in_file(self, os.path.join(self.source_folder, "libs", "fiber", "build", "Jamfile.v2"), " @numa", " shared:.//boost_fiber : @numa", strict=False) if self.options.header_only: - self.output.warn("Header only package, skipping build") + self.output.warning("Header only package, skipping build") return self._clean() @@ -860,25 +854,22 @@ def build(self): self._build_bcp() self._run_bcp() - # Help locating bzip2 and zlib self._create_user_config_jam(self._boost_build_dir) # JOIN ALL FLAGS b2_flags = " ".join(self._build_flags) full_command = f"{self._b2_exe} {b2_flags}" # -d2 is to print more debug info and avoid travis timing out without output - sources = os.path.join(self.source_folder, self._boost_dir) + sources = os.path.join(self.source_folder, self._bcp_dir) if self._use_bcp else self.source_folder full_command += f' --debug-configuration --build-dir="{self.build_folder}"' - self.output.warn(full_command) + self.output.warning(full_command) # If sending a user-specified toolset to B2, setting the vcvars # interferes with the compiler selection. - use_vcvars = self._is_msvc and not self.settings.compiler.get_safe("toolset", default="") - with tools.vcvars(self.settings) if use_vcvars else tools.no_op(): - with chdir(self, sources): - # To show the libraries *1 - # self.run("%s --show-libraries" % b2_exe) - self.run(full_command, run_environment=True) + with chdir(self, sources): + # To show the libraries *1 + # self.run("%s --show-libraries" % b2_exe) + self.run(full_command) @property def _b2_os(self): @@ -1009,7 +1000,7 @@ def _build_flags(self): flags.append("--disable-iconv") def add_defines(library): - for define in self.deps_cpp_info[library].defines: + for define in self.dependencies[library].cpp_info.aggregated_components().defines: flags.append(f"define={define}") if self._with_zlib: @@ -1021,8 +1012,8 @@ def add_defines(library): if self._with_zstd: add_defines("zstd") - if self._is_msvc: - flags.append(f"runtime-link={'static' if 'MT' in msvc_runtime_flag(self) else 'shared'}" % ()) + if is_msvc(self): + flags.append(f"runtime-link={'static' if is_msvc_static_runtime(self) else 'shared'}") flags.append(f"runtime-debugging={'on' if 'd' in msvc_runtime_flag(self) else 'off'}") # For details https://boostorg.github.io/build/manual/master/index.html @@ -1042,7 +1033,8 @@ def add_defines(library): flags.append(f"toolset={self._toolset}") if self.settings.get_safe("compiler.cppstd"): - flags.append(f"cxxflags={tools.cppstd_flag(self.settings)}") + cppstd_flag = AutotoolsToolchain(self).cppstd + flags.append(f"cxxflags={cppstd_flag}") # LDFLAGS link_flags = [] @@ -1055,10 +1047,9 @@ def add_defines(library): if self.settings.build_type == "RelWithDebInfo": if self.settings.compiler == "gcc" or "clang" in str(self.settings.compiler): cxx_flags.append("-g") - elif self._is_msvc: + elif is_msvc(self): cxx_flags.append("/Z7") - # Standalone toolchain fails when declare the std lib if self.settings.os not in ("Android", "Emscripten"): try: @@ -1093,21 +1084,14 @@ def add_defines(library): flags.append("pch=on" if self.options.pch else "pch=off") if is_apple_os(self): - os_version = self.settings.get_safe("os.version") - if os_version: - os_subsystem = self.settings.get_safe("os.subsystem") - deployment_target_flag = tools.apple_deployment_target_flag( - self.settings.os, - os_version, - self.settings.get_safe("os.sdk"), - os_subsystem, - self.settings.get_safe("arch") - ) - cxx_flags.append(deployment_target_flag) - link_flags.append(deployment_target_flag) - if os_subsystem == "catalyst": - cxx_flags.append("--target=arm64-apple-ios-macabi") - link_flags.append("--target=arm64-apple-ios-macabi") + apple_min_version_flag = AutotoolsToolchain(self).apple_min_version_flag + if apple_min_version_flag: + cxx_flags.append(apple_min_version_flag) + link_flags.append(apple_min_version_flag) + os_subsystem = self.settings.get_safe("os.subsystem") + if os_subsystem == "catalyst": + cxx_flags.append("--target=arm64-apple-ios-macabi") + link_flags.append("--target=arm64-apple-ios-macabi") if self.settings.os == "iOS": if self.options.multithreading: @@ -1117,15 +1101,16 @@ def add_defines(library): cxx_flags.append("-fembed-bitcode") if self._with_iconv: - flags.append(f"-sICONV_PATH={self.deps_cpp_info['libiconv'].rootpath}") + flags.append(f"-sICONV_PATH={self.dependencies['libiconv'].package_folder}") if self._with_icu: - flags.append(f"-sICU_PATH={self.deps_cpp_info['icu'].rootpath}") - if not self.options["icu"].shared: + flags.append(f"-sICU_PATH={self.dependencies['icu'].package_folder}") + if not self.dependencies["icu"].options.shared: # Using ICU_OPTS to pass ICU system libraries is not possible due to Boost.Regex disallowing it. - if self._is_msvc: - icu_ldflags = " ".join(f"{l}.lib" for l in self.deps_cpp_info["icu"].system_libs) + icu_system_libs = self.dependencies["icu"].cpp_info.aggregated_components().system_libs + if is_msvc(self): + icu_ldflags = " ".join(f"{l}.lib" for l in icu_system_libs) else: - icu_ldflags = " ".join(f"-l{l}" for l in self.deps_cpp_info["icu"].system_libs) + icu_ldflags = " ".join(f"-l{l}" for l in icu_system_libs) link_flags.append(icu_ldflags) link_flags = f'linkflags="{" ".join(link_flags)}"' @@ -1150,7 +1135,7 @@ def add_defines(library): f"--prefix={self.package_folder}", f"-j{build_jobs(self)}", "--abbreviate-paths", - "-d%d" % self.options.debug_level, + f"-d{self.options.debug_level}", ]) return flags @@ -1174,66 +1159,71 @@ def _build_cross_flags(self): elif arch.startswith("mips"): pass else: - self.output.warn(f"Unable to detect the appropriate ABI for {arch} architecture.") + self.output.warning(f"Unable to detect the appropriate ABI for {arch} architecture.") self.output.info(f"Cross building flags: {flags}") return flags @property def _ar(self): - if os.environ.get("AR"): - return os.environ["AR"] + ar = VirtualBuildEnv(self).vars().get("AR") + if ar: + return ar if is_apple_os(self) and self.settings.compiler == "apple-clang": - return tools.XCRun(self.settings).ar + return XCRun(self).ar return None @property def _ranlib(self): - if os.environ.get("RANLIB"): - return os.environ["RANLIB"] + ranlib = VirtualBuildEnv(self).vars().get("RANLIB") + if ranlib: + return ranlib if is_apple_os(self) and self.settings.compiler == "apple-clang": - return tools.XCRun(self.settings).ranlib + return XCRun(self).ranlib return None @property def _cxx(self): - if os.environ.get("CXX"): - return os.environ["CXX"] + compilers_by_conf = self.conf.get("tools.build:compiler_executables", default={}, check_type=dict) + cxx = compilers_by_conf.get("cpp") or VirtualBuildEnv(self).vars().get("CXX") + if cxx: + return cxx if is_apple_os(self) and self.settings.compiler == "apple-clang": - return tools.XCRun(self.settings).cxx + return XCRun(self).cxx compiler_version = str(self.settings.compiler.version) major = compiler_version.split(".", maxsplit=1)[0] if self.settings.compiler == "gcc": - return tools.which(f"g++-{compiler_version}") or tools.which(f"g++-{major}") or tools.which("g++") or "" + return shutil.which(f"g++-{compiler_version}") or shutil.which(f"g++-{major}") or shutil.which("g++") or "" if self.settings.compiler == "clang": - return tools.which(f"clang++-{compiler_version}") or tools.which(f"clang++-{major}") or tools.which("clang++") or "" + return shutil.which(f"clang++-{compiler_version}") or shutil.which(f"clang++-{major}") or shutil.which("clang++") or "" return "" def _create_user_config_jam(self, folder): - """To help locating the zlib and bzip2 deps""" - self.output.warn("Patching user-config.jam") + self.output.warning("Patching user-config.jam") + + def create_library_config(deps_name, name): + aggregated_cpp_info = self.dependencies[deps_name].cpp_info.aggregated_components() + includedir = aggregated_cpp_info.includedirs[0].replace("\\", "/") + includedir = f"\"{includedir}\"" + libdir = aggregated_cpp_info.libdirs[0].replace("\\", "/") + libdir = f"\"{libdir}\"" + lib = aggregated_cpp_info.libs[0] + version = self.dependencies[deps_name].ref.version + return f"\nusing {name} : {version} : " \ + f"{includedir} " \ + f"{libdir} " \ + f"{lib} ;" contents = "" - if self._zip_bzip2_requires_needed: - def create_library_config(deps_name, name): - includedir = '"%s"' % self.deps_cpp_info[deps_name].include_paths[0].replace("\\", "/") - libdir = '"%s"' % self.deps_cpp_info[deps_name].lib_paths[0].replace("\\", "/") - lib = self.deps_cpp_info[deps_name].libs[0] - version = self.deps_cpp_info[deps_name].version - return f"\nusing {name} : {version} : " \ - f"{includedir} " \ - f"{libdir} " \ - f"{lib} ;" - - contents = "" - if self._with_zlib: - contents += create_library_config("zlib", "zlib") - if self._with_bzip2: - contents += create_library_config("bzip2", "bzip2") - if self._with_lzma: - contents += create_library_config("xz_utils", "lzma") - if self._with_zstd: - contents += create_library_config("zstd", "zstd") + + if self._with_zlib: + contents += create_library_config("zlib", "zlib") + if self._with_bzip2: + contents += create_library_config("bzip2", "bzip2") + if self._with_lzma: + contents += create_library_config("xz_utils", "lzma") + if self._with_zstd: + contents += create_library_config("zstd", "zstd") if not self.options.without_python: # https://www.boost.org/doc/libs/1_70_0/libs/python/doc/html/building/configuring_boost_build.html @@ -1247,33 +1237,33 @@ def create_library_config(deps_name, name): contents += f'\nusing "{self._toolset}" : {self._toolset_version} : ' cxx_fwd_slahes = self._cxx.replace("\\", "/") - if self._is_msvc: - contents += f' "{cxx_fwd_slahes}"' - else: - contents += f' {cxx_fwd_slahes}' + if cxx_fwd_slahes: + contents += f" \"{cxx_fwd_slahes}\"" if is_apple_os(self): if self.settings.compiler == "apple-clang": - contents += f" -isysroot {tools.XCRun(self.settings).sdk_path}" + contents += f" -isysroot {XCRun(self).sdk_path}" if self.settings.get_safe("arch"): - contents += f" -arch {tools.to_apple_arch(self.settings.arch)}" + contents += f" -arch {to_apple_arch(self)}" contents += " : \n" if self._ar: - ar_path = tools.which(self._ar).replace("\\", "/") + ar_path = self._ar.replace("\\", "/") contents += f'"{ar_path}" ' if self._ranlib: - ranlib_path = tools.which(self._ranlib).replace("\\", "/") + ranlib_path = self._ranlib.replace("\\", "/") contents += f'"{ranlib_path}" ' - cxxflags = tools.get_env("CXXFLAGS", "") + " " - cflags = tools.get_env("CFLAGS", "") + " " - cppflags = tools.get_env("CPPFLAGS", "") + " " - ldflags = tools.get_env("LDFLAGS", "") + " " - asflags = tools.get_env("ASFLAGS", "") + " " + cxxflags = " ".join(self.conf.get("tools.build:cxxflags", default=[], check_type=list)) + " " + cflags = " ".join(self.conf.get("tools.build:cflags", default=[], check_type=list)) + " " + buildenv_vars = VirtualBuildEnv(self).vars() + cppflags = buildenv_vars.get("CPPFLAGS", "") + " " + ldflags = " ".join(self.conf.get("tools.build:sharedlinkflags", default=[], check_type=list)) + " " + asflags = buildenv_vars.get("ASFLAGS", "") + " " if self._with_stacktrace_backtrace: - cppflags += " ".join(f"-I{p}" for p in self.deps_cpp_info["libbacktrace"].include_paths) + " " - ldflags += " ".join(f"-L{p}" for p in self.deps_cpp_info["libbacktrace"].lib_paths) + " " + backtrace_aggregated_cpp_info = self.dependencies["libbacktrace"].cpp_info.aggregated_components() + cppflags += " ".join(f"-I{p}" for p in backtrace_aggregated_cpp_info.includedirs) + " " + ldflags += " ".join(f"-L{p}" for p in backtrace_aggregated_cpp_info.libdirs) + " " if cxxflags.strip(): contents += f'"{cxxflags.strip()}" ' @@ -1291,30 +1281,22 @@ def create_library_config(deps_name, name): contents += " ;" - self.output.warn(contents) + self.output.warning(contents) filename = f"{folder}/user-config.jam" save(self, filename, contents) @property def _toolset_version(self): - if self.settings.get_safe("compiler") == "Visual Studio": - toolset = tools.msvs_toolset(self) + toolset = MSBuildToolchain(self).toolset + if toolset: match = re.match(r"v(\d+)(\d)$", toolset) if match: return f"{match.group(1)}.{match.group(2)}" - elif self.settings.get_safe("compiler") == "msvc": - toolsets = {'170': '11.0', - '180': '12.0', - '190': '14.0', - '191': '14.1', - '192': '14.2', - "193": '14.3'} - return toolsets[self.settings.get_safe("compiler.version")] return "" @property def _toolset(self): - if self._is_msvc: + if is_msvc(self): return "clang-win" if self.settings.compiler.get_safe("toolset") == "ClangCL" else "msvc" if self.settings.os == "Windows" and self.settings.compiler == "clang": return "clang-win" @@ -1358,7 +1340,7 @@ def _toolset_tag(self): os_ = "" if self.settings.os == "Macos": os_ = "darwin" - if self._is_msvc: + if is_msvc(self): toolset_version = self._toolset_version.replace(".", "") else: toolset_version = str(Version(self.settings.compiler.version).major) @@ -1372,18 +1354,18 @@ def _toolset_tag(self): def package(self): # This stage/lib is in source_folder... Face palm, looks like it builds in build but then # copy to source with the good lib name - self.copy("LICENSE_1_0.txt", dst="licenses", src=os.path.join(self.source_folder, - self._source_subfolder)) + copy(self, "LICENSE_1_0.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) if self.options.header_only: - self.copy(pattern="*", dst="include/boost", src=f"{self._boost_dir}/boost") + copy(self, "*", src=os.path.join(self.source_folder, "boost"), + dst=os.path.join(self.package_folder, "include", "boost")) if self.settings.os == "Emscripten" and not self.options.header_only: self._create_emscripten_libs() - if self._is_msvc and self._shared: + if is_msvc(self) and self._shared: # Some boost releases contain both static and shared variants of some libraries (if shared=True) - all_libs = set(tools.collect_libs(self, "lib")) + all_libs = set(collect_libs(self, "lib")) static_libs = set(l for l in all_libs if l.startswith("lib")) shared_libs = all_libs.difference(static_libs) static_libs = set(l[3:] for l in static_libs) @@ -1409,7 +1391,7 @@ def _create_emscripten_libs(self): self.package_folder, "lib" ) if not os.path.exists(staged_libs): - self.output.warn(f"Lib folder doesn't exist, can't collect libraries: {staged_libs}") + self.output.warning(f"Lib folder doesn't exist, can't collect libraries: {staged_libs}") return for bc_file in os.listdir(staged_libs): if bc_file.startswith("lib") and bc_file.endswith(".bc"): @@ -1526,7 +1508,7 @@ def package_info(self): # Note that "_libboost" requires "headers" so these defines will be applied to all the libraries too. self.cpp_info.components["headers"].requires.append("disable_autolinking") - if self._is_msvc or self._is_clang_cl: + if is_msvc(self) or self._is_clang_cl: if self.options.magic_autolink: if self.options.layout == "system": self.cpp_info.components["headers"].defines.append("BOOST_AUTO_LINK_SYSTEM") @@ -1569,9 +1551,9 @@ def package_info(self): "ach": "", "version": "", } - if self._is_msvc: # FIXME: mingw? + if is_msvc(self): # FIXME: mingw? # FIXME: add 'y' when using cpython cci package and when python is built in debug mode - static_runtime_key = "s" if "MT" in msvc_runtime_flag(self) else "" + static_runtime_key = "s" if is_msvc_static_runtime(self) else "" debug_runtime_key = "g" if "d" in msvc_runtime_flag(self) else "" debug_key = "d" if self.settings.build_type == "Debug" else "" abi = static_runtime_key + debug_runtime_key + debug_key @@ -1602,11 +1584,11 @@ def package_info(self): def add_libprefix(n): """ On MSVC, static libraries are built with a 'lib' prefix. Some libraries do not support shared, so are always built as a static library. """ libprefix = "" - if self._is_msvc and (not self._shared or n in self._dependencies["static_only"]): + if is_msvc(self) and (not self._shared or n in self._dependencies["static_only"]): libprefix = "lib" return libprefix + n - all_detected_libraries = set(l[:-4] if l.endswith(".dll") else l for l in tools.collect_libs(self)) + all_detected_libraries = set(l[:-4] if l.endswith(".dll") else l for l in collect_libs(self)) all_expected_libraries = set() incomplete_components = [] @@ -1664,11 +1646,15 @@ def filter_transform_module_libraries(names): self.cpp_info.components[module].names["cmake_find_package_multi"] = module self.cpp_info.components[module].names["pkg_config"] = f"boost_{module}" + # extract list of names of direct host dependencies to check for dependencies + # of components that exist in other packages + dependencies = [d.ref.name for d, _ in self.dependencies.direct_host.items()] + for requirement in self._dependencies.get("requirements", {}).get(module, []): if self.options.get_safe(requirement, None) == False: continue conan_requirement = self._option_to_conan_requirement(requirement) - if conan_requirement not in self.requires: + if conan_requirement not in dependencies: continue if module == "locale" and requirement in ("icu", "iconv"): if requirement == "icu" and not self._with_icu: @@ -1678,7 +1664,7 @@ def filter_transform_module_libraries(names): self.cpp_info.components[module].requires.append(f"{conan_requirement}::{conan_requirement}") for incomplete_component in incomplete_components: - self.output.warn(f"Boost component '{incomplete_component}' is missing libraries. Try building boost with '-o boost:without_{incomplete_component}'. (Option is not guaranteed to exist)") + self.output.warning(f"Boost component '{incomplete_component}' is missing libraries. Try building boost with '-o boost:without_{incomplete_component}'. (Option is not guaranteed to exist)") non_used = all_detected_libraries.difference(all_expected_libraries) if non_used: @@ -1724,7 +1710,7 @@ def filter_transform_module_libraries(names): self.cpp_info.components[f"numpy{pyversion.major}{pyversion.minor}"].requires = ["numpy"] - if self._is_msvc or self._is_clang_cl: + if is_msvc(self) or self._is_clang_cl: # https://github.com/conan-community/conan-boost/issues/127#issuecomment-404750974 self.cpp_info.components["_libboost"].system_libs.append("bcrypt") elif self.settings.os == "Linux": @@ -1753,4 +1739,6 @@ def filter_transform_module_libraries(names): self.cpp_info.components["headers"].defines.append("BOOST_SP_USE_SPINLOCK") else: self.cpp_info.components["headers"].defines.extend(["BOOST_AC_DISABLE_THREADS", "BOOST_SP_DISABLE_THREADS"]) + #TODO: remove in the future, user_info deprecated in conan2, but kept for compatibility while recipe is cross-compatible. self.user_info.stacktrace_addr2line_available = self._stacktrace_addr2line_available + self.conf_info.define("user.boost:stacktrace_addr2line_available", self._stacktrace_addr2line_available) diff --git a/recipes/boost/all/dependencies/dependencies-1.81.0.yml b/recipes/boost/all/dependencies/dependencies-1.81.0.yml new file mode 100644 index 00000000000000..838c68bc7e4324 --- /dev/null +++ b/recipes/boost/all/dependencies/dependencies-1.81.0.yml @@ -0,0 +1,280 @@ +configure_options: +- atomic +- chrono +- container +- context +- contract +- coroutine +- date_time +- exception +- fiber +- filesystem +- graph +- graph_parallel +- iostreams +- json +- locale +- log +- math +- mpi +- nowide +- program_options +- python +- random +- regex +- serialization +- stacktrace +- system +- test +- thread +- timer +- type_erasure +- url +- wave +dependencies: + atomic: [] + chrono: + - system + container: [] + context: [] + contract: + - exception + - thread + coroutine: + - context + - exception + - system + date_time: [] + exception: [] + fiber: + - context + - filesystem + fiber_numa: + - fiber + filesystem: + - atomic + - system + graph: + - math + - random + - regex + - serialization + graph_parallel: + - filesystem + - graph + - mpi + - random + - serialization + iostreams: + - random + - regex + json: + - container + - system + locale: + - thread + log: + - atomic + - container + - date_time + - exception + - filesystem + - random + - regex + - system + - thread + log_setup: + - log + math: [] + math_c99: + - math + math_c99f: + - math + math_c99l: + - math + math_tr1: + - math + math_tr1f: + - math + math_tr1l: + - math + mpi: + - graph + - serialization + mpi_python: + - mpi + - python + nowide: + - filesystem + numpy: + - python + prg_exec_monitor: + - test + program_options: [] + python: [] + random: + - system + regex: [] + serialization: [] + stacktrace: [] + stacktrace_addr2line: + - stacktrace + stacktrace_backtrace: + - stacktrace + stacktrace_basic: + - stacktrace + stacktrace_noop: + - stacktrace + stacktrace_windbg: + - stacktrace + stacktrace_windbg_cached: + - stacktrace + system: [] + test: + - exception + test_exec_monitor: + - test + thread: + - atomic + - chrono + - container + - date_time + - exception + - system + timer: + - chrono + - system + type_erasure: + - thread + unit_test_framework: + - prg_exec_monitor + - test + - test_exec_monitor + url: + - system + wave: + - filesystem + - serialization + wserialization: + - serialization +libs: + atomic: + - boost_atomic + chrono: + - boost_chrono + container: + - boost_container + context: + - boost_context + contract: + - boost_contract + coroutine: + - boost_coroutine + date_time: + - boost_date_time + exception: + - boost_exception + fiber: + - boost_fiber + fiber_numa: + - boost_fiber_numa + filesystem: + - boost_filesystem + graph: + - boost_graph + graph_parallel: + - boost_graph_parallel + iostreams: + - boost_iostreams + json: + - boost_json + locale: + - boost_locale + log: + - boost_log + log_setup: + - boost_log_setup + math: [] + math_c99: + - boost_math_c99 + math_c99f: + - boost_math_c99f + math_c99l: + - boost_math_c99l + math_tr1: + - boost_math_tr1 + math_tr1f: + - boost_math_tr1f + math_tr1l: + - boost_math_tr1l + mpi: + - boost_mpi + mpi_python: + - boost_mpi_python + nowide: + - boost_nowide + numpy: + - boost_numpy{py_major}{py_minor} + prg_exec_monitor: + - boost_prg_exec_monitor + program_options: + - boost_program_options + python: + - boost_python{py_major}{py_minor} + random: + - boost_random + regex: + - boost_regex + serialization: + - boost_serialization + stacktrace: [] + stacktrace_addr2line: + - boost_stacktrace_addr2line + stacktrace_backtrace: + - boost_stacktrace_backtrace + stacktrace_basic: + - boost_stacktrace_basic + stacktrace_noop: + - boost_stacktrace_noop + stacktrace_windbg: + - boost_stacktrace_windbg + stacktrace_windbg_cached: + - boost_stacktrace_windbg_cached + system: + - boost_system + test: [] + test_exec_monitor: + - boost_test_exec_monitor + thread: + - boost_thread + timer: + - boost_timer + type_erasure: + - boost_type_erasure + unit_test_framework: + - boost_unit_test_framework + url: + - boost_url + wave: + - boost_wave + wserialization: + - boost_wserialization +requirements: + iostreams: + - bzip2 + - lzma + - zlib + - zstd + locale: + - iconv + - icu + python: + - python + regex: + - icu + stacktrace: + - backtrace +static_only: +- boost_exception +- boost_test_exec_monitor +version: 1.81.0 diff --git a/recipes/boost/all/patches/1.81.0-locale-fail-on-missing-backend.patch b/recipes/boost/all/patches/1.81.0-locale-fail-on-missing-backend.patch new file mode 100644 index 00000000000000..80b22dd54b0e12 --- /dev/null +++ b/recipes/boost/all/patches/1.81.0-locale-fail-on-missing-backend.patch @@ -0,0 +1,12 @@ +diff --git a/libs/locale/build/Jamfile.v2 b/libs/locale/build/Jamfile.v2 +index f1321db3..36899cdc 100644 +--- a/libs/locale/build/Jamfile.v2 ++++ b/libs/locale/build/Jamfile.v2 +@@ -22,6 +22,7 @@ project /boost/locale + # Features + + feature.feature boost.locale.iconv : on off : optional propagated ; ++feature.feature boost.locale.iconv.lib : libc libiconv : optional propagated ; + feature.feature boost.locale.icu : on off : optional propagated ; + feature.feature boost.locale.posix : on off : optional propagated ; + feature.feature boost.locale.std : on off : optional propagated ; diff --git a/recipes/boost/all/rebuild-dependencies.py b/recipes/boost/all/rebuild-dependencies.py index 0ad4028e797b3f..05a14b8375a058 100755 --- a/recipes/boost/all/rebuild-dependencies.py +++ b/recipes/boost/all/rebuild-dependencies.py @@ -55,6 +55,7 @@ "thread", "timer", "type_erasure", + "url", "wave", ) diff --git a/recipes/boost/all/test_package/CMakeLists.txt b/recipes/boost/all/test_package/CMakeLists.txt index 0a03121f759205..769ce4cdc3ba2d 100644 --- a/recipes/boost/all/test_package/CMakeLists.txt +++ b/recipes/boost/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS) +enable_testing() if(BOOST_NAMESPACE) add_definitions("-DBOOST_NAMESPACE=${BOOST_NAMESPACE}") @@ -13,30 +12,35 @@ if(NOT HEADER_ONLY) find_package(Boost COMPONENTS random REQUIRED) add_executable(random_exe random.cpp) target_link_libraries(random_exe PRIVATE Boost::random) + add_test(NAME boost_random COMMAND random_exe) endif() if(WITH_REGEX) find_package(Boost COMPONENTS regex REQUIRED) add_executable(regex_exe regex.cpp) target_link_libraries(regex_exe PRIVATE Boost::regex) + add_test(NAME boost_regex COMMAND regex_exe) endif() if(WITH_TEST) find_package(Boost COMPONENTS unit_test_framework REQUIRED) add_executable(test_exe test.cpp) target_link_libraries(test_exe PRIVATE Boost::unit_test_framework) + add_test(NAME boost_test COMMAND test_exe) endif() if(WITH_COROUTINE) find_package(Boost COMPONENTS coroutine REQUIRED) add_executable(coroutine_exe coroutine.cpp) target_link_libraries(coroutine_exe PRIVATE Boost::coroutine) + add_test(NAME coroutine_test COMMAND coroutine_exe) endif() if(WITH_CHRONO) find_package(Boost COMPONENTS chrono REQUIRED) add_executable(chrono_exe chrono.cpp) target_link_libraries(chrono_exe PRIVATE Boost::chrono) + add_test(NAME chrono_test COMMAND chrono_exe) endif() if(WITH_FIBER) @@ -44,6 +48,7 @@ if(NOT HEADER_ONLY) add_executable(fiber_exe fiber.cpp) target_link_libraries(fiber_exe PRIVATE Boost::fiber) set_property(TARGET fiber_exe PROPERTY CXX_STANDARD 11) + add_test(NAME boost_fiber COMMAND fiber_exe) endif() if(WITH_JSON) @@ -51,6 +56,7 @@ if(NOT HEADER_ONLY) add_executable(json_exe json.cpp) target_link_libraries(json_exe PRIVATE Boost::json) set_property(TARGET json_exe PROPERTY CXX_STANDARD 11) + add_test(NAME boost_json COMMAND json_exe) endif() if(WITH_NOWIDE) @@ -58,12 +64,14 @@ if(NOT HEADER_ONLY) add_executable(nowide_exe nowide.cpp) target_link_libraries(nowide_exe PRIVATE Boost::nowide) set_property(TARGET nowide_exe PROPERTY CXX_STANDARD 11) + add_test(NAME boost_nowide COMMAND nowide_exe ${CMAKE_CURRENT_SOURCE_DIR}/conanfile.py) endif() if(WITH_LOCALE) find_package(Boost COMPONENTS locale REQUIRED) add_executable(locale_exe locale.cpp) target_link_libraries(locale_exe PRIVATE Boost::locale) + add_test(NAME boost_locale COMMAND locale_exe) endif() if(WITH_STACKTRACE_ADDR2LINE) @@ -71,12 +79,14 @@ if(NOT HEADER_ONLY) add_executable(stacktrace_addr2line_exe stacktrace.cpp) target_compile_definitions(stacktrace_addr2line_exe PRIVATE TEST_STACKTRACE_IMPL=1) target_link_libraries(stacktrace_addr2line_exe PRIVATE Boost::stacktrace_addr2line) + add_test(NAME boost_stacktrace_addr2line COMMAND stacktrace_addr2line_exe) endif() if(WITH_STACKTRACE_BACKTRACE) add_executable(stacktrace_backtrace_exe stacktrace.cpp) target_compile_definitions(stacktrace_backtrace_exe PRIVATE TEST_STACKTRACE_IMPL=2) target_link_libraries(stacktrace_backtrace_exe PRIVATE Boost::stacktrace_backtrace) + add_test(NAME boost_stacktrace_backtrace COMMAND stacktrace_backtrace_exe) endif() if(WITH_STACKTRACE) @@ -85,19 +95,23 @@ if(NOT HEADER_ONLY) add_executable(stacktrace_noop_exe stacktrace.cpp) target_compile_definitions(stacktrace_noop_exe PRIVATE TEST_STACKTRACE_IMPL=4) target_link_libraries(stacktrace_noop_exe PRIVATE Boost::stacktrace_noop) + add_test(NAME boost_stacktrace_noop COMMAND stacktrace_noop_exe) if(WIN32) add_executable(stacktrace_windbg_exe stacktrace.cpp) target_compile_definitions(stacktrace_windbg_exe PRIVATE TEST_STACKTRACE_IMPL=5) target_link_libraries(stacktrace_windbg_exe PRIVATE Boost::stacktrace_windbg) + add_test(NAME boost_stacktrace_windbg COMMAND stacktrace_windbg_exe) add_executable(stacktrace_windbg_cached_exe stacktrace.cpp) target_compile_definitions(stacktrace_windbg_cached_exe PRIVATE TEST_STACKTRACE_IMPL=6) target_link_libraries(stacktrace_windbg_cached_exe PRIVATE Boost::stacktrace_windbg_cached) + add_test(NAME boost_stacktrace_windbg_cached COMMAND stacktrace_windbg_cached_exe) else() add_executable(stacktrace_basic_exe stacktrace.cpp) target_compile_definitions(stacktrace_basic_exe PRIVATE TEST_STACKTRACE_IMPL=3) target_link_libraries(stacktrace_basic_exe PRIVATE Boost::stacktrace_basic) + add_test(NAME boost_stacktrace_basic COMMAND stacktrace_basic_exe) endif() endif() @@ -106,22 +120,33 @@ if(NOT HEADER_ONLY) add_library(hello_ext MODULE python.cpp) set_property(TARGET hello_ext PROPERTY PREFIX "") - find_package(PythonInterp REQUIRED) - find_package(PythonLibs REQUIRED) + find_package(Python ${PYTHON_VERSION_TO_SEARCH} COMPONENTS Interpreter Development NumPy REQUIRED) - target_include_directories(hello_ext PRIVATE ${PYTHON_INCLUDE_DIRS}) - target_link_libraries(hello_ext PRIVATE Boost::python${PYTHON_COMPONENT_SUFFIX} ${PYTHON_LIBRARIES}) + target_link_libraries(hello_ext PRIVATE Boost::python Python::Python) if(WIN32) set_target_properties(hello_ext PROPERTIES SUFFIX ".pyd") endif() + add_test(NAME boost_python COMMAND Python::Interpreter "${CMAKE_CURRENT_SOURCE_DIR}/python.py") + set_property(TEST boost_python PROPERTY ENVIRONMENT "PYTHONPATH=$") add_executable(numpy_exe numpy.cpp) - target_include_directories(numpy_exe PRIVATE ${PYTHON_INCLUDE_DIRS}) - target_link_libraries(numpy_exe PRIVATE Boost::numpy${PYTHON_COMPONENT_SUFFIX} ${PYTHON_LIBRARIES}) + target_link_libraries(numpy_exe PRIVATE Boost::numpy Python::Python Python::NumPy) + add_test(NAME boost_numpy COMMAND numpy_exe) + set_property(TEST boost_numpy PROPERTY ENVIRONMENT "PYTHONPATH=${Python_SITELIB}") endif() + + if(WITH_URL) + find_package(Boost COMPONENTS url REQUIRED) + add_executable(url_exe url.cpp) + target_link_libraries(url_exe PRIVATE Boost::url) + set_property(TARGET url_exe PROPERTY CXX_STANDARD 11) + add_test(NAME boost_url COMMAND url_exe) + endif() + endif() # Test header-only target find_package(Boost REQUIRED) add_executable(lambda_exe lambda.cpp) target_link_libraries(lambda_exe PRIVATE Boost::headers) +add_test(NAME boost_boost COMMAND lambda_exe) diff --git a/recipes/boost/all/test_package/conanfile.py b/recipes/boost/all/test_package/conanfile.py index 54e431f7b3b68a..66ee2b0e2d2764 100644 --- a/recipes/boost/all/test_package/conanfile.py +++ b/recipes/boost/all/test_package/conanfile.py @@ -1,94 +1,62 @@ -import os - -from conan.tools.build import cross_building -from conans import ConanFile, CMake, tools -from conans.errors import ConanException +from conan import ConanFile +from conan.errors import ConanException +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import chdir +from conan.tools.scm import Version class TestPackageConan(ConanFile): - settings = "os", "compiler", "arch", "build_type" - generators = "cmake", "cmake_find_package" - - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - self.build_requires("cmake/3.20.1") + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" def _boost_option(self, name, default): try: - return getattr(self.options["boost"], name, default) + return getattr(self.dependencies["boost"].options, name, default) except (AttributeError, ConanException): return default + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["HEADER_ONLY"] = self.dependencies["boost"].options.header_only + if not self.dependencies["boost"].options.header_only: + tc.cache_variables["Boost_USE_STATIC_LIBS"] = not self.dependencies["boost"].options.shared + tc.cache_variables["WITH_PYTHON"] = not self.dependencies["boost"].options.without_python + if not self.dependencies["boost"].options.without_python: + pyversion = self.dependencies["boost"].options.python_version + tc.cache_variables["PYTHON_VERSION_TO_SEARCH"] = pyversion + tc.cache_variables["Python_EXECUTABLE"] = self.dependencies["boost"].options.python_executable + tc.cache_variables["WITH_RANDOM"] = not self.dependencies["boost"].options.without_random + tc.cache_variables["WITH_REGEX"] = not self.dependencies["boost"].options.without_regex + tc.cache_variables["WITH_TEST"] = not self.dependencies["boost"].options.without_test + tc.cache_variables["WITH_COROUTINE"] = not self.dependencies["boost"].options.without_coroutine + tc.cache_variables["WITH_CHRONO"] = not self.dependencies["boost"].options.without_chrono + tc.cache_variables["WITH_FIBER"] = not self.dependencies["boost"].options.without_fiber + tc.cache_variables["WITH_LOCALE"] = not self.dependencies["boost"].options.without_locale + tc.cache_variables["WITH_NOWIDE"] = not self._boost_option("without_nowide", True) + tc.cache_variables["WITH_JSON"] = not self._boost_option("without_json", True) + tc.cache_variables["WITH_STACKTRACE"] = not self.dependencies["boost"].options.without_stacktrace + tc.cache_variables["WITH_STACKTRACE_ADDR2LINE"] = self.dependencies["boost"].conf_info.get("user.boost:stacktrace_addr2line_available") + tc.cache_variables["WITH_STACKTRACE_BACKTRACE"] = self._boost_option("with_stacktrace_backtrace", False) + tc.cache_variables["WITH_URL"] = not self._boost_option("without_url", True) + if self.dependencies["boost"].options.namespace != 'boost' and not self.dependencies["boost"].options.namespace_alias: + tc.cache_variables['BOOST_NAMESPACE'] = self.dependencies["boost"].options.namespace + tc.generate() + def build(self): - # FIXME: tools.vcvars added for clang-cl. Remove once conan supports clang-cl properly. (https://github.com/conan-io/conan-center-index/pull/1453) - with tools.vcvars(self.settings) if (self.settings.os == "Windows" and self.settings.compiler == "clang") else tools.no_op(): - cmake = CMake(self) - cmake.definitions["HEADER_ONLY"] = self.options["boost"].header_only - if not self.options["boost"].header_only: - cmake.definitions["Boost_USE_STATIC_LIBS"] = not self.options["boost"].shared - cmake.definitions["WITH_PYTHON"] = not self.options["boost"].without_python - if not self.options["boost"].without_python: - pyversion = tools.Version(self.options["boost"].python_version) - cmake.definitions["Python_ADDITIONAL_VERSIONS"] = "{}.{}".format(pyversion.major, pyversion.minor) - cmake.definitions["PYTHON_COMPONENT_SUFFIX"] = "{}{}".format(pyversion.major, pyversion.minor) - cmake.definitions["WITH_RANDOM"] = not self.options["boost"].without_random - cmake.definitions["WITH_REGEX"] = not self.options["boost"].without_regex - cmake.definitions["WITH_TEST"] = not self.options["boost"].without_test - cmake.definitions["WITH_COROUTINE"] = not self.options["boost"].without_coroutine - cmake.definitions["WITH_CHRONO"] = not self.options["boost"].without_chrono - cmake.definitions["WITH_FIBER"] = not self.options["boost"].without_fiber - cmake.definitions["WITH_LOCALE"] = not self.options["boost"].without_locale - cmake.definitions["WITH_NOWIDE"] = not self._boost_option("without_nowide", True) - cmake.definitions["WITH_JSON"] = not self._boost_option("without_json", True) - cmake.definitions["WITH_STACKTRACE"] = not self.options["boost"].without_stacktrace - cmake.definitions["WITH_STACKTRACE_ADDR2LINE"] = self.deps_user_info["boost"].stacktrace_addr2line_available - cmake.definitions["WITH_STACKTRACE_BACKTRACE"] = self._boost_option("with_stacktrace_backtrace", False) - if self.options["boost"].namespace != 'boost' and not self.options["boost"].namespace_alias: - cmake.definitions['BOOST_NAMESPACE'] = self.options["boost"].namespace - cmake.configure() - # Disable parallel builds because c3i (=conan-center's test/build infrastructure) seems to choke here - cmake.parallel = False - cmake.build() + cmake = CMake(self) + cmake.configure() + cmake.build() def test(self): - if cross_building(self): - return - self.run(os.path.join("bin", "lambda_exe"), run_environment=True) - if self.options["boost"].header_only: + if not can_run(self): return - if not self.options["boost"].without_random: - self.run(os.path.join("bin", "random_exe"), run_environment=True) - if not self.options["boost"].without_regex: - self.run(os.path.join("bin", "regex_exe"), run_environment=True) - if not self.options["boost"].without_test: - self.run(os.path.join("bin", "test_exe"), run_environment=True) - if not self.options["boost"].without_coroutine: - self.run(os.path.join("bin", "coroutine_exe"), run_environment=True) - if not self.options["boost"].without_chrono: - self.run(os.path.join("bin", "chrono_exe"), run_environment=True) - if not self.options["boost"].without_fiber: - self.run(os.path.join("bin", "fiber_exe"), run_environment=True) - if not self.options["boost"].without_locale: - self.run(os.path.join("bin", "locale_exe"), run_environment=True) - if not self._boost_option("without_nowide", True): - self.run("{} {}".format(os.path.join("bin", "nowide_exe"), os.path.join(self.source_folder, "conanfile.py")), run_environment=True) - if not self._boost_option("without_json", True): - self.run(os.path.join("bin", "json_exe"), run_environment=True) - if not self.options["boost"].without_python: - with tools.environment_append({"PYTHONPATH": "{}:{}".format("bin", "lib")}): - self.run("{} {}".format(self.options["boost"].python_executable, os.path.join(self.source_folder, "python.py")), run_environment=True) - self.run(os.path.join("bin", "numpy_exe"), run_environment=True) - if not self.options["boost"].without_stacktrace: - self.run(os.path.join("bin", "stacktrace_noop_exe"), run_environment=True) - if str(self.deps_user_info["boost"].stacktrace_addr2line_available) == "True": - self.run(os.path.join("bin", "stacktrace_addr2line_exe"), run_environment=True) - if self.settings.os == "Windows": - self.run(os.path.join("bin", "stacktrace_windbg_exe"), run_environment=True) - self.run(os.path.join("bin", "stacktrace_windbg_cached_exe"), run_environment=True) - else: - self.run(os.path.join("bin", "stacktrace_basic_exe"), run_environment=True) - if self._boost_option("with_stacktrace_backtrace", False): - self.run(os.path.join("bin", "stacktrace_backtrace_exe"), run_environment=True) + with chdir(self, self.folders.build_folder): + self.run(f"ctest --output-on-failure -C {self.settings.build_type}", env="conanrun") diff --git a/recipes/boost/all/test_package/url.cpp b/recipes/boost/all/test_package/url.cpp new file mode 100644 index 00000000000000..dd65390f85c359 --- /dev/null +++ b/recipes/boost/all/test_package/url.cpp @@ -0,0 +1,14 @@ +// +// Copyright (c) 2022 alandefreitas (alandefreitas@gmail.com) +// +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt +// + +#include +#include + +int main() { + assert(sizeof(boost::urls::url) > 0); + return 0; +} diff --git a/recipes/boost/all/test_v1_package/CMakeLists.txt b/recipes/boost/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..c23ed5cfe6d983 --- /dev/null +++ b/recipes/boost/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_v1_package) + +enable_testing() + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/boost/all/test_v1_package/conanfile.py b/recipes/boost/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..4bdbddf498bcc7 --- /dev/null +++ b/recipes/boost/all/test_v1_package/conanfile.py @@ -0,0 +1,52 @@ +from conans import ConanFile, CMake, tools +from conans.errors import ConanException +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def _boost_option(self, name, default): + try: + return getattr(self.options["boost"], name, default) + except (AttributeError, ConanException): + return default + + def build(self): + # FIXME: tools.vcvars added for clang-cl. Remove once conan supports clang-cl properly. (https://github.com/conan-io/conan-center-index/pull/1453) + with tools.vcvars(self.settings) if (self.settings.os == "Windows" and self.settings.compiler == "clang") else tools.no_op(): + cmake = CMake(self) + cmake.definitions["HEADER_ONLY"] = self.options["boost"].header_only + if not self.options["boost"].header_only: + cmake.definitions["Boost_USE_STATIC_LIBS"] = not self.options["boost"].shared + cmake.definitions["WITH_PYTHON"] = not self.options["boost"].without_python + if not self.options["boost"].without_python: + pyversion = tools.Version(self.options["boost"].python_version) + cmake.definitions["PYTHON_VERSION_TO_SEARCH"] = pyversion + cmake.definitions["Python_EXECUTABLE"] = self.options["boost"].python_executable + cmake.definitions["WITH_RANDOM"] = not self.options["boost"].without_random + cmake.definitions["WITH_REGEX"] = not self.options["boost"].without_regex + cmake.definitions["WITH_TEST"] = not self.options["boost"].without_test + cmake.definitions["WITH_COROUTINE"] = not self.options["boost"].without_coroutine + cmake.definitions["WITH_CHRONO"] = not self.options["boost"].without_chrono + cmake.definitions["WITH_FIBER"] = not self.options["boost"].without_fiber + cmake.definitions["WITH_LOCALE"] = not self.options["boost"].without_locale + cmake.definitions["WITH_NOWIDE"] = not self._boost_option("without_nowide", True) + cmake.definitions["WITH_JSON"] = not self._boost_option("without_json", True) + cmake.definitions["WITH_STACKTRACE"] = not self.options["boost"].without_stacktrace + cmake.definitions["WITH_STACKTRACE_ADDR2LINE"] = self.deps_user_info["boost"].stacktrace_addr2line_available + cmake.definitions["WITH_STACKTRACE_BACKTRACE"] = self._boost_option("with_stacktrace_backtrace", False) + cmake.definitions["WITH_URL"] = not self._boost_option("without_url", True) + if self.options["boost"].namespace != 'boost' and not self.options["boost"].namespace_alias: + cmake.definitions['BOOST_NAMESPACE'] = self.options["boost"].namespace + cmake.configure() + # Disable parallel builds because c3i (=conan-center's test/build infrastructure) seems to choke here + cmake.parallel = False + cmake.build() + + def test(self): + if tools.cross_building(self): + return + self.run(f"ctest --output-on-failure -C {self.settings.build_type}", run_environment=True) + diff --git a/recipes/boost/config.yml b/recipes/boost/config.yml index c2b37ebeaa9db7..76bc4f6280af1e 100644 --- a/recipes/boost/config.yml +++ b/recipes/boost/config.yml @@ -1,23 +1,25 @@ versions: - 1.70.0: - folder: all - 1.71.0: - folder: all - 1.72.0: - folder: all - 1.73.0: - folder: all - 1.74.0: - folder: all - 1.75.0: - folder: all - 1.76.0: - folder: all - 1.77.0: - folder: all - 1.78.0: - folder: all - 1.79.0: - folder: all - 1.80.0: - folder: all + "1.81.0": + folder: all + "1.80.0": + folder: all + "1.79.0": + folder: all + "1.78.0": + folder: all + "1.77.0": + folder: all + "1.76.0": + folder: all + "1.75.0": + folder: all + "1.74.0": + folder: all + "1.73.0": + folder: all + "1.72.0": + folder: all + "1.71.0": + folder: all + "1.70.0": + folder: all diff --git a/recipes/brynet/all/conandata.yml b/recipes/brynet/all/conandata.yml index 9c73dc59d65479..032ce7485ea1de 100644 --- a/recipes/brynet/all/conandata.yml +++ b/recipes/brynet/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.12.2": + url: "https://github.com/IronsDu/brynet/archive/v1.12.2.tar.gz" + sha256: "b8b740cae39804d1e7037866046321065856c0ea9f565d26f67aeccc7ccd3d51" + "1.12.1": + url: "https://github.com/IronsDu/brynet/archive/v1.12.1.tar.gz" + sha256: "bcd7ce9b1c3a8dd900f34e50e7ac23013226b3c78b1e22b079d781fbc698122d" "1.11.1": url: "https://github.com/IronsDu/brynet/archive/v1.11.1.tar.gz" sha256: "780f7e1be5e16a202b75661178209a9dd572d07d548a7f30e9bcc7f4a768c61d" diff --git a/recipes/brynet/all/conanfile.py b/recipes/brynet/all/conanfile.py index f19ddf2cfae85e..ece3fff57254f0 100644 --- a/recipes/brynet/all/conanfile.py +++ b/recipes/brynet/all/conanfile.py @@ -11,9 +11,9 @@ class BrynetConan(ConanFile): name = "brynet" description = "Header Only Cross platform high performance TCP network library using C++ 11." license = "MIT" - topics = ("networking", "tcp", "websocket") - homepage = "https://github.com/IronsDu/brynet" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/IronsDu/brynet" + topics = ("networking", "tcp", "websocket") settings = "os", "arch", "compiler", "build_type" options = { @@ -30,7 +30,7 @@ def layout(self): def requirements(self): if self.options.with_openssl: - self.requires("openssl/1.1.1q", transitive_headers=True, transitive_libs=True) + self.requires("openssl/1.1.1s", transitive_headers=True, transitive_libs=True) def package_id(self): self.info.clear() diff --git a/recipes/brynet/all/test_package/CMakeLists.txt b/recipes/brynet/all/test_package/CMakeLists.txt index d7b3556ccaf55f..a89c4946c16503 100644 --- a/recipes/brynet/all/test_package/CMakeLists.txt +++ b/recipes/brynet/all/test_package/CMakeLists.txt @@ -6,3 +6,7 @@ find_package(brynet REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE brynet::brynet) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) + +if(brynet_VERSION VERSION_GREATER_EQUAL "1.11.2") + target_compile_definitions(${PROJECT_NAME} PRIVATE BRYNET_EVENTLOOP_TCPSERVICE) +endif() diff --git a/recipes/brynet/all/test_package/test_package.cpp b/recipes/brynet/all/test_package/test_package.cpp index 54ae2df3641ce6..abfd618f6e876f 100644 --- a/recipes/brynet/all/test_package/test_package.cpp +++ b/recipes/brynet/all/test_package/test_package.cpp @@ -1,6 +1,11 @@ #include int main() { +#ifdef BRYNET_EVENTLOOP_TCPSERVICE + // brynet >= 1.11.2 provides IOThreadTcpService and EventLoopTcpService instead of TcpService + auto service = brynet::net::IOThreadTcpService::Create(); +#else auto service = brynet::net::TcpService::Create(); +#endif return 0; } diff --git a/recipes/brynet/all/test_v1_package/CMakeLists.txt b/recipes/brynet/all/test_v1_package/CMakeLists.txt index 0d6bc29a538907..be00a8c7f57c71 100644 --- a/recipes/brynet/all/test_v1_package/CMakeLists.txt +++ b/recipes/brynet/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/brynet/config.yml b/recipes/brynet/config.yml index 95c35b81026253..dd64cd4c4992b0 100644 --- a/recipes/brynet/config.yml +++ b/recipes/brynet/config.yml @@ -1,4 +1,8 @@ versions: + "1.12.2": + folder: all + "1.12.1": + folder: all "1.11.1": folder: all "1.11.0": diff --git a/recipes/bx/all/CMakeLists.txt b/recipes/bx/all/CMakeLists.txt deleted file mode 100644 index ba4a65a78f3b0a..00000000000000 --- a/recipes/bx/all/CMakeLists.txt +++ /dev/null @@ -1,60 +0,0 @@ -# Custom cmake config because the maintainer doesn't want maintain CMake configs. -# https://github.com/conan-io/conan-center-index/pull/1544/files#r420852884 - -cmake_minimum_required(VERSION 3.0) -project(bx) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -include(GNUInstallDirs) - -set(BX_SOURCE_SUBFOLDER "${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder") - -file(GLOB BX_SOURCES ${BX_SOURCE_SUBFOLDER}/src/*.cpp) -list(REMOVE_ITEM BX_SOURCES ${BX_SOURCE_SUBFOLDER}/src/amalgamated.cpp) -add_library(bx STATIC ${BX_SOURCES}) -target_include_directories(bx PUBLIC ${BX_SOURCE_SUBFOLDER}/include ${BX_SOURCE_SUBFOLDER}/3rdparty) -install(TARGETS bx PUBLIC_HEADER ARCHIVE LIBRARY RUNTIME) -set_property(TARGET bx PROPERTY CXX_STANDARD 14) -install(DIRECTORY ${BX_SOURCE_SUBFOLDER}/include/bx DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) - -if(MSVC) - target_include_directories(bx PUBLIC ${BX_SOURCE_SUBFOLDER}/include/compat/msvc) - install(DIRECTORY ${BX_SOURCE_SUBFOLDER}/include/compat/msvc/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bx/compat) -elseif(MINGW OR CYGWIN OR MSYS) - target_include_directories(bx PUBLIC ${BX_SOURCE_SUBFOLDER}/include/compat/mingw) - install(DIRECTORY ${BX_SOURCE_SUBFOLDER}/include/compat/mingw/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bx/compat) -elseif(UNIX) - if(APPLE) - if(IOS) - target_include_directories(bx PUBLIC ${BX_SOURCE_SUBFOLDER}/include/compat/ios) - install(DIRECTORY ${BX_SOURCE_SUBFOLDER}/include/compat/ios/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bx/compat) - else() - target_include_directories(bx PUBLIC ${BX_SOURCE_SUBFOLDER}/include/compat/osx) - install(DIRECTORY ${BX_SOURCE_SUBFOLDER}/include/compat/osx/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bx/compat) - endif() - else() - if(SYSTEM_NAME STREQUAL "FreeBSD") - target_include_directories(bx PUBLIC ${BX_SOURCE_SUBFOLDER}/include/compat/freebsd) - install(DIRECTORY ${BX_SOURCE_SUBFOLDER}/include/compat/freebsd/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bx/compat) - endif() - endif() -endif() - -if(WIN32) - target_link_libraries(bx PUBLIC psapi) -endif() - -target_compile_definitions(bx PUBLIC "__STDC_LIMIT_MACROS" "__STDC_FORMAT_MACROS" "__STDC_CONSTANT_MACROS" PRIVATE "$<$:BX_CONFIG_DEBUG=1>") - -if(UNIX AND NOT APPLE AND NOT ANDROID) - find_package(Threads) - target_link_libraries(bx ${CMAKE_THREAD_LIBS_INIT} dl) - - target_link_libraries(bx rt) -elseif(APPLE) - find_library(FOUNDATION_LIBRARY Foundation) - mark_as_advanced(FOUNDATION_LIBRARY) - target_link_libraries(bx PUBLIC ${FOUNDATION_LIBRARY}) -endif() diff --git a/recipes/bx/all/conandata.yml b/recipes/bx/all/conandata.yml index 4f350d3b1a2c6a..f4ae1ed020baa8 100644 --- a/recipes/bx/all/conandata.yml +++ b/recipes/bx/all/conandata.yml @@ -1,7 +1,4 @@ sources: - "20200504": - url: "https://github.com/bkaradzic/bx/archive/b6ab66b099044220b8a047e58c41c288a939388c.zip" - sha256: "2074387565d9ace107e7a1dc734ee2e72a9763170574f22b0e70d70072449663" - "20200716": - url: "https://github.com/bkaradzic/bx/archive/c5b9b64c2d7c270494f6ad89cbb4090f8e3e7b64.zip" - sha256: "8c006f0df6ed0ac19fad8e9110451a71d729554aad13d7dcd8239aa0abbc1537" + "cci.20221116": + url: "https://github.com/bkaradzic/bx/archive/aed1086c48884b1b4f1c2f9af34c5198624263f6.tar.gz" + sha256: "6867CF7ABD2BB53A1A92C7B70CBC7F424B97D3AE3A8183F284C6A6507EFE4517" diff --git a/recipes/bx/all/conanfile.py b/recipes/bx/all/conanfile.py index 26064fb83f34bd..c1e1bfa91952f4 100644 --- a/recipes/bx/all/conanfile.py +++ b/recipes/bx/all/conanfile.py @@ -1,81 +1,247 @@ +from conan import ConanFile +from conan.tools.files import copy, get, rename +from conan.tools.build import check_min_cppstd +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, check_min_vs, is_msvc_static_runtime +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import MSBuild, VCVars +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.env import VirtualBuildEnv +from pathlib import Path import os -import glob -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -class BxConan(ConanFile): +required_conan_version = ">=1.50.0" + + +class bxConan(ConanFile): name = "bx" - description = "Base library used across multiple projects." license = "BSD-2-Clause" - topics = ("conan", "bx") homepage = "https://github.com/bkaradzic/bx" url = "https://github.com/conan-io/conan-center-index" - exports_sources = ["CMakeLists.txt"] - generators = "cmake" - settings = "os", "arch", "compiler", "build_type" - options = { - "fPIC": [True, False], - } - default_options = { - "fPIC": True, - } + description = "Base library providing utility functions and macros." + topics = ("general", "utility") + settings = "os", "compiler", "arch", "build_type" + options = {"fPIC": [True, False], "tools": [True, False]} + default_options = {"fPIC": True, "tools": False} + + @property + def _bx_folder(self): + return "bx" @property - def _source_subfolder(self): - return "source_subfolder" + def _bx_path(self): + return os.path.join(self.source_folder, self._bx_folder) @property - def _build_subfolder(self): - return "build_subfolder" + def _genie_extra(self): + genie_extra = "" + if is_msvc(self) and not is_msvc_static_runtime(self): + genie_extra += " --with-dynamic-runtime" + return genie_extra + + @property + def _projs(self): + projs = ["bx"] + if self.options.tools: + projs.extend(["bin2c", "lemon"]) + return projs + + @property + def _compiler_required(self): + return { + "gcc": "8", + "clang": "3.3", + "apple-clang": "5", + } + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) def config_options(self): - if self.settings.os == 'Windows': + if self.settings.os == "Windows": del self.options.fPIC - def configure(self): - minimal_cpp_standard = "14" - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, minimal_cpp_standard) - minimal_version = { - "gcc": "5", - "clang": "3.4", - "apple-clang": "10", - "Visual Studio": "15" - } - compiler = str(self.settings.compiler) - if compiler not in minimal_version: - self.output.warn( - "%s recipe lacks information about the %s compiler standard version support" % (self.name, compiler)) - self.output.warn( - "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) - return - version = tools.Version(self.settings.compiler.version) - if version < minimal_version[compiler]: - raise ConanInvalidConfiguration("%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) + def layout(self): + basic_layout(self, src_folder="src") + + def validate(self): + if not self.options.get_safe("fPIC", True): + raise ConanInvalidConfiguration("This package does not support builds without fPIC.") + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 14) + check_min_vs(self, 191) + if not is_msvc(self): + try: + minimum_required_compiler_version = self._compiler_required[str(self.settings.compiler)] + if Version(self.settings.compiler.version) < minimum_required_compiler_version: + raise ConanInvalidConfiguration("This package requires C++14 support. The current compiler does not support it.") + except KeyError: + self.output.warn("This recipe has no checking for the current compiler. Please consider adding it.") + + def build_requirements(self): + self.tool_requires("genie/1170") + if not is_msvc(self) and self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob('bx-*/')[0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True, + destination=os.path.join(self.source_folder, self._bx_folder)) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure(build_folder=self._build_subfolder) - return cmake + def generate(self): + vbe = VirtualBuildEnv(self) + vbe.generate() + if is_msvc(self): + tc = VCVars(self) + tc.generate() + else: + tc = AutotoolsToolchain(self) + tc.generate() def build(self): - cmake = self._configure_cmake() - cmake.build() + if is_msvc(self): + # Conan to Genie translation maps + vs_ver_to_genie = {"17": "2022", "16": "2019", "15": "2017", + "193": "2022", "192": "2019", "191": "2017"} + + # Use genie directly, then msbuild on specific projects based on requirements + genie_VS = f"vs{vs_ver_to_genie[str(self.settings.compiler.version)]}" + genie_gen = f"{self._genie_extra} {genie_VS}" + self.run(f"genie {genie_gen}", cwd=self._bx_path) + + msbuild = MSBuild(self) + # customize to Release when RelWithDebInfo + msbuild.build_type = "Debug" if self.settings.build_type == "Debug" else "Release" + # use Win32 instead of the default value when building x86 + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + msbuild.build(os.path.join(self._bx_path, ".build", "projects", genie_VS, "bx.sln"), targets=self._projs) + else: + # Not sure if XCode can be spefically handled by conan for building through, so assume everything not VS is make + # gcc-multilib and g++-multilib required for 32bit cross-compilation, should see if we can check and install through conan + + # Conan to Genie translation maps + compiler_str = str(self.settings.compiler) + compiler_and_os_to_genie = {"Windows": f"--gcc=mingw-{compiler_str}", "Linux": f"--gcc=linux-{compiler_str}", + "FreeBSD": "--gcc=freebsd", "Macos": "--gcc=osx", + "Android": "--gcc=android", "iOS": "--gcc=ios"} + gmake_os_to_proj = {"Windows": "mingw", "Linux": "linux", "FreeBSD": "freebsd", "Macos": "osx", "Android": "android", "iOS": "ios"} + gmake_arch_to_genie_suffix = {"x86": "-x86", "x86_64": "-x64", "armv8": "-arm64", "armv7": "-arm"} + os_to_use_arch_config_suffix = {"Windows": False, "Linux": False, "FreeBSD": False, "Macos": True, "Android": True, "iOS": True} + + build_type_to_make_config = {"Debug": "config=debug", "Release": "config=release"} + arch_to_make_config_suffix = {"x86": "32", "x86_64": "64"} + os_to_use_make_config_suffix = {"Windows": True, "Linux": True, "FreeBSD": True, "Macos": False, "Android": False, "iOS": False} + + # Generate projects through genie + genieGen = f"{self._genie_extra} {compiler_and_os_to_genie[str(self.settings.os)]}" + if os_to_use_arch_config_suffix[str(self.settings.os)]: + genieGen += f"{gmake_arch_to_genie_suffix[str(self.settings.arch)]}" + genieGen += " gmake" + self.run(f"genie {genieGen}", cwd=self._bx_path) + + # Build project folder and path from given settings + projFolder = f"gmake-{gmake_os_to_proj[str(self.settings.os)]}" + if self.settings.os == "Windows" or compiler_str not in ["gcc", "apple-clang"]: + projFolder += f"-{compiler_str}" #mingw-gcc or mingw-clang for windows; -clang for linux (where gcc on linux has no extra) + if os_to_use_arch_config_suffix[str(self.settings.os)]: + projFolder += gmake_arch_to_genie_suffix[str(self.settings.arch)] + proj_path = os.path.sep.join([self._bx_path, ".build", "projects", projFolder]) + + # Build make args from settings + conf = build_type_to_make_config[str(self.settings.build_type)] + if os_to_use_make_config_suffix[str(self.settings.os)]: + conf += arch_to_make_config_suffix[str(self.settings.arch)] + if self.settings.os == "Windows": + mingw = "MINGW=$MINGW_PREFIX" + proj_path = proj_path.replace("\\", "/") # Fix path for msys... + else: + mingw = "" + autotools = Autotools(self) + # Build with make + for proj in self._projs: + autotools.make(target=proj, args=["-R", f"-C {proj_path}", mingw, conf]) def package(self): - cmake = self._configure_cmake() - cmake.install() - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) + # Set platform suffixes and prefixes + if self.settings.os == "Windows": + lib_ext = "*.lib" + package_lib_prefix = "" + elif self.settings.os in ["Linux", "FreeBSD"]: + lib_ext = "*.a" + package_lib_prefix = "lib" + elif self.settings.os == "Macos": + lib_ext = "*.a" + package_lib_prefix = "lib" + + # Get build bin folder + for bx_out_dir in os.listdir(os.path.join(self._bx_path, ".build")): + if not bx_out_dir=="projects": + build_bin = os.path.join(self._bx_path, ".build", bx_out_dir, "bin") + break + + # Copy license + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self._bx_path) + # Copy includes + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self._bx_path, "include")) + copy(self, pattern="*.inl", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self._bx_path, "include")) + # Copy libs + copy(self, pattern=lib_ext, dst=os.path.join(self.package_folder, "lib"), src=build_bin, keep_path=False) + # Copy tools + if self.options.tools: + copy(self, pattern="bin2c*", dst=os.path.join(self.package_folder, "bin"), src=build_bin, keep_path=False) + copy(self, pattern="lemon*", dst=os.path.join(self.package_folder, "bin"), src=build_bin, keep_path=False) + + # Rename for consistency across platforms and configs + for bx_file in Path(os.path.join(self.package_folder, "lib")).glob("*bx*"): + rename(self, os.path.join(self.package_folder, "lib", bx_file.name), + os.path.join(self.package_folder, "lib", f"{package_lib_prefix}bx{bx_file.suffix}")) + if self.options.tools: + for bx_file in Path(os.path.join(self.package_folder, "bin")).glob("*bin2c*"): + rename(self, os.path.join(self.package_folder, "bin", bx_file.name), + os.path.join(self.package_folder, "bin", f"bin2c{bx_file.suffix}")) + for bx_file in Path(os.path.join(self.package_folder, "bin")).glob("*lemon*"): + rename(self, os.path.join(self.package_folder, "bin", bx_file.name), + os.path.join(self.package_folder, "bin", f"lemon{bx_file.suffix}")) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) - self.cpp_info.includedirs.append(os.path.join("include", "bx", "compat")) - if self.settings.os == "Linux": - self.cpp_info.system_libs = ["dl", "pthread", "rt"] - if self.settings.os == "Macos": - self.cpp_info.frameworks = ["Foundation"] + self.cpp_info.includedirs = ["include"] + self.cpp_info.libs = ["bx"] + + self.cpp_info.set_property("cmake_file_name", "bx") + self.cpp_info.set_property("cmake_target_name", "bx::bx") + self.cpp_info.set_property("pkg_config_name", "bx") + + if self.settings.build_type == "Debug": + self.cpp_info.defines.extend(["BX_CONFIG_DEBUG=1"]) + else: + self.cpp_info.defines.extend(["BX_CONFIG_DEBUG=0"]) + + if self.settings.os == "Windows": + if self.settings.arch == "x86": + self.cpp_info.system_libs.extend(["psapi"]) + if is_msvc(self): + self.cpp_info.includedirs.extend(["include/compat/msvc"]) + self.cpp_info.cxxflags.extend(["/Zc:__cplusplus"]) + else: + self.cpp_info.includedirs.extend(["include/compat/mingw"]) + elif self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["dl", "pthread"]) + if self.settings.os == "Linux": + self.cpp_info.includedirs.extend(["include/compat/linux"]) + else: + self.cpp_info.includedirs.extend(["include/compat/freebsd"]) + elif self.settings.os in ["Macos", "iOS"]: + self.cpp_info.frameworks.extend(["Foundation", "Cocoa"]) + if self.settings.os == "Macos": + self.cpp_info.includedirs.extend(["include/compat/osx"]) + else: + self.cpp_info.includedirs.extend(["include/compat/ios"]) + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "bx" + self.cpp_info.filenames["cmake_find_package_multi"] = "bx" + self.cpp_info.names["cmake_find_package"] = "bx" + self.cpp_info.names["cmake_find_package_multi"] = "bx" diff --git a/recipes/bx/all/test_package/CMakeLists.txt b/recipes/bx/all/test_package/CMakeLists.txt index 57c0d429701ced..71a1766827d58c 100644 --- a/recipes/bx/all/test_package/CMakeLists.txt +++ b/recipes/bx/all/test_package/CMakeLists.txt @@ -1,9 +1,9 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +project(test_package LANGUAGES CXX) -add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) -target_link_libraries(${CMAKE_PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 14) +find_package(bx REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF) +target_link_libraries(${PROJECT_NAME} bx::bx) diff --git a/recipes/bx/all/test_package/conanfile.py b/recipes/bx/all/test_package/conanfile.py index 4903f1a7e8fa0f..7914baa4343981 100644 --- a/recipes/bx/all/test_package/conanfile.py +++ b/recipes/bx/all/test_package/conanfile.py @@ -1,9 +1,21 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.layout import cmake_layout +from conan.tools.cmake import CMake import os +required_conan_version = ">=1.50.0" + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,6 +23,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/bx/all/test_package/test_package.cpp b/recipes/bx/all/test_package/test_package.cpp index 712588f0588978..e62d29351461ac 100644 --- a/recipes/bx/all/test_package/test_package.cpp +++ b/recipes/bx/all/test_package/test_package.cpp @@ -1,7 +1,8 @@ -#include +#include -int main() -{ - char tmp[1024]; - prettify(tmp, BX_COUNTOF(tmp), 4000, bx::Units::Kilo); +int main() { + float tLerp = bx::lerp(0.0f, 10.0f, 0.5f); + BX_TRACE("Lerped 0.0f to 10.0f at 0.5f, result %f", tLerp); + BX_ASSERT(bx::isEqual(tLerp, 5.0f, 0.1f), "isEqual failed"); + return 0; } diff --git a/recipes/bx/all/test_v1_package/CMakeLists.txt b/recipes/bx/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..3a070c42e74472 --- /dev/null +++ b/recipes/bx/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(bx REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF) +target_link_libraries(${PROJECT_NAME} bx::bx) diff --git a/recipes/bx/all/test_v1_package/conanfile.py b/recipes/bx/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..d2959af78862a7 --- /dev/null +++ b/recipes/bx/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class BxTestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/bx/all/test_v1_package/test_package.cpp b/recipes/bx/all/test_v1_package/test_package.cpp new file mode 100644 index 00000000000000..e62d29351461ac --- /dev/null +++ b/recipes/bx/all/test_v1_package/test_package.cpp @@ -0,0 +1,8 @@ +#include + +int main() { + float tLerp = bx::lerp(0.0f, 10.0f, 0.5f); + BX_TRACE("Lerped 0.0f to 10.0f at 0.5f, result %f", tLerp); + BX_ASSERT(bx::isEqual(tLerp, 5.0f, 0.1f), "isEqual failed"); + return 0; +} diff --git a/recipes/bx/config.yml b/recipes/bx/config.yml index c46173d220255d..1156867d3e651c 100644 --- a/recipes/bx/config.yml +++ b/recipes/bx/config.yml @@ -1,5 +1,3 @@ versions: - "20200504": - folder: all - "20200716": + "cci.20221116": folder: all diff --git a/recipes/bzip3/all/conandata.yml b/recipes/bzip3/all/conandata.yml index 793290248520a6..eb1cfea3a1d614 100644 --- a/recipes/bzip3/all/conandata.yml +++ b/recipes/bzip3/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.2.2": + url: "https://github.com/kspalaiologos/bzip3/archive/1.2.2.tar.gz" + sha256: "e7792f3c83f1d9efd0d7b18da2eb6a1f119ffcdeb5515cf441145c2e9b72652e" "1.2.1": url: "https://github.com/kspalaiologos/bzip3/archive/1.2.1.tar.gz" sha256: "f2fc4c9c7679d3b120e8f44d8c4ecd00f03af9981f53e13dc0f956b5996913c9" diff --git a/recipes/bzip3/all/conanfile.py b/recipes/bzip3/all/conanfile.py index 118e5fbf34f0cb..651e96036ca1cd 100644 --- a/recipes/bzip3/all/conanfile.py +++ b/recipes/bzip3/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import export_conandata_patches, apply_conandata_patches, copy, get import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class BZip3Conan(ConanFile): @@ -42,18 +42,9 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def layout(self): cmake_layout(self, src_folder="src") diff --git a/recipes/bzip3/all/test_v1_package/CMakeLists.txt b/recipes/bzip3/all/test_v1_package/CMakeLists.txt index 8c1771e7b10810..925ecbe19e448d 100644 --- a/recipes/bzip3/all/test_v1_package/CMakeLists.txt +++ b/recipes/bzip3/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(bzip3 REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE bzip3::bzip3) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/bzip3/config.yml b/recipes/bzip3/config.yml index a95d0b82239d84..e28ea261ce3048 100644 --- a/recipes/bzip3/config.yml +++ b/recipes/bzip3/config.yml @@ -1,4 +1,6 @@ versions: + "1.2.2": + folder: all "1.2.1": folder: all "1.2.0": diff --git a/recipes/c-blosc/all/conandata.yml b/recipes/c-blosc/all/conandata.yml index dfd824d8023f04..c8c0ea232bc215 100644 --- a/recipes/c-blosc/all/conandata.yml +++ b/recipes/c-blosc/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.21.3": + url: "https://github.com/Blosc/c-blosc/archive/v1.21.3.tar.gz" + sha256: "941016c4564bca662080bb01aea74f06630bd665e598c6f6967fd91b2e2e0bb6" "1.21.1": url: "https://github.com/Blosc/c-blosc/archive/v1.21.1.tar.gz" sha256: "f387149eab24efa01c308e4cba0f59f64ccae57292ec9c794002232f7903b55b" @@ -21,17 +24,35 @@ sources: url: "https://github.com/Blosc/c-blosc/archive/v1.17.1.tar.gz" sha256: "19a6948b579c27e8ac440b4f077f99fc90e7292b1d9cb896bec0fd781d68fba2" patches: + "1.21.3": + - patch_file: "patches/cmake-dependencies-1.21.2+.patch" + patch_description: "use cci package" + patch_type: "conan" "1.21.1": - patch_file: "patches/cmake-dependencies-1.21.1+.patch" + patch_description: "use cci package" + patch_type: "conan" "1.21.0": - patch_file: "patches/cmake-dependencies-1.20.0+.patch" + patch_description: "use cci package" + patch_type: "conan" "1.20.1": - patch_file: "patches/cmake-dependencies-1.20.0+.patch" + patch_description: "use cci package" + patch_type: "conan" "1.20.0": - patch_file: "patches/cmake-dependencies-1.20.0+.patch" + patch_description: "use cci package" + patch_type: "conan" "1.19.0": - patch_file: "patches/cmake-dependencies-1.19.0.patch" + patch_description: "use cci package" + patch_type: "conan" "1.18.1": - patch_file: "patches/cmake-dependencies-1.18.1-.patch" + patch_description: "use cci package" + patch_type: "conan" "1.17.1": - patch_file: "patches/cmake-dependencies-1.18.1-.patch" + patch_description: "use cci package" + patch_type: "conan" diff --git a/recipes/c-blosc/all/conanfile.py b/recipes/c-blosc/all/conanfile.py index 1a0282104d95b0..a349a37babbd2b 100644 --- a/recipes/c-blosc/all/conanfile.py +++ b/recipes/c-blosc/all/conanfile.py @@ -5,7 +5,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class CbloscConan(ConanFile): @@ -47,18 +47,9 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass - try: - del self.settings.compiler.libcxx - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def layout(self): cmake_layout(self, src_folder="src") @@ -130,4 +121,4 @@ def package_info(self): prefix = "lib" if is_msvc(self) and not self.options.shared else "" self.cpp_info.libs = [f"{prefix}blosc"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.append("pthread") + self.cpp_info.system_libs.extend(["m", "pthread"]) diff --git a/recipes/c-blosc/all/patches/cmake-dependencies-1.21.2+.patch b/recipes/c-blosc/all/patches/cmake-dependencies-1.21.2+.patch new file mode 100644 index 00000000000000..09a5a7401237e5 --- /dev/null +++ b/recipes/c-blosc/all/patches/cmake-dependencies-1.21.2+.patch @@ -0,0 +1,71 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 54d4817..2ba937d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -134,7 +134,8 @@ include(GNUInstallDirs) + + if(NOT DEACTIVATE_LZ4) + if(PREFER_EXTERNAL_LZ4) +- find_package(LZ4) ++ find_package(lz4 REQUIRED CONFIG) ++ set(LZ4_FOUND TRUE) + else() + message(STATUS "Using LZ4 internal sources.") + endif() +@@ -156,7 +157,6 @@ endif() + if(NOT DEACTIVATE_ZLIB) + # import the ZLIB_ROOT environment variable to help finding the zlib library + if(PREFER_EXTERNAL_ZLIB) +- set(ZLIB_ROOT $ENV{ZLIB_ROOT}) + find_package(ZLIB) + if(NOT ZLIB_FOUND ) + message(STATUS "No zlib found. Using internal sources.") +@@ -171,7 +171,7 @@ endif() + + if(NOT DEACTIVATE_ZSTD) + if(PREFER_EXTERNAL_ZSTD) +- find_package(Zstd) ++ find_package(zstd REQUIRED CONFIG) + else() + message(STATUS "Using ZSTD internal sources.") + endif() +diff --git a/blosc/CMakeLists.txt b/blosc/CMakeLists.txt +index fd6d695..8ef909d 100644 +--- a/blosc/CMakeLists.txt ++++ b/blosc/CMakeLists.txt +@@ -88,7 +88,7 @@ endif(WIN32) + + if(NOT DEACTIVATE_LZ4) + if(LZ4_FOUND) +- set(LIBS ${LIBS} ${LZ4_LIBRARY}) ++ set(LIBS ${LIBS} $,LZ4::lz4_shared,LZ4::lz4_static>) + else(LZ4_FOUND) + file(GLOB LZ4_FILES ${LZ4_LOCAL_DIR}/*.c) + set(SOURCES ${SOURCES} ${LZ4_FILES}) +@@ -98,7 +98,7 @@ endif(NOT DEACTIVATE_LZ4) + + if(NOT DEACTIVATE_SNAPPY) + if(SNAPPY_FOUND) +- set(LIBS ${LIBS} ${SNAPPY_LIBRARY}) ++ set(LIBS ${LIBS} "Snappy::snappy") + else(SNAPPY_FOUND) + file(GLOB SNAPPY_FILES ${SNAPPY_LOCAL_DIR}/*.cc) + set(SOURCES ${SOURCES} ${SNAPPY_FILES}) +@@ -108,7 +108,7 @@ endif(NOT DEACTIVATE_SNAPPY) + + if(NOT DEACTIVATE_ZLIB) + if(ZLIB_FOUND) +- set(LIBS ${LIBS} ${ZLIB_LIBRARY}) ++ set(LIBS ${LIBS} "ZLIB::ZLIB") + else(ZLIB_FOUND) + file(GLOB ZLIB_FILES ${ZLIB_LOCAL_DIR}/*.c) + set(SOURCES ${SOURCES} ${ZLIB_FILES}) +@@ -118,7 +118,7 @@ endif(NOT DEACTIVATE_ZLIB) + + if (NOT DEACTIVATE_ZSTD) + if (ZSTD_FOUND) +- set(LIBS ${LIBS} ${ZSTD_LIBRARY}) ++ set(LIBS ${LIBS} $,zstd::libzstd_shared,zstd::libzstd_static>) + else (ZSTD_FOUND) + # Enable assembly code only when not using MSVC *and* x86 is there + if((NOT MSVC) AND COMPILER_SUPPORT_SSE2) # if SSE2 is here, this is an x86 platform diff --git a/recipes/c-blosc/all/test_v1_package/CMakeLists.txt b/recipes/c-blosc/all/test_v1_package/CMakeLists.txt index 178f209fe3a3a4..de3b75d9538de0 100644 --- a/recipes/c-blosc/all/test_v1_package/CMakeLists.txt +++ b/recipes/c-blosc/all/test_v1_package/CMakeLists.txt @@ -4,7 +4,5 @@ project(test_package LANGUAGES C) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(c-blosc REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE c-blosc::c-blosc) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/c-blosc/config.yml b/recipes/c-blosc/config.yml index 600b8bb73358e5..5798e3590a6d3d 100644 --- a/recipes/c-blosc/config.yml +++ b/recipes/c-blosc/config.yml @@ -1,4 +1,6 @@ versions: + "1.21.3": + folder: all "1.21.1": folder: all "1.21.0": diff --git a/recipes/c-blosc2/all/conandata.yml b/recipes/c-blosc2/all/conandata.yml index d80738613d1bde..2dea9f28ab0285 100644 --- a/recipes/c-blosc2/all/conandata.yml +++ b/recipes/c-blosc2/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.6.1": + url: "https://github.com/Blosc/c-blosc2/archive/v2.6.1.tar.gz" + sha256: "514a793368093893c1a7cae030f7e31faca7f86465ae69dd576f256d8bf28c08" + "2.6.0": + url: "https://github.com/Blosc/c-blosc2/archive/v2.6.0.tar.gz" + sha256: "ca4fc79a7c4a4d4f53da856ee0bb7083c16236210fdd6263397124572c25a507" "2.4.3": url: "https://github.com/Blosc/c-blosc2/archive/v2.4.3.tar.gz" sha256: "d4aa5e0794598794f20ab950e973d44f0d0d9c133ea1a5a07cb200fa54d2e036" @@ -13,11 +19,27 @@ sources: sha256: "66f9977de26d6bc9ea1c0e623d873c3225e4fff709aa09b3335fd09d41d57c0e" patches: + "2.6.1": + - patch_file: "patches/2.6.0-0001-fix-cmake.patch" + patch_description: "use cci package" + patch_type: "conan" + "2.6.0": + - patch_file: "patches/2.6.0-0001-fix-cmake.patch" + patch_description: "use cci package" + patch_type: "conan" "2.4.3": - patch_file: "patches/2.4.1-0001-fix-cmake.patch" + patch_description: "use cci package" + patch_type: "conan" "2.4.2": - patch_file: "patches/2.4.1-0001-fix-cmake.patch" + patch_description: "use cci package" + patch_type: "conan" "2.4.1": - patch_file: "patches/2.4.1-0001-fix-cmake.patch" + patch_description: "use cci package" + patch_type: "conan" "2.2.0": - patch_file: "patches/2.2.0-0001-fix-cmake.patch" + patch_description: "use cci package" + patch_type: "conan" diff --git a/recipes/c-blosc2/all/conanfile.py b/recipes/c-blosc2/all/conanfile.py index e8b9099a17a496..5be02801821408 100644 --- a/recipes/c-blosc2/all/conanfile.py +++ b/recipes/c-blosc2/all/conanfile.py @@ -2,6 +2,7 @@ from conan.tools.microsoft import is_msvc from conan.tools.files import export_conandata_patches, apply_conandata_patches, get, copy, rm, rmdir from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.scm import Version import os import glob @@ -78,6 +79,21 @@ def requirements(self): if self.options.with_zstd: self.requires("zstd/1.5.2") + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output=output) + m = re.search(r'cmake version (\d+\.\d+\.\d+)', output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False + + def build_requirements(self): + if Version(self.version) >= "2.4.1" and not self._cmake_new_enough("3.16.3"): + self.tool_requires("cmake/3.25.0") + def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) 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 index c7220f5674f37a..565d775f0be528 100644 --- 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 @@ -1,18 +1,8 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 866c7f6..d68513a 100644 +index 866c7f6..c2e2501 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) +@@ -144,26 +144,26 @@ if(BUILD_LITE) endif() if(PREFER_EXTERNAL_LZ4) @@ -44,7 +34,7 @@ index 866c7f6..d68513a 100644 message(STATUS "Using ZLIB-NG internal sources for ZLIB support.") set(HAVE_ZLIB_NG TRUE) add_definitions(-DZLIB_COMPAT) -@@ -184,8 +185,8 @@ endif() +@@ -184,8 +184,8 @@ endif() if(NOT DEACTIVATE_ZSTD) if(PREFER_EXTERNAL_ZSTD) diff --git a/recipes/c-blosc2/all/patches/2.6.0-0001-fix-cmake.patch b/recipes/c-blosc2/all/patches/2.6.0-0001-fix-cmake.patch new file mode 100644 index 00000000000000..5c30c1a180c480 --- /dev/null +++ b/recipes/c-blosc2/all/patches/2.6.0-0001-fix-cmake.patch @@ -0,0 +1,122 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 43910d1..199ef1d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -144,26 +144,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) +- set(HAVE_ZLIB_NG TRUE) ++ 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,9 +184,9 @@ endif() + + if(NOT DEACTIVATE_ZSTD) + if(PREFER_EXTERNAL_ZSTD) +- find_package(ZSTD) +- if(NOT ZSTD_FOUND) +- message(STATUS "No ZSTD library found. Using internal sources.") ++ find_package(zstd) ++ if(NOT zstd_FOUND) ++ message(STATUS "No ZSTD library found. Using internal sources.") + endif() + else() + message(STATUS "Using ZSTD internal sources.") +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 50ba489df290c7..4e3319b05a4f06 100644 --- a/recipes/c-blosc2/all/test_package/CMakeLists.txt +++ b/recipes/c-blosc2/all/test_package/CMakeLists.txt @@ -1,6 +1,6 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) find_package(c-blosc2 REQUIRED CONFIG) diff --git a/recipes/c-blosc2/all/test_v1_package/CMakeLists.txt b/recipes/c-blosc2/all/test_v1_package/CMakeLists.txt index 955deb8b6c928b..2a9b48732268c7 100644 --- a/recipes/c-blosc2/all/test_v1_package/CMakeLists.txt +++ b/recipes/c-blosc2/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,9 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(c-blosc2 REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE c-blosc2::c-blosc2) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/c-blosc2/config.yml b/recipes/c-blosc2/config.yml index 2efeb63b2eea8f..8f6cd9ee625a2e 100644 --- a/recipes/c-blosc2/config.yml +++ b/recipes/c-blosc2/config.yml @@ -1,4 +1,8 @@ versions: + "2.6.1": + folder: all + "2.6.0": + folder: all "2.4.3": folder: all "2.4.2": diff --git a/recipes/c-dbg-macro/all/conanfile.py b/recipes/c-dbg-macro/all/conanfile.py index 8c02b5c63b5a6c..d30bb72e433f78 100644 --- a/recipes/c-dbg-macro/all/conanfile.py +++ b/recipes/c-dbg-macro/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.46.0" class DbgMacroConan(ConanFile): name = "c-dbg-macro" @@ -10,24 +13,27 @@ class DbgMacroConan(ConanFile): homepage = "https://github.com/eerimoq/dbg-macro" license = "MIT" description = "A dbg(...) macro for C" - topics = ("conan", "debugging", "macro", "pretty-printing", "header-only") + topics = ("debugging", "macro", "pretty-printing", "header-only") settings = ("compiler", "build_type", "os", "arch") no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" - def validate(self): if self.settings.os == "Windows": raise ConanInvalidConfiguration("This library is not compatible with Windows") + def layout(self): + basic_layout(self, src_folder="src") + def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def package(self): - self.copy("include/dbg.h", dst=".", src=self._source_subfolder) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "dbg.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include")) + copy(self, "LICENSE", src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses")) + def package_id(self): - self.info.header_only() + self.info.clear() diff --git a/recipes/c-dbg-macro/all/test_package/CMakeLists.txt b/recipes/c-dbg-macro/all/test_package/CMakeLists.txt index 85e615074f940b..c764c0709047b2 100644 --- a/recipes/c-dbg-macro/all/test_package/CMakeLists.txt +++ b/recipes/c-dbg-macro/all/test_package/CMakeLists.txt @@ -1,7 +1,7 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(c-dbg-macro REQUIRED) -add_executable(test_package test_package.c) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE c-dbg-macro::c-dbg-macro) diff --git a/recipes/c-dbg-macro/all/test_package/conanfile.py b/recipes/c-dbg-macro/all/test_package/conanfile.py index c795b378cca50b..48499fa0989d9c 100644 --- a/recipes/c-dbg-macro/all/test_package/conanfile.py +++ b/recipes/c-dbg-macro/all/test_package/conanfile.py @@ -1,17 +1,27 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools +# It will become the standard on Conan 2.x class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" - + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libzippp/all/CMakeLists.txt b/recipes/c-dbg-macro/all/test_v1_package/CMakeLists.txt similarity index 55% rename from recipes/libzippp/all/CMakeLists.txt rename to recipes/c-dbg-macro/all/test_v1_package/CMakeLists.txt index bcd4ccf17fd786..4c9e7ffdd2a286 100644 --- a/recipes/libzippp/all/CMakeLists.txt +++ b/recipes/c-dbg-macro/all/test_v1_package/CMakeLists.txt @@ -1,9 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -set(CMAKE_CXX_STANDARD 11) +project(test_package C) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() -add_subdirectory("source_subfolder") +add_executable(test_package ../test_package/test_package.c) diff --git a/recipes/c-dbg-macro/all/test_v1_package/conanfile.py b/recipes/c-dbg-macro/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..c795b378cca50b --- /dev/null +++ b/recipes/c-dbg-macro/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, CMake, tools + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/c4core/all/conandata.yml b/recipes/c4core/all/conandata.yml index 622bb4f50ac3af..3cf4bc0bf49101 100644 --- a/recipes/c4core/all/conandata.yml +++ b/recipes/c4core/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.1.11": + url: "https://github.com/biojppm/c4core/releases/download/v0.1.11/c4core-0.1.11-src.tgz" + sha256: "67f4443f3742424f42453594e26e656f616dddfcf225a1d810e00473a741408c" "0.1.10": url: "https://github.com/biojppm/c4core/releases/download/v0.1.10/c4core-0.1.10-src.tgz" sha256: "e8ab4dedd0e20f86af7c69527cfbe8bc1cf72c84b7fbc0cfd420656f28ae20b2" @@ -10,6 +13,10 @@ sources: sha256: "95c0663192c6bff7a098b50afcb05d22a34dd0fd8e6be2e1b61edad2b9675fde" patches: + "0.1.11": + - patch_file: "patches/0.1.11-0001-make-fast_float-external.patch" + patch_description: "use cci's fast_float recipe" + patch_type: "conan" "0.1.10": - patch_file: "patches/0.1.10-0001-make-fast_float-external.patch" patch_description: "use cci's fast_float recipe" diff --git a/recipes/c4core/all/patches/0.1.11-0001-make-fast_float-external.patch b/recipes/c4core/all/patches/0.1.11-0001-make-fast_float-external.patch new file mode 100644 index 00000000000000..7532d129ab0805 --- /dev/null +++ b/recipes/c4core/all/patches/0.1.11-0001-make-fast_float-external.patch @@ -0,0 +1,37 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index 1207d1b..20ffe96 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -73,7 +73,6 @@ set(C4CORE_SRC_FILES + if(C4CORE_WITH_FASTFLOAT) + list(APPEND C4CORE_SRC_FILES + c4/ext/fast_float.hpp +- c4/ext/fast_float_all.h + ) + endif() + set(C4CORE_AMALGAMATED ${C4CORE_SRC_DIR}/../src_singleheader/c4/c4core_all.hpp) +@@ -92,7 +91,10 @@ c4_add_library(c4core + SOURCE_ROOT ${C4CORE_SRC_DIR} + SOURCES ${C4CORE_SRC_FILES} + ) +-if(NOT C4CORE_WITH_FASTFLOAT) ++if(C4CORE_WITH_FASTFLOAT) ++ find_package(FastFloat REQUIRED CONFIG) ++ target_link_libraries(c4core PUBLIC "FastFloat::fast_float") ++else() + target_compile_definitions(c4core PUBLIC -DC4CORE_NO_FAST_FLOAT) + endif() + if(C4CORE_NO_DEBUG_BREAK) +diff --git a/a/src/c4/ext/fast_float.hpp b/b/src/c4/ext/fast_float.hpp +index 9e75b5e..64aa2a4 100644 +--- a/a/src/c4/ext/fast_float.hpp ++++ b/b/src/c4/ext/fast_float.hpp +@@ -15,7 +15,7 @@ + # pragma GCC diagnostic ignored "-Wuseless-cast" + #endif + +-#include "c4/ext/fast_float_all.h" ++#include "fast_float/fast_float.h" + + #ifdef _MSC_VER + # pragma warning(pop) diff --git a/recipes/c4core/all/test_package/CMakeLists.txt b/recipes/c4core/all/test_package/CMakeLists.txt index 62cfc706469cd2..e0b34e28e562bc 100644 --- a/recipes/c4core/all/test_package/CMakeLists.txt +++ b/recipes/c4core/all/test_package/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package LANGUAGES CXX) find_package(c4core REQUIRED CONFIG) diff --git a/recipes/c4core/all/test_v1_package/CMakeLists.txt b/recipes/c4core/all/test_v1_package/CMakeLists.txt index bfd5ba0ad4164a..bc541ea90b5128 100644 --- a/recipes/c4core/all/test_v1_package/CMakeLists.txt +++ b/recipes/c4core/all/test_v1_package/CMakeLists.txt @@ -1,12 +1,9 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(c4core REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE c4core::c4core) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/c4core/config.yml b/recipes/c4core/config.yml index 364da530085a94..b3f909b6c96645 100644 --- a/recipes/c4core/config.yml +++ b/recipes/c4core/config.yml @@ -1,4 +1,6 @@ versions: + "0.1.11": + folder: all "0.1.10": folder: all "0.1.9": diff --git a/recipes/capnproto/all/CMakeLists.txt b/recipes/capnproto/all/CMakeLists.txt deleted file mode 100644 index 217b9530b904d4..00000000000000 --- a/recipes/capnproto/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/capnproto/all/conandata.yml b/recipes/capnproto/all/conandata.yml index 90455ae5133174..8a6eeaab5a8d19 100644 --- a/recipes/capnproto/all/conandata.yml +++ b/recipes/capnproto/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.10.3": + url: "https://github.com/capnproto/capnproto/archive/v0.10.3.tar.gz" + sha256: "e07446f56043c983e009038e69d18ff86a2924909f0b518ccf47eccf5ac03919" "0.10.1": url: "https://github.com/capnproto/capnproto/archive/v0.10.1.tar.gz" sha256: "2e9c918f02c198557c75ca7c635fe281337c9755b752a6ab3a841bcc1cf5176b" @@ -15,36 +18,24 @@ sources: url: "https://github.com/capnproto/capnproto/archive/v0.7.0.tar.gz" sha256: 76c7114a3d142ad08b7208b3964a26e72a6320ee81331d3f0b87569fc9c47a28 patches: + "0.10.3": + - patch_file: patches/0014-disable-tests-for-0.10.1.patch "0.10.1": - patch_file: patches/0014-disable-tests-for-0.10.1.patch - base_path: source_subfolder "0.10.0": - patch_file: patches/0013-disable-tests-for-0.10.0.patch - base_path: source_subfolder "0.9.1": - patch_file: patches/0010-disable-tests-for-0.9.1.patch - base_path: source_subfolder - patch_file: patches/0011-msvc-cpp17-hassubstring-fix-0.9.1.patch - base_path: source_subfolder - patch_file: patches/0012-msvc-nogdi-fix-0.9.1.patch - base_path: source_subfolder "0.8.0": - patch_file: patches/0001-disable-tests.patch - base_path: source_subfolder - patch_file: patches/0002-cmake-compat-header-install.patch - base_path: source_subfolder - patch_file: patches/0003-kj-tls-windows.patch - base_path: source_subfolder - patch_file: patches/0004-cmake-module-path.patch - base_path: source_subfolder - patch_file: patches/0005-msvc-16.7-ice-workaround.patch - base_path: source_subfolder - patch_file: patches/0009-windows-symlink-fix-0.8.0.patch - base_path: source_subfolder "0.7.0": - patch_file: patches/0006-symlink.patch - base_path: source_subfolder - patch_file: patches/0007-cmake-module-path.patch - base_path: source_subfolder - patch_file: patches/0008-disable-tests.patch - base_path: source_subfolder diff --git a/recipes/capnproto/all/conanfile.py b/recipes/capnproto/all/conanfile.py index 4d5fd86b03ef9f..31ac13800e74b2 100644 --- a/recipes/capnproto/all/conanfile.py +++ b/recipes/capnproto/all/conanfile.py @@ -1,19 +1,26 @@ -from conans import ConanFile, CMake, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import check_min_cppstd, cross_building +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import glob import os import textwrap -import functools -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.54.0" class CapnprotoConan(ConanFile): name = "capnproto" description = "Cap'n Proto serialization/RPC system." license = "MIT" - topics = ("capnproto", "serialization", "rpc") + topics = ("serialization", "rpc") homepage = "https://capnproto.org" url = "https://github.com/conan-io/conan-center-index" @@ -31,114 +38,117 @@ class CapnprotoConan(ConanFile): "with_zlib": True, } - generators = "cmake", "cmake_find_package" - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" + def _min_cppstd(self): + return "14" @property def _minimum_compilers_version(self): return { "Visual Studio": "15", + "msvc": "191", "gcc": "5", "clang": "5", "apple-clang": "5.1", } + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if tools.Version(self.version) < "0.8.0": + if Version(self.version) < "0.8.0": del self.options.with_zlib def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + if self.settings.os == "Windows": + cmake_layout(self, src_folder="src") + else: + basic_layout(self, src_folder="src") def requirements(self): if self.options.with_openssl: - self.requires("openssl/1.1.1o") + self.requires("openssl/1.1.1s") if self.options.get_safe("with_zlib"): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) + check_min_cppstd(self, self._min_cppstd) minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler), False) - if not minimum_version: - self.output.warn("Cap'n Proto requires C++14. Your compiler is unknown. Assuming it supports C++14.") - elif tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("Cap'n Proto requires C++14, which your compiler does not support.") + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) if is_msvc(self) and self.options.shared: - raise ConanInvalidConfiguration("Cap'n Proto doesn't support shared libraries for Visual Studio") - if self.settings.os == "Windows" and tools.Version(self.version) < "0.8.0" and self.options.with_openssl: - raise ConanInvalidConfiguration("Cap'n Proto doesn't support OpenSSL on Windows pre 0.8.0") + raise ConanInvalidConfiguration(f"{self.ref} doesn't support shared libraries for Visual Studio") + if self.settings.os == "Windows" and Version(self.version) < "0.8.0" and self.options.with_openssl: + raise ConanInvalidConfiguration(f"{self.ref} doesn't support OpenSSL on Windows pre 0.8.0") def build_requirements(self): if self.settings.os != "Windows": - self.build_requires("libtool/2.4.6") + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["BUILD_TESTING"] = False - cmake.definitions["EXTERNAL_CAPNP"] = False - cmake.definitions["CAPNP_LITE"] = False - cmake.definitions["WITH_OPENSSL"] = self.options.with_openssl - cmake.configure(build_folder=self._build_subfolder) - return cmake - - @functools.lru_cache(1) - def _configure_autotools(self): - args = [ - "--enable-shared" if self.options.shared else "--disable-shared", - "--disable-static" if self.options.shared else "--enable-static", - "--with-openssl" if self.options.with_openssl else "--without-openssl", - "--enable-reflection", - ] - if tools.Version(self.version) >= "0.8.0": - args.append("--with-zlib" if self.options.with_zlib else "--without-zlib") - autotools = AutoToolsBuildEnvironment(self) - # Fix rpath on macOS - if self.settings.os == "Macos": - autotools.link_flags.append("-Wl,-rpath,@loader_path/../lib") - autotools.configure(args=args) - return autotools + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + if self.settings.os == "Windows": + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.variables["EXTERNAL_CAPNP"] = False + tc.variables["CAPNP_LITE"] = False + tc.variables["WITH_OPENSSL"] = self.options.with_openssl + tc.generate() + deps = CMakeDeps(self) + deps.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + tc = AutotoolsToolchain(self) + yes_no = lambda v: "yes" if v else "no" + tc.configure_args.extend([ + f"--with-openssl={yes_no(self.options.with_openssl)}", + "--enable-reflection", + ]) + if Version(self.version) >= "0.8.0": + tc.configure_args.append(f"--with-zlib={yes_no(self.options.with_zlib)}") + # Fix rpath on macOS + if self.settings.os == "Macos": + tc.extra_ldflags.append("-Wl,-rpath,@loader_path/../lib") + tc.generate() + deps = AutotoolsDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) if self.settings.os == "Windows": - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() else: - with tools.chdir(os.path.join(self._source_subfolder, "c++")): - self.run("{} -fiv".format(tools.get_env("AUTORECONF"))) - # relocatable shared libs on macOS - tools.replace_in_file("configure", "-install_name \\$rpath/", "-install_name @rpath/") - # avoid SIP issues on macOS when dependencies are shared - if tools.is_apple_os(self.settings.os): - libpaths = ":".join(self.deps_cpp_info.lib_paths) - tools.replace_in_file( - "configure", - "#! /bin/sh\n", - "#! /bin/sh\nexport DYLD_LIBRARY_PATH={}:$DYLD_LIBRARY_PATH\n".format(libpaths), - ) - autotools = self._configure_autotools() + with chdir(self, os.path.join(self.source_folder, "c++")): + autotools = Autotools(self) + # TODO: replace by a call to autootols.autoreconf() in c++ folder once https://github.com/conan-io/conan/issues/12103 implemented + self.run("autoreconf --force --install") + autotools.configure(build_script_folder=os.path.join(self.source_folder, "c++")) autotools.make() @property @@ -146,16 +156,17 @@ def _cmake_folder(self): return os.path.join("lib", "cmake", "CapnProto") def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) if self.settings.os == "Windows": - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() else: - with tools.chdir(os.path.join(self._source_subfolder, "c++")): - autotools = self._configure_autotools() + with chdir(self, os.path.join(self.source_folder, "c++")): + autotools = Autotools(self) autotools.install() - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) for cmake_file in glob.glob(os.path.join(self.package_folder, self._cmake_folder, "*")): if os.path.basename(cmake_file) != "CapnProtoMacros.cmake": os.remove(cmake_file) @@ -175,7 +186,7 @@ def package(self): set(CAPNP_INCLUDE_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/../../../include") function(CAPNP_GENERATE_CPP SOURCES HEADERS) """) - tools.replace_in_file(os.path.join(self.package_folder, self._cmake_folder, "CapnProtoMacros.cmake"), + replace_in_file(self, os.path.join(self.package_folder, self._cmake_folder, "CapnProtoMacros.cmake"), "function(CAPNP_GENERATE_CPP SOURCES HEADERS)", find_execs) @@ -198,7 +209,7 @@ def package_info(self): components.append({"name": "kj-gzip", "requires": ["kj", "kj-async", "zlib::zlib"]}) if self.options.with_openssl: components.append({"name": "kj-tls", "requires": ["kj", "kj-async", "openssl::openssl"]}) - if tools.Version(self.version) >= "0.9.0": + if Version(self.version) >= "0.9.0": components.append({ "name": "capnp-websocket", "requires": ["capnp", "capnp-rpc", "kj-http", "kj-async", "kj"], @@ -214,18 +225,17 @@ def package_info(self): elif self.settings.os == "Windows": self.cpp_info.components["kj-async"].system_libs = ["ws2_32"] - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH env var with: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) - # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "CapnProto" self.cpp_info.names["cmake_find_package_multi"] = "CapnProto" self.cpp_info.components["kj"].build_modules = [capnprotomacros] + bin_path = os.path.join(self.package_folder, "bin") + self.output.info(f"Appending PATH env var with: {bin_path}") + self.env_info.PATH.append(bin_path) def _register_component(self, component): name = component["name"] - self.cpp_info.components[name].set_property("cmake_target_name", "CapnProto::{}".format(name)) + self.cpp_info.components[name].set_property("cmake_target_name", f"CapnProto::{name}") self.cpp_info.components[name].builddirs.append(self._cmake_folder) self.cpp_info.components[name].set_property("pkg_config_name", name) self.cpp_info.components[name].libs = [name] diff --git a/recipes/capnproto/all/test_package/CMakeLists.txt b/recipes/capnproto/all/test_package/CMakeLists.txt index 44e90440833f5b..8ffc65e9ffa4be 100644 --- a/recipes/capnproto/all/test_package/CMakeLists.txt +++ b/recipes/capnproto/all/test_package/CMakeLists.txt @@ -1,20 +1,16 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(CapnProto REQUIRED capnp capnp-rpc CONFIG) capnp_generate_cpp(addressbookSources addressbookHeaders addressbook.capnp) add_executable(addressbook addressbook.c++ ${addressbookSources}) -target_link_libraries(addressbook CapnProto::capnp) target_include_directories(addressbook PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) -set_property(TARGET addressbook PROPERTY CXX_STANDARD 14) +target_link_libraries(addressbook PRIVATE CapnProto::capnp) +target_compile_features(addressbook PRIVATE cxx_std_14) capnp_generate_cpp(calculatorSources calculatorHeaders calculator.capnp) -add_library(calculator_protocol STATIC) -target_sources(calculator_protocol PRIVATE ${calculatorSources}) +add_library(calculator_protocol STATIC ${calculatorSources}) target_include_directories(calculator_protocol PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) target_link_libraries(calculator_protocol PUBLIC CapnProto::capnp-rpc) target_compile_features(calculator_protocol PUBLIC cxx_std_14) diff --git a/recipes/capnproto/all/test_package/conanfile.py b/recipes/capnproto/all/test_package/conanfile.py index 10650773f736a3..d4d32590a51cc5 100644 --- a/recipes/capnproto/all/test_package/conanfile.py +++ b/recipes/capnproto/all/test_package/conanfile.py @@ -1,14 +1,31 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run, cross_building +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build_requirements(self): - if hasattr(self, "settings_build"): - self.build_requires(str(self.requires["capnproto"])) + if hasattr(self, "settings_build") and cross_building(self): + self.tool_requires(self.tested_reference_str) + + def generate(self): + VirtualRunEnv(self).generate() + if hasattr(self, "settings_build") and cross_building(self): + VirtualBuildEnv(self).generate() + else: + VirtualRunEnv(self).generate(scope="build") def build(self): cmake = CMake(self) @@ -16,6 +33,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "addressbook") - self.run("{} write".format(bin_path), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "addressbook") + self.run(f"{bin_path} write", env="conanrun") diff --git a/recipes/capnproto/all/test_v1_package/CMakeLists.txt b/recipes/capnproto/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/capnproto/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/capnproto/all/test_v1_package/conanfile.py b/recipes/capnproto/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..9c7aa58ab88686 --- /dev/null +++ b/recipes/capnproto/all/test_v1_package/conanfile.py @@ -0,0 +1,26 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def build_requirements(self): + if hasattr(self, "settings_build"): + self.build_requires(self.tested_reference_str) + + def build(self): + with tools.no_op() if hasattr(self, "settings_build") else tools.run_environment(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "addressbook") + self.run(f"{bin_path} write", run_environment=True) diff --git a/recipes/capnproto/config.yml b/recipes/capnproto/config.yml index b46b8cb89082c6..89d97bce3d8502 100644 --- a/recipes/capnproto/config.yml +++ b/recipes/capnproto/config.yml @@ -1,4 +1,6 @@ versions: + "0.10.3": + folder: all "0.10.1": folder: all "0.10.0": diff --git a/recipes/catch2/2.x.x/conandata.yml b/recipes/catch2/2.x.x/conandata.yml index a0d3adb7f0e99e..c945ab03130017 100644 --- a/recipes/catch2/2.x.x/conandata.yml +++ b/recipes/catch2/2.x.x/conandata.yml @@ -1,16 +1,16 @@ sources: - "2.11.3": - url: "https://github.com/catchorg/Catch2/archive/v2.11.3.tar.gz" - sha256: "9a6967138062688f04374698fce4ce65908f907d8c0fe5dfe8dc33126bd46543" - "2.12.4": - url: "https://github.com/catchorg/Catch2/archive/v2.12.4.tar.gz" - sha256: "5436725bbc6ee131a0bc9545bef31f0adabbb21fbc39fb6f1b2a42c12e4f8107" - "2.13.7": - url: "https://github.com/catchorg/Catch2/archive/v2.13.7.tar.gz" - sha256: "3cdb4138a072e4c0290034fe22d9f0a80d3bcfb8d7a8a5c49ad75d3a5da24fae" - "2.13.8": - url: "https://github.com/catchorg/Catch2/archive/v2.13.8.tar.gz" - sha256: "b9b592bd743c09f13ee4bf35fc30eeee2748963184f6bea836b146e6cc2a585a" "2.13.9": url: "https://github.com/catchorg/Catch2/archive/v2.13.9.tar.gz" sha256: "06dbc7620e3b96c2b69d57bf337028bf245a211b3cddb843835bfe258f427a52" + "2.13.8": + url: "https://github.com/catchorg/Catch2/archive/v2.13.8.tar.gz" + sha256: "b9b592bd743c09f13ee4bf35fc30eeee2748963184f6bea836b146e6cc2a585a" + "2.13.7": + url: "https://github.com/catchorg/Catch2/archive/v2.13.7.tar.gz" + sha256: "3cdb4138a072e4c0290034fe22d9f0a80d3bcfb8d7a8a5c49ad75d3a5da24fae" + "2.12.4": + url: "https://github.com/catchorg/Catch2/archive/v2.12.4.tar.gz" + sha256: "5436725bbc6ee131a0bc9545bef31f0adabbb21fbc39fb6f1b2a42c12e4f8107" + "2.11.3": + url: "https://github.com/catchorg/Catch2/archive/v2.11.3.tar.gz" + sha256: "9a6967138062688f04374698fce4ce65908f907d8c0fe5dfe8dc33126bd46543" diff --git a/recipes/catch2/2.x.x/conanfile.py b/recipes/catch2/2.x.x/conanfile.py index 44ba8e97757aa9..e72193ff6fadc4 100644 --- a/recipes/catch2/2.x.x/conanfile.py +++ b/recipes/catch2/2.x.x/conanfile.py @@ -11,7 +11,7 @@ class Catch2Conan(ConanFile): name = "catch2" description = "A modern, C++-native, header-only, framework for unit-tests, TDD and BDD" - topics = ("catch2", "header-only", "unit-test", "tdd", "bdd") + topics = ("header-only", "unit-test", "tdd", "bdd") homepage = "https://github.com/catchorg/Catch2" url = "https://github.com/conan-io/conan-center-index" license = "BSL-1.0" @@ -46,7 +46,7 @@ def configure(self): self.options.rm_safe("with_benchmark") def package_id(self): - if not self.options.with_main: + if not self.info.options.with_main: self.info.clear() def layout(self): diff --git a/recipes/catch2/2.x.x/test_package/conanfile.py b/recipes/catch2/2.x.x/test_package/conanfile.py index e5d217bf13ce53..d9d04e82d4e3ca 100644 --- a/recipes/catch2/2.x.x/test_package/conanfile.py +++ b/recipes/catch2/2.x.x/test_package/conanfile.py @@ -2,19 +2,20 @@ from conan.tools.cmake import CMake, CMakeToolchain from conan.tools.build import can_run from conan.tools.cmake import cmake_layout +from conan.tools.files import save, load import os -import yaml +import json + class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" generators = "CMakeDeps", "VirtualRunEnv" test_type = "explicit" - _tests_todo = [] @property def _todos_filename(self): - return os.path.join(self.recipe_folder, self.folders.generators, "catch2_test_to_do.yml") + return os.path.join(self.build_folder, "catch2_test_to_do.yml") def requirements(self): self.requires(self.tested_reference_str) @@ -22,20 +23,18 @@ def requirements(self): def generate(self): tc = CMakeToolchain(self) catch_opts = self.dependencies[self.tested_reference_str].options - tc.variables["WITH_PREFIX"] = catch_opts.with_prefix - tc.variables["WITH_MAIN"] = catch_opts.with_main + tc.variables["WITH_PREFIX"] = catch_opts.with_prefix + tc.variables["WITH_MAIN"] = catch_opts.with_main tc.variables["WITH_BENCHMARK"] = not catch_opts.with_prefix and catch_opts.with_main and catch_opts.with_benchmark tc.generate() # note: this is required as self.dependencies is not available in test() - self._tests_todo.append("test_package") + tests_todo = ["test_package"] if catch_opts.with_main: - self._tests_todo.append("standalone") + tests_todo.append("standalone") if not catch_opts.with_prefix and catch_opts.with_main and catch_opts.with_benchmark: - self._tests_todo.append("benchmark") - - with open(self._todos_filename, "w", encoding="utf-8") as file: - yaml.dump(self._tests_todo, file) + tests_todo.append("benchmark") + save(self, self._todos_filename, json.dumps(tests_todo)) def layout(self): cmake_layout(self) @@ -46,8 +45,7 @@ def build(self): cmake.build() def test(self): - with open(self._todos_filename, "r", encoding="utf-8") as file: - self._tests_todo = yaml.safe_load(file) + tests_todo = json.loads(load(self, self._todos_filename)) if can_run(self): - for test_name in self._tests_todo: + for test_name in tests_todo: self.run(os.path.join(self.cpp.build.bindirs[0], test_name), env="conanrun") diff --git a/recipes/catch2/3.x.x/conandata.yml b/recipes/catch2/3.x.x/conandata.yml index 80296e292f33aa..d0130641909445 100644 --- a/recipes/catch2/3.x.x/conandata.yml +++ b/recipes/catch2/3.x.x/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.2.1": + url: "https://github.com/catchorg/Catch2/archive/v3.2.1.tar.gz" + sha256: "4613d3e8142b672159fcae252a4860d72c8cf8e2df5043b1ae3541db9ef5d73c" "3.2.0": url: "https://github.com/catchorg/Catch2/archive/v3.2.0.tar.gz" sha256: "feee04647e28ac3cbeff46cb42abc8ee2d8d5f646d36e3fb3ba274b8c69a58ea" diff --git a/recipes/catch2/3.x.x/conanfile.py b/recipes/catch2/3.x.x/conanfile.py index ec3465c8a1719e..37d159374b11af 100644 --- a/recipes/catch2/3.x.x/conanfile.py +++ b/recipes/catch2/3.x.x/conanfile.py @@ -23,18 +23,25 @@ class Catch2Conan(ConanFile): "fPIC": [True, False], "with_prefix": [True, False], "default_reporter": [None, "ANY"], + "console_width": [None, "ANY"], } default_options = { "shared": False, "fPIC": True, "with_prefix": False, "default_reporter": None, + "console_width": "80", } @property def _min_cppstd(self): return "14" + @property + def _min_console_width(self): + # Catch2 doesn't build if less than this value + return 46 + @property def _compilers_minimum_version(self): return { @@ -72,6 +79,15 @@ def validate(self): f"{self.ref} requires C++{self._min_cppstd}, which your compiler doesn't support", ) + try: + if int(self.options.console_width) < self._min_console_width: + raise ConanInvalidConfiguration( + f"option 'console_width' must be >= {self._min_console_width}, " + f"got {self.options.console_width}. Contributions welcome if this should work!") + except ValueError as e: + raise ConanInvalidConfiguration(f"option 'console_width' must be an integer, " + f"got '{self.options.console_width}'") from e + def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -82,6 +98,7 @@ def generate(self): tc.cache_variables["CATCH_INSTALL_EXTRAS"] = True tc.cache_variables["CATCH_DEVELOPMENT_BUILD"] = False tc.variables["CATCH_CONFIG_PREFIX_ALL"] = self.options.with_prefix + tc.variables["CATCH_CONFIG_CONSOLE_WIDTH"] = self.options.console_width if self.options.default_reporter: tc.variables["CATCH_CONFIG_DEFAULT_REPORTER"] = self._default_reporter_str tc.generate() diff --git a/recipes/catch2/config.yml b/recipes/catch2/config.yml index 70386952911a84..af0893d76f6a87 100644 --- a/recipes/catch2/config.yml +++ b/recipes/catch2/config.yml @@ -1,4 +1,6 @@ versions: + "3.2.1": + folder: 3.x.x "3.2.0": folder: 3.x.x "3.1.0": diff --git a/recipes/cd3-boost-unit-definitions/all/conandata.yml b/recipes/cd3-boost-unit-definitions/all/conandata.yml new file mode 100644 index 00000000000000..c911db51da07b0 --- /dev/null +++ b/recipes/cd3-boost-unit-definitions/all/conandata.yml @@ -0,0 +1,6 @@ +sources: + # Newer versions at the top + "0.2.2": + url: + - "https://github.com/CD3/BoostUnitDefinitions/archive/refs/tags/0.2.2.tar.gz" + sha256: "84b374ce94bd4792994205a40e3a92b4d70694203f596c18f00de2520ba55db3" diff --git a/recipes/cd3-boost-unit-definitions/all/conanfile.py b/recipes/cd3-boost-unit-definitions/all/conanfile.py new file mode 100644 index 00000000000000..23bdb146d0b4ea --- /dev/null +++ b/recipes/cd3-boost-unit-definitions/all/conanfile.py @@ -0,0 +1,96 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os + + +required_conan_version = ">=1.52.0" + + +class PackageConan(ConanFile): + name = "cd3-boost-unit-definitions" + description = "A collection of pre-defined types and unit instances for working with Boost.Units quantities." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/CD3/BoostUnitDefinitions" + topics = ("physical dimensions", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 14 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "15", + "msvc": "19.0", + "gcc": "5", + "clang": "5", + "apple-clang": "5.1", + } + + def export_sources(self): + pass + + def layout(self): + basic_layout(self) + + def requirements(self): + self.requires("boost/1.80.0", transitive_headers=True) + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get( + str(self.settings.compiler), False + ) + if ( + minimum_version + and Version(self.settings.compiler.version) < minimum_version + ): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def build(self): + pass + + def package(self): + copy( + self, + pattern="LICENSE.md", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + ) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "src"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "BoostUnitDefinitions") + self.cpp_info.set_property( + "cmake_target_name", "BoostUnitDefinitions::BoostUnitDefinitions" + ) + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "BoostUnitDefinitions" + self.cpp_info.filenames["cmake_find_package_multi"] = "BoostUnitDefinitions" + self.cpp_info.names["cmake_find_package"] = "BoostUnitDefinitions" + self.cpp_info.names["cmake_find_package_multi"] = "BoostUnitDefinitions" diff --git a/recipes/cd3-boost-unit-definitions/all/test_package/CMakeLists.txt b/recipes/cd3-boost-unit-definitions/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..d4bbd419ef9dbd --- /dev/null +++ b/recipes/cd3-boost-unit-definitions/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(BoostUnitDefinitions REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE BoostUnitDefinitions::BoostUnitDefinitions) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/cd3-boost-unit-definitions/all/test_package/conanfile.py b/recipes/cd3-boost-unit-definitions/all/test_package/conanfile.py new file mode 100644 index 00000000000000..48499fa0989d9c --- /dev/null +++ b/recipes/cd3-boost-unit-definitions/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +# It will become the standard on Conan 2.x +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cd3-boost-unit-definitions/all/test_package/test_package.cpp b/recipes/cd3-boost-unit-definitions/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..a8708b60bd5f7c --- /dev/null +++ b/recipes/cd3-boost-unit-definitions/all/test_package/test_package.cpp @@ -0,0 +1,15 @@ +#include +#include +#include + +using namespace boost; +using namespace boost::units; + + +int main(void) { + + quantity x = 2.5*i::m; + std::cout << x << " == " << quantity(x) << std::endl; + + return EXIT_SUCCESS; +} diff --git a/recipes/cd3-boost-unit-definitions/all/test_v1_package/CMakeLists.txt b/recipes/cd3-boost-unit-definitions/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..b5b37b01b534cd --- /dev/null +++ b/recipes/cd3-boost-unit-definitions/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) + diff --git a/recipes/cd3-boost-unit-definitions/all/test_v1_package/conanfile.py b/recipes/cd3-boost-unit-definitions/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..c492184eec19c2 --- /dev/null +++ b/recipes/cd3-boost-unit-definitions/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/cd3-boost-unit-definitions/config.yml b/recipes/cd3-boost-unit-definitions/config.yml new file mode 100644 index 00000000000000..bb62e39821ff59 --- /dev/null +++ b/recipes/cd3-boost-unit-definitions/config.yml @@ -0,0 +1,4 @@ +versions: + # Newer versions at the top + "0.2.2": + folder: all diff --git a/recipes/cfgfile/all/CMakeLists.txt b/recipes/cfgfile/all/CMakeLists.txt deleted file mode 100644 index 64b7fce508eb08..00000000000000 --- a/recipes/cfgfile/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.10) -project(cmake_wrapper) - -set(CMAKE_CXX_STANDARD 14) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/cfgfile/all/conandata.yml b/recipes/cfgfile/all/conandata.yml index 2e90d0b7dcbd78..16ce1e88dfbb62 100644 --- a/recipes/cfgfile/all/conandata.yml +++ b/recipes/cfgfile/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.2.11": + url: "https://github.com/igormironchik/cfgfile/archive/refs/tags/0.2.11.tar.gz" + sha256: "fdf76baf157f86acc048fdcaa7e3ed534817026710866265706978a76a8e8238" "0.2.10": url: "https://github.com/igormironchik/cfgfile/archive/refs/tags/0.2.10.tar.gz" sha256: "bfab4deb8c9d71872a62a4f2a06056b56c93faf70b36ebb3bab5f207c8fe2c3f" diff --git a/recipes/cfgfile/all/conanfile.py b/recipes/cfgfile/all/conanfile.py index 1e8c15c48583c5..6ce91734444e44 100644 --- a/recipes/cfgfile/all/conanfile.py +++ b/recipes/cfgfile/all/conanfile.py @@ -1,7 +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.files import copy, get, rmdir +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -import textwrap + +required_conan_version = ">=1.50.0" class CfgfileConan(ConanFile): @@ -10,82 +15,78 @@ class CfgfileConan(ConanFile): homepage = "https://github.com/igormironchik/cfgfile.git" license = "MIT" description = "Header-only library for reading/saving configuration files with schema defined in sources." - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" topics = ("cfgfile", "configuration", "file") settings = "os", "arch", "compiler", "build_type" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" + def _min_cppstd(self): + return "14" @property def _compilers_minimum_version(self): return { "Visual Studio": "15", + "msvc": "191", "gcc": "5", "clang": "3.5", - "apple-clang": "10" + "apple-clang": "10", } - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_EXAMPLES"] = False - self._cmake.definitions["BUILD_TESTS"] = False - if tools.Version(self.version) >= "0.2.9": - self._cmake.definitions["USE_INTERNAL_ARGS_PARSER"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def package_id(self): + del self.info.settings.compiler def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "14") - - compiler = str(self.settings.compiler) - if compiler not in self._compilers_minimum_version: - self.output.warn("Unknown compiler, assuming it supports at least C++14") - return - - version = tools.Version(self.settings.compiler.version) - if version < self._compilers_minimum_version[compiler]: - raise ConanInvalidConfiguration("cfgfile requires a compiler that supports at least C++14") + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.name} {self.version} requires C++{self._min_cppstd}, which your compiler does not support.", + ) def requirements(self): - if tools.Version(self.version) >= "0.2.10": + if Version(self.version) >= "0.2.10": self.requires("args-parser/6.2.0.1") elif self.version == "0.2.9.1": self.requires("args-parser/6.2.0.1") elif self.version == "0.2.9.0": self.requires("args-parser/6.0.1.0") + def build_requirements(self): + self.tool_requires("cmake/3.25.0") + def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=self.source_folder) cmake.build() + def layout(self): + cmake_layout(self) + def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["BUILD_EXAMPLES"] = False + tc.cache_variables["BUILD_TESTS"] = False + if Version(self.version) >= "0.2.9": + tc.variables["USE_INTERNAL_ARGS_PARSER"] = False + tc.generate() + deps = CMakeDeps(self) + deps.generate() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - self.copy("*.hpp", src=os.path.join(self._source_subfolder, "cfgfile"), dst=os.path.join("include", "cfgfile")) - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib")) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "cfgfile") + self.cpp_info.set_property("cmake_target_name", "cfgfile::cfgfile") + self.cpp_info.includedirs.append(os.path.join("include", "cfgfile")) bin_path = os.path.join(self.package_folder, "bin") self.output.info("Appending PATH env var with : {}".format(bin_path)) self.env_info.PATH.append(bin_path) - self.cpp_info.names["cmake_find_package"] = "cfgfile" - self.cpp_info.names["cmake_find_package_multi"] = "cfgfile" - self.cpp_info.includedirs.append(os.path.join("include", "cfgfile")) - - def package_id(self): - del self.info.settings.compiler diff --git a/recipes/cfgfile/all/test_package/CMakeLists.txt b/recipes/cfgfile/all/test_package/CMakeLists.txt index fa543125623364..678ffe7224c311 100644 --- a/recipes/cfgfile/all/test_package/CMakeLists.txt +++ b/recipes/cfgfile/all/test_package/CMakeLists.txt @@ -1,12 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -project(cfgfile.test) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) - -conan_basic_setup(TARGETS) - -find_package(cfgfile REQUIRED) +find_package(cfgfile REQUIRED CONFIG) add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cfg.hpp" @@ -14,16 +9,7 @@ add_custom_command( DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/session_cfg.conf" ) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - -add_executable(${PROJECT_NAME} - example.cpp - "${CMAKE_CURRENT_BINARY_DIR}/cfg.hpp" -) - -target_link_libraries(${PROJECT_NAME} cfgfile::cfgfile) - -set_target_properties(${PROJECT_NAME} PROPERTIES - CXX_STANDARD 14 - CXX_STANDARD_REQUIRED ON -) +add_executable(${PROJECT_NAME} test_package.cpp "${CMAKE_CURRENT_BINARY_DIR}/cfg.hpp") +target_link_libraries(${PROJECT_NAME} PRIVATE cfgfile::cfgfile) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/recipes/cfgfile/all/test_package/conanfile.py b/recipes/cfgfile/all/test_package/conanfile.py index 95fef1a204a6ce..cc0263e38af82f 100644 --- a/recipes/cfgfile/all/test_package/conanfile.py +++ b/recipes/cfgfile/all/test_package/conanfile.py @@ -1,21 +1,28 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run, cross_building +from conan.tools.cmake import CMake, cmake_layout import os -class CfgfileTestConan(ConanFile): - generators = "cmake", "cmake_find_package" + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): - if not tools.cross_building(self, skip_x64_x86=True): + if not cross_building(self, skip_x64_x86=True): cmake = CMake(self) cmake.configure() cmake.build() - def build_requirements(self): - if hasattr(self, "settings_build"): - self.build_requires(str(self.requires["cfgfile"])) - def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "cfgfile.test") - cfg_path = os.path.join(self.source_folder, "test.cfg"); - self.run("{} \"{}\"".format(bin_path, cfg_path), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + cfg_path = os.path.join(self.source_folder, "test.cfg") + self.run("{} \"{}\"".format(bin_path, cfg_path), env="conanrun") + diff --git a/recipes/cfgfile/all/test_package/example.cpp b/recipes/cfgfile/all/test_package/test_package.cpp similarity index 100% rename from recipes/cfgfile/all/test_package/example.cpp rename to recipes/cfgfile/all/test_package/test_package.cpp diff --git a/recipes/cfgfile/all/test_v1_package/CMakeLists.txt b/recipes/cfgfile/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..8af52c82738051 --- /dev/null +++ b/recipes/cfgfile/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cfgfile/all/test_v1_package/conanfile.py b/recipes/cfgfile/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..54b7d470785a9e --- /dev/null +++ b/recipes/cfgfile/all/test_v1_package/conanfile.py @@ -0,0 +1,23 @@ +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): + if not tools.cross_building(self, skip_x64_x86=True): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def build_requirements(self): + if hasattr(self, "settings_build"): + self.build_requires(str(self.requires["cfgfile"])) + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + cfg_path = os.path.join(self.source_folder, os.pardir, "test_package", "test.cfg") + self.run("{} \"{}\"".format(bin_path, cfg_path), run_environment=True) diff --git a/recipes/cfgfile/config.yml b/recipes/cfgfile/config.yml index 26f651ad576a2d..5f9aabdfbd6d9e 100644 --- a/recipes/cfgfile/config.yml +++ b/recipes/cfgfile/config.yml @@ -1,4 +1,6 @@ versions: + "0.2.11": + folder: all "0.2.10": folder: all "0.2.9.1": diff --git a/recipes/charls/all/conandata.yml b/recipes/charls/all/conandata.yml index 0c25d16afadd4f..44bdf87dad81c1 100644 --- a/recipes/charls/all/conandata.yml +++ b/recipes/charls/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.4.1": + url: "https://github.com/team-charls/charls/archive/2.4.1.tar.gz" + sha256: "f313f556b5acb9215961d9718c21235aafcd43bce6b357bf66f772e5692bba75" + "2.4.0": + url: "https://github.com/team-charls/charls/archive/2.4.0.tar.gz" + sha256: "721f4fd6a8dc3ec6a334d1c3c15d1cb9faa149afddd0eff703466c20e775c294" "2.3.4": url: "https://github.com/team-charls/charls/archive/2.3.4.tar.gz" sha256: "28e895a6e22daee76c24cf4d36c62bb20fd60fad0c9cfefc2eb8fa9b6045ae84" diff --git a/recipes/charls/all/conanfile.py b/recipes/charls/all/conanfile.py index 97c3e37e316b8a..b252de9d9dec05 100644 --- a/recipes/charls/all/conanfile.py +++ b/recipes/charls/all/conanfile.py @@ -7,7 +7,7 @@ import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class CharlsConan(ConanFile): @@ -39,7 +39,7 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def validate(self): if self.info.settings.compiler.cppstd: @@ -108,6 +108,8 @@ def package_info(self): self.cpp_info.libs = collect_libs(self) if not self.options.shared: self.cpp_info.defines.append("CHARLS_STATIC") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") # TODO: to remove in conan v2 once legacy generators removed self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] diff --git a/recipes/charls/all/test_package/CMakeLists.txt b/recipes/charls/all/test_package/CMakeLists.txt index 4f9a1f4112d6f9..a05d57b66979e3 100644 --- a/recipes/charls/all/test_package/CMakeLists.txt +++ b/recipes/charls/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) +project(test_package LANGUAGES C CXX) find_package(charls CONFIG REQUIRED) diff --git a/recipes/charls/all/test_v1_package/CMakeLists.txt b/recipes/charls/all/test_v1_package/CMakeLists.txt index 47ece1bc01777a..be00a8c7f57c71 100644 --- a/recipes/charls/all/test_v1_package/CMakeLists.txt +++ b/recipes/charls/all/test_v1_package/CMakeLists.txt @@ -4,12 +4,5 @@ project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(charls CONFIG REQUIRED) - -add_executable(test_package_c ../test_package/test_package.c) -target_link_libraries(test_package_c PRIVATE charls) -set_target_properties(test_package_c PROPERTIES LINKER_LANGUAGE CXX) - -add_executable(test_package_cpp ../test_package/test_package.cpp) -target_link_libraries(test_package_cpp PRIVATE charls) -target_compile_features(test_package_cpp PRIVATE cxx_std_14) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/charls/config.yml b/recipes/charls/config.yml index a9e865d288a54b..96f2c11fde345c 100644 --- a/recipes/charls/config.yml +++ b/recipes/charls/config.yml @@ -1,4 +1,8 @@ versions: + "2.4.1": + folder: all + "2.4.0": + folder: all "2.3.4": folder: all "2.2.0": diff --git a/recipes/cimg/all/conandata.yml b/recipes/cimg/all/conandata.yml index 939c703cb331f5..eea92963062f72 100644 --- a/recipes/cimg/all/conandata.yml +++ b/recipes/cimg/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.2.0": + url: "https://cimg.eu/files/CImg_3.2.0.zip" + sha256: "7a923357c3127d8839696c7b0f4eb4c23982c090d3f49fb133f2c8556ca74a88" "3.0.2": url: "https://cimg.eu/files/CImg_3.0.2.zip" sha256: "ee55a37c33d503a64ff264b53952e502ba7c2887b59ded47c47c86ea52ac5c31" diff --git a/recipes/cimg/all/conanfile.py b/recipes/cimg/all/conanfile.py index 8c0549fa875e2e..4c4d65c0ab3d85 100644 --- a/recipes/cimg/all/conanfile.py +++ b/recipes/cimg/all/conanfile.py @@ -1,16 +1,18 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -import shutil -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.51.1" class CImgConan(ConanFile): name = "cimg" description = "The CImg Library is a small and open-source C++ toolkit for image processing" homepage = "http://cimg.eu" - topics = ("cimg", "physics", "simulation", "robotics", "kinematics", "engine") + topics = ("physics", "simulation", "robotics", "kinematics", "engine") license = "CeCILL V2" url = "https://github.com/conan-io/conan-center-index" @@ -28,13 +30,13 @@ class CImgConan(ConanFile): "enable_xshm": [True, False], } default_options = { - "enable_fftw": True, - "enable_jpeg": True, - "enable_openexr": True, - "enable_png": True, - "enable_tiff": True, - "enable_ffmpeg": True, - "enable_opencv": True, + "enable_fftw": False, + "enable_jpeg": False, + "enable_openexr": False, + "enable_png": False, + "enable_tiff": False, + "enable_ffmpeg": False, + "enable_opencv": False, "enable_magick": False, "enable_xrandr": False, "enable_xshm": False, @@ -42,10 +44,6 @@ class CImgConan(ConanFile): no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _cimg_defines(self): return [ @@ -61,48 +59,56 @@ def _cimg_defines(self): ("enable_xshm", "cimg_use_xshm"), ] + def layout(self): + basic_layout(self, src_folder="src") + def requirements(self): if self.options.enable_fftw: self.requires("fftw/3.3.9") if self.options.enable_jpeg: - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") if self.options.enable_openexr: self.requires("openexr/2.5.7") if self.options.enable_png: - self.requires("libpng/1.6.37") + self.requires("libpng/1.6.39") if self.options.enable_tiff: - self.requires("libtiff/4.3.0") + self.requires("libtiff/4.4.0") if self.options.enable_ffmpeg: - self.requires("ffmpeg/4.4") + self.requires("ffmpeg/5.0") if self.options.enable_opencv: - self.requires("opencv/4.5.3") + self.requires("opencv/4.5.5") if self.options.enable_magick: self.requires("imagemagick/7.0.11-14") + def package_id(self): + self.info.clear() + def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "11") + check_min_cppstd(self, "11") # TODO: Update requirements when available in CCI if self.options.enable_xrandr: raise ConanInvalidConfiguration("xrandr not available in CCI yet") if self.options.enable_xshm: raise ConanInvalidConfiguration("xshm not available in CCI yet") - def package_id(self): - self.info.header_only() - 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("Licence*", src=self._source_subfolder, dst="licenses") - self.copy("CImg.h", src=self._source_subfolder, dst="include") - shutil.copytree(os.path.join(self.source_folder, self._source_subfolder, "plugins"), + copy(self, "Licence*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "CImg.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) + copy(self, "*", os.path.join(self.source_folder, "plugins"), os.path.join(self.package_folder, "include", "plugins")) def package_info(self): self.cpp_info.set_property("pkg_config_name", "CImg") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] for option, define in self._cimg_defines: if getattr(self.options, option): self.cpp_info.defines.append(define) @@ -111,4 +117,3 @@ def package_info(self): # do not use this name in CMakeDeps, it was a mistake, there is no offical CMake config file self.cpp_info.names["cmake_find_package"] = "CImg" self.cpp_info.names["cmake_find_package_multi"] = "CImg" - self.cpp_info.names["pkg_config"] = "CImg" diff --git a/recipes/cimg/all/test_package/CMakeLists.txt b/recipes/cimg/all/test_package/CMakeLists.txt index 54f60fa9925c05..449f2a9e10e694 100644 --- a/recipes/cimg/all/test_package/CMakeLists.txt +++ b/recipes/cimg/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -set(CMAKE_CXX_STANDARD 11) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(cimg REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) - +target_link_libraries(${PROJECT_NAME} PRIVATE cimg::cimg) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/cimg/all/test_package/conanfile.py b/recipes/cimg/all/test_package/conanfile.py index d919133e5c230c..0a6bc68712d901 100644 --- a/recipes/cimg/all/test_package/conanfile.py +++ b/recipes/cimg/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,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cimg/all/test_v1_package/CMakeLists.txt b/recipes/cimg/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..9cb59c3d4ef6af --- /dev/null +++ b/recipes/cimg/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(CImg REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE CImg::CImg) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/cimg/all/test_v1_package/conanfile.py b/recipes/cimg/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/cimg/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/cimg/config.yml b/recipes/cimg/config.yml index 57d368a954f0b4..570cd2f89fed48 100644 --- a/recipes/cimg/config.yml +++ b/recipes/cimg/config.yml @@ -1,4 +1,6 @@ versions: + "3.2.0": + folder: all "3.0.2": folder: all "3.0.0": diff --git a/recipes/cista/all/conandata.yml b/recipes/cista/all/conandata.yml index dd598e2bd2c5c4..1547b3bc2b229b 100644 --- a/recipes/cista/all/conandata.yml +++ b/recipes/cista/all/conandata.yml @@ -1,4 +1,9 @@ sources: + "0.11": + - url: "https://github.com/felixguendling/cista/releases/download/v0.11/cista.h" + sha256: "e2e37fa1f7278e7f1a8dab7d84b6b00f5a0a4fb48f42fbe5761b7ddd0d07314c" + - url: "https://raw.githubusercontent.com/felixguendling/cista/v0.11/LICENSE" + sha256: "fcd47e35fd6dc22feec454c5c1e572ccb7587dedd91d824528ebbb00a7f37c56" "0.10": - url: "https://github.com/felixguendling/cista/releases/download/v0.10/cista.h" sha256: "c06162c73c0fb034170198d79940d2eeecc233140797ab7e3b66053d61a0169b" diff --git a/recipes/cista/all/conanfile.py b/recipes/cista/all/conanfile.py index 6021efe7f66009..a5a461c964a048 100644 --- a/recipes/cista/all/conanfile.py +++ b/recipes/cista/all/conanfile.py @@ -3,10 +3,10 @@ from conan.tools.build import check_min_cppstd from conan.tools.files import copy, download from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" - +required_conan_version = ">=1.52.0" class CistaConan(ConanFile): name = "cista" @@ -21,10 +21,15 @@ class CistaConan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True + @property + def _min_cppstd(self): + return 17 + @property def _compilers_minimum_version(self): return { - "Visual Studio": "15.7", + "Visual Studio": "15.7" if Version(self.version) < "0.11" else "16", + "msvc": "191" if Version(self.version) < "0.11" else "192", "gcc": "8", "clang": "6", "apple-clang": "9.1" @@ -35,7 +40,7 @@ def package_id(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, 17) + check_min_cppstd(self, self._min_cppstd) def loose_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] @@ -46,7 +51,7 @@ def loose_lt_semver(v1, v2): minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), None) if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): raise ConanInvalidConfiguration( - f"{self.name} {self.version} requires C++17, which your compiler does not support.", + f"{self.name} {self.version} requires C++{self._min_cppstd}, which your compiler does not support.", ) def layout(self): @@ -64,7 +69,6 @@ def package(self): def package_info(self): self.cpp_info.set_property("cmake_file_name", "cista") self.cpp_info.set_property("cmake_target_name", "cista::cista") + self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] diff --git a/recipes/cista/all/test_package/CMakeLists.txt b/recipes/cista/all/test_package/CMakeLists.txt index d342da86f8d00e..17a27c55f0b491 100644 --- a/recipes/cista/all/test_package/CMakeLists.txt +++ b/recipes/cista/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) +project(test_package LANGUAGES CXX) find_package(cista REQUIRED CONFIG) diff --git a/recipes/cista/all/test_v1_package/CMakeLists.txt b/recipes/cista/all/test_v1_package/CMakeLists.txt index d27dfd94cab14e..be00a8c7f57c71 100644 --- a/recipes/cista/all/test_v1_package/CMakeLists.txt +++ b/recipes/cista/all/test_v1_package/CMakeLists.txt @@ -4,8 +4,5 @@ project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(cista REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE cista::cista) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/cista/config.yml b/recipes/cista/config.yml index 5808152f9189f9..ac2c19b16c2784 100644 --- a/recipes/cista/config.yml +++ b/recipes/cista/config.yml @@ -1,4 +1,6 @@ versions: + "0.11": + folder: all "0.10": folder: all "0.9": diff --git a/recipes/cityhash/all/conanfile.py b/recipes/cityhash/all/conanfile.py index 35e373369c7eb1..2459b5205cee16 100644 --- a/recipes/cityhash/all/conanfile.py +++ b/recipes/cityhash/all/conanfile.py @@ -1,10 +1,15 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration -from contextlib import contextmanager -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class CityhashConan(ConanFile): @@ -25,14 +30,6 @@ class CityhashConan(ConanFile): "fPIC": True, } - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) @@ -47,69 +44,63 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + basic_layout(self, src_folder="src") def validate(self): - if self._is_msvc and self.options.shared: + if is_msvc(self) and self.options.shared: raise ConanInvalidConfiguration("cityhash does not support shared builds with Visual Studio") def build_requirements(self): - self.build_requires("libtool/2.4.6") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @contextmanager - def _build_context(self): - if self._is_msvc: - with tools.vcvars(self): - env = { - "CC": "cl -nologo", - "CXX": "cl -nologo", - "LD": "link -nologo", - "AR": "{} lib".format(tools.unix_path(self._user_info_build["automake"].ar_lib)), - } - with tools.environment_append(env): - yield - else: - yield - - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - autotools.libs = [] - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-static={}".format(yes_no(not self.options.shared)), - "--enable-shared={}".format(yes_no(self.options.shared)), - ] - if self._is_msvc: - autotools.cxx_flags.append("-EHsc") - if not (self.settings.compiler == "Visual Studio" and \ - tools.Version(self.settings.compiler.version) < "12"): - autotools.flags.append("-FS") - autotools.configure(configure_dir=self._source_subfolder, args=args) - return autotools + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + if is_msvc(self): + tc.extra_cxxflags.append("-EHsc") + if (str(self.settings.compiler) == "Visual Studio" and Version(self.settings.compiler.version) >= "12") or \ + (str(self.settings.compiler) == "msvc" and Version(self.settings.compiler.version) >= "180"): + tc.extra_cflags.append("-FS") + tc.extra_cxxflags.append("-FS") + env = tc.environment() + if is_msvc(self): + ar_wrapper = unix_path(self, self._user_info_build["automake"].ar_lib) + env.define("CC", "cl -nologo") + env.define("CXX", "cl -nologo") + env.define("LD", "link -nologo") + env.define("AR", f"{ar_wrapper} lib") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + tc.generate(env) def build(self): - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) - # relocatable shared lib on macOS - tools.replace_in_file("configure", "-install_name \\$rpath/", "-install_name @rpath/") - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.rmdir(os.path.join(self.package_folder, "share")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "share")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.libs = ["cityhash"] diff --git a/recipes/cityhash/all/test_package/CMakeLists.txt b/recipes/cityhash/all/test_package/CMakeLists.txt index 895a4298a7cae1..9fbe304115d9e0 100644 --- a/recipes/cityhash/all/test_package/CMakeLists.txt +++ b/recipes/cityhash/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(cityhash REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} cityhash::cityhash) +target_link_libraries(${PROJECT_NAME} PRIVATE cityhash::cityhash) diff --git a/recipes/cityhash/all/test_package/conanfile.py b/recipes/cityhash/all/test_package/conanfile.py index 38f4483872d47f..0a6bc68712d901 100644 --- a/recipes/cityhash/all/test_package/conanfile.py +++ b/recipes/cityhash/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cityhash/all/test_v1_package/CMakeLists.txt b/recipes/cityhash/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/cityhash/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cityhash/all/test_v1_package/conanfile.py b/recipes/cityhash/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/cityhash/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/civetweb/all/conanfile.py b/recipes/civetweb/all/conanfile.py index fd01f187e2af3b..181978c12d7a64 100644 --- a/recipes/civetweb/all/conanfile.py +++ b/recipes/civetweb/all/conanfile.py @@ -99,13 +99,13 @@ def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def layout(self): - cmake_layout(self) + cmake_layout(self, src_folder="src") def generate(self): tc = CMakeToolchain(self) if self.options.with_ssl: - openssl_version = Version(self.dependencies["openssl"].ref.version[:-1]) + openssl_version = Version(str(self.dependencies["openssl"].ref.version)[:-1]) tc.variables["CIVETWEB_ENABLE_SSL"] = self.options.with_ssl tc.variables["CIVETWEB_ENABLE_SSL_DYNAMIC_LOADING"] = self.options.ssl_dynamic_loading tc.variables["CIVETWEB_SSL_OPENSSL_API_1_0"] = openssl_version.minor == "0" diff --git a/recipes/cli11/all/conandata.yml b/recipes/cli11/all/conandata.yml index 36add26ccbad70..fb856253269aa2 100644 --- a/recipes/cli11/all/conandata.yml +++ b/recipes/cli11/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.3.2": + url: "https://github.com/CLIUtils/CLI11/archive/v2.3.2.tar.gz" + sha256: "aac0ab42108131ac5d3344a9db0fdf25c4db652296641955720a4fbe52334e22" "2.3.1": url: "https://github.com/CLIUtils/CLI11/archive/v2.3.1.tar.gz" sha256: "378da73d2d1d9a7b82ad6ed2b5bda3e7bc7093c4034a1d680a2e009eb067e7b2" diff --git a/recipes/cli11/config.yml b/recipes/cli11/config.yml index 404e9fa4a9f550..37bc8ba7326b9e 100644 --- a/recipes/cli11/config.yml +++ b/recipes/cli11/config.yml @@ -1,4 +1,6 @@ versions: + "2.3.2": + folder: all "2.3.1": folder: all "2.3.0": diff --git a/recipes/cmake/3.x.x/conandata.yml b/recipes/cmake/3.x.x/conandata.yml index 6d9ebddf32aadc..77f6af017496fc 100644 --- a/recipes/cmake/3.x.x/conandata.yml +++ b/recipes/cmake/3.x.x/conandata.yml @@ -20,3 +20,6 @@ sources: "3.25.0": url: "https://github.com/Kitware/CMake/releases/download/v3.25.0/cmake-3.25.0.tar.gz" sha256: "306463f541555da0942e6f5a0736560f70c487178b9d94a5ae7f34d0538cdd48" + "3.25.1": + url: "https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1.tar.gz" + sha256: "1c511d09516af493694ed9baf13c55947a36389674d657a2d5e0ccedc6b291d8" diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index e0d41c4a94794d..96b67934a6d19f 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -1,20 +1,24 @@ -import os from conan import ConanFile +from conan.tools.files import chdir, copy, rmdir, get, save, load +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout +from conan.tools.build import build_jobs, cross_building, check_min_cppstd from conan.tools.scm import Version -from conan.tools.files import rmdir, get -from conans import tools, AutoToolsBuildEnvironment, CMake -from conan.errors import ConanInvalidConfiguration, ConanException +from conan.errors import ConanInvalidConfiguration +import os +import json -required_conan_version = ">=1.49.0" +required_conan_version = ">=1.50.0" class CMakeConan(ConanFile): name = "cmake" + package_type = "application" description = "Conan installer for CMake" topics = ("cmake", "build", "installer") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/Kitware/CMake" license = "BSD-3-Clause" - generators = "cmake" settings = "os", "arch", "compiler", "build_type" options = { @@ -26,9 +30,6 @@ class CMakeConan(ConanFile): "bootstrap": False, } - _source_subfolder = "source_subfolder" - _cmake = None - def config_options(self): if self.settings.os == "Windows": self.options.with_openssl = False @@ -38,103 +39,112 @@ def requirements(self): self.requires("openssl/1.1.1s") def validate(self): - if self.settings.os == "Macos" and self.settings.arch == "x86": - raise ConanInvalidConfiguration("CMake does not support x86 for macOS") - if self.settings.os == "Windows" and self.options.bootstrap: raise ConanInvalidConfiguration("CMake does not support bootstrapping on Windows") + if self.settings.os == "Macos" and self.settings.arch == "x86": + raise ConanInvalidConfiguration("CMake does not support x86 for macOS") + minimal_cpp_standard = "11" - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, minimal_cpp_standard) + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, minimal_cpp_standard) minimal_version = { "gcc": "4.8", "clang": "3.3", "apple-clang": "9", "Visual Studio": "14", + "msvc": "190", } compiler = str(self.settings.compiler) if compiler not in minimal_version: - self.output.warn( - "{} recipe lacks information about the {} compiler standard version support".format(self.name, compiler)) - self.output.warn( - "{} requires a compiler that supports at least C++{}".format(self.name, minimal_cpp_standard)) + self.output.warning( + f"{self.name} recipe lacks information about the {compiler} compiler standard version support") + self.output.warning( + f"{self.name} requires a compiler that supports at least C++{minimal_cpp_standard}") return version = Version(self.settings.compiler.version) if version < minimal_version[compiler]: raise ConanInvalidConfiguration( - "{} requires a compiler that supports at least C++{}".format(self.name, minimal_cpp_standard)) + f"{self.name} requires a compiler that supports at least C++{minimal_cpp_standard}") + + def layout(self): + if self.options.bootstrap: + basic_layout(self, src_folder="src") + else: + cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - rmdir(self, os.path.join(self._source_subfolder, "Tests", "RunCMake", "find_package")) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + rmdir(self, os.path.join(self.source_folder, "Tests", "RunCMake", "find_package")) - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) + def generate(self): + if self.options.bootstrap: + tc = AutotoolsToolchain(self) + tc.generate() + tc = AutotoolsDeps(self) + tc.generate() + bootstrap_cmake_options = ["--"] + bootstrap_cmake_options.append(f'-DCMAKE_CXX_STANDARD={"11" if not self.settings.compiler.cppstd else self.settings.compiler.cppstd}') + if self.settings.os == "Linux": + if self.options.with_openssl: + openssl = self.dependencies["openssl"] + bootstrap_cmake_options.append("-DCMAKE_USE_OPENSSL=ON") + bootstrap_cmake_options.append(f'-DOPENSSL_USE_STATIC_LIBS={"FALSE" if openssl.options.shared else "TRUE"}') + else: + bootstrap_cmake_options.append("-DCMAKE_USE_OPENSSL=OFF") + save(self, "bootstrap_args", json.dumps({"bootstrap_cmake_options": ' '.join(arg for arg in bootstrap_cmake_options)})) + else: + tc = CMakeToolchain(self) if not self.settings.compiler.cppstd: - self._cmake.definitions["CMAKE_CXX_STANDARD"] = 11 - self._cmake.definitions["CMAKE_BOOTSTRAP"] = False + tc.variables["CMAKE_CXX_STANDARD"] = 11 + tc.variables["CMAKE_BOOTSTRAP"] = False if self.settings.os == "Linux": - self._cmake.definitions["CMAKE_USE_OPENSSL"] = self.options.with_openssl + tc.variables["CMAKE_USE_OPENSSL"] = self.options.with_openssl if self.options.with_openssl: - self._cmake.definitions["OPENSSL_USE_STATIC_LIBS"] = not self.options["openssl"].shared - if tools.cross_building(self): - self._cmake.definitions["HAVE_POLL_FINE_EXITCODE"] = '' - self._cmake.definitions["HAVE_POLL_FINE_EXITCODE__TRYRUN_OUTPUT"] = '' - self._cmake.configure(source_folder=self._source_subfolder) - - return self._cmake + openssl = self.dependencies["openssl"] + tc.variables["OPENSSL_USE_STATIC_LIBS"] = not openssl.options.shared + if cross_building(self): + tc.variables["HAVE_POLL_FINE_EXITCODE"] = '' + tc.variables["HAVE_POLL_FINE_EXITCODE__TRYRUN_OUTPUT"] = '' + tc.generate() def build(self): if self.options.bootstrap: - with tools.chdir(self._source_subfolder): - self.run(['./bootstrap', '--prefix={}'.format(self.package_folder), '--parallel={}'.format(tools.cpu_count())]) - autotools = AutoToolsBuildEnvironment(self) + toolchain_file_content = json.loads(load(self, os.path.join(self.generators_folder, "bootstrap_args"))) + bootstrap_cmake_options = toolchain_file_content.get("bootstrap_cmake_options") + with chdir(self, self.source_folder): + self.run(f'./bootstrap --prefix="" --parallel={build_jobs(self)} {bootstrap_cmake_options}') + autotools = Autotools(self) autotools.make() else: - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "project(CMake)", - "project(CMake)\ninclude(\"{}/conanbuildinfo.cmake\")\nconan_basic_setup(NO_OUTPUT_DIRS)".format( - self.install_folder.replace("\\", "/"))) - if self.settings.os == "Linux": - tools.replace_in_file(os.path.join(self._source_subfolder, "Utilities", "cmcurl", "CMakeLists.txt"), - "list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES})", - "list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES} ${CMAKE_DL_LIBS} pthread)") - - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("Copyright.txt", dst="licenses", src=self._source_subfolder) + copy(self, "Copyright.txt", self.source_folder, os.path.join(self.package_folder, "licenses"), keep_path=False) if self.options.bootstrap: - with tools.chdir(self._source_subfolder): - autotools = AutoToolsBuildEnvironment(self) + with chdir(self, self.source_folder): + autotools = Autotools(self) autotools.install() else: - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "doc")) def package_id(self): del self.info.settings.compiler + del self.info.options.bootstrap def package_info(self): - module_version = "{}.{}".format(Version(self.version).major, Version(self.version).minor) + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] + # Needed for compatibility with v1.x - Remove when 2.0 becomes the default bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) + self.output.info(f"Appending PATH environment variable: {bindir}") self.env_info.PATH.append(bindir) - - self.buildenv_info.prepend_path("CMAKE_ROOT", self.package_folder) - self.env_info.CMAKE_ROOT = self.package_folder - mod_path = os.path.join(self.package_folder, "share", f"cmake-{module_version}", "Modules") - self.buildenv_info.prepend_path("CMAKE_MODULE_PATH", mod_path) - self.env_info.CMAKE_MODULE_PATH = mod_path - if not os.path.exists(mod_path): - raise ConanException("Module path not found: %s" % mod_path) - - self.cpp_info.includedirs = [] diff --git a/recipes/cmake/3.x.x/test_package/conanfile.py b/recipes/cmake/3.x.x/test_package/conanfile.py index 0b0c4858e1c60e..df50a01c37d6f0 100644 --- a/recipes/cmake/3.x.x/test_package/conanfile.py +++ b/recipes/cmake/3.x.x/test_package/conanfile.py @@ -1,23 +1,24 @@ -import os from six import StringIO from conan import ConanFile -from conan.tools.build import can_run +import re class TestPackageConan(ConanFile): - settings = "os", "arch" - generators = "VirtualRunEnv" + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" - def requirements(self): - self.requires(self.tested_reference_str) + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - if can_run(self): - output = StringIO() - self.run("cmake --version", env="conanrun", output=output) - output_str = str(output.getvalue()) - self.output.info("Installed version: {}".format(output_str)) - require_version = str(self.deps_cpp_info["cmake"].version) - self.output.info("Expected version: {}".format(require_version)) - assert_cmake_version = "cmake version %s" % require_version - assert(assert_cmake_version in output_str) + output = StringIO() + # Third arg to self.run renamed "stdout" in Conan 2.0 but 1.x linter doesn't like it + self.run("cmake --version", output) + output_str = str(output.getvalue()) + self.output.info("Installed version: {}".format(output_str)) + tokens = re.split('[@#]', self.tested_reference_str) + require_version = tokens[0].split("/", 1)[1] + self.output.info("Expected version: {}".format(require_version)) + assert_cmake_version = "cmake version %s" % require_version + assert(assert_cmake_version in output_str) diff --git a/recipes/cmake/3.x.x/test_v1_package/conanfile.py b/recipes/cmake/3.x.x/test_v1_package/conanfile.py index efb629f7d57250..df9415b7cf880e 100644 --- a/recipes/cmake/3.x.x/test_v1_package/conanfile.py +++ b/recipes/cmake/3.x.x/test_v1_package/conanfile.py @@ -1,23 +1,23 @@ import os from six import StringIO from conan import ConanFile -from conan.tools.build import can_run +import re class TestPackageConan(ConanFile): - settings = "os", "arch" + settings = "os", "arch", "compiler", "build_type" test_type = "explicit" - def requirements(self): - self.requires(self.tested_reference_str) + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - if can_run(self): - output = StringIO() - self.run("cmake --version", output=output, run_environment=True) - output_str = str(output.getvalue()) - self.output.info("Installed version: {}".format(output_str)) - require_version = str(self.deps_cpp_info["cmake"].version) - self.output.info("Expected version: {}".format(require_version)) - assert_cmake_version = "cmake version %s" % require_version - assert(assert_cmake_version in output_str) + output = StringIO() + self.run("cmake --version", output=output, run_environment=False) + output_str = str(output.getvalue()) + self.output.info("Installed version: {}".format(output_str)) + tokens = re.split('[@#]', self.tested_reference_str) + require_version = tokens[0].split("/", 1)[1] + self.output.info("Expected version: {}".format(require_version)) + assert_cmake_version = "cmake version %s" % require_version + assert(assert_cmake_version in output_str) diff --git a/recipes/cmake/config.yml b/recipes/cmake/config.yml index 6075464de552da..ccea93393d10dd 100644 --- a/recipes/cmake/config.yml +++ b/recipes/cmake/config.yml @@ -13,3 +13,5 @@ versions: folder: "3.x.x" "3.25.0": folder: "3.x.x" + "3.25.1": + folder: "3.x.x" diff --git a/recipes/coin-utils/all/conandata.yml b/recipes/coin-utils/all/conandata.yml index 53efde04b8eaaf..66e5f00bfc3438 100644 --- a/recipes/coin-utils/all/conandata.yml +++ b/recipes/coin-utils/all/conandata.yml @@ -2,7 +2,13 @@ sources: "2.11.4": url: "https://github.com/coin-or/CoinUtils/archive/releases/2.11.4.tar.gz" sha256: "d4effff4452e73356eed9f889efd9c44fe9cd68bd37b608a5ebb2c58bd45ef81" + "2.11.6": + url: "https://github.com/coin-or/CoinUtils/archive/releases/2.11.6.tar.gz" + sha256: "6ea31d5214f7eb27fa3ffb2bdad7ec96499dd2aaaeb4a7d0abd90ef852fc79ca" patches: "2.11.4": - patch_file: "patches/0001-no-check-pkgconfig.patch" base_path: "source_subfolder" + "2.11.6": + - patch_file: "patches/0001-no-check-pkgconfig.patch" + base_path: "source_subfolder" diff --git a/recipes/coin-utils/config.yml b/recipes/coin-utils/config.yml index 2cbd50d2508a16..0500c349417c7b 100644 --- a/recipes/coin-utils/config.yml +++ b/recipes/coin-utils/config.yml @@ -1,3 +1,5 @@ versions: "2.11.4": folder: "all" + "2.11.6": + folder: "all" diff --git a/recipes/commata/all/conandata.yml b/recipes/commata/all/conandata.yml new file mode 100644 index 00000000000000..9371922d5a0ab6 --- /dev/null +++ b/recipes/commata/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.2.3": + url: "https://github.com/furfurylic/commata/archive/refs/tags/v0.2.3.tar.gz" + sha256: "47521aa27b26fe650bd985c4e07df44453f9d09ab0d61ee98dd6877afe4c25a0" diff --git a/recipes/commata/all/conanfile.py b/recipes/commata/all/conanfile.py new file mode 100644 index 00000000000000..3b9d7e615f7d78 --- /dev/null +++ b/recipes/commata/all/conanfile.py @@ -0,0 +1,66 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os + + +required_conan_version = ">=1.52.0" + + +class CommataConan(ConanFile): + name = "commata" + description = "Just another header-only C++17 CSV parser" + license = "Unlicense" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/furfurylic/commata" + topics = ("csv", "parser", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "7", + "apple-clang": "12", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/commata/all/test_package/CMakeLists.txt b/recipes/commata/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..f69f5f2677dd57 --- /dev/null +++ b/recipes/commata/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(commata REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE commata::commata) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/commata/all/test_package/conanfile.py b/recipes/commata/all/test_package/conanfile.py new file mode 100644 index 00000000000000..e845ae751a3017 --- /dev/null +++ b/recipes/commata/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/commata/all/test_package/test_package.cpp b/recipes/commata/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..5221c81aef9014 --- /dev/null +++ b/recipes/commata/all/test_package/test_package.cpp @@ -0,0 +1,58 @@ +#include +#include + +#include "commata/parse_csv.hpp" + +template +class test_collector +{ + std::vector>>* field_values_; + std::basic_string field_value_; + +public: + using char_type = Ch; + + explicit test_collector( + std::vector>>& field_values) : + field_values_(&field_values) + {} + + void start_record(const Ch* /*record_begin*/) + { + field_values_->emplace_back(); + } + + void update(const Ch* first, const Ch* last) + { + field_value_.append(first, last); + } + + void finalize(const Ch* first, const Ch* last) + { + field_value_.append(first, last); + field_values_->back().emplace_back(); + field_values_->back().back().swap(field_value_); + // field_value_ is cleared here + } + + void end_record(const Ch* /*record_end*/) + {} +}; + +int main(void) { + std::string s = R"(,"col1", col2 ,col3,)" "\r\n" + "\n" + R"( cell10 ,,"cell)" "\r\n" + R"(12","cell""13""","")" "\n"; + + std::stringbuf buf(s); + + std::vector> field_values; + + test_collector collector(field_values); + commata::parse_csv(&buf, collector); + + std::cout << field_values.size() << '\n'; + + return 0; +} diff --git a/recipes/commata/all/test_v1_package/CMakeLists.txt b/recipes/commata/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..be00a8c7f57c71 --- /dev/null +++ b/recipes/commata/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/commata/all/test_v1_package/conanfile.py b/recipes/commata/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/commata/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/commata/config.yml b/recipes/commata/config.yml new file mode 100644 index 00000000000000..cfc2b98c1a462c --- /dev/null +++ b/recipes/commata/config.yml @@ -0,0 +1,3 @@ +versions: + "0.2.3": + folder: all diff --git a/recipes/continuable/all/conandata.yml b/recipes/continuable/all/conandata.yml index b1c9fe04e8ebc8..13887549bde390 100644 --- a/recipes/continuable/all/conandata.yml +++ b/recipes/continuable/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.2.1": + url: "https://github.com/Naios/continuable/archive/4.2.1.tar.gz" + sha256: "19c7c2371c94ec759eac8169dea593703b54057551322b5d682643548c9c0146" "4.2.0": url: "https://github.com/Naios/continuable/archive/4.2.0.tar.gz" sha256: "d85bed930ac19d4b36b23778ad9ae943c2981f7492982bd51dadb89e8908d53f" diff --git a/recipes/continuable/config.yml b/recipes/continuable/config.yml index 71d2cb6211de66..52fa67bcd41e8a 100644 --- a/recipes/continuable/config.yml +++ b/recipes/continuable/config.yml @@ -1,4 +1,6 @@ versions: + "4.2.1": + folder: all "4.2.0": folder: all "4.1.0": diff --git a/recipes/cpp-httplib/all/conandata.yml b/recipes/cpp-httplib/all/conandata.yml index dbdbe18e1b5acd..9d3f0340d9f7b4 100644 --- a/recipes/cpp-httplib/all/conandata.yml +++ b/recipes/cpp-httplib/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.11.4": + url: "https://github.com/yhirose/cpp-httplib/archive/v0.11.4.tar.gz" + sha256: "28f76b875a332fb80972c3212980c963f0a7d2e11a8fe94a8ed0d847b9a2256f" "0.11.3": url: "https://github.com/yhirose/cpp-httplib/archive/v0.11.3.tar.gz" sha256: "799b2daa0441d207f6cd1179ae3a34869722084a434da6614978be1682c1e12d" @@ -17,21 +20,6 @@ sources: "0.10.8": url: "https://github.com/yhirose/cpp-httplib/archive/v0.10.8.tar.gz" sha256: "2959ae3669e34ca8934dfe066cd72fc2bfff44ba53bfc26f3b2cb81ed664ca0d" - "0.10.7": - url: "https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.10.7.tar.gz" - sha256: "f89e2e74f64821f3cd925750dcee5dde7160600b1122e692253a4ebed8e1b1b1" - "0.10.6": - url: "https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.10.6.tar.gz" - sha256: "c9024e1f41881f28ca276f0f35c1916eb34dab8c52b6aa32a3c360d4e40eb440" - "0.10.4": - url: "https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.10.4.tar.gz" - sha256: "7719ff9f309c807dd8a574048764836b6a12bcb7d6ae9e129e7e4289cfdb4bd4" - "0.10.3": - url: "https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.10.3.tar.gz" - sha256: "2c02fe6bca8407fb260944ecca68de367475e7221912b104f882c278b46d4776" - "0.10.1": - url: "https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.10.1.tar.gz" - sha256: "c3fb2019ed77482681b80b9a5d74ddf49df61a024703be1a5379b28fa13dfa2f" "0.9.10": url: "https://github.com/yhirose/cpp-httplib/archive/v0.9.10.tar.gz" sha256: "49dfa101ced75f8536ec7c865f872ab8fca157c8b49e29be5ef2d2aa11f716e8" diff --git a/recipes/cpp-httplib/all/conanfile.py b/recipes/cpp-httplib/all/conanfile.py index 7129662e2807e4..b61cc9bed61d1d 100644 --- a/recipes/cpp-httplib/all/conanfile.py +++ b/recipes/cpp-httplib/all/conanfile.py @@ -12,7 +12,7 @@ class CpphttplibConan(ConanFile): name = "cpp-httplib" description = "A C++11 single-file header-only cross platform HTTP/HTTPS library." license = "MIT" - topics = ("cpp-httplib", "http", "https", "header-only") + topics = ("http", "https", "header-only") homepage = "https://github.com/yhirose/cpp-httplib" url = "https://github.com/conan-io/conan-center-index" diff --git a/recipes/cpp-httplib/all/test_v1_package/CMakeLists.txt b/recipes/cpp-httplib/all/test_v1_package/CMakeLists.txt index 72809bb080c2cd..be00a8c7f57c71 100644 --- a/recipes/cpp-httplib/all/test_v1_package/CMakeLists.txt +++ b/recipes/cpp-httplib/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(httplib REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE httplib::httplib) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/cpp-httplib/config.yml b/recipes/cpp-httplib/config.yml index 7b7f02579048ef..6960c85b0ed81d 100644 --- a/recipes/cpp-httplib/config.yml +++ b/recipes/cpp-httplib/config.yml @@ -1,4 +1,6 @@ versions: + "0.11.4": + folder: all "0.11.3": folder: all "0.11.2": @@ -11,16 +13,6 @@ versions: folder: all "0.10.8": folder: all - "0.10.7": - folder: all - "0.10.6": - folder: all - "0.10.4": - folder: all - "0.10.3": - folder: all - "0.10.1": - folder: all "0.9.10": folder: all "0.8.9": diff --git a/recipes/cpp-sort/all/conandata.yml b/recipes/cpp-sort/all/conandata.yml index 75a1298f3e54ef..092fe59db4a196 100644 --- a/recipes/cpp-sort/all/conandata.yml +++ b/recipes/cpp-sort/all/conandata.yml @@ -1,31 +1,34 @@ sources: + "1.14.0": + url: "https://github.com/Morwenn/cpp-sort/archive/1.14.0.tar.gz" + sha256: "3b85cd4580f54ae3f171777d0630b4f7c89c33cf96e9ae24a1dbebbf200c3195" "1.13.2": - sha256: f5384ed9c8abef2f26cb010df2687ac8bba52f0e1726935826a80e83c1347b23 - url: https://github.com/Morwenn/cpp-sort/archive/1.13.2.tar.gz + url: "https://github.com/Morwenn/cpp-sort/archive/1.13.2.tar.gz" + sha256: "f5384ed9c8abef2f26cb010df2687ac8bba52f0e1726935826a80e83c1347b23" "1.13.1": - sha256: 139912c6004df8748bb1cfd3b94f2c6bfc2713885ed4b8e927a783d6b66963a8 - url: https://github.com/Morwenn/cpp-sort/archive/1.13.1.tar.gz + url: "https://github.com/Morwenn/cpp-sort/archive/1.13.1.tar.gz" + sha256: "139912c6004df8748bb1cfd3b94f2c6bfc2713885ed4b8e927a783d6b66963a8" "1.13.0": - sha256: 646eca5c592d20cbde0fbff41c65527940bb6430be68e0224fb5fcbf38b0df92 - url: https://github.com/Morwenn/cpp-sort/archive/1.13.0.tar.gz + url: "https://github.com/Morwenn/cpp-sort/archive/1.13.0.tar.gz" + sha256: "646eca5c592d20cbde0fbff41c65527940bb6430be68e0224fb5fcbf38b0df92" "1.12.1": - sha256: 5b0b6f3b4d9ecc339d6c2204a18479edca49fbc4d487413e0ec747e143569e2a - url: https://github.com/Morwenn/cpp-sort/archive/1.12.1.tar.gz + url: "https://github.com/Morwenn/cpp-sort/archive/1.12.1.tar.gz" + sha256: "5b0b6f3b4d9ecc339d6c2204a18479edca49fbc4d487413e0ec747e143569e2a" "1.12.0": - sha256: 70877c1993fa1e5eb53974ac30aeb713448c206344379f193dec8ee887c23998 - url: https://github.com/Morwenn/cpp-sort/archive/1.12.0.tar.gz + url: "https://github.com/Morwenn/cpp-sort/archive/1.12.0.tar.gz" + sha256: "70877c1993fa1e5eb53974ac30aeb713448c206344379f193dec8ee887c23998" "1.11.0": - sha256: a53b3ea240d6f8d8ea9da0a7e0c8e313cf5e714daedf1617473ab34f111ffeec - url: https://github.com/Morwenn/cpp-sort/archive/1.11.0.tar.gz + url: "https://github.com/Morwenn/cpp-sort/archive/1.11.0.tar.gz" + sha256: "a53b3ea240d6f8d8ea9da0a7e0c8e313cf5e714daedf1617473ab34f111ffeec" "1.10.0": - sha256: 48951cac0051d48fee286c3bc02804975f9d83269d80c10dfc5589e76a542765 - url: https://github.com/Morwenn/cpp-sort/archive/1.10.0.tar.gz + url: "https://github.com/Morwenn/cpp-sort/archive/1.10.0.tar.gz" + sha256: "48951cac0051d48fee286c3bc02804975f9d83269d80c10dfc5589e76a542765" "1.9.0": - sha256: e83f3daad30bd91fed668bdb56ad379c4aeea39d7dc640484fdcc55149b6d0e4 - url: https://github.com/Morwenn/cpp-sort/archive/1.9.0.tar.gz + url: "https://github.com/Morwenn/cpp-sort/archive/1.9.0.tar.gz" + sha256: "e83f3daad30bd91fed668bdb56ad379c4aeea39d7dc640484fdcc55149b6d0e4" "1.8.1": - sha256: 04d518dabb422614fcb4a2b4e258c515f31dd01d51c26e9eaaec76e77c4d3d40 - url: https://github.com/Morwenn/cpp-sort/archive/1.8.1.tar.gz + url: "https://github.com/Morwenn/cpp-sort/archive/1.8.1.tar.gz" + sha256: "04d518dabb422614fcb4a2b4e258c515f31dd01d51c26e9eaaec76e77c4d3d40" "1.8.0": sha256: a3de426a66cffbe9f8865feb7518ff4f4d1b3aadf3725161b8e118dcbf6fe9b9 url: https://github.com/Morwenn/cpp-sort/archive/1.8.0.tar.gz diff --git a/recipes/cpp-sort/all/conanfile.py b/recipes/cpp-sort/all/conanfile.py index 881a2c63d61be7..cfda199bf6a781 100644 --- a/recipes/cpp-sort/all/conanfile.py +++ b/recipes/cpp-sort/all/conanfile.py @@ -5,7 +5,7 @@ from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import copy, get, rmdir -from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.microsoft import is_msvc from conan.tools.scm import Version required_conan_version = ">=1.50.0" @@ -14,12 +14,12 @@ class CppSortConan(ConanFile): name = "cpp-sort" description = "Additional sorting algorithms & related tools" - topics = "cpp-sort", "sorting", "algorithms" + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/Morwenn/cpp-sort" - license = "MIT" + topics = "cpp-sort", "sorting", "algorithms" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - settings = "os", "compiler", "build_type", "arch" @property def _minimum_cpp_standard(self): @@ -28,6 +28,8 @@ def _minimum_cpp_standard(self): @property def _compilers_minimum_version(self): return { + "Visual Studio": "16", + "msvc": "192", "apple-clang": "9.4", "clang": "3.8", "gcc": "5.5" @@ -36,29 +38,37 @@ def _compilers_minimum_version(self): def layout(self): cmake_layout(self, src_folder="src") + def package_id(self): + self.info.clear() + def validate(self): if self.settings.get_safe("compiler.cppstd"): check_min_cppstd(self, self._minimum_cpp_standard) - if is_msvc(self): - if Version(self.version) < "1.10.0": - raise ConanInvalidConfiguration("cpp-sort versions older than 1.10.0 do not support MSVC") - check_min_vs(self, 192) - return + if is_msvc(self) and Version(self.version) < "1.10.0": + raise ConanInvalidConfiguration(f"{self.ref} versions older than 1.10.0 do not support MSVC") + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] - compiler = self.settings.compiler + compiler = str(self.settings.compiler) + version = str(self.settings.compiler.version) try: - min_version = self._compilers_minimum_version[str(compiler)] - if Version(compiler.version) < min_version: + minimum_version = self._compilers_minimum_version[str(compiler)] + if minimum_version and loose_lt_semver(version, minimum_version): msg = ( - "{} requires C++{} features which are not supported by compiler {} {}." - ).format(self.name, self._minimum_cpp_standard, compiler, compiler.version) + f"{self.ref} requires C++{self._minimum_cpp_standard} features " + f"which are not supported by compiler {compiler} {version}." + ) raise ConanInvalidConfiguration(msg) except KeyError: msg = ( - "{} recipe lacks information about the {} compiler, " - "support for the required C++{} features is assumed" - ).format(self.name, compiler, self._minimum_cpp_standard) + f"{self.ref} recipe lacks information about the {compiler} compiler, " + f"support for the required C++{self._minimum_cpp_standard} features is assumed" + ) self.output.warn(msg) def source(self): @@ -87,10 +97,9 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "lib")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "cpp-sort" - self.cpp_info.names["cmake_find_package_multi"] = "cpp-sort" - if self.settings.compiler == "Visual Studio": + self.cpp_info.set_property("cmake_file_name", "cpp-sort") + self.cpp_info.set_property("cmake_target_name", "cpp-sort::cpp-sort") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + if is_msvc(self): self.cpp_info.cxxflags = ["/permissive-"] - - def package_id(self): - self.info.clear() diff --git a/recipes/cpp-sort/all/test_package/CMakeLists.txt b/recipes/cpp-sort/all/test_package/CMakeLists.txt index fe9c658362ade3..da13330ac49af6 100644 --- a/recipes/cpp-sort/all/test_package/CMakeLists.txt +++ b/recipes/cpp-sort/all/test_package/CMakeLists.txt @@ -5,5 +5,5 @@ project(test_package LANGUAGES CXX) find_package(cpp-sort REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} cpp-sort-integrity.cpp) -target_link_libraries(${CMAKE_PROJECT_NAME} cpp-sort::cpp-sort) -set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 14) +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE cpp-sort::cpp-sort) +target_compile_features(${CMAKE_PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/cpp-sort/all/test_v1_package/CMakeLists.txt b/recipes/cpp-sort/all/test_v1_package/CMakeLists.txt index 4ebb96b60a2931..2a9b48732268c7 100644 --- a/recipes/cpp-sort/all/test_v1_package/CMakeLists.txt +++ b/recipes/cpp-sort/all/test_v1_package/CMakeLists.txt @@ -1,12 +1,9 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(cpp-sort REQUIRED CONFIG) - -add_executable(${CMAKE_PROJECT_NAME} cpp-sort-integrity.cpp) -target_link_libraries(${CMAKE_PROJECT_NAME} cpp-sort::cpp-sort) -set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 14) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/cpp-sort/all/test_v1_package/cpp-sort-integrity.cpp b/recipes/cpp-sort/all/test_v1_package/cpp-sort-integrity.cpp deleted file mode 100644 index 05f269569147f2..00000000000000 --- a/recipes/cpp-sort/all/test_v1_package/cpp-sort-integrity.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2018-2020 Morwenn. - * - * SPDX-License-Identifier: MIT - */ -#include -#include -#include -#include -#include - -int main() -{ - int arr[] = { 5, 8, 3, 2, 9 }; - cppsort::smooth_sort(arr); - assert(std::is_sorted(std::begin(arr), std::end(arr))); - - // should print 2 3 5 8 9 - for (int val: arr) { - std::cout << val << ' '; - } -} diff --git a/recipes/cpp-sort/config.yml b/recipes/cpp-sort/config.yml index 55b2c50d93416f..c097db627e4151 100644 --- a/recipes/cpp-sort/config.yml +++ b/recipes/cpp-sort/config.yml @@ -1,4 +1,6 @@ versions: + "1.14.0": + folder: all "1.13.2": folder: all "1.13.1": diff --git a/recipes/cppcheck/all/conandata.yml b/recipes/cppcheck/all/conandata.yml index d97f5c1a31a95d..43c1f6aca7810e 100644 --- a/recipes/cppcheck/all/conandata.yml +++ b/recipes/cppcheck/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.9.3": + url: "https://github.com/danmar/cppcheck/archive/2.9.3.tar.gz" + sha256: "46319ca73e33e4b2bd91981a76a0d4f184cd3f86b62dc18e8938eabacd3ad2e3" "2.9.2": url: "https://github.com/danmar/cppcheck/archive/2.9.2.tar.gz" sha256: "93920d24d4442856bf7916ee0e3fc31308bc23948e7029b4fd332e01cac63c3e" @@ -9,6 +12,16 @@ sources: url: "https://github.com/danmar/cppcheck/archive/2.7.5.tar.gz" sha256: "6c7ac29e57fa8b3ac7be224510200e579d5a90217e2152591ef46ffc947d8f78" patches: + "2.9.3": + - patch_file: "patches/0001-cli-remove-dmake-cmake.patch" + patch_description: "Remove dmake tool from target ALL" + patch_type: "portability" + - patch_file: "patches/0002-htmlreport-python3.patch" + patch_description: "Use Python 3 in Shebang Header" + patch_type: "portability" + - patch_file: "patches/0003-pcre-debuglib-name.patch" + patch_description: "Consider the Debug suffix for Windows" + patch_type: "portability" "2.9.2": - patch_file: "patches/0001-cli-remove-dmake-cmake.patch" patch_description: "Remove dmake tool from target ALL" diff --git a/recipes/cppcheck/config.yml b/recipes/cppcheck/config.yml index bc6d13a4fc4ca3..ec0fd43bf08caf 100644 --- a/recipes/cppcheck/config.yml +++ b/recipes/cppcheck/config.yml @@ -1,4 +1,6 @@ versions: + "2.9.3": + folder: all "2.9.2": folder: all "2.8.2": diff --git a/recipes/cppfront/all/conandata.yml b/recipes/cppfront/all/conandata.yml index 9256a02f34f3ac..3db3937d63c0d5 100644 --- a/recipes/cppfront/all/conandata.yml +++ b/recipes/cppfront/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "cci.20230103": + url: "https://github.com/hsutter/cppfront/archive/808db2bd6ae92f869166827dfda66cfa42dde0ab.zip" + sha256: "479252c99d66db477c4cd98a6e1707a8929a70afdf000c75589841d944c539f4" "cci.20221024": url: "https://github.com/hsutter/cppfront/archive/b1754dbd53a496a9104b43ecde6064c9980246bd.zip" sha256: "8668bddbd7fc06d4975c867521c005f898eca8f83f018e7c28b54dbcf9aa3ab9" diff --git a/recipes/cppfront/config.yml b/recipes/cppfront/config.yml index 58e5c15a9b457a..50c5629b6e0252 100644 --- a/recipes/cppfront/config.yml +++ b/recipes/cppfront/config.yml @@ -1,4 +1,6 @@ versions: + "cci.20230103": + folder: all "cci.20221024": folder: all "cci.20220924": diff --git a/recipes/cpr/all/CMakeLists.txt b/recipes/cpr/all/CMakeLists.txt deleted file mode 100644 index f00dad984610f9..00000000000000 --- a/recipes/cpr/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -if(WIN32 AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif() - -add_subdirectory(source_subfolder) diff --git a/recipes/cpr/all/conandata.yml b/recipes/cpr/all/conandata.yml index d7338e66daa308..b89a362a8deb44 100644 --- a/recipes/cpr/all/conandata.yml +++ b/recipes/cpr/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.9.3": + url: "https://github.com/libcpr/cpr/archive/refs/tags/1.9.3.tar.gz" + sha256: "df53e7213d80fdc24583528521f7d3349099f5bb4ed05ab05206091a678cc53c" "1.9.0": url: "https://github.com/libcpr/cpr/archive/refs/tags/1.9.0.tar.gz" sha256: "67023cde8979e8371f5ee7d6e586d6d0761af4a3a3a3be6270256353c9bf411f" @@ -18,29 +21,43 @@ sources: url: "https://github.com/libcpr/cpr/archive/1.4.0.tar.gz" sha256: "13baffba95445e02291684e31906b04df41d8c6a3020a1a55253047c6756a004" patches: + "1.9.3": + - patch_file: "patches/005-1.9.3-fix-curl-components.patch" + patch_description: "use cci package" + patch_type: "conan" "1.9.0": - patch_file: "patches/005-1.9.0-fix-curl-components.patch" - base_path: "source_subfolder" + patch_description: "use cci package" + patch_type: "conan" "1.8.1": - patch_file: "patches/005-1.8.1-fix-curl-components.patch" - base_path: "source_subfolder" + patch_description: "use cci package" + patch_type: "conan" - patch_file: "patches/007-fix-dll-install.patch" - base_path: "source_subfolder" + patch_description: "fix install path for dll" + patch_type: "conan" "1.7.2": - patch_file: "patches/005-1.7.2-fix-curl-components.patch" - base_path: "source_subfolder" + patch_description: "use cci package" + patch_type: "conan" - patch_file: "patches/007-fix-dll-install.patch" - base_path: "source_subfolder" + patch_description: "fix install path for dll" + patch_type: "conan" "1.6.2": - patch_file: "patches/005-1.6.2-fix-curl-components.patch" - base_path: "source_subfolder" + patch_description: "use cci package" + patch_type: "conan" "1.5.2": - patch_file: "patches/005-1.5.2-fix-curl-components.patch" - base_path: "source_subfolder" + patch_description: "use cci package" + patch_type: "conan" "1.4.0": - patch_file: "patches/002-1.4.0-create-install.patch" - base_path: "source_subfolder" + patch_description: "add install definition" + patch_type: "conan" - patch_file: "patches/003-1.4.0-curl-use-target.patch" - base_path: "source_subfolder" + patch_description: "link curl library as target name" + patch_type: "portability" - patch_file: "patches/004-1.4.0-curl-global-scope.patch" - base_path: "source_subfolder" + patch_description: "use cci package" + patch_type: "conan" diff --git a/recipes/cpr/all/conanfile.py b/recipes/cpr/all/conanfile.py index 90958d55211c79..e22134e21d95ee 100644 --- a/recipes/cpr/all/conanfile.py +++ b/recipes/cpr/all/conanfile.py @@ -1,11 +1,14 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -from conan.tools.microsoft import is_msvc +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version import os -import functools -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class CprConan(ConanFile): @@ -33,62 +36,49 @@ class CprConan(ConanFile): "signal": 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 _supports_openssl(self): # https://github.com/libcpr/cpr/commit/b036a3279ba62720d1e43362d32202bf412ea152 # https://github.com/libcpr/cpr/releases/tag/1.5.0 - return tools.Version(self.version) >= "1.5.0" and not tools.is_apple_os(self.settings.os) + return Version(self.version) >= "1.5.0" and not is_apple_os(self) @property def _supports_winssl(self): # https://github.com/libcpr/cpr/commit/18e1fc5c3fc0ffc07695f1d78897fb69e7474ea9 # https://github.com/libcpr/cpr/releases/tag/1.5.1 - return tools.Version(self.version) >= "1.5.1" and self.settings.os == "Windows" + return Version(self.version) >= "1.5.1" and self.settings.os == "Windows" @property def _supports_darwinssl(self): # https://github.com/libcpr/cpr/releases/tag/1.6.1 - return tools.Version(self.version) >= "1.6.1" and tools.is_apple_os(self.settings.os) + return Version(self.version) >= "1.6.1" and is_apple_os(self.settings.os) @property def _can_auto_ssl(self): # https://github.com/libcpr/cpr/releases/tag/1.6.0 return not self._uses_old_cmake_options and not ( # https://github.com/libcpr/cpr/issues/546 - tools.Version(self.version) in ["1.6.0", "1.6.1"] - and tools.is_apple_os(self.settings.os) + Version(self.version) in ["1.6.0", "1.6.1"] + and is_apple_os(self.settings.os) ) @property def _uses_old_cmake_options(self): # https://github.com/libcpr/cpr/releases/tag/1.6.0 - return tools.Version(self.version) < "1.6.0" + return Version(self.version) < "1.6.0" @property def _uses_valid_abi_and_compiler(self): # https://github.com/conan-io/conan-center-index/pull/5194#issuecomment-821908385 return not ( - tools.Version(self.version) >= "1.6.0" + Version(self.version) >= "1.6.0" and self.settings.compiler == "clang" and self.settings.compiler.libcxx == "libstdc++" - and tools.Version(self.settings.compiler.version) < "9" + and Version(self.settings.compiler.version) < "9" ) 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": @@ -105,10 +95,30 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("libcurl/7.80.0") + self.requires("libcurl/7.86.0") + + # Check if the system supports the given ssl library + def _supports_ssl_library(self, library): + if library == CprConan._NO_SSL: + return True + elif library == CprConan._AUTO_SSL: + return self._can_auto_ssl + + validators = { + "openssl": self._supports_openssl, + "darwinssl": self._supports_darwinssl, + "winssl": self._supports_winssl, + CprConan._AUTO_SSL: self._can_auto_ssl + } + + # A KeyError should never happen, as the options are validated by conan. + return validators[library] def validate(self): SSL_FAILURE_MESSAGES = { @@ -119,34 +129,35 @@ def validate(self): } if not self._uses_valid_abi_and_compiler: - raise ConanInvalidConfiguration("Cannot compile cpr/1.6.0 with libstdc++ on clang < 9") + raise ConanInvalidConfiguration(f"Cannot compile {self.ref} with libstdc++ on clang < 9") - ssl_library = str(self.options.get_safe("with_ssl")) + ssl_library = str(self.options.with_ssl) if not self._supports_ssl_library(ssl_library): raise ConanInvalidConfiguration( - "Invalid SSL selection for the given configuration: {}".format(SSL_FAILURE_MESSAGES[ssl_library]) + f"Invalid SSL selection for the given configuration: {SSL_FAILURE_MESSAGES[ssl_library]}" if ssl_library in SSL_FAILURE_MESSAGES - else "Invalid value of ssl option, {}".format(ssl_library) + else f"Invalid value of ssl option, {ssl_library}" ) if ssl_library not in (CprConan._AUTO_SSL, CprConan._NO_SSL, "winssl") and ssl_library != self.options["libcurl"].with_ssl: - raise ConanInvalidConfiguration("cpr requires libcurl to be built with the option with_ssl='{}'.".format(self.options.get_safe('with_ssl'))) + raise ConanInvalidConfiguration( + f"{self.ref}:with_ssl={self.options.with_ssl} requires libcurl:with_ssl={self.options.with_ssl}" + ) if ssl_library == "winssl" and self.options["libcurl"].with_ssl != "schannel": - raise ConanInvalidConfiguration("cpr requires libcurl to be built with the option with_ssl='schannel'") + raise ConanInvalidConfiguration( + f"{self.ref}:with_ssl=winssl requires libcurl:with_ssl=schannel" + ) - if is_msvc(self) and self.options.shared and "MT" in self.settings.compiler.runtime: + if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self): raise ConanInvalidConfiguration("Visual Studio build for shared library with MT runtime is not supported") - if tools.Version(self.version) == "1.9.0" and self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "6": - raise ConanInvalidConfiguration("{}/{} doesn't support gcc < 6".format(self.name, self.version)) + if Version(self.version) >= "1.9.0" and self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "6": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support gcc < 6") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def _get_cmake_option(self, option): CPR_1_6_CMAKE_OPTIONS_TO_OLD = { @@ -165,15 +176,13 @@ def _get_cmake_option(self, option): else: return option - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions[self._get_cmake_option("CPR_FORCE_USE_SYSTEM_CURL")] = True - cmake.definitions[self._get_cmake_option("CPR_BUILD_TESTS")] = False - cmake.definitions[self._get_cmake_option("CPR_GENERATE_COVERAGE")] = False - cmake.definitions[self._get_cmake_option("CPR_USE_SYSTEM_GTEST")] = False - cmake.definitions["CPR_CURL_NOSIGNAL"] = not self.options.signal - + def generate(self): + tc = CMakeToolchain(self) + tc.variables[self._get_cmake_option("CPR_FORCE_USE_SYSTEM_CURL")] = True + tc.variables[self._get_cmake_option("CPR_BUILD_TESTS")] = False + tc.variables[self._get_cmake_option("CPR_GENERATE_COVERAGE")] = False + tc.variables[self._get_cmake_option("CPR_USE_SYSTEM_GTEST")] = False + tc.variables["CPR_CURL_NOSIGNAL"] = not self.options.signal ssl_value = str(self.options.get_safe("with_ssl")) SSL_OPTIONS = { "CPR_FORCE_DARWINSSL_BACKEND": ssl_value == "darwinssl", @@ -181,60 +190,39 @@ def _configure_cmake(self): "CPR_FORCE_WINSSL_BACKEND": ssl_value == "winssl", "CMAKE_USE_OPENSSL": ssl_value == "openssl" } - for cmake_option, value in SSL_OPTIONS.items(): - cmake.definitions[self._get_cmake_option(cmake_option)] = value - + tc.variables[self._get_cmake_option(cmake_option)] = value # If we are on a version where disabling SSL requires a cmake option, disable it if not self._uses_old_cmake_options and str(self.options.get_safe("with_ssl")) == CprConan._NO_SSL: - cmake.definitions["CPR_ENABLE_SSL"] = False - - if hasattr(self, "settings_build") and cross_building(self, skip_x64_x86=True): - cmake.definitions["THREAD_SANITIZER_AVAILABLE_EXITCODE"] = 1 - cmake.definitions["THREAD_SANITIZER_AVAILABLE_EXITCODE__TRYRUN_OUTPUT"] = 1 - cmake.definitions["ADDRESS_SANITIZER_AVAILABLE_EXITCODE"] = 1 - cmake.definitions["ADDRESS_SANITIZER_AVAILABLE_EXITCODE__TRYRUN_OUTPUT"] = 1 - cmake.definitions["ALL_SANITIZERS_AVAILABLE_EXITCODE"] = 1 - cmake.definitions["ALL_SANITIZERS_AVAILABLE_EXITCODE__TRYRUN_OUTPUT"] = 1 - - cmake.configure(build_folder=self._build_subfolder) - return cmake - - # Check if the system supports the given ssl library - def _supports_ssl_library(self, library): - if library == CprConan._NO_SSL: - return True - elif library == CprConan._AUTO_SSL: - return self._can_auto_ssl - - validators = { - "openssl": self._supports_openssl, - "darwinssl": self._supports_darwinssl, - "winssl": self._supports_winssl, - CprConan._AUTO_SSL: self._can_auto_ssl - } - - # A KeyError should never happen, as the options are validated by conan. - return validators[library] + tc.variables["CPR_ENABLE_SSL"] = False + if cross_building(self, skip_x64_x86=True): + tc.variables["THREAD_SANITIZER_AVAILABLE_EXITCODE"] = 1 + tc.variables["THREAD_SANITIZER_AVAILABLE_EXITCODE__TRYRUN_OUTPUT"] = 1 + tc.variables["ADDRESS_SANITIZER_AVAILABLE_EXITCODE"] = 1 + tc.variables["ADDRESS_SANITIZER_AVAILABLE_EXITCODE__TRYRUN_OUTPUT"] = 1 + tc.variables["ALL_SANITIZERS_AVAILABLE_EXITCODE"] = 1 + tc.variables["ALL_SANITIZERS_AVAILABLE_EXITCODE__TRYRUN_OUTPUT"] = 1 + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + 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(pattern="LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "cpr") + self.cpp_info.set_property("cmake_target_name", "cpr::cpr") self.cpp_info.libs = ["cpr"] - if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") - - self.cpp_info.set_property("cmake_target_name", "cpr::cpr") - - self.cpp_info.names["cmake_find_package"] = "cpr" - self.cpp_info.names["cmake_find_package_multi"] = "cpr" diff --git a/recipes/cpr/all/patches/003-1.4.0-curl-use-target.patch b/recipes/cpr/all/patches/003-1.4.0-curl-use-target.patch index 8c5c37a715199a..61ba93886b977b 100644 --- a/recipes/cpr/all/patches/003-1.4.0-curl-use-target.patch +++ b/recipes/cpr/all/patches/003-1.4.0-curl-use-target.patch @@ -9,7 +9,7 @@ index c4f9b5b..7e2279d 100644 message(STATUS "Using CURL_LIBRARIES: ${CURL_LIBRARIES}.") -target_link_libraries(${CPR_LIBRARIES} - ${CURL_LIBRARIES}) -+target_link_libraries(cpr PUBLIC CURL::CURL) ++target_link_libraries(cpr PUBLIC CURL::libcurl) include(GNUInstallDirs) install(TARGETS cpr diff --git a/recipes/cpr/all/patches/005-1.9.3-fix-curl-components.patch b/recipes/cpr/all/patches/005-1.9.3-fix-curl-components.patch new file mode 100644 index 00000000000000..dee08272019c76 --- /dev/null +++ b/recipes/cpr/all/patches/005-1.9.3-fix-curl-components.patch @@ -0,0 +1,21 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index 0c10971..9627982 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -150,6 +150,8 @@ endif() + + # Curl configuration + if(CPR_FORCE_USE_SYSTEM_CURL) ++ find_package(CURL REQUIRED) ++ if(0) + if(CPR_ENABLE_SSL) + find_package(CURL COMPONENTS HTTP HTTPS) + if(CURL_FOUND) +@@ -174,6 +176,7 @@ if(CPR_FORCE_USE_SYSTEM_CURL) + message(FATAL_ERROR "Curl not found on this system. To use the build in version set CPR_FORCE_USE_SYSTEM_CURL to OFF.") + endif() + endif() ++ endif() + else() + message(STATUS "Configuring build in curl...") + diff --git a/recipes/cpr/all/test_package/CMakeLists.txt b/recipes/cpr/all/test_package/CMakeLists.txt index c003582670c365..f6ae64d3c92613 100644 --- a/recipes/cpr/all/test_package/CMakeLists.txt +++ b/recipes/cpr/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(cpr REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} cpr::cpr) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE cpr::cpr) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/cpr/all/test_package/conanfile.py b/recipes/cpr/all/test_package/conanfile.py index 2490acfa82ff81..98ab55852ad565 100644 --- a/recipes/cpr/all/test_package/conanfile.py +++ b/recipes/cpr/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", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -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/cpr/all/test_v1_package/CMakeLists.txt b/recipes/cpr/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/cpr/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cpr/all/test_v1_package/conanfile.py b/recipes/cpr/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/cpr/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/cpr/config.yml b/recipes/cpr/config.yml index 3ceff74829cd98..d3e1bfcad9ced4 100644 --- a/recipes/cpr/config.yml +++ b/recipes/cpr/config.yml @@ -1,4 +1,6 @@ versions: + "1.9.3": + folder: all "1.9.0": folder: all "1.8.1": diff --git a/recipes/cryptopp/all/conanfile.py b/recipes/cryptopp/all/conanfile.py index f4a34568ef0e2b..b83ed6c1a84a1b 100644 --- a/recipes/cryptopp/all/conanfile.py +++ b/recipes/cryptopp/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import apply_conandata_patches, collect_libs, copy, get, rename, replace_in_file, rmdir, save from conan.tools.scm import Version -from conans import tools as tools_legacy + import os import textwrap @@ -36,9 +36,20 @@ def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output) + m = re.search(r'cmake version (\d+\.\d+\.\d+)', output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False + def build_requirements(self): - if Version(self.version) >= "8.7.0": - self.tool_requires("cmake/3.24.0") + if Version(self.version) >= "8.7.0" and not self._cmake_new_enough("3.20"): + self.tool_requires("cmake/3.20.6") def validate(self): if self.options.shared and Version(self.version) >= "8.7.0": @@ -100,8 +111,10 @@ def generate(self): def _patch_sources(self): apply_conandata_patches(self) # Use cpu-features.h from Android NDK - if self.settings.os == "Android": - android_ndk_home = tools_legacy.get_env("ANDROID_NDK_HOME") + if self.settings.os == "Android" and Version(self.version) < "8.4.0": + # Replicate logic from: https://github.com/weidai11/cryptopp/blob/CRYPTOPP_8_2_0/cpu.cpp#L46-L52 + # In more recent versions this is already taken care of by cryptopp-cmake + android_ndk_home = self.conf.get("tools.android:ndk_path") if android_ndk_home: copy( self, diff --git a/recipes/cs_libguarded/all/conandata.yml b/recipes/cs_libguarded/all/conandata.yml index 7054b1c7f8dac5..9814b7bca2929c 100644 --- a/recipes/cs_libguarded/all/conandata.yml +++ b/recipes/cs_libguarded/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.0": + url: "https://github.com/copperspice/cs_libguarded/archive/libguarded-1.3.0.tar.gz" + sha256: "4059db286bb6386faa748cdcdb53c0e5ce785ca3644fb4a01410011b8ea97be2" "1.1.0": - url: https://github.com/copperspice/cs_libguarded/archive/libguarded-1.1.0.tar.gz - sha256: ad51992e5a8ba29ce55e7bd6dfb653f4b483a52edf07806871e8b15e67278af3 + url: "https://github.com/copperspice/cs_libguarded/archive/libguarded-1.1.0.tar.gz" + sha256: "ad51992e5a8ba29ce55e7bd6dfb653f4b483a52edf07806871e8b15e67278af3" diff --git a/recipes/cs_libguarded/all/conanfile.py b/recipes/cs_libguarded/all/conanfile.py index 1be2009a9320aa..39578ddadb4233 100644 --- a/recipes/cs_libguarded/all/conanfile.py +++ b/recipes/cs_libguarded/all/conanfile.py @@ -1,25 +1,102 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -from conans import ConanFile, tools +required_conan_version = ">=1.52.0" class CsLibguardedConan(ConanFile): name = "cs_libguarded" + description = "The libGuarded library is a standalone header-only library for multithreaded programming." license = "BSD-2-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/copperspice/libguarded" - description = "The libGuarded library is a standalone header-only library for multithreaded programming." - topics = ("multithreading", "templates", "cpp14", "mutexes") + topics = ("multithreading", "templates", "cpp14", "mutexes", "header-only") + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 14 if Version(self.version) < "1.3" else 17 + + @property + def _compilers_minimum_version(self): + if Version(self.version) < "1.3": + return { + "Visual Studio": "15.2", + "msvc": "191", + "gcc": "5", + "clang": "5", + "apple-clang": "5", + } + else: + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "7", + "apple-clang": "12", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + compiler = str(self.settings.compiler) + version = str(self.settings.compiler.version) + + minimum_version = self._compilers_minimum_version.get(compiler, False) + if minimum_version and loose_lt_semver(version, minimum_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler ({compiler}-{version}) does not support") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "cs_libguarded-libguarded-" + self.version - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def package(self): - self.copy("*.hpp", dst='include', src=os.path.join(self._source_subfolder, "src")) - 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 Version(self.version) < "1.3": + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "src"), + ) + else: + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include", "CsLibGuarded"), + src=os.path.join(self.source_folder, "src"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + if Version(self.version) >= "1.3": + self.cpp_info.includedirs.append(os.path.join("include", "CsLibGuarded")) + + self.cpp_info.set_property("cmake_file_name", "CsLibGuarded") + self.cpp_info.set_property("cmake_target_name", "CsLibGuarded::CsLibGuarded") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "CsLibGuarded" + self.cpp_info.filenames["cmake_find_package_multi"] = "CsLibGuarded" + self.cpp_info.names["cmake_find_package"] = "CsLibGuarded" + self.cpp_info.names["cmake_find_package_multi"] = "CsLibGuarded" diff --git a/recipes/cs_libguarded/all/test_package/CMakeLists.txt b/recipes/cs_libguarded/all/test_package/CMakeLists.txt index 406c687ef37e1e..d5463ebc7c858e 100644 --- a/recipes/cs_libguarded/all/test_package/CMakeLists.txt +++ b/recipes/cs_libguarded/all/test_package/CMakeLists.txt @@ -1,9 +1,15 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +add_executable(${PROJECT_NAME} test_package.cpp) -add_executable(main main.cpp) -target_link_libraries(main ${CONAN_LIBS}) -set_property(TARGET main PROPERTY CXX_STANDARD 11) +find_package(cs_libguarded CONFIG) +if (cs_libguarded_FOUND) + target_link_libraries(${PROJECT_NAME} PRIVATE cs_libguarded::cs_libguarded) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +else() + find_package(CsLibGuarded REQUIRED CONFIG) + target_link_libraries(${PROJECT_NAME} PRIVATE CsLibGuarded::CsLibGuarded) + target_compile_definitions(${PROJECT_NAME} PRIVATE CS_LIBGUARDED_1_3_0_LATER) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() diff --git a/recipes/cs_libguarded/all/test_package/conanfile.py b/recipes/cs_libguarded/all/test_package/conanfile.py index 19d05dfdde2b7b..e845ae751a3017 100644 --- a/recipes/cs_libguarded/all/test_package/conanfile.py +++ b/recipes/cs_libguarded/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools - class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - self.run(os.path.join("bin", "main"), 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/cs_libguarded/all/test_package/main.cpp b/recipes/cs_libguarded/all/test_package/main.cpp deleted file mode 100644 index 6cd1ecd9307c28..00000000000000 --- a/recipes/cs_libguarded/all/test_package/main.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include -#include - -int main() { - libguarded::guarded g; - *g.lock() = 42; - return 0; -} diff --git a/recipes/cs_libguarded/all/test_package/test_package.cpp b/recipes/cs_libguarded/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..9befabd77ff2c8 --- /dev/null +++ b/recipes/cs_libguarded/all/test_package/test_package.cpp @@ -0,0 +1,16 @@ +#include +#ifndef CS_LIBGUARDED_1_3_0_LATER + #include +#else + #include +#endif + +int main() { +#ifndef CS_LIBGUARDED_1_3_0_LATER + libguarded::guarded g; +#else + libguarded::plain_guarded g; +#endif + *g.lock() = 42; + return 0; +} diff --git a/recipes/cs_libguarded/all/test_v1_package/CMakeLists.txt b/recipes/cs_libguarded/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/cs_libguarded/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/cs_libguarded/all/test_v1_package/conanfile.py b/recipes/cs_libguarded/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/cs_libguarded/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/cs_libguarded/config.yml b/recipes/cs_libguarded/config.yml index 954a8c5b4d65a2..fcb4297f989840 100644 --- a/recipes/cs_libguarded/config.yml +++ b/recipes/cs_libguarded/config.yml @@ -1,4 +1,5 @@ ---- versions: + "1.3.0": + folder: all "1.1.0": folder: all diff --git a/recipes/csvmonkey/all/conanfile.py b/recipes/csvmonkey/all/conanfile.py index 70c4748ec7036c..49542ed86e55ce 100644 --- a/recipes/csvmonkey/all/conanfile.py +++ b/recipes/csvmonkey/all/conanfile.py @@ -1,56 +1,78 @@ -import os - +from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan import ConanFile, tools +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc +import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class CSVMONEKYConan(ConanFile): name = "csvmonkey" + description = "Header-only vectorized, lazy-decoding, zero-copy CSV file parser" license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" - description = "Header-only vectorized, lazy-decoding, zero-copy CSV file parser " - topics = ("csv-parser", "header-only", "vectorized") homepage = "https://github.com/dw/csvmonkey/" - settings = "arch", "compiler" + topics = ("csv-parser", "header-only", "vectorized") + settings = "os", "arch", "compiler", "build_type" + options = { + "with_spirit": [True, False], + } + default_options = { + "with_spirit": False, + } no_copy_source = True - options = {"with_spirit": [True, False]} - default_options = {"with_spirit": False} @property - def _source_subfolder(self): - return "source_subfolder" - - def validate(self): - if self.settings.arch not in ("x86", "x86_64",): - raise ConanInvalidConfiguration("{} requires x86 architecture.".format(self.name)) + def _min_cppstd(self): + return 11 - if self.settings.compiler == "Visual Studio": - raise ConanInvalidConfiguration("{} doesn't support Visual Studio C++.".format(self.name)) + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.with_spirit: - self.requires("boost/1.77.0") + self.requires("boost/1.81.0") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + if self.settings.arch not in ("x86", "x86_64",): + raise ConanInvalidConfiguration(f"{self.ref} requires x86 architecture.") + + if is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} doesn't support Visual Studio C++.") def source(self): - tools.files.get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy("LICENSE*", "licenses", self._source_subfolder) - self.copy("*.hpp", dst="include", src=os.path.join(self._source_subfolder, "include")) - - def package_id(self): - self.info.header_only() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.set_property("cmake_file_name", "csvmonkey") self.cpp_info.set_property("cmake_target_name", "csvmonkey::csvmonkey") self.cpp_info.set_property("pkg_config_name", "csvmonkey") + if self.options.with_spirit: + self.cpp_info.defines.append("USE_SPIRIT") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "csvmonkey" self.cpp_info.filenames["cmake_find_package_multi"] = "csvmonkey" self.cpp_info.names["cmake_find_package"] = "csvmonkey" self.cpp_info.names["cmake_find_package_multi"] = "csvmonkey" - - if self.options.with_spirit: - self.cpp_info.defines.append("USE_SPIRIT") diff --git a/recipes/csvmonkey/all/test_package/CMakeLists.txt b/recipes/csvmonkey/all/test_package/CMakeLists.txt index 6f39b9addc9e6b..fd4b892a1c012a 100644 --- a/recipes/csvmonkey/all/test_package/CMakeLists.txt +++ b/recipes/csvmonkey/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(csvmonkey CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} csvmonkey::csvmonkey) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE csvmonkey::csvmonkey) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/csvmonkey/all/test_package/conanfile.py b/recipes/csvmonkey/all/test_package/conanfile.py index 69bc51936474f1..a9fb96656f2039 100644 --- a/recipes/csvmonkey/all/test_package/conanfile.py +++ b/recipes/csvmonkey/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conan import ConanFile, tools -from conans import CMake -class CSVMonkeyTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.build.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/csvmonkey/all/test_v1_package/CMakeLists.txt b/recipes/csvmonkey/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/csvmonkey/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/csvmonkey/all/test_v1_package/conanfile.py b/recipes/csvmonkey/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/csvmonkey/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/czmq/all/CMakeLists.txt b/recipes/czmq/all/CMakeLists.txt deleted file mode 100644 index 9b9d3d634acc0e..00000000000000 --- a/recipes/czmq/all/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -if(MSVC) - add_definitions("-D_NOEXCEPT=noexcept") -endif() - -if(NOT BUILD_SHARED_LIBS) - add_definitions("-DCZMQ_STATIC") -endif() - -add_subdirectory(source_subfolder) - -foreach(TARGET zmakecert zsp test_randof czmq_selftest) - set_target_properties("${TARGET}" - PROPERTIES EXCLUDE_FROM_ALL ON) -endforeach() diff --git a/recipes/czmq/all/conandata.yml b/recipes/czmq/all/conandata.yml index ae7b2a74b8950c..9c67f10778c980 100644 --- a/recipes/czmq/all/conandata.yml +++ b/recipes/czmq/all/conandata.yml @@ -1,14 +1,20 @@ sources: + "4.2.1": + url: "https://github.com/zeromq/czmq/archive/v4.2.1.tar.gz" + sha256: "83457cd32a2c2615b8d7ebcf91b198cb0d8df383a2072b96835ab250164d8a83" "4.2.0": url: "https://github.com/zeromq/czmq/archive/v4.2.0.tar.gz" sha256: "31185090b500b64855003be2450ced00efa6b58544639acfc68aa13c9ec249f8" patches: + "4.2.1": + - patch_file: patches/4.2.1-0001-fix-cmake.patch + patch_description: "set LINKER_LANGUAGE, disable executable and tests" + patch_type: "conan" + - patch_file: patches/4.2.1-0002-fix-zsys_thread-issue.patch + patch_description: "addresses three problems related to ZSYS_THREAD_NAME_PREFIX / ZSYS_THREAD_NAME_PREFIX_STR:" + patch_type: "bugfix" + patch_source: "https://github.com/zeromq/czmq/pull/2162" "4.2.0": - - base_path: source_subfolder - patch_file: patches/0001-allow-cmake-subproject.patch - - base_path: source_subfolder - patch_file: patches/0002-dont-build-zmakecert.patch - - base_path: source_subfolder - patch_file: patches/0003-fix-cmake-find-package.patch - - base_path: source_subfolder - patch_file: patches/0004-make-czmq-link-using-cxx-compiler.patch + - patch_file: patches/4.2.0-0001-fix-cmake.patch + patch_description: "add options which are added in 4.2.1, set LINKER_LANGUAGE, disable executable and tests" + patch_type: "conan" diff --git a/recipes/czmq/all/conanfile.py b/recipes/czmq/all/conanfile.py index 916303c3f9b24c..ca6710a21cdb37 100644 --- a/recipes/czmq/all/conanfile.py +++ b/recipes/czmq/all/conanfile.py @@ -1,112 +1,122 @@ -from conans import ConanFile, tools, CMake +from conan import ConanFile +from conan.tools.microsoft import is_msvc +from conan.tools.apple import is_apple_os +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir, save +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.errors import ConanInvalidConfiguration import os import textwrap -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.53.0" class CzmqConan(ConanFile): name = "czmq" - homepage = "https://github.com/zeromq/czmq" description = "High-level C binding for ZeroMQ" - topics = ("zmq", "libzmq", "message-queue", "asynchronous") - url = "https://github.com/conan-io/conan-center-index" license = "MPL-2.0" - + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/zeromq/czmq" + topics = ("zmq", "libzmq", "message-queue", "asynchronous") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], + "enable_drafts": [True, False], "with_libcurl": [True, False], "with_lz4": [True, False], "with_libuuid": [True, False], + "with_systemd": [True, False], } default_options = { "shared": False, + "enable_drafts": False, "fPIC": True, "with_libcurl": True, "with_lz4": True, "with_libuuid": True, + "with_systemd": False, } - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC # libuuid is not available on Windows del self.options.with_libuuid + if self.settings.os == "Linux": + del self.options.with_systemd def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("openssl/1.1.1m") # zdigest depends on openssl + self.requires("openssl/1.1.1s") # zdigest depends on openssl self.requires("zeromq/4.3.4") + if self.options.enable_drafts: + self.requires("libmicrohttpd/0.9.75") if self.options.with_libcurl: - self.requires("libcurl/7.80.0") + self.requires("libcurl/7.86.0") if self.options.with_lz4: - self.requires("lz4/1.9.3") + self.requires("lz4/1.9.4") if self.options.get_safe("with_libuuid"): self.requires("libuuid/1.0.3") + if self.options.get_safe("with_systemd"): + self.requires("libsystemd/252.4") + + def validate(self): + if is_apple_os(self) and self.options.shared and self.settings.build_type == "Debug": + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared and debug on apple-clang.") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["CZMQ_BUILD_SHARED"] = self.options.shared - self._cmake.definitions["CZMQ_BUILD_STATIC"] = not self.options.shared - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.variables["CZMQ_BUILD_SHARED"] = self.options.shared + tc.variables["CZMQ_BUILD_STATIC"] = not self.options.shared + tc.variables["CZMQ_WITH_UUID"] = self.options.get_safe("with_libuuid", False) + tc.variables["CZMQ_WITH_SYSTEMD"] = self.options.get_safe("with_systemd", False) + tc.variables["CZMQ_WITH_LZ4"] = self.options.get_safe("with_lz4", False) + tc.variables["CZMQ_WITH_LIBCURL"] = self.options.get_safe("with_libcurl", False) + tc.variables["CZMQ_WITH_LIBMICROHTTPD"] = self.options.enable_drafts + if is_msvc(self): + tc.preprocessor_definitions["_NOEXCEPT"] = "noexcept" + if self.options.shared: + tc.preprocessor_definitions["CZMQ_STATIC"] = 1 + tc.generate() + + dpes = CMakeDeps(self) + dpes.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + # remove custom Finduuid.cmake to use cci Finduuid.cmake + rm(self, "Finduuid.cmake", self.source_folder) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "CMake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - # TODO: to remove in conan v2 once cmake_find_package_* generators removed + rmdir(self, os.path.join(self.package_folder, "CMake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), {self._czmq_target: "czmq::czmq"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): content += textwrap.dedent("""\ @@ -115,7 +125,7 @@ def _create_cmake_module_alias_targets(module_file, targets): set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + save(self, module_file, content) @property def _module_file_rel_path(self): @@ -129,18 +139,14 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "czmq") self.cpp_info.set_property("cmake_target_name", self._czmq_target) self.cpp_info.set_property("pkg_config_name", "libczmq") - prefix = "lib" if self._is_msvc and not self.options.shared else "" - self.cpp_info.libs = ["{}czmq".format(prefix)] + prefix = "lib" if is_msvc(self) and not self.options.shared else "" + self.cpp_info.libs = [f"{prefix}czmq"] if not self.options.shared: self.cpp_info.defines.append("CZMQ_STATIC") if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["pthread", "m"]) elif self.settings.os == "Windows": self.cpp_info.system_libs.append("rpcrt4") - if not self.options.shared: - stdcpp_library = tools.stdcpp_library(self) - if stdcpp_library: - self.cpp_info.system_libs.append(stdcpp_library) # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] diff --git a/recipes/czmq/all/patches/0001-allow-cmake-subproject.patch b/recipes/czmq/all/patches/0001-allow-cmake-subproject.patch deleted file mode 100644 index ba289825b0a1f6..00000000000000 --- a/recipes/czmq/all/patches/0001-allow-cmake-subproject.patch +++ /dev/null @@ -1,92 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -74,7 +74,7 @@ endif() - - file(REMOVE "${SOURCE_DIR}/src/platform.h") - --file(WRITE "${CMAKE_BINARY_DIR}/platform.h.in" " -+file(WRITE "${PROJECT_BINARY_DIR}/platform.h.in" " - #cmakedefine HAVE_LINUX_WIRELESS_H - #cmakedefine HAVE_NET_IF_H - #cmakedefine HAVE_NET_IF_MEDIA_H -@@ -82,7 +82,7 @@ file(WRITE "${CMAKE_BINARY_DIR}/platform.h.in" " - #cmakedefine HAVE_FREEIFADDRS - ") - --configure_file("${CMAKE_BINARY_DIR}/platform.h.in" "${CMAKE_BINARY_DIR}/platform.h") -+configure_file("${PROJECT_BINARY_DIR}/platform.h.in" "${PROJECT_BINARY_DIR}/platform.h") - - #The MSVC C compiler is too out of date, - #so the sources have to be compiled as c++ -@@ -299,7 +299,7 @@ install(FILES ${czmq_headers} DESTINATION include) - ######################################################################## - - --include_directories("${SOURCE_DIR}/src" "${SOURCE_DIR}/include" "${CMAKE_BINARY_DIR}") -+include_directories("${SOURCE_DIR}/src" "${SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}") - set (czmq_sources - src/zactor.c - src/zarmour.c -@@ -658,17 +658,17 @@ ENDIF (ENABLE_DRAFTS) - - add_custom_target( - copy-selftest-ro ALL -- COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/src/selftest-ro ${CMAKE_BINARY_DIR}/src/selftest-ro -+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/src/selftest-ro ${PROJECT_BINARY_DIR}/src/selftest-ro - ) - - add_custom_target( - make-selftest-rw ALL -- COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/src/selftest-rw -+ COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/src/selftest-rw - ) - - set_directory_properties( - PROPERTIES -- ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_BINARY_DIR}/src/selftest-ro;${CMAKE_BINARY_DIR}/src/selftest-rw" -+ ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_BINARY_DIR}/src/selftest-ro;${PROJECT_BINARY_DIR}/src/selftest-rw" - ) - - foreach(TEST_CLASS ${TEST_CLASSES}) -@@ -693,22 +693,22 @@ include(CTest) - ######################################################################## - add_custom_target (distclean @echo Cleaning for source distribution) - --set(cmake_generated ${CMAKE_BINARY_DIR}/CMakeCache.txt -- ${CMAKE_BINARY_DIR}/cmake_install.cmake -- ${CMAKE_BINARY_DIR}/Makefile -- ${CMAKE_BINARY_DIR}/CMakeFiles -- ${CMAKE_BINARY_DIR}/CTestTestfile.cmake -- ${CMAKE_BINARY_DIR}/DartConfiguration.tcl -- ${CMAKE_BINARY_DIR}/Testing -- ${CMAKE_BINARY_DIR}/compile_commands.json -- ${CMAKE_BINARY_DIR}/platform.h -- ${CMAKE_BINARY_DIR}/src/libczmq.pc -- ${CMAKE_BINARY_DIR}/src/libczmq.so -- ${CMAKE_BINARY_DIR}/src/czmq_selftest -- ${CMAKE_BINARY_DIR}/src/zmakecert -- ${CMAKE_BINARY_DIR}/src/zsp -- ${CMAKE_BINARY_DIR}/src/test_randof -- ${CMAKE_BINARY_DIR}/src/czmq_selftest -+set(cmake_generated ${PROJECT_BINARY_DIR}/CMakeCache.txt -+ ${PROJECT_BINARY_DIR}/cmake_install.cmake -+ ${PROJECT_BINARY_DIR}/Makefile -+ ${PROJECT_BINARY_DIR}/CMakeFiles -+ ${PROJECT_BINARY_DIR}/CTestTestfile.cmake -+ ${PROJECT_BINARY_DIR}/DartConfiguration.tcl -+ ${PROJECT_BINARY_DIR}/Testing -+ ${PROJECT_BINARY_DIR}/compile_commands.json -+ ${PROJECT_BINARY_DIR}/platform.h -+ ${PROJECT_BINARY_DIR}/src/libczmq.pc -+ ${PROJECT_BINARY_DIR}/src/libczmq.so -+ ${PROJECT_BINARY_DIR}/src/czmq_selftest -+ ${PROJECT_BINARY_DIR}/src/zmakecert -+ ${PROJECT_BINARY_DIR}/src/zsp -+ ${PROJECT_BINARY_DIR}/src/test_randof -+ ${PROJECT_BINARY_DIR}/src/czmq_selftest - ) - - add_custom_command( --- -2.21.0 - diff --git a/recipes/czmq/all/patches/0002-dont-build-zmakecert.patch b/recipes/czmq/all/patches/0002-dont-build-zmakecert.patch deleted file mode 100644 index 069bf10a74ad83..00000000000000 --- a/recipes/czmq/all/patches/0002-dont-build-zmakecert.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -502,7 +502,7 @@ - # executables - ######################################################################## - add_executable( -+ zmakecert EXCLUDE_FROM_ALL -- zmakecert - "${SOURCE_DIR}/src/zmakecert.c" - ) - if (TARGET czmq) -@@ -522,9 +522,9 @@ - ${OPTIONAL_LIBRARIES_STATIC} - ) - endif() --install(TARGETS zmakecert -- RUNTIME DESTINATION bin --) -+#install(TARGETS zmakecert -+# RUNTIME DESTINATION bin -+#) - add_executable( - zsp - "${SOURCE_DIR}/src/zsp.c" diff --git a/recipes/czmq/all/patches/0003-fix-cmake-find-package.patch b/recipes/czmq/all/patches/0003-fix-cmake-find-package.patch deleted file mode 100644 index ff1a6455a6955d..00000000000000 --- a/recipes/czmq/all/patches/0003-fix-cmake-find-package.patch +++ /dev/null @@ -1,203 +0,0 @@ ---- Findlibcurl.cmake -+++ Findlibcurl.cmake -@@ -3,7 +3,7 @@ - # Read the zproject/README.md for information about making permanent changes. # - ################################################################################ - --if (NOT MSVC) -+if (0) - include(FindPkgConfig) - pkg_check_modules(PC_LIBCURL "libcurl") - if (PC_LIBCURL_FOUND) -@@ -17,17 +17,9 @@ - endif(PC_LIBCURL_FOUND) - endif (NOT MSVC) - --find_path ( -- LIBCURL_INCLUDE_DIRS -- NAMES curl/curl.h -- HINTS ${PC_LIBCURL_INCLUDE_HINTS} --) -- --find_library ( -- LIBCURL_LIBRARIES -- NAMES curl -- HINTS ${PC_LIBCURL_LIBRARY_HINTS} --) -+set(LIBCURL_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS_CURL}) -+ -+set(LIBCURL_LIBRARIES CONAN_PKG::CURL) - - include(FindPackageHandleStandardArgs) - ---- Findlibmicrohttpd.cmake 2019-02-10 18:47:44.000000000 +0100 -+++ Findlibmicrohttpd.cmake 2019-12-14 14:54:53.667244809 +0100 -@@ -3,7 +3,7 @@ - # Read the zproject/README.md for information about making permanent changes. # - ################################################################################ - --if (NOT MSVC) -+if (0) - include(FindPkgConfig) - pkg_check_modules(PC_LIBMICROHTTPD "libmicrohttpd") - if (PC_LIBMICROHTTPD_FOUND) -@@ -17,17 +17,9 @@ - endif(PC_LIBMICROHTTPD_FOUND) - endif (NOT MSVC) - --find_path ( -- LIBMICROHTTPD_INCLUDE_DIRS -- NAMES microhttpd.h -- HINTS ${PC_LIBMICROHTTPD_INCLUDE_HINTS} --) -- --find_library ( -- LIBMICROHTTPD_LIBRARIES -- NAMES microhttpd -- HINTS ${PC_LIBMICROHTTPD_LIBRARY_HINTS} --) -+set(LIBMICROHTTPD_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS_LIBMICROHTTPD}) -+link_directories(${CONAN_LIB_DIRS_LIBMICROHTTPD}) -+set(LIBLIBMICROHTTPD_LIBRARIES_DIRS ${CONAN_LIBS_LIBLIBMICROHTTPD} ${CONAN_SYSTEM_LIBS_LIBLIBMICROHTTPD}) - - include(FindPackageHandleStandardArgs) - ---- Findlibsodium.cmake 2019-02-10 18:47:44.000000000 +0100 -+++ Findlibsodium.cmake 2019-12-14 14:54:53.667244809 +0100 -@@ -3,7 +3,7 @@ - # Please refer to the README for information about making permanent changes. # - ################################################################################ - --if (NOT MSVC) -+if (0) - include(FindPkgConfig) - pkg_check_modules(PC_LIBSODIUM "libsodium") - if (NOT PC_LIBSODIUM_FOUND) -@@ -18,17 +18,10 @@ - endif(PC_LIBSODIUM_FOUND) - endif (NOT MSVC) - --find_path ( -- LIBSODIUM_INCLUDE_DIRS -- NAMES sodium.h -- HINTS ${PC_LIBSODIUM_INCLUDE_HINTS} --) -- --find_library ( -- LIBSODIUM_LIBRARIES -- NAMES sodium -- HINTS ${PC_LIBSODIUM_LIBRARY_HINTS} --) -+set(LIBSODIUM_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS_LIBSODIUM}) -+link_directories(${CONAN_LIB_DIRS_LIBSODIUM}) -+set(LIBSODIUM_LIBRARIES ${CONAN_LIBS_LIBSODIUM} ${CONAN_SYSTEM_LIBS_LIBSODIUM}) -+add_definitions(${CONAN_DEFINES_LIBSODIUM}) - - include(FindPackageHandleStandardArgs) - ---- Findlibzmq.cmake 2019-02-10 18:47:44.000000000 +0100 -+++ Findlibzmq.cmake 2019-12-14 14:54:53.667244809 +0100 -@@ -3,7 +3,7 @@ - # Read the zproject/README.md for information about making permanent changes. # - ################################################################################ - --if (NOT MSVC) -+if (0) - include(FindPkgConfig) - pkg_check_modules(PC_LIBZMQ "libzmq") - if (PC_LIBZMQ_FOUND) -@@ -17,19 +17,16 @@ - endif(PC_LIBZMQ_FOUND) - endif (NOT MSVC) - --find_path ( -- LIBZMQ_INCLUDE_DIRS -- NAMES zmq.h -- HINTS ${PC_LIBZMQ_INCLUDE_HINTS} --) -- --find_library ( -- LIBZMQ_LIBRARIES -- NAMES zmq -- HINTS ${PC_LIBZMQ_LIBRARY_HINTS} --) -- -+set(LIBZMQ_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS_ZEROMQ}) -+link_directories(${CONAN_LIB_DIRS_ZEROMQ}) -+set(LIBZMQ_LIBRARIES ${CONAN_LIBS_ZEROMQ} ${CONAN_SYSTEM_LIBS_ZEROMQ}) - include(FindPackageHandleStandardArgs) -+add_definitions(${CONAN_DEFINES_ZEROMQ}) -+ -+if(DEFINED CONAN_INCLUDE_DIRS_LIBSODIUM) -+ find_package(libsodium REQUIRED) -+ list(APPEND LIBZMQ_LIBRARIES ${LIBSODIUM_LIBRARIES}) -+endif() - - find_package_handle_standard_args( - LIBZMQ ---- Findlz4.cmake 2019-02-10 18:47:44.000000000 +0100 -+++ Findlz4.cmake 2019-12-14 14:54:53.667244809 +0100 -@@ -3,7 +3,7 @@ - # Read the zproject/README.md for information about making permanent changes. # - ################################################################################ - --if (NOT MSVC) -+if (0) - include(FindPkgConfig) - pkg_check_modules(PC_LZ4 "liblz4") - if (PC_LZ4_FOUND) -@@ -17,17 +17,10 @@ - endif(PC_LZ4_FOUND) - endif (NOT MSVC) - --find_path ( -- LZ4_INCLUDE_DIRS -- NAMES lz4.h -- HINTS ${PC_LZ4_INCLUDE_HINTS} --) -- --find_library ( -- LZ4_LIBRARIES -- NAMES lz4 -- HINTS ${PC_LZ4_LIBRARY_HINTS} --) -+set(LZ4_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS_LZ4}) -+link_directories(${CONAN_LIB_DIRS_LZ4}) -+set(LZ4_LIBRARIES ${CONAN_LIBS_LZ4} ${CONAN_SYSTEM_LIBS_LZ4}) -+add_definitions(${CONAN_DEFINES_LZ4}) - - include(FindPackageHandleStandardArgs) - ---- Finduuid.cmake 2019-02-10 18:47:44.000000000 +0100 -+++ Finduuid.cmake 2019-12-14 14:54:53.668244813 +0100 -@@ -3,7 +3,7 @@ - # Read the zproject/README.md for information about making permanent changes. # - ################################################################################ - --if (NOT MSVC) -+if (0) - include(FindPkgConfig) - pkg_check_modules(PC_UUID "uuid") - if (PC_UUID_FOUND) -@@ -17,17 +17,10 @@ - endif(PC_UUID_FOUND) - endif (NOT MSVC) - --find_path ( -- UUID_INCLUDE_DIRS -- NAMES uuid/uuid.h -- HINTS ${PC_UUID_INCLUDE_HINTS} --) -- --find_library ( -- UUID_LIBRARIES -- NAMES uuid -- HINTS ${PC_UUID_LIBRARY_HINTS} --) -+set(UUID_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS_LIBUUID}) -+link_directories(${CONAN_LIB_DIRS_LIBUUID}) -+set(UUID_LIBRARIES ${CONAN_LIBS_LIBUUID} ${CONAN_SYSTEM_LIBS_LIBUUID}) -+add_definitions(${CONAN_DEFINES_LIBUUID}) - - include(FindPackageHandleStandardArgs) - diff --git a/recipes/czmq/all/patches/0004-make-czmq-link-using-cxx-compiler.patch b/recipes/czmq/all/patches/0004-make-czmq-link-using-cxx-compiler.patch deleted file mode 100644 index 5137f6e7d0c154..00000000000000 --- a/recipes/czmq/all/patches/0004-make-czmq-link-using-cxx-compiler.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -380,5 +380,6 @@ - ENDIF (MSVC) - - set_target_properties (czmq PROPERTIES -+ LINKER_LANGUAGE CXX - PUBLIC_HEADER "${public_headers}" - DEFINE_SYMBOL "CZMQ_EXPORTS" diff --git a/recipes/czmq/all/patches/4.2.0-0001-fix-cmake.patch b/recipes/czmq/all/patches/4.2.0-0001-fix-cmake.patch new file mode 100644 index 00000000000000..962bae9a6cb998 --- /dev/null +++ b/recipes/czmq/all/patches/4.2.0-0001-fix-cmake.patch @@ -0,0 +1,152 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index de4e150..93a0727 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -120,25 +120,26 @@ set(OPTIONAL_LIBRARIES_STATIC) + ######################################################################## + # LIBZMQ dependency + ######################################################################## +-find_package(libzmq REQUIRED) +-IF (LIBZMQ_FOUND) +- include_directories(${LIBZMQ_INCLUDE_DIRS}) +- list(APPEND MORE_LIBRARIES ${LIBZMQ_LIBRARIES}) ++find_package(ZeroMQ REQUIRED) ++IF (ZeroMQ_FOUND) ++ include_directories(${ZeroMQ_INCLUDE_DIRS}) ++ list(APPEND MORE_LIBRARIES ${ZeroMQ_LIBRARIES}) + IF (PC_LIBZMQ_FOUND) + set(pkg_config_names_private "${pkg_config_names_private} libzmq") + list(APPEND OPTIONAL_LIBRARIES_STATIC ${PC_LIBZMQ_STATIC_LDFLAGS}) + ELSE (PC_LIBZMQ_FOUND) + set(pkg_config_libs_private "${pkg_config_libs_private} -lzmq") + ENDIF (PC_LIBZMQ_FOUND) +-ELSE (LIBZMQ_FOUND) ++ELSE (ZeroMQ_FOUND) + message( FATAL_ERROR "libzmq not found." ) +-ENDIF (LIBZMQ_FOUND) ++ENDIF (ZeroMQ_FOUND) + + ######################################################################## + # UUID dependency + ######################################################################## + find_package(uuid) +-IF (UUID_FOUND) ++option(CZMQ_WITH_UUID "Build czmq with uuid" ${UUID_FOUND}) ++IF (CZMQ_WITH_UUID AND UUID_FOUND) + include_directories(${UUID_INCLUDE_DIRS}) + list(APPEND MORE_LIBRARIES ${UUID_LIBRARIES}) + IF (PC_UUID_FOUND) +@@ -149,13 +150,14 @@ IF (UUID_FOUND) + ENDIF (PC_UUID_FOUND) + add_definitions(-DHAVE_UUID) + list(APPEND OPTIONAL_LIBRARIES ${UUID_LIBRARIES}) +-ENDIF (UUID_FOUND) ++ENDIF (CZMQ_WITH_UUID AND UUID_FOUND) + + ######################################################################## + # SYSTEMD dependency + ######################################################################## + find_package(systemd) +-IF (SYSTEMD_FOUND) ++option(CZMQ_WITH_SYSTEMD "Build czmq with systemd" ${SYSTEMD_FOUND}) ++IF (CZMQ_WITH_SYSTEMD AND SYSTEMD_FOUND) + include_directories(${SYSTEMD_INCLUDE_DIRS}) + list(APPEND MORE_LIBRARIES ${SYSTEMD_LIBRARIES}) + IF (PC_SYSTEMD_FOUND) +@@ -166,13 +168,14 @@ IF (SYSTEMD_FOUND) + ENDIF (PC_SYSTEMD_FOUND) + add_definitions(-DHAVE_LIBSYSTEMD) + list(APPEND OPTIONAL_LIBRARIES ${SYSTEMD_LIBRARIES}) +-ENDIF (SYSTEMD_FOUND) ++ENDIF (CZMQ_WITH_SYSTEMD AND SYSTEMD_FOUND) + + ######################################################################## + # LZ4 dependency + ######################################################################## + find_package(lz4) +-IF (LZ4_FOUND) ++option(CZMQ_WITH_LZ4 "Build czmq with lz4" ${LZ4_FOUND}) ++IF (CZMQ_WITH_LZ4 AND LZ4_FOUND) + include_directories(${LZ4_INCLUDE_DIRS}) + list(APPEND MORE_LIBRARIES ${LZ4_LIBRARIES}) + IF (PC_LZ4_FOUND) +@@ -183,13 +186,14 @@ IF (LZ4_FOUND) + ENDIF (PC_LZ4_FOUND) + add_definitions(-DHAVE_LIBLZ4) + list(APPEND OPTIONAL_LIBRARIES ${LZ4_LIBRARIES}) +-ENDIF (LZ4_FOUND) ++ENDIF (CZMQ_WITH_LZ4 AND LZ4_FOUND) + + ######################################################################## + # LIBCURL dependency + ######################################################################## + find_package(libcurl) +-IF (LIBCURL_FOUND) ++option(CZMQ_WITH_LIBCURL "Build czmq with libcurl" ${LIBCURL_FOUND}) ++IF (CZMQ_WITH_LIBCURL AND LIBCURL_FOUND) + include_directories(${LIBCURL_INCLUDE_DIRS}) + list(APPEND MORE_LIBRARIES ${LIBCURL_LIBRARIES}) + IF (PC_LIBCURL_FOUND) +@@ -200,13 +204,14 @@ IF (LIBCURL_FOUND) + ENDIF (PC_LIBCURL_FOUND) + add_definitions(-DHAVE_LIBCURL) + list(APPEND OPTIONAL_LIBRARIES ${LIBCURL_LIBRARIES}) +-ENDIF (LIBCURL_FOUND) ++ENDIF (CZMQ_WITH_LIBCURL AND LIBCURL_FOUND) + + ######################################################################## + # LIBMICROHTTPD dependency + ######################################################################## + find_package(libmicrohttpd) +-IF (LIBMICROHTTPD_FOUND) ++option(CZMQ_WITH_LIBMICROHTTPD "Build czmq with libmicrohttpd" ${LIBMICROHTTPD_FOUND}) ++IF (CZMQ_WITH_LIBMICROHTTPD AND LIBMICROHTTPD_FOUND) + include_directories(${LIBMICROHTTPD_INCLUDE_DIRS}) + list(APPEND MORE_LIBRARIES ${LIBMICROHTTPD_LIBRARIES}) + IF (PC_LIBMICROHTTPD_FOUND) +@@ -217,7 +222,7 @@ IF (LIBMICROHTTPD_FOUND) + ENDIF (PC_LIBMICROHTTPD_FOUND) + add_definitions(-DHAVE_LIBMICROHTTPD) + list(APPEND OPTIONAL_LIBRARIES ${LIBMICROHTTPD_LIBRARIES}) +-ENDIF (LIBMICROHTTPD_FOUND) ++ENDIF (CZMQ_WITH_LIBMICROHTTPD AND LIBMICROHTTPD_FOUND) + + ######################################################################## + # version +@@ -380,6 +385,7 @@ if (CZMQ_BUILD_SHARED) + ENDIF (MSVC) + + set_target_properties (czmq PROPERTIES ++ LINKER_LANGUAGE CXX + PUBLIC_HEADER "${public_headers}" + DEFINE_SYMBOL "CZMQ_EXPORTS" + SOVERSION "4" +@@ -501,6 +507,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/czmqConfig.cmake + ######################################################################## + # executables + ######################################################################## ++if(0) # disable executables + add_executable( + zmakecert + "${SOURCE_DIR}/src/zmakecert.c" +@@ -588,10 +595,12 @@ target_link_libraries( + ${OPTIONAL_LIBRARIES_STATIC} + ) + endif() ++endif() # disable executables + + ######################################################################## + # tests + ######################################################################## ++if(0) # disable tests + set(CLASSTEST_TIMEOUT 60 CACHE STRING "Timeout of the selftest of a class") + set(TOTAL_TIMEOUT 600 CACHE STRING "Timout of the total testsuite") + +@@ -687,6 +696,7 @@ foreach(TEST_CLASS ${TEST_CLASSES}) + endforeach(TEST_CLASS) + + include(CTest) ++endif() # disable tests + + ######################################################################## + # cleanup diff --git a/recipes/czmq/all/patches/4.2.1-0001-fix-cmake.patch b/recipes/czmq/all/patches/4.2.1-0001-fix-cmake.patch new file mode 100644 index 00000000000000..d28f290d16d5eb --- /dev/null +++ b/recipes/czmq/all/patches/4.2.1-0001-fix-cmake.patch @@ -0,0 +1,67 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index d51cba0..d12a024 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -130,19 +130,19 @@ set(OPTIONAL_LIBRARIES_STATIC) + ######################################################################## + # LIBZMQ dependency + ######################################################################## +-find_package(libzmq REQUIRED) +-IF (LIBZMQ_FOUND) +- include_directories(${LIBZMQ_INCLUDE_DIRS}) +- list(APPEND MORE_LIBRARIES ${LIBZMQ_LIBRARIES}) ++find_package(ZeroMQ REQUIRED) ++IF (ZeroMQ_FOUND) ++ include_directories(${ZeroMQ_INCLUDE_DIRS}) ++ list(APPEND MORE_LIBRARIES ${ZeroMQ_LIBRARIES}) + IF (PC_LIBZMQ_FOUND) + set(pkg_config_names_private "${pkg_config_names_private} libzmq") + list(APPEND OPTIONAL_LIBRARIES_STATIC ${PC_LIBZMQ_STATIC_LDFLAGS}) + ELSE (PC_LIBZMQ_FOUND) + set(pkg_config_libs_private "${pkg_config_libs_private} -lzmq") + ENDIF (PC_LIBZMQ_FOUND) +-ELSE (LIBZMQ_FOUND) ++ELSE (ZeroMQ_FOUND) + message( FATAL_ERROR "libzmq not found." ) +-ENDIF (LIBZMQ_FOUND) ++ENDIF (ZeroMQ_FOUND) + + ######################################################################## + # UUID dependency +@@ -419,6 +419,7 @@ if (CZMQ_BUILD_SHARED) + ENDIF(APPLE) + + set_target_properties (czmq PROPERTIES ++ LINKER_LANGUAGE CXX + PUBLIC_HEADER "${public_headers}" + DEFINE_SYMBOL "CZMQ_EXPORTS" + SOVERSION "4" +@@ -544,6 +545,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/czmqConfig.cmake + ######################################################################## + # executables + ######################################################################## ++if(0) # disable executables + add_executable( + zmakecert + "${SOURCE_DIR}/src/zmakecert.c" +@@ -631,10 +633,12 @@ target_link_libraries( + ${OPTIONAL_LIBRARIES_STATIC} + ) + endif() ++endif() # disable executables + + ######################################################################## + # tests + ######################################################################## ++if(0) # disable tests + set(CLASSTEST_TIMEOUT 60 CACHE STRING "Timeout of the selftest of a class") + set(TOTAL_TIMEOUT 600 CACHE STRING "Timout of the total testsuite") + +@@ -743,6 +747,7 @@ foreach(TEST_CLASS ${TEST_CLASSES}) + endforeach(TEST_CLASS) + + include(CTest) ++endif() # disable tests + + ######################################################################## + # cleanup diff --git a/recipes/czmq/all/patches/4.2.1-0002-fix-zsys_thread-issue.patch b/recipes/czmq/all/patches/4.2.1-0002-fix-zsys_thread-issue.patch new file mode 100644 index 00000000000000..82cede05404718 --- /dev/null +++ b/recipes/czmq/all/patches/4.2.1-0002-fix-zsys_thread-issue.patch @@ -0,0 +1,43 @@ +diff --git a/src/zsock.c b/src/zsock.c +index 46bbb63..36ad5e0 100644 +--- a/src/zsock.c ++++ b/src/zsock.c +@@ -2376,6 +2376,7 @@ zsock_test (bool verbose) + zstr_free (&addr); + zstr_free (&message); + ++#ifndef __APPLE__ + // ZMQ_DGRAM ipv4 multicast test + zsock_t* mdgramr = zsock_new_dgram ("udp://225.25.25.25:7777"); + assert (mdgramr); +@@ -2389,6 +2390,7 @@ zsock_test (bool verbose) + + char *mdmessage, *maddr; + ++ // this call blocks forever on MacOS + zmsg_t *mdmsg = zmsg_recv( mdgramr ); + assert (mdmsg); + maddr = zmsg_popstr (mdmsg); +@@ -2400,6 +2402,7 @@ zsock_test (bool verbose) + zstr_free (&mdmessage); + zstr_free (&maddr); + zstr_free (&mdmessage); ++#endif + + // // ipv6 (not supported yet) + // zsys_set_ipv6(1); +diff --git a/src/zsys.c b/src/zsys.c +index 7c7301b..f384051 100644 +--- a/src/zsys.c ++++ b/src/zsys.c +@@ -334,9 +334,7 @@ zsys_init (void) + zsys_set_thread_name_prefix (s_thread_name_prefix); + + if (getenv ("ZSYS_THREAD_NAME_PREFIX_STR")) +- zsys_set_thread_name_prefix_str (getenv ("ZSYS_THREAD_NAME_PREFIX")); +- else +- zsys_set_thread_name_prefix_str (s_thread_name_prefix_str); ++ zsys_set_thread_name_prefix_str (getenv ("ZSYS_THREAD_NAME_PREFIX_STR")); + + return s_process_ctx; + } diff --git a/recipes/czmq/all/test_package/CMakeLists.txt b/recipes/czmq/all/test_package/CMakeLists.txt index 48b3bf1fe3b3f9..379c1eec90db58 100644 --- a/recipes/czmq/all/test_package/CMakeLists.txt +++ b/recipes/czmq/all/test_package/CMakeLists.txt @@ -1,15 +1,12 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(czmq REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_compile_definitions(${PROJECT_NAME} PRIVATE $<$:"WITH_LIBSODIUM">) if(TARGET czmq-static) - target_link_libraries(${PROJECT_NAME} czmq-static) + target_link_libraries(${PROJECT_NAME} PRIVATE czmq-static) else() - target_link_libraries(${PROJECT_NAME} czmq) + target_link_libraries(${PROJECT_NAME} PRIVATE czmq) endif() diff --git a/recipes/czmq/all/test_package/conanfile.py b/recipes/czmq/all/test_package/conanfile.py index 5eac88580e1080..de4d02115f1c4d 100644 --- a/recipes/czmq/all/test_package/conanfile.py +++ b/recipes/czmq/all/test_package/conanfile.py @@ -1,18 +1,30 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain import os - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["WITH_LIBSODIUM"] = self.options["zeromq"].encryption == "libsodium" + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["WITH_LIBSODIUM"] = self.options["zeromq"].encryption == "libsodium" cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/czmq/all/test_v1_package/CMakeLists.txt b/recipes/czmq/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..be00a8c7f57c71 --- /dev/null +++ b/recipes/czmq/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/czmq/all/test_v1_package/conanfile.py b/recipes/czmq/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5eac88580e1080 --- /dev/null +++ b/recipes/czmq/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["WITH_LIBSODIUM"] = self.options["zeromq"].encryption == "libsodium" + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/czmq/config.yml b/recipes/czmq/config.yml index da3be1903f085f..5074502634e2b3 100644 --- a/recipes/czmq/config.yml +++ b/recipes/czmq/config.yml @@ -1,3 +1,5 @@ versions: + "4.2.1": + folder: all "4.2.0": folder: all diff --git a/recipes/dataframe/all/conandata.yml b/recipes/dataframe/all/conandata.yml index 91566611b6db34..61fe550263e995 100644 --- a/recipes/dataframe/all/conandata.yml +++ b/recipes/dataframe/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.22.0": + url: "https://github.com/hosseinmoein/DataFrame/archive/refs/tags/1.22.0.tar.gz" + sha256: "4b244241cd56893fccb22f7c874588f0d86b444912382ed6e9a4cf95e55ffda2" "1.21.0": url: "https://github.com/hosseinmoein/DataFrame/archive/refs/tags/1.21.0.tar.gz" sha256: "a6b07eaaf628225a34e4402c1a6e311430e8431455669ac03691d92f44081172" @@ -9,31 +12,20 @@ sources: url: "https://github.com/hosseinmoein/DataFrame/archive/1.19.0.tar.gz" sha256: "81382e9c68df7c52f69f645b1830fcd3634eedc07fa3d2024ee6c57cf2cdb7ff" "1.18.0": - sha256: 8cdb8b246263fbd8fcef07b6300f6aefb58b3a54cd67e5cbe5383bc948305844 - url: https://github.com/hosseinmoein/DataFrame/archive/1.18.0.tar.gz + url: "https://github.com/hosseinmoein/DataFrame/archive/1.18.0.tar.gz" + sha256: "8cdb8b246263fbd8fcef07b6300f6aefb58b3a54cd67e5cbe5383bc948305844" "1.17.0": - sha256: 669e9663de358330b15eacaa783ccf42fe16db27b9556fdcd18f1114c0335557 - url: https://github.com/hosseinmoein/DataFrame/archive/1.17.0.tar.gz + url: "https://github.com/hosseinmoein/DataFrame/archive/1.17.0.tar.gz" + sha256: "669e9663de358330b15eacaa783ccf42fe16db27b9556fdcd18f1114c0335557" "1.16.0": - sha256: a5a24ec07fb4761a294a291d7bed7c72e82e2dde8bba8bfc1ca2f68e07afd7fc - url: https://github.com/hosseinmoein/DataFrame/archive/1.16.0.tar.gz + url: "https://github.com/hosseinmoein/DataFrame/archive/1.16.0.tar.gz" + sha256: "a5a24ec07fb4761a294a291d7bed7c72e82e2dde8bba8bfc1ca2f68e07afd7fc" "1.15.0": - sha256: 68eb3fca66dff3f8473722d561e9391800957a09c2c6d4dde5f9ad37cbf88954 - url: https://github.com/hosseinmoein/DataFrame/archive/1.15.0.tar.gz + url: "https://github.com/hosseinmoein/DataFrame/archive/1.15.0.tar.gz" + sha256: "68eb3fca66dff3f8473722d561e9391800957a09c2c6d4dde5f9ad37cbf88954" "1.14.0": - sha256: 45991cc16e478b24641d0548aab24fd59ad534ada30fca8776fd9990e1914ac7 - url: https://github.com/hosseinmoein/DataFrame/archive/1.14.0.tar.gz + url: "https://github.com/hosseinmoein/DataFrame/archive/1.14.0.tar.gz" + sha256: "45991cc16e478b24641d0548aab24fd59ad534ada30fca8776fd9990e1914ac7" "1.12.0": - sha256: e951a699bd048bd7a034ac60bdd45f15cf066a04fda33cb22030d192b91a836c - url: https://github.com/hosseinmoein/DataFrame/archive/1.12.0.tar.gz - "1.8.0": - sha256: 43b057f6dedbdfc328667dc4dcdcd3384b4551cc2825ca546405ec955fb8cb35 - url: https://github.com/hosseinmoein/DataFrame/archive/1.8.0.tar.gz - "1.7.0": - sha256: b5f25e331bcd25f2ddd222e65563df3c316d726d92134789f043338545faa4d4 - url: https://github.com/hosseinmoein/DataFrame/archive/1.7.0.tar.gz -patches: - "1.8.0": - - patch_file: "patches/0001-remove-tests-bin-for-conan-package.patch" - "1.7.0": - - patch_file: "patches/0001-remove-tests-bin-for-conan-package.patch" + url: "https://github.com/hosseinmoein/DataFrame/archive/1.12.0.tar.gz" + sha256: "e951a699bd048bd7a034ac60bdd45f15cf066a04fda33cb22030d192b91a836c" diff --git a/recipes/dataframe/all/conanfile.py b/recipes/dataframe/all/conanfile.py index 33492673970a78..f596bf9ba05f78 100644 --- a/recipes/dataframe/all/conanfile.py +++ b/recipes/dataframe/all/conanfile.py @@ -52,9 +52,10 @@ class DataFrameConan(ConanFile): def _minimum_compilers_version(self): return { "Visual Studio": "15", + "msvc": "191", "gcc": "7", "clang": "6", - "apple-clang": "10.0" if Version(self.version) >= "1.12.0" else "9.0", + "apple-clang": "10.0", } def export_sources(self): @@ -144,7 +145,7 @@ def package_info(self): self.cpp_info.set_property("pkg_config_name", "DataFrame") self.cpp_info.libs = ["DataFrame"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.extend(["pthread", "rt"]) + self.cpp_info.system_libs.extend(["pthread", "rt", "m"]) if is_msvc(self): self.cpp_info.defines.append("_USE_MATH_DEFINES") if Version(self.version) < "1.20.0" and not self.options.shared: diff --git a/recipes/dataframe/all/patches/0001-remove-tests-bin-for-conan-package.patch b/recipes/dataframe/all/patches/0001-remove-tests-bin-for-conan-package.patch deleted file mode 100644 index 1eae4efbddc429..00000000000000 --- a/recipes/dataframe/all/patches/0001-remove-tests-bin-for-conan-package.patch +++ /dev/null @@ -1,166 +0,0 @@ -From 6cfbda5ec6f3d1d5987242c00af16ed4c1a65e7d Mon Sep 17 00:00:00 2001 -From: "Jimmy M. Gong" -Date: Mon, 10 Feb 2020 22:05:52 +0800 -Subject: [PATCH] remove tests bin for conan package - ---- - CMakeLists.txt | 146 ------------------------------------------------- - 1 file changed, 146 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 362bd95..b33ed49 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -216,149 +216,3 @@ endif(MSVC) - - # Add the uninstall target - include(AddUninstallTarget) -- --# Build the test binary --add_executable(dataframe_tester test/dataframe_tester.cc) --add_executable(dataframe_performance test/dataframe_performance.cc) --add_executable(vectors_tester test/vectors_tester.cc) --add_executable(vector_ptr_view_tester test/vector_ptr_view_tester.cc) --add_executable(date_time_tester test/date_time_tester.cc) --add_executable(mmfile_tester test/mmfile_tester.cc) --add_executable(obj_vector_tester test/obj_vector_tester.cc) --add_executable(obj_vector_erase_tester test/obj_vector_erase_tester.cc) --add_executable(sharedmem_tester test/sharedmem_tester.cc) --add_executable(gen_rand_tester test/gen_rand_tester.cc) -- --# Link the DataFrame library to the test binary --target_link_libraries(dataframe_tester DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(dataframe_performance DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(vectors_tester DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(vector_ptr_view_tester DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(date_time_tester DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(mmfile_tester DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(obj_vector_tester DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(obj_vector_erase_tester DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(sharedmem_tester DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(gen_rand_tester DataFrame) -- --if (UNIX) -- # Find pthreads library -- set(THREADS_PREFER_PTHREAD_FLAG ON) -- find_package(Threads REQUIRED) -- target_link_libraries(dataframe_tester Threads::Threads) -- target_link_libraries(dataframe_performance Threads::Threads) -- target_link_libraries(vectors_tester Threads::Threads) -- target_link_libraries(vector_ptr_view_tester Threads::Threads) -- target_link_libraries(date_time_tester Threads::Threads) -- target_link_libraries(mmfile_tester Threads::Threads) -- target_link_libraries(obj_vector_tester Threads::Threads) -- target_link_libraries(obj_vector_erase_tester Threads::Threads) -- target_link_libraries(sharedmem_tester Threads::Threads) -- target_link_libraries(gen_rand_tester Threads::Threads) --endif (UNIX) -- --if (UNIX AND NOT APPLE) -- target_link_libraries(dataframe_tester rt) -- target_link_libraries(dataframe_performance rt) -- target_link_libraries(vectors_tester rt) -- target_link_libraries(vector_ptr_view_tester rt) -- target_link_libraries(date_time_tester rt) -- target_link_libraries(mmfile_tester rt) -- target_link_libraries(obj_vector_tester rt) -- target_link_libraries(obj_vector_erase_tester rt) -- target_link_libraries(sharedmem_tester rt) -- target_link_libraries(gen_rand_tester rt) --endif() -- --# Enable ctest, testing so we can see if unit tests pass or fail in CI --enable_testing() --add_test(NAME dataframe_tester -- COMMAND dataframe_tester -- WORKING_DIRECTORY $) -- --# For some unknown reason to me, this test sigfaults in AppVeyor --# --# add_test(NAME vectors_tester --# COMMAND vectors_tester --# WORKING_DIRECTORY $) -- --add_test(NAME vector_ptr_view_tester -- COMMAND vector_ptr_view_tester -- WORKING_DIRECTORY $) --add_test(NAME date_time_tester -- COMMAND date_time_tester -- WORKING_DIRECTORY $) -- --# For some unknown reason to me, this test hangs in Travis CI --# --# add_test(NAME mmfile_tester --# COMMAND mmfile_tester --# WORKING_DIRECTORY $) -- --add_test(NAME obj_vector_tester -- COMMAND obj_vector_tester -- WORKING_DIRECTORY $) -- --add_test(NAME obj_vector_erase_tester -- COMMAND obj_vector_erase_tester -- WORKING_DIRECTORY $) --add_test(NAME gen_rand_tester -- COMMAND gen_rand_tester -- WORKING_DIRECTORY $) -- --message("-- Copying files for testing") --# Ctest require this files in the build dir, on all platforms --add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD -- COMMAND ${CMAKE_COMMAND} -E copy -- ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data.csv -- ${CMAKE_CURRENT_BINARY_DIR}/sample_data.csv) --add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD -- COMMAND ${CMAKE_COMMAND} -E copy -- ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data.json -- ${CMAKE_CURRENT_BINARY_DIR}/sample_data.json) --add_custom_command( -- TARGET ${PROJECT_NAME} POST_BUILD -- COMMAND ${CMAKE_COMMAND} -E copy -- ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data_dt_index.csv -- ${CMAKE_CURRENT_BINARY_DIR}/sample_data_dt_index.csv) --add_custom_command( -- TARGET ${PROJECT_NAME} POST_BUILD -- COMMAND ${CMAKE_COMMAND} -E copy -- ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data_string_index.csv -- ${CMAKE_CURRENT_BINARY_DIR}/sample_data_string_index.csv) -- --file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data.csv -- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/Debug) --file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data.csv -- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/Release) --file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data.json -- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/Debug) --file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data.json -- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/Release) --file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data_dt_index.csv -- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/Debug) --file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data_dt_index.csv -- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/Release) --file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data_string_index.csv -- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/Debug) --file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data_string_index.csv -- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/Release) --message("-- Copying files for testing - done") --- -2.25.0 - diff --git a/recipes/dataframe/all/test_v1_package/CMakeLists.txt b/recipes/dataframe/all/test_v1_package/CMakeLists.txt index ff71d0aea5f2ca..be00a8c7f57c71 100644 --- a/recipes/dataframe/all/test_v1_package/CMakeLists.txt +++ b/recipes/dataframe/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(DataFrame REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE DataFrame::DataFrame) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/dataframe/all/test_v1_package/conanfile.py b/recipes/dataframe/all/test_v1_package/conanfile.py index 75c0cd81d2d2f3..38f4483872d47f 100644 --- a/recipes/dataframe/all/test_v1_package/conanfile.py +++ b/recipes/dataframe/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/dataframe/config.yml b/recipes/dataframe/config.yml index ee0214f11ffb33..55fe67d4b45816 100644 --- a/recipes/dataframe/config.yml +++ b/recipes/dataframe/config.yml @@ -1,4 +1,6 @@ versions: + "1.22.0": + folder: all "1.21.0": folder: all "1.20.0": @@ -17,7 +19,3 @@ versions: folder: all "1.12.0": folder: all - "1.8.0": - folder: all - "1.7.0": - folder: all diff --git a/recipes/daw_header_libraries/all/conandata.yml b/recipes/daw_header_libraries/all/conandata.yml index 6545605dcb07a6..ed2e2f4b08ab60 100644 --- a/recipes/daw_header_libraries/all/conandata.yml +++ b/recipes/daw_header_libraries/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.85.1": + url: "https://github.com/beached/header_libraries/archive/v2.85.1.tar.gz" + sha256: "fb4880e254a481e3c750261fdb75a1696afc9ef4404e095a7f3ba0683bcd9930" + "2.79.0": + url: "https://github.com/beached/header_libraries/archive/v2.79.0.tar.gz" + sha256: "2dfa8fc9495499379cff39ed648c6bba156a87eb177fc91a860045a410aebb99" "2.76.3": url: "https://github.com/beached/header_libraries/archive/v2.76.3.tar.gz" sha256: "2d66f9aec38fb9a42779e0283fa2fc5842e04d34f2bf655c72a9beb4bf5cc8c8" @@ -20,9 +26,6 @@ sources: "2.68.3": url: "https://github.com/beached/header_libraries/archive/v2.68.3.tar.gz" sha256: "9bb7d25d161b89ad4a0ac857c28734c061cf53f6e80212c7fe70b8e0fd14789f" - "2.68.1": - url: "https://github.com/beached/header_libraries/archive/v2.68.1.tar.gz" - sha256: "51bdb042959373729009f91449c492f58bb63262146463a767f17d3de6fb2687" "1.29.7": url: "https://github.com/beached/header_libraries/archive/refs/tags/v1.29.7.tar.gz" sha256: "524c34f3f5d2af498e7bcaff7802b914ba42acde29f7e3ecce41a035db0bf5bd" diff --git a/recipes/daw_header_libraries/all/conanfile.py b/recipes/daw_header_libraries/all/conanfile.py index 50f3611d7a2d82..81865adfe60e7b 100644 --- a/recipes/daw_header_libraries/all/conanfile.py +++ b/recipes/daw_header_libraries/all/conanfile.py @@ -57,8 +57,12 @@ def package(self): copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.set_property("cmake_file_name", "daw-header-libraries") self.cpp_info.set_property("cmake_target_name", "daw::daw-header-libraries") + self.cpp_info.components["daw"].set_property("cmake_target_name", "daw::daw-header-libraries") # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "daw-header-libraries" @@ -67,4 +71,3 @@ def package_info(self): self.cpp_info.names["cmake_find_package_multi"] = "daw" self.cpp_info.components["daw"].names["cmake_find_package"] = "daw-header-libraries" self.cpp_info.components["daw"].names["cmake_find_package_multi"] = "daw-header-libraries" - self.cpp_info.components["daw"].set_property("cmake_target_name", "daw::daw-header-libraries") diff --git a/recipes/daw_header_libraries/config.yml b/recipes/daw_header_libraries/config.yml index 3e49278dd88947..e18abeaf72479e 100644 --- a/recipes/daw_header_libraries/config.yml +++ b/recipes/daw_header_libraries/config.yml @@ -1,4 +1,8 @@ versions: + "2.85.1": + folder: all + "2.79.0": + folder: all "2.76.3": folder: all "2.76.2": @@ -13,7 +17,5 @@ versions: folder: all "2.68.3": folder: all - "2.68.1": - folder: all "1.29.7": folder: all diff --git a/recipes/daw_json_link/all/conandata.yml b/recipes/daw_json_link/all/conandata.yml index 0116aa5dce76fb..d36a5c60a18037 100644 --- a/recipes/daw_json_link/all/conandata.yml +++ b/recipes/daw_json_link/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "3.14.0": + url: "https://github.com/beached/daw_json_link/archive/refs/tags/v3.14.tar.gz" + sha256: "07171e1b8f09f525116627015b6618990dc9cfb32357ba821512c0508730c9a4" + "3.12.0": + url: "https://github.com/beached/daw_json_link/archive/v3.12.0.tar.gz" + sha256: "b32097954caae14071893232fd85febbfda1deec34bb939f6aad76c077c6c5d5" "3.11.1": url: "https://github.com/beached/daw_json_link/archive/v3.11.1.tar.gz" sha256: "d2b5cb221892c6b1ecd30fd2e45d168d6b378e97d134e75349703104c5882309" @@ -20,15 +26,6 @@ sources: "3.1.1": url: "https://github.com/beached/daw_json_link/archive/v3.1.1.tar.gz" sha256: "7d340886898b2ea3c595f0f871c81e4c7382fe53d22d80edc5629768e49fa634" - "3.1.0": - url: "https://github.com/beached/daw_json_link/archive/v3.1.0.tar.gz" - sha256: "c1134fed24794cda598306d23d23c393a0df8ee13d0019cae6ed46b939dad190" - "3.0.5": - url: "https://github.com/beached/daw_json_link/archive/v3.0.5.tar.gz" - sha256: "77abe2ca525083d59a1e4e8e9aa1d2633e5382d98a0d5d838cd2379eaf8d7edf" "2.15.3": url: "https://github.com/beached/daw_json_link/archive/v2.15.3.tar.gz" sha256: "ec0457a5682a76c5aec709f2d6959ef7bafa0b54c5e7740f911d97991188ee84" - "2.14.0": - url: "https://github.com/beached/daw_json_link/archive/v2.14.0.tar.gz" - sha256: "811d0c5ab9ed9c79c84fc5837c8e7ef48f1f45177b7931bc849363c48a62261b" diff --git a/recipes/daw_json_link/all/conanfile.py b/recipes/daw_json_link/all/conanfile.py index c31ac48f8445e0..c3f0164810694a 100644 --- a/recipes/daw_json_link/all/conanfile.py +++ b/recipes/daw_json_link/all/conanfile.py @@ -37,7 +37,7 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("daw_header_libraries/2.76.3") + self.requires("daw_header_libraries/2.79.0") self.requires("daw_utf_range/2.2.3") def package_id(self): diff --git a/recipes/daw_json_link/config.yml b/recipes/daw_json_link/config.yml index 534a6fe8ae5422..be0c9ca0953a7e 100644 --- a/recipes/daw_json_link/config.yml +++ b/recipes/daw_json_link/config.yml @@ -1,4 +1,8 @@ versions: + "3.14.0": + folder: "all" + "3.12.0": + folder: "all" "3.11.1": folder: "all" "3.10.0": @@ -13,11 +17,5 @@ versions: folder: "all" "3.1.1": folder: "all" - "3.1.0": - folder: "all" - "3.0.5": - folder: "all" "2.15.3": folder: "all" - "2.14.0": - folder: "all" diff --git a/recipes/daw_utf_range/all/conanfile.py b/recipes/daw_utf_range/all/conanfile.py index b3e630fee1e5aa..b572b095a9b69c 100644 --- a/recipes/daw_utf_range/all/conanfile.py +++ b/recipes/daw_utf_range/all/conanfile.py @@ -27,16 +27,18 @@ def _minimum_cpp_standard(self): @property def _compilers_minimum_version(self): return { + "Visual Studio": "16", + "msvc": "192", "gcc": "8", "clang": "7", - "apple-clang": "12.0", + "apple-clang": "12", } def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("daw_header_libraries/2.76.3") + self.requires("daw_header_libraries/2.79.0") def package_id(self): self.info.clear() @@ -44,13 +46,11 @@ def package_id(self): def validate(self): if self.settings.get_safe("compiler.cppstd"): check_min_cppstd(self, self._minimum_cpp_standard) - check_min_vs(self, 192) - if not is_msvc(self): - minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) - if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration( - f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support." - ) + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support." + ) def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) diff --git a/recipes/daw_utf_range/all/test_v1_package/CMakeLists.txt b/recipes/daw_utf_range/all/test_v1_package/CMakeLists.txt index ab1c8bbe0a5e15..be00a8c7f57c71 100644 --- a/recipes/daw_utf_range/all/test_v1_package/CMakeLists.txt +++ b/recipes/daw_utf_range/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(daw-utf-range REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE daw::daw-utf-range) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/dbus/1.x.x/conanfile.py b/recipes/dbus/1.x.x/conanfile.py index 8e5ffa679d9f58..eac8625ebd775d 100644 --- a/recipes/dbus/1.x.x/conanfile.py +++ b/recipes/dbus/1.x.x/conanfile.py @@ -1,17 +1,17 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.apple import is_apple_os -from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain +from conan.tools.cmake import CMake, cmake_layout, CMakeDeps, CMakeToolchain from conan.tools.env import VirtualBuildEnv -from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, mkdir, rename, replace_in_file, rm, rmdir, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, mkdir, rename, rm, rmdir, save from conan.tools.gnu import PkgConfigDeps -from conan.tools.layout import basic_layout, cmake_layout +from conan.tools.layout import basic_layout from conan.tools.meson import Meson, MesonToolchain from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class DbusConan(ConanFile): @@ -20,7 +20,7 @@ class DbusConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.freedesktop.org/wiki/Software/dbus" description = "D-Bus is a simple system for interprocess communication and coordination." - topics = ("bus", "interprocess", "message") + topics = "bus", "interprocess", "message" settings = "os", "arch", "compiler", "build_type" short_paths = True options = { @@ -56,14 +56,8 @@ def config_options(self): del self.options.with_x11 def configure(self): - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): if self._meson_available: @@ -73,15 +67,15 @@ def layout(self): def build_requirements(self): if self._meson_available: - self.tool_requires("meson/0.63.3") + self.tool_requires("meson/1.0.0") self.tool_requires("pkgconf/1.9.3") def requirements(self): - self.requires("expat/2.4.9") + self.requires("expat/2.5.0") if self.options.with_glib: - self.requires("glib/2.74.0") + self.requires("glib/2.75.2") if self.options.get_safe("with_systemd"): - self.requires("libsystemd/251.4") + self.requires("libsystemd/252.4") if self.options.with_selinux: self.requires("libselinux/3.3") if self.options.get_safe("with_x11"): @@ -91,12 +85,13 @@ def validate(self): if Version(self.version) >= "1.14.0": if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < 7: raise ConanInvalidConfiguration(f"{self.ref} requires at least gcc 7.") - + if not self._meson_available and self.info.settings.os == "Windows": raise ConanInvalidConfiguration(f"{self.ref} does not support Windows. Contributions welcome.") 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): if self._meson_available: diff --git a/recipes/dbus/1.x.x/test_v1_package/CMakeLists.txt b/recipes/dbus/1.x.x/test_v1_package/CMakeLists.txt index b2f91e4b0e3221..925ecbe19e448d 100644 --- a/recipes/dbus/1.x.x/test_v1_package/CMakeLists.txt +++ b/recipes/dbus/1.x.x/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(DBus1 REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE dbus-1) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/dcmtk/all/conanfile.py b/recipes/dcmtk/all/conanfile.py index a22b5ac9d4a21f..9b544546330a2f 100644 --- a/recipes/dcmtk/all/conanfile.py +++ b/recipes/dcmtk/all/conanfile.py @@ -1,11 +1,15 @@ +from conans import CMake +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, rmdir, save from conan.tools.microsoft import msvc_runtime_flag -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan.tools.scm import Version import functools import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class DCMTKConan(ConanFile): @@ -33,6 +37,7 @@ class DCMTKConan(ConanFile): "builtin_private_tags": [True, False], "external_dictionary": [None, True, False], "wide_io": [True, False], + "enable_stl": [True, False], } default_options = { "shared": False, @@ -50,6 +55,7 @@ class DCMTKConan(ConanFile): "builtin_private_tags": False, "external_dictionary": None, "wide_io": False, + "enable_stl": True, } generators = "cmake", "cmake_find_package" @@ -68,8 +74,7 @@ def _is_msvc(self): def export_sources(self): self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -103,13 +108,13 @@ def requirements(self): self.requires("tcp-wrappers/7.6") def validate(self): - if hasattr(self, "settings_build") and tools.cross_building(self) and \ + if hasattr(self, "settings_build") and cross_building(self) and \ self.settings.os == "Macos" and self.settings.arch == "armv8": # FIXME: Probable issue with flags, build includes header 'mmintrin.h' raise ConanInvalidConfiguration("Cross building to Macos M1 is not supported (yet)") def source(self): - tools.get(**self.conan_data["sources"][self.version], + get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) @functools.lru_cache(1) @@ -146,7 +151,10 @@ def _configure_cmake(self): if self.options.with_zlib: cmake.definitions["WITH_ZLIBINC"] = self.deps_cpp_info["zlib"].rootpath - cmake.definitions["DCMTK_ENABLE_STL"] = "ON" + if self.options.enable_stl: + cmake.definitions["DCMTK_ENABLE_STL"] = "ON" + else: + cmake.definitions["DCMTK_ENABLE_STL"] = "OFF" cmake.definitions["DCMTK_ENABLE_CXX11"] = True cmake.definitions["DCMTK_ENABLE_MANPAGE"] = False @@ -170,12 +178,8 @@ def _configure_cmake(self): cmake.configure(build_folder=self._build_subfolder) return cmake - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - def build(self): - self._patch_sources() + apply_conandata_patches(self) cmake = self._configure_cmake() cmake.build() @@ -185,18 +189,17 @@ def package(self): cmake = self._configure_cmake() cmake.install() - tools.rmdir(os.path.join(self.package_folder, "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "etc")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "etc")) + rmdir(self, os.path.join(self.package_folder, "share")) self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), - {target: "DCMTK::{}".format(target) for target in self._dcmtk_components.keys()} + {target: f"DCMTK::{target}" for target in self._dcmtk_components} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): content += textwrap.dedent("""\ @@ -205,7 +208,7 @@ def _create_cmake_module_alias_targets(module_file, targets): set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + save(self, module_file, content) @property def _module_subfolder(self): @@ -213,8 +216,7 @@ def _module_subfolder(self): @property def _module_file_rel_path(self): - return os.path.join(self._module_subfolder, - "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join(self._module_subfolder, "conan-official-{self.name}-targets.cmake") @property def _dcmtk_components(self): @@ -241,7 +243,7 @@ def tcpwrappers(): def xml2(): return ["libxml2::libxml2"] if self.options.with_libxml2 else [] - charls = "dcmtkcharls" if tools.Version("3.6.6") <= self.version else "charls" + charls = "dcmtkcharls" if Version("3.6.6") <= self.version else "charls" return { "ofstd" : charset_conversion(), @@ -309,12 +311,12 @@ def register_components(components): register_components(self._dcmtk_components) dcmdictpath = os.path.join(self._dcm_datadictionary_path, "dcmtk", "dicom.dic") - self.output.info("Settings DCMDICTPATH environment variable: {}".format(dcmdictpath)) + self.output.info(f"Settings DCMDICTPATH environment variable: {dcmdictpath}") self.runenv_info.define_path("DCMDICTPATH", dcmdictpath) self.env_info.DCMDICTPATH = dcmdictpath # remove in conan v2? if self.options.with_applications: self.buildenv_info.define_path("DCMDICTPATH", dcmdictpath) bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.PATH.append(bin_path) diff --git a/recipes/dcmtk/all/test_package/conanfile.py b/recipes/dcmtk/all/test_package/conanfile.py index 38f4483872d47f..c5fa77486cfa53 100644 --- a/recipes/dcmtk/all/test_package/conanfile.py +++ b/recipes/dcmtk/all/test_package/conanfile.py @@ -1,4 +1,6 @@ -from conans import ConanFile, CMake, tools +from conans import CMake +from conan import ConanFile +from conan.tools.build import cross_building import os @@ -12,6 +14,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): + if not cross_building(self): bin_path = os.path.join("bin", "test_package") self.run(bin_path, run_environment=True) diff --git a/recipes/docopt.cpp/all/CMakeLists.txt b/recipes/docopt.cpp/all/CMakeLists.txt deleted file mode 100644 index c55df0a582d8f7..00000000000000 --- a/recipes/docopt.cpp/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -CONAN_BASIC_SETUP() - -add_subdirectory("source_subfolder") diff --git a/recipes/docopt.cpp/all/conandata.yml b/recipes/docopt.cpp/all/conandata.yml index 9c028b4d8773f7..ce21cb936020ce 100644 --- a/recipes/docopt.cpp/all/conandata.yml +++ b/recipes/docopt.cpp/all/conandata.yml @@ -8,13 +8,18 @@ sources: patches: "0.6.3": - patch_file: "patches/cmake-library-0.6.3.patch" - base_path: "source_subfolder" + patch_description: "fix install path, separate static/shared build" + patch_type: "conan" - patch_file: "patches/msvc-dll-export-0.6.3.patch" - base_path: "source_subfolder" + patch_description: "export ostream<< to dll" + patch_type: "portability" "0.6.2": - patch_file: "patches/include-stdexcept.patch" - base_path: "source_subfolder" + patch_description: "include stdexcept" + patch_type: "portability" - patch_file: "patches/cmake-library-0.6.2.patch" - base_path: "source_subfolder" + patch_description: "fix install path, separate static/shared build" + patch_type: "conan" - patch_file: "patches/msvc-dll-export-0.6.2.patch" - base_path: "source_subfolder" + patch_description: "export ostream<< to dll" + patch_type: "portability" diff --git a/recipes/docopt.cpp/all/conanfile.py b/recipes/docopt.cpp/all/conanfile.py index 1342254943457d..0745cc959331b1 100644 --- a/recipes/docopt.cpp/all/conanfile.py +++ b/recipes/docopt.cpp/all/conanfile.py @@ -1,14 +1,17 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.microsoft import is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, save +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os import textwrap -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.53.0" class DocoptCppConan(ConanFile): name = "docopt.cpp" - license = "MIT" description = "C++11 port of docopt" + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/docopt/docopt.cpp" topics = ("cli", "getopt", "options", "argparser") @@ -25,25 +28,12 @@ class DocoptCppConan(ConanFile): "boost_regex": False, } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + def _min_cppstd(self): + return 11 def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -51,40 +41,42 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.boost_regex: - self.requires("boost/1.76.0") + self.requires("boost/1.81.0") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "11") + check_min_cppstd(self, self._min_cppstd) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["USE_BOOST_REGEX"] = self.options.boost_regex + tc.generate() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["USE_BOOST_REGEX"] = self.options.boost_regex - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + dpes = CMakeDeps(self) + dpes.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE*", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) # TODO: to remove in conan v2 once cmake_find_package_* generators removed self._create_cmake_module_alias_targets( @@ -96,8 +88,7 @@ def package(self): def _cmake_target(self): return "docopt" if self.options.shared else "docopt_s" - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): content += textwrap.dedent("""\ @@ -106,7 +97,7 @@ def _create_cmake_module_alias_targets(module_file, targets): set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + save(self, module_file, content) @property def _module_file_rel_path(self): @@ -120,7 +111,7 @@ def package_info(self): self.cpp_info.components["docopt"].libs = ["docopt"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["docopt"].system_libs = ["m"] - if self._is_msvc and self.options.shared: + if is_msvc(self) and self.options.shared: self.cpp_info.components["docopt"].defines = ["DOCOPT_DLL"] if self.options.boost_regex: self.cpp_info.components["docopt"].requires.append("boost::boost") diff --git a/recipes/docopt.cpp/all/test_package/CMakeLists.txt b/recipes/docopt.cpp/all/test_package/CMakeLists.txt index bfb18efe2d7e06..2f25c54702003d 100644 --- a/recipes/docopt.cpp/all/test_package/CMakeLists.txt +++ b/recipes/docopt.cpp/all/test_package/CMakeLists.txt @@ -1,15 +1,12 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(docopt REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) if(TARGET docopt_s) - target_link_libraries(${PROJECT_NAME} docopt_s) + target_link_libraries(${PROJECT_NAME} PRIVATE docopt_s) else() - target_link_libraries(${PROJECT_NAME} docopt) + target_link_libraries(${PROJECT_NAME} PRIVATE docopt) endif() diff --git a/recipes/docopt.cpp/all/test_package/conanfile.py b/recipes/docopt.cpp/all/test_package/conanfile.py index 96f53ca4b9bf0e..c72c51b464c6d3 100644 --- a/recipes/docopt.cpp/all/test_package/conanfile.py +++ b/recipes/docopt.cpp/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - exec_path = os.path.join("bin", "test_package") - self.run("{} --help".format(exec_path), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(f"{bin_path} --help", env="conanrun") diff --git a/recipes/docopt.cpp/all/test_v1_package/CMakeLists.txt b/recipes/docopt.cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/docopt.cpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/docopt.cpp/all/test_v1_package/conanfile.py b/recipes/docopt.cpp/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..85a33f95801480 --- /dev/null +++ b/recipes/docopt.cpp/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +# legacy validation with Conan 1.x +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(f"{bin_path} --help", run_environment=True) diff --git a/recipes/doctest/2.x.x/conanfile.py b/recipes/doctest/2.x.x/conanfile.py index 4017382a983009..4a5f3a48700e94 100644 --- a/recipes/doctest/2.x.x/conanfile.py +++ b/recipes/doctest/2.x.x/conanfile.py @@ -47,4 +47,4 @@ def package_info(self): self.cpp_info.build_modules.append("lib/cmake/doctest.cmake") def package_id(self): - self.info.header_only() + self.info.clear() diff --git a/recipes/drogon/all/conandata.yml b/recipes/drogon/all/conandata.yml index 08abde0a27bf2c..4211c4dd99f2bd 100644 --- a/recipes/drogon/all/conandata.yml +++ b/recipes/drogon/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.8.2": + url: "https://github.com/drogonframework/drogon/archive/v1.8.2.tar.gz" + sha256: "1182cab00c33e400eac617c6dbf44fa2f358e1844990b6b8c5c87783024f9971" "1.8.0": url: "https://github.com/drogonframework/drogon/archive/refs/tags/v1.8.0.tar.gz" sha256: "bc6503cf213ed961d4a5e9fd7cb8e75b6b11045a67840ea2241e57321dd8711b" @@ -6,6 +9,14 @@ sources: url: "https://github.com/drogonframework/drogon/archive/refs/tags/v1.7.5.tar.gz" sha256: "e2af7c55dcabafef16f26f5b3242692f5a2b54c19b7b626840bf9132d24766f6" patches: + "1.8.2": + - patch_file: "patches/1.8.0-0001-disable-unused-data.patch" + patch_description: "Consume Trantor package from Conan instead of using the\ + \ subproject" + patch_type: "conan" + - patch_file: "patches/1.8.0-0002-find-package-jsoncpp.patch" + patch_description: "Fix jsoncpp cmake target name" + patch_type: "conan" "1.8.0": - patch_file: "patches/1.8.0-0001-disable-unused-data.patch" patch_description: "Consume Trantor package from Conan instead of using the subproject" diff --git a/recipes/drogon/all/conanfile.py b/recipes/drogon/all/conanfile.py index c5ca4457d0f246..05e8a3e45cfa14 100644 --- a/recipes/drogon/all/conanfile.py +++ b/recipes/drogon/all/conanfile.py @@ -1,13 +1,12 @@ from conan import ConanFile from conan.tools.cmake import cmake_layout, CMakeToolchain, CMakeDeps, CMake -from conan.tools.files import copy, get, apply_conandata_patches, rmdir +from conan.tools.files import copy, get, apply_conandata_patches, export_conandata_patches, rmdir from conan.tools.build import check_min_cppstd from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration import os - -required_conan_version = ">=1.50.2 <1.51.0 || >=1.51.2" +required_conan_version = ">=1.53.0" class DrogonConan(ConanFile): name = "drogon" @@ -47,8 +46,7 @@ class DrogonConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -56,7 +54,7 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") self.options["trantor"].shared = True if not self.options.with_orm: del self.options.with_postgres @@ -67,25 +65,39 @@ def configure(self): elif not self.options.with_postgres: del self.options.with_postgres_batch + @property + def _min_cppstd(self): + return 14 if Version(self.version) < "1.8.2" else 17 + @property def _compilers_minimum_version(self): - return { - "gcc": "6", - "Visual Studio": "15.0", - "clang": "5", - "apple-clang": "10", - } + if Version(self.version) < "1.8.2": + return { + "Visual Studio": "15", + "msvc": "191", + "gcc": "6", + "clang": "5", + "apple-clang": "10", + } + else: + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "7", + "apple-clang": "12", + } def validate(self): if self.info.settings.compiler.cppstd: - check_min_cppstd(self, "14") + check_min_cppstd(self, self._min_cppstd) minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) if minimum_version: if Version(self.info.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("{} requires C++14, which your compiler does not support.".format(self.name)) + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.") else: - self.output.warn("{} requires C++14. Your compiler is unknown. Assuming it supports C++14.".format(self.name)) + self.output.warn(f"{self.ref} requires C++{self._min_cppstd}. Your compiler is unknown. Assuming it supports C++{self._min_cppstd}.") def requirements(self): self.requires("trantor/1.5.8") @@ -97,7 +109,7 @@ def requirements(self): if self.options.with_profile: self.requires("coz/cci.20210322") if self.options.with_boost: - self.requires("boost/1.80.0") + self.requires("boost/1.81.0") if self.options.with_brotli: self.requires("brotli/1.0.9") if self.options.get_safe("with_postgres"): @@ -107,7 +119,7 @@ def requirements(self): if self.options.get_safe("with_sqlite"): self.requires("sqlite3/3.40.0") if self.options.get_safe("with_redis"): - self.requires("hiredis/1.0.2") + self.requires("hiredis/1.1.0") def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -154,7 +166,7 @@ def package_info(self): if self.options.with_ctl: bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.PATH.append(bin_path) self.cpp_info.set_property("cmake_file_name", "Drogon") diff --git a/recipes/drogon/all/test_package/CMakeLists.txt b/recipes/drogon/all/test_package/CMakeLists.txt index 634b92448f47aa..cf16e9b501eaa8 100644 --- a/recipes/drogon/all/test_package/CMakeLists.txt +++ b/recipes/drogon/all/test_package/CMakeLists.txt @@ -1,14 +1,14 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package LANGUAGES CXX) find_package(Drogon CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} Drogon::Drogon) +target_link_libraries(${PROJECT_NAME} PRIVATE Drogon::Drogon) # drogon uses string_view when MSVC_VERSION is greater than 1900. # https://github.com/drogonframework/drogon/blob/v1.7.5/lib/inc/drogon/utils/string_view.h#L16 -if(DEFINED MSVC_VERSION AND MSVC_VERSION GREATER 1900) +if((DEFINED MSVC_VERSION AND MSVC_VERSION GREATER 1900) OR Drogon_VERSION VERSION_GREATER_EQUAL "1.8.2") target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) else() target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/drogon/all/test_v1_package/CMakeLists.txt b/recipes/drogon/all/test_v1_package/CMakeLists.txt index 3bd4427985a7ef..be00a8c7f57c71 100644 --- a/recipes/drogon/all/test_v1_package/CMakeLists.txt +++ b/recipes/drogon/all/test_v1_package/CMakeLists.txt @@ -1,18 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(Drogon CONFIG REQUIRED) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} Drogon::Drogon) - -# drogon uses string_view when MSVC_VERSION is greater than 1900. -# https://github.com/drogonframework/drogon/blob/v1.7.5/lib/inc/drogon/utils/string_view.h#L16 -if(DEFINED MSVC_VERSION AND MSVC_VERSION GREATER 1900) - target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) -else() - target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/drogon/config.yml b/recipes/drogon/config.yml index 6f8a6d82d93778..53e81010b34fec 100644 --- a/recipes/drogon/config.yml +++ b/recipes/drogon/config.yml @@ -1,4 +1,6 @@ versions: + "1.8.2": + folder: "all" "1.8.0": folder: "all" "1.7.5": diff --git a/recipes/duckdb/all/conandata.yml b/recipes/duckdb/all/conandata.yml index 4304099c6ee037..3126108b096882 100644 --- a/recipes/duckdb/all/conandata.yml +++ b/recipes/duckdb/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.6.1": + url: "https://github.com/duckdb/duckdb/archive/refs/tags/v0.6.0.tar.gz" + sha256: "700b09114f8b99892a9d19ba21ca962ae65d1ea8085622418a2fa50ff915b244" "0.6.0": url: "https://github.com/duckdb/duckdb/archive/refs/tags/v0.6.0.tar.gz" sha256: "700b09114f8b99892a9d19ba21ca962ae65d1ea8085622418a2fa50ff915b244" @@ -7,6 +10,13 @@ sources: sha256: "3dab7ba0d0f8d024d3c73fd3d4fb8834203c31d7b0ddb1e8539ee266e11b0e9b" patches: + "0.6.1": + - patch_file: "patches/0.6.0-0001-fix-cmake.patch" + patch_description: "install static of shared library, add installation for odbc extention" + patch_type: "portability" + - patch_file: "patches/0.6.0-0002-include-stdlib.patch" + patch_description: "include stdlib for abort function" + patch_type: "portability" "0.6.0": - patch_file: "patches/0.6.0-0001-fix-cmake.patch" patch_description: "install static of shared library, add installation for odbc extention" diff --git a/recipes/duckdb/all/conanfile.py b/recipes/duckdb/all/conanfile.py index 6e8d8bec8f4caa..994004c1132404 100644 --- a/recipes/duckdb/all/conanfile.py +++ b/recipes/duckdb/all/conanfile.py @@ -7,7 +7,7 @@ import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class DuckdbConan(ConanFile): name = "duckdb" @@ -70,10 +70,7 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") @@ -83,7 +80,7 @@ def requirements(self): if self.options.with_odbc: self.requires("odbc/2.3.11") if self.options.with_httpfs: - self.requires("openssl/3.0.5") + self.requires("openssl/3.0.7") def validate(self): if self.info.settings.compiler.cppstd: diff --git a/recipes/duckdb/all/test_v1_package/CMakeLists.txt b/recipes/duckdb/all/test_v1_package/CMakeLists.txt index 9319256c43756e..925ecbe19e448d 100644 --- a/recipes/duckdb/all/test_v1_package/CMakeLists.txt +++ b/recipes/duckdb/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(duckdb REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE duckdb::duckdb) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/duckdb/config.yml b/recipes/duckdb/config.yml index 77c93c26d75154..49d19e4d3a5cb0 100644 --- a/recipes/duckdb/config.yml +++ b/recipes/duckdb/config.yml @@ -1,4 +1,6 @@ versions: + "0.6.1": + folder: "all" "0.6.0": folder: "all" "0.5.1": diff --git a/recipes/elfio/all/conandata.yml b/recipes/elfio/all/conandata.yml index 267559b70048a0..f57351ff19434e 100644 --- a/recipes/elfio/all/conandata.yml +++ b/recipes/elfio/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.11": + sha256: 3307b104c205399786edbba203906de9517e36297709fe747faf9478d55fbb91 + url: https://github.com/serge1/ELFIO/releases/download/Release_3.11/elfio-3.11.tar.gz "3.10": sha256: cdc6362ede2e0c8d1d6db15d7da4b526f461d9cfae6f6337369e416a8bc60234 url: https://github.com/serge1/ELFIO/releases/download/Release_3.10/elfio-3.10.tar.gz diff --git a/recipes/elfio/all/conanfile.py b/recipes/elfio/all/conanfile.py index 497de23753765c..8efd907fc132d8 100644 --- a/recipes/elfio/all/conanfile.py +++ b/recipes/elfio/all/conanfile.py @@ -1,5 +1,9 @@ +from conan import ConanFile +from conan.tools.layout import basic_layout +from conan.tools.files import get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version import os -from conans import ConanFile, tools class ElfioConan(ConanFile): @@ -7,26 +11,43 @@ class ElfioConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "http://elfio.sourceforge.net" description = "A header-only C++ library that provides a simple interface for reading and generating files in ELF binary format." - topics = ("conan", "elfio", "elf") + topics = ("elfio", "elf") license = "MIT" settings = "compiler" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" - def configure(self): if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + if Version(self.version) < "3.11": + check_min_cppstd(self, 11) + else: + check_min_cppstd(self, 14) + + def layout(self): + basic_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("elfio-{}".format(self.version), self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package_id(self): - self.info.header_only() + self.info.clear() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - self.copy(pattern=os.path.join("elfio", "*.hpp"), src=self._source_subfolder, dst="include") + copy( + self, + pattern="COPYING", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + ) + copy( + self, + pattern="LICENSE*", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + ) + copy( + self, + pattern=os.path.join("elfio", "*.hpp"), + src=self.source_folder, + dst=os.path.join(self.package_folder, "include"), + ) diff --git a/recipes/elfio/all/test_package/CMakeLists.txt b/recipes/elfio/all/test_package/CMakeLists.txt index 055d849f41b284..8980e10b063e69 100755 --- a/recipes/elfio/all/test_package/CMakeLists.txt +++ b/recipes/elfio/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(elfio REQUIRED CONFIG) add_executable(example example.cpp) -target_link_libraries(example ${CONAN_LIBS}) -set_target_properties(example PROPERTIES - CXX_STANDARD 11 # Elfio requires at least c++11 - CXX_STANDARD_REQUIRED ON) +target_link_libraries(example PRIVATE elfio::elfio) +target_compile_features(example PRIVATE cxx_std_14) diff --git a/recipes/elfio/all/test_package/conanfile.py b/recipes/elfio/all/test_package/conanfile.py index 23f4017aae4890..8a039654ce69f3 100755 --- a/recipes/elfio/all/test_package/conanfile.py +++ b/recipes/elfio/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class ElfioTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "example") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "example") + self.run(bin_path, env="conanrun") diff --git a/recipes/elfio/all/test_v1_package/CMakeLists.txt b/recipes/elfio/all/test_v1_package/CMakeLists.txt new file mode 100755 index 00000000000000..8980e10b063e69 --- /dev/null +++ b/recipes/elfio/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +find_package(elfio REQUIRED CONFIG) + +add_executable(example example.cpp) +target_link_libraries(example PRIVATE elfio::elfio) +target_compile_features(example PRIVATE cxx_std_14) diff --git a/recipes/elfio/all/test_v1_package/conanfile.py b/recipes/elfio/all/test_v1_package/conanfile.py new file mode 100755 index 00000000000000..2653a9aa71c861 --- /dev/null +++ b/recipes/elfio/all/test_v1_package/conanfile.py @@ -0,0 +1,22 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class ElfioTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "example") + self.run(bin_path, env="conanrun") diff --git a/recipes/elfio/all/test_v1_package/example.cpp b/recipes/elfio/all/test_v1_package/example.cpp new file mode 100755 index 00000000000000..08728f016b5542 --- /dev/null +++ b/recipes/elfio/all/test_v1_package/example.cpp @@ -0,0 +1,14 @@ + +#include +#include + +using namespace ELFIO; + +int main() { + // just check we can create an reader, that means the recipe works + elfio reader; + if ( !reader.load( "/does/not/exist" ) ) { + return EXIT_SUCCESS; + } + return EXIT_FAILURE; +} diff --git a/recipes/elfio/config.yml b/recipes/elfio/config.yml index 9fda1f4e349b2c..387fbf23f814ba 100644 --- a/recipes/elfio/config.yml +++ b/recipes/elfio/config.yml @@ -1,4 +1,6 @@ versions: + "3.11": + folder: all "3.10": folder: all "3.9": diff --git a/recipes/emsdk/all/conandata.yml b/recipes/emsdk/all/conandata.yml index 97335d64e50ee9..13960aa77279e1 100644 --- a/recipes/emsdk/all/conandata.yml +++ b/recipes/emsdk/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "3.1.30": + url: "https://github.com/emscripten-core/emsdk/archive/3.1.30.tar.gz" + sha256: "7b9c4e0b19f08df9f0d807112926f3908fe73a2960b752a87c3862956da8b9a8" + "3.1.29": + url: "https://github.com/emscripten-core/emsdk/archive/refs/tags/3.1.29.tar.gz" + sha256: "506376d0d2a71fc3dd1a4dba6fb4cf18f0a2fa4e1936aa04ba4b59f2d435bf3f" "3.1.23": url: "https://github.com/emscripten-core/emsdk/archive/3.1.23.tar.gz" sha256: "a2609fd97580e4e332acbf49b6cc363714982f06cb6970d54c9789df8e91381c" diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py index b9f626ca08eefd..64d00c50649055 100644 --- a/recipes/emsdk/all/conanfile.py +++ b/recipes/emsdk/all/conanfile.py @@ -159,8 +159,13 @@ def package_info(self): self.buildenv_info.define_path("EM_CONFIG", self._em_config) self.buildenv_info.define_path("EM_CACHE", self._em_cache) - self.buildenv_info.define_path("CC", self._define_tool_var("emcc")) - self.buildenv_info.define_path("CXX", self._define_tool_var("em++")) + compiler_executables = { + "c": self._define_tool_var("emcc"), + "cpp": self._define_tool_var("em++"), + } + self.conf_info.update("tools.build:compiler_executables", compiler_executables) + self.buildenv_info.define_path("CC", compiler_executables["c"]) + self.buildenv_info.define_path("CXX", compiler_executables["cpp"]) self.buildenv_info.define_path("AR", self._define_tool_var("emar")) self.buildenv_info.define_path("NM", self._define_tool_var("emnm")) self.buildenv_info.define_path("RANLIB", self._define_tool_var("emranlib")) @@ -183,8 +188,8 @@ def package_info(self): self.env_info.EMSCRIPTEN = self._emscripten self.env_info.EM_CONFIG = self._em_config self.env_info.EM_CACHE = self._em_cache - self.env_info.CC = self._define_tool_var("emcc") - self.env_info.CXX = self._define_tool_var("em++") + self.env_info.CC = compiler_executables["c"] + self.env_info.CXX = compiler_executables["cpp"] self.env_info.AR = self._define_tool_var("emar") self.env_info.NM = self._define_tool_var("emnm") self.env_info.RANLIB = self._define_tool_var("emranlib") diff --git a/recipes/emsdk/config.yml b/recipes/emsdk/config.yml index 7591f3687c3226..dcab8dc9efb2f7 100644 --- a/recipes/emsdk/config.yml +++ b/recipes/emsdk/config.yml @@ -1,4 +1,8 @@ versions: + "3.1.30": + folder: all + "3.1.29": + folder: all "3.1.23": folder: all "3.1.20": diff --git a/recipes/etl/all/conandata.yml b/recipes/etl/all/conandata.yml index 28a7b9e5386ab2..1c7a7976936cdc 100644 --- a/recipes/etl/all/conandata.yml +++ b/recipes/etl/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "20.35.8": + url: "https://github.com/ETLCPP/etl/archive/20.35.8.tar.gz" + sha256: "7d0a6402b24fc91cf66328b95391a38c52d20f582f42497fb9b0a99d71ab8879" + "20.35.7": + url: "https://github.com/ETLCPP/etl/archive/20.35.7.tar.gz" + sha256: "20127e36c12a33142645dd5ec0a08d12b34ce9b33986847eeaa8c4201e025895" + "20.35.5": + url: "https://github.com/ETLCPP/etl/archive/20.35.5.tar.gz" + sha256: "d67aead4f1c023eaeb9ae67b62b0aed76138aa1b7dac48f627530ab3ea366281" "20.35.0": url: "https://github.com/ETLCPP/etl/archive/20.35.0.tar.gz" sha256: "1bfbc5679bce41625add0e5d7354ab8521dc4811f13e1627a9816af65f49f42b" diff --git a/recipes/etl/config.yml b/recipes/etl/config.yml index 00ddf8566d799b..0fe84ca008d0e8 100644 --- a/recipes/etl/config.yml +++ b/recipes/etl/config.yml @@ -1,4 +1,10 @@ versions: + "20.35.8": + folder: all + "20.35.7": + folder: all + "20.35.5": + folder: all "20.35.0": folder: all "20.34.0": diff --git a/recipes/faac/all/conandata.yml b/recipes/faac/all/conandata.yml index 187de5684ab948..a217e9fd92fd5c 100644 --- a/recipes/faac/all/conandata.yml +++ b/recipes/faac/all/conandata.yml @@ -2,10 +2,15 @@ sources: "1.30": url: "https://github.com/knik0/faac/archive/1_30.tar.gz" sha256: "adc387ce588cca16d98c03b6ec1e58f0ffd9fc6eadb00e254157d6b16203b2d2" - "1.28": - url: "https://github.com/knik0/faac/archive/refs/tags/faac1_28.tar.gz" - sha256: "fec821797a541e8359f086fef454b947a7f7246fe8ec6207668968b86606a7dd" patches: "1.30": - - patch_file: "patches/001-fix-out-of-root-build.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.30-0001-fix-out-of-root-build.patch" + patch_description: "Fix out of root build" + patch_source: "https://github.com/knik0/faac/commit/c8d12a5c7c5b6f1c4593f0a6c1eeceacc4d7c941.patch" + patch_type: "conan" + - patch_file: "patches/1.30-0002-dont-hardcode-x86.patch" + patch_description: "Allow to build for x86_64" + patch_type: "portability" + - patch_file: "patches/1.30-0003-relax-windows-sdk.patch" + patch_description: "Don't constrain Windows SDK" + patch_type: "portability" diff --git a/recipes/faac/all/conanfile.py b/recipes/faac/all/conanfile.py index bd64d9ff6cbb83..101a73acd4cc45 100644 --- a/recipes/faac/all/conanfile.py +++ b/recipes/faac/all/conanfile.py @@ -1,10 +1,15 @@ -from conan.tools.files import apply_conandata_patches -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, MSBuild, MSBuildToolchain +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class FaacConan(ConanFile): @@ -29,14 +34,6 @@ class FaacConan(ConanFile): "drm": False, } - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _is_mingw(self): return self.settings.os == "Windows" and self.settings.compiler == "gcc" @@ -47,11 +44,18 @@ def _settings_build(self): @property def _has_mp4_option(self): - return tools.Version(self.version) < "1.29.1" + return Version(self.version) < "1.29.1" + + @property + def _msbuild_configuration(self): + return "Debug" if self.settings.build_type == "Debug" else "Release" + + @property + def _sln_folder(self): + return os.path.join(self.source_folder, "project", "msvc") def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -61,69 +65,127 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): # FIXME: libfaac depends on kissfft. Try to unvendor this dependency pass def validate(self): - if self._is_msvc: - # FIXME: add msvc support since there are MSBuild files upstream - raise ConanInvalidConfiguration("libfaac conan-center recipe doesn't support building with Visual Studio yet") + if is_msvc(self): + if self.settings.arch not in ["x86", "x86_64"]: + raise ConanInvalidConfiguration(f"{self.ref} only supports x86 and x86_64 with Visual Studio") + if self.options.drm and not self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} with drm support can't be built as static with Visual Studio") if self.options.get_safe("with_mp4"): # TODO: as mpv4v2 as a conan package raise ConanInvalidConfiguration("building with mp4v2 is not supported currently") def build_requirements(self): - self.build_requires("libtool/2.4.6") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if not is_msvc(self): + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - autotools.libs = [] - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--enable-drm={}".format(yes_no(self.options.drm)), - ] - if self._has_mp4_option: - args.append("--with-mp4v2={}".format(yes_no(self.options.with_mp4))) - autotools.configure(configure_dir=self._source_subfolder, args=args) - return autotools + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.configuration = self._msbuild_configuration + tc.generate() + else: + VirtualBuildEnv(self).generate() + tc = AutotoolsToolchain(self) + yes_no = lambda v: "yes" if v else "no" + tc.configure_args.append(f"--enable-drm={yes_no(self.options.drm)}") + if self._has_mp4_option: + tc.configure_args.append(f"--with-mp4v2={yes_no(self.options.with_mp4)}") + tc.generate() def build(self): apply_conandata_patches(self) - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) - tools.replace_in_file("configure", "-install_name \\$rpath/", "-install_name @rpath/") + if is_msvc(self): + #========================== + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + vcxproj_files = ["faac.vcxproj", "libfaac.vcxproj", "libfaac_dll.vcxproj", "libfaac_dll_drm.vcxproj"] + platform_toolset = MSBuildToolchain(self).toolset + conantoolchain_props = os.path.join(self.generators_folder, MSBuildToolchain.filename) + for vcxproj_file in vcxproj_files: + replace_in_file( + self, os.path.join(self._sln_folder, vcxproj_file), + "v141", + f"{platform_toolset}", + ) + replace_in_file( + self, os.path.join(self._sln_folder, vcxproj_file), + "", + f"", + ) + #========================== + + msbuild = MSBuild(self) + msbuild.build_type = self._msbuild_configuration + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + # Allow to build for other archs than Win32 + if self.settings.arch != "x86": + for vc_proj_file in ( + "faac.sln", "faac.vcxproj", "libfaac.vcxproj", + "libfaac_dll.vcxproj", "libfaac_dll_drm.vcxproj" + ): + replace_in_file(self, os.path.join(self._sln_folder, vc_proj_file), "Win32", msbuild.platform) + targets = ["faac"] + if self.options.drm: + targets.append("libfaac_dll_drm") + else: + targets.append("libfaac_dll" if self.options.shared else "libfaac") + msbuild.build(os.path.join(self._sln_folder, "faac.sln"), targets=targets) + else: + autotools = Autotools(self) + autotools.autoreconf() if self._is_mingw and self.options.shared: - tools.replace_in_file(os.path.join("libfaac", "Makefile"), - "\nlibfaac_la_LIBADD = ", - "\nlibfaac_la_LIBADD = -no-undefined ") - autotools = self._configure_autotools() - autotools.make() + replace_in_file(self, os.path.join(self.build_folder, "libfaac", "Makefile"), + "\nlibfaac_la_LIBADD = ", + "\nlibfaac_la_LIBADD = -no-undefined ") + autotools.configure() + autotools.make() def package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - autotools = self._configure_autotools() - autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + copy(self, "*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + output_folder = os.path.join(self._sln_folder, "bin", self._msbuild_configuration) + copy(self, "*.exe", src=output_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "*.dll", src=output_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + if self.options.drm: + old_libname = "libfaacdrm.lib" + new_libname = "faac_drm.lib" + else: + old_libname = "libfaac_dll.lib" if self.options.shared else "libfaac.lib" + new_libname = "faac.lib" + lib_folder = os.path.join(self.package_folder, "lib") + copy(self, old_libname, src=output_folder, dst=lib_folder, keep_path=False) + rename(self, os.path.join(lib_folder, old_libname), os.path.join(lib_folder, new_libname)) + else: + autotools = Autotools(self) + autotools.install() + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.libs = ["faac"] + suffix = "_drm" if self.options.drm else "" + self.cpp_info.libs = [f"faac{suffix}"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") - bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) - self.env_info.PATH.append(bindir) + # TODO: to remove in conan v2 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/faac/all/patches/001-fix-out-of-root-build.patch b/recipes/faac/all/patches/1.30-0001-fix-out-of-root-build.patch similarity index 100% rename from recipes/faac/all/patches/001-fix-out-of-root-build.patch rename to recipes/faac/all/patches/1.30-0001-fix-out-of-root-build.patch diff --git a/recipes/faac/all/patches/1.30-0002-dont-hardcode-x86.patch b/recipes/faac/all/patches/1.30-0002-dont-hardcode-x86.patch new file mode 100644 index 00000000000000..f39de0190d9d74 --- /dev/null +++ b/recipes/faac/all/patches/1.30-0002-dont-hardcode-x86.patch @@ -0,0 +1,74 @@ +--- a/project/msvc/faac.vcxproj ++++ b/project/msvc/faac.vcxproj +@@ -66,7 +66,7 @@ + 0x0413 + + +- /MACHINE:I386 %(AdditionalOptions) ++ %(AdditionalOptions) + true + true + Console +@@ -89,7 +89,7 @@ + 0x0413 + + +- /MACHINE:I386 %(AdditionalOptions) ++ %(AdditionalOptions) + true + Console + +--- a/project/msvc/libfaac_dll.vcxproj ++++ b/project/msvc/libfaac_dll.vcxproj +@@ -61,10 +61,9 @@ + true + + +- /MACHINE:I386 %(AdditionalOptions) ++ %(AdditionalOptions) + true + .\libfaac.def +- MachineX86 + + + Retrieving package version... +@@ -84,11 +83,10 @@ + EditAndContinue + + +- /MACHINE:I386 %(AdditionalOptions) ++ %(AdditionalOptions) + true + .\libfaac.def + true +- MachineX86 + + + Retrieving package version... +--- a/project/msvc/libfaac_dll_drm.vcxproj ++++ b/project/msvc/libfaac_dll_drm.vcxproj +@@ -61,10 +61,9 @@ + true + + +- /MACHINE:I386 %(AdditionalOptions) ++ %(AdditionalOptions) + true + .\libfaac.def +- MachineX86 + $(OutDir)libfaacdrm.lib + + +@@ -85,11 +84,10 @@ + EditAndContinue + + +- /MACHINE:I386 %(AdditionalOptions) ++ %(AdditionalOptions) + true + .\libfaac.def + true +- MachineX86 + $(OutDir)libfaacdrm.lib + + diff --git a/recipes/faac/all/patches/1.30-0003-relax-windows-sdk.patch b/recipes/faac/all/patches/1.30-0003-relax-windows-sdk.patch new file mode 100644 index 00000000000000..772fe863051a4a --- /dev/null +++ b/recipes/faac/all/patches/1.30-0003-relax-windows-sdk.patch @@ -0,0 +1,40 @@ +--- a/project/msvc/faac.vcxproj ++++ b/project/msvc/faac.vcxproj +@@ -12,7 +12,6 @@ + + + {92992E74-AEDE-46DC-AD8C-ADEA876F1A4C} +- 8.1 + + + +--- a/project/msvc/libfaac.vcxproj ++++ b/project/msvc/libfaac.vcxproj +@@ -13,7 +13,6 @@ + + libfaac + {9CC48C6E-92EB-4814-AD37-97AB3622AB65} +- 8.1 + + + +--- a/project/msvc/libfaac_dll.vcxproj ++++ b/project/msvc/libfaac_dll.vcxproj +@@ -13,7 +13,6 @@ + + libfaac_dll + {856BB8CF-B944-4D7A-9D59-4945316229AA} +- 8.1 + + + +--- a/project/msvc/libfaac_dll_drm.vcxproj ++++ b/project/msvc/libfaac_dll_drm.vcxproj +@@ -13,7 +13,6 @@ + + libfaac_dll_drm + {AA2D0EFE-E73D-40AD-ADCE-8A2B54F34C6F} +- 8.1 + + + diff --git a/recipes/faac/all/test_package/CMakeLists.txt b/recipes/faac/all/test_package/CMakeLists.txt index 366ecce0962e72..d2d4532f8451ff 100644 --- a/recipes/faac/all/test_package/CMakeLists.txt +++ b/recipes/faac/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.1.0) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) find_package(faac REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} faac::faac) +target_link_libraries(${PROJECT_NAME} PRIVATE faac::faac) diff --git a/recipes/faac/all/test_package/conanfile.py b/recipes/faac/all/test_package/conanfile.py index 697dfef261b53b..0a6bc68712d901 100644 --- a/recipes/faac/all/test_package/conanfile.py +++ b/recipes/faac/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -21,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/faac/all/test_v1_package/CMakeLists.txt b/recipes/faac/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/faac/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/faac/all/test_v1_package/conanfile.py b/recipes/faac/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/faac/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/faac/config.yml b/recipes/faac/config.yml index e34a7ad292edbb..a6f1b0cffc2ddf 100644 --- a/recipes/faac/config.yml +++ b/recipes/faac/config.yml @@ -1,5 +1,3 @@ versions: "1.30": folder: all - "1.28": - folder: all diff --git a/recipes/fakeit/all/conandata.yml b/recipes/fakeit/all/conandata.yml index 822858ea79ad4c..6c84b299ffd6c9 100644 --- a/recipes/fakeit/all/conandata.yml +++ b/recipes/fakeit/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.3.2": + url: "https://github.com/eranpeer/FakeIt/archive/2.3.2.tar.gz" + sha256: "d2472d0d4b3dce83e8c9672e9221375c7a0c32aa8fe57c20075776928142b495" + "2.3.1": + url: "https://github.com/eranpeer/FakeIt/archive/2.3.1.tar.gz" + sha256: "8dea371c729ff4b5f007dafc95e7807ea146402a3b0da1b5a11cace538a57b61" "2.3.0": url: "https://github.com/eranpeer/FakeIt/archive/2.3.0.tar.gz" sha256: "990469c1e4608ebf662d64e979aa607a0c32faa40cc5ffe38b74c7dd6968ed2d" diff --git a/recipes/fakeit/config.yml b/recipes/fakeit/config.yml index 46e3c97d8884aa..a05c93c91a0633 100644 --- a/recipes/fakeit/config.yml +++ b/recipes/fakeit/config.yml @@ -1,4 +1,8 @@ versions: + "2.3.2": + folder: all + "2.3.1": + folder: all "2.3.0": folder: all "2.2.0": diff --git a/recipes/fast_double_parser/all/conandata.yml b/recipes/fast_double_parser/all/conandata.yml index c25ac034457d15..e6359076757f6a 100644 --- a/recipes/fast_double_parser/all/conandata.yml +++ b/recipes/fast_double_parser/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.7.0": + url: "https://github.com/lemire/fast_double_parser/archive/v0.7.0.tar.gz" + sha256: "eb80a1d9c406bbe8cb22fffd3c007651f716abd03225009302d8aba8e9c4df77" "0.6.0": url: "https://github.com/lemire/fast_double_parser/archive/refs/tags/v0.6.0.tar.gz" sha256: "90835c770a2577a38442601e92330207ad8b917f956614938303b8439d13b282" diff --git a/recipes/fast_double_parser/config.yml b/recipes/fast_double_parser/config.yml index 33d7618432d305..d61439bae1bc34 100644 --- a/recipes/fast_double_parser/config.yml +++ b/recipes/fast_double_parser/config.yml @@ -1,4 +1,6 @@ versions: + "0.7.0": + folder: all "0.6.0": folder: all "0.5.0": diff --git a/recipes/ffmpeg/all/conanfile.py b/recipes/ffmpeg/all/conanfile.py index a5907c7b7ccb30..c66437da011ce9 100644 --- a/recipes/ffmpeg/all/conanfile.py +++ b/recipes/ffmpeg/all/conanfile.py @@ -350,6 +350,8 @@ def _target_os(self): target_os = triplet.split("-")[2] if target_os == "gnueabihf": target_os = "gnu" # could also be "linux" + if target_os.startswith("android"): + target_os = "android" return target_os def _patch_sources(self): diff --git a/recipes/flatbuffers/all/conandata.yml b/recipes/flatbuffers/all/conandata.yml index 1dfbf2c1e3bbb1..a637b19cca0ad9 100644 --- a/recipes/flatbuffers/all/conandata.yml +++ b/recipes/flatbuffers/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "22.12.06": + url: "https://github.com/google/flatbuffers/archive/v22.12.06.tar.gz" + sha256: "209823306f2cbedab6ff70997e0d236fcfd1864ca9ad082cbfdb196e7386daed" "22.11.23": url: "https://github.com/google/flatbuffers/archive/v22.11.23.tar.gz" sha256: "8e9bacc942db59ca89a383dd7923f3e69a377d6e579d1ba13557de1fdfddf56a" diff --git a/recipes/flatbuffers/config.yml b/recipes/flatbuffers/config.yml index 53fefa755dcb26..014a45840cfb26 100644 --- a/recipes/flatbuffers/config.yml +++ b/recipes/flatbuffers/config.yml @@ -1,4 +1,6 @@ versions: + "22.12.06": + folder: all "22.11.23": folder: all "22.10.26": diff --git a/recipes/flecs/all/conandata.yml b/recipes/flecs/all/conandata.yml index 5eff0caa1c101b..cccdeded9497c5 100644 --- a/recipes/flecs/all/conandata.yml +++ b/recipes/flecs/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "3.1.3": + url: "https://github.com/SanderMertens/flecs/archive/refs/tags/v3.1.3.tar.gz" + sha256: "52da12a8bae260be21bf29d97af622241efd822737d0a15e551cd92e30abd5c9" + "3.1.2": + url: "https://github.com/SanderMertens/flecs/archive/refs/tags/v3.1.2.tar.gz" + sha256: "1fe4f78b44f2ded1355179a8395bb254fbd8a9db88b9f8ecd890472d60acf723" "3.1.1": url: "https://github.com/SanderMertens/flecs/archive/refs/tags/v3.1.1.tar.gz" sha256: "f31edfa258b90d086c311ad5ccc60e8e1ab0448aa10856d96e9e503cc15c1c63" diff --git a/recipes/flecs/config.yml b/recipes/flecs/config.yml index dd4804a9998741..3560a32c7e5efc 100644 --- a/recipes/flecs/config.yml +++ b/recipes/flecs/config.yml @@ -1,4 +1,8 @@ versions: + "3.1.3": + folder: all + "3.1.2": + folder: all "3.1.1": folder: all "3.1.0": diff --git a/recipes/foonathan-lexy/all/conandata.yml b/recipes/foonathan-lexy/all/conandata.yml index f7151e22f94baf..98cd033191be37 100644 --- a/recipes/foonathan-lexy/all/conandata.yml +++ b/recipes/foonathan-lexy/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2022.12.1": + url: "https://github.com/foonathan/lexy/releases/download/v2022.12.1/lexy-src.zip" + sha256: "4c16efd31d03f908c7125352ebacbdb6c028de3788ca56940175e7017dbc6c7f" + "2022.12.00": + url: "https://github.com/foonathan/lexy/releases/download/v2022.12.0/lexy-src.zip" + sha256: "62afda502963abce28f051416b977dcc8f11581ba0773f4b1da39a9b4842b19d" "2022.05.01": url: "https://github.com/foonathan/lexy/releases/download/v2022.05.1/lexy-src.zip" sha256: "de2199f8233ea5ed9d4dbe86a8eaf88d754decd28e28554329a7b29b4d952773" diff --git a/recipes/foonathan-lexy/all/conanfile.py b/recipes/foonathan-lexy/all/conanfile.py index bc8d75798a2d54..d95ef191b17a05 100644 --- a/recipes/foonathan-lexy/all/conanfile.py +++ b/recipes/foonathan-lexy/all/conanfile.py @@ -1,6 +1,5 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.microsoft import check_min_vs, is_msvc from conan.tools.files import get, copy, rm, rmdir from conan.tools.build import check_min_cppstd from conan.tools.scm import Version @@ -32,6 +31,8 @@ def _min_cppstd(self): @property def _compilers_minimum_version(self): return { + "Visual Studio": "16", + "msvc": "192", "gcc": "8", "clang": "7", "apple-clang": "10", @@ -47,16 +48,26 @@ def layout(self): def validate(self): if self.info.settings.compiler.cppstd: check_min_cppstd(self, self._min_cppstd) - check_min_vs(self, 192) - if not is_msvc(self): - minimum_version = self._compilers_minimum_version.get(str(self.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." - ) + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output=output) + m = re.search(r'cmake version (\d+\.\d+\.\d+)', output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False def build_requirements(self): - self.tool_requires("cmake/3.18.0") + if not self._cmake_new_enough("3.18"): + self.tool_requires("cmake/3.25.0") def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder) diff --git a/recipes/foonathan-lexy/config.yml b/recipes/foonathan-lexy/config.yml index 0ce23eac9b55d5..9b16b933ef1b66 100644 --- a/recipes/foonathan-lexy/config.yml +++ b/recipes/foonathan-lexy/config.yml @@ -1,3 +1,7 @@ versions: + "2022.12.1": + folder: all + "2022.12.00": + folder: all "2022.05.01": folder: all diff --git a/recipes/foonathan-memory/all/conandata.yml b/recipes/foonathan-memory/all/conandata.yml index 7a847a5e8afc78..5438e06adfb025 100644 --- a/recipes/foonathan-memory/all/conandata.yml +++ b/recipes/foonathan-memory/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.7.3": + url: "https://github.com/foonathan/memory/archive/refs/tags/v0.7-3.tar.gz" + sha256: "4203d15db22a94a3978eeb1afb59a37d35c57c0f148733f0f1a53a6281cb74dd" "0.7.2": url: "https://github.com/foonathan/memory/archive/refs/tags/v0.7-2.tar.gz" sha256: "8aba7211bb0e59b7538decda453e492cc6e36f8781508ed92b38cbafe8a48762" @@ -11,3 +14,5 @@ sources: patches: "0.7.0": - patch_file: "patches/0.7.0-0001-fix-virtualAllocFromApp.patch" + patch_description: "use VirtualAlloc on Desktop environment" + patch_type: "portability" diff --git a/recipes/foonathan-memory/config.yml b/recipes/foonathan-memory/config.yml index 75789cf28caa84..d4d016ea9d4235 100644 --- a/recipes/foonathan-memory/config.yml +++ b/recipes/foonathan-memory/config.yml @@ -1,4 +1,6 @@ versions: + "0.7.3": + folder: all "0.7.2": folder: all "0.7.1": diff --git a/recipes/g3log/all/conandata.yml b/recipes/g3log/all/conandata.yml index 140d23e5b67d19..81ba1376072ad0 100644 --- a/recipes/g3log/all/conandata.yml +++ b/recipes/g3log/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.1": + url: "https://github.com/KjellKod/g3log/archive/2.1.tar.gz" + sha256: "13c9d8cc0387792301f264c4f623618fc4dea9814d9b5844931ffbfd9aafb1fe" "1.3.4": url: "https://github.com/KjellKod/g3log/archive/refs/tags/1.3.4.tar.gz" sha256: "2fe8815e5f5afec6b49bdfedfba1e86b8e58a5dc89fd97f4868fb7f3141aed19" @@ -14,3 +17,5 @@ sources: patches: "1.3.2": - patch_file: "patches/0002-remove-explicit-stdlib-setting.patch" + patch_description: "fix compilation and link errors on Linux" + patch_type: "portability" diff --git a/recipes/g3log/all/conanfile.py b/recipes/g3log/all/conanfile.py index 298068a223096d..560379c7334960 100644 --- a/recipes/g3log/all/conanfile.py +++ b/recipes/g3log/all/conanfile.py @@ -8,20 +8,19 @@ import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class G3logConan(ConanFile): name = "g3log" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/KjellKod/g3log" - license = "The Unlicense" description = ( "G3log is an asynchronous, \"crash safe\", logger that is easy to use " "with default logging sinks or you can add your own." ) - topics = ("g3log", "log") - + license = "The Unlicense" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/KjellKod/g3log" + topics = ("logging", "log", "asynchronous") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -46,14 +45,28 @@ class G3logConan(ConanFile): "debug_break_at_fatal_signal": False, } + @property + def _min_cppstd(self): + return 14 if Version(self.version) < "2.0" else 17 + @property def _compilers_minimum_version(self): - return { - "gcc": "6.1", - "clang": "3.4", - "apple-clang": "5.1", - "Visual Studio": "15", - } + if Version(self.version) < "2.0": + return { + "gcc": "6.1", + "clang": "3.4", + "apple-clang": "5.1", + "Visual Studio": "15", + "msvc": "191", + } + else: + return { + "gcc": "8", + "clang": "7", + "apple-clang": "12", + "Visual Studio": "16", + "msvc": "192", + } def export_sources(self): for p in self.conan_data.get("patches", {}).get(self.version, []): @@ -68,11 +81,11 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def validate(self): if self.info.settings.compiler.cppstd: - check_min_cppstd(self, "14") + check_min_cppstd(self, self._min_cppstd) def loose_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] @@ -82,9 +95,7 @@ def loose_lt_semver(v1, v2): minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) if minimum_version and loose_lt_semver(str(self.info.settings.compiler.version), minimum_version): - raise ConanInvalidConfiguration( - "{} requires C++14, which your compiler does not support.".format(self.name) - ) + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.") def layout(self): cmake_layout(self, src_folder="src") @@ -147,8 +158,13 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "g3log") self.cpp_info.set_property("cmake_target_name", "g3log") self.cpp_info.libs = ["g3logger" if Version(self.version) < "1.3.4" else "g3log"] - if self.settings.os in ["Linux", "Android"]: + + if self.settings.os in ["Linux", "FreeBSD", "Android"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.system_libs.append("rt") self.cpp_info.system_libs.append("pthread") + if self.settings.os == "Windows": + self.cpp_info.system_libs.append("dbghelp") # TODO: to remove in conan v2 once legacy generators removed self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] diff --git a/recipes/g3log/all/test_package/CMakeLists.txt b/recipes/g3log/all/test_package/CMakeLists.txt index 6bcbaa08a0d71c..c9d535ba3d96a1 100644 --- a/recipes/g3log/all/test_package/CMakeLists.txt +++ b/recipes/g3log/all/test_package/CMakeLists.txt @@ -5,4 +5,8 @@ find_package(g3log REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE g3log) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +if(g3log_VERSION VERSION_LESS 2.0) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() diff --git a/recipes/g3log/all/test_v1_package/CMakeLists.txt b/recipes/g3log/all/test_v1_package/CMakeLists.txt index a12ddaa2ea9489..be00a8c7f57c71 100644 --- a/recipes/g3log/all/test_v1_package/CMakeLists.txt +++ b/recipes/g3log/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(g3log REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE g3log) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/g3log/config.yml b/recipes/g3log/config.yml index c34ce10c74ca3e..64be3dabf4e85a 100644 --- a/recipes/g3log/config.yml +++ b/recipes/g3log/config.yml @@ -1,4 +1,6 @@ versions: + "2.1": + folder: all "1.3.4": folder: all "1.3.3": diff --git a/recipes/gcc/all/conandata.yml b/recipes/gcc/all/conandata.yml index dcd31b786fcb02..f7f34296518837 100644 --- a/recipes/gcc/all/conandata.yml +++ b/recipes/gcc/all/conandata.yml @@ -1,7 +1,10 @@ sources: - "10.2.0": - sha256: 27e879dccc639cd7b0cc08ed575c1669492579529b53c9ff27b0b96265fa867d - url: https://ftp.gnu.org/gnu/gcc/gcc-10.2.0/gcc-10.2.0.tar.gz "12.2.0": sha256: ac6b317eb4d25444d87cf29c0d141dedc1323a1833ec9995211b13e1a851261c url: https://ftp.gnu.org/gnu/gcc/gcc-12.2.0/gcc-12.2.0.tar.gz + "11.3.0": + sha256: 98438e6cc7294298b474cf0da7655d9a8c8b796421bb0210531c294a950374ed + url: https://ftp.gnu.org/gnu/gcc/gcc-11.3.0/gcc-11.3.0.tar.gz + "10.2.0": + sha256: 27e879dccc639cd7b0cc08ed575c1669492579529b53c9ff27b0b96265fa867d + url: https://ftp.gnu.org/gnu/gcc/gcc-10.2.0/gcc-10.2.0.tar.gz diff --git a/recipes/gcc/all/conanfile.py b/recipes/gcc/all/conanfile.py index 309ef5f64d0ab6..1d20bad3fdda20 100644 --- a/recipes/gcc/all/conanfile.py +++ b/recipes/gcc/all/conanfile.py @@ -1,126 +1,196 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanException, ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.errors import ConanInvalidConfiguration +from conan.tools.layout import basic_layout +from conan.tools.apple import XCRun +from conan.tools.files import copy, get, replace_in_file, rmdir, rm +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv +from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.29.1" +required_conan_version = ">=1.53.0" class GccConan(ConanFile): name = "gcc" - description = "The GNU Compiler Collection includes front ends for C, " \ - "C++, Objective-C, Fortran, Ada, Go, and D, as well as " \ - "libraries for these languages (libstdc++,...). " + description = ( + "The GNU Compiler Collection includes front ends for C, " + "C++, Objective-C, Fortran, Ada, Go, and D, as well as " + "libraries for these languages (libstdc++,...). " + ) topics = ("gcc", "gnu", "compiler", "c", "c++") homepage = "https://gcc.gnu.org" url = "https://github.com/conan-io/conan-center-index" license = "GPL-3.0-only" settings = "os", "compiler", "arch", "build_type" - _autotools = None - def build_requirements(self): - self.build_requires("flex/2.6.4") - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - pkgversion = 'conan GCC %s' % self.version - bugurl = self.url + '/issues' - libdir = "%s/lib/gcc/%s" % (self.package_folder, self.version) - args = [ - "--enable-languages=c,c++", - "--disable-nls", - "--disable-multilib", - "--disable-bootstrap", - "--with-system-zlib", - "--with-gmp=%s" % self.deps_cpp_info['gmp'].rootpath, - '--with-mpc=%s' % self.deps_cpp_info["mpc"].rootpath, - "--with-mpfr=%s" % self.deps_cpp_info["mpfr"].rootpath, - "--without-isl", - "--libdir=%s" % libdir, - '--with-pkgversion=%s' % pkgversion, - "--program-suffix=-%s" % self.version, - "--with-bugurl=%s" % bugurl - ] - if self.settings.os == "Macos": - xcrun = tools.XCRun(self.settings) - args.extend([ - '--with-native-system-header-dir=/usr/include', - "--with-sysroot={}".format(xcrun.sdk_path) - ]) - self._autotools.libs = [] # otherwise causes config.log to fail finding -lmpc + def configure(self): if self.settings.compiler in ["clang", "apple-clang"]: - # xgcc: error: unrecognized command-line option -stdlib=libc++ - if self.settings.compiler.libcxx == "libc++": - self._autotools.cxx_flags.remove("-stdlib=libc++") - elif self.settings.compiler.libcxx in ["libstdc++", "libstdc++11"]: - self._autotools.cxx_flags.remove("-stdlib=libstdc++") - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools - - @property - def _source_subfolder(self): - return "source_subfolder" + # Can't remove this from cxxflags with autotools - so get rid of it + del self.settings.compiler.libcxx + + def build_requirements(self): + if self.settings.os == "Linux": + # binutils recipe is broken for Macos, and Windows uses tools + # distributed with msys/mingw + self.tool_requires("binutils/2.38") + self.tool_requires("flex/2.6.4") def requirements(self): self.requires("mpc/1.2.0") self.requires("mpfr/4.1.0") - self.requires("gmp/6.2.0") - self.requires("zlib/1.2.11") + self.requires("gmp/6.2.1") + self.requires("zlib/1.2.13") + self.requires("isl/0.24") - def configure(self): - if self.settings.os == "Windows": - raise ConanInvalidConfiguration("Windows builds aren't supported (yet), sorry") - if tools.cross_building(self.settings): - raise ConanInvalidConfiguration("no cross-building support (yet), sorry") + def package_id(self): + del self.info.settings.compiler - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "gcc-%s" % self.version - os.rename(extracted_dir, self._source_subfolder) + def validate_build(self): + if is_msvc(self): + raise ConanInvalidConfiguration("GCC can't be built with MSVC") - @property - def _make_args(self): + def validate(self): + if self.settings.os == "Windows": + raise ConanInvalidConfiguration( + "Windows builds aren't currently supported. Contributions to support this are welcome." + ) if self.settings.os == "Macos": - return ["BOOT_LDFLAGS=-Wl,-headerpad_max_install_names"] - return [] + # FIXME: This recipe should largely support Macos, however the following + # errors are present when building using the c3i CI: + # clang: error: unsupported option '-print-multi-os-directory' + # clang: error: no input files + raise ConanInvalidConfiguration( + "Macos builds aren't currently supported. Contributions to support this are welcome." + ) + if cross_building(self): + raise ConanInvalidConfiguration( + "Cross builds are not current supported. Contributions to support this are welcome" + ) + + def layout(self): + basic_layout(self, src_folder="src") + + def generate(self): + # Ensure binutils and flex are on the path. + # TODO: Remove when conan 2.0 is released as this will be default behaviour + buildenv = VirtualBuildEnv(self) + buildenv.generate() + + tc = AutotoolsToolchain(self) + tc.configure_args.append("--enable-languages=c,c++,fortran") + tc.configure_args.append("--disable-nls") + tc.configure_args.append("--disable-multilib") + tc.configure_args.append("--disable-bootstrap") + # TODO: Remove --prefix and --libexecdir args when c3i supports conan 1.55.0. + # This change should only happen in conjunction with a move to + # autotools.install("install-strip") + tc.configure_args.append(f"--prefix={self.package_folder}") + tc.configure_args.append(f"--libexecdir={os.path.join(self.package_folder, 'bin', 'libexec')}") + tc.configure_args.append(f"--with-zlib={self.dependencies['zlib'].package_folder}") + tc.configure_args.append(f"--with-isl={self.dependencies['isl'].package_folder}") + tc.configure_args.append(f"--with-gmp={self.dependencies['gmp'].package_folder}") + tc.configure_args.append(f"--with-mpc={self.dependencies['mpc'].package_folder}") + tc.configure_args.append(f"--with-mpfr={self.dependencies['mpfr'].package_folder}") + tc.configure_args.append(f"--with-pkgversion=conan GCC {self.version}") + tc.configure_args.append(f"--program-suffix=-{self.version}") + tc.configure_args.append(f"--with-bugurl={self.url}/issues") + + if self.settings.os == "Macos": + xcrun = XCRun(self) + tc.configure_args.append(f"--with-sysroot={xcrun.sdk_path}") + # Set native system header dir to ${{sysroot}}/usr/include to + # isolate installation from the system as much as possible + tc.configure_args.append("--with-native-system-header-dir=/usr/include") + tc.make_args.append("BOOT_LDFLAGS=-Wl,-headerpad_max_install_names") + tc.generate() + + # Don't use AutotoolsDeps here - deps are passed directly in configure_args. + # Using AutotoolsDeps causes the compiler tests to fail by erroneously adding + # additional $LIBS to the test compilation + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): # If building on x86_64, change the default directory name for 64-bit libraries to "lib": - libdir = "%s/lib/gcc/%s" % (self.package_folder, self.version) - tools.replace_in_file(os.path.join(self.source_folder, - self._source_subfolder, "gcc", "config", "i386", "t-linux64"), - "m64=../lib64", "m64=../lib", strict=False) + replace_in_file( + self, + os.path.join(self.source_folder, "gcc", "config", "i386", "t-linux64"), + "m64=../lib64", + "m64=../lib", + strict=False, + ) + # Ensure correct install names when linking against libgcc_s; # see discussion in https://github.com/Homebrew/legacy-homebrew/pull/34303 - tools.replace_in_file(os.path.join(self.source_folder, - self._source_subfolder, "libgcc", "config", "t-slibgcc-darwin"), - "@shlib_slibdir@", libdir, strict=False) - autotools = self._configure_autotools() - autotools.make(args=self._make_args) - - def package_id(self): - del self.info.settings.compiler + replace_in_file( + self, + os.path.join(self.source_folder, "libgcc", "config", "t-slibgcc-darwin"), + "@shlib_slibdir@", + os.path.join(self.package_folder, "lib"), + strict=False, + ) + + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - autotools = self._configure_autotools() - if self.settings.build_type == "Debug": - autotools.install(args=self._make_args) - else: - autotools.make(args=["install-strip"] + self._make_args) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(self.package_folder, "*.la") - self.copy(pattern="COPYING*", dst="licenses", src=self._source_subfolder) + autotools = Autotools(self) + # TODO: Use more modern autotools.install(target="install-strip") when c3i supports + # conan client version of 1.55.0. Make sure that the minimum conan version is also bumped + # when this is changed. + autotools.make(target="install-strip") + + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", self.package_folder, recursive=True) + copy( + self, + pattern="COPYING*", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + keep_path=False, + ) def package_info(self): + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.system_libs.append("rt") + self.cpp_info.system_libs.append("pthread") + self.cpp_info.system_libs.append("dl") + bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH env var with : " + bindir) - self.env_info.PATH.append(bindir) - cc = os.path.join(bindir, "gcc-%s" % self.version) - self.output.info("Creating CC env var with : " + cc) - self.env_info.CC = cc + cc = os.path.join(bindir, f"gcc-{self.version}") + self.output.info("Creating CC env var with: " + cc) + self.buildenv_info.define("CC", cc) - cxx = os.path.join(bindir, "g++-%s" % self.version) - self.output.info("Creating CXX env var with : " + cxx) + cxx = os.path.join(bindir, f"g++-{self.version}") + self.output.info("Creating CXX env var with: " + cxx) + self.buildenv_info.define("CXX", cxx) + + fc = os.path.join(bindir, f"gfortran-{self.version}") + self.output.info("Creating FC env var with: " + fc) + self.buildenv_info.define("FC", fc) + + ar = os.path.join(bindir, f"gcc-ar-{self.version}") + self.output.info("Creating AR env var with: " + ar) + self.buildenv_info.define("AR", ar) + + nm = os.path.join(bindir, f"gcc-nm-{self.version}") + self.output.info("Creating NM env var with: " + nm) + self.buildenv_info.define("NM", nm) + + ranlib = os.path.join(bindir, f"gcc-ranlib-{self.version}") + self.output.info("Creating RANLIB env var with: " + ranlib) + self.buildenv_info.define("RANLIB", ranlib) + + # TODO: Remove after conan 2.0 is released + self.env_info.CC = cc self.env_info.CXX = cxx + self.env_info.FC = fc + self.env_info.AR = ar + self.env_info.NM = nm + self.env_info.RANLIB = ranlib diff --git a/recipes/gcc/all/test_package/conanfile.py b/recipes/gcc/all/test_package/conanfile.py index a9e585e6ddfd44..439f1c3ddfe867 100644 --- a/recipes/gcc/all/test_package/conanfile.py +++ b/recipes/gcc/all/test_package/conanfile.py @@ -1,34 +1,84 @@ -from conans import ConanFile, tools import os +import shutil +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + + @property + def file_io(self): + return { + "c": { + "compiler": "$CC", + "src": os.path.join(self.source_folder, "hello.c"), + "bin": os.path.join(self.build_folder, "hello_c"), + }, + "cpp": { + "compiler": "$CXX", + "src": os.path.join(self.source_folder, "hello.cpp"), + "bin": os.path.join(self.build_folder, "hello_cpp"), + }, + "fortran": { + "compiler": "$FC", + "src": os.path.join(self.source_folder, "hello.f90"), + "bin": os.path.join(self.build_folder, "hello_f90"), + }, + } + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + buildenv = VirtualBuildEnv(self) + buildenv.generate() + + runenv = VirtualRunEnv(self) + runenv.generate() + + def build(self): + self.run("echo PATH: $PATH") + for language, files in self.file_io.items(): + self.output.info(f"Testing build using {language} compiler") + # Confirm compiler is propagated to env + envvar = files["compiler"].split("$")[1] + self.run(f"echo {envvar}: {files['compiler']}", env="conanbuild") + self.run(f"{files['compiler']} --version", env="conanbuild") + self.run(f"{files['compiler']} -dumpversion", env="conanbuild") + + # Confirm files can be compiled + self.run( + f"{files['compiler']} {files['src']} -o {files['bin']}", + env="conanbuild", + ) + self.output.info(f"Successfully built {files['bin']}") def test(self): def chmod_plus_x(name): - if os.name == 'posix': + if os.name == "posix": os.chmod(name, os.stat(name).st_mode | 0o111) - cc = self.deps_env_info["gcc"].CC - cxx = self.deps_env_info["gcc"].CXX - hello_c = os.path.join(self.source_folder, "hello.c") - hello_cpp = os.path.join(self.source_folder, "hello.cpp") - self.run("%s --version" % cc, run_environment=True) - self.run("%s --version" % cxx, run_environment=True) - self.run("%s -dumpversion" % cc, run_environment=True) - self.run("%s -dumpversion" % cxx, run_environment=True) - self.run("%s %s -o hello_c" % (cc, hello_c), run_environment=True) - self.run("%s %s -o hello_cpp" % (cxx, hello_cpp), run_environment=True) - if not tools.cross_building(self.settings): - chmod_plus_x("hello_c") - chmod_plus_x("hello_cpp") - self.run("./hello_c", run_environment=True) - self.run("./hello_cpp", run_environment=True) - if tools.which("readelf"): - self.run("readelf -l hello_c", run_environment=True) - self.run("readelf -l hello_cpp", run_environment=True) - if tools.which("otool"): - self.run("otool -L hello_c", run_environment=True) - self.run("otool -L hello_cpp", run_environment=True) + for language, files in self.file_io.items(): + self.output.info(f"Testing application built using {language} compiler") + if not cross_building(self): + chmod_plus_x(f"{files['bin']}") + + if self.settings.os == "Linux": + if shutil.which("readelf"): + self.run(f"readelf -l {files['bin']}", env="conanrun") + else: + self.output.info( + "readelf is not on the PATH. Skipping readelf test." + ) + + if self.settings.os == "Macos": + if shutil.which("otool"): + self.run(f"otool -L {files['bin']}", env="conanrun") + else: + self.output.info( + "otool is not on the PATH. Skipping otool test." + ) + + self.run(f"{files['bin']}", env="conanrun") diff --git a/recipes/gcc/all/test_package/hello.c b/recipes/gcc/all/test_package/hello.c index 52029834a425bb..63fdcbf2713ba1 100644 --- a/recipes/gcc/all/test_package/hello.c +++ b/recipes/gcc/all/test_package/hello.c @@ -2,7 +2,7 @@ int main() { - puts("Hello, World!\n"); + puts(" gcc: Hello, World!"); return 0; } diff --git a/recipes/gcc/all/test_package/hello.cpp b/recipes/gcc/all/test_package/hello.cpp index e59b7b15826e33..6cf57370b32816 100644 --- a/recipes/gcc/all/test_package/hello.cpp +++ b/recipes/gcc/all/test_package/hello.cpp @@ -2,7 +2,7 @@ int main() { - std::cout << "Hello, World!\n"; + std::cout << " g++: Hello, World!\n"; return 0; } diff --git a/recipes/gcc/all/test_package/hello.f90 b/recipes/gcc/all/test_package/hello.f90 new file mode 100644 index 00000000000000..ff78fe23454f70 --- /dev/null +++ b/recipes/gcc/all/test_package/hello.f90 @@ -0,0 +1,4 @@ +program hello + implicit none + write(*,*) 'gfortran: Hello, World!' +end program hello diff --git a/recipes/gcc/all/test_v1_package/conanfile.py b/recipes/gcc/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..a9e585e6ddfd44 --- /dev/null +++ b/recipes/gcc/all/test_v1_package/conanfile.py @@ -0,0 +1,34 @@ +from conans import ConanFile, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + + def test(self): + def chmod_plus_x(name): + if os.name == 'posix': + os.chmod(name, os.stat(name).st_mode | 0o111) + + cc = self.deps_env_info["gcc"].CC + cxx = self.deps_env_info["gcc"].CXX + hello_c = os.path.join(self.source_folder, "hello.c") + hello_cpp = os.path.join(self.source_folder, "hello.cpp") + self.run("%s --version" % cc, run_environment=True) + self.run("%s --version" % cxx, run_environment=True) + self.run("%s -dumpversion" % cc, run_environment=True) + self.run("%s -dumpversion" % cxx, run_environment=True) + self.run("%s %s -o hello_c" % (cc, hello_c), run_environment=True) + self.run("%s %s -o hello_cpp" % (cxx, hello_cpp), run_environment=True) + if not tools.cross_building(self.settings): + chmod_plus_x("hello_c") + chmod_plus_x("hello_cpp") + self.run("./hello_c", run_environment=True) + self.run("./hello_cpp", run_environment=True) + if tools.which("readelf"): + self.run("readelf -l hello_c", run_environment=True) + self.run("readelf -l hello_cpp", run_environment=True) + if tools.which("otool"): + self.run("otool -L hello_c", run_environment=True) + self.run("otool -L hello_cpp", run_environment=True) diff --git a/recipes/gcc/all/test_v1_package/hello.c b/recipes/gcc/all/test_v1_package/hello.c new file mode 100644 index 00000000000000..52029834a425bb --- /dev/null +++ b/recipes/gcc/all/test_v1_package/hello.c @@ -0,0 +1,8 @@ +#include + +int main() +{ + puts("Hello, World!\n"); + return 0; +} + diff --git a/recipes/gcc/all/test_v1_package/hello.cpp b/recipes/gcc/all/test_v1_package/hello.cpp new file mode 100644 index 00000000000000..e59b7b15826e33 --- /dev/null +++ b/recipes/gcc/all/test_v1_package/hello.cpp @@ -0,0 +1,8 @@ +#include + +int main() +{ + std::cout << "Hello, World!\n"; + return 0; +} + diff --git a/recipes/gcc/config.yml b/recipes/gcc/config.yml index 204a7032b0bc44..20d860f029e5e1 100644 --- a/recipes/gcc/config.yml +++ b/recipes/gcc/config.yml @@ -1,5 +1,7 @@ versions: - "10.2.0": - folder: all "12.2.0": folder: all + "11.3.0": + folder: all + "10.2.0": + folder: all diff --git a/recipes/geotrans/all/conandata.yml b/recipes/geotrans/all/conandata.yml index d74641c250a308..2b4068a9ac96ec 100644 --- a/recipes/geotrans/all/conandata.yml +++ b/recipes/geotrans/all/conandata.yml @@ -1,7 +1,12 @@ sources: + "3.9": + url: "https://c3i.jfrog.io/artifactory/cci-sources-backup/sources/geotrans/geotrans-3.9.tgz" + sha256: "06712b1c52e0a321bad1b5e6b38babbdbfd89f709669a238644fd878e8ccb4f2" "3.8": url: "https://c3i.jfrog.io/artifactory/cci-sources-backup/sources/geotrans/geotrans-3.8.tgz" sha256: "baa72d3b1ae12f237a8ad30f2deb3fed2b80feb759528ea0a72b4b42cb77c565" patches: + "3.9": + - patch_file: "patches/3.x-fix-for-cxx20.patch" "3.8": - - patch_file: "patches/3.8-fix-for-cxx20.patch" + - patch_file: "patches/3.x-fix-for-cxx20.patch" diff --git a/recipes/geotrans/all/conanfile.py b/recipes/geotrans/all/conanfile.py index 45f53bc792fe56..1345217d20119e 100644 --- a/recipes/geotrans/all/conanfile.py +++ b/recipes/geotrans/all/conanfile.py @@ -57,7 +57,7 @@ def validate(self): def source(self): get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + destination=self.source_folder, strip_root=True, filename=f"geotrans-{self.version}.tgz") def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/geotrans/all/patches/3.8-fix-for-cxx20.patch b/recipes/geotrans/all/patches/3.x-fix-for-cxx20.patch similarity index 100% rename from recipes/geotrans/all/patches/3.8-fix-for-cxx20.patch rename to recipes/geotrans/all/patches/3.x-fix-for-cxx20.patch diff --git a/recipes/geotrans/config.yml b/recipes/geotrans/config.yml index a874c72606420c..bc00071b32befd 100644 --- a/recipes/geotrans/config.yml +++ b/recipes/geotrans/config.yml @@ -1,3 +1,5 @@ versions: + "3.9": + folder: all "3.8": folder: all diff --git a/recipes/glaze/all/conandata.yml b/recipes/glaze/all/conandata.yml index 47d89e682397d7..d9cb0b695b150d 100644 --- a/recipes/glaze/all/conandata.yml +++ b/recipes/glaze/all/conandata.yml @@ -1,19 +1,22 @@ sources: + "0.2.2": + url: "https://github.com/stephenberry/glaze/archive/v0.2.2.tar.gz" + sha256: "d0d2edcc546b0ebb4bedaeedfb4a54aa678a6fdffa6b20dd6b252ef6325a9e75" + "0.2.1": + url: "https://github.com/stephenberry/glaze/archive/v0.2.1.tar.gz" + sha256: "dcf9ddf51b186dbc4cfd3b9324f9ee238cc1ba46fc2a62effa9293971ac4d1d4" + "0.2.0": + url: "https://github.com/stephenberry/glaze/archive/v0.2.0.tar.gz" + sha256: "2ad0d91f89465eac94efbeb91e435a5b36b7d54c9d8d6ccfb0708f6c6c0c5f87" + "0.1.8": + url: "https://github.com/stephenberry/glaze/archive/v0.1.8.tar.gz" + sha256: "8268ec2a8e0f2d9de2e65830ad9f7a623577c7bd47d465d4c6e4bed9d266ad48" "0.1.7": url: "https://github.com/stephenberry/glaze/archive/v0.1.7.tar.gz" sha256: "7dc31ceaa444fd92339a48a69be638e92daa2858c3228f347b1df54a824b8f62" "0.1.4": url: "https://github.com/stephenberry/glaze/archive/v0.1.4.tar.gz" sha256: "dd46e77973fe5b3cf4cd68fd597ba6b1010ecffd3e10cd8ccbd6cd615e6ffaff" - "0.1.3": - url: "https://github.com/stephenberry/glaze/archive/v0.1.3.tar.gz" - sha256: "291e71244bf6fde5e57daf53d8e2fdd4793a7e93fe68c546f746f43a0e534d07" - "0.1.2": - url: "https://github.com/stephenberry/glaze/archive/v0.1.2.tar.gz" - sha256: "5de894dbad95a773a7b1e3c43eeb42ec79bf30bc04355d4d055db0cba1ae52db" - "0.1.0": - url: "https://github.com/stephenberry/glaze/archive/v0.1.0.tar.gz" - sha256: "bb709637217b68c835c5c17d49d6e1d10682a9fb5d3899b4452f737f64961a67" "0.0.7": url: "https://github.com/stephenberry/glaze/archive/refs/tags/v0.0.7.tar.gz" sha256: "124f7e8fea58c012b548ba1b643684fe428c7dbfeb8d8a5f701eb7db4356a759" diff --git a/recipes/glaze/config.yml b/recipes/glaze/config.yml index 1ed7f92213ccee..a951e691f29d86 100644 --- a/recipes/glaze/config.yml +++ b/recipes/glaze/config.yml @@ -1,13 +1,15 @@ versions: - "0.1.7": + "0.2.2": folder: all - "0.1.4": + "0.2.1": folder: all - "0.1.3": + "0.2.0": folder: all - "0.1.2": + "0.1.8": folder: all - "0.1.0": + "0.1.7": + folder: all + "0.1.4": folder: all "0.0.7": folder: all diff --git a/recipes/glfw/all/conanfile.py b/recipes/glfw/all/conanfile.py index f263935f089e9b..70718f2458b265 100644 --- a/recipes/glfw/all/conanfile.py +++ b/recipes/glfw/all/conanfile.py @@ -73,6 +73,10 @@ def _patch_sources(self): # don't force PIC replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), "POSITION_INDEPENDENT_CODE ON", "") + # don't force static link to libgcc if MinGW + replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), + "target_link_libraries(glfw PRIVATE \"-static-libgcc\")", "") + # Allow to link vulkan-loader into shared glfw if self.options.vulkan_static: cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") @@ -129,8 +133,9 @@ def package_info(self): libname = "glfw" if self.settings.os == "Windows" or not self.options.shared: libname += "3" - if is_msvc(self) and self.options.shared: + if self.settings.os == "Windows" and self.options.shared: libname += "dll" + self.cpp_info.defines.append("GLFW_DLL") self.cpp_info.libs = [libname] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["m", "pthread", "dl", "rt"]) diff --git a/recipes/glib/all/conandata.yml b/recipes/glib/all/conandata.yml index 997e550aba596b..095459d3a0d9d2 100644 --- a/recipes/glib/all/conandata.yml +++ b/recipes/glib/all/conandata.yml @@ -1,39 +1,25 @@ sources: + "2.75.2": + url: "https://download.gnome.org/sources/glib/2.75/glib-2.75.2.tar.xz" + sha256: "360d6fb75202c0eb0d07f0ab812b19b526f1c05ccc0a8ed7e5d2c988616d343a" + "2.75.1": + url: "https://download.gnome.org/sources/glib/2.75/glib-2.75.1.tar.xz" + sha256: "96fd22355a542cca96c31082f2d09b72cb5a3454b6ea60c1be17c987a18a6b93" "2.75.0": url: "https://download.gnome.org/sources/glib/2.75/glib-2.75.0.tar.xz" sha256: "6dde8e55cc4a2c83d96797120b08bcffb5f645b2e212164ae22d63c40e0e6360" "2.74.1": url: "https://download.gnome.org/sources/glib/2.74/glib-2.74.1.tar.xz" sha256: "0ab981618d1db47845e56417b0d7c123f81a3427b2b9c93f5a46ff5bbb964964" - "2.74.0": - url: "https://download.gnome.org/sources/glib/2.74/glib-2.74.0.tar.xz" - sha256: "3652c7f072d7b031a6b5edd623f77ebc5dcd2ae698598abcc89ff39ca75add30" "2.73.3": url: "https://download.gnome.org/sources/glib/2.73/glib-2.73.3.tar.xz" sha256: "df1a2b841667d6b48b2ef6969ebda4328243829f6e45866726f806f90f64eead" "2.72.4": url: "https://download.gnome.org/sources/glib/2.72/glib-2.72.4.tar.xz" sha256: "8848aba518ba2f4217d144307a1d6cb9afcc92b54e5c13ac1f8c4d4608e96f0e" - "2.71.3": - url: "https://download.gnome.org/sources/glib/2.71/glib-2.71.3.tar.xz" - sha256: "288549404c26db3d52cf7a37f2f42b495b31ccffce2b4cb2439a64099c740343" - "2.70.5": - url: "https://download.gnome.org/sources/glib/2.70/glib-2.70.5.tar.xz" - sha256: "f70bf76ebcc84e0705722f038be8e2f9a58d17e1a700810c635fcc18b8974b7e" - "2.69.3": - url: "https://download.gnome.org/sources/glib/2.69/glib-2.69.3.tar.xz" - sha256: "47af2c6e06becee44d447ae7d1212dbab255b002b5141d9b62a4357c0ecc058f" - "2.68.3": - url: "https://download.gnome.org/sources/glib/2.68/glib-2.68.3.tar.xz" - sha256: "e7e1a3c20c026109c45c9ec4a31d8dcebc22e86c69486993e565817d64be3138" patches: - "2.74.0": - - patch_file: "patches/0001-2.74.0-clang-static-assert.patch" - patch_type: backport - patch_description: fix for clang compilation - patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2898 "2.73.3": - patch_file: "patches/0001-2.73.3-clang-static-assert.patch" - patch_type: backport + patch_type: bugfix patch_description: fix for clang compilation patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2898 diff --git a/recipes/glib/all/conanfile.py b/recipes/glib/all/conanfile.py index 45a32d15f9f33d..54e3429735b138 100644 --- a/recipes/glib/all/conanfile.py +++ b/recipes/glib/all/conanfile.py @@ -12,13 +12,14 @@ import shutil -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class GLibConan(ConanFile): name = "glib" - description = "GLib provides the core application building blocks for libraries and applications written in C" - topics = ("gobject", "gio", "gmodule") + description = ("Low-level core library that forms the basis for projects such as GTK+ and GNOME. " + "It provides data structure handling for C, portability wrappers, and interfaces for such runtime functionality as an event loop, threads, dynamic loading, and an object system.") + topics = "gio", "gmodule", "gnome", "gobject", "gtk" url = "https://github.com/conan-io/conan-center-index" homepage = "https://gitlab.gnome.org/GNOME/glib" license = "LGPL-2.1-or-later" @@ -47,8 +48,6 @@ def export_sources(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if Version(self.version) < "2.71.1": - self.options.shared = True if self.settings.os != "Linux": del self.options.with_mount del self.options.with_selinux @@ -57,18 +56,9 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): basic_layout(self, src_folder="src") @@ -95,18 +85,11 @@ def requirements(self): self.requires("libiconv/1.17") def validate(self): - if Version(self.version) >= "2.69.0" and not self.info.options.with_pcre: + if not self.info.options.with_pcre: raise ConanInvalidConfiguration("option glib:with_pcre must be True for glib >= 2.69.0") - if self.info.settings.os == "Windows" and not self.info.options.shared and Version(self.version) < "2.71.1": - raise ConanInvalidConfiguration( - "glib < 2.71.1 can not be built as static library on Windows. " - "see https://gitlab.gnome.org/GNOME/glib/-/issues/692" - ) - if Version(self.version) < "2.67.0" and not is_msvc(self) and not self.info.options.with_elf: - raise ConanInvalidConfiguration("libelf dependency can't be disabled in glib < 2.67.0") def build_requirements(self): - self.tool_requires("meson/0.63.3") + self.tool_requires("meson/0.64.1") if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): self.tool_requires("pkgconf/1.9.3") @@ -121,28 +104,18 @@ def generate(self): tc.generate() tc = MesonToolchain(self) - if is_apple_os(self): + if is_apple_os(self) and Version(self.version) < "2.75.1": tc.project_options["iconv"] = "external" # https://gitlab.gnome.org/GNOME/glib/issues/1557 tc.project_options["selinux"] = "enabled" if self.options.get_safe("with_selinux") else "disabled" tc.project_options["libmount"] = "enabled" if self.options.get_safe("with_mount") else "disabled" - if Version(self.version) < "2.69.0": - tc.project_options["internal_pcre"] = not self.options.with_pcre if self.settings.os == "FreeBSD": tc.project_options["xattr"] = "false" - if Version(self.version) >= "2.67.2": - tc.project_options["tests"] = "false" - if Version(self.version) >= "2.67.0": - tc.project_options["libelf"] = "enabled" if self.options.get_safe("with_elf") else "disabled" + tc.project_options["tests"] = "false" + tc.project_options["libelf"] = "enabled" if self.options.get_safe("with_elf") else "disabled" tc.generate() def _patch_sources(self): apply_conandata_patches(self) - if Version(self.version) < "2.67.2": - replace_in_file(self, - os.path.join(self.source_folder, "meson.build"), - "build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper())", - "build_tests = false", - ) replace_in_file(self, os.path.join(self.source_folder, "meson.build"), "subdir('fuzzing')", @@ -160,9 +133,9 @@ def _patch_sources(self): # allow to find gettext replace_in_file(self, os.path.join(self.source_folder, "meson.build"), - "libintl = cc.find_library('intl', required : false)" if Version(self.version) < "2.73.1" \ - else "libintl = dependency('intl', required: false)", - "libintl = dependency('libgettext', method : 'pkg-config', required : false)", + "libintl = cc.find_library('intl', required : false" if Version(self.version) < "2.73.1" \ + else "libintl = dependency('intl', required: false", + "libintl = dependency('libgettext', method : 'pkg-config', required : false", ) replace_in_file(self, diff --git a/recipes/glib/all/patches/0001-2.74.0-clang-static-assert.patch b/recipes/glib/all/patches/0001-2.74.0-clang-static-assert.patch deleted file mode 100644 index c9481d079569d1..00000000000000 --- a/recipes/glib/all/patches/0001-2.74.0-clang-static-assert.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/gio/gio-launch-desktop.c b/gio/gio-launch-desktop.c -index 26b9ae1a1..47717b987 100644 ---- a/gio/gio-launch-desktop.c -+++ b/gio/gio-launch-desktop.c -@@ -121,8 +121,8 @@ journal_stream_fd (const char *identifier, - /* Arbitrary large size for the sending buffer, from systemd */ - int large_buffer_size = 8 * 1024 * 1024; - -- G_STATIC_ASSERT (LOG_EMERG == 0 && "Linux ABI defines LOG_EMERG"); -- G_STATIC_ASSERT (LOG_DEBUG == 7 && "Linux ABI defines LOG_DEBUG"); -+ G_STATIC_ASSERT (LOG_EMERG == 0 && sizeof "Linux ABI defines LOG_EMERG"); -+ G_STATIC_ASSERT (LOG_DEBUG == 7 && sizeof "Linux ABI defines LOG_DEBUG"); - - fd = socket (AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0); - diff --git a/recipes/glib/config.yml b/recipes/glib/config.yml index a3f68d3f20d1ae..997ec90da28090 100644 --- a/recipes/glib/config.yml +++ b/recipes/glib/config.yml @@ -1,19 +1,13 @@ versions: + "2.75.2": + folder: all + "2.75.1": + folder: all "2.75.0": folder: all "2.74.1": folder: all - "2.74.0": - folder: all "2.73.3": folder: all "2.72.4": folder: all - "2.71.3": - folder: all - "2.70.5": - folder: all - "2.69.3": - folder: all - "2.68.3": - folder: all diff --git a/recipes/glslang/all/conandata.yml b/recipes/glslang/all/conandata.yml index 5f989bd0af008c..f6333a1a14d01e 100644 --- a/recipes/glslang/all/conandata.yml +++ b/recipes/glslang/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.236.0": + url: "https://github.com/KhronosGroup/glslang/archive/refs/tags/sdk-1.3.236.0.tar.gz" + sha256: "fb6f323a36efcd98766bb72f598008f73c4c92bce69c79fc98ad2b3cdca0c263" "1.3.231.1": url: "https://github.com/KhronosGroup/glslang/archive/refs/tags/sdk-1.3.231.1.tar.gz" sha256: "df3857f01c1aa9ee1927d2feaaa431406d243958e07791e9aed4cb5ab22a5f2b" @@ -27,6 +30,8 @@ sources: url: "https://github.com/KhronosGroup/glslang/archive/8.13.3559.tar.gz" sha256: "c58fdcf7e00943ba10f9ae565b2725ec9d5be7dab7c8e82cac72fcaa83c652ca" patches: + "1.3.236.0": + - patch_file: "patches/1.3.236.0-0001-no-force-glslang-pic.patch" "1.3.231.1": - patch_file: "patches/0001-no-force-glslang-pic.patch" "1.3.224.0": diff --git a/recipes/glslang/all/patches/1.3.236.0-0001-no-force-glslang-pic.patch b/recipes/glslang/all/patches/1.3.236.0-0001-no-force-glslang-pic.patch new file mode 100644 index 00000000000000..10a3ace245afd6 --- /dev/null +++ b/recipes/glslang/all/patches/1.3.236.0-0001-no-force-glslang-pic.patch @@ -0,0 +1,10 @@ +--- a/glslang/CMakeLists.txt ++++ b/glslang/CMakeLists.txt +@@ -169,7 +169,6 @@ set(GLSLANG_HEADERS + add_library(glslang ${LIB_TYPE} ${BISON_GLSLParser_OUTPUT_SOURCE} ${GLSLANG_SOURCES} ${GLSLANG_HEADERS}) + set_target_properties(glslang PROPERTIES + FOLDER glslang +- POSITION_INDEPENDENT_CODE ON + VERSION "${GLSLANG_VERSION}" + SOVERSION "${GLSLANG_VERSION_MAJOR}") + target_link_libraries(glslang PRIVATE OGLCompiler OSDependent MachineIndependent) diff --git a/recipes/glslang/config.yml b/recipes/glslang/config.yml index eb0c5a565bc362..413c4c359d87ef 100644 --- a/recipes/glslang/config.yml +++ b/recipes/glslang/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.236.0": + folder: all "1.3.231.1": folder: all "1.3.224.0": diff --git a/recipes/glu/all/conanfile.py b/recipes/glu/all/conanfile.py index 42fc9acb237e88..4aa309d2770f57 100644 --- a/recipes/glu/all/conanfile.py +++ b/recipes/glu/all/conanfile.py @@ -1,9 +1,8 @@ from conan import ConanFile -from conan.errors import ConanException +from conan.tools.gnu import PkgConfig from conan.tools.system import package_manager -from conans import tools -required_conan_version = ">=1.47" +required_conan_version = ">=1.50.0" class SysConfigGLUConan(ConanFile): @@ -15,7 +14,15 @@ class SysConfigGLUConan(ConanFile): homepage = "https://cgit.freedesktop.org/mesa/glu/" license = "SGI-B-2.0" settings = "os", "arch", "compiler", "build_type" - requires = "opengl/system" + + def layout(self): + pass + + def requirements(self): + self.requires("opengl/system") + + def package_id(self): + self.info.clear() def system_requirements(self): dnf = package_manager.Dnf(self) @@ -36,34 +43,13 @@ def system_requirements(self): pkg = package_manager.Pkg(self) pkg.install(["libGLU"], update=True, check=True) - def _fill_cppinfo_from_pkgconfig(self, name): - pkg_config = tools.PkgConfig(name) - if not pkg_config.provides: - raise ConanException("GLU development files aren't available, giving up") - libs = [lib[2:] for lib in pkg_config.libs_only_l] - lib_dirs = [lib[2:] for lib in pkg_config.libs_only_L] - ldflags = [flag for flag in pkg_config.libs_only_other] - include_dirs = [include[2:] for include in pkg_config.cflags_only_I] - cflags = [flag for flag in pkg_config.cflags_only_other if not flag.startswith("-D")] - defines = [flag[2:] for flag in pkg_config.cflags_only_other if flag.startswith("-D")] - - self.cpp_info.system_libs.extend(libs) - self.cpp_info.libdirs.extend(lib_dirs) - self.cpp_info.sharedlinkflags.extend(ldflags) - self.cpp_info.exelinkflags.extend(ldflags) - self.cpp_info.defines.extend(defines) - self.cpp_info.includedirs.extend(include_dirs) - self.cpp_info.cflags.extend(cflags) - self.cpp_info.cxxflags.extend(cflags) - def package_info(self): + self.cpp_info.bindirs = [] self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] if self.settings.os == "Windows": self.cpp_info.system_libs = ["Glu32"] elif self.settings.os in ["Linux", "FreeBSD"]: - self._fill_cppinfo_from_pkgconfig("glu") - - def package_id(self): - self.info.header_only() + pkg_config = PkgConfig(self, 'glu') + pkg_config.fill_cpp_info(self.cpp_info, is_system=self.settings.os != "FreeBSD") diff --git a/recipes/glu/all/test_package/CMakeLists.txt b/recipes/glu/all/test_package/CMakeLists.txt index 34af13462f44f8..56f2fb9c24114c 100644 --- a/recipes/glu/all/test_package/CMakeLists.txt +++ b/recipes/glu/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(glu REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE glu::glu) diff --git a/recipes/glu/all/test_package/conanfile.py b/recipes/glu/all/test_package/conanfile.py index fdb9f346a1da9d..ef5d7042163ecc 100644 --- a/recipes/glu/all/test_package/conanfile.py +++ b/recipes/glu/all/test_package/conanfile.py @@ -1,9 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/glu/all/test_v1_package/CMakeLists.txt b/recipes/glu/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/glu/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/glu/all/test_v1_package/conanfile.py b/recipes/glu/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..a500b98343c743 --- /dev/null +++ b/recipes/glu/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +from conans import ConanFile, CMake, tools +import os + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/gmp/all/conandata.yml b/recipes/gmp/all/conandata.yml index d97aab0d277f2e..9266fcde97cc7d 100644 --- a/recipes/gmp/all/conandata.yml +++ b/recipes/gmp/all/conandata.yml @@ -11,18 +11,11 @@ sources: patches: "6.2.1": - patch_file: "patches/0001-msvc-dumpbin-yasm-wrapper.patch" - base_path: "" - patch_file: "patches/6.2.x-0001-fix-MSVC-next-prime-error.patch" - base_path: "source_subfolder" "6.2.0": - patch_file: "patches/0001-msvc-dumpbin-yasm-wrapper.patch" - base_path: "" - patch_file: "patches/6.2.x-0001-fix-MSVC-next-prime-error.patch" - base_path: "source_subfolder" "6.1.2": - patch_file: "patches/0001-msvc-dumpbin-yasm-wrapper.patch" - base_path: "" - patch_file: "patches/6.1.x-0001-fix-MSVC-next-prime-error.patch" - base_path: "source_subfolder" - patch_file: "patches/6.1.x-0002-fix-MSVC-debug.patch" - base_path: "source_subfolder" diff --git a/recipes/gmp/all/conanfile.py b/recipes/gmp/all/conanfile.py index 5ccdd6563bbde5..6d9215c94d74d3 100644 --- a/recipes/gmp/all/conanfile.py +++ b/recipes/gmp/all/conanfile.py @@ -1,11 +1,16 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration -import contextlib -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name, is_apple_os +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path +from conan.tools.scm import Version import os import stat -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.54.0" class GmpConan(ConanFile): @@ -37,10 +42,6 @@ class GmpConan(ConanFile): "enable_cxx": True, } - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) @@ -49,13 +50,8 @@ def _settings_build(self): def _user_info_build(self): return getattr(self, "user_info_build", self.deps_user_info) - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -65,106 +61,105 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if self.options.get_safe("enable_fat"): del self.options.disable_assembly if not self.options.enable_cxx: - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") - def validate(self): - if self._is_msvc and self.options.shared: - raise ConanInvalidConfiguration("Cannot build a shared library using Visual Studio: some error occurs at link time") + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): del self.info.options.run_checks # run_checks doesn't affect package's ID + def validate(self): + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration( + f"{self.ref} cannot be built as a shared library using Visual Studio: some error occurs at link time", + ) + def build_requirements(self): - self.build_requires("m4/1.4.19") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - if self._is_msvc: - self.build_requires("yasm/1.3.0") - self.build_requires("automake/1.16.4") + self.tool_requires("m4/1.4.19") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + if is_msvc(self): + self.tool_requires("yasm/1.3.0") + self.tool_requires("automake/1.16.5") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True, verify=False) - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - # Relocatable shared lib on macOS & fix permission issue - if tools.is_apple_os(self.settings.os): - configure_file = os.path.join(self._source_subfolder, "configure") - tools.replace_in_file(configure_file, "-install_name \\$rpath/", "-install_name @rpath/") - configure_stats = os.stat(configure_file) - os.chmod(configure_file, configure_stats.st_mode | stat.S_IEXEC) + def generate(self): + env = VirtualBuildEnv(self) + env.generate() - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) + tc = AutotoolsToolchain(self) yes_no = lambda v: "yes" if v else "no" - configure_args = [ + tc.configure_args.extend([ "--with-pic={}".format(yes_no(self.options.get_safe("fPIC", True))), "--enable-assembly={}".format(yes_no(not self.options.get_safe("disable_assembly", False))), "--enable-fat={}".format(yes_no(self.options.get_safe("enable_fat", False))), "--enable-cxx={}".format(yes_no(self.options.enable_cxx)), - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--srcdir={}".format(os.path.join(self.source_folder, self._source_subfolder).replace("\\", "/")), - ] - if self._is_msvc: - configure_args.extend([ + "--srcdir={}".format(self.source_folder.replace("\\", "/")), + ]) + if is_msvc(self): + tc.configure_args.extend([ "ac_cv_c_restrict=restrict", "gmp_cv_asm_label_suffix=:", "lt_cv_sys_global_symbol_pipe=cat", # added to get further in shared MSVC build, but it gets stuck later ]) - if not (self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) < 12): - autotools.flags.append("-FS") - autotools.cxx_flags.append("-EHsc") - autotools.configure(args=configure_args, configure_dir=self._source_subfolder) - return autotools - - @contextlib.contextmanager - def _build_context(self): - if self._is_msvc: - with tools.vcvars(self): - yasm_machine = { - "x86": "x86", - "x86_64": "amd64", - }[str(self.settings.arch)] - env = { - "CC": "cl -nologo", - "CCAS": "{} -a x86 -m {} -p gas -r raw -f win32 -g null -X gnu".format(os.path.join(self.build_folder, "yasm_wrapper.sh").replace("\\", "/"), yasm_machine), - "CXX": "cl -nologo", - "AR": "{} lib".format(self._user_info_build["automake"].ar_lib.replace("\\", "/")), - "LD": "link -nologo", - "NM": "python {}".format(tools.unix_path(os.path.join(self.build_folder, "dumpbin_nm.py"))), - } - with tools.environment_append(env): - yield - else: - yield + tc.extra_cxxflags.append("-EHsc") + if (str(self.settings.compiler) == "Visual Studio" and Version(self.settings.compiler.version) >= "12") or \ + (str(self.settings.compiler) == "msvc" and Version(self.settings.compiler.version) >= "180"): + tc.extra_cflags.append("-FS") + tc.extra_cxxflags.append("-FS") + env = tc.environment() + if is_msvc(self): + yasm_wrapper = unix_path(self, os.path.join(self.source_folder, "yasm_wrapper.sh")) + yasm_machine = { + "x86": "x86", + "x86_64": "amd64", + }[str(self.settings.arch)] + ar_wrapper = unix_path(self, self._user_info_build["automake"].ar_lib) + dumpbin_nm = unix_path(self, os.path.join(self.source_folder, "dumpbin_nm.py")) + env.define("CC", "cl -nologo") + env.define("CCAS", f"{yasm_wrapper} -a x86 -m {yasm_machine} -p gas -r raw -f win32 -g null -X gnu") + env.define("CXX", "cl -nologo") + env.define("LD", "link -nologo") + env.define("AR", f"{ar_wrapper} \"lib -nologo\"") + env.define("NM", f"python {dumpbin_nm}") + tc.generate(env) + + def _patch_sources(self): + apply_conandata_patches(self) + # Fix permission issue + if is_apple_os(self): + configure_file = os.path.join(self.source_folder, "configure") + configure_stats = os.stat(configure_file) + os.chmod(configure_file, configure_stats.st_mode | stat.S_IEXEC) def build(self): self._patch_sources() - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() - # INFO: According to the gmp readme file, make check should not be omitted, but it causes timeouts on the CI server. - if self.options.run_checks: - autotools.make(args=["check"]) + autotools = Autotools(self) + autotools.configure() + autotools.make() + # INFO: According to the gmp readme file, make check should not be omitted, but it causes timeouts on the CI server. + if self.options.run_checks: + autotools.make(args=["check"]) def package(self): - self.copy("COPYINGv2", dst="licenses", src=self._source_subfolder) - self.copy("COPYING.LESSERv3", dst="licenses", src=self._source_subfolder) - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() - - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + copy(self, "COPYINGv2", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "COPYING.LESSERv3", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): # Workaround to always provide a pkgconfig file depending on all components diff --git a/recipes/gmp/all/test_package/CMakeLists.txt b/recipes/gmp/all/test_package/CMakeLists.txt index 9f96d523192a5d..382515baaeb92e 100644 --- a/recipes/gmp/all/test_package/CMakeLists.txt +++ b/recipes/gmp/all/test_package/CMakeLists.txt @@ -1,18 +1,18 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(gmp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE gmp::libgmp) -if (TEST_PIC) +if(TEST_PIC) add_library(${PROJECT_NAME}_shared SHARED test_package.c) - target_link_libraries(${PROJECT_NAME}_shared ${CONAN_LIBS}) + target_link_libraries(${PROJECT_NAME}_shared PRIVATE gmp::libgmp) endif() -if (ENABLE_CXX) +if(ENABLE_CXX) + enable_language(CXX) add_executable(${PROJECT_NAME}_cpp test_package.cpp) - target_link_libraries(${PROJECT_NAME}_cpp ${CONAN_LIBS}) + target_link_libraries(${PROJECT_NAME}_cpp PRIVATE gmp::gmpxx) endif() diff --git a/recipes/gmp/all/test_package/conanfile.py b/recipes/gmp/all/test_package/conanfile.py index 605e1da44137b0..472d139ec19ee8 100644 --- a/recipes/gmp/all/test_package/conanfile.py +++ b/recipes/gmp/all/test_package/conanfile.py @@ -1,22 +1,35 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ENABLE_CXX"] = self.dependencies["gmp"].options.enable_cxx + tc.variables["TEST_PIC"] = "fPIC" in self.dependencies["gmp"].options and self.dependencies["gmp"].options.fPIC + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["ENABLE_CXX"] = self.options["gmp"].enable_cxx - cmake.definitions["TEST_PIC"] = "fPIC" in self.options["gmp"] and self.options["gmp"].fPIC cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") if self.options["gmp"].enable_cxx: - bin_path = os.path.join("bin", "test_package_cpp") - self.run(bin_path, run_environment=True) + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package_cpp") + self.run(bin_path, env="conanrun") diff --git a/recipes/gmp/all/test_v1_package/CMakeLists.txt b/recipes/gmp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..81f52f58013af8 --- /dev/null +++ b/recipes/gmp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +if(ENABLE_CXX) + enable_language(CXX) +endif() + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +find_package(gmp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE gmp::GMP) + +if(TEST_PIC) + add_library(${PROJECT_NAME}_shared SHARED ../test_package/test_package.c) + target_link_libraries(${PROJECT_NAME}_shared PRIVATE gmp::GMP) +endif() + +if(ENABLE_CXX) + add_executable(${PROJECT_NAME}_cpp ../test_package/test_package.cpp) + target_link_libraries(${PROJECT_NAME}_cpp PRIVATE gmp::GMPXX) +endif() diff --git a/recipes/gmp/all/test_v1_package/conanfile.py b/recipes/gmp/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..716c611a38e8ab --- /dev/null +++ b/recipes/gmp/all/test_v1_package/conanfile.py @@ -0,0 +1,22 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["ENABLE_CXX"] = self.options["gmp"].enable_cxx + cmake.definitions["TEST_PIC"] = "fPIC" in self.options["gmp"] and self.options["gmp"].fPIC + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + if self.options["gmp"].enable_cxx: + bin_path = os.path.join("bin", "test_package_cpp") + self.run(bin_path, run_environment=True) diff --git a/recipes/gnu-config/all/test_package/conanfile.py b/recipes/gnu-config/all/test_package/conanfile.py index d50d33bfc8962d..93cb4f77f7eab9 100644 --- a/recipes/gnu-config/all/test_package/conanfile.py +++ b/recipes/gnu-config/all/test_package/conanfile.py @@ -1,6 +1,4 @@ from conan import ConanFile -from conan.errors import ConanException -from conans import tools as tools_legacy class TestPackageConan(ConanFile): @@ -20,8 +18,4 @@ def build_requirements(self): def test(self): self.run("config.guess") - try: - triplet = tools_legacy.get_gnu_triplet(str(self.settings.os), str(self.settings.arch), str(self.settings.compiler)) - self.run(f"config.sub {triplet}") - except ConanException: - self.output.info("Current configuration is not supported by GNU config.\nIgnoring...") + self.run("config.sub --version") diff --git a/recipes/googleapis/all/conanfile.py b/recipes/googleapis/all/conanfile.py index 0a81aae16d1a0f..022bfade0055ca 100644 --- a/recipes/googleapis/all/conanfile.py +++ b/recipes/googleapis/all/conanfile.py @@ -7,12 +7,14 @@ from conan import ConanFile from conan.tools.files import get, copy +from conan.tools.microsoft import is_msvc from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration from helpers import parse_proto_libraries +required_conan_version = ">=1.45.0" class GoogleAPIS(ConanFile): name = "googleapis" @@ -55,7 +57,7 @@ def validate(self): if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) <= "5": raise ConanInvalidConfiguration("Build with GCC 5 fails") - if self.settings.compiler in ["Visual Studio", "msvc"] and self.options.shared: + if is_msvc(self) and self.options.shared: raise ConanInvalidConfiguration("Source code generated from protos is missing some export macro") if self.options.shared and not self.options["protobuf"].shared: raise ConanInvalidConfiguration("If built as shared, protobuf must be shared as well. Please, use `protobuf:shared=True`") diff --git a/recipes/hana/all/conanfile.py b/recipes/hana/all/conanfile.py index 246b40e89dc55e..9aa79d14353681 100644 --- a/recipes/hana/all/conanfile.py +++ b/recipes/hana/all/conanfile.py @@ -1,5 +1,7 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.files import get, save +from conan.tools.build import check_min_cppstd +from conan.errors import ConanInvalidConfiguration import os import textwrap @@ -15,6 +17,7 @@ class HanaConan(ConanFile): topics = ("hana", "metaprogramming", "boost") settings = "compiler" no_copy_source = True + deprecated = "boost" @property def _source_subfolder(self): @@ -31,7 +34,7 @@ def _compilers_minimum_version(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "14") + check_min_cppstd(self, "14") def lazy_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] @@ -45,23 +48,26 @@ def lazy_lt_semver(v1, v2): elif lazy_lt_semver(str(self.settings.compiler.version), minimum_version): raise ConanInvalidConfiguration("{} {} requires C++14, which your compiler does not support.".format(self.name, self.version)) + raise ConanInvalidConfiguration(f"{self.ref} is deprecated of Boost. Please, use boost package.") + def package_id(self): - self.info.header_only() + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) def package(self): self.copy("LICENSE.md", dst="licenses", src=self._source_subfolder) self.copy("*.hpp", dst="include", src=os.path.join(self._source_subfolder, "include")) self._create_cmake_module_alias_targets( + self, os.path.join(self.package_folder, self._module_file_rel_path), {"hana": "hana::hana"} ) @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(conanfile, module_file, targets): content = "" for alias, aliased in targets.items(): content += textwrap.dedent("""\ @@ -70,7 +76,7 @@ def _create_cmake_module_alias_targets(module_file, targets): set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + save(conanfile, module_file, content) @property def _module_subfolder(self): diff --git a/recipes/harfbuzz/all/conandata.yml b/recipes/harfbuzz/all/conandata.yml index a3c91fbe233613..8ab99e436984bd 100644 --- a/recipes/harfbuzz/all/conandata.yml +++ b/recipes/harfbuzz/all/conandata.yml @@ -17,6 +17,9 @@ sources: "5.3.1": url: "https://github.com/harfbuzz/harfbuzz/archive/5.3.1.tar.gz" sha256: "77c8c903f4539b050a6d3a5be79705c7ccf7b1cb66d68152a651486e261edbd2" + "6.0.0": + url: "https://github.com/harfbuzz/harfbuzz/archive/6.0.0.tar.gz" + sha256: "6d753948587db3c7c3ba8cc4f8e6bf83f5c448d2591a9f7ec306467f3a4fe4fa" patches: "4.4.1": - patch_file: "patches/0000-fix-freetype-lookup-4.4.1.patch" diff --git a/recipes/harfbuzz/config.yml b/recipes/harfbuzz/config.yml index 72fcc32e115378..3dd17ac25646ca 100644 --- a/recipes/harfbuzz/config.yml +++ b/recipes/harfbuzz/config.yml @@ -11,3 +11,5 @@ versions: folder: all "5.3.1": folder: all + "6.0.0": + folder: all diff --git a/recipes/hazelcast-cpp-client/all/conandata.yml b/recipes/hazelcast-cpp-client/all/conandata.yml index 90b1afe2d9103a..ef6a536c1dc634 100644 --- a/recipes/hazelcast-cpp-client/all/conandata.yml +++ b/recipes/hazelcast-cpp-client/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "5.1.0": + url: "https://github.com/hazelcast/hazelcast-cpp-client/archive/v5.1.0.tar.gz" + sha256: "de22ddf2c99079ed2385baa554a997b15ae17b039d6d108f68e25e1b3bbf76b6" "5.0.0": url: "https://github.com/hazelcast/hazelcast-cpp-client/archive/v5.0.0.tar.gz" sha256: "0df7948bc6f4d219c60f51179355599938cab5b713335c2ea48d1d38be1b69dc" @@ -15,5 +18,11 @@ sources: url: "https://github.com/hazelcast/hazelcast-cpp-client/archive/v4.0.1.zip" sha256: "4b3c6a876ebca2a4dcf23a556d3c3d4da2284e4ce1d2bbdf335df7f86b03fd28" patches: + "5.1.0": + - patch_file: "patches/gcc_11_1_0.patch" + patch_description: "Fix for GCC-111" + patch_type: "portability" "4.1.0": - patch_file: "patches/gcc_4.9_5_fix.patch" + patch_description: "Fix for GCC-495" + patch_type: "portability" diff --git a/recipes/hazelcast-cpp-client/all/patches/gcc_11_1_0.patch b/recipes/hazelcast-cpp-client/all/patches/gcc_11_1_0.patch new file mode 100644 index 00000000000000..c286f1883f21f0 --- /dev/null +++ b/recipes/hazelcast-cpp-client/all/patches/gcc_11_1_0.patch @@ -0,0 +1,40 @@ +diff --git a/hazelcast/include/hazelcast/client/protocol/ClientMessage.h b/hazelcast/include/hazelcast/client/protocol/ClientMessage.h +index 462ea85b0..f2686506a 100644 +--- a/hazelcast/include/hazelcast/client/protocol/ClientMessage.h ++++ b/hazelcast/include/hazelcast/client/protocol/ClientMessage.h +@@ -190,6 +190,9 @@ struct HAZELCAST_API is_trivial_entry_vector< + */ + class HAZELCAST_API ClientMessage + { ++ template ++ struct default_nullable_decoder; ++ + public: + static constexpr size_t EXPECTED_DATA_BLOCK_SIZE = 1024; + +@@ -974,10 +977,8 @@ public: + } + + template +- boost::optional get_nullable(std::function decoder = +- [](ClientMessage& msg) { +- return msg.get(); +- }) ++ boost::optional get_nullable( ++ std::function decoder = default_nullable_decoder{}) + { + if (next_frame_is_null_frame()) { + // skip next frame with null flag +@@ -1357,6 +1358,12 @@ private: + static const frame_header_type BEGIN_FRAME; + static const frame_header_type END_FRAME; + ++ template ++ struct default_nullable_decoder ++ { ++ T operator()(ClientMessage& msg) const { return msg.get(); } ++ }; ++ + template + void set_primitive_vector(const std::vector& values, + bool is_final = false) diff --git a/recipes/hazelcast-cpp-client/config.yml b/recipes/hazelcast-cpp-client/config.yml index 50e0bcc183e614..6c55bb901999c6 100644 --- a/recipes/hazelcast-cpp-client/config.yml +++ b/recipes/hazelcast-cpp-client/config.yml @@ -1,4 +1,6 @@ versions: + "5.1.0": + folder: all "5.0.0": folder: all "4.2.0": diff --git a/recipes/hdf5/all/CMakeLists.txt b/recipes/hdf5/all/CMakeLists.txt deleted file mode 100644 index 7bd2be5d08aa83..00000000000000 --- a/recipes/hdf5/all/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -cmake_minimum_required(VERSION 3.13) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS KEEP_RPATHS) - -if (MSVC) - add_compile_options("$<$:/Z7>") - add_link_options("$<$:/DEBUG:NONE>") -endif () - -add_subdirectory("source_subfolder") diff --git a/recipes/hdf5/all/conandata.yml b/recipes/hdf5/all/conandata.yml index d39b52a21d7400..dc660f8ec159bb 100644 --- a/recipes/hdf5/all/conandata.yml +++ b/recipes/hdf5/all/conandata.yml @@ -1,14 +1,15 @@ sources: + "1.14.0": + url: "https://github.com/HDFGroup/hdf5/archive/hdf5-1_14_0.tar.gz" + sha256: "0f2ec13c1bf6e9f506fd03681c83a476d722e7479cad9ce6f8585a26c317d0ad" "1.13.1": url: "https://github.com/HDFGroup/hdf5/archive/hdf5-1_13_1.tar.gz" sha256: "92552458f35c7e58128ce1bfc2831abf901cc142ea0fdd2b056311e4452db7bf" "1.12.2": url: "https://github.com/HDFGroup/hdf5/archive/hdf5-1_12_2.tar.gz" sha256: "1ca14cadff7bc4b61826eee591da1a330f44c107db66c9510ee95df3b2bc5f78" - "1.12.1": - url: "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.12/hdf5-1.12.1/src/hdf5-1.12.1.tar.gz" - sha256: "79c66ff67e666665369396e9c90b32e238e501f345afd2234186bfb8331081ca" "1.12.0": + # Need 1.12.0 for NetCDF 4.7.4 with byteranges=True url: "https://github.com/HDFGroup/hdf5/archive/hdf5-1_12_0.tar.gz" sha256: "c64ffec2539ae6b6041f97952a40b0893c3c0df4d5b1c0177fb8aba567808158" "1.10.6": @@ -21,44 +22,55 @@ sources: url: "https://github.com/HDFGroup/hdf5/archive/hdf5-1_8_21.tar.gz" sha256: "753520e34a576a64809b8e02d9c015d6126f7974f678c7417a60492d835a88f4" patches: + "1.14.0": + - patch_file: "patches/conanize-link-szip-1.14.0+.patch" + patch_type: "conan" + patch_description: "Fixup target_link_libraries() targets for szip and zlib" "1.13.1": - patch_file: "patches/conanize-link-szip-1.12.2+.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Fixup target_link_libraries() targets for szip and zlib" "1.12.2": - patch_file: "patches/conanize-link-szip-1.12.2+.patch" - base_path: "source_subfolder" - "1.12.1": - - patch_file: "patches/conanize-link-szip-1.12.1+.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Fixup target_link_libraries() targets for szip and zlib" "1.12.0": - patch_file: "patches/conanize-link-szip-1.10.5+.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Fixup target_link_libraries() targets for szip and zlib" "1.10.6": - patch_file: "patches/fix-missing-function-prototypes-1.10.5+.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Fix missing function prototypes" - patch_file: "patches/fix-missing-function-prototypes-1.10.6.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Fix missing function prototypes" - patch_file: "patches/conanize-link-szip-1.10.5+.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Fixup target_link_libraries() targets for szip and zlib" "1.10.5": - patch_file: "patches/fix-missing-function-prototypes-1.10.5+.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Fix missing function prototypes" - patch_file: "patches/conanize-link-szip-1.10.5+.patch" - base_path: "source_subfolder" - - patch_file: "patches/build-either-static-or-shared-1.10.5.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Fixup target_link_libraries() targets for szip and zlib" - patch_file: "patches/mingw-cmake-size-type-checks-1.10.5.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "mingw cmake size type checks" - patch_file: "patches/mingw-fix-prefix-lib.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "mingw fix prefix lib" - patch_file: "patches/mingw-unused-ellipses.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "mingw unused ellipses" "1.8.21": - patch_file: "patches/conanize-link-szip-1.8.21.patch" - base_path: "source_subfolder" - - patch_file: "patches/build-either-static-or-shared-1.8.21.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Fixup target_link_libraries() targets for szip and zlib" - patch_file: "patches/mingw-cmake-size-type-checks-1.8.21.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "mingw cmake size type checks" - patch_file: "patches/mingw-fix-prefix-lib.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "mingw fix prefix lib" diff --git a/recipes/hdf5/all/conanfile.py b/recipes/hdf5/all/conanfile.py index 3f219642650bcb..e99788436fb27d 100644 --- a/recipes/hdf5/all/conanfile.py +++ b/recipes/hdf5/all/conanfile.py @@ -1,22 +1,21 @@ -from conan import ConanFile -from conan.errors import ConanInvalidConfiguration -from conan.tools.files import rmdir, copy, save, get, replace_in_file, apply_conandata_patches -from conan.tools.build import cross_building -from conan.tools.scm import Version -from conans import CMake -import functools import os import textwrap +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import can_run, check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir, save +from conan.tools.scm import Version -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class Hdf5Conan(ConanFile): name = "hdf5" description = "HDF5 is a data model, library, and file format for storing and managing data." license = "BSD-3-Clause" - topics = ("hdf5", "hdf", "data") + topics = "hdf", "data" homepage = "https://portal.hdfgroup.org/display/HDF5/HDF5" url = "https://github.com/conan-io/conan-center-index" @@ -43,37 +42,49 @@ class Hdf5Conan(ConanFile): "szip_encoding": False, "parallel": False, } - - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" + def _min_cpp_standard(self): + if Version(self.version) < "1.14.0": + return 98 + return 11 def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + def validate(self): + if not can_run(self): + # While building it runs some executables like H5detect + raise ConanInvalidConfiguration("Current recipe doesn't support cross-building (yet)") + if self.info.options.parallel: + if self.info.options.enable_cxx: + raise ConanInvalidConfiguration("Parallel and C++ options are mutually exclusive") + if self.info.options.get_safe("threadsafe"): # FIXME why can't I define the default valid as False? + raise ConanInvalidConfiguration("Parallel and Threadsafe options are mutually exclusive") + if self.info.options.szip_support == "with_szip" and \ + self.info.options.szip_encoding and \ + not self.dependencies["szip"].options.enable_encoding: + raise ConanInvalidConfiguration("encoding must be enabled in szip dependency (szip:enable_encoding=True)") + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._min_cpp_standard) + def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if not self.options.enable_cxx: - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") if self.options.enable_cxx or self.options.hl or (self.settings.os == "Windows" and not self.options.shared): del self.options.threadsafe if not bool(self.options.szip_support): del self.options.szip_encoding + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): if self.options.with_zlib: self.requires("zlib/1.2.13") @@ -84,82 +95,95 @@ def requirements(self): if self.options.parallel: self.requires("openmpi/4.1.0") - def validate(self): - if hasattr(self, "settings_build") and cross_building(self, skip_x64_x86=True): - # While building it runs some executables like H5detect - raise ConanInvalidConfiguration("Current recipe doesn't support cross-building (yet)") - if self.options.parallel: - if self.options.enable_cxx: - raise ConanInvalidConfiguration("Parallel and C++ options are mutually exclusive") - if self.options.get_safe("threadsafe", False): - raise ConanInvalidConfiguration("Parallel and Threadsafe options are mutually exclusive") - if self.options.szip_support == "with_szip" and self.options.szip_encoding and \ - not self.options["szip"].enable_encoding: - raise ConanInvalidConfiguration("encoding must be enabled in szip dependency (szip:enable_encoding=True)") + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output) + m = re.search(r"cmake version (\d+\.\d+\.\d+)", output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False - def source(self): - get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + def _inject_stdlib_flag(self, tc): + if self.settings.os == "Linux" and self.settings.compiler == "clang": + cpp_stdlib = f" -stdlib={self.settings.compiler.libcxx}".rstrip("1") # strip 11 from stdlibc++11 + tc.variables["CMAKE_CXX_FLAGS"] = tc.variables.get("CMAKE_CXX_FLAGS", "") + cpp_stdlib - def build(self): - self._patch_sources() - cmake = self._configure_cmake() - cmake.build() + return tc - def _patch_sources(self): - apply_conandata_patches(self) - # Do not force PIC - replace_in_file(self, os.path.join(self._source_subfolder, "CMakeLists.txt"), - "set (CMAKE_POSITION_INDEPENDENT_CODE ON)", "") - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["HDF5_EXTERNALLY_CONFIGURED"] = True - cmake.definitions["HDF5_EXTERNAL_LIB_PREFIX"] = "" - cmake.definitions["HDF5_USE_FOLDERS"] = False - cmake.definitions["HDF5_NO_PACKAGES"] = True - cmake.definitions["ALLOW_UNSUPPORTED"] = False + def build_requirements(self): + if Version(self.version) >= "1.14.0" and not self._cmake_new_enough("3.18"): + self.tool_requires("cmake/3.25.0") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + cmakedeps = CMakeDeps(self) + cmakedeps.generate() + + tc = CMakeToolchain(self) + if self.settings.get_safe("compiler.cppstd"): + tc.variables["CMAKE_CXX_STANDARD"] = self._min_cpp_standard + if self.settings.get_safe("compiler.libcxx"): + tc = self._inject_stdlib_flag(tc) + if self.options.szip_support == "with_libaec": + tc.variables["USE_LIBAEC"] = True + tc.variables["HDF5_EXTERNALLY_CONFIGURED"] = True + tc.variables["HDF5_EXTERNAL_LIB_PREFIX"] = "" + tc.variables["HDF5_USE_FOLDERS"] = False + tc.variables["HDF5_NO_PACKAGES"] = True + tc.variables["ALLOW_UNSUPPORTED"] = False if Version(self.version) >= "1.10.6": - cmake.definitions["ONLY_SHARED_LIBS"] = self.options.shared - cmake.definitions["BUILD_STATIC_EXECS"] = False - cmake.definitions["HDF5_ENABLE_COVERAGE"] = False - cmake.definitions["HDF5_ENABLE_USING_MEMCHECKER"] = False + tc.variables["ONLY_SHARED_LIBS"] = self.options.shared + tc.variables["BUILD_STATIC_LIBS"] = not self.options.shared + tc.variables["BUILD_STATIC_EXECS"] = False + tc.variables["HDF5_ENABLE_COVERAGE"] = False + tc.variables["HDF5_ENABLE_USING_MEMCHECKER"] = False if Version(self.version) >= "1.10.0": - cmake.definitions["HDF5_MEMORY_ALLOC_SANITY_CHECK"] = False + tc.variables["HDF5_MEMORY_ALLOC_SANITY_CHECK"] = False if Version(self.version) >= "1.10.5": - cmake.definitions["HDF5_ENABLE_PREADWRITE"] = True - cmake.definitions["HDF5_ENABLE_DEPRECATED_SYMBOLS"] = True - cmake.definitions["HDF5_BUILD_GENERATORS"] = False - cmake.definitions["HDF5_ENABLE_TRACE"] = False + tc.variables["HDF5_ENABLE_PREADWRITE"] = True + tc.variables["HDF5_ENABLE_DEPRECATED_SYMBOLS"] = True + tc.variables["HDF5_BUILD_GENERATORS"] = False + tc.variables["HDF5_ENABLE_TRACE"] = False if self.settings.build_type == "Debug": - cmake.definitions["HDF5_ENABLE_INSTRUMENT"] = False # Option? - cmake.definitions["HDF5_ENABLE_PARALLEL"] = self.options.parallel - cmake.definitions["HDF5_ENABLE_Z_LIB_SUPPORT"] = self.options.with_zlib - cmake.definitions["HDF5_ENABLE_SZIP_SUPPORT"] = bool(self.options.szip_support) - if bool(self.options.szip_support): - cmake.definitions["CONAN_SZIP_LIBNAME"] = self._get_szip_lib() # this variable is added by conanize-link-szip*.patch - cmake.definitions["HDF5_ENABLE_SZIP_ENCODING"] = self.options.get_safe("szip_encoding", False) - cmake.definitions["HDF5_PACKAGE_EXTLIBS"] = False - cmake.definitions["HDF5_ENABLE_THREADSAFE"] = self.options.get_safe("threadsafe", False) - cmake.definitions["HDF5_ENABLE_DEBUG_APIS"] = False # Option? - cmake.definitions["BUILD_TESTING"] = False - cmake.definitions["HDF5_INSTALL_INCLUDE_DIR"] = os.path.join(self.package_folder, "include", "hdf5") - cmake.definitions["HDF5_BUILD_TOOLS"] = False - cmake.definitions["HDF5_BUILD_EXAMPLES"] = False - cmake.definitions["HDF5_BUILD_HL_LIB"] = self.options.hl - cmake.definitions["HDF5_BUILD_FORTRAN"] = False - cmake.definitions["HDF5_BUILD_CPP_LIB"] = self.options.enable_cxx + tc.variables["HDF5_ENABLE_INSTRUMENT"] = False # Option? + tc.variables["HDF5_ENABLE_PARALLEL"] = self.options.parallel + tc.variables["HDF5_ENABLE_Z_LIB_SUPPORT"] = self.options.with_zlib + tc.variables["HDF5_ENABLE_SZIP_SUPPORT"] = bool(self.options.szip_support) + tc.variables["HDF5_ENABLE_SZIP_ENCODING"] = self.options.get_safe("szip_encoding", False) + tc.variables["HDF5_PACKAGE_EXTLIBS"] = False + tc.variables["HDF5_ENABLE_THREADSAFE"] = self.options.get_safe("threadsafe", False) + tc.variables["HDF5_ENABLE_DEBUG_APIS"] = False # Option? + tc.variables["BUILD_TESTING"] = False + + # FIXME is there no built-in way of doing the replace? + tc.variables["HDF5_INSTALL_INCLUDE_DIR"] = os.path.join(self.package_folder, "include", "hdf5").replace("\\", "/") + + tc.variables["HDF5_BUILD_TOOLS"] = False + tc.variables["HDF5_BUILD_EXAMPLES"] = False + tc.variables["HDF5_BUILD_HL_LIB"] = self.options.hl + tc.variables["HDF5_BUILD_FORTRAN"] = False + tc.variables["HDF5_BUILD_CPP_LIB"] = self.options.enable_cxx if Version(self.version) >= "1.10.0": - cmake.definitions["HDF5_BUILD_JAVA"] = False + tc.variables["HDF5_BUILD_JAVA"] = False + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() - cmake.configure(build_folder=self._build_subfolder) - return cmake - def _get_szip_lib(self): - return { - "with_libaec": "libaec", - "with_szip": "szip", - }.get(str(self.options.szip_support)) + def build(self): + apply_conandata_patches(self) + # Do not force PIC + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "set (CMAKE_POSITION_INDEPENDENT_CODE ON)", "") + cmake = CMake(self) + cmake.configure() + cmake.build() def _components(self): hdf5_requirements = [] @@ -179,8 +203,7 @@ def _components(self): "hdf5_hl_cpp": {"component": "HL_CXX", "alias_target": "hdf5_hl_cpp", "requirements": ["hdf5_c", "hdf5_cpp", "hdf5_hl"]}, } - @staticmethod - def _create_cmake_module_alias_targets(conanfile, module_file, targets, is_parallel): + def _create_cmake_module_alias_targets(self, module_file, targets, is_parallel): content = "" for alias, aliased in targets.items(): content += textwrap.dedent("""\ @@ -198,26 +221,27 @@ def _create_cmake_module_alias_targets(conanfile, module_file, targets, is_paral endif() """) content += textwrap.dedent("set(HDF5_IS_PARALLEL {})".format("ON" if is_parallel else "OFF")) - save(conanfile, module_file, content) + save(self, module_file, content) @property def _module_file_rel_path(self): return os.path.join("lib", "cmake", - "conan-official-{}-targets.cmake".format(self.name)) + f"conan-official-{self.name}-targets.cmake") def package(self): - copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + + cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) - os.remove(os.path.join(self.package_folder, "lib", "libhdf5.settings")) + rm(self, "libhdf5.settings", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) # Mimic the official CMake FindHDF5 targets. HDF5::HDF5 refers to the global target as per conan, # but component targets have a lower case namespace prefix. hdf5::hdf5 refers to the C library only components = self._components() self._create_cmake_module_alias_targets( - self, os.path.join(self.package_folder, self._module_file_rel_path), - {"hdf5::{}".format(component["alias_target"]): "HDF5::{}".format(component["component"]) for component in components.values()}, + {f"hdf5::{component['alias_target']}": f"HDF5::{component['component']}" for component in components.values()}, self.options.get_safe("parallel", False) ) @@ -236,6 +260,7 @@ def _config_libname(lib): self.cpp_info.components[component_name].set_property("pkg_config_name", alias_target) self.cpp_info.components[component_name].libs = [_config_libname(alias_target)] self.cpp_info.components[component_name].requires = requirements + self.cpp_info.components[component_name].includedirs.append(os.path.join("include", "hdf5")) # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.components[component_name].names["cmake_find_package"] = component diff --git a/recipes/hdf5/all/patches/build-either-static-or-shared-1.10.5.patch b/recipes/hdf5/all/patches/build-either-static-or-shared-1.10.5.patch deleted file mode 100644 index 1fd97a9f54aa5d..00000000000000 --- a/recipes/hdf5/all/patches/build-either-static-or-shared-1.10.5.patch +++ /dev/null @@ -1,116 +0,0 @@ ---- a/c++/src/CMakeLists.txt -+++ b/c++/src/CMakeLists.txt -@@ -84,6 +84,7 @@ set (CPP_HDRS - ${HDF5_CPP_SRC_SOURCE_DIR}/H5VarLenType.h - ) - -+if (NOT BUILD_SHARED_LIBS) - add_library (${HDF5_CPP_LIB_TARGET} STATIC ${CPP_SOURCES} ${CPP_HDRS}) - target_include_directories(${HDF5_CPP_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" -@@ -98,6 +99,7 @@ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF - H5_SET_LIB_OPTIONS (${HDF5_CPP_LIB_TARGET} ${HDF5_CPP_LIB_NAME} STATIC 0) - set_target_properties (${HDF5_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/cpp) - set (install_targets ${HDF5_CPP_LIB_TARGET}) -+endif () - - if (BUILD_SHARED_LIBS) - add_library (${HDF5_CPP_LIBSH_TARGET} SHARED ${CPP_SOURCES} ${CPP_HDRS}) -@@ -135,8 +137,9 @@ install ( - if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_CPP_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries) -- endif () -+ else () - INSTALL_TARGET_PDB (${HDF5_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries) -+ endif () - - install ( - TARGETS ---- a/hl/c++/src/CMakeLists.txt -+++ b/hl/c++/src/CMakeLists.txt -@@ -8,6 +8,7 @@ project (HDF5_HL_CPP_SRC CXX) - set (HDF5_HL_CPP_SOURCES ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.cpp) - set (HDF5_HL_CPP_HDRS ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.h) - -+if (NOT BUILD_SHARED_LIBS) - add_library (${HDF5_HL_CPP_LIB_TARGET} STATIC ${HDF5_HL_CPP_SOURCES}) - target_include_directories(${HDF5_HL_CPP_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" -@@ -19,6 +20,7 @@ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF - H5_SET_LIB_OPTIONS (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_HL_CPP_LIB_NAME} STATIC 0) - set_target_properties (${HDF5_HL_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/hl) - set (install_targets ${HDF5_HL_CPP_LIB_TARGET}) -+endif () - - if (BUILD_SHARED_LIBS) - add_library (${HDF5_HL_CPP_LIBSH_TARGET} SHARED ${HDF5_HL_CPP_SOURCES}) -@@ -55,8 +57,9 @@ install ( - if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries) -- endif () -+ else () - INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries) -+ endif () - - install ( - TARGETS ---- a/hl/src/CMakeLists.txt -+++ b/hl/src/CMakeLists.txt -@@ -32,6 +32,7 @@ set (HL_PRIVATE_HEADERS - ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.h - ) - -+if (NOT BUILD_SHARED_LIBS) - add_library (${HDF5_HL_LIB_TARGET} STATIC ${HL_SOURCES} ${HL_HEADERS} ${HL_PRIVATE_HEADERS}) - target_include_directories(${HDF5_HL_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" -@@ -43,6 +44,7 @@ H5_SET_LIB_OPTIONS (${HDF5_HL_LIB_TARGET} ${HDF5_HL_LIB_NAME} STATIC 0) - set_target_properties (${HDF5_HL_LIB_TARGET} PROPERTIES FOLDER libraries/hl) - set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIB_TARGET}") - set (install_targets ${HDF5_HL_LIB_TARGET}) -+endif () - - if (BUILD_SHARED_LIBS) - add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SOURCES} ${HL_HEADERS} ${HL_PRIVATE_HEADERS}) -@@ -79,8 +81,9 @@ install ( - if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_HL_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hllibraries) -- endif () -+ else () - INSTALL_TARGET_PDB (${HDF5_HL_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hllibraries) -+ endif () - - install ( - TARGETS ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -1063,6 +1063,7 @@ option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) - set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c) - add_custom_target (gen_${HDF5_LIB_TARGET} ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2) - -+if (NOT BUILD_SHARED_LIBS) - add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) - target_include_directories(${HDF5_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" -@@ -1088,6 +1089,7 @@ set_target_properties (${HDF5_LIB_TARGET} PROPERTIES FOLDER libraries) - add_dependencies (${HDF5_LIB_TARGET} gen_${HDF5_LIB_TARGET}) - - set (install_targets ${HDF5_LIB_TARGET}) -+endif () - - if (BUILD_SHARED_LIBS) - set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_BINARY_DIR}/shared/H5lib_settings.c) -@@ -1144,8 +1146,9 @@ endif () - if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries) -- endif () -+ else () - INSTALL_TARGET_PDB (${HDF5_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries) -+ endif () - - install ( - TARGETS diff --git a/recipes/hdf5/all/patches/build-either-static-or-shared-1.8.21.patch b/recipes/hdf5/all/patches/build-either-static-or-shared-1.8.21.patch deleted file mode 100644 index d7ee7cabd980be..00000000000000 --- a/recipes/hdf5/all/patches/build-either-static-or-shared-1.8.21.patch +++ /dev/null @@ -1,125 +0,0 @@ ---- a/c++/src/CMakeLists.txt -+++ b/c++/src/CMakeLists.txt -@@ -86,6 +86,7 @@ set (CPP_HDRS - ${HDF5_CPP_SRC_SOURCE_DIR}/H5VarLenType.h - ) - -+if (NOT BUILD_SHARED_LIBS) - add_library (${HDF5_CPP_LIB_TARGET} STATIC ${CPP_SRCS} ${CPP_HDRS}) - TARGET_C_PROPERTIES (${HDF5_CPP_LIB_TARGET} STATIC " " " ") - target_link_libraries (${HDF5_CPP_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) -@@ -96,6 +97,7 @@ set_target_properties (${HDF5_CPP_LIB_TARGET} PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "$/include>" - ) - set (install_targets ${HDF5_CPP_LIB_TARGET}) -+endif () - - if (BUILD_SHARED_LIBS) - add_library (${HDF5_CPP_LIBSH_TARGET} SHARED ${CPP_SRCS} ${CPP_HDRS}) -@@ -130,8 +132,9 @@ install ( - if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_CPP_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries) -- endif () -+ else () - INSTALL_TARGET_PDB (${HDF5_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries) -+ endif () - - install ( - TARGETS ---- a/hl/c++/src/CMakeLists.txt -+++ b/hl/c++/src/CMakeLists.txt -@@ -10,6 +10,7 @@ INCLUDE_DIRECTORIES (${HDF5_HL_CPP_SRC_SOURCE_DIR}) - set (HDF5_HL_CPP_SRCS ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.cpp) - set (HDF5_HL_CPP_HDRS ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.h) - -+if (NOT BUILD_SHARED_LIBS) - add_library (${HDF5_HL_CPP_LIB_TARGET} STATIC ${HDF5_HL_CPP_SRCS}) - TARGET_C_PROPERTIES (${HDF5_HL_CPP_LIB_TARGET} STATIC " " " ") - target_link_libraries (${HDF5_HL_CPP_LIB_TARGET} PUBLIC ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) -@@ -20,6 +21,7 @@ set_target_properties (${HDF5_HL_CPP_LIB_TARGET} PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "$/include>" - ) - set (install_targets ${HDF5_HL_CPP_LIB_TARGET}) -+endif () - - if (BUILD_SHARED_LIBS) - add_library (${HDF5_HL_CPP_LIBSH_TARGET} SHARED ${HDF5_HL_CPP_SRCS}) -@@ -54,8 +56,9 @@ install ( - if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries) -- endif () -+ else () - INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries) -+ endif () - - install ( - TARGETS ---- a/hl/src/CMakeLists.txt -+++ b/hl/src/CMakeLists.txt -@@ -26,6 +26,7 @@ set (HL_HEADERS - ${HDF5_HL_SRC_SOURCE_DIR}/hdf5_hl.h - ) - -+if (NOT BUILD_SHARED_LIBS) - add_library (${HDF5_HL_LIB_TARGET} STATIC ${HL_SRCS} ${HL_HEADERS}) - TARGET_C_PROPERTIES (${HDF5_HL_LIB_TARGET} STATIC " " " ") - target_link_libraries (${HDF5_HL_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) -@@ -36,6 +37,7 @@ set_target_properties (${HDF5_HL_LIB_TARGET} PROPERTIES - ) - set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIB_TARGET}") - set (install_targets ${HDF5_HL_LIB_TARGET}) -+endif () - - if (BUILD_SHARED_LIBS) - add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SRCS} ${HL_HEADERS}) -@@ -70,8 +72,9 @@ install ( - if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_HL_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hllibraries) -- endif () -+ else () - INSTALL_TARGET_PDB (${HDF5_HL_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hllibraries) -+ endif () - - install ( - TARGETS ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -696,6 +696,8 @@ set_source_files_properties (${HDF5_BINARY_DIR}/H5version.h GENERATED) - set (common_SRCS ${common_SRCS} ${HDF5_BINARY_DIR}/H5overflow.h) - set_source_files_properties (${HDF5_BINARY_DIR}/H5overflow.h GENERATED) - -+option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) -+if (NOT BUILD_SHARED_LIBS) - add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS}) - TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC " " " ") - target_link_libraries (${HDF5_LIB_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS}) -@@ -709,7 +711,6 @@ set_target_properties (${HDF5_LIB_TARGET} PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "$/include>" - ) - --option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) - if (HDF5_ENABLE_DEBUG_APIS) - set_target_properties (${HDF5_LIB_TARGET} PROPERTIES - COMPILE_DEFINITIONS -@@ -717,6 +718,7 @@ if (HDF5_ENABLE_DEBUG_APIS) - ) - endif () - set (install_targets ${HDF5_LIB_TARGET}) -+endif() - - if (BUILD_SHARED_LIBS) - add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS}) -@@ -770,8 +772,9 @@ endif () - if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries) -- endif () -+ else () - INSTALL_TARGET_PDB (${HDF5_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries) -+ endif () - - install ( - TARGETS diff --git a/recipes/hdf5/all/patches/conanize-link-szip-1.10.5+.patch b/recipes/hdf5/all/patches/conanize-link-szip-1.10.5+.patch index 7bac650915b653..d81778f11d3b34 100644 --- a/recipes/hdf5/all/patches/conanize-link-szip-1.10.5+.patch +++ b/recipes/hdf5/all/patches/conanize-link-szip-1.10.5+.patch @@ -1,45 +1,37 @@ --- a/CMakeFilters.cmake +++ b/CMakeFilters.cmake -@@ -99,38 +99,10 @@ endif () - option (HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF) - if (HDF5_ENABLE_SZIP_SUPPORT) - option (HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF) -- if (NOT SZIP_USE_EXTERNAL) -- find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) -- if (NOT SZIP_FOUND) +@@ -52,10 +52,10 @@ + find_package (ZLIB NAMES ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) + if (NOT ZLIB_FOUND) + find_package (ZLIB) # Legacy find +- if (ZLIB_FOUND) +- set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES}) +- set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} ${ZLIB_LIBRARIES}) +- endif () ++ endif () ++ if (ZLIB_FOUND) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES}) ++ set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} ${ZLIB_LIBRARIES}) + endif () + endif () + if (ZLIB_FOUND) +@@ -102,10 +102,15 @@ + if (NOT SZIP_USE_EXTERNAL) + find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) + if (NOT SZIP_FOUND) - find_package (SZIP) # Legacy find - if (SZIP_FOUND) - set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) - set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} ${SZIP_LIBRARIES}) -- endif () -- endif () -- endif () -- if (SZIP_FOUND) -- set (H5_HAVE_FILTER_SZIP 1) -- set (H5_HAVE_SZLIB_H 1) -- set (H5_HAVE_LIBSZ 1) -- set (SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR}) -- set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIRS} ${SZIP_INCLUDE_DIR}) -- else () -- if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") -- EXTERNAL_SZIP_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT} ${HDF5_ENABLE_SZIP_ENCODING}) -- set (H5_HAVE_FILTER_SZIP 1) -- set (H5_HAVE_SZLIB_H 1) -- set (H5_HAVE_LIBSZ 1) -- message (STATUS "Filter SZIP is built") -- else () -- message (FATAL_ERROR "SZIP is Required for SZIP support in HDF5") -- endif () -- endif () -- if (BUILD_SHARED_LIBS) -- set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} ${SZIP_SHARED_LIBRARY}) -- endif () -- set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_STATIC_LIBRARY}) -- INCLUDE_DIRECTORIES (${SZIP_INCLUDE_DIRS}) -+ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} "CONAN_PKG::${CONAN_SZIP_LIBNAME}") -+ set (H5_HAVE_FILTER_SZIP 1) -+ set (H5_HAVE_SZLIB_H 1) -+ set (H5_HAVE_LIBSZ 1) - message (STATUS "Filter SZIP is ON") - if (H5_HAVE_FILTER_SZIP) - set (EXTERNAL_FILTERS "${EXTERNAL_FILTERS} DECODE") ++ find_package (szip CONFIG REQUIRED) ++ endif () ++ if (SZIP_FOUND) ++ if (TARGET szip-shared) ++ set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} szip-shared) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} szip-shared) ++ else () ++ set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} szip-static) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} szip-static) + endif () + endif () + endif () diff --git a/recipes/hdf5/all/patches/conanize-link-szip-1.12.1+.patch b/recipes/hdf5/all/patches/conanize-link-szip-1.12.1+.patch deleted file mode 100644 index fdf084ea5a466f..00000000000000 --- a/recipes/hdf5/all/patches/conanize-link-szip-1.12.1+.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- CMakeFilters.cmake 2021-07-01 23:26:37.000000000 +0200 -+++ CMakeFilters2.cmake 2022-02-07 07:25:14.498269403 +0100 -@@ -109,44 +109,10 @@ - option (HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF) - if (HDF5_ENABLE_SZIP_SUPPORT) - option (HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF) -- if (NOT SZIP_USE_EXTERNAL) -- find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) -- if (NOT SZIP_FOUND) -- find_package (SZIP) # Legacy find -- if (SZIP_FOUND) -- set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) -- endif () -- endif () -- endif () -- if (SZIP_FOUND) -- set (H5_HAVE_FILTER_SZIP 1) -- set (H5_HAVE_SZLIB_H 1) -- set (H5_HAVE_LIBSZ 1) -- set (SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR}) -- set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIRS} ${SZIP_INCLUDE_DIR}) -- else () -- if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") -- EXTERNAL_SZIP_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT} ${HDF5_ENABLE_SZIP_ENCODING}) -- set (H5_HAVE_FILTER_SZIP 1) -- set (H5_HAVE_SZLIB_H 1) -- set (H5_HAVE_LIBSZ 1) -- if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") -- message (VERBOSE "Filter SZIP is built") -- endif () -- if (USE_LIBAEC) -- if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") -- message (VERBOSE "... with library AEC") -- endif () -- set (SZ_PACKAGE_NAME ${LIBAEC_PACKAGE_NAME}) -- else () -- set (SZ_PACKAGE_NAME ${SZIP_PACKAGE_NAME}) -- endif () -- else () -- message (FATAL_ERROR "SZIP is Required for SZIP support in HDF5") -- endif () -- endif () -- set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_STATIC_LIBRARY}) -- INCLUDE_DIRECTORIES (${SZIP_INCLUDE_DIRS}) -+ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} "CONAN_PKG::${CONAN_SZIP_LIBNAME}") -+ set (H5_HAVE_FILTER_SZIP 1) -+ set (H5_HAVE_SZLIB_H 1) -+ set (H5_HAVE_LIBSZ 1) - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Filter SZIP is ON") - endif () diff --git a/recipes/hdf5/all/patches/conanize-link-szip-1.12.2+.patch b/recipes/hdf5/all/patches/conanize-link-szip-1.12.2+.patch index 1da6c95a320ba9..1cdae1d205cdcc 100644 --- a/recipes/hdf5/all/patches/conanize-link-szip-1.12.2+.patch +++ b/recipes/hdf5/all/patches/conanize-link-szip-1.12.2+.patch @@ -2,63 +2,45 @@ diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake index 725390b31b..085b18051e 100644 --- a/CMakeFilters.cmake +++ b/CMakeFilters.cmake -@@ -110,55 +110,10 @@ endif () - option (HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF) - if (HDF5_ENABLE_SZIP_SUPPORT) - option (HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF) -- if (NOT SZIP_USE_EXTERNAL) -- set(SZIP_FOUND FALSE) -- if (USE_LIBAEC) +@@ -63,9 +62,9 @@ + find_package (ZLIB NAMES ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) + if (NOT ZLIB_FOUND) + find_package (ZLIB) # Legacy find +- if (ZLIB_FOUND) +- set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES}) +- endif () ++ endif () ++ if (ZLIB_FOUND) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES}) + endif () + endif () + if (ZLIB_FOUND) +@@ -113,19 +112,21 @@ + if (NOT SZIP_USE_EXTERNAL) + set(SZIP_FOUND FALSE) + if (USE_LIBAEC) - set(libaec_USE_STATIC_LIBS ${USE_LIBAEC_STATIC}) - find_package (libaec 1.0.5 CONFIG) - if (SZIP_FOUND) - set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) - endif () -- endif () -- -- if (NOT SZIP_FOUND) -- find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) -- if (NOT SZIP_FOUND) -- find_package (SZIP) # Legacy find ++ find_package (libaec CONFIG REQUIRED) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} libaec::libaec) ++ set (SZIP_FOUND TRUE) + endif () + + if (NOT SZIP_FOUND) + find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) + if (NOT SZIP_FOUND) + find_package (SZIP) # Legacy find - if (SZIP_FOUND) - set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) -- endif () -- endif () -- endif () -- endif () -- if (SZIP_FOUND) -- set (H5_HAVE_FILTER_SZIP 1) -- set (H5_HAVE_SZLIB_H 1) -- set (H5_HAVE_LIBSZ 1) -- set (SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR}) -- set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIRS} ${SZIP_INCLUDE_DIR}) -- else () -- if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") -- EXTERNAL_SZIP_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT} ${HDF5_ENABLE_SZIP_ENCODING}) -- set (H5_HAVE_FILTER_SZIP 1) -- set (H5_HAVE_SZLIB_H 1) -- set (H5_HAVE_LIBSZ 1) -- if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") -- message (VERBOSE "Filter SZIP is built") -- endif () -- if (USE_LIBAEC) -- if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") -- message (VERBOSE "... with library AEC") -- endif () -- set (SZIP_PACKAGE_NAME ${LIBAEC_PACKAGE_NAME}) -- else () -- set (SZIP_PACKAGE_NAME ${SZIP_PACKAGE_NAME}) -- endif () -- else () -- message (FATAL_ERROR "SZIP is Required for SZIP support in HDF5") -- endif () -- endif () -- set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_STATIC_LIBRARY}) -- INCLUDE_DIRECTORIES (${SZIP_INCLUDE_DIRS}) -+ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} "CONAN_PKG::${CONAN_SZIP_LIBNAME}") -+ set (H5_HAVE_FILTER_SZIP 1) -+ set (H5_HAVE_SZLIB_H 1) -+ set (H5_HAVE_LIBSZ 1) - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Filter SZIP is ON") - endif () ++ endif () ++ if (SZIP_FOUND) ++ if (TARGET szip-shared) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} szip-shared) ++ else () ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} szip-static) + endif () + endif () + endif () diff --git a/recipes/hdf5/all/patches/conanize-link-szip-1.14.0+.patch b/recipes/hdf5/all/patches/conanize-link-szip-1.14.0+.patch new file mode 100644 index 00000000000000..b7c286ec1ccf26 --- /dev/null +++ b/recipes/hdf5/all/patches/conanize-link-szip-1.14.0+.patch @@ -0,0 +1,45 @@ +diff -u a/CMakeFilters.cmake b/CMakeFilters.cmake +--- a/CMakeFilters.cmake 2023-01-04 22:29:45.875695757 +0100 ++++ b/CMakeFilters.cmake 2023-01-04 22:37:15.356762199 +0100 +@@ -59,9 +59,9 @@ + find_package (ZLIB NAMES ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) + if (NOT ZLIB_FOUND) + find_package (ZLIB) # Legacy find +- if (ZLIB_FOUND) +- set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES}) +- endif () ++ endif() ++ if (ZLIB_FOUND) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES}) + endif () + endif () + if (ZLIB_FOUND) +@@ -105,20 +105,20 @@ + if (NOT SZIP_USE_EXTERNAL) + set(SZIP_FOUND FALSE) + if (USE_LIBAEC) +- set(libaec_USE_STATIC_LIBS ${USE_LIBAEC_STATIC}) +- find_package (libaec 1.0.5 CONFIG) +- if (SZIP_FOUND) +- set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) +- endif () ++ find_package (libaec CONFIG REQUIRED) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) ++ set (SZIP_FOUND TRUE) + endif () + + if (NOT SZIP_FOUND) + find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) + if (NOT SZIP_FOUND) + find_package (SZIP) # Legacy find +- if (SZIP_FOUND) +- set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) +- endif () ++ endif() ++ if (TARGET szip-shared) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} szip-shared) ++ else () ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} szip-static) + endif () + endif () + endif () diff --git a/recipes/hdf5/all/patches/conanize-link-szip-1.8.21.patch b/recipes/hdf5/all/patches/conanize-link-szip-1.8.21.patch index 0871659d5d2344..44cd11379d7b8d 100644 --- a/recipes/hdf5/all/patches/conanize-link-szip-1.8.21.patch +++ b/recipes/hdf5/all/patches/conanize-link-szip-1.8.21.patch @@ -1,45 +1,37 @@ --- a/CMakeFilters.cmake +++ b/CMakeFilters.cmake -@@ -91,38 +91,10 @@ endif () - option (HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF) - if (HDF5_ENABLE_SZIP_SUPPORT) - option (HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF) -- if (NOT SZIP_USE_EXTERNAL) -- find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) -- if (NOT SZIP_FOUND) +@@ -44,10 +44,10 @@ + find_package (ZLIB NAMES ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) + if (NOT ZLIB_FOUND) + find_package (ZLIB) # Legacy find +- if (ZLIB_FOUND) +- set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES}) +- set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} ${ZLIB_LIBRARIES}) +- endif () ++ endif () ++ if (ZLIB_FOUND) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES}) ++ set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} ${ZLIB_LIBRARIES}) + endif () + endif () + if (ZLIB_FOUND) +@@ -94,10 +94,15 @@ + if (NOT SZIP_USE_EXTERNAL) + find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) + if (NOT SZIP_FOUND) - find_package (SZIP) # Legacy find - if (SZIP_FOUND) - set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) - set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} ${SZIP_LIBRARIES}) -- endif () -- endif () -- endif () -- if (SZIP_FOUND) -- set (H5_HAVE_FILTER_SZIP 1) -- set (H5_HAVE_SZLIB_H 1) -- set (H5_HAVE_LIBSZ 1) -- set (SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR}) -- set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIRS} ${SZIP_INCLUDE_DIR}) -- else () -- if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") -- EXTERNAL_SZIP_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT} ${HDF5_ENABLE_SZIP_ENCODING}) -- set (H5_HAVE_FILTER_SZIP 1) -- set (H5_HAVE_SZLIB_H 1) -- set (H5_HAVE_LIBSZ 1) -- message (STATUS "Filter SZIP is built") -- else () -- message (FATAL_ERROR "SZIP is Required for SZIP support in HDF5") -- endif () -- endif () -- if (BUILD_SHARED_LIBS) -- set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} ${SZIP_SHARED_LIBRARY}) -- endif () -- set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_STATIC_LIBRARY}) -- INCLUDE_DIRECTORIES (${SZIP_INCLUDE_DIRS}) -+ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} "CONAN_PKG::${CONAN_SZIP_LIBNAME}") -+ set (H5_HAVE_FILTER_SZIP 1) -+ set (H5_HAVE_SZLIB_H 1) -+ set (H5_HAVE_LIBSZ 1) - message (STATUS "Filter SZIP is ON") - if (H5_HAVE_FILTER_SZIP) - set (EXTERNAL_FILTERS "${EXTERNAL_FILTERS} DECODE") ++ find_package (szip CONFIG REQUIRED) ++ endif () ++ if (SZIP_FOUND) ++ if (TARGET szip-shared) ++ set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} szip-shared) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} szip-shared) ++ else () ++ set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} szip-static) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} szip-static) + endif () + endif () + endif () diff --git a/recipes/hdf5/all/test_package/CMakeLists.txt b/recipes/hdf5/all/test_package/CMakeLists.txt index 61e2f5929ebe07..f55f0f366b044a 100644 --- a/recipes/hdf5/all/test_package/CMakeLists.txt +++ b/recipes/hdf5/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - set(HDF5_COMPONENTS C) if (HDF5_HL) list(APPEND HDF5_COMPONENTS HL) diff --git a/recipes/hdf5/all/test_package/conanfile.py b/recipes/hdf5/all/test_package/conanfile.py index 4d4698a0afd369..e3d318178049c6 100644 --- a/recipes/hdf5/all/test_package/conanfile.py +++ b/recipes/hdf5/all/test_package/conanfile.py @@ -1,21 +1,37 @@ -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, CMakeToolchain, cmake_layout + class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" - def build(self): - cmake = CMake(self) - cmake.definitions.update({ + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables.update({ "HDF5_CXX": self.options["hdf5"].enable_cxx, "HDF5_HL": self.options["hdf5"].hl, }) + if self.options["hdf5"].enable_cxx: + tc.variables.update({"CMAKE_CXX_STANDARD": 11}) + tc.generate() + + def build(self): + cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/hdf5/all/test_v1_package/CMakeLists.txt b/recipes/hdf5/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..61e2f5929ebe07 --- /dev/null +++ b/recipes/hdf5/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +set(HDF5_COMPONENTS C) +if (HDF5_HL) + list(APPEND HDF5_COMPONENTS HL) +endif() +if (HDF5_CXX) + list(APPEND HDF5_COMPONENTS CXX) +endif() +find_package(HDF5 COMPONENTS ${HDF5_COMPONENTS}) + +add_executable(${PROJECT_NAME} test_package.c) + +if (TARGET hdf5::hdf5_cpp) + target_compile_definitions(${PROJECT_NAME} PRIVATE CONAN_HDF5_CXX) + target_sources(${PROJECT_NAME} PRIVATE test_package.cpp) + target_link_libraries(${PROJECT_NAME} PRIVATE hdf5::hdf5_cpp) +elseif (HDF5_IS_PARALLEL) + target_compile_definitions(${PROJECT_NAME} PRIVATE CONAN_HDF5_PARALLEL) + target_sources(${PROJECT_NAME} PRIVATE test_parallel.c) + target_link_libraries(${PROJECT_NAME} PRIVATE hdf5::hdf5) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE hdf5::hdf5) +endif() diff --git a/recipes/hdf5/all/test_v1_package/conanfile.py b/recipes/hdf5/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..4c36411c061629 --- /dev/null +++ b/recipes/hdf5/all/test_v1_package/conanfile.py @@ -0,0 +1,24 @@ +import os + +from conans import CMake, ConanFile, tools + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.definitions.update({ + "HDF5_CXX": self.options["hdf5"].enable_cxx, + "HDF5_HL": self.options["hdf5"].hl, + }) + if self.options["hdf5"].enable_cxx: + cmake.definitions.update({"CMAKE_CXX_STANDARD": 11}) + cmake.configure() + cmake.build() + + 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/hdf5/all/test_v1_package/test_package.c b/recipes/hdf5/all/test_v1_package/test_package.c new file mode 100644 index 00000000000000..acc23d1bd8c5fe --- /dev/null +++ b/recipes/hdf5/all/test_v1_package/test_package.c @@ -0,0 +1,50 @@ +#include "hdf5.h" +#define FILE "dset.h5" + +extern void test_cxx_api(); +extern void test_parallel(); + +void test_c_api() +{ + + hid_t file_id, dataset_id, dataspace_id; /* identifiers */ + hsize_t dims[2]; + herr_t status; + + /* Create a new file using default properties. */ + file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* Create the data space for the dataset. */ + dims[0] = 4; + dims[1] = 6; + dataspace_id = H5Screate_simple(2, dims, NULL); + + /* Create the dataset. */ + dataset_id = + H5Dcreate2(file_id, "/dset", H5T_STD_I32BE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + /* End access to the dataset and release resources used by it. */ + status = H5Dclose(dataset_id); + + /* Terminate access to the data space. */ + status = H5Sclose(dataspace_id); + + /* Close the file. */ + status = H5Fclose(file_id); +} + +int main(int argc, char **argv) +{ + printf("Testing C API\n"); + test_c_api(); + #ifdef CONAN_HDF5_CXX + printf("Testing C++ API\n"); + test_cxx_api(); + #endif + #ifdef CONAN_HDF5_PARALLEL + printf("Testing HDF5 Parallel\n"); + test_parallel(argc, argv); + #endif + + return 0; +} diff --git a/recipes/hdf5/all/test_v1_package/test_package.cpp b/recipes/hdf5/all/test_v1_package/test_package.cpp new file mode 100644 index 00000000000000..ef3ec22b3871e9 --- /dev/null +++ b/recipes/hdf5/all/test_v1_package/test_package.cpp @@ -0,0 +1,9 @@ +#include + +extern "C" void test_cxx_api() +{ + hsize_t dimensions[] = {4, 6}; + H5::H5File file("dataset.h5", H5F_ACC_TRUNC); + H5::DataSpace dataspace(2, dimensions); + H5::DataSet dataset = file.createDataSet("dataset", H5::PredType::STD_I32BE, dataspace); +} diff --git a/recipes/hdf5/all/test_v1_package/test_parallel.c b/recipes/hdf5/all/test_v1_package/test_parallel.c new file mode 100644 index 00000000000000..557e7c0f803729 --- /dev/null +++ b/recipes/hdf5/all/test_v1_package/test_parallel.c @@ -0,0 +1,99 @@ +/* + * This example writes data to the HDF5 file. + * Number of processes is assumed to be 1 or multiples of 2 (up to 8) + */ + +#include "hdf5.h" +#include "stdlib.h" + +#define H5FILE_NAME "SDS.h5" +#define DATASETNAME "IntArray" +#define NX 8 /* dataset dimensions */ +#define NY 5 +#define RANK 2 + +int test_parallel(int argc, char **argv) +{ + /* + * HDF5 APIs definitions + */ + hid_t file_id, dset_id; /* file and dataset identifiers */ + hid_t filespace; /* file and memory dataspace identifiers */ + hsize_t dimsf[] = {NX, NY}; /* dataset dimensions */ + int *data; /* pointer to data buffer to write */ + hid_t plist_id; /* property list identifier */ + int i; + herr_t status; + + /* + * MPI variables + */ + int mpi_size, mpi_rank; + MPI_Comm comm = MPI_COMM_WORLD; + MPI_Info info = MPI_INFO_NULL; + + /* + * Initialize MPI + */ + MPI_Init(&argc, &argv); + MPI_Comm_size(comm, &mpi_size); + MPI_Comm_rank(comm, &mpi_rank); + + /* + * Initialize data buffer + */ + data = (int *) malloc(sizeof(int)*dimsf[0]*dimsf[1]); + for (i=0; i < dimsf[0]*dimsf[1]; i++) { + data[i] = i; + } + /* + * Set up file access property list with parallel I/O access + */ + plist_id = H5Pcreate(H5P_FILE_ACCESS); + H5Pset_fapl_mpio(plist_id, comm, info); + + /* + * Create a new file collectively and release property list identifier. + */ + file_id = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, plist_id); + H5Pclose(plist_id); + + + /* + * Create the dataspace for the dataset. + */ + filespace = H5Screate_simple(RANK, dimsf, NULL); + + /* + * Create the dataset with default properties and close filespace. + */ + dset_id = H5Dcreate(file_id, DATASETNAME, H5T_NATIVE_INT, filespace, + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + /* + * Create property list for collective dataset write. + */ + plist_id = H5Pcreate(H5P_DATASET_XFER); + H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_COLLECTIVE); + + /* + * To write dataset independently use + * + * H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_INDEPENDENT); + */ + + status = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + plist_id, data); + free(data); + + /* + * Close/release resources. + */ + H5Dclose(dset_id); + H5Sclose(filespace); + H5Pclose(plist_id); + H5Fclose(file_id); + + MPI_Finalize(); + + return 0; +} diff --git a/recipes/hdf5/config.yml b/recipes/hdf5/config.yml index 354b7315d78c15..6c8040e06da054 100644 --- a/recipes/hdf5/config.yml +++ b/recipes/hdf5/config.yml @@ -1,10 +1,10 @@ versions: + "1.14.0": + folder: all "1.13.1": folder: all "1.12.2": folder: all - "1.12.1": - folder: all "1.12.0": folder: all "1.10.6": diff --git a/recipes/hidapi/all/conanfile.py b/recipes/hidapi/all/conanfile.py index eaf53fb9ab72b9..0d46e3c910cf03 100644 --- a/recipes/hidapi/all/conanfile.py +++ b/recipes/hidapi/all/conanfile.py @@ -1,9 +1,14 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, MSBuild, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, MSBuild, MSBuildToolchain import os -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.54.0" class HidapiConan(ConanFile): @@ -25,87 +30,108 @@ class HidapiConan(ConanFile): "shared": False, } - generators = "pkg_config" - @property - def _source_subfolder(self): - return "source_subfolder" + def _settings_build(self): + return getattr(self, "settings_build", self.settings) @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + def _msbuild_configuration(self): + return "Debug" if self.settings.build_type == "Debug" else "Release" def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if self._is_msvc: + if is_msvc(self): self.options.shared = True def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.settings.os in ["Linux", "FreeBSD"]: - self.requires("libusb/1.0.24") + self.requires("libusb/1.0.26") def validate(self): - if self._is_msvc and not self.options.shared: + if is_msvc(self) and not self.options.shared: raise ConanInvalidConfiguration("Static libraries for Visual Studio are currently not available") def build_requirements(self): - if not self._is_msvc: - self.build_requires("libtool/2.4.6") + if not is_msvc(self): + self.tool_requires("libtool/2.4.7") + if self.settings.os in ["Linux", "FreeBSD"] and not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.configuration = self._msbuild_configuration + tc.properties["WholeProgramOptimization"] = "false" + tc.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.generate() + deps = PkgConfigDeps(self) + deps.generate() def _patch_sources(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "configure.ac"), - "AC_CONFIG_MACRO_DIR", "dnl AC_CONFIG_MACRO_DIR") - - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - ] - autotools.configure(configure_dir=self._source_subfolder, args=args) - return autotools + replace_in_file(self, os.path.join(self.source_folder, "configure.ac"), + "AC_CONFIG_MACRO_DIR", "dnl AC_CONFIG_MACRO_DIR") def build(self): self._patch_sources() - if self._is_msvc: - self._build_msvc() + if is_msvc(self): + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + replace_in_file( + self, os.path.join(self.source_folder, "windows", "hidapi.vcxproj"), + "true", + "", + ) + conantoolchain_props = os.path.join(self.generators_folder, MSBuildToolchain.filename) + replace_in_file( + self, os.path.join(self.source_folder, "windows", "hidapi.vcxproj"), + "", + f"", + ) + + msbuild = MSBuild(self) + msbuild.build_type = self._msbuild_configuration + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + msbuild.build(os.path.join(self.source_folder, "windows", "hidapi.sln"), targets=["hidapi"]) else: - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) - # relocatable shared lib on macOS - tools.replace_in_file("configure", "-install_name \\$rpath/", "-install_name @rpath/") - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() autotools.make() - def _build_msvc(self): - msbuild = MSBuild(self) - msbuild.build(os.path.join(self._source_subfolder, "windows", "hidapi.sln"), - platforms={"x86": "Win32"}) - def package(self): - self.copy("LICENSE*", src=self._source_subfolder, dst="licenses") - if self.settings.os == "Windows": - self.copy(os.path.join("hidapi", "*.h"), dst="include", src=self._source_subfolder) - self.copy("*hidapi.lib", dst="lib", keep_path=False) - self.copy("*.dll", dst="bin", keep_path=False) + copy(self, "LICENSE*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + copy(self, os.path.join("hidapi", "*.h"), src=self.source_folder, dst=os.path.join(self.package_folder, "include")) + output_folder = os.path.join(self.source_folder, "windows") + copy(self, "*hidapi.lib", src=output_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dll", src=output_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): if self.settings.os in ["Linux", "FreeBSD"]: @@ -120,4 +146,4 @@ def package_info(self): else: self.cpp_info.libs = ["hidapi"] if self.settings.os == "Macos": - self.cpp_info.frameworks.extend(["IOKit", "CoreFoundation", "Appkit"]) + self.cpp_info.frameworks.extend(["IOKit", "CoreFoundation", "AppKit"]) diff --git a/recipes/hidapi/all/test_package/CMakeLists.txt b/recipes/hidapi/all/test_package/CMakeLists.txt index be3a6a4e6aaa6a..51fe04d5b6cce2 100644 --- a/recipes/hidapi/all/test_package/CMakeLists.txt +++ b/recipes/hidapi/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(hidapi CONFIG REQUIRED) +find_package(hidapi REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} hidapi::hidapi) +target_link_libraries(${PROJECT_NAME} PRIVATE hidapi::hidapi) diff --git a/recipes/hidapi/all/test_package/conanfile.py b/recipes/hidapi/all/test_package/conanfile.py index 8d1ff488f0374f..98ab55852ad565 100644 --- a/recipes/hidapi/all/test_package/conanfile.py +++ b/recipes/hidapi/all/test_package/conanfile.py @@ -1,19 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools -class HidapiTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -21,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/hidapi/all/test_v1_package/CMakeLists.txt b/recipes/hidapi/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/hidapi/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/hidapi/all/test_v1_package/conanfile.py b/recipes/hidapi/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/hidapi/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/highfive/all/conanfile.py b/recipes/highfive/all/conanfile.py index 11ed9374f0a0ac..c7a09023dd38c6 100644 --- a/recipes/highfive/all/conanfile.py +++ b/recipes/highfive/all/conanfile.py @@ -34,9 +34,9 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("hdf5/1.13.1") + self.requires("hdf5/1.14.0") if self.options.with_boost: - self.requires("boost/1.80.0") + self.requires("boost/1.81.0") if self.options.with_eigen: self.requires("eigen/3.4.0") if self.options.with_xtensor: diff --git a/recipes/hlslpp/all/conandata.yml b/recipes/hlslpp/all/conandata.yml index 9962d3d9124379..41a6668e87c713 100644 --- a/recipes/hlslpp/all/conandata.yml +++ b/recipes/hlslpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.2.2": + url: "https://github.com/redorav/hlslpp/archive/refs/tags/3.2.2.tar.gz" + sha256: "f8fae38e6f02920f24344a86397f03b2a7a1fe18bbcb77f4c39bc33978c4a058" "3.2": url: "https://github.com/redorav/hlslpp/archive/3.2.tar.gz" sha256: "23ab0b7f392c518185157e9b1e099eac0a560f4932cebbdf8ccb4a533a0d0336" diff --git a/recipes/hlslpp/all/conanfile.py b/recipes/hlslpp/all/conanfile.py index 875e16e21920d7..d8ccb3fef6db2b 100644 --- a/recipes/hlslpp/all/conanfile.py +++ b/recipes/hlslpp/all/conanfile.py @@ -10,13 +10,16 @@ class HlslppConan(ConanFile): name = "hlslpp" description = "Header-only Math library using hlsl syntax with SSE/NEON support" - topics = ("hlslpp", "hlsl", "math", "shader", "vector", "matrix", "quaternion") + topics = ("hlsl", "math", "shader", "vector", "matrix", "quaternion") license = "MIT" homepage = "https://github.com/redorav/hlslpp" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" no_copy_source = True + def layout(self): + basic_layout(self, src_folder="src") + def package_id(self): self.info.clear() @@ -24,9 +27,6 @@ def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) - def layout(self): - basic_layout(self, src_folder="src") - def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -40,6 +40,4 @@ def package(self): def package_info(self): self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] diff --git a/recipes/hlslpp/all/test_package/conanfile.py b/recipes/hlslpp/all/test_package/conanfile.py index d120a992c06a69..0a6bc68712d901 100644 --- a/recipes/hlslpp/all/test_package/conanfile.py +++ b/recipes/hlslpp/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/hlslpp/all/test_v1_package/CMakeLists.txt b/recipes/hlslpp/all/test_v1_package/CMakeLists.txt index 3b23e4e379ffb0..0d20897301b68b 100644 --- a/recipes/hlslpp/all/test_v1_package/CMakeLists.txt +++ b/recipes/hlslpp/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(hlslpp REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE hlslpp::hlslpp) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/hlslpp/config.yml b/recipes/hlslpp/config.yml index b8a3a571e7b7d1..199b902f235398 100644 --- a/recipes/hlslpp/config.yml +++ b/recipes/hlslpp/config.yml @@ -1,4 +1,6 @@ versions: + "3.2.2": + folder: all "3.2": folder: all "3.1": diff --git a/recipes/homog2d/all/conandata.yml b/recipes/homog2d/all/conandata.yml index 9703143edc4f09..c744269df86d0e 100644 --- a/recipes/homog2d/all/conandata.yml +++ b/recipes/homog2d/all/conandata.yml @@ -11,3 +11,7 @@ patches: - patch_file: "patches/0002-pretty_function-for-msvc.patch" patch_description: "use __FUNCSIG__ instead of __PRETTY_FUNCTION__ on MSVC" patch_type: "portability" + - patch_file: "patches/0003-support-msvc.patch" + patch_description: "fix msvc compilation error" + patch_type: "portability" + patch_source: "https://github.com/skramm/homog2d/issues/2" diff --git a/recipes/homog2d/all/patches/0002-pretty_function-for-msvc.patch b/recipes/homog2d/all/patches/0002-pretty_function-for-msvc.patch index ea9cad9d77946e..5b68d2eeb13eca 100644 --- a/recipes/homog2d/all/patches/0002-pretty_function-for-msvc.patch +++ b/recipes/homog2d/all/patches/0002-pretty_function-for-msvc.patch @@ -1,5 +1,5 @@ diff --git a/homog2d.hpp b/homog2d.hpp -index f30d150..68bc280 100644 +index f30d150..d82d7e5 100644 --- a/homog2d.hpp +++ b/homog2d.hpp @@ -115,12 +115,18 @@ See https://github.com/skramm/homog2d @@ -31,15 +31,3 @@ index f30d150..68bc280 100644 << "\n -Error count=" << ++errorCount(); \ throw std::runtime_error( oss.str() ); \ } -@@ -2914,11 +2920,6 @@ private: - h2d::operator * ( const h2d::Point2d_&, const h2d::Point2d_& ) - -> h2d::Line2d_; - -- template -- friend auto -- h2d::operator * ( const h2d::Homogr_&, const h2d::Line2d_& ) -- -> h2d::Line2d_; -- - template - friend base::LPBase - detail::crossProduct( const base::LPBase&, const base::LPBase& ); diff --git a/recipes/homog2d/all/patches/0003-support-msvc.patch b/recipes/homog2d/all/patches/0003-support-msvc.patch new file mode 100644 index 00000000000000..5897903f1959fb --- /dev/null +++ b/recipes/homog2d/all/patches/0003-support-msvc.patch @@ -0,0 +1,22 @@ +diff --git a/homog2d.hpp b/homog2d.hpp +index 77f6841..ab8646b 100644 +--- a/homog2d.hpp ++++ b/homog2d.hpp +@@ -729,12 +729,11 @@ auto + operator << ( std::ostream&, const h2d::base::LPBase& ) + -> std::ostream&; + } +-/* +-template +-auto +-operator << ( std::ostream&, const h2d::Point2d_& ) +--> std::ostream&; +-*/ ++ ++// forward declaration, related to https://github.com/skramm/homog2d/issues/2 ++template ++Line2d_ ++operator * ( const Homogr_&, const Line2d_& ); + + namespace detail { + diff --git a/recipes/http_parser/all/conanfile.py b/recipes/http_parser/all/conanfile.py index e764d7f53939c3..70717a99f03795 100644 --- a/recipes/http_parser/all/conanfile.py +++ b/recipes/http_parser/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import copy, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class HttpParserConan(ConanFile): @@ -24,30 +24,24 @@ class HttpParserConan(ConanFile): "fPIC": True, } - exports_sources = "CMakeLists.txt" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def export_sources(self): + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/http_parser/all/test_v1_package/conanfile.py b/recipes/http_parser/all/test_v1_package/conanfile.py index 75c0cd81d2d2f3..38f4483872d47f 100644 --- a/recipes/http_parser/all/test_v1_package/conanfile.py +++ b/recipes/http_parser/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/hyperscan/all/CMakeLists.txt b/recipes/hyperscan/all/CMakeLists.txt deleted file mode 100644 index 1848ca5a77c355..00000000000000 --- a/recipes/hyperscan/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/hyperscan/all/conandata.yml b/recipes/hyperscan/all/conandata.yml index a03650d07b3ae0..b46d4ac06c6166 100644 --- a/recipes/hyperscan/all/conandata.yml +++ b/recipes/hyperscan/all/conandata.yml @@ -4,5 +4,9 @@ sources: sha256: "e51aba39af47e3901062852e5004d127fa7763b5dbbc16bcca4265243ffa106f" patches: "5.4.0": - - patch_file: "patches/fix-cmake.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-fix-cmake.patch" + patch_description: "modify cmake files to build with conan" + patch_type: "conan" + - patch_file: "patches/0002-use-ue2-make_unique.patch" + patch_description: "add ue2:: prefix to make_unique for name collision" + patch_type: "portability" diff --git a/recipes/hyperscan/all/conanfile.py b/recipes/hyperscan/all/conanfile.py index f3eb36131b29f9..4e6a4a4f423c33 100644 --- a/recipes/hyperscan/all/conanfile.py +++ b/recipes/hyperscan/all/conanfile.py @@ -1,23 +1,20 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration - +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class HyperscanConan(ConanFile): name = "hyperscan" + description = "High-performance regular expression matching library" license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.hyperscan.io" - description = "High-performance regular expression matching library" topics = ("regex", "regular expressions") - settings = "os", "compiler", "build_type", "arch" - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake", "cmake_find_package" - - _cmake = None - + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -26,9 +23,8 @@ class HyperscanConan(ConanFile): "build_avx512": [True, False], "fat_runtime": [True, False], "build_chimera": [True, False], - "dump_support": [True, False, "auto"] + "dump_support": [True, False, "auto"], } - default_options = { "shared": False, "fPIC": True, @@ -37,74 +33,79 @@ class HyperscanConan(ConanFile): "build_avx512": False, "fat_runtime": False, "build_chimera": False, - "dump_support": "auto" + "dump_support": "auto", } @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("hyperscan-{0}".format(self.version), self._source_subfolder) + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC - def build_requirements(self): - self.build_requires("ragel/6.10"); + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("boost/1.79.0"); + self.requires("boost/1.80.0"); if self.options.build_chimera: self.requires("pcre/8.45") def validate(self): - tools.check_min_cppstd(self, "11") + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + + if self.options.shared and self.options.build_chimera: + raise ConanInvalidConfiguration("Chimera build requires static building") if self.settings.arch not in ["x86", "x86_64"]: raise ConanInvalidConfiguration("Hyperscan only support x86 architecture") - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC + def build_requirements(self): + self.build_requires("ragel/6.10"); - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self); + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) if self.options.optimise != "auto": - self._cmake.definitions["OPTIMISE"] = self.options.optimise + tc.variables["OPTIMISE"] = self.options.optimise if self.options.debug_output != "auto": - self._cmake.definitions["DEBUG_OUTPUT"] = self.options.debug_output - self._cmake.definitions["BUILD_AVX512"] = self.options.build_avx512 - self._cmake.definitions["FAT_RUNTIME"] = self.options.fat_runtime - self._cmake.definitions["BUILD_CHIMERA"] = self.options.build_chimera + tc.variables["DEBUG_OUTPUT"] = self.options.debug_output + tc.variables["BUILD_AVX512"] = self.options.build_avx512 + tc.variables["FAT_RUNTIME"] = self.options.fat_runtime + tc.variables["BUILD_CHIMERA"] = self.options.build_chimera if self.options.dump_support != "auto": - self._cmake.definitions["DUMP_SUPPORT"] = self.options.dump_support - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - - def configure(self): - if self.options.shared: - del self.options.fPIC + tc.variables["DUMP_SUPPORT"] = self.options.dump_support + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() - if self.options.shared and self.options.build_chimera: - raise ConanInvalidConfiguration("Chimera build requires static building") + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + + cmake = CMake(self) cmake.install() - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.names["cmake_find_package"] = "hyperscan" @@ -133,8 +134,6 @@ def package_info(self): self.cpp_info.components["chimera"].set_property("cmake_target_name", "hyperscan::chimera") self.cpp_info.components["chimera"].set_property("pkg_config_name", "libchimera") - - if not self.options.shared: if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["hs"].system_libs = ["m"] @@ -142,4 +141,3 @@ def package_info(self): if self.options.build_chimera: self.cpp_info.components["chimera"].system_libs = ["m"] - diff --git a/recipes/hyperscan/all/patches/fix-cmake.patch b/recipes/hyperscan/all/patches/0001-fix-cmake.patch similarity index 86% rename from recipes/hyperscan/all/patches/fix-cmake.patch rename to recipes/hyperscan/all/patches/0001-fix-cmake.patch index 0905e34e5bc471..872966c197543c 100644 --- a/recipes/hyperscan/all/patches/fix-cmake.patch +++ b/recipes/hyperscan/all/patches/0001-fix-cmake.patch @@ -1,7 +1,7 @@ -diff --git CMakeLists.txt CMakeLists.txt -index 8bc6077..579a7b4 100644 ---- CMakeLists.txt -+++ CMakeLists.txt +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8bc6077..0fbed25 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt @@ -6,7 +6,7 @@ set (HS_MINOR_VERSION 4) set (HS_PATCH_VERSION 0) set (HS_VERSION ${HS_MAJOR_VERSION}.${HS_MINOR_VERSION}.${HS_PATCH_VERSION}) @@ -58,6 +58,15 @@ index 8bc6077..579a7b4 100644 # testing a builtin takes a little more work CHECK_C_SOURCE_COMPILES("void *aa_test(void *x) { return __builtin_assume_aligned(x, 16);}\nint main(void) { return 0; }" HAVE_CC_BUILTIN_ASSUME_ALIGNED) +@@ -463,7 +463,7 @@ else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + endif() + +-add_subdirectory(util) ++# add_subdirectory(util) + add_subdirectory(doc/dev-reference) + + if (NOT WIN32) @@ -472,7 +472,7 @@ if (NOT WIN32) set(PCRE_REQUIRED_MAJOR_VERSION 8) set(PCRE_REQUIRED_MINOR_VERSION 41) @@ -67,15 +76,18 @@ index 8bc6077..579a7b4 100644 if (NOT CORRECT_PCRE_VERSION) message(STATUS "PCRE ${PCRE_REQUIRED_VERSION} or above not found") endif() -@@ -483,16 +483,16 @@ if (CORRECT_PCRE_VERSION AND PCRE_BUILD_SOURCE AND BUILD_STATIC_LIBS) +@@ -482,17 +482,19 @@ if (CORRECT_PCRE_VERSION AND PCRE_BUILD_SOURCE AND BUILD_STATIC_LIBS) + set(BUILD_CHIMERA TRUE) endif() ++if(0) add_subdirectory(unit) -if (EXISTS ${CMAKE_SOURCE_DIR}/tools/CMakeLists.txt) +if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tools/CMakeLists.txt) add_subdirectory(tools) endif() -if (EXISTS ${CMAKE_SOURCE_DIR}/chimera/CMakeLists.txt AND BUILD_CHIMERA) ++endif() +if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/chimera/CMakeLists.txt AND BUILD_CHIMERA) add_subdirectory(chimera) endif() @@ -87,7 +99,7 @@ index 8bc6077..579a7b4 100644 configure_file(src/hs_version.h.in ${PROJECT_BINARY_DIR}/hs_version.h) if (NOT WIN32) -@@ -505,7 +505,7 @@ if (NOT WIN32) +@@ -505,7 +507,7 @@ if (NOT WIN32) endforeach() configure_file(libhs.pc.in libhs.pc @ONLY) # only replace @ quoted vars @@ -96,7 +108,7 @@ index 8bc6077..579a7b4 100644 DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") endif() -@@ -524,7 +524,7 @@ if (WIN32) +@@ -524,7 +526,7 @@ if (WIN32) set(PCRE_REQUIRED_MAJOR_VERSION 8) set(PCRE_REQUIRED_MINOR_VERSION 41) set(PCRE_REQUIRED_VERSION ${PCRE_REQUIRED_MAJOR_VERSION}.${PCRE_REQUIRED_MINOR_VERSION}) @@ -105,20 +117,23 @@ index 8bc6077..579a7b4 100644 if (NOT CORRECT_PCRE_VERSION) message(STATUS "PCRE ${PCRE_REQUIRED_VERSION} or above not found") endif() -@@ -535,10 +535,10 @@ if (CORRECT_PCRE_VERSION AND PCRE_BUILD_SOURCE AND BUILD_STATIC_LIBS) +@@ -534,11 +536,13 @@ if (CORRECT_PCRE_VERSION AND PCRE_BUILD_SOURCE AND BUILD_STATIC_LIBS) + set(BUILD_CHIMERA TRUE) endif() ++if(0) add_subdirectory(unit) -if (EXISTS ${CMAKE_SOURCE_DIR}/tools/CMakeLists.txt) +if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tools/CMakeLists.txt) add_subdirectory(tools) endif() -if (EXISTS ${CMAKE_SOURCE_DIR}/chimera/CMakeLists.txt AND BUILD_CHIMERA) ++endif() +if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/chimera/CMakeLists.txt AND BUILD_CHIMERA) add_subdirectory(chimera) endif() endif() -@@ -548,14 +548,14 @@ set(RAGEL_C_FLAGS "-Wno-unused") +@@ -548,14 +552,14 @@ set(RAGEL_C_FLAGS "-Wno-unused") endif() set_source_files_properties( @@ -135,7 +150,7 @@ index 8bc6077..579a7b4 100644 PROPERTIES COMPILE_FLAGS "${RAGEL_C_FLAGS}") -@@ -1216,28 +1216,28 @@ else (FAT_RUNTIME) +@@ -1216,28 +1220,28 @@ else (FAT_RUNTIME) list(APPEND RUNTIME_LIBS $) set_target_properties(hs_exec_core2 PROPERTIES COMPILE_FLAGS "-march=core2" @@ -168,7 +183,7 @@ index 8bc6077..579a7b4 100644 ) endif (BUILD_AVX512) if (BUILD_AVX512VBMI) -@@ -1245,7 +1245,7 @@ else (FAT_RUNTIME) +@@ -1245,7 +1249,7 @@ else (FAT_RUNTIME) list(APPEND RUNTIME_LIBS $) set_target_properties(hs_exec_avx512vbmi PROPERTIES COMPILE_FLAGS "${ICELAKE_FLAG}" @@ -177,7 +192,7 @@ index 8bc6077..579a7b4 100644 ) endif (BUILD_AVX512VBMI) -@@ -1280,21 +1280,21 @@ else (FAT_RUNTIME) +@@ -1280,21 +1284,21 @@ else (FAT_RUNTIME) set_target_properties(hs_exec_shared_core2 PROPERTIES COMPILE_FLAGS "-march=core2" POSITION_INDEPENDENT_CODE TRUE @@ -202,7 +217,7 @@ index 8bc6077..579a7b4 100644 ) if (BUILD_AVX512) -@@ -1303,7 +1303,7 @@ else (FAT_RUNTIME) +@@ -1303,7 +1307,7 @@ else (FAT_RUNTIME) set_target_properties(hs_exec_shared_avx512 PROPERTIES COMPILE_FLAGS "${SKYLAKE_FLAG}" POSITION_INDEPENDENT_CODE TRUE @@ -211,7 +226,7 @@ index 8bc6077..579a7b4 100644 ) endif (BUILD_AVX512) if (BUILD_AVX512VBMI) -@@ -1312,7 +1312,7 @@ else (FAT_RUNTIME) +@@ -1312,7 +1316,7 @@ else (FAT_RUNTIME) set_target_properties(hs_exec_shared_avx512vbmi PROPERTIES COMPILE_FLAGS "${ICELAKE_FLAG}" POSITION_INDEPENDENT_CODE TRUE @@ -220,10 +235,10 @@ index 8bc6077..579a7b4 100644 ) endif (BUILD_AVX512VBMI) add_library(hs_exec_common_shared OBJECT -diff --git chimera/CMakeLists.txt chimera/CMakeLists.txt +diff --git a/chimera/CMakeLists.txt b/chimera/CMakeLists.txt index 1cd66a3..ebb3b49 100644 ---- chimera/CMakeLists.txt -+++ chimera/CMakeLists.txt +--- a/chimera/CMakeLists.txt ++++ b/chimera/CMakeLists.txt @@ -44,6 +44,6 @@ if (NOT WIN32) set(PRIVATE_LIBS "${PRIVATE_LIBS} -L${LIBDIR} -lpcre") @@ -232,10 +247,10 @@ index 1cd66a3..ebb3b49 100644 + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libch.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") endif() -diff --git chimera/ch_database.h chimera/ch_database.h +diff --git a/chimera/ch_database.h b/chimera/ch_database.h index 28bde86..d757c82 100644 ---- chimera/ch_database.h -+++ chimera/ch_database.h +--- a/chimera/ch_database.h ++++ b/chimera/ch_database.h @@ -38,7 +38,7 @@ extern "C" { #endif @@ -245,10 +260,10 @@ index 28bde86..d757c82 100644 #include #include "ch_compile.h" // for CH_MODE_ flags -diff --git cmake/pcre.cmake cmake/pcre.cmake -index e0acda5..c68601f 100644 ---- cmake/pcre.cmake -+++ cmake/pcre.cmake +diff --git a/cmake/pcre.cmake b/cmake/pcre.cmake +index e0acda5..c3cbbc7 100644 +--- a/cmake/pcre.cmake ++++ b/cmake/pcre.cmake @@ -1,4 +1,5 @@ # first look in pcre-$version or pcre subdirs + @@ -264,21 +279,21 @@ index e0acda5..c68601f 100644 - pkg_check_modules(PCRE libpcre>=${PCRE_REQUIRED_VERSION}) - if (PCRE_FOUND) + # conan should save us -+ find_package(PCRE) -+ if(PCRE_FOUND AND (PCRE_VERSION VERSION_GREATER_EQUAL PCRE_REQUIRED_VERSION)) ++ find_package(pcre) ++ if(pcre_FOUND AND (pcre_VERSION VERSION_GREATER_EQUAL PCRE_REQUIRED_VERSION)) set(CORRECT_PCRE_VERSION TRUE) - message(STATUS "PCRE version ${PCRE_REQUIRED_VERSION} or above") - else () - message(STATUS "PCRE version ${PCRE_REQUIRED_VERSION} or above not found") - return () - endif () -+ set(PCRE_LDFLAGS "PCRE::libpcre") ++ set(PCRE_LDFLAGS "pcre::pcre") + endif() endif (PCRE_BUILD_SOURCE) -diff --git tools/CMakeLists.txt tools/CMakeLists.txt +diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 6ca3fd8..378afd0 100644 ---- tools/CMakeLists.txt -+++ tools/CMakeLists.txt +--- a/tools/CMakeLists.txt ++++ b/tools/CMakeLists.txt @@ -1,3 +1,7 @@ + +# Tools are not installed @@ -287,20 +302,20 @@ index 6ca3fd8..378afd0 100644 find_package(Threads) # remove some warnings -diff --git tools/hsbench/CMakeLists.txt tools/hsbench/CMakeLists.txt +diff --git a/tools/hsbench/CMakeLists.txt b/tools/hsbench/CMakeLists.txt index bbceda4..18545d0 100644 ---- tools/hsbench/CMakeLists.txt -+++ tools/hsbench/CMakeLists.txt +--- a/tools/hsbench/CMakeLists.txt ++++ b/tools/hsbench/CMakeLists.txt @@ -1,4 +1,4 @@ -include (${CMAKE_MODULE_PATH}/sqlite3.cmake) +include (sqlite3) if (NOT SQLITE3_FOUND) message(STATUS "sqlite3 not found, not building hsbench") return() -diff --git tools/hscollider/CMakeLists.txt tools/hscollider/CMakeLists.txt +diff --git a/tools/hscollider/CMakeLists.txt b/tools/hscollider/CMakeLists.txt index a4d71b2..f733479 100644 ---- tools/hscollider/CMakeLists.txt -+++ tools/hscollider/CMakeLists.txt +--- a/tools/hscollider/CMakeLists.txt ++++ b/tools/hscollider/CMakeLists.txt @@ -5,7 +5,7 @@ endif() include_directories(${PCRE_INCLUDE_DIRS}) diff --git a/recipes/hyperscan/all/patches/0002-use-ue2-make_unique.patch b/recipes/hyperscan/all/patches/0002-use-ue2-make_unique.patch new file mode 100644 index 00000000000000..9d4f5ee2944909 --- /dev/null +++ b/recipes/hyperscan/all/patches/0002-use-ue2-make_unique.patch @@ -0,0 +1,875 @@ +diff --git a/src/nfa/castlecompile.cpp b/src/nfa/castlecompile.cpp +index 5884ebb..1af6cd2 100644 +--- a/src/nfa/castlecompile.cpp ++++ b/src/nfa/castlecompile.cpp +@@ -281,7 +281,7 @@ vector> checkExclusion(u32 &streamStateSize, + size_t total = 0; + while (lower < trigSize) { + vector vertices; +- unique_ptr cg = make_unique(); ++ unique_ptr cg = ue2::make_unique(); + + vector> min_reset_dist; + size_t upper = min(lower + CLIQUE_GRAPH_MAX_SIZE, trigSize); +diff --git a/src/nfagraph/ng_equivalence.cpp b/src/nfagraph/ng_equivalence.cpp +index a42a0ac..9b1f072 100644 +--- a/src/nfagraph/ng_equivalence.cpp ++++ b/src/nfagraph/ng_equivalence.cpp +@@ -269,7 +269,7 @@ vector> getVertexInfos(const NGHolder &g) { + vertex_map.resize(num_verts); + + for (auto v : vertices_range(g)) { +- infos.push_back(make_unique(v, g)); ++ infos.push_back(ue2::make_unique(v, g)); + vertex_map[g[v].index] = infos.back().get(); + } + +@@ -516,7 +516,7 @@ void mergeClass(vector> &infos, NGHolder &g, + g[new_v].reports.clear(); /* populated as we pull in succs */ + + // store this vertex in our global vertex list +- infos.push_back(make_unique(new_v, g)); ++ infos.push_back(ue2::make_unique(new_v, g)); + VertexInfo *new_vertex_info = infos.back().get(); + + NFAVertex new_v_eod = NGHolder::null_vertex(); +@@ -525,7 +525,7 @@ void mergeClass(vector> &infos, NGHolder &g, + if (require_separate_eod_vertex(cur_class_vertices, g)) { + new_v_eod = clone_vertex(g, old_v); + g[new_v_eod].reports.clear(); +- infos.push_back(make_unique(new_v_eod, g)); ++ infos.push_back(ue2::make_unique(new_v_eod, g)); + new_vertex_info_eod = infos.back().get(); + } + +diff --git a/src/nfagraph/ng_violet.cpp b/src/nfagraph/ng_violet.cpp +index 78d7308..2807f2b 100644 +--- a/src/nfagraph/ng_violet.cpp ++++ b/src/nfagraph/ng_violet.cpp +@@ -375,7 +375,7 @@ void getSimpleRoseLiterals(const NGHolder &g, bool seeking_anchored, + + DEBUG_PRINTF("candidate is a candidate\n"); + scores[v] = score; +- lit_info[v] = make_unique(v, s, anchored); ++ lit_info[v] = ue2::make_unique(v, s, anchored); + } + + /* try to filter out cases where appending some characters produces worse +@@ -531,7 +531,7 @@ void getRegionRoseLiterals(const NGHolder &g, bool seeking_anchored, + } + + DEBUG_PRINTF("candidate is a candidate\n"); +- lits->push_back(make_unique(vv, s, anchored)); ++ lits->push_back(ue2::make_unique(vv, s, anchored)); + } + } + +@@ -1835,7 +1835,7 @@ static + unique_ptr make_chain(u32 count) { + assert(count); + +- auto rv = make_unique(NFA_INFIX); ++ auto rv = ue2::make_unique(NFA_INFIX); + + NGHolder &h = *rv; + +diff --git a/src/rose/rose_build_add.cpp b/src/rose/rose_build_add.cpp +index aa043fa..f680dbb 100644 +--- a/src/rose/rose_build_add.cpp ++++ b/src/rose/rose_build_add.cpp +@@ -1802,7 +1802,7 @@ bool RoseBuildImpl::addOutfix(const NGHolder &h, const raw_som_dfa &haig) { + + bool RoseBuildImpl::addOutfix(const raw_puff &rp) { + if (!mpv_outfix) { +- mpv_outfix = make_unique(MpvProto()); ++ mpv_outfix = ue2::make_unique(MpvProto()); + } + + auto *mpv = mpv_outfix->mpv(); +@@ -1827,7 +1827,7 @@ bool RoseBuildImpl::addOutfix(const raw_puff &rp) { + bool RoseBuildImpl::addChainTail(const raw_puff &rp, u32 *queue_out, + u32 *event_out) { + if (!mpv_outfix) { +- mpv_outfix = make_unique(MpvProto()); ++ mpv_outfix = ue2::make_unique(MpvProto()); + } + + auto *mpv = mpv_outfix->mpv(); +diff --git a/src/rose/rose_build_anchored.cpp b/src/rose/rose_build_anchored.cpp +index 8ea07c9..1f918bb 100644 +--- a/src/rose/rose_build_anchored.cpp ++++ b/src/rose/rose_build_anchored.cpp +@@ -249,7 +249,7 @@ unique_ptr populate_holder(const simple_anchored_info &sai, + const flat_set &exit_ids) { + DEBUG_PRINTF("populating holder for ^.{%u,%u}%s\n", sai.min_bound, + sai.max_bound, dumpString(sai.literal).c_str()); +- auto h_ptr = make_unique(); ++ auto h_ptr = ue2::make_unique(); + NGHolder &h = *h_ptr; + auto ends = addDotsToGraph(h, h.start, sai.min_bound, sai.max_bound, + CharReach::dot()); +diff --git a/src/rose/rose_build_exclusive.cpp b/src/rose/rose_build_exclusive.cpp +index 6a5a710..966c908 100644 +--- a/src/rose/rose_build_exclusive.cpp ++++ b/src/rose/rose_build_exclusive.cpp +@@ -280,7 +280,7 @@ void findCliques(const map> &exclusiveGroups, + } + // Construct the exclusivity graph + map vertex_map; +- unique_ptr cg = make_unique(); ++ unique_ptr cg = ue2::make_unique(); + + // Add vertices representing infixes/suffixes + for (const auto &e : exclusiveGroups) { +diff --git a/src/rose/rose_build_program.cpp b/src/rose/rose_build_program.cpp +index 96c95db..81d605b 100644 +--- a/src/rose/rose_build_program.cpp ++++ b/src/rose/rose_build_program.cpp +@@ -95,7 +95,7 @@ OffsetMap makeOffsetMap(const RoseProgram &program, u32 *total_len) { + } + + RoseProgram::RoseProgram() { +- prog.push_back(make_unique()); ++ prog.push_back(ue2::make_unique()); + } + + RoseProgram::~RoseProgram() = default; +@@ -297,28 +297,28 @@ void addEnginesEodProgram(u32 eodNfaIterOffset, RoseProgram &program) { + } + + RoseProgram block; +- block.add_before_end(make_unique(eodNfaIterOffset)); ++ block.add_before_end(ue2::make_unique(eodNfaIterOffset)); + program.add_block(move(block)); + } + + void addSuffixesEodProgram(RoseProgram &program) { + RoseProgram block; +- block.add_before_end(make_unique()); ++ block.add_before_end(ue2::make_unique()); + program.add_block(move(block)); + } + + void addMatcherEodProgram(RoseProgram &program) { + RoseProgram block; +- block.add_before_end(make_unique()); ++ block.add_before_end(ue2::make_unique()); + program.add_block(move(block)); + } + + void addFlushCombinationProgram(RoseProgram &program) { +- program.add_before_end(make_unique()); ++ program.add_before_end(ue2::make_unique()); + } + + void addLastFlushCombinationProgram(RoseProgram &program) { +- program.add_before_end(make_unique()); ++ program.add_before_end(ue2::make_unique()); + } + + static +@@ -342,11 +342,11 @@ void makeRoleCheckLeftfix(const RoseBuildImpl &build, + + unique_ptr ri; + if (is_prefix) { +- ri = make_unique(lni.queue, build.g[v].left.lag, ++ ri = ue2::make_unique(lni.queue, build.g[v].left.lag, + build.g[v].left.leftfix_report, + end_inst); + } else { +- ri = make_unique(lni.queue, build.g[v].left.lag, ++ ri = ue2::make_unique(lni.queue, build.g[v].left.lag, + build.g[v].left.leftfix_report, + end_inst); + } +@@ -384,7 +384,7 @@ void makeAnchoredLiteralDelay(const RoseBuildImpl &build, + u32 anch_id = prog_build.anchored_programs.at(lit_id); + + const auto *end_inst = program.end_instruction(); +- auto ri = make_unique(groups, anch_id, end_inst); ++ auto ri = ue2::make_unique(groups, anch_id, end_inst); + program.add_before_end(move(ri)); + } + +@@ -393,7 +393,7 @@ void makeDedupe(const ReportManager &rm, const Report &report, + RoseProgram &program) { + const auto *end_inst = program.end_instruction(); + auto ri = +- make_unique(report.quashSom, rm.getDkey(report), ++ ue2::make_unique(report.quashSom, rm.getDkey(report), + report.offsetAdjust, end_inst); + program.add_before_end(move(ri)); + } +@@ -402,7 +402,7 @@ static + void makeDedupeSom(const ReportManager &rm, const Report &report, + RoseProgram &program) { + const auto *end_inst = program.end_instruction(); +- auto ri = make_unique(report.quashSom, ++ auto ri = ue2::make_unique(report.quashSom, + rm.getDkey(report), + report.offsetAdjust, end_inst); + program.add_before_end(move(ri)); +@@ -428,7 +428,7 @@ void makeCatchup(const ReportManager &rm, bool needs_catchup, + return; + } + +- program.add_before_end(make_unique()); ++ program.add_before_end(ue2::make_unique()); + } + + static +@@ -511,12 +511,12 @@ void addLogicalSetRequired(const Report &report, ReportManager &rm, + return; + } + // set matching status of current lkey +- auto risl = make_unique(report.lkey, ++ auto risl = ue2::make_unique(report.lkey, + report.offsetAdjust); + program.add_before_end(move(risl)); + // set current lkey's corresponding ckeys active, pending to check + for (auto ckey : rm.getRelateCKeys(report.lkey)) { +- auto risc = make_unique(ckey); ++ auto risc = ue2::make_unique(ckey); + program.add_before_end(move(risc)); + } + } +@@ -532,7 +532,7 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + + // Handle min/max offset checks. + if (report.minOffset > 0 || report.maxOffset < MAX_OFFSET) { +- auto ri = make_unique(report.minOffset, ++ auto ri = ue2::make_unique(report.minOffset, + report.maxOffset, end_inst); + report_block.add_before_end(move(ri)); + } +@@ -540,7 +540,7 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + // If this report has an exhaustion key, we can check it in the program + // rather than waiting until we're in the callback adaptor. + if (report.ekey != INVALID_EKEY) { +- auto ri = make_unique(report.ekey, end_inst); ++ auto ri = ue2::make_unique(report.ekey, end_inst); + report_block.add_before_end(move(ri)); + } + +@@ -548,7 +548,7 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + // calculated. + if (isExternalSomReport(report) && + report.type != EXTERNAL_CALLBACK_SOM_PASS) { +- auto ri = make_unique(); ++ auto ri = ue2::make_unique(); + writeSomOperation(report, &ri->som); + report_block.add_before_end(move(ri)); + } +@@ -556,13 +556,13 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + // Min length constraint. + if (report.minLength > 0) { + assert(build.hasSom); +- auto ri = make_unique( ++ auto ri = ue2::make_unique( + report.offsetAdjust, report.minLength, end_inst); + report_block.add_before_end(move(ri)); + } + + if (report.quashSom) { +- report_block.add_before_end(make_unique()); ++ report_block.add_before_end(ue2::make_unique()); + } + + switch (report.type) { +@@ -578,7 +578,7 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + if (needs_dedupe) { + if (!report.quiet) { + report_block.add_before_end( +- make_unique( ++ ue2::make_unique( + report.quashSom, build.rm.getDkey(report), + report.onmatch, report.offsetAdjust, end_inst)); + } else { +@@ -587,7 +587,7 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + } else { + if (!report.quiet) { + report_block.add_before_end( +- make_unique( ++ ue2::make_unique( + report.onmatch, report.offsetAdjust)); + } + } +@@ -597,28 +597,28 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + } + if (!report.quiet) { + report_block.add_before_end( +- make_unique( ++ ue2::make_unique( + report.onmatch, report.offsetAdjust, report.ekey)); + } else { + report_block.add_before_end( +- make_unique(report.ekey)); ++ ue2::make_unique(report.ekey)); + } + } + } else { // has_som + makeDedupeSom(build.rm, report, report_block); + if (report.ekey == INVALID_EKEY) { + if (!report.quiet) { +- report_block.add_before_end(make_unique( ++ report_block.add_before_end(ue2::make_unique( + report.onmatch, report.offsetAdjust)); + } + } else { + if (!report.quiet) { + report_block.add_before_end( +- make_unique( ++ ue2::make_unique( + report.onmatch, report.offsetAdjust, report.ekey)); + } else { + report_block.add_before_end( +- make_unique(report.ekey)); ++ ue2::make_unique(report.ekey)); + } + } + } +@@ -639,17 +639,17 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + addFlushCombinationProgram(report_block); + } + if (has_som) { +- auto ri = make_unique(); ++ auto ri = ue2::make_unique(); + writeSomOperation(report, &ri->som); + report_block.add_before_end(move(ri)); + } else { +- auto ri = make_unique(); ++ auto ri = ue2::make_unique(); + writeSomOperation(report, &ri->som); + report_block.add_before_end(move(ri)); + } + break; + case INTERNAL_ROSE_CHAIN: { +- report_block.add_before_end(make_unique( ++ report_block.add_before_end(ue2::make_unique( + report.onmatch, report.topSquashDistance)); + break; + } +@@ -663,17 +663,17 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + makeDedupeSom(build.rm, report, report_block); + if (report.ekey == INVALID_EKEY) { + if (!report.quiet) { +- report_block.add_before_end(make_unique( ++ report_block.add_before_end(ue2::make_unique( + report.onmatch, report.offsetAdjust)); + } + } else { + if (!report.quiet) { + report_block.add_before_end( +- make_unique( ++ ue2::make_unique( + report.onmatch, report.offsetAdjust, report.ekey)); + } else { + report_block.add_before_end( +- make_unique(report.ekey)); ++ ue2::make_unique(report.ekey)); + } + } + addLogicalSetRequired(report, build.rm, report_block); +@@ -685,17 +685,17 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + makeDedupeSom(build.rm, report, report_block); + if (report.ekey == INVALID_EKEY) { + if (!report.quiet) { +- report_block.add_before_end(make_unique( ++ report_block.add_before_end(ue2::make_unique( + report.onmatch, report.offsetAdjust)); + } + } else { + if (!report.quiet) { + report_block.add_before_end( +- make_unique( ++ ue2::make_unique( + report.onmatch, report.offsetAdjust, report.ekey)); + } else { + report_block.add_before_end( +- make_unique(report.ekey)); ++ ue2::make_unique(report.ekey)); + } + } + addLogicalSetRequired(report, build.rm, report_block); +@@ -722,11 +722,11 @@ void makeRoleReports(const RoseBuildImpl &build, + assert(contains(leftfix_info, v)); + const left_build_info &lni = leftfix_info.at(v); + program.add_before_end( +- make_unique(lni.queue, g[v].left.lag)); ++ ue2::make_unique(lni.queue, g[v].left.lag)); + report_som = true; + } else if (g[v].som_adjust) { + program.add_before_end( +- make_unique(g[v].som_adjust)); ++ ue2::make_unique(g[v].som_adjust)); + report_som = true; + } + +@@ -748,7 +748,7 @@ void makeRoleSetState(const unordered_map &roleStateIndices, + if (it == end(roleStateIndices)) { + return; + } +- program.add_before_end(make_unique(it->second)); ++ program.add_before_end(ue2::make_unique(it->second)); + } + + static +@@ -772,7 +772,7 @@ void makePushDelayedInstructions(const RoseLiteralMap &literals, + }); + + for (const auto &ri : delay_instructions) { +- program.add_before_end(make_unique(ri)); ++ program.add_before_end(ue2::make_unique(ri)); + } + } + +@@ -801,10 +801,10 @@ void makeCheckLiteralInstruction(const rose_literal_id &lit, + const auto *end_inst = program.end_instruction(); + unique_ptr ri; + if (lit.s.any_nocase()) { +- ri = make_unique(lit.s.get_string(), ++ ri = ue2::make_unique(lit.s.get_string(), + end_inst); + } else { +- ri = make_unique(lit.s.get_string(), ++ ri = ue2::make_unique(lit.s.get_string(), + end_inst); + } + program.add_before_end(move(ri)); +@@ -820,10 +820,10 @@ void makeCheckLiteralInstruction(const rose_literal_id &lit, + const auto *end_inst = program.end_instruction(); + unique_ptr ri; + if (lit.s.any_nocase()) { +- ri = make_unique(lit.s.get_string(), ++ ri = ue2::make_unique(lit.s.get_string(), + end_inst); + } else { +- ri = make_unique(lit.s.get_string(), end_inst); ++ ri = ue2::make_unique(lit.s.get_string(), end_inst); + } + program.add_before_end(move(ri)); + } +@@ -840,7 +840,7 @@ void makeRoleCheckNotHandled(ProgramBuild &prog_build, RoseVertex v, + } + + const auto *end_inst = program.end_instruction(); +- auto ri = make_unique(handled_key, end_inst); ++ auto ri = ue2::make_unique(handled_key, end_inst); + program.add_before_end(move(ri)); + } + +@@ -889,7 +889,7 @@ void makeRoleCheckBounds(const RoseBuildImpl &build, RoseVertex v, + + const auto *end_inst = program.end_instruction(); + program.add_before_end( +- make_unique(min_bound, max_bound, end_inst)); ++ ue2::make_unique(min_bound, max_bound, end_inst)); + } + + static +@@ -924,7 +924,7 @@ void makeRoleGroups(const RoseGraph &g, ProgramBuild &prog_build, + return; + } + +- program.add_before_end(make_unique(groups)); ++ program.add_before_end(ue2::make_unique(groups)); + } + + static +@@ -968,7 +968,7 @@ bool makeRoleByte(const vector &look, RoseProgram &program) { + s32 checkbyte_offset = verify_s32(entry.offset); + DEBUG_PRINTF("CHECK BYTE offset=%d\n", checkbyte_offset); + const auto *end_inst = program.end_instruction(); +- auto ri = make_unique(andmask_u8, cmpmask_u8, flip, ++ auto ri = ue2::make_unique(andmask_u8, cmpmask_u8, flip, + checkbyte_offset, end_inst); + program.add_before_end(move(ri)); + return true; +@@ -1000,7 +1000,7 @@ bool makeRoleMask(const vector &look, RoseProgram &program) { + DEBUG_PRINTF("CHECK MASK and_mask=%llx cmp_mask=%llx\n", + and_mask, cmp_mask); + const auto *end_inst = program.end_instruction(); +- auto ri = make_unique(and_mask, cmp_mask, neg_mask, ++ auto ri = ue2::make_unique(and_mask, cmp_mask, neg_mask, + base_offset, end_inst); + program.add_before_end(move(ri)); + return true; +@@ -1055,7 +1055,7 @@ bool makeRoleMask32(const vector &look, + DEBUG_PRINTF("base_offset %d\n", base_offset); + + const auto *end_inst = program.end_instruction(); +- auto ri = make_unique(and_mask, cmp_mask, neg_mask, ++ auto ri = ue2::make_unique(and_mask, cmp_mask, neg_mask, + base_offset, end_inst); + program.add_before_end(move(ri)); + return true; +@@ -1098,7 +1098,7 @@ bool makeRoleMask64(const vector &look, + DEBUG_PRINTF("base_offset %d\n", base_offset); + + const auto *end_inst = program.end_instruction(); +- auto ri = make_unique(and_mask, cmp_mask, neg_mask, ++ auto ri = ue2::make_unique(and_mask, cmp_mask, neg_mask, + base_offset, end_inst); + program.add_before_end(move(ri)); + return true; +@@ -1235,7 +1235,7 @@ makeCheckShufti16x8(u32 offset_range, u8 bucket_idx, + copy(hi_mask.begin(), hi_mask.begin() + 16, nib_mask.begin() + 16); + copy(bucket_select_mask.begin(), bucket_select_mask.begin() + 16, + bucket_select_mask_16.begin()); +- return make_unique ++ return ue2::make_unique + (nib_mask, bucket_select_mask_16, + neg_mask & 0xffff, base_offset, end_inst); + } +@@ -1255,7 +1255,7 @@ makeCheckShufti32x8(u32 offset_range, u8 bucket_idx, + array lo_mask_16; + copy(hi_mask.begin(), hi_mask.begin() + 16, hi_mask_16.begin()); + copy(lo_mask.begin(), lo_mask.begin() + 16, lo_mask_16.begin()); +- return make_unique ++ return ue2::make_unique + (hi_mask_16, lo_mask_16, bucket_select_mask, + neg_mask, base_offset, end_inst); + } +@@ -1277,7 +1277,7 @@ makeCheckShufti16x16(u32 offset_range, u8 bucket_idx, + bucket_select_mask_32.begin()); + copy(bucket_select_mask_hi.begin(), bucket_select_mask_hi.begin() + 16, + bucket_select_mask_32.begin() + 16); +- return make_unique ++ return ue2::make_unique + (hi_mask, lo_mask, bucket_select_mask_32, + neg_mask & 0xffff, base_offset, end_inst); + } +@@ -1294,7 +1294,7 @@ makeCheckShufti32x16(u32 offset_range, u8 bucket_idx, + return nullptr; + } + +- return make_unique ++ return ue2::make_unique + (hi_mask, lo_mask, bucket_select_mask_hi, + bucket_select_mask_lo, neg_mask, base_offset, end_inst); + } +@@ -1321,7 +1321,7 @@ makeCheckShufti64x8(u32 offset_range, u8 bucket_idx, + copy(lo_mask.begin(), lo_mask.begin() + 16, lo_mask_64.begin() + 32); + copy(lo_mask.begin(), lo_mask.begin() + 16, lo_mask_64.begin() + 48); + +- return make_unique ++ return ue2::make_unique + (hi_mask_64, lo_mask_64, bucket_select_mask, + neg_mask, base_offset, end_inst); + } +@@ -1361,7 +1361,7 @@ makeCheckShufti64x16(u32 offset_range, u8 bucket_idx, + copy(lo_mask.begin() + 16, lo_mask.begin() + 32, lo_mask_2.begin() + 32); + copy(lo_mask.begin() + 16, lo_mask.begin() + 32, lo_mask_2.begin() + 48); + +- return make_unique ++ return ue2::make_unique + (hi_mask_1, hi_mask_2, lo_mask_1, lo_mask_2, bucket_select_mask_hi, + bucket_select_mask_lo, neg_mask, base_offset, end_inst); + } +@@ -1486,7 +1486,7 @@ void makeLookaroundInstruction(const vector &look, + if (look.size() == 1) { + s8 offset = look.begin()->offset; + const CharReach &reach = look.begin()->reach; +- auto ri = make_unique(offset, reach, ++ auto ri = ue2::make_unique(offset, reach, + program.end_instruction()); + program.add_before_end(move(ri)); + return; +@@ -1508,7 +1508,7 @@ void makeLookaroundInstruction(const vector &look, + return; + } + +- auto ri = make_unique(look, ++ auto ri = ue2::make_unique(look, + program.end_instruction()); + program.add_before_end(move(ri)); + } +@@ -1584,7 +1584,7 @@ void makeCheckLitEarlyInstruction(const RoseBuildImpl &build, u32 lit_id, + + DEBUG_PRINTF("adding lit early check, min_offset=%u\n", min_offset); + const auto *end = prog.end_instruction(); +- prog.add_before_end(make_unique(min_offset, end)); ++ prog.add_before_end(ue2::make_unique(min_offset, end)); + } + + static +@@ -1595,7 +1595,7 @@ void makeGroupCheckInstruction(const RoseBuildImpl &build, u32 lit_id, + if (!info.group_mask) { + return; + } +- prog.add_before_end(make_unique(info.group_mask)); ++ prog.add_before_end(ue2::make_unique(info.group_mask)); + } + + static +@@ -1762,7 +1762,7 @@ bool makeRoleMultipathShufti(const vector> &multi_look, + copy(begin(lo_mask), begin(lo_mask) + 16, nib_mask.begin()); + copy(begin(hi_mask), begin(hi_mask) + 16, nib_mask.begin() + 16); + +- auto ri = make_unique ++ auto ri = ue2::make_unique + (nib_mask, bucket_select_lo, data_select_mask, hi_bits_mask, + lo_bits_mask, neg_mask, base_offset, last_start, end_inst); + program.add_before_end(move(ri)); +@@ -1771,20 +1771,20 @@ bool makeRoleMultipathShufti(const vector> &multi_look, + assert(!(hi_bits_mask & ~0xffffffffULL)); + assert(!(lo_bits_mask & ~0xffffffffULL)); + if (bit_index <= 8) { +- auto ri = make_unique ++ auto ri = ue2::make_unique + (hi_mask, lo_mask, bucket_select_lo, data_select_mask, + hi_bits_mask, lo_bits_mask, neg_mask, base_offset, + last_start, end_inst); + program.add_before_end(move(ri)); + } else { +- auto ri = make_unique ++ auto ri = ue2::make_unique + (hi_mask, lo_mask, bucket_select_hi, bucket_select_lo, + data_select_mask, hi_bits_mask, lo_bits_mask, neg_mask, + base_offset, last_start, end_inst); + program.add_before_end(move(ri)); + } + } else { +- auto ri = make_unique ++ auto ri = ue2::make_unique + (hi_mask, lo_mask, bucket_select_lo, data_select_mask, + hi_bits_mask, lo_bits_mask, neg_mask, base_offset, + last_start, end_inst); +@@ -1856,7 +1856,7 @@ void makeRoleMultipathLookaround(const vector> &multi_look, + ordered_look.emplace_back(multi_entry); + } + +- auto ri = make_unique(move(ordered_look), ++ auto ri = ue2::make_unique(move(ordered_look), + last_start, start_mask, + program.end_instruction()); + program.add_before_end(move(ri)); +@@ -1932,7 +1932,7 @@ void makeRoleSuffix(const RoseBuildImpl &build, + event = MQE_TOP; + } + +- prog.add_before_end(make_unique(queue, event)); ++ prog.add_before_end(ue2::make_unique(queue, event)); + } + + static +@@ -1945,7 +1945,7 @@ void addInfixTriggerInstructions(vector triggers, + }); + for (const auto &ti : triggers) { + prog.add_before_end( +- make_unique(ti.cancel, ti.queue, ti.event)); ++ ue2::make_unique(ti.cancel, ti.queue, ti.event)); + } + } + +@@ -2039,7 +2039,7 @@ static + void addCheckOnlyEodInstruction(RoseProgram &prog) { + DEBUG_PRINTF("only at eod\n"); + const auto *end_inst = prog.end_instruction(); +- prog.add_before_end(make_unique(end_inst)); ++ prog.add_before_end(ue2::make_unique(end_inst)); + } + + static +@@ -2164,7 +2164,7 @@ void makeGroupSquashInstruction(const RoseBuildImpl &build, u32 lit_id, + DEBUG_PRINTF("squashes 0x%llx\n", info.group_mask); + assert(info.group_mask); + /* Note: group_mask is negated. */ +- prog.add_before_end(make_unique(~info.group_mask)); ++ prog.add_before_end(ue2::make_unique(~info.group_mask)); + } + + namespace { +@@ -2209,7 +2209,7 @@ RoseProgram assembleProgramBlocks(vector &&blocks_in) { + * only set if a state has been. */ + if (!prog.empty() && reads_work_done_flag(block)) { + RoseProgram clear_block; +- clear_block.add_before_end(make_unique()); ++ clear_block.add_before_end(ue2::make_unique()); + prog.add_block(move(clear_block)); + } + +@@ -2369,7 +2369,7 @@ void makeCatchupMpv(const ReportManager &rm, bool needs_mpv_catchup, + return; + } + +- program.add_before_end(make_unique()); ++ program.add_before_end(ue2::make_unique()); + } + + RoseProgram makeReportProgram(const RoseBuildImpl &build, +@@ -2402,7 +2402,7 @@ RoseProgram makeBoundaryProgram(const RoseBuildImpl &build, + void addIncludedJumpProgram(RoseProgram &program, u32 child_offset, + u8 squash) { + RoseProgram block; +- block.add_before_end(make_unique(child_offset, ++ block.add_before_end(ue2::make_unique(child_offset, + squash)); + program.add_block(move(block)); + } +@@ -2413,7 +2413,7 @@ void addPredBlockSingle(u32 pred_state, RoseProgram &pred_block, + // Prepend an instruction to check the pred state is on. + const auto *end_inst = pred_block.end_instruction(); + pred_block.insert(begin(pred_block), +- make_unique(pred_state, end_inst)); ++ ue2::make_unique(pred_state, end_inst)); + program.add_block(move(pred_block)); + } + +@@ -2428,7 +2428,7 @@ void addPredBlocksAny(map &pred_blocks, u32 num_states, + } + + const RoseInstruction *end_inst = sparse_program.end_instruction(); +- auto ri = make_unique(num_states, keys, end_inst); ++ auto ri = ue2::make_unique(num_states, keys, end_inst); + sparse_program.add_before_end(move(ri)); + + RoseProgram &block = pred_blocks.begin()->second; +@@ -2451,14 +2451,14 @@ void addPredBlocksMulti(map &pred_blocks, + vector> jump_table; + + // BEGIN instruction. +- auto ri_begin = make_unique(num_states, end_inst); ++ auto ri_begin = ue2::make_unique(num_states, end_inst); + RoseInstrSparseIterBegin *begin_inst = ri_begin.get(); + sparse_program.add_before_end(move(ri_begin)); + + // NEXT instructions, one per pred program. + u32 prev_key = pred_blocks.begin()->first; + for (auto it = next(begin(pred_blocks)); it != end(pred_blocks); ++it) { +- auto ri = make_unique(prev_key, begin_inst, ++ auto ri = ue2::make_unique(prev_key, begin_inst, + end_inst); + sparse_program.add_before_end(move(ri)); + prev_key = it->first; +@@ -2539,7 +2539,7 @@ void applyFinalSpecialisation(RoseProgram &program) { + auto it = next(program.rbegin()); + if (auto *ri = dynamic_cast(it->get())) { + DEBUG_PRINTF("replacing REPORT with FINAL_REPORT\n"); +- program.replace(it, make_unique( ++ program.replace(it, ue2::make_unique( + ri->onmatch, ri->offset_adjust)); + } + } +diff --git a/src/rose/rose_in_util.cpp b/src/rose/rose_in_util.cpp +index 9fe47c2..6fa56d1 100644 +--- a/src/rose/rose_in_util.cpp ++++ b/src/rose/rose_in_util.cpp +@@ -93,7 +93,7 @@ private: + + unique_ptr cloneRoseGraph(const RoseInGraph &ig) { + assert(hasCorrectlyNumberedVertices(ig)); +- unique_ptr out = make_unique(); ++ unique_ptr out = ue2::make_unique(); + + unordered_map> graph_map; + unordered_map> haig_map; +diff --git a/src/smallwrite/smallwrite_build.cpp b/src/smallwrite/smallwrite_build.cpp +index 4eb4801..6acdf3c 100644 +--- a/src/smallwrite/smallwrite_build.cpp ++++ b/src/smallwrite/smallwrite_build.cpp +@@ -680,7 +680,7 @@ unique_ptr buildDfa(LitTrie &trie, bool nocase) { + // Construct DFA states in BFS order. + const auto state_ids = makeStateMap(trie, ordering); + +- auto rdfa = make_unique(NFA_OUTFIX); ++ auto rdfa = ue2::make_unique(NFA_OUTFIX); + + // Calculate alphabet. + array unalpha; +diff --git a/tools/hsbench/main.cpp b/tools/hsbench/main.cpp +index 1c91813..4ec793e 100644 +--- a/tools/hsbench/main.cpp ++++ b/tools/hsbench/main.cpp +@@ -1038,7 +1038,7 @@ void runBenchmark(const Engine &db, + int HS_CDECL main(int argc, char *argv[]) { + unique_ptr grey; + #if !defined(RELEASE_BUILD) +- grey = make_unique(); ++ grey = ue2::make_unique(); + #endif + setlocale(LC_ALL, ""); // use the user's locale + +diff --git a/tools/hscheck/main.cpp b/tools/hscheck/main.cpp +index 197087b..bdecab8 100644 +--- a/tools/hscheck/main.cpp ++++ b/tools/hscheck/main.cpp +@@ -664,7 +664,7 @@ int HS_CDECL main(int argc, char **argv) { + num_of_threads = max(1u, std::thread::hardware_concurrency()); + + #if !defined(RELEASE_BUILD) +- g_grey = make_unique(); ++ g_grey = ue2::make_unique(); + #endif + processArgs(argc, argv, g_grey); + +diff --git a/tools/hscollider/GraphTruth.cpp b/tools/hscollider/GraphTruth.cpp +index 0b67b11..e43beb1 100644 +--- a/tools/hscollider/GraphTruth.cpp ++++ b/tools/hscollider/GraphTruth.cpp +@@ -134,7 +134,7 @@ void CNGInfo::compile() { + auto pl = ue2::make_unique(); + pl->parseLogicalCombination(id, re.c_str(), ~0U, 0, ~0ULL); + pl->logicalKeyRenumber(); +- cng = make_unique(move(pl)); ++ cng = ue2::make_unique(move(pl)); + return; + } + +@@ -193,7 +193,7 @@ void CNGInfo::compile() { + } + } + +- cng = make_unique(move(g), move(rm)); ++ cng = ue2::make_unique(move(g), move(rm)); + } catch (CompileError &e) { + throw NGCompileFailure(e.reason); + } catch (NGUnsupportedFailure &e) { +@@ -257,7 +257,7 @@ unique_ptr GraphTruth::preprocess(unsigned id, + } + } + +- auto cngi = make_unique(id, m_expr); ++ auto cngi = ue2::make_unique(id, m_expr); + cngi->utf8 = hs_flags & HS_FLAG_UTF8; + cngi->highlander = highlander; + cngi->prefilter = prefilter; +diff --git a/tools/hscollider/GroundTruth.cpp b/tools/hscollider/GroundTruth.cpp +index a267306..d9293dc 100644 +--- a/tools/hscollider/GroundTruth.cpp ++++ b/tools/hscollider/GroundTruth.cpp +@@ -331,7 +331,7 @@ GroundTruth::compile(unsigned id, bool no_callouts) { + int errloc = 0; + int errcode = 0; + +- unique_ptr compiled = make_unique(); ++ unique_ptr compiled = ue2::make_unique(); + compiled->utf8 = flags & PCRE_UTF8; + compiled->highlander = highlander; + compiled->prefilter = prefilter; +diff --git a/tools/hscollider/main.cpp b/tools/hscollider/main.cpp +index afa6ef5..c85526e 100644 +--- a/tools/hscollider/main.cpp ++++ b/tools/hscollider/main.cpp +@@ -1606,7 +1606,7 @@ void generateTests(CorporaSource &corpora_src, const ExpressionMap &exprMap, + max_generator_queue_len); + vector> generators; + for (size_t i = 0; i < numGeneratorThreads; i++) { +- auto c = make_unique(i, testq, corpq, corpora_src); ++ auto c = ue2::make_unique(i, testq, corpq, corpora_src); + c->start(); + generators.push_back(move(c)); + } +diff --git a/util/ng_corpus_generator.cpp b/util/ng_corpus_generator.cpp +index e5e8e06..2e0080a 100644 +--- a/util/ng_corpus_generator.cpp ++++ b/util/ng_corpus_generator.cpp +@@ -200,7 +200,7 @@ void findPaths(const NGHolder &g, CorpusProperties &cProps, + if (boost::next(ai) == ae) { + new_path = std::move(p); + } else { +- new_path = make_unique(*p); ++ new_path = ue2::make_unique(*p); + } + + new_path->push_back(v); diff --git a/recipes/hyperscan/all/test_package/CMakeLists.txt b/recipes/hyperscan/all/test_package/CMakeLists.txt index 0e579ae32cbada..8cfec33c7dfff6 100644 --- a/recipes/hyperscan/all/test_package/CMakeLists.txt +++ b/recipes/hyperscan/all/test_package/CMakeLists.txt @@ -1,16 +1,15 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(hyperscan COMPONENTS hs REQUIRED) + add_executable(hs_example hs_example.cpp) target_link_libraries(hs_example PRIVATE hyperscan::hs) +target_compile_features(hs_example PRIVATE cxx_std_11) if(BUILD_CHIMERA) find_package(hyperscan COMPONENTS chimera REQUIRED) add_executable(ch_example ch_example.cpp) target_link_libraries(ch_example PRIVATE hyperscan::chimera) + target_compile_features(ch_example PRIVATE cxx_std_11) endif() - diff --git a/recipes/hyperscan/all/test_package/conanfile.py b/recipes/hyperscan/all/test_package/conanfile.py index 5ce555b9552f06..e299e5dd32f1b8 100644 --- a/recipes/hyperscan/all/test_package/conanfile.py +++ b/recipes/hyperscan/all/test_package/conanfile.py @@ -1,25 +1,40 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv import os -from conans import ConanFile, CMake, tools -from conan.tools.build import cross_building +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + test_type = "explicit" + def requirements(self): + self.requires(self.tested_reference_str) -class HyperscanTestConan(ConanFile): - settings = "os", "build_type", "arch", "compiler" - generators = "cmake", "cmake_find_package" + def layout(self): + cmake_layout(self) + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_CHIMERA"] = self.options["hyperscan"].build_chimera + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + venv = VirtualBuildEnv(self) + venv.generate(scope="build") def build(self): cmake = CMake(self) - cmake.definitions["BUILD_CHIMERA"] = self.options["hyperscan"].build_chimera cmake.configure() cmake.build() def test(self): - if not cross_building(self): - bin_path = os.path.join("bin", "hs_example") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "hs_example") self.run(bin_path, run_environment=True) if self.options["hyperscan"].build_chimera: - bin_path = os.path.join("bin", "ch_example") + bin_path = os.path.join(self.cpp.build.bindirs[0], "ch_example") self.run(bin_path, run_environment=True) diff --git a/recipes/hyperscan/all/test_v1_package/CMakeLists.txt b/recipes/hyperscan/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/hyperscan/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/hyperscan/all/test_v1_package/conanfile.py b/recipes/hyperscan/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..cb26b3fe155907 --- /dev/null +++ b/recipes/hyperscan/all/test_v1_package/conanfile.py @@ -0,0 +1,23 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["BUILD_CHIMERA"] = self.options["hyperscan"].build_chimera + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "hs_example") + self.run(bin_path, run_environment=True) + + if self.options["hyperscan"].build_chimera: + bin_path = os.path.join("bin", "ch_example") + self.run(bin_path, run_environment=True) diff --git a/recipes/icu/all/conanfile.py b/recipes/icu/all/conanfile.py index 2f39693a0f674d..96bfccb5a01650 100644 --- a/recipes/icu/all/conanfile.py +++ b/recipes/icu/all/conanfile.py @@ -119,6 +119,11 @@ def generate(self): if cross_building(self): base_path = unix_path(self, self.dependencies.build["icu"].package_folder) tc.configure_args.append(f"--with-cross-build={base_path}") + if (not is_msvc(self)): + # --with-cross-build above prevents tc.generate() from setting --build option. + # Workaround for https://github.com/conan-io/conan/issues/12642 + gnu_triplet = get_gnu_triplet(str(self._settings_build.os), str(self._settings_build.arch), str(self.settings.compiler)) + tc.configure_args.append(f"--build={gnu_triplet}") if self.settings.os in ["iOS", "tvOS", "watchOS"]: gnu_triplet = get_gnu_triplet("Macos", str(self.settings.arch)) tc.configure_args.append(f"--host={gnu_triplet}") diff --git a/recipes/imath/all/conandata.yml b/recipes/imath/all/conandata.yml index 406c04912aa650..c74e535dae312d 100644 --- a/recipes/imath/all/conandata.yml +++ b/recipes/imath/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.1.6": + url: "https://github.com/AcademySoftwareFoundation/Imath/archive/v3.1.6.tar.gz" + sha256: "ea5592230f5ab917bea3ceab266cf38eb4aa4a523078d46eac0f5a89c52304db" "3.1.5": url: "https://github.com/AcademySoftwareFoundation/Imath/archive/refs/tags/v3.1.5.tar.gz" sha256: "1e9c7c94797cf7b7e61908aed1f80a331088cc7d8873318f70376e4aed5f25fb" diff --git a/recipes/imath/config.yml b/recipes/imath/config.yml index 93cee5ea459a06..566850eaffa71c 100644 --- a/recipes/imath/config.yml +++ b/recipes/imath/config.yml @@ -1,4 +1,6 @@ versions: + "3.1.6": + folder: all "3.1.5": folder: all "3.1.4": diff --git a/recipes/imgui/all/conandata.yml b/recipes/imgui/all/conandata.yml index 9ed281a0bbcaf8..4ad544bfd412c9 100644 --- a/recipes/imgui/all/conandata.yml +++ b/recipes/imgui/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.89.2": + url: "https://github.com/ocornut/imgui/archive/v1.89.2.tar.gz" + sha256: "e110beffda505e6954feb7b13541d35a7c12a176b9723290c853684713df6a67" "1.89.1": url: "https://github.com/ocornut/imgui/archive/v1.89.1.tar.gz" sha256: "6d02a0079514d869e4b5f8f590f9060259385fcddd93a07ef21298b6a9610cbd" diff --git a/recipes/imgui/config.yml b/recipes/imgui/config.yml index 876df7dac77899..c809f19e5ffedd 100644 --- a/recipes/imgui/config.yml +++ b/recipes/imgui/config.yml @@ -1,4 +1,6 @@ versions: + "1.89.2": + folder: all "1.89.1": folder: all "1.88": diff --git a/recipes/itlib/all/conandata.yml b/recipes/itlib/all/conandata.yml index 75c51a069dcdcf..7baad7835ef3db 100644 --- a/recipes/itlib/all/conandata.yml +++ b/recipes/itlib/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "1.8.1": + url: "https://github.com/iboB/itlib/archive/v1.8.1.tar.gz" + sha256: "7a8619073d0bbd5a5cea0ee9bb1b3b749348cbab1d12e4e0c234215f26388aef" + "1.8.0": + url: "https://github.com/iboB/itlib/archive/v1.8.0.tar.gz" + sha256: "70b6493b0cc3a720ffd48e98e3f009e8d94003380800bf07e61f167e813a9add" + "1.7.0": + url: "https://github.com/iboB/itlib/archive/v1.7.0.tar.gz" + sha256: "9a27138cfa8554eb69436bb1afacfafc5a3888b6e05f9124b2d20da7ab55b723" "1.6.3": url: "https://github.com/iboB/itlib/archive/v1.6.3.tar.gz" sha256: "d2e320d9218269c421407d6df819ca0bfae3ea5bc897b341b9babaedc0b7103f" diff --git a/recipes/itlib/all/conanfile.py b/recipes/itlib/all/conanfile.py index 5176ae5632fc2a..bb31e9b71bfa0c 100644 --- a/recipes/itlib/all/conanfile.py +++ b/recipes/itlib/all/conanfile.py @@ -41,6 +41,4 @@ def package(self): def package_info(self): self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] diff --git a/recipes/itlib/all/test_package/CMakeLists.txt b/recipes/itlib/all/test_package/CMakeLists.txt index 31ab408f84cc73..11bad027c5a7e4 100644 --- a/recipes/itlib/all/test_package/CMakeLists.txt +++ b/recipes/itlib/all/test_package/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package LANGUAGES CXX) find_package(itlib REQUIRED CONFIG) diff --git a/recipes/itlib/all/test_v1_package/CMakeLists.txt b/recipes/itlib/all/test_v1_package/CMakeLists.txt index dd166aa657f7df..bc541ea90b5128 100644 --- a/recipes/itlib/all/test_v1_package/CMakeLists.txt +++ b/recipes/itlib/all/test_v1_package/CMakeLists.txt @@ -1,12 +1,9 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(itlib REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE itlib::itlib) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/itlib/config.yml b/recipes/itlib/config.yml index da2c4537319ae5..4399ebe9b5da56 100644 --- a/recipes/itlib/config.yml +++ b/recipes/itlib/config.yml @@ -1,4 +1,10 @@ versions: + "1.8.1": + folder: all + "1.8.0": + folder: all + "1.7.0": + folder: all "1.6.3": folder: all "1.6.1": diff --git a/recipes/jasper/all/CMakeLists.txt b/recipes/jasper/all/CMakeLists.txt deleted file mode 100644 index daed229fb32e0b..00000000000000 --- a/recipes/jasper/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -set(CMAKE_MODULE_PATH ${CONAN_CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/source_subfolder/build/cmake/modules ${CMAKE_MODULE_PATH}) - -add_subdirectory(source_subfolder) diff --git a/recipes/jasper/all/conandata.yml b/recipes/jasper/all/conandata.yml index 6867be26271524..b08601c042de06 100644 --- a/recipes/jasper/all/conandata.yml +++ b/recipes/jasper/all/conandata.yml @@ -1,47 +1,41 @@ sources: + "4.0.0": + url: "https://github.com/jasper-software/jasper/releases/download/version-4.0.0/jasper-4.0.0.tar.gz" + sha256: "39514e1b53a5333fcff817e19565371f016ea536c36fd2d13a9c4d8da8f0be0c" + "3.0.6": + url: "https://github.com/jasper-software/jasper/archive/refs/tags/version-3.0.6.tar.gz" + sha256: "c79961bc00158f5b5dc5f5fcfa792fde9bebb024432689d0f9e3f95a097d0ec3" "2.0.33": url: "https://github.com/jasper-software/jasper/archive/refs/tags/version-2.0.33.tar.gz" sha256: "38b8f74565ee9e7fec44657e69adb5c9b2a966ca5947ced5717cde18a7d2eca6" - "2.0.32": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.32.tar.gz" - sha256: "a3583a06698a6d6106f2fc413aa42d65d86bedf9a988d60e5cfa38bf72bc64b9" - "2.0.28": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.28.tar.gz" - sha256: "6b4e5f682be0ab1a5acb0eeb6bf41d6ce17a658bb8e2dbda95de40100939cc88" - "2.0.27": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.27.tar.gz" - sha256: "df41bd015a9dd0cc2a2e696f8ca5cbfb633323ca9429621f7fa801778681f2dd" - "2.0.26": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.26.tar.gz" - sha256: "a82a119e85b7d1f448e61309777fa5f79053a9adca4a2b5bfe44be5439fb8fea" - "2.0.25": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.25.tar.gz" - sha256: "f5bc48e2884bcabd2aca1737baff4ca962ec665b6eb673966ced1f7adea07edb" - "2.0.24": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.24.tar.gz" - sha256: "d2d28e115968d38499163cf8086179503668ce0d71b90dd33855b3de96a1ca1d" - "2.0.23": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.23.tar.gz" - sha256: "20facc904bd9d38c20e0c090b1be3ae02ae5b2703b803013be2ecad586a18927" - "2.0.22": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.22.tar.gz" - sha256: "afc4166bff29b8a0dc46ed5e8d6a208d7976fccfd0b1146e3400c8b2948794a2" - "2.0.21": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.21.tar.gz" - sha256: "2482def06dfaa33b8d93cbe992a29723309f3c2b6e75674423a52fc82be10418" - "2.0.19": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.19.tar.gz" - sha256: "b9d16162a088617ada36450f2374d72165377cb64b33ed197c200bcfb73ec76c" - "2.0.16": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.16.tar.gz" - sha256: "f1d8b90f231184d99968f361884e2054a1714fdbbd9944ba1ae4ebdcc9bbfdb1" - "2.0.14": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.14.tar.gz" - sha256: "85266eea728f8b14365db9eaf1edc7be4c348704e562bb05095b9a077cf1a97b" patches: - "2.0.16": - - patch_file: "patches/fix-exported-symbols.patch" - base_path: "source_subfolder" - "2.0.14": - - patch_file: "patches/fix-exported-symbols.patch" - base_path: "source_subfolder" + "4.0.0": + - patch_file: "patches/4.0.0-0001-skip-rpath.patch" + patch_description: "Do not enforce rpath configuration" + patch_source: "https://github.com/jasper-software/jasper/pull/347" + patch_type: "conan" + - patch_file: "patches/4.0.0-0002-find-libjpeg.patch" + patch_description: "check_c_source_compilers does not work with conan gens. See https://github.com/conan-io/conan/issues/12180" + patch_type: "conan" + - patch_file: "patches/4.0.0-0003-deterministic-libname.patch" + patch_description: "No generator dependent libname" + patch_type: "conan" + "3.0.6": + - patch_file: "patches/3.0.6-0001-skip-rpath.patch" + patch_description: "Do not enforce rpath configuration" + patch_source: "https://github.com/jasper-software/jasper/pull/347" + patch_type: "conan" + - patch_file: "patches/3.0.6-0002-find-libjpeg.patch" + patch_description: "check_c_source_compilers does not work with conan gens. See https://github.com/conan-io/conan/issues/12180" + patch_type: "conan" + - patch_file: "patches/3.0.6-0003-deterministic-libname.patch" + patch_description: "No generator dependent libname" + patch_type: "conan" + "2.0.33": + - patch_file: "patches/2.0.33-0001-skip-rpath.patch" + patch_description: "Do not enforce rpath configuration" + patch_source: "https://github.com/jasper-software/jasper/pull/347" + patch_type: "conan" + - patch_file: "patches/2.0.33-0002-find-libjpeg.patch" + patch_description: "check_c_source_compilers does not work with conan gens. See https://github.com/conan-io/conan/issues/12180" + patch_type: "conan" diff --git a/recipes/jasper/all/conanfile.py b/recipes/jasper/all/conanfile.py index 796bf127244db9..9893cd476a58fd 100644 --- a/recipes/jasper/all/conanfile.py +++ b/recipes/jasper/all/conanfile.py @@ -1,8 +1,9 @@ -from conans import CMake from conan import ConanFile -from conan.tools.files import get, save, rmdir, rm, replace_in_file, apply_conandata_patches, export_conandata_patches +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir, save +from conan.tools.microsoft import is_msvc from conan.tools.scm import Version -from conan.errors import ConanInvalidConfiguration import os import textwrap @@ -14,14 +15,13 @@ class JasperConan(ConanFile): license = "JasPer-2.0" homepage = "https://jasper-software.github.io/jasper" url = "https://github.com/conan-io/conan-center-index" - topics = ("tool-kit", "coding") + topics = ("toolkit", "coding", "jpeg", "images") description = "JasPer Image Processing/Coding Tool Kit" - settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "with_libjpeg": ["libjpeg", "libjpeg-turbo"], + "with_libjpeg": [False, "libjpeg", "libjpeg-turbo", "mozjpeg"], } default_options = { "shared": False, @@ -29,19 +29,7 @@ class JasperConan(ConanFile): "with_libjpeg": "libjpeg", } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") export_conandata_patches(self) def config_options(self): @@ -49,72 +37,77 @@ def config_options(self): del self.options.fPIC def configure(self): - if self.options.shared: - self.options.rm_safe("fPIC") self.settings.rm_safe("compiler.cppstd") self.settings.rm_safe("compiler.libcxx") + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - if self.options.with_libjpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.2") - elif self.options.with_libjpeg == "libjpeg": + if self.options.with_libjpeg == "libjpeg": self.requires("libjpeg/9e") - - def validate(self): - if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) == "16": - raise ConanInvalidConfiguration(f"{self.name} Current can not build in CCI due to windows SDK version. See https://github.com/conan-io/conan-center-index/pull/13285 for the solution hopefully") + elif self.options.with_libjpeg == "libjpeg-turbo": + self.requires("libjpeg-turbo/2.1.4") + elif self.options.with_libjpeg == "mozjpeg": + self.requires("mozjpeg/4.1.1") def source(self): get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["JAS_ENABLE_DOC"] = False - self._cmake.definitions["JAS_ENABLE_PROGRAMS"] = False - self._cmake.definitions["JAS_ENABLE_SHARED"] = self.options.shared - self._cmake.definitions["JAS_LIBJPEG_REQUIRED"] = "REQUIRED" - self._cmake.definitions["JAS_ENABLE_OPENGL"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - - def _patch_sources(self): - apply_conandata_patches(self) - # Clean rpath in installed shared lib - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") - cmds_to_remove = [ - "set(CMAKE_INSTALL_RPATH \"${CMAKE_INSTALL_PREFIX}/lib\")", - "set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)", - "set(CMAKE_INSTALL_RPATH\n \"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\")", - ] - for cmd_to_remove in cmds_to_remove: - replace_in_file(self, cmakelists, cmd_to_remove, "") + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + if Version(self.version) >= "4.0.0": + tc.variables["JAS_ENABLE_PIC"] = self.options.get_safe("fPIC", True) + tc.variables["JAS_ENABLE_DOC"] = False + tc.variables["JAS_ENABLE_LATEX"] = False + tc.variables["JAS_ENABLE_PROGRAMS"] = False + tc.variables["JAS_ENABLE_SHARED"] = self.options.shared + tc.variables["JAS_LIBJPEG_REQUIRED"] = "REQUIRED" + tc.variables["JAS_ENABLE_LIBJPEG"] = bool(self.options.with_libjpeg) + if Version(self.version) >= "3.0.0": + tc.variables["JAS_ENABLE_LIBHEIF"] = False + tc.variables["JAS_ENABLE_OPENGL"] = False + + if cross_building(self): + tc.cache_variables["JAS_CROSSCOMPILING"] = True + tc.cache_variables["JAS_STDC_VERSION"] = "199901L" + + # TODO: Remove after fixing https://github.com/conan-io/conan-center-index/issues/13159 + # C3I workaround to force CMake to choose the highest version of + # the windows SDK available in the system + if is_msvc(self) and not self.conf.get("tools.cmake.cmaketoolchain:system_version"): + tc.variables["CMAKE_SYSTEM_VERSION"] = "10.0" + + tc.generate() + + cmakedeps = CMakeDeps(self) + cmakedeps.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", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "COPYRIGHT*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "share")) rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) if self.settings.os == "Windows": for dll_prefix in ["concrt", "msvcp", "vcruntime"]: rm(self, f"{dll_prefix}*.dll", os.path.join(self.package_folder, "bin")) - self._create_cmake_module_variables( - os.path.join(self.package_folder, self._module_file_rel_path) - ) + self._create_cmake_module_variables(os.path.join(self.package_folder, self._module_file_rel_path)) + # FIXME: Missing CMake alias variables. See https://github.com/conan-io/conan/issues/7691 def _create_cmake_module_variables(self, module_file): content = textwrap.dedent("""\ - if(DEFINED Jasper_FOUND) - set(JASPER_FOUND ${Jasper_FOUND}) - endif() + set(JASPER_FOUND TRUE) if(DEFINED Jasper_INCLUDE_DIR) set(JASPER_INCLUDE_DIR ${Jasper_INCLUDE_DIR}) endif() @@ -129,7 +122,7 @@ def _create_cmake_module_variables(self, module_file): @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-variables.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") @@ -137,11 +130,18 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "Jasper::Jasper") self.cpp_info.set_property("cmake_build_modules", [self._module_file_rel_path]) self.cpp_info.set_property("pkg_config_name", "jasper") - + self.cpp_info.libs = ["jasper"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread"]) + self.cpp_info.requires = [] + if self.options.with_libjpeg == "libjpeg": + self.cpp_info.requires.append("libjpeg::libjpeg") + elif self.options.with_libjpeg == "libjpeg-turbo": + self.cpp_info.requires.append("libjpeg-turbo::jpeg") + elif self.options.with_libjpeg == "mozjpeg": + self.cpp_info.requires.append("mozjpeg::libjpeg") + + # TODO: to remove in conan v2 self.cpp_info.names["cmake_find_package"] = "Jasper" self.cpp_info.names["cmake_find_package_multi"] = "Jasper" self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] - - self.cpp_info.libs = ["jasper"] - if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.append("m") diff --git a/recipes/jasper/all/patches/2.0.33-0001-skip-rpath.patch b/recipes/jasper/all/patches/2.0.33-0001-skip-rpath.patch new file mode 100644 index 00000000000000..eb9d47cbbb0146 --- /dev/null +++ b/recipes/jasper/all/patches/2.0.33-0001-skip-rpath.patch @@ -0,0 +1,24 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 230d88c..79081c2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -298,19 +298,15 @@ if (JAS_ENABLE_SHARED) + # (but later on when installing) + set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) + +- set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + + # add the automatically determined parts of the RPATH + # which point to directories outside the build tree to the install RPATH +- set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + + # The RPATH to be used when installing, but only if it's not a + # system directory + list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) + if("${isSystemDir}" STREQUAL "-1") +- set(CMAKE_INSTALL_RPATH +- "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + endif("${isSystemDir}" STREQUAL "-1") + + endif() diff --git a/recipes/jasper/all/patches/2.0.33-0002-find-libjpeg.patch b/recipes/jasper/all/patches/2.0.33-0002-find-libjpeg.patch new file mode 100644 index 00000000000000..e95e0295493590 --- /dev/null +++ b/recipes/jasper/all/patches/2.0.33-0002-find-libjpeg.patch @@ -0,0 +1,18 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 79081c2..38b6238 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -244,12 +244,7 @@ if (JAS_ENABLE_LIBJPEG AND JPEG_FOUND) + # (e.g., stdio.h and stdint.h). So, we cannot reliably use + # check_include_file here. + set(CMAKE_REQUIRED_INCLUDES ${JPEG_INCLUDE_DIR}) +- check_c_source_compiles(" +- #include +- #include +- #include +- int main() {} +- " JAS_HAVE_JPEGLIB_H) ++ set(JAS_HAVE_JPEGLIB_H 1) + if(JAS_HAVE_JPEGLIB_H) + set(JAS_HAVE_LIBJPEG 1) + include_directories(${JPEG_INCLUDE_DIR}) diff --git a/recipes/jasper/all/patches/3.0.6-0001-skip-rpath.patch b/recipes/jasper/all/patches/3.0.6-0001-skip-rpath.patch new file mode 100644 index 00000000000000..959d169bd49add --- /dev/null +++ b/recipes/jasper/all/patches/3.0.6-0001-skip-rpath.patch @@ -0,0 +1,24 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5cf594c..a0d253d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -740,19 +740,15 @@ if(JAS_ENABLE_SHARED) + # (but later on when installing) + set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) + +- set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + + # add the automatically determined parts of the RPATH + # which point to directories outside the build tree to the install RPATH +- set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + + # The RPATH to be used when installing, but only if it's not a + # system directory + list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) + if(isSystemDir EQUAL -1) +- set(CMAKE_INSTALL_RPATH +- "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + endif() + endif() + diff --git a/recipes/jasper/all/patches/3.0.6-0002-find-libjpeg.patch b/recipes/jasper/all/patches/3.0.6-0002-find-libjpeg.patch new file mode 100644 index 00000000000000..47a8350d738d49 --- /dev/null +++ b/recipes/jasper/all/patches/3.0.6-0002-find-libjpeg.patch @@ -0,0 +1,18 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a0d253d..19518af 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -680,12 +680,7 @@ if(JAS_ENABLE_LIBJPEG) + # (e.g., stdio.h and stdint.h). So, we cannot reliably use + # check_include_file here. + jas_get_includes_from_targets(CMAKE_REQUIRED_INCLUDES JPEG::JPEG) +- check_c_source_compiles(" +- #include +- #include +- #include +- int main() {} +- " JAS_HAVE_JPEGLIB_H) ++ set(JAS_HAVE_JPEGLIB_H 1) + if(JAS_HAVE_JPEGLIB_H) + set(JAS_HAVE_LIBJPEG 1) + set(JAS_LIBJPEG_TARGET JPEG::JPEG) diff --git a/recipes/jasper/all/patches/3.0.6-0003-deterministic-libname.patch b/recipes/jasper/all/patches/3.0.6-0003-deterministic-libname.patch new file mode 100644 index 00000000000000..567ff16e021a49 --- /dev/null +++ b/recipes/jasper/all/patches/3.0.6-0003-deterministic-libname.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -254,7 +254,7 @@ endif() + # If a multiconfiguration generator is used, ensure that various output + # files are not placed in subdirectories (such as Debug and Release) + # as this will cause the CTest test suite to fail. +-if(JAS_MULTICONFIGURATION_GENERATOR) ++if(0) + if(CMAKE_CONFIGURATION_TYPES) + set(CMAKE_DEBUG_POSTFIX d) + endif() diff --git a/recipes/jasper/all/patches/4.0.0-0001-skip-rpath.patch b/recipes/jasper/all/patches/4.0.0-0001-skip-rpath.patch new file mode 100644 index 00000000000000..4be85edcc1149d --- /dev/null +++ b/recipes/jasper/all/patches/4.0.0-0001-skip-rpath.patch @@ -0,0 +1,22 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -793,19 +793,15 @@ if(JAS_ENABLE_SHARED) + # (but later on when installing) + set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) + +- set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + + # add the automatically determined parts of the RPATH + # which point to directories outside the build tree to the install RPATH +- set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + + # The RPATH to be used when installing, but only if it's not a + # system directory + list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) + if(isSystemDir EQUAL -1) +- set(CMAKE_INSTALL_RPATH +- "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + endif() + endif() + diff --git a/recipes/jasper/all/patches/4.0.0-0002-find-libjpeg.patch b/recipes/jasper/all/patches/4.0.0-0002-find-libjpeg.patch new file mode 100644 index 00000000000000..b98de65fb7adfb --- /dev/null +++ b/recipes/jasper/all/patches/4.0.0-0002-find-libjpeg.patch @@ -0,0 +1,16 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -731,12 +731,7 @@ if(JAS_ENABLE_LIBJPEG) + # (e.g., stdio.h and stdint.h). So, we cannot reliably use + # check_include_file here. + jas_get_includes_from_targets(CMAKE_REQUIRED_INCLUDES JPEG::JPEG) +- check_c_source_compiles(" +- #include +- #include +- #include +- int main() {} +- " JAS_HAVE_JPEGLIB_H) ++ set(JAS_HAVE_JPEGLIB_H 1) + if(JAS_HAVE_JPEGLIB_H) + set(JAS_HAVE_LIBJPEG 1) + set(JAS_LIBJPEG_TARGET JPEG::JPEG) diff --git a/recipes/jasper/all/patches/4.0.0-0003-deterministic-libname.patch b/recipes/jasper/all/patches/4.0.0-0003-deterministic-libname.patch new file mode 100644 index 00000000000000..d2b29d21cbd988 --- /dev/null +++ b/recipes/jasper/all/patches/4.0.0-0003-deterministic-libname.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -262,7 +262,7 @@ endif() + # If a multiconfiguration generator is used, ensure that various output + # files are not placed in subdirectories (such as Debug and Release) + # as this will cause the CTest test suite to fail. +-if(JAS_MULTICONFIGURATION_GENERATOR) ++if(0) + if(CMAKE_CONFIGURATION_TYPES) + set(CMAKE_DEBUG_POSTFIX d) + endif() diff --git a/recipes/jasper/all/patches/fix-exported-symbols.patch b/recipes/jasper/all/patches/fix-exported-symbols.patch deleted file mode 100644 index 9db2d08488ceee..00000000000000 --- a/recipes/jasper/all/patches/fix-exported-symbols.patch +++ /dev/null @@ -1,163 +0,0 @@ ---- a/src/libjasper/include/jasper/jas_cm.h -+++ b/src/libjasper/include/jasper/jas_cm.h -@@ -237,13 +237,13 @@ int jas_cm_prof_setattr(jas_cm_prof_t *prof, jas_cm_attrname_t name, void *val); - void *jas_cm_prof_getattr(jas_cm_prof_t *prof, jas_cm_attrname_t name); - #endif - --jas_cmxform_t *jas_cmxform_create(jas_cmprof_t *inprof, jas_cmprof_t *outprof, -+JAS_DLLEXPORT jas_cmxform_t *jas_cmxform_create(jas_cmprof_t *inprof, jas_cmprof_t *outprof, - jas_cmprof_t *proofprof, int op, int intent, int optimize); - --void jas_cmxform_destroy(jas_cmxform_t *xform); -+JAS_DLLEXPORT void jas_cmxform_destroy(jas_cmxform_t *xform); - - /* Apply a transform to data. */ --int jas_cmxform_apply(jas_cmxform_t *xform, jas_cmpixmap_t *in, -+JAS_DLLEXPORT int jas_cmxform_apply(jas_cmxform_t *xform, jas_cmpixmap_t *in, - jas_cmpixmap_t *out); - - int jas_cxform_optimize(jas_cmxform_t *xform, int optimize); ---- a/src/libjasper/include/jasper/jas_debug.h -+++ b/src/libjasper/include/jasper/jas_debug.h -@@ -107,10 +107,10 @@ JAS_DLLEXPORT int jas_setdbglevel(int dbglevel); - JAS_DLLEXPORT int jas_eprintf(const char *fmt, ...); - - /* Dump memory to a stream. */ --int jas_memdump(FILE *out, void *data, size_t len); -+JAS_DLLEXPORT int jas_memdump(FILE *out, void *data, size_t len); - - /* Warn about use of deprecated functionality. */ --void jas_deprecated(const char *s); -+JAS_DLLEXPORT void jas_deprecated(const char *s); - - /* Convert to a string literal */ - #define JAS_STRINGIFY(x) #x ---- a/src/libjasper/include/jasper/jas_icc.h -+++ b/src/libjasper/include/jasper/jas_icc.h -@@ -395,10 +395,10 @@ JAS_DLLEXPORT jas_iccattrval_t *jas_iccattrval_create(jas_iccuint32_t type); - - JAS_DLLEXPORT void jas_iccattrtab_dump(jas_iccattrtab_t *attrtab, FILE *out); - --extern jas_uchar jas_iccprofdata_srgb[]; --extern int jas_iccprofdata_srgblen; --extern jas_uchar jas_iccprofdata_sgray[]; --extern int jas_iccprofdata_sgraylen; -+JAS_DLLEXPORT extern jas_uchar jas_iccprofdata_srgb[]; -+JAS_DLLEXPORT extern int jas_iccprofdata_srgblen; -+JAS_DLLEXPORT extern jas_uchar jas_iccprofdata_sgray[]; -+JAS_DLLEXPORT extern int jas_iccprofdata_sgraylen; - JAS_DLLEXPORT jas_iccprof_t *jas_iccprof_createfrombuf(jas_uchar *buf, int len); - JAS_DLLEXPORT jas_iccprof_t *jas_iccprof_createfromclrspc(int clrspc); - ---- a/src/libjasper/include/jasper/jas_image.h -+++ b/src/libjasper/include/jasper/jas_image.h -@@ -492,21 +492,21 @@ JAS_DLLEXPORT int jas_image_getfmt(jas_stream_t *in); - - - #define jas_image_cmprof(image) ((image)->cmprof_) --int jas_image_ishomosamp(jas_image_t *image); --int jas_image_sampcmpt(jas_image_t *image, int cmptno, int newcmptno, -+JAS_DLLEXPORT int jas_image_ishomosamp(jas_image_t *image); -+JAS_DLLEXPORT int jas_image_sampcmpt(jas_image_t *image, int cmptno, int newcmptno, - jas_image_coord_t ho, jas_image_coord_t vo, jas_image_coord_t hs, - jas_image_coord_t vs, int sgnd, int prec); --int jas_image_writecmpt2(jas_image_t *image, int cmptno, jas_image_coord_t x, -+JAS_DLLEXPORT int jas_image_writecmpt2(jas_image_t *image, int cmptno, jas_image_coord_t x, - jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, - long *buf); --int jas_image_readcmpt2(jas_image_t *image, int cmptno, jas_image_coord_t x, -+JAS_DLLEXPORT int jas_image_readcmpt2(jas_image_t *image, int cmptno, jas_image_coord_t x, - jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, - long *buf); - - #define jas_image_setcmprof(image, cmprof) ((image)->cmprof_ = cmprof) - JAS_DLLEXPORT jas_image_t *jas_image_chclrspc(jas_image_t *image, jas_cmprof_t *outprof, - int intent); --void jas_image_dump(jas_image_t *image, FILE *out); -+JAS_DLLEXPORT void jas_image_dump(jas_image_t *image, FILE *out); - - /******************************************************************************\ - * Image format-dependent operations. -@@ -514,58 +514,58 @@ void jas_image_dump(jas_image_t *image, FILE *out); - - #if !defined(EXCLUDE_JPG_SUPPORT) - /* Format-dependent operations for JPG support. */ --jas_image_t *jpg_decode(jas_stream_t *in, const char *optstr); --int jpg_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); --int jpg_validate(jas_stream_t *in); -+JAS_DLLEXPORT jas_image_t *jpg_decode(jas_stream_t *in, const char *optstr); -+JAS_DLLEXPORT int jpg_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); -+JAS_DLLEXPORT int jpg_validate(jas_stream_t *in); - #endif - - #if !defined(EXCLUDE_MIF_SUPPORT) - /* Format-dependent operations for MIF support. */ --jas_image_t *mif_decode(jas_stream_t *in, const char *optstr); --int mif_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); --int mif_validate(jas_stream_t *in); -+JAS_DLLEXPORT jas_image_t *mif_decode(jas_stream_t *in, const char *optstr); -+JAS_DLLEXPORT int mif_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); -+JAS_DLLEXPORT int mif_validate(jas_stream_t *in); - #endif - - #if !defined(EXCLUDE_PNM_SUPPORT) - /* Format-dependent operations for PNM support. */ --jas_image_t *pnm_decode(jas_stream_t *in, const char *optstr); --int pnm_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); --int pnm_validate(jas_stream_t *in); -+JAS_DLLEXPORT jas_image_t *pnm_decode(jas_stream_t *in, const char *optstr); -+JAS_DLLEXPORT int pnm_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); -+JAS_DLLEXPORT int pnm_validate(jas_stream_t *in); - #endif - - #if !defined(EXCLUDE_RAS_SUPPORT) - /* Format-dependent operations for Sun Rasterfile support. */ --jas_image_t *ras_decode(jas_stream_t *in, const char *optstr); --int ras_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); --int ras_validate(jas_stream_t *in); -+JAS_DLLEXPORT jas_image_t *ras_decode(jas_stream_t *in, const char *optstr); -+JAS_DLLEXPORT int ras_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); -+JAS_DLLEXPORT int ras_validate(jas_stream_t *in); - #endif - - #if !defined(EXCLUDE_BMP_SUPPORT) - /* Format-dependent operations for BMP support. */ --jas_image_t *bmp_decode(jas_stream_t *in, const char *optstr); --int bmp_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); --int bmp_validate(jas_stream_t *in); -+JAS_DLLEXPORT jas_image_t *bmp_decode(jas_stream_t *in, const char *optstr); -+JAS_DLLEXPORT int bmp_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); -+JAS_DLLEXPORT int bmp_validate(jas_stream_t *in); - #endif - - #if !defined(EXCLUDE_JP2_SUPPORT) - /* Format-dependent operations for JP2 support. */ --jas_image_t *jp2_decode(jas_stream_t *in, const char *optstr); --int jp2_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); --int jp2_validate(jas_stream_t *in); -+JAS_DLLEXPORT jas_image_t *jp2_decode(jas_stream_t *in, const char *optstr); -+JAS_DLLEXPORT int jp2_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); -+JAS_DLLEXPORT int jp2_validate(jas_stream_t *in); - #endif - - #if !defined(EXCLUDE_JPC_SUPPORT) - /* Format-dependent operations for JPEG-2000 code stream support. */ --jas_image_t *jpc_decode(jas_stream_t *in, const char *optstr); --int jpc_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); --int jpc_validate(jas_stream_t *in); -+JAS_DLLEXPORT jas_image_t *jpc_decode(jas_stream_t *in, const char *optstr); -+JAS_DLLEXPORT int jpc_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); -+JAS_DLLEXPORT int jpc_validate(jas_stream_t *in); - #endif - - #if !defined(EXCLUDE_PGX_SUPPORT) - /* Format-dependent operations for PGX support. */ --jas_image_t *pgx_decode(jas_stream_t *in, const char *optstr); --int pgx_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); --int pgx_validate(jas_stream_t *in); -+JAS_DLLEXPORT jas_image_t *pgx_decode(jas_stream_t *in, const char *optstr); -+JAS_DLLEXPORT int pgx_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); -+JAS_DLLEXPORT int pgx_validate(jas_stream_t *in); - #endif - - #ifdef __cplusplus diff --git a/recipes/jasper/all/test_package/CMakeLists.txt b/recipes/jasper/all/test_package/CMakeLists.txt index bee826cf5aec03..54cd6e29fc23c1 100644 --- a/recipes/jasper/all/test_package/CMakeLists.txt +++ b/recipes/jasper/all/test_package/CMakeLists.txt @@ -1,16 +1,21 @@ 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(Jasper REQUIRED) -message("JASPER_FOUND: ${JASPER_FOUND}") -message("JASPER_INCLUDE_DIR: ${JASPER_INCLUDE_DIR}") -message("JASPER_LIBRARIES: ${JASPER_LIBRARIES}") -message("JASPER_VERSION_STRING: ${JASPER_VERSION_STRING}") +set(_custom_vars + JASPER_FOUND + JASPER_INCLUDE_DIR + JASPER_LIBRARIES + JASPER_VERSION_STRING +) +foreach(_custom_var ${_custom_vars}) +if(DEFINED _custom_var) + message(STATUS "${_custom_var}: ${${_custom_var}}") +else() + message(FATAL_ERROR "${_custom_var} not defined") +endif() +endforeach() add_executable(${PROJECT_NAME} test_package.c) -target_include_directories(${PROJECT_NAME} PRIVATE ${JASPER_INCLUDE_DIR}) -target_link_libraries(${PROJECT_NAME} ${JASPER_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PRIVATE Jasper::Jasper) diff --git a/recipes/jasper/all/test_package/conanfile.py b/recipes/jasper/all/test_package/conanfile.py index 3da371b660e0a3..e845ae751a3017 100644 --- a/recipes/jasper/all/test_package/conanfile.py +++ b/recipes/jasper/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def 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/jasper/all/test_v1_package/CMakeLists.txt b/recipes/jasper/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..2f6b1a2f7ec79d --- /dev/null +++ b/recipes/jasper/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/jasper/all/test_v1_package/conanfile.py b/recipes/jasper/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..19e6a0c06e3d81 --- /dev/null +++ b/recipes/jasper/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/jasper/config.yml b/recipes/jasper/config.yml index 61123bdc2e508a..4a60a36eef3ae0 100644 --- a/recipes/jasper/config.yml +++ b/recipes/jasper/config.yml @@ -1,27 +1,7 @@ versions: - "2.0.33": - folder: all - "2.0.32": - folder: all - "2.0.28": - folder: all - "2.0.27": - folder: all - "2.0.26": - folder: all - "2.0.25": + "4.0.0": folder: all - "2.0.24": + "3.0.6": folder: all - "2.0.23": - folder: all - "2.0.22": - folder: all - "2.0.21": - folder: all - "2.0.19": - folder: all - "2.0.16": - folder: all - "2.0.14": + "2.0.33": folder: all diff --git a/recipes/joltphysics/all/conandata.yml b/recipes/joltphysics/all/conandata.yml new file mode 100644 index 00000000000000..7c5580239b9ad4 --- /dev/null +++ b/recipes/joltphysics/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "2.0.1": + url: "https://github.com/jrouwe/JoltPhysics/archive/refs/tags/v2.0.1.tar.gz" + sha256: "96ae2e8691c4802e56bf2587da30f2cc86b8abe82a78bc2398065bd87dd718af" +patches: + "2.0.1": + - patch_file: "patches/0001-fix-cmake.patch" + patch_description: "Fix CMakeLists: no warnings as errors, allow shared, add install target, and add profile & debug_renderer options" + patch_type: "conan" diff --git a/recipes/joltphysics/all/conanfile.py b/recipes/joltphysics/all/conanfile.py new file mode 100644 index 00000000000000..875b57e559f578 --- /dev/null +++ b/recipes/joltphysics/all/conanfile.py @@ -0,0 +1,160 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +import os + +required_conan_version = ">=1.53.0" + + +class JoltPhysicsConan(ConanFile): + name = "joltphysics" + description = ( + "A multi core friendly rigid body physics and collision detection " + "library, written in C++, suitable for games and VR applications." + ) + license = "MIT" + topics = ("physics", "simulation", "physics-engine", "physics-simulation", "rigid-body", "game", "collision") + homepage = "https://github.com/jrouwe/JoltPhysics" + url = "https://github.com/conan-io/conan-center-index" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "simd": ["sse", "sse41", "sse42", "avx", "avx2", "avx512"], + "debug_renderer": [True, False], + "profile": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "simd": "sse42", + "debug_renderer": False, + "profile": False, + } + + @property + def _min_cppstd(self): + return "17" + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "9.2", # due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81429 + "clang": "5", + "apple-clang": "12", + } + + @property + def _has_sse41(self): + return self.options.get_safe("simd") in ("sse41", "sse42", "avx", "avx2", "avx512") + + @property + def _has_sse42(self): + return self.options.get_safe("simd") in ("sse42", "avx", "avx2", "avx512") + + @property + def _has_avx(self): + return self.options.get_safe("simd") in ("avx", "avx2", "avx512") + + @property + def _has_avx2(self): + return self.options.get_safe("simd") in ("avx2", "avx512") + + @property + def _has_avx512(self): + return self.options.get_safe("simd") == "avx512" + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + if self.settings.arch not in ("x86", "x86_64"): + del self.options.simd + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.info.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) + + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} shared not supported with Visual Studio") + + 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["TARGET_UNIT_TESTS"] = False + tc.variables["TARGET_HELLO_WORLD"] = False + tc.variables["TARGET_PERFORMANCE_TEST"] = False + tc.variables["TARGET_SAMPLES"] = False + tc.variables["TARGET_VIEWER"] = False + tc.variables["GENERATE_DEBUG_SYMBOLS"] = False + tc.variables["TARGET_UNIT_TESTS"] = False + tc.variables["USE_SSE4_1"] = self._has_sse41 + tc.variables["USE_SSE4_2"] = self._has_sse42 + tc.variables["USE_AVX"] = self._has_avx + tc.variables["USE_AVX2"] = self._has_avx2 + tc.variables["USE_AVX512"] = self._has_avx512 + if is_msvc(self): + tc.variables["USE_STATIC_MSVC_RUNTIME_LIBRARY"] = is_msvc_static_runtime(self) + tc.variables["JPH_DEBUG_RENDERER"] = self.options.debug_renderer + tc.variables["JPH_PROFILE_ENABLED"] = self.options.profile + tc.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "Build")) + cmake.build() + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["Jolt"] + if self._has_sse41: + self.cpp_info.defines.append("JPH_USE_SSE4_1") + if self._has_sse42: + self.cpp_info.defines.append("JPH_USE_SSE4_2") + if self._has_avx: + self.cpp_info.defines.append("JPH_USE_AVX") + if self._has_avx2: + self.cpp_info.defines.append("JPH_USE_AVX2") + if self._has_avx512: + self.cpp_info.defines.append("JPH_USE_AVX512") + if self.options.debug_renderer: + self.cpp_info.defines.append("JPH_DEBUG_RENDERER") + if self.options.profile: + self.cpp_info.defines.append("JPH_PROFILE_ENABLED") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread"]) diff --git a/recipes/joltphysics/all/patches/0001-fix-cmake.patch b/recipes/joltphysics/all/patches/0001-fix-cmake.patch new file mode 100644 index 00000000000000..2be9454d8f5f9b --- /dev/null +++ b/recipes/joltphysics/all/patches/0001-fix-cmake.patch @@ -0,0 +1,90 @@ +--- a/Build/CMakeLists.txt ++++ b/Build/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 3.16 FATAL_ERROR) ++cmake_minimum_required(VERSION 3.15) + + project(JoltPhysics CXX) + +@@ -32,11 +32,6 @@ include(CMakeDependentOption) + # Windows Store only supports the DLL version + cmake_dependent_option(USE_STATIC_MSVC_RUNTIME_LIBRARY "Use the static MSVC runtime library" ON "MSVC;NOT WINDOWS_STORE" OFF) + +-if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") +- set(CMAKE_CONFIGURATION_TYPES "Debug;Release;Distribution") +-elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") +- set(CMAKE_CONFIGURATION_TYPES "Debug;Release;ReleaseASAN;ReleaseUBSAN;ReleaseCoverage;Distribution") +-endif() + + if (("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore") AND NOT MINGW) + # Fill in the path to the asan libraries +@@ -53,7 +48,7 @@ if (("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR "${CMAKE_SYSTEM_NAME}" STREQUA + endif() + + # Set general compiler flags +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17 /Zc:__cplusplus /Gm- /Wall /WX /MP /nologo /diagnostics:classic /FC /fp:except- /Zc:inline /Zi") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus /Gm- /Wall /MP /nologo /diagnostics:classic /FC /fp:except- /Zc:inline /Zi") + + # Remove any existing compiler flag that enables RTTI + string(REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) +@@ -76,8 +71,6 @@ if (("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR "${CMAKE_SYSTEM_NAME}" STREQUA + + if (NOT ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "ARM64") AND NOT ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "ARM")) + # On ARM, whole program optimization triggers an internal compiler error during code gen, so we don't turn it on +- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL") +- set(CMAKE_CXX_FLAGS_DISTRIBUTION "${CMAKE_CXX_FLAGS_DISTRIBUTION} /GL") + endif() + + # Set linker flags +@@ -118,7 +111,6 @@ if (("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR "${CMAKE_SYSTEM_NAME}" STREQUA + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /DJPH_FLOATING_POINT_EXCEPTIONS_ENABLED") # Clang turns Float2 into a vector sometimes causing floating point exceptions + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /DJPH_FLOATING_POINT_EXCEPTIONS_ENABLED") + set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/INCREMENTAL:NO /LTCG:incremental /OPT:ICF /OPT:REF") +- set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "/LTCG") + elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /showFilenames") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments") # Clang emits warnings about unused arguments such as /MP and /GL +@@ -153,7 +145,7 @@ if (("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR "${CMAKE_SYSTEM_NAME}" STREQUA + endif() + elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "iOS" OR MINGW OR EMSCRIPTEN) + # Set general compiler flags +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -std=c++17 -I. -Wall -Werror") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -I. -Wall") + + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + # Somehow -Wcomment doesn't want to be turned off from code and we need this because Doxygen MathJax uses it +--- a/Jolt/Jolt.cmake ++++ b/Jolt/Jolt.cmake +@@ -410,12 +410,26 @@ endif() + source_group(TREE ${JOLT_PHYSICS_ROOT} FILES ${JOLT_PHYSICS_SRC_FILES}) + + # Create Jolt lib +-add_library(Jolt STATIC ${JOLT_PHYSICS_SRC_FILES}) ++add_library(Jolt ${JOLT_PHYSICS_SRC_FILES}) ++target_compile_features(Jolt PUBLIC cxx_std_17) ++include(GNUInstallDirs) ++install( ++ TARGETS Jolt ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++) ++install(DIRECTORY ${JOLT_PHYSICS_ROOT} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING REGEX "(.*).(h|inl)$") ++if(JPH_DEBUG_RENDERER) ++ target_compile_definitions(Jolt PUBLIC JPH_DEBUG_RENDERER) ++endif() ++if(JPH_PROFILE_ENABLED) ++ target_compile_definitions(Jolt PUBLIC JPH_PROFILE_ENABLED) ++endif() + target_include_directories(Jolt PUBLIC ${PHYSICS_REPO_ROOT}) +-target_precompile_headers(Jolt PRIVATE ${JOLT_PHYSICS_ROOT}/Jolt.h) +-target_compile_definitions(Jolt PUBLIC "$<$:_DEBUG;JPH_PROFILE_ENABLED;JPH_DEBUG_RENDERER>") +-target_compile_definitions(Jolt PUBLIC "$<$:NDEBUG;JPH_PROFILE_ENABLED;JPH_DEBUG_RENDERER>") ++target_compile_definitions(Jolt PUBLIC "$<$:_DEBUG>") ++target_compile_definitions(Jolt PUBLIC "$<$:NDEBUG>") + target_compile_definitions(Jolt PUBLIC "$<$:NDEBUG>") +-target_compile_definitions(Jolt PUBLIC "$<$:NDEBUG;JPH_PROFILE_ENABLED;JPH_DISABLE_TEMP_ALLOCATOR;JPH_DISABLE_CUSTOM_ALLOCATOR;JPH_DEBUG_RENDERER>") +-target_compile_definitions(Jolt PUBLIC "$<$:NDEBUG;JPH_PROFILE_ENABLED;JPH_DEBUG_RENDERER>") ++target_compile_definitions(Jolt PUBLIC "$<$:NDEBUG;JPH_DISABLE_TEMP_ALLOCATOR;JPH_DISABLE_CUSTOM_ALLOCATOR>") ++target_compile_definitions(Jolt PUBLIC "$<$:NDEBUG>") + target_compile_definitions(Jolt PUBLIC "$<$:NDEBUG>") diff --git a/recipes/joltphysics/all/test_package/CMakeLists.txt b/recipes/joltphysics/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..0b69831ca4aa0e --- /dev/null +++ b/recipes/joltphysics/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(joltphysics REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE joltphysics::joltphysics) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/joltphysics/all/test_package/conanfile.py b/recipes/joltphysics/all/test_package/conanfile.py new file mode 100644 index 00000000000000..0a6bc68712d901 --- /dev/null +++ b/recipes/joltphysics/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/joltphysics/all/test_package/test_package.cpp b/recipes/joltphysics/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..73d3685c494f5b --- /dev/null +++ b/recipes/joltphysics/all/test_package/test_package.cpp @@ -0,0 +1,51 @@ +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +static void TraceImpl(const char *inFMT, ...) +{ + va_list list; + va_start(list, inFMT); + char buffer[1024]; + std::vsnprintf(buffer, sizeof(buffer), inFMT, list); + va_end(list); + + std::cout << buffer << std::endl; +} + +#ifdef JPH_ENABLE_ASSERTS +static bool AssertFailedImpl(const char *inExpression, const char *inMessage, const char *inFile, JPH::uint inLine) +{ + std::cout << inFile << ":" << inLine << ": (" << inExpression << ") " << (inMessage != nullptr? inMessage : "") << std::endl; + return true; +}; +#endif + +int main() +{ + JPH::RegisterDefaultAllocator(); + + JPH::Trace = TraceImpl; +#ifdef JPH_ENABLE_ASSERTS + JPH::AssertFailed = AssertFailedImpl; +#endif + + JPH::Factory::sInstance = new JPH::Factory(); + + JPH::RegisterTypes(); + + JPH::TempAllocatorImpl temp_allocator(10 * 1024 * 1024); + JPH::JobSystemThreadPool job_system(JPH::cMaxPhysicsJobs, JPH::cMaxPhysicsBarriers, std::thread::hardware_concurrency() - 1); + + delete JPH::Factory::sInstance; + JPH::Factory::sInstance = nullptr; + + return 0; +} diff --git a/recipes/joltphysics/all/test_v1_package/CMakeLists.txt b/recipes/joltphysics/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/joltphysics/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/joltphysics/all/test_v1_package/conanfile.py b/recipes/joltphysics/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/joltphysics/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/joltphysics/config.yml b/recipes/joltphysics/config.yml new file mode 100644 index 00000000000000..bb7eb85dfac498 --- /dev/null +++ b/recipes/joltphysics/config.yml @@ -0,0 +1,3 @@ +versions: + "2.0.1": + folder: all diff --git a/recipes/jom/all/conanfile.py b/recipes/jom/all/conanfile.py index d1824504b7e54d..e94e1344b85efd 100644 --- a/recipes/jom/all/conanfile.py +++ b/recipes/jom/all/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.files import get, download +from conan.tools.files import copy, download, get from conan.errors import ConanInvalidConfiguration import os @@ -10,12 +10,10 @@ class JomInstallerConan(ConanFile): description = "jom is a clone of nmake to support the execution of multiple independent commands in parallel" url = "https://github.com/conan-io/conan-center-index" homepage = "http://wiki.qt.io/Jom" - license = "GPL-3.0" - topics = ("build", "makefile", "make") - + license = "GPL-3.0-only" + topics = ("build", "make", "makefile", "nmake") settings = "os", "arch", "compiler", "build_type" - # not needed but supress warning message from conan commands def layout(self): pass @@ -24,16 +22,19 @@ def package_id(self): del self.info.settings.build_type def validate(self): - if self.settings.os != "Windows": - raise ConanInvalidConfiguration("Only Windows supported") + if self.info.settings.os != "Windows": + raise ConanInvalidConfiguration(f"{self.ref} only supports Windows") def source(self): + pass + + def build(self): get(self, **self.conan_data["sources"][self.version]) - download(self, f'https://code.qt.io/cgit/qt-labs/jom.git/plain/LICENSE.GPL?h=v{self.version}', filename='LICENSE.GPL') + download(self, f"https://code.qt.io/cgit/qt-labs/jom.git/plain/LICENSE.GPL?h=v{self.version}", filename="LICENSE.GPL") def package(self): - self.copy("LICENSE.GPL", dst= 'licenses', src='') - self.copy("*.exe", dst="bin", src="") + copy(self, "LICENSE.GPL", self.build_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "*.exe", self.build_folder, os.path.join(self.package_folder, "bin")) def package_info(self): self.cpp_info.frameworkdirs = [] @@ -41,10 +42,6 @@ def package_info(self): self.cpp_info.resdirs = [] self.cpp_info.includedirs = [] - bin_folder = os.path.join(self.package_folder, "bin") - # In case need to find packaged tools when building a package - self.buildenv_info.append("PATH", bin_folder) - # In case need to find packaged tools at runtime - self.runenv_info.append("PATH", bin_folder) # TODO: Legacy, to be removed on Conan 2.0 + bin_folder = os.path.join(self.package_folder, "bin") self.env_info.PATH.append(bin_folder) diff --git a/recipes/jom/all/test_package/conanfile.py b/recipes/jom/all/test_package/conanfile.py index f7976d712ed838..7762b725dc75e7 100644 --- a/recipes/jom/all/test_package/conanfile.py +++ b/recipes/jom/all/test_package/conanfile.py @@ -1,8 +1,18 @@ -from conans import ConanFile +from conan import ConanFile +from conan.tools.build import can_run class TestPackageConan(ConanFile): - settings = "os" + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" - def test(self): - self.run("jom /VERSION") + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def build(self): + pass + + def test(self): + if can_run(self): + self.run("jom /VERSION") diff --git a/recipes/jom/all/test_v1_package/conanfile.py b/recipes/jom/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..524a49a2860477 --- /dev/null +++ b/recipes/jom/all/test_v1_package/conanfile.py @@ -0,0 +1,13 @@ +from conans import ConanFile +from conan.tools.build import can_run + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + def build(self): + pass + + def test(self): + if can_run(self): + self.run("jom /VERSION", run_environment=True) diff --git a/recipes/jsmn/all/conandata.yml b/recipes/jsmn/all/conandata.yml new file mode 100644 index 00000000000000..4e1b9613351b79 --- /dev/null +++ b/recipes/jsmn/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.1.0": + url: "https://github.com/zserge/jsmn/archive/refs/tags/v1.1.0.tar.gz" + sha256: "5f0913a10657fe7ec8d5794ccf00a01000e3e1f2f1e1f143c34a0f7b47edcb38" diff --git a/recipes/jsmn/all/conanfile.py b/recipes/jsmn/all/conanfile.py new file mode 100644 index 00000000000000..80c11f45949cba --- /dev/null +++ b/recipes/jsmn/all/conanfile.py @@ -0,0 +1,41 @@ +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.50.0" + + +class JsmnConan(ConanFile): + name = "jsmn" + description = ( + "jsmn (pronounced like 'jasmine') is a minimalistic JSON parser in C. " + "It can be easily integrated into resource-limited or embedded projects." + ) + license = "MIT" + topics = ("json", "parser") + homepage = "https://github.com/zserge/jsmn" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "jsmn.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/jsmn/all/test_package/CMakeLists.txt b/recipes/jsmn/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..1b2a676ec01f19 --- /dev/null +++ b/recipes/jsmn/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(jsmn REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE jsmn::jsmn) diff --git a/recipes/jsmn/all/test_package/conanfile.py b/recipes/jsmn/all/test_package/conanfile.py new file mode 100644 index 00000000000000..0a6bc68712d901 --- /dev/null +++ b/recipes/jsmn/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/jsmn/all/test_package/test_package.c b/recipes/jsmn/all/test_package/test_package.c new file mode 100644 index 00000000000000..20c6bc254fdfae --- /dev/null +++ b/recipes/jsmn/all/test_package/test_package.c @@ -0,0 +1,8 @@ +#define JSMN_STATIC +#include + +int main() { + jsmn_parser parser; + jsmn_init(&parser); + return 0; +} diff --git a/recipes/jsmn/all/test_v1_package/CMakeLists.txt b/recipes/jsmn/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/jsmn/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/jsmn/all/test_v1_package/conanfile.py b/recipes/jsmn/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/jsmn/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/jsmn/config.yml b/recipes/jsmn/config.yml new file mode 100644 index 00000000000000..b5c0d3cb2d4091 --- /dev/null +++ b/recipes/jsmn/config.yml @@ -0,0 +1,3 @@ +versions: + "1.1.0": + folder: all diff --git a/recipes/json-schema-validator/all/conandata.yml b/recipes/json-schema-validator/all/conandata.yml index b019d54ef79678..122476811e03fa 100644 --- a/recipes/json-schema-validator/all/conandata.yml +++ b/recipes/json-schema-validator/all/conandata.yml @@ -9,6 +9,11 @@ sources: url: "https://github.com/pboettch/json-schema-validator/archive/refs/tags/2.0.0.tar.gz" sha256: "ca8e4ca5a88c49ea52b5f5c2a08a293dbf02b2fc66cb8c09d4cce5810ee98b57" patches: + "2.2.0": + - patch_file: "patches/2.2.0-signed-char.patch" + patch_type: "portability" + patch_description: "Fix for PowerPC and ARM" + patch_source: "https://github.com/pboettch/json-schema-validator/pull/242" "2.1.0": - patch_file: "patches/2.1.0-cmake_minimum_version.patch" patch_type: "conan" diff --git a/recipes/json-schema-validator/all/patches/2.2.0-signed-char.patch b/recipes/json-schema-validator/all/patches/2.2.0-signed-char.patch new file mode 100644 index 00000000000000..ffea4bf7ef2e74 --- /dev/null +++ b/recipes/json-schema-validator/all/patches/2.2.0-signed-char.patch @@ -0,0 +1,64 @@ +From 3918616faf989fcf4a9206a34e3b87c23642a96a Mon Sep 17 00:00:00 2001 +From: Robert Joslyn +Date: Wed, 30 Nov 2022 13:07:29 -0800 +Subject: [PATCH] Fix assumed signed char + +The code assumes that char is signed, but whether char is signed or +unsigned is implementation defined. On some architectures like PowerPC, +GCC treats char as unsigned resulting in compile errors: + + smtp-address-validator.cpp:213:1: error: narrowing conversion of '-32' from 'int' to 'char' [-Wnarrowing] + +Fix this by specifying signed char. +--- + src/smtp-address-validator.cpp | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/src/smtp-address-validator.cpp b/src/smtp-address-validator.cpp +index a63ead0..3903b51 100644 +--- a/src/smtp-address-validator.cpp ++++ b/src/smtp-address-validator.cpp +@@ -63,7 +63,7 @@ static const short _address_key_offsets[] = { + 1363, 1365, 1367, 1368, 1370, 1388, 0 + }; + +-static const char _address_trans_keys[] = { ++static const signed char _address_trans_keys[] = { + -32, -19, -16, -12, 34, 45, 61, 63, + -62, -33, -31, -17, -15, -13, 33, 39, + 42, 43, 47, 57, 65, 90, 94, 126, +@@ -711,7 +711,7 @@ bool is_address(const char* p, const char* pe) + { + int _klen; + unsigned int _trans = 0; +- const char * _keys; ++ const signed char * _keys; + const signed char * _acts; + unsigned int _nacts; + _resume: {} +@@ -728,9 +728,9 @@ bool is_address(const char* p, const char* pe) + + _klen = (int)_address_single_lengths[cs]; + if ( _klen > 0 ) { +- const char *_lower = _keys; +- const char *_upper = _keys + _klen - 1; +- const char *_mid; ++ const signed char *_lower = _keys; ++ const signed char *_upper = _keys + _klen - 1; ++ const signed char *_mid; + while ( 1 ) { + if ( _upper < _lower ) { + _keys += _klen; +@@ -752,9 +752,9 @@ bool is_address(const char* p, const char* pe) + + _klen = (int)_address_range_lengths[cs]; + if ( _klen > 0 ) { +- const char *_lower = _keys; +- const char *_upper = _keys + (_klen<<1) - 2; +- const char *_mid; ++ const signed char *_lower = _keys; ++ const signed char *_upper = _keys + (_klen<<1) - 2; ++ const signed char *_mid; + while ( 1 ) { + if ( _upper < _lower ) { + _trans += (unsigned int)_klen; diff --git a/recipes/json_dto/all/conanfile.py b/recipes/json_dto/all/conanfile.py index ee89f2d2edf517..8e39c9590814b2 100644 --- a/recipes/json_dto/all/conanfile.py +++ b/recipes/json_dto/all/conanfile.py @@ -1,11 +1,16 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" -class JsondtoConan(ConanFile): + +class PackageConan(ConanFile): name = "json_dto" license = "BSD-3-Clause" homepage = "https://github.com/Stiffstream/json_dto" @@ -16,51 +21,53 @@ class JsondtoConan(ConanFile): no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" - - def requirements(self): - self.requires("rapidjson/1.1.0") + def _min_cppstd(self): + return 14 - def validate(self): - minimal_cpp_standard = "14" - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, minimal_cpp_standard) - minimal_version = { + @property + def _compilers_minimum_version(self): + return { "gcc": "5", "clang": "4", "apple-clang": "8", - "Visual Studio": "15" + "Visual Studio": "14", + "msvc": "190", } - compiler = str(self.settings.compiler) - if compiler not in minimal_version: - self.output.warn( - "%s recipe lacks information about the %s compiler standard version support" % (self.name, compiler)) - self.output.warn( - "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) - elif tools.Version(self.settings.compiler.version) < minimal_version[compiler]: - raise ConanInvalidConfiguration("%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) - if self.settings.compiler == "apple-clang" and tools.Version(self.settings.compiler.version) >= "11": - raise ConanInvalidConfiguration(f"{self.name} requires apple-clang less then version 11") + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("rapidjson/1.1.0", transitive_headers=True) def package_id(self): - self.info.header_only() + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = CMake(self) - cmake.definitions["JSON_DTO_INSTALL"] = True - cmake.definitions["JSON_DTO_FIND_DEPS"] = False - cmake.configure(source_folder=os.path.join(self._source_subfolder, "dev", "json_dto")) - cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib")) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="pub.hpp", + dst=os.path.join(self.package_folder, "include", "json_dto"), + src=os.path.join(self.source_folder, "dev", "json_dto"), + ) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.set_property("cmake_file_name", "json-dto") self.cpp_info.set_property("cmake_target_name", "json-dto::json-dto") self.cpp_info.names["cmake_find_package"] = "json-dto" diff --git a/recipes/jsoncpp/all/conanfile.py b/recipes/jsoncpp/all/conanfile.py index 99b1d8ec06857e..1354ccb9d19437 100644 --- a/recipes/jsoncpp/all/conanfile.py +++ b/recipes/jsoncpp/all/conanfile.py @@ -2,6 +2,7 @@ from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, save from conan.tools.scm import Version +from conan.tools.microsoft import is_msvc import os import textwrap @@ -41,8 +42,7 @@ def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -70,7 +70,7 @@ def generate(self): def _patch_sources(self): apply_conandata_patches(self) - if self.settings.compiler == "Visual Studio" and self.settings.compiler.version == "11": + if is_msvc(self) and str(self.settings.compiler.version) in ("11", "170"): replace_in_file(self, os.path.join(self.source_folder, "include", "json", "value.h"), "explicit operator bool()", "operator bool()") @@ -123,6 +123,8 @@ def package_info(self): self.cpp_info.libs = ["jsoncpp"] if self.settings.os == "Windows" and self.options.shared: self.cpp_info.defines.append("JSON_DLL") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") # TODO: to remove in conan v2 once legacy generators removed self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] diff --git a/recipes/jungle/all/conandata.yml b/recipes/jungle/all/conandata.yml index 66bd8466456e14..bd27aef1a8932e 100644 --- a/recipes/jungle/all/conandata.yml +++ b/recipes/jungle/all/conandata.yml @@ -2,6 +2,9 @@ sources: "cci.20220801": url: "https://github.com/eBay/Jungle/archive/f41b7123489f1bc942a6b76dc54485391485cd27.tar.gz" sha256: 8667a114bcef661b2a93e627a68b0584931f182dc8b96693ce6901d903584ab8 + "cci.20221201": + url: "https://github.com/eBay/Jungle/archive/289105763172418eeb37fbeeb6d2fe2a58834715.tar.gz" + sha256: df07fff42e2c4087d96e617d8d976c2856b9dfcef95a0a7255004ed272ca2361 patches: "cci.20220801": - patch_file: "patches/0001-cmake-alterations.patch" @@ -19,3 +22,19 @@ patches: patch_type: "portability" base_path: "source_subfolder" sha256: "3ca66676f89e2425255eeb15bf18a77ae21c4f383124013bd6d1cb660cbc1544" + "cci.20221201": + - patch_file: "patches/0004-cmake-alterations-cci.20221201.patch" + patch_description: "CMake dependency discovery outside subtree." + patch_type: "conan" + base_path: "source_subfolder" + sha256: "a7111a290e145717ae0cbdace9866db69c70782731c8568a806f8579e30759eb" + - patch_file: "patches/0002-forestdb-path.patch" + patch_description: "Update include macros for ForestDB headers." + patch_type: "conan" + base_path: "source_subfolder" + sha256: "84ec45a312c52e2fa8cb7ab615aaa11088f24dcb4e4b880340b46c2763900d6b" + - patch_file: "patches/0003-stdatomic.patch" + patch_description: "Include std::atomic from all compilers." + patch_type: "portability" + base_path: "source_subfolder" + sha256: "3ca66676f89e2425255eeb15bf18a77ae21c4f383124013bd6d1cb660cbc1544" diff --git a/recipes/jungle/all/patches/0004-cmake-alterations-cci.20221201.patch b/recipes/jungle/all/patches/0004-cmake-alterations-cci.20221201.patch new file mode 100644 index 00000000000000..ae047df397a105 --- /dev/null +++ b/recipes/jungle/all/patches/0004-cmake-alterations-cci.20221201.patch @@ -0,0 +1,48 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -106,7 +106,8 @@ if (LOGGER_NO_BACKTRACE GREATER 0) + message(STATUS "---- NO BACKTRACE BY LOGGER ----") + endif() + +-file(COPY ${CMAKE_SOURCE_DIR}/scripts/runtests.sh ++find_package(forestdb REQUIRED) ++file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/scripts/runtests.sh + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + + # === CUSTOM LOGGER === +@@ -193,16 +194,16 @@ set(JUNGLE_DEPS + ${LIBDL}) + + add_library(static_lib ${JUNGLE_CORE}) +-target_link_libraries(static_lib ${JUNGLE_DEPS}) ++target_link_libraries(static_lib forestdb::forestdb) + set_target_properties(static_lib PROPERTIES OUTPUT_NAME jungle + CLEAN_DIRECT_OUTPUT 1) + if (DETACH_LOGGER GREATER 0) + add_dependencies(static_lib simplelogger_lib) + endif () + +-add_subdirectory("${PROJECT_SOURCE_DIR}/examples") +-add_subdirectory("${PROJECT_SOURCE_DIR}/tests") +-add_subdirectory("${PROJECT_SOURCE_DIR}/tools") ++#add_subdirectory("${PROJECT_SOURCE_DIR}/examples") ++#add_subdirectory("${PROJECT_SOURCE_DIR}/tests") ++#add_subdirectory("${PROJECT_SOURCE_DIR}/tools") + + if (CODE_COVERAGE GREATER 0) + SETUP_TARGET_FOR_COVERAGE( +--- a/tests/CMakeLists.txt ++++ b/tests/CMakeLists.txt +@@ -5,10 +5,7 @@ set(STRESS_TEST_DIR ${TEST_DIR}/stress) + + set(JUNGLE_TEST_DEPS + static_lib +- ${LIBSIMPLELOGGER} +- ${FDB_LIB_DIR}/libforestdb.a +- ${LIBSNAPPY} +- ${LIBDL}) ++ forestdb:forestdb) + + set(FILEOPS_TEST ${TEST_DIR}/unit/fileops_test.cc) + add_executable(fileops_test ${FILEOPS_TEST}) + diff --git a/recipes/jungle/config.yml b/recipes/jungle/config.yml index 2499184dd3f4b0..f95f42a22df324 100644 --- a/recipes/jungle/config.yml +++ b/recipes/jungle/config.yml @@ -1,3 +1,5 @@ versions: "cci.20220801": folder: all + "cci.20221201": + folder: all diff --git a/recipes/jwt-cpp/all/conanfile.py b/recipes/jwt-cpp/all/conanfile.py index 03a6ded8886d72..75e913785ea24e 100644 --- a/recipes/jwt-cpp/all/conanfile.py +++ b/recipes/jwt-cpp/all/conanfile.py @@ -1,10 +1,10 @@ from conan import ConanFile from conan.tools.scm import Version -from conan.tools.files import get, copy, apply_conandata_patches +from conan.tools.files import get, copy, apply_conandata_patches, export_conandata_patches from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class JwtCppConan(ConanFile): name = "jwt-cpp" @@ -12,8 +12,8 @@ class JwtCppConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/Thalhammer/jwt-cpp" description = "A C++ JSON Web Token library for encoding/decoding" - topics = ("jwt-cpp", "json", "jwt", "jws", "jwe", "jwk", "jwks", "jose", "header-only") - settings = "arch", "build_type", "compiler", "os" + topics = ("json", "jwt", "jws", "jwe", "jwk", "jwks", "jose", "header-only") + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property @@ -21,8 +21,7 @@ def _supports_generic_json(self): return Version(self.version) >= "0.5.0" 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 requirements(self): self.requires("openssl/1.1.1s") diff --git a/recipes/lcms/all/conandata.yml b/recipes/lcms/all/conandata.yml index 55991f5faffdb9..c5a742dcdcb990 100644 --- a/recipes/lcms/all/conandata.yml +++ b/recipes/lcms/all/conandata.yml @@ -5,15 +5,12 @@ sources: "2.13.1": url: "https://github.com/mm2/Little-CMS/archive/refs/tags/lcms2.13.1.tar.gz" sha256: "6f84c942ecde1b4852b5a051894502ac8c98d010acb3400dec958c6db1bc94ef" - "2.12": - url: "https://github.com/mm2/Little-CMS/archive/2.12.tar.gz" - sha256: "e501f1482fc424550ef3abbf86bf1c66090e1661249e89552d39ed5bf935df66" - "2.11": - url: "https://github.com/mm2/Little-CMS/archive/2.11.tar.gz" - sha256: "478c9c3938d7a91b1171de4616f8b04308a8676d73eadc19505b7ace41327f28" - "2.10": - url: "https://github.com/mm2/Little-CMS/archive/lcms2.10.tar.gz" - sha256: "f7529f90f0a9c7529c561a2c681043c10f2d30b78e6728fb44132828f89b666a" - "2.9": - url: "https://github.com/mm2/Little-CMS/archive/lcms2.9.tar.gz" - sha256: "8e23a09dc81af856db37941a4ea26acdf6a45b0281ec5b7ee94b5a4e9f7afbf7" +patches: + "2.14": + - patch_file: "patches/2.13.1-0001-fix-msvc-import-lib.patch" + patch_description: "Fix msvc import lib" + patch_type: "portability" + "2.13.1": + - patch_file: "patches/2.13.1-0001-fix-msvc-import-lib.patch" + patch_description: "Fix msvc import lib" + patch_type: "portability" diff --git a/recipes/lcms/all/conanfile.py b/recipes/lcms/all/conanfile.py index e73dd6770d2e09..a0de3a3a66bf78 100644 --- a/recipes/lcms/all/conanfile.py +++ b/recipes/lcms/all/conanfile.py @@ -1,9 +1,13 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment, MSBuild +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.scm import Version import os -import re -import shutil -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.53.0" class LcmsConan(ConanFile): @@ -12,7 +16,7 @@ class LcmsConan(ConanFile): description = "A free, open source, CMM engine." license = "MIT" homepage = "https://github.com/mm2/Little-CMS" - topics = ("lcms", "cmm", "icc", "cmm-engine") + topics = ("littlecms", "little-cms", "cmm", "icc", "cmm-engine", "color-management-engine") settings = "os", "arch", "compiler", "build_type" options = { @@ -24,23 +28,8 @@ class LcmsConan(ConanFile): "fPIC": True, } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) - - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -48,118 +37,70 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def build_requirements(self): - if not self._is_msvc: - self.build_requires("gnu-config/cci.20201022") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("meson/1.0.0") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = MesonToolchain(self) + tc.generate() def _patch_sources(self): - compiler_version = tools.Version(self.settings.compiler.version) - if (self.settings.compiler == "Visual Studio" and compiler_version >= "14") or \ - str(self.settings.compiler) == "msvc": + apply_conandata_patches(self) + compiler_version = Version(self.settings.compiler.version) + if (str(self.settings.compiler) == "Visual Studio" and compiler_version >= "14") or \ + (str(self.settings.compiler) == "msvc" and compiler_version >= "190"): # since VS2015 vsnprintf is built-in - path = os.path.join(self._source_subfolder, "src", "lcms2_internal.h") - tools.replace_in_file(path, "# define vsnprintf _vsnprintf", "") - if (self.settings.compiler == "Visual Studio" and compiler_version >= "16") or \ - (str(self.settings.compiler) == "msvc" and compiler_version >= "192"): - # since VS2019, don't need to specify the WindowsTargetPlatformVersion - path = os.path.join(self._source_subfolder, "Projects", "VC2015", "lcms2_static", "lcms2_static.vcxproj") - tools.replace_in_file(path, "8.1", "") - if self.settings.os == "Android" and self._settings_build.os == "Windows": - # remove escape for quotation marks, to make ndk on windows happy - tools.replace_in_file(os.path.join(self._source_subfolder, "configure"), - "s/[ `~#$^&*(){}\\\\|;'\\\''\"<>?]/\\\\&/g", - "s/[ `~#$^&*(){}\\\\|;<>?]/\\\\&/g") - - def _build_visual_studio(self): - if tools.Version(self.version) <= "2.11": - vc_sln_subdir = "VC2013" - else: - vc_sln_subdir = "VC2015" - with tools.chdir(os.path.join(self._source_subfolder, "Projects", vc_sln_subdir )): - target = "lcms2_DLL" if self.options.shared else "lcms2_static" - if self.settings.compiler == "Visual Studio" and \ - tools.Version(self.settings.compiler.version) <= "12": - upgrade_project = False - else: - upgrade_project = True - # Enable LTO when CFLAGS contains -GL - if any(re.finditer("(^| )[/-]GL($| )", tools.get_env("CFLAGS", ""))): - lto = "true" - else: - lto = "false" - properties = { - "WholeProgramOptimization": lto, - } - # run build - msbuild = MSBuild(self) - msbuild.build("lcms2.sln", targets=[target], platforms={"x86": "Win32"}, - upgrade_project=upgrade_project, properties=properties) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--without-tiff", - "--without-jpeg", - ] - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools + path = os.path.join(self.source_folder, "src", "lcms2_internal.h") + replace_in_file(self, path, "# define vsnprintf _vsnprintf", "") def build(self): self._patch_sources() - if self._is_msvc: - self._build_visual_studio() - else: - shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, - os.path.join(self._source_subfolder, "config.sub")) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, - os.path.join(self._source_subfolder, "config.guess")) - autotools = self._configure_autotools() - autotools.make() + meson = Meson(self) + meson.configure() + meson.build() def package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - if self._is_msvc: - self.copy(pattern="*.h", src=os.path.join(self._source_subfolder, "include"), dst="include", keep_path=True) - if self.options.shared: - self.copy(pattern="*.lib", src=os.path.join(self._source_subfolder, "bin"), dst="lib", keep_path=False) - self.copy(pattern="*.dll", src=os.path.join(self._source_subfolder, "bin"), dst="bin", keep_path=False) - else: - self.copy(pattern="*.lib", src=os.path.join(self._source_subfolder, "Lib", "MS"), dst="lib", - keep_path=False) - else: - autotools = self._configure_autotools() - autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - # remove utilities - if self.settings.os == "Windows" and self.options.shared: - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*[!.dll]") - else: - tools.rmdir(os.path.join(self.package_folder, "bin")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + meson = Meson(self) + meson.install() + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + fix_apple_shared_install_name(self) + fix_msvc_libname(self) def package_info(self): self.cpp_info.set_property("pkg_config_name", "lcms2") - suffix = "_static" if self._is_msvc and not self.options.shared else "" - self.cpp_info.libs = ["lcms2{}".format(suffix)] - if self._is_msvc and self.options.shared: + self.cpp_info.libs = ["lcms2"] + if self.settings.os == "Windows" and self.options.shared: self.cpp_info.defines.append("CMS_DLL") if self.settings.os in ("FreeBSD", "Linux"): - self.cpp_info.system_libs.append("m") - - self.cpp_info.names["pkg_config"] = "lcms2" + self.cpp_info.system_libs.extend(["m", "pthread"]) + +def fix_msvc_libname(conanfile, remove_lib_prefix=True): + """remove lib prefix & change extension to .lib""" + from conan.tools.files import rename + from conan.tools.microsoft import is_msvc + import glob + if not is_msvc(conanfile): + return + libdirs = getattr(conanfile.cpp.package, "libdirs") + for libdir in libdirs: + for ext in [".dll.a", ".dll.lib", ".a"]: + full_folder = os.path.join(conanfile.package_folder, libdir) + for filepath in glob.glob(os.path.join(full_folder, f"*{ext}")): + libname = os.path.basename(filepath)[0:-len(ext)] + if remove_lib_prefix and libname[0:3] == "lib": + libname = libname[3:] + rename(conanfile, filepath, os.path.join(os.path.dirname(filepath), f"{libname}.lib")) diff --git a/recipes/lcms/all/patches/2.13.1-0001-fix-msvc-import-lib.patch b/recipes/lcms/all/patches/2.13.1-0001-fix-msvc-import-lib.patch new file mode 100644 index 00000000000000..6200fe4cf44ee4 --- /dev/null +++ b/recipes/lcms/all/patches/2.13.1-0001-fix-msvc-import-lib.patch @@ -0,0 +1,10 @@ +--- a/meson.build ++++ b/meson.build +@@ -73,7 +73,6 @@ liblcms2_lib = library('lcms2', lcms2_srcs, + dependencies: deps, + c_args: cargs, + version: library_version, +- vs_module_defs: 'src/lcms2.def', + install: true, + ) + diff --git a/recipes/lcms/all/test_package/CMakeLists.txt b/recipes/lcms/all/test_package/CMakeLists.txt index 7b9b613cbb24a3..c0d476f3440242 100644 --- a/recipes/lcms/all/test_package/CMakeLists.txt +++ b/recipes/lcms/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(lcms REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE lcms::lcms) diff --git a/recipes/lcms/all/test_package/conanfile.py b/recipes/lcms/all/test_package/conanfile.py index d4128b04507778..98ab55852ad565 100644 --- a/recipes/lcms/all/test_package/conanfile.py +++ b/recipes/lcms/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/lcms/all/test_v1_package/CMakeLists.txt b/recipes/lcms/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/lcms/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/lcms/all/test_v1_package/conanfile.py b/recipes/lcms/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/lcms/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/lcms/config.yml b/recipes/lcms/config.yml index 82126a56f46e64..8a6c0dd7e6e99d 100644 --- a/recipes/lcms/config.yml +++ b/recipes/lcms/config.yml @@ -3,11 +3,3 @@ versions: folder: all "2.13.1": folder: all - "2.12": - folder: all - "2.11": - folder: all - "2.10": - folder: all - "2.9": - folder: all diff --git a/recipes/libaio/all/conandata.yml b/recipes/libaio/all/conandata.yml new file mode 100644 index 00000000000000..e5229e2bd9bde5 --- /dev/null +++ b/recipes/libaio/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.3.113": + url: "https://pagure.io/libaio/archive/libaio-0.3.113/libaio-libaio-0.3.113.tar.gz" + sha256: "716c7059703247344eb066b54ecbc3ca2134f0103307192e6c2b7dab5f9528ab" diff --git a/recipes/libaio/all/conanfile.py b/recipes/libaio/all/conanfile.py new file mode 100644 index 00000000000000..1c6d39e998e828 --- /dev/null +++ b/recipes/libaio/all/conanfile.py @@ -0,0 +1,77 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.env import VirtualRunEnv +from conan.tools.files import copy, get, chdir, rm +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.53.0" + +class LibaioConan(ConanFile): + name = "libaio" + description = "libaio provides the Linux-native API for async I/O." + license = "LGPL-2.1-only" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://pagure.io/libaio" + topics = ("asynchronous", "aio", "async") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": 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) + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") + + def validate(self): + if self.info.settings.os != "Linux": + raise ConanInvalidConfiguration(f"{self.ref} is not supported on {self.info.settings.os}.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + tc = AutotoolsToolchain(self) + tc.generate() + + def build(self): + autotools = Autotools(self) + with chdir(self, self.source_folder): + autotools.make(target="all") + + def package(self): + copy(self, pattern="COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + with chdir(self, self.source_folder): + autotools.make(target="install", args=["prefix=" + self.package_folder]) + + if self.options.shared: + rm(self, "libaio.a", os.path.join(self.package_folder, "lib")) + else: + rm(self, "libaio.so*", os.path.join(self.package_folder, "lib")) + + def package_info(self): + self.cpp_info.libs = ["aio"] diff --git a/recipes/libaio/all/test_package/CMakeLists.txt b/recipes/libaio/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..4515d52910142d --- /dev/null +++ b/recipes/libaio/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(libaio REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libaio::libaio) diff --git a/recipes/libaio/all/test_package/conanfile.py b/recipes/libaio/all/test_package/conanfile.py new file mode 100644 index 00000000000000..e845ae751a3017 --- /dev/null +++ b/recipes/libaio/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libaio/all/test_package/test_package.c b/recipes/libaio/all/test_package/test_package.c new file mode 100644 index 00000000000000..e8a44ee3d19ddf --- /dev/null +++ b/recipes/libaio/all/test_package/test_package.c @@ -0,0 +1,93 @@ +#include +#include +#include +#include +#include +#include +#include + +#define FATAL(...)\ + do {\ + fprintf(stderr, __VA_ARGS__);\ + fprintf(stderr, "\n");\ + assert(0);\ + exit(-1);\ + } while (0) + +static const void handle_error(int err) { +#define DECL_ERR(X) case -X: FATAL("Error "#X"\n"); break; + switch (err) { + DECL_ERR(EFAULT); + DECL_ERR(EINVAL); + DECL_ERR(ENOSYS); + DECL_ERR(EAGAIN); + }; + if (err < 0) FATAL("Unknown error"); +#undef DECL_ERR +} + +#define IO_RUN(F, ...)\ + do {\ + int err = F(__VA_ARGS__);\ + handle_error(err);\ + } while (0) + +#define MB(X) (X * 1024 * 1024) +#define SZ MB(50) + +static const int maxEvents = 10; +char *dst = NULL; // data we are reading +char *src = NULL; // data we are writing +int fd = -1; // file to open + +void check(io_context_t ctx, struct iocb *iocb, long res, long res2) { + size_t i; + if (res2 || res != SZ) FATAL("Error in async IO"); + for (i = 0; i < SZ; ++i) + if (dst[i] != src[i]) FATAL("Error in async copy"); + printf("DONE\n"); + fflush(stdout); +} + +int main (int argc, char *argv[]) { + size_t i; + /* Create a file and fill it with random crap */ + FILE *file = fopen("crap.dat", "wb"); + if (file == NULL) FATAL("Unable to create crap.dat"); + src = (char*)malloc(sizeof(char) * SZ); + for (i = 0; i < SZ; ++i) src[i] = rand(); + size_t nr = fwrite(src, SZ, 1, file); + if (nr != 1) FATAL("Unable to fill crap.dat"); + fclose(file); + + /* Prepare the file to read */ + int fd = open("crap.dat", O_NONBLOCK, 0); + if (fd < 0) FATAL("Error opening file"); + dst = (char*)malloc(sizeof(char) * SZ); + + /* Now use *real* asynchronous IO to read back the file */ + io_context_t ctx; + memset(&ctx, 0, sizeof(ctx)); + IO_RUN (io_queue_init, maxEvents, &ctx); + + /* This is the read job we asynchronously run */ + struct iocb *job = (struct iocb*)malloc(sizeof(struct iocb) * 1); + io_prep_pread(job, fd, dst, SZ, 0); + io_set_callback(job, check); + + /* Issue it now */ + IO_RUN (io_submit, ctx, 1, &job); + + /* Wait for it */ + struct io_event evt; + IO_RUN (io_getevents, ctx, 1, 1, &evt, NULL); + check(ctx, evt.obj, evt.res, evt.res2); + + close(fd); + + free(src); + free(dst); + free(job); + io_destroy(ctx); + return 0; +} diff --git a/recipes/libaio/all/test_v1_package/CMakeLists.txt b/recipes/libaio/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/libaio/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libaio/all/test_v1_package/conanfile.py b/recipes/libaio/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/libaio/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/libaio/config.yml b/recipes/libaio/config.yml new file mode 100644 index 00000000000000..88b2313b77c9bd --- /dev/null +++ b/recipes/libaio/config.yml @@ -0,0 +1,3 @@ +versions: + "0.3.113": + folder: all diff --git a/recipes/libalsa/all/test_package/test_package.c b/recipes/libalsa/all/test_package/test_package.c index 532921eec833ce..5fe270f6f4fcc2 100644 --- a/recipes/libalsa/all/test_package/test_package.c +++ b/recipes/libalsa/all/test_package/test_package.c @@ -1,895 +1,8 @@ - -/* - * This small demo sends a simple sinusoidal wave to your speakers. - */ #include -#include -#include -#include -#include -#include -#include "alsa/asoundlib.h" -#include -#include - - -static time_t get_current_time() -{ - struct timeval tv; - - gettimeofday(&tv, NULL); - - return tv.tv_sec; -} - -static time_t start_time; - -static int is_playing() -{ - return (get_current_time() - start_time) < 5; -} - -static char *device = "plughw:0,0"; /* playback device */ -static snd_pcm_format_t format = SND_PCM_FORMAT_S16; /* sample format */ -static unsigned int rate = 44100; /* stream rate */ -static unsigned int channels = 1; /* count of channels */ -static unsigned int buffer_time = 500000; /* ring buffer length in us */ -static unsigned int period_time = 100000; /* period time in us */ -static double freq = 440; /* sinusoidal wave frequency in Hz */ -static int verbose = 0; /* verbose flag */ -static int resample = 1; /* enable alsa-lib resampling */ -static int period_event = 0; /* produce poll event after each period */ -static snd_pcm_sframes_t buffer_size; -static snd_pcm_sframes_t period_size; -static snd_output_t *output = NULL; -static void generate_sine(const snd_pcm_channel_area_t *areas, - snd_pcm_uframes_t offset, - int count, double *_phase) -{ - static double max_phase = 2. * M_PI; - double phase = *_phase; - double step = max_phase*freq/(double)rate; - unsigned char *samples[channels]; - int steps[channels]; - unsigned int chn; - int format_bits = snd_pcm_format_width(format); - unsigned int maxval = (1 << (format_bits - 1)) - 1; - int bps = format_bits / 8; /* bytes per sample */ - int phys_bps = snd_pcm_format_physical_width(format) / 8; - int big_endian = snd_pcm_format_big_endian(format) == 1; - int to_unsigned = snd_pcm_format_unsigned(format) == 1; - int is_float = (format == SND_PCM_FORMAT_FLOAT_LE || - format == SND_PCM_FORMAT_FLOAT_BE); - /* verify and prepare the contents of areas */ - for (chn = 0; chn < channels; chn++) { - if ((areas[chn].first % 8) != 0) { - printf("areas[%i].first == %i, aborting...\n", chn, areas[chn].first); - exit(EXIT_FAILURE); - } - samples[chn] = /*(signed short *)*/(((unsigned char *)areas[chn].addr) + (areas[chn].first / 8)); - if ((areas[chn].step % 16) != 0) { - printf("areas[%i].step == %i, aborting...\n", chn, areas[chn].step); - exit(EXIT_FAILURE); - } - steps[chn] = areas[chn].step / 8; - samples[chn] += offset * steps[chn]; - } - /* fill the channel areas */ - while (count-- > 0) { - union { - float f; - int i; - } fval; - int res, i; - if (is_float) { - fval.f = sin(phase); - res = fval.i; - } else - res = sin(phase) * maxval; - if (to_unsigned) - res ^= 1U << (format_bits - 1); - for (chn = 0; chn < channels; chn++) { - /* Generate data in native endian format */ - if (big_endian) { - for (i = 0; i < bps; i++) - *(samples[chn] + phys_bps - 1 - i) = (res >> i * 8) & 0xff; - } else { - for (i = 0; i < bps; i++) - *(samples[chn] + i) = (res >> i * 8) & 0xff; - } - samples[chn] += steps[chn]; - } - phase += step; - if (phase >= max_phase) - phase -= max_phase; - } - *_phase = phase; -} -static int set_hwparams(snd_pcm_t *handle, - snd_pcm_hw_params_t *params, - snd_pcm_access_t access) -{ - unsigned int rrate; - snd_pcm_uframes_t size; - int err, dir; - /* choose all parameters */ - err = snd_pcm_hw_params_any(handle, params); - if (err < 0) { - printf("Broken configuration for playback: no configurations available: %s\n", snd_strerror(err)); - return err; - } - /* set hardware resampling */ - err = snd_pcm_hw_params_set_rate_resample(handle, params, resample); - if (err < 0) { - printf("Resampling setup failed for playback: %s\n", snd_strerror(err)); - return err; - } - /* set the interleaved read/write format */ - err = snd_pcm_hw_params_set_access(handle, params, access); - if (err < 0) { - printf("Access type not available for playback: %s\n", snd_strerror(err)); - return err; - } - /* set the sample format */ - err = snd_pcm_hw_params_set_format(handle, params, format); - if (err < 0) { - printf("Sample format not available for playback: %s\n", snd_strerror(err)); - return err; - } - /* set the count of channels */ - err = snd_pcm_hw_params_set_channels(handle, params, channels); - if (err < 0) { - printf("Channels count (%i) not available for playbacks: %s\n", channels, snd_strerror(err)); - return err; - } - /* set the stream rate */ - rrate = rate; - err = snd_pcm_hw_params_set_rate_near(handle, params, &rrate, 0); - if (err < 0) { - printf("Rate %iHz not available for playback: %s\n", rate, snd_strerror(err)); - return err; - } - if (rrate != rate) { - printf("Rate doesn't match (requested %iHz, get %iHz)\n", rate, err); - return -EINVAL; - } - /* set the buffer time */ - err = snd_pcm_hw_params_set_buffer_time_near(handle, params, &buffer_time, &dir); - if (err < 0) { - printf("Unable to set buffer time %i for playback: %s\n", buffer_time, snd_strerror(err)); - return err; - } - err = snd_pcm_hw_params_get_buffer_size(params, &size); - if (err < 0) { - printf("Unable to get buffer size for playback: %s\n", snd_strerror(err)); - return err; - } - buffer_size = size; - /* set the period time */ - err = snd_pcm_hw_params_set_period_time_near(handle, params, &period_time, &dir); - if (err < 0) { - printf("Unable to set period time %i for playback: %s\n", period_time, snd_strerror(err)); - return err; - } - err = snd_pcm_hw_params_get_period_size(params, &size, &dir); - if (err < 0) { - printf("Unable to get period size for playback: %s\n", snd_strerror(err)); - return err; - } - period_size = size; - /* write the parameters to device */ - err = snd_pcm_hw_params(handle, params); - if (err < 0) { - printf("Unable to set hw params for playback: %s\n", snd_strerror(err)); - return err; - } - return 0; -} -static int set_swparams(snd_pcm_t *handle, snd_pcm_sw_params_t *swparams) -{ - int err; - /* get the current swparams */ - err = snd_pcm_sw_params_current(handle, swparams); - if (err < 0) { - printf("Unable to determine current swparams for playback: %s\n", snd_strerror(err)); - return err; - } - /* start the transfer when the buffer is almost full: */ - /* (buffer_size / avail_min) * avail_min */ - err = snd_pcm_sw_params_set_start_threshold(handle, swparams, (buffer_size / period_size) * period_size); - if (err < 0) { - printf("Unable to set start threshold mode for playback: %s\n", snd_strerror(err)); - return err; - } - /* allow the transfer when at least period_size samples can be processed */ - /* or disable this mechanism when period event is enabled (aka interrupt like style processing) */ - err = snd_pcm_sw_params_set_avail_min(handle, swparams, period_event ? buffer_size : period_size); - if (err < 0) { - printf("Unable to set avail min for playback: %s\n", snd_strerror(err)); - return err; - } - /* enable period events when requested */ - if (period_event) { - err = snd_pcm_sw_params_set_period_event(handle, swparams, 1); - if (err < 0) { - printf("Unable to set period event: %s\n", snd_strerror(err)); - return err; - } - } - /* write the parameters to the playback device */ - err = snd_pcm_sw_params(handle, swparams); - if (err < 0) { - printf("Unable to set sw params for playback: %s\n", snd_strerror(err)); - return err; - } - return 0; -} -/* - * Underrun and suspend recovery - */ - -static int xrun_recovery(snd_pcm_t *handle, int err) -{ - if (verbose) - printf("stream recovery\n"); - if (err == -EPIPE) { /* under-run */ - err = snd_pcm_prepare(handle); - if (err < 0) - printf("Can't recovery from underrun, prepare failed: %s\n", snd_strerror(err)); - return 0; - } else if (err == -ESTRPIPE) { - while ((err = snd_pcm_resume(handle)) == -EAGAIN) - sleep(1); /* wait until the suspend flag is released */ - if (err < 0) { - err = snd_pcm_prepare(handle); - if (err < 0) - printf("Can't recovery from suspend, prepare failed: %s\n", snd_strerror(err)); - } - return 0; - } - return err; -} -/* - * Transfer method - write only - */ -static int write_loop(snd_pcm_t *handle, - signed short *samples, - snd_pcm_channel_area_t *areas) -{ - double phase = 0; - signed short *ptr; - int err, cptr; - while (is_playing()) { - generate_sine(areas, 0, period_size, &phase); - ptr = samples; - cptr = period_size; - while (cptr > 0) { - err = snd_pcm_writei(handle, ptr, cptr); - if (err == -EAGAIN) - continue; - if (err < 0) { - if (xrun_recovery(handle, err) < 0) { - printf("Write error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - break; /* skip one period */ - } - ptr += err * channels; - cptr -= err; - } - } -} - -/* - * Transfer method - write and wait for room in buffer using poll - */ -static int wait_for_poll(snd_pcm_t *handle, struct pollfd *ufds, unsigned int count) -{ - unsigned short revents; - while (is_playing()) { - poll(ufds, count, -1); - snd_pcm_poll_descriptors_revents(handle, ufds, count, &revents); - if (revents & POLLERR) - return -EIO; - if (revents & POLLOUT) - return 0; - } -} -static int write_and_poll_loop(snd_pcm_t *handle, - signed short *samples, - snd_pcm_channel_area_t *areas) -{ - struct pollfd *ufds; - double phase = 0; - signed short *ptr; - int err, count, cptr, init; - count = snd_pcm_poll_descriptors_count (handle); - if (count <= 0) { - printf("Invalid poll descriptors count\n"); - return count; - } - ufds = malloc(sizeof(struct pollfd) * count); - if (ufds == NULL) { - printf("No enough memory\n"); - return -ENOMEM; - } - if ((err = snd_pcm_poll_descriptors(handle, ufds, count)) < 0) { - printf("Unable to obtain poll descriptors for playback: %s\n", snd_strerror(err)); - return err; - } - init = 1; - while (is_playing()) { - if (!init) { - err = wait_for_poll(handle, ufds, count); - if (err < 0) { - if (snd_pcm_state(handle) == SND_PCM_STATE_XRUN || - snd_pcm_state(handle) == SND_PCM_STATE_SUSPENDED) { - err = snd_pcm_state(handle) == SND_PCM_STATE_XRUN ? -EPIPE : -ESTRPIPE; - if (xrun_recovery(handle, err) < 0) { - printf("Write error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - init = 1; - } else { - printf("Wait for poll failed\n"); - return err; - } - } - } - generate_sine(areas, 0, period_size, &phase); - ptr = samples; - cptr = period_size; - while (cptr > 0) { - err = snd_pcm_writei(handle, ptr, cptr); - if (err < 0) { - if (xrun_recovery(handle, err) < 0) { - printf("Write error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - init = 1; - break; /* skip one period */ - } - if (snd_pcm_state(handle) == SND_PCM_STATE_RUNNING) - init = 0; - ptr += err * channels; - cptr -= err; - if (cptr == 0) - break; - /* it is possible, that the initial buffer cannot store */ - /* all data from the last period, so wait awhile */ - err = wait_for_poll(handle, ufds, count); - if (err < 0) { - if (snd_pcm_state(handle) == SND_PCM_STATE_XRUN || - snd_pcm_state(handle) == SND_PCM_STATE_SUSPENDED) { - err = snd_pcm_state(handle) == SND_PCM_STATE_XRUN ? -EPIPE : -ESTRPIPE; - if (xrun_recovery(handle, err) < 0) { - printf("Write error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - init = 1; - } else { - printf("Wait for poll failed\n"); - return err; - } - } - } - } -} -/* - * Transfer method - asynchronous notification - */ -struct async_private_data { - signed short *samples; - snd_pcm_channel_area_t *areas; - double phase; -}; -static void async_callback(snd_async_handler_t *ahandler) -{ - snd_pcm_t *handle = snd_async_handler_get_pcm(ahandler); - struct async_private_data *data = snd_async_handler_get_callback_private(ahandler); - signed short *samples = data->samples; - snd_pcm_channel_area_t *areas = data->areas; - snd_pcm_sframes_t avail; - int err; - - avail = snd_pcm_avail_update(handle); - while (avail >= period_size) { - generate_sine(areas, 0, period_size, &data->phase); - err = snd_pcm_writei(handle, samples, period_size); - if (err < 0) { - printf("Write error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - if (err != period_size) { - printf("Write error: written %i expected %li\n", err, period_size); - exit(EXIT_FAILURE); - } - avail = snd_pcm_avail_update(handle); - } -} -static int async_loop(snd_pcm_t *handle, - signed short *samples, - snd_pcm_channel_area_t *areas) -{ - struct async_private_data data; - snd_async_handler_t *ahandler; - int err, count; - data.samples = samples; - data.areas = areas; - data.phase = 0; - err = snd_async_add_pcm_handler(&ahandler, handle, async_callback, &data); - if (err < 0) { - printf("Unable to register async handler\n"); - exit(EXIT_FAILURE); - } - for (count = 0; count < 2; count++) { - generate_sine(areas, 0, period_size, &data.phase); - err = snd_pcm_writei(handle, samples, period_size); - if (err < 0) { - printf("Initial write error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - if (err != period_size) { - printf("Initial write error: written %i expected %li\n", err, period_size); - exit(EXIT_FAILURE); - } - } - if (snd_pcm_state(handle) == SND_PCM_STATE_PREPARED) { - err = snd_pcm_start(handle); - if (err < 0) { - printf("Start error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - } - /* because all other work is done in the signal handler, - suspend the process */ - while (is_playing()) { - sleep(1); - } -} -/* - * Transfer method - asynchronous notification + direct write - */ -static void async_direct_callback(snd_async_handler_t *ahandler) -{ - snd_pcm_t *handle = snd_async_handler_get_pcm(ahandler); - struct async_private_data *data = snd_async_handler_get_callback_private(ahandler); - const snd_pcm_channel_area_t *my_areas; - snd_pcm_uframes_t offset, frames, size; - snd_pcm_sframes_t avail, commitres; - snd_pcm_state_t state; - int first = 0, err; - - while (is_playing()) { - state = snd_pcm_state(handle); - if (state == SND_PCM_STATE_XRUN) { - err = xrun_recovery(handle, -EPIPE); - if (err < 0) { - printf("XRUN recovery failed: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - first = 1; - } else if (state == SND_PCM_STATE_SUSPENDED) { - err = xrun_recovery(handle, -ESTRPIPE); - if (err < 0) { - printf("SUSPEND recovery failed: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - } - avail = snd_pcm_avail_update(handle); - if (avail < 0) { - err = xrun_recovery(handle, avail); - if (err < 0) { - printf("avail update failed: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - first = 1; - continue; - } - if (avail < period_size) { - if (first) { - first = 0; - err = snd_pcm_start(handle); - if (err < 0) { - printf("Start error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - } else { - break; - } - continue; - } - size = period_size; - while (size > 0) { - frames = size; - err = snd_pcm_mmap_begin(handle, &my_areas, &offset, &frames); - if (err < 0) { - if ((err = xrun_recovery(handle, err)) < 0) { - printf("MMAP begin avail error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - first = 1; - } - generate_sine(my_areas, offset, frames, &data->phase); - commitres = snd_pcm_mmap_commit(handle, offset, frames); - if (commitres < 0 || (snd_pcm_uframes_t)commitres != frames) { - if ((err = xrun_recovery(handle, commitres >= 0 ? -EPIPE : commitres)) < 0) { - printf("MMAP commit error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - first = 1; - } - size -= frames; - } - } -} -static int async_direct_loop(snd_pcm_t *handle, - signed short *samples ATTRIBUTE_UNUSED, - snd_pcm_channel_area_t *areas ATTRIBUTE_UNUSED) -{ - struct async_private_data data; - snd_async_handler_t *ahandler; - const snd_pcm_channel_area_t *my_areas; - snd_pcm_uframes_t offset, frames, size; - snd_pcm_sframes_t commitres; - int err, count; - data.samples = NULL; /* we do not require the global sample area for direct write */ - data.areas = NULL; /* we do not require the global areas for direct write */ - data.phase = 0; - err = snd_async_add_pcm_handler(&ahandler, handle, async_direct_callback, &data); - if (err < 0) { - printf("Unable to register async handler\n"); - exit(EXIT_FAILURE); - } - for (count = 0; count < 2; count++) { - size = period_size; - while (size > 0) { - frames = size; - err = snd_pcm_mmap_begin(handle, &my_areas, &offset, &frames); - if (err < 0) { - if ((err = xrun_recovery(handle, err)) < 0) { - printf("MMAP begin avail error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - } - generate_sine(my_areas, offset, frames, &data.phase); - commitres = snd_pcm_mmap_commit(handle, offset, frames); - if (commitres < 0 || (snd_pcm_uframes_t)commitres != frames) { - if ((err = xrun_recovery(handle, commitres >= 0 ? -EPIPE : commitres)) < 0) { - printf("MMAP commit error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - } - size -= frames; - } - } - err = snd_pcm_start(handle); - if (err < 0) { - printf("Start error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - /* because all other work is done in the signal handler, - suspend the process */ - while (is_playing()) { - sleep(1); - } -} -/* - * Transfer method - direct write only - */ -static int direct_loop(snd_pcm_t *handle, - signed short *samples ATTRIBUTE_UNUSED, - snd_pcm_channel_area_t *areas ATTRIBUTE_UNUSED) -{ - double phase = 0; - const snd_pcm_channel_area_t *my_areas; - snd_pcm_uframes_t offset, frames, size; - snd_pcm_sframes_t avail, commitres; - snd_pcm_state_t state; - int err, first = 1; - while (is_playing()) { - state = snd_pcm_state(handle); - if (state == SND_PCM_STATE_XRUN) { - err = xrun_recovery(handle, -EPIPE); - if (err < 0) { - printf("XRUN recovery failed: %s\n", snd_strerror(err)); - return err; - } - first = 1; - } else if (state == SND_PCM_STATE_SUSPENDED) { - err = xrun_recovery(handle, -ESTRPIPE); - if (err < 0) { - printf("SUSPEND recovery failed: %s\n", snd_strerror(err)); - return err; - } - } - avail = snd_pcm_avail_update(handle); - if (avail < 0) { - err = xrun_recovery(handle, avail); - if (err < 0) { - printf("avail update failed: %s\n", snd_strerror(err)); - return err; - } - first = 1; - continue; - } - if (avail < period_size) { - if (first) { - first = 0; - err = snd_pcm_start(handle); - if (err < 0) { - printf("Start error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - } else { - err = snd_pcm_wait(handle, -1); - if (err < 0) { - if ((err = xrun_recovery(handle, err)) < 0) { - printf("snd_pcm_wait error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - first = 1; - } - } - continue; - } - size = period_size; - while (size > 0) { - frames = size; - err = snd_pcm_mmap_begin(handle, &my_areas, &offset, &frames); - if (err < 0) { - if ((err = xrun_recovery(handle, err)) < 0) { - printf("MMAP begin avail error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - first = 1; - } - generate_sine(my_areas, offset, frames, &phase); - commitres = snd_pcm_mmap_commit(handle, offset, frames); - if (commitres < 0 || (snd_pcm_uframes_t)commitres != frames) { - if ((err = xrun_recovery(handle, commitres >= 0 ? -EPIPE : commitres)) < 0) { - printf("MMAP commit error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - first = 1; - } - size -= frames; - } - } -} - -/* - * Transfer method - direct write only using mmap_write functions - */ -static int direct_write_loop(snd_pcm_t *handle, - signed short *samples, - snd_pcm_channel_area_t *areas) -{ - double phase = 0; - signed short *ptr; - int err, cptr; - while (is_playing()) { - generate_sine(areas, 0, period_size, &phase); - ptr = samples; - cptr = period_size; - while (cptr > 0) { - err = snd_pcm_mmap_writei(handle, ptr, cptr); - if (err == -EAGAIN) - continue; - if (err < 0) { - if (xrun_recovery(handle, err) < 0) { - printf("Write error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - break; /* skip one period */ - } - ptr += err * channels; - cptr -= err; - } - } -} +#include -/* - * - */ -struct transfer_method { - const char *name; - snd_pcm_access_t access; - int (*transfer_loop)(snd_pcm_t *handle, - signed short *samples, - snd_pcm_channel_area_t *areas); -}; -static struct transfer_method transfer_methods[] = { - { "write", SND_PCM_ACCESS_RW_INTERLEAVED, write_loop }, - { "write_and_poll", SND_PCM_ACCESS_RW_INTERLEAVED, write_and_poll_loop }, - { "async", SND_PCM_ACCESS_RW_INTERLEAVED, async_loop }, - { "async_direct", SND_PCM_ACCESS_MMAP_INTERLEAVED, async_direct_loop }, - { "direct_interleaved", SND_PCM_ACCESS_MMAP_INTERLEAVED, direct_loop }, - { "direct_noninterleaved", SND_PCM_ACCESS_MMAP_NONINTERLEAVED, direct_loop }, - { "direct_write", SND_PCM_ACCESS_MMAP_INTERLEAVED, direct_write_loop }, - { NULL, SND_PCM_ACCESS_RW_INTERLEAVED, NULL } -}; -static void help(void) -{ - int k; - printf( -"Usage: pcm [OPTION]... [FILE]...\n" -"-h,--help help\n" -"-D,--device playback device\n" -"-r,--rate stream rate in Hz\n" -"-c,--channels count of channels in stream\n" -"-f,--frequency sine wave frequency in Hz\n" -"-b,--buffer ring buffer size in us\n" -"-p,--period period size in us\n" -"-m,--method transfer method\n" -"-o,--format sample format\n" -"-v,--verbose show the PCM setup parameters\n" -"-n,--noresample do not resample\n" -"-e,--pevent enable poll event after each period\n" -"\n"); - printf("Recognized sample formats are:"); - for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) { - const char *s = snd_pcm_format_name(k); - if (s) - printf(" %s", s); - } - printf("\n"); - printf("Recognized transfer methods are:"); - for (k = 0; transfer_methods[k].name; k++) - printf(" %s", transfer_methods[k].name); - printf("\n"); -} -int main(int argc, char *argv[]) +int main() { - struct option long_option[] = - { - {"help", 0, NULL, 'h'}, - {"device", 1, NULL, 'D'}, - {"rate", 1, NULL, 'r'}, - {"channels", 1, NULL, 'c'}, - {"frequency", 1, NULL, 'f'}, - {"buffer", 1, NULL, 'b'}, - {"period", 1, NULL, 'p'}, - {"method", 1, NULL, 'm'}, - {"format", 1, NULL, 'o'}, - {"verbose", 1, NULL, 'v'}, - {"noresample", 1, NULL, 'n'}, - {"pevent", 1, NULL, 'e'}, - {NULL, 0, NULL, 0}, - }; - snd_pcm_t *handle; - int err, morehelp; - snd_pcm_hw_params_t *hwparams; - snd_pcm_sw_params_t *swparams; - int method = 0; - signed short *samples; - unsigned int chn; - snd_pcm_channel_area_t *areas; - snd_pcm_hw_params_alloca(&hwparams); - snd_pcm_sw_params_alloca(&swparams); - morehelp = 0; - start_time = get_current_time(); - - while (1) { - int c; - if ((c = getopt_long(argc, argv, "hD:r:c:f:b:p:m:o:vne", long_option, NULL)) < 0) - break; - switch (c) { - case 'h': - morehelp++; - break; - case 'D': - device = strdup(optarg); - break; - case 'r': - rate = atoi(optarg); - rate = rate < 4000 ? 4000 : rate; - rate = rate > 196000 ? 196000 : rate; - break; - case 'c': - channels = atoi(optarg); - channels = channels < 1 ? 1 : channels; - channels = channels > 1024 ? 1024 : channels; - break; - case 'f': - freq = atoi(optarg); - freq = freq < 50 ? 50 : freq; - freq = freq > 5000 ? 5000 : freq; - break; - case 'b': - buffer_time = atoi(optarg); - buffer_time = buffer_time < 1000 ? 1000 : buffer_time; - buffer_time = buffer_time > 1000000 ? 1000000 : buffer_time; - break; - case 'p': - period_time = atoi(optarg); - period_time = period_time < 1000 ? 1000 : period_time; - period_time = period_time > 1000000 ? 1000000 : period_time; - break; - case 'm': - for (method = 0; transfer_methods[method].name; method++) - if (!strcasecmp(transfer_methods[method].name, optarg)) - break; - if (transfer_methods[method].name == NULL) - method = 0; - break; - case 'o': - for (format = 0; format < SND_PCM_FORMAT_LAST; format++) { - const char *format_name = snd_pcm_format_name(format); - if (format_name) - if (!strcasecmp(format_name, optarg)) - break; - } - if (format == SND_PCM_FORMAT_LAST) - format = SND_PCM_FORMAT_S16; - if (!snd_pcm_format_linear(format) && - !(format == SND_PCM_FORMAT_FLOAT_LE || - format == SND_PCM_FORMAT_FLOAT_BE)) { - printf("Invalid (non-linear/float) format %s\n", - optarg); - return 1; - } - break; - case 'v': - verbose = 1; - break; - case 'n': - resample = 0; - break; - case 'e': - period_event = 1; - break; - } - } - if (morehelp) { - help(); - return 0; - } - err = snd_output_stdio_attach(&output, stdout, 0); - if (err < 0) { - printf("Output failed: %s\n", snd_strerror(err)); - return 0; - } - printf("Playback device is %s\n", device); - printf("Stream parameters are %iHz, %s, %i channels\n", rate, snd_pcm_format_name(format), channels); - printf("Sine wave rate is %.4fHz\n", freq); - printf("Using transfer method: %s\n", transfer_methods[method].name); - if ((err = snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) { - printf("Playback open error: %s\n", snd_strerror(err)); - return 0; - } - - if ((err = set_hwparams(handle, hwparams, transfer_methods[method].access)) < 0) { - printf("Setting of hwparams failed: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - if ((err = set_swparams(handle, swparams)) < 0) { - printf("Setting of swparams failed: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - if (verbose > 0) - snd_pcm_dump(handle, output); - samples = malloc((period_size * channels * snd_pcm_format_physical_width(format)) / 8); - if (samples == NULL) { - printf("No enough memory\n"); - exit(EXIT_FAILURE); - } - - areas = calloc(channels, sizeof(snd_pcm_channel_area_t)); - if (areas == NULL) { - printf("No enough memory\n"); - exit(EXIT_FAILURE); - } - for (chn = 0; chn < channels; chn++) { - areas[chn].addr = samples; - areas[chn].first = chn * snd_pcm_format_physical_width(format); - areas[chn].step = channels * snd_pcm_format_physical_width(format); - } - err = transfer_methods[method].transfer_loop(handle, samples, areas); - if (err < 0) - printf("Transfer failed: %s\n", snd_strerror(err)); - free(areas); - free(samples); - snd_pcm_close(handle); - return 0; + printf("libalsa version %s\n", snd_asoundlib_version()); + return 0; } diff --git a/recipes/libalsa/all/test_v1_package/CMakeLists.txt b/recipes/libalsa/all/test_v1_package/CMakeLists.txt index 690e8d6667c907..925ecbe19e448d 100644 --- a/recipes/libalsa/all/test_v1_package/CMakeLists.txt +++ b/recipes/libalsa/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(ALSA REQUIRED) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE ALSA::ALSA) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libarchive/all/conandata.yml b/recipes/libarchive/all/conandata.yml index dd56f7af959bf8..9a164839a427bb 100644 --- a/recipes/libarchive/all/conandata.yml +++ b/recipes/libarchive/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.6.2": + url: "https://github.com/libarchive/libarchive/releases/download/v3.6.2/libarchive-3.6.2.tar.xz" + sha256: "9e2c1b80d5fbe59b61308fdfab6c79b5021d7ff4ff2489fb12daf0a96a83551d" "3.6.1": url: "https://github.com/libarchive/libarchive/releases/download/v3.6.1/libarchive-3.6.1.tar.xz" sha256: "5a411aceb978f43e626f0c2d1812ddd8807b645ed892453acabd532376c148e6" @@ -18,6 +21,16 @@ sources: url: "https://github.com/libarchive/libarchive/releases/download/v3.4.0/libarchive-3.4.0.tar.gz" sha256: "8643d50ed40c759f5412a3af4e353cffbce4fdf3b5cf321cb72cacf06b2d825e" patches: + "3.6.2": + - patch_file: "patches/0001-3.6.2-zlib-winapi.patch" + patch_description: "Remove broken ZLIB WINAPI check" + patch_type: "portability" + - patch_file: "patches/0003-3.6.2-cmake.patch" + patch_description: "Make CMake build-system compatible with Conan" + patch_type: "conan" + - patch_file: "patches/0005-3.6.2-try-compile-cmakedeps.patch" + patch_description: "Patch try_compile check to work with imported CMake targets from Conan packages" + patch_type: "conan" "3.6.1": - patch_file: "patches/0001-3.6.0-zlib-winapi.patch" patch_description: "Remove broken ZLIB WINAPI check" diff --git a/recipes/libarchive/all/conanfile.py b/recipes/libarchive/all/conanfile.py index 32b26cd316c4b9..b5ea492609f904 100644 --- a/recipes/libarchive/all/conanfile.py +++ b/recipes/libarchive/all/conanfile.py @@ -1,19 +1,18 @@ from conan import ConanFile -from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain +from conan.tools.cmake import CMake, cmake_layout, CMakeDeps, CMakeToolchain from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, rmdir -from conan.tools.layout import cmake_layout from conan.tools.microsoft import is_msvc from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class LibarchiveConan(ConanFile): name = "libarchive" description = "Multi-format archive and compression library" - topics = "tar", "data-compressor", "file-compression" + topics = "archive", "compression", "tar", "data-compressor", "file-compression" url = "https://github.com/conan-io/conan-center-index" homepage = "https://libarchive.org" license = "BSD-2-Clause" @@ -72,18 +71,9 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def requirements(self): if self.options.with_zlib: @@ -91,9 +81,9 @@ def requirements(self): if self.options.with_bzip2: self.requires("bzip2/1.0.8") if self.options.with_libxml2: - self.requires("libxml2/2.9.14") + self.requires("libxml2/2.10.3") if self.options.with_expat: - self.requires("expat/2.4.9") + self.requires("expat/2.5.0") if self.options.with_iconv: self.requires("libiconv/1.17") if self.options.with_pcreposix: @@ -101,7 +91,7 @@ def requirements(self): if self.options.with_nettle: self.requires("nettle/3.8.1") if self.options.with_openssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/3.0.7") if self.options.with_libb2: self.requires("libb2/20190723") if self.options.with_lz4: @@ -109,7 +99,7 @@ def requirements(self): if self.options.with_lzo: self.requires("lzo/2.10") if self.options.with_lzma: - self.requires("xz_utils/5.2.5") + self.requires("xz_utils/5.4.0") if self.options.with_zstd: self.requires("zstd/1.5.2") if self.options.get_safe("with_mbedtls"): diff --git a/recipes/libarchive/all/patches/0001-3.6.2-zlib-winapi.patch b/recipes/libarchive/all/patches/0001-3.6.2-zlib-winapi.patch new file mode 100644 index 00000000000000..62dd3ef8198757 --- /dev/null +++ b/recipes/libarchive/all/patches/0001-3.6.2-zlib-winapi.patch @@ -0,0 +1,20 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 713e3bc..2315da5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -430,14 +430,7 @@ IF(ZLIB_FOUND) + INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES}) + IF(WIN32 AND NOT CYGWIN) +- # +- # Test if ZLIB_WINAPI macro is needed to use. +- # +- TRY_MACRO_FOR_LIBRARY( +- "${ZLIB_INCLUDE_DIR}" "${ZLIB_LIBRARIES}" +- RUNS +- "#include \nint main() {uLong f = zlibCompileFlags(); return (f&(1U<<10))?0:-1; }" +- ZLIB_WINAPI) ++ set(ZLIB_WINAPI yes) + IF(ZLIB_WINAPI) + ADD_DEFINITIONS(-DZLIB_WINAPI) + ELSE(ZLIB_WINAPI) diff --git a/recipes/libarchive/all/patches/0003-3.6.2-cmake.patch b/recipes/libarchive/all/patches/0003-3.6.2-cmake.patch new file mode 100644 index 00000000000000..80d49396aac872 --- /dev/null +++ b/recipes/libarchive/all/patches/0003-3.6.2-cmake.patch @@ -0,0 +1,103 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2315da5..1d8de96 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -9,7 +9,7 @@ endif() + # + PROJECT(libarchive C) + # +-SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake") ++list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake") + if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${libarchive_BINARY_DIR}/bin) + endif() +@@ -428,7 +428,7 @@ IF(ZLIB_FOUND) + SET(HAVE_LIBZ 1) + SET(HAVE_ZLIB_H 1) + INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) +- LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES}) ++ LIST(APPEND ADDITIONAL_LIBS ZLIB::ZLIB) + IF(WIN32 AND NOT CYGWIN) + set(ZLIB_WINAPI yes) + IF(ZLIB_WINAPI) +@@ -490,7 +490,7 @@ IF(LIBLZMA_FOUND) + SET(HAVE_LIBLZMA 1) + SET(HAVE_LZMA_H 1) + CMAKE_PUSH_CHECK_STATE() +- SET(CMAKE_REQUIRED_INCLUDES ${LIBLZMA_INCLUDE_DIR}) ++ SET(CMAKE_REQUIRED_INCLUDES ${LIBLZMA_INCLUDE_DIRS}) + SET(CMAKE_REQUIRED_LIBRARIES ${LIBLZMA_LIBRARIES}) + INCLUDE_DIRECTORIES(${LIBLZMA_INCLUDE_DIRS}) + LIST(APPEND ADDITIONAL_LIBS ${LIBLZMA_LIBRARIES}) +@@ -507,7 +507,7 @@ IF(LIBLZMA_FOUND) + ELSE(LIBLZMA_FOUND) + # LZMA not found and will not be used. + ENDIF(LIBLZMA_FOUND) +-MARK_AS_ADVANCED(CLEAR LIBLZMA_INCLUDE_DIR) ++MARK_AS_ADVANCED(CLEAR LIBLZMA_INCLUDE_DIRS) + MARK_AS_ADVANCED(CLEAR LIBLZMA_LIBRARY) + + # +@@ -577,7 +577,7 @@ IF(ENABLE_LZ4) + ENDIF (LZ4_INCLUDE_DIR) + + FIND_PATH(LZ4_INCLUDE_DIR lz4.h) +- FIND_LIBRARY(LZ4_LIBRARY NAMES lz4 liblz4) ++ FIND_LIBRARY(LZ4_LIBRARY NAMES lz4 liblz4 lz4_static liblz4_static) + INCLUDE(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZ4 DEFAULT_MSG LZ4_LIBRARY LZ4_INCLUDE_DIR) + ELSE(ENABLE_LZ4) +@@ -799,7 +799,7 @@ ENDIF(ENABLE_NETTLE) + # Find OpenSSL + # (Except on Mac, where OpenSSL is deprecated.) + # +-IF(ENABLE_OPENSSL AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") ++IF(ENABLE_OPENSSL) + FIND_PACKAGE(OpenSSL) + IF(OPENSSL_FOUND) + SET(HAVE_LIBCRYPTO 1) +diff --git a/libarchive/CMakeLists.txt b/libarchive/CMakeLists.txt +index ff7ade0..1438819 100644 +--- a/libarchive/CMakeLists.txt ++++ b/libarchive/CMakeLists.txt +@@ -243,11 +243,14 @@ ELSEIF(ARCHIVE_ACL_SUNOS) + ENDIF() + + # Libarchive is a shared library ++if (BUILD_SHARED_LIBS) + ADD_LIBRARY(archive SHARED ${libarchive_SOURCES} ${include_HEADERS}) + TARGET_INCLUDE_DIRECTORIES(archive PUBLIC .) + TARGET_LINK_LIBRARIES(archive ${ADDITIONAL_LIBS}) + SET_TARGET_PROPERTIES(archive PROPERTIES SOVERSION ${SOVERSION}) + ++else() ++ + # archive_static is a static library + ADD_LIBRARY(archive_static STATIC ${libarchive_SOURCES} ${include_HEADERS}) + TARGET_LINK_LIBRARIES(archive_static ${ADDITIONAL_LIBS}) +@@ -257,13 +260,21 @@ SET_TARGET_PROPERTIES(archive_static PROPERTIES COMPILE_DEFINITIONS + IF(NOT WIN32 OR CYGWIN) + SET_TARGET_PROPERTIES(archive_static PROPERTIES OUTPUT_NAME archive) + ENDIF(NOT WIN32 OR CYGWIN) ++endif() + + IF(ENABLE_INSTALL) + # How to install the libraries +- INSTALL(TARGETS archive archive_static +- RUNTIME DESTINATION bin +- LIBRARY DESTINATION lib +- ARCHIVE DESTINATION lib) ++ if (BUILD_SHARED_LIBS) ++ INSTALL(TARGETS archive ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib) ++ else() ++ INSTALL(TARGETS archive_static ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib) ++ endif() + INSTALL_MAN(${libarchive_MANS}) + INSTALL(FILES ${include_HEADERS} DESTINATION include) + ENDIF() diff --git a/recipes/libarchive/all/patches/0005-3.6.2-try-compile-cmakedeps.patch b/recipes/libarchive/all/patches/0005-3.6.2-try-compile-cmakedeps.patch new file mode 100644 index 00000000000000..4bca48088c19b8 --- /dev/null +++ b/recipes/libarchive/all/patches/0005-3.6.2-try-compile-cmakedeps.patch @@ -0,0 +1,31 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1d8de96f..d54975b7 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -829,6 +829,8 @@ ENDIF(NOT OPENSSL_FOUND) + # + MACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION) + FOREACH(ALGORITHM ${ALGORITHMS}) ++ include(CMakePushCheckState) ++ cmake_push_check_state() + IF(NOT ARCHIVE_CRYPTO_${ALGORITHM}) + STRING(TOLOWER "${ALGORITHM}" lower_algorithm) + STRING(TOUPPER "${ALGORITHM}" algorithm) +@@ -849,8 +851,7 @@ MACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION) + IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) + SET(TRY_CRYPTO_REQUIRED_INCLUDES + "${TRY_CRYPTO_REQUIRED_INCLUDES};${OPENSSL_INCLUDE_DIR}") +- SET(TRY_CRYPTO_REQUIRED_LIBS +- "-DLINK_LIBRARIES:STRING=${OPENSSL_LIBRARIES}") ++ set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES}) + ELSEIF("${IMPLEMENTATION}" MATCHES "^MBEDTLS$" AND MBEDTLS_FOUND) + SET(TRY_CRYPTO_REQUIRED_INCLUDES + "${TRY_CRYPTO_REQUIRED_INCLUDES};${MBEDTLS_INCLUDE_DIRS}") +@@ -927,6 +928,7 @@ main(int argc, char **argv) + ENDIF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) + ENDIF (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) + ENDIF(NOT ARCHIVE_CRYPTO_${ALGORITHM}) ++ cmake_pop_check_state() + ENDFOREACH(ALGORITHM ${ALGORITHMS}) + ENDMACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION) + diff --git a/recipes/libarchive/config.yml b/recipes/libarchive/config.yml index 5e7bb50cad34c1..2cfb62acf52281 100644 --- a/recipes/libarchive/config.yml +++ b/recipes/libarchive/config.yml @@ -1,4 +1,6 @@ versions: + "3.6.2": + folder: all "3.6.1": folder: all "3.6.0": diff --git a/recipes/libavif/all/conandata.yml b/recipes/libavif/all/conandata.yml index 8c5ef7fb45af60..1889bd2ede18fd 100644 --- a/recipes/libavif/all/conandata.yml +++ b/recipes/libavif/all/conandata.yml @@ -1,8 +1,20 @@ sources: + "0.11.1": + url: "https://github.com/AOMediaCodec/libavif/archive/refs/tags/v0.11.1.tar.gz" + sha256: "0eb49965562a0e5e5de58389650d434cff32af84c34185b6c9b7b2fccae06d4e" "0.9.3": + url: "https://github.com/AOMediaCodec/libavif/archive/refs/tags/v0.9.3.tar.gz" sha256: "bcd9a1f57f982a9615eb7e2faf87236dc88eb1d0c886f3471c7440ead605060d" - url: https://github.com/AOMediaCodec/libavif/archive/refs/tags/v0.9.3.tar.gz patches: + "0.11.1": + - patch_file: patches/0.11.1-0001-disable-developer-only-codepaths.patch + patch_description: "disable compiler options for develop" + patch_type: "portability" "0.9.3": - - patch_file: patches/0001-disable-developer-only-codepaths.patch - - patch_file: patches/0002-fix-libyuv-version-handling.patch + - patch_file: patches/0.9.3-0001-disable-developer-only-codepaths.patch + patch_description: "disable compiler options for develop" + patch_type: "portability" + - patch_file: patches/0.9.3-0002-fix-libyuv-version-handling.patch + patch_description: "support libyuv API modification" + patch_type: "backport" + patch_source: "https://github.com/AOMediaCodec/libavif/issues/781" diff --git a/recipes/libavif/all/conanfile.py b/recipes/libavif/all/conanfile.py index 66b650db87d1da..dc46d0267dd992 100644 --- a/recipes/libavif/all/conanfile.py +++ b/recipes/libavif/all/conanfile.py @@ -4,16 +4,16 @@ import os import textwrap -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class LibAVIFConan(ConanFile): name = "libavif" description = "Library for encoding and decoding .avif files" + license = "BSD-2-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/AOMediaCodec/libavif" - topics = "avif" - license = "BSD-2-Clause" + topics = ("avif") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -35,18 +35,9 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def layout(self): cmake_layout(self, src_folder="src") @@ -56,8 +47,8 @@ def _has_dav1d(self): return self.options.with_decoder == "dav1d" def requirements(self): - self.requires("libaom-av1/3.4.0") - self.requires("libyuv/1841") + self.requires("libaom-av1/3.5.0") + self.requires("libyuv/1854") if self._has_dav1d: self.requires("dav1d/1.0.0") @@ -143,3 +134,4 @@ def package_info(self): self.cpp_info.build_modules["cmake_find_package"] = [self._alias_path] self.cpp_info.build_modules["cmake_find_package_multi"] = \ [self._alias_path] + diff --git a/recipes/libavif/all/patches/0.11.1-0001-disable-developer-only-codepaths.patch b/recipes/libavif/all/patches/0.11.1-0001-disable-developer-only-codepaths.patch new file mode 100644 index 00000000000000..b6e2a81df709ce --- /dev/null +++ b/recipes/libavif/all/patches/0.11.1-0001-disable-developer-only-codepaths.patch @@ -0,0 +1,34 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6d9431c..0f3a1b3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -64,11 +64,13 @@ if(AVIF_LOCAL_LIBGAV1) + enable_language(CXX) + endif() + ++if(0) + if(APPLE) + set(XCRUN xcrun) + else() + set(XCRUN) + endif() ++endif() + + # --------------------------------------------------------------------------------------- + # This insanity is for people embedding libavif or making fully static or Windows builds. +@@ -141,6 +143,7 @@ if(AVIF_LOCAL_LIBSHARPYUV) + endif() + # --------------------------------------------------------------------------------------- + ++if(0) + # Enable all warnings + include(CheckCCompilerFlag) + if(CMAKE_C_COMPILER_ID MATCHES "Clang") +@@ -189,6 +192,7 @@ if(AVIF_ENABLE_COVERAGE) + message(WARNING "libavif: Ignoring request for coverage (AVIF_ENABLE_COVERAGE); only clang is currently supported.") + endif() + endif() ++endif() + + set(AVIF_SRCS + src/alpha.c diff --git a/recipes/libavif/all/patches/0001-disable-developer-only-codepaths.patch b/recipes/libavif/all/patches/0.9.3-0001-disable-developer-only-codepaths.patch similarity index 100% rename from recipes/libavif/all/patches/0001-disable-developer-only-codepaths.patch rename to recipes/libavif/all/patches/0.9.3-0001-disable-developer-only-codepaths.patch diff --git a/recipes/libavif/all/patches/0002-fix-libyuv-version-handling.patch b/recipes/libavif/all/patches/0.9.3-0002-fix-libyuv-version-handling.patch similarity index 100% rename from recipes/libavif/all/patches/0002-fix-libyuv-version-handling.patch rename to recipes/libavif/all/patches/0.9.3-0002-fix-libyuv-version-handling.patch diff --git a/recipes/libavif/all/test_v1_package/CMakeLists.txt b/recipes/libavif/all/test_v1_package/CMakeLists.txt index 23152240acea82..925ecbe19e448d 100644 --- a/recipes/libavif/all/test_v1_package/CMakeLists.txt +++ b/recipes/libavif/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(libavif REQUIRED CONFIG) - -add_executable(test_package ../test_package/test_package.c) -target_link_libraries(test_package PRIVATE avif) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libavif/config.yml b/recipes/libavif/config.yml index 5e19b05d9fa394..f3e6d6038f1fa1 100644 --- a/recipes/libavif/config.yml +++ b/recipes/libavif/config.yml @@ -1,3 +1,5 @@ versions: + "0.11.1": + folder: all "0.9.3": folder: all diff --git a/recipes/libavrocpp/all/CMakeLists.txt b/recipes/libavrocpp/all/CMakeLists.txt deleted file mode 100644 index 596a2f6f95b12a..00000000000000 --- a/recipes/libavrocpp/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder/lang/c++) diff --git a/recipes/libavrocpp/all/conandata.yml b/recipes/libavrocpp/all/conandata.yml index 5f1e3ccbae4994..4db9766f42d9f1 100644 --- a/recipes/libavrocpp/all/conandata.yml +++ b/recipes/libavrocpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.11.1": + url: "https://github.com/apache/avro/archive/release-1.11.1.tar.gz" + sha256: "599f96bb405f72a35154b2477caa6254d723bb4e3f6a0e54e9ae540664321752" "1.11.0": url: "https://github.com/apache/avro/archive/release-1.11.0.tar.gz" sha256: "c205140e7936d552286ba7131122a34e522d66f601ee912f272109d801f89773" @@ -9,30 +12,59 @@ sources: url: "https://github.com/apache/avro/archive/release-1.10.1.tar.gz" sha256: "8fd1f850ce37e60835e6d8335c0027a959aaa316773da8a9660f7d33a66ac142" patches: + "1.11.1": + - patch_file: "patches/0001-add-iterator-include-1-11-0.patch" + patch_description: "include iterator" + patch_type: "portability" + - patch_file: "patches/0002-disable-tests-1-11-1.patch" + patch_description: "disable tests" + patch_type: "conan" + - patch_file: "patches/0003-allow-static-boost-linkage-1-11-0.patch" + patch_description: "remove boost linkage definitions" + patch_type: "conan" + - patch_file: "patches/0004-fix-windows-shared-installation-1-11-1.patch" + patch_description: "fix runtime installation path" + patch_type: "portability" + - patch_file: "patches/0005-fix-breaking-include-1-11-1.patch" + patch_description: "move impl/json/jsonDom.h to api/json" + patch_type: "backport" + patch_source: "https://issues.apache.org/jira/browse/AVRO-3601" "1.11.0": - - base_path: "source_subfolder" - patch_file: "patches/0001-add-iterator-include-1-11-0.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-disable-tests-1-11-0.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-allow-static-boost-linkage-1-11-0.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-fix-windows-shared-installation-1-11-0.patch" + - patch_file: "patches/0001-add-iterator-include-1-11-0.patch" + patch_description: "include iterator" + patch_type: "portability" + - patch_file: "patches/0002-disable-tests-1-11-0.patch" + patch_description: "disable tests" + patch_type: "conan" + - patch_file: "patches/0003-allow-static-boost-linkage-1-11-0.patch" + patch_description: "remove boost linkage definitions" + patch_type: "conan" + - patch_file: "patches/0004-fix-windows-shared-installation-1-11-0.patch" + patch_description: "fix runtime installation path" + patch_type: "portability" "1.10.2": - - base_path: "source_subfolder" - patch_file: "patches/0001-add-iterator-include.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-disable-tests-1-10-2.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-allow-static-boost-linkage.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-fix-windows-shared-installation-1-10-2.patch" + - patch_file: "patches/0001-add-iterator-include.patch" + patch_description: "include iterator" + patch_type: "portability" + - patch_file: "patches/0002-disable-tests-1-10-2.patch" + patch_description: "disable tests" + patch_type: "conan" + - patch_file: "patches/0003-allow-static-boost-linkage.patch" + patch_description: "remove boost linkage definitions" + patch_type: "conan" + - patch_file: "patches/0004-fix-windows-shared-installation-1-10-2.patch" + patch_description: "fix runtime installation path" + patch_type: "portability" "1.10.1": - - base_path: "source_subfolder" - patch_file: "patches/0001-add-iterator-include.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-disable-tests-1-10-1.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-allow-static-boost-linkage.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-fix-windows-shared-installation-1-10-1.patch" + - patch_file: "patches/0001-add-iterator-include.patch" + patch_description: "include iterator" + patch_type: "portability" + - patch_file: "patches/0002-disable-tests-1-10-1.patch" + patch_description: "disable tests" + patch_type: "conan" + - patch_file: "patches/0003-allow-static-boost-linkage.patch" + patch_description: "remove boost linkage definitions" + patch_type: "conan" + - patch_file: "patches/0004-fix-windows-shared-installation-1-10-1.patch" + patch_description: "fix runtime installation path" + patch_type: "portability" diff --git a/recipes/libavrocpp/all/conanfile.py b/recipes/libavrocpp/all/conanfile.py index 9056fdb84fb51b..a27c9be2bf7317 100644 --- a/recipes/libavrocpp/all/conanfile.py +++ b/recipes/libavrocpp/all/conanfile.py @@ -1,18 +1,18 @@ +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, replace_in_file +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -import functools -from conans import ConanFile, CMake, tools - -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class LibavrocppConan(ConanFile): name = "libavrocpp" + description = "Avro is a data serialization system." license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" - description = "Avro is a data serialization system." homepage = "https://avro.apache.org/" - topics = ("serialization", "deserialization") - generators = "cmake", "cmake_find_package" + topics = ("serialization", "deserialization","avro") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,17 +25,11 @@ class LibavrocppConan(ConanFile): short_paths = True @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def _min_cppstd(self): + return 11 def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -43,49 +37,53 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, "11") + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("boost/1.78.0") + self.requires("boost/1.81.0") self.requires("snappy/1.1.9") + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["SNAPPY_ROOT_DIR"] = self.deps_cpp_info["snappy"].rootpath.replace("\\", "/") + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - tools.replace_in_file( - os.path.join(os.path.join(self._source_subfolder, "lang", "c++"), "CMakeLists.txt"), + apply_conandata_patches(self) + replace_in_file(self, + os.path.join(self.source_folder, "lang", "c++", "CMakeLists.txt"), "${SNAPPY_LIBRARIES}", "${Snappy_LIBRARIES}" ) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["SNAPPY_ROOT_DIR"] = self.deps_cpp_info["snappy"].rootpath.replace("\\", "/") - cmake.configure() - return cmake - def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "lang", "c++")) cmake.build() def package(self): - self.copy("LICENSE*", dst="licenses", src=self._source_subfolder) - self.copy("NOTICE*", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="NOTICE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() if self.settings.os == "Windows": for dll_pattern_to_remove in ["concrt*.dll", "msvcp*.dll", "vcruntime*.dll"]: - tools.remove_files_by_mask(self.package_folder, dll_pattern_to_remove) + rm(self, dll_pattern_to_remove, os.path.join(self.package_folder, "bin")) def package_info(self): # FIXME: avro does not install under a CMake namespace https://github.com/apache/avro/blob/351f589913b9691322966fb77fe72269a0a2ec82/lang/c%2B%2B/CMakeLists.txt#L193 @@ -94,3 +92,6 @@ def package_info(self): self.cpp_info.components[target].requires = ["boost::boost", "snappy::snappy"] if self.options.shared: self.cpp_info.components[target].defines.append("AVRO_DYN_LINK") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + diff --git a/recipes/libavrocpp/all/patches/0002-disable-tests-1-11-1.patch b/recipes/libavrocpp/all/patches/0002-disable-tests-1-11-1.patch new file mode 100644 index 00000000000000..a1505a597e4da1 --- /dev/null +++ b/recipes/libavrocpp/all/patches/0002-disable-tests-1-11-1.patch @@ -0,0 +1,30 @@ +diff --git a/lang/c++/CMakeLists.txt b/lang/c++/CMakeLists.txt +index 6098613..c27fab7 100644 +--- a/lang/c++/CMakeLists.txt ++++ b/lang/c++/CMakeLists.txt +@@ -171,10 +171,6 @@ target_link_libraries (avrogencpp avrocpp_s ${Boost_LIBRARIES} ${SNAPPY_LIBRARIE + enable_testing() + + macro (unittest name) +- add_executable (${name} test/${name}.cc) +- target_link_libraries (${name} avrocpp ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES}) +- add_test (NAME ${name} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +- COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${name}) + endmacro (unittest) + + unittest (buffertest) +@@ -190,14 +186,6 @@ unittest (AvrogencppTests) + unittest (CompilerTests) + unittest (AvrogencppTestReservedWords) + +-add_dependencies (AvrogencppTestReservedWords cpp_reserved_words_hh) +- +-add_dependencies (AvrogencppTests bigrecord_hh bigrecord_r_hh bigrecord2_hh +- tweet_hh +- union_array_union_hh union_map_union_hh union_conflict_hh +- recursive_hh reuse_hh circulardep_hh tree1_hh tree2_hh crossref_hh +- primitivetypes_hh empty_record_hh) +- + include (InstallRequiredSystemLibraries) + + set (CPACK_PACKAGE_FILE_NAME "avrocpp-${AVRO_VERSION_MAJOR}") diff --git a/recipes/libavrocpp/all/patches/0004-fix-windows-shared-installation-1-11-1.patch b/recipes/libavrocpp/all/patches/0004-fix-windows-shared-installation-1-11-1.patch new file mode 100644 index 00000000000000..842c3ca3ec866d --- /dev/null +++ b/recipes/libavrocpp/all/patches/0004-fix-windows-shared-installation-1-11-1.patch @@ -0,0 +1,13 @@ +diff --git a/lang/c++/CMakeLists.txt b/lang/c++/CMakeLists.txt +index 5ceb045..e19b5a9 100644 +--- a/lang/c++/CMakeLists.txt ++++ b/lang/c++/CMakeLists.txt +@@ -190,7 +190,7 @@ include (CPack) + install (TARGETS avrocpp avrocpp_s + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +- RUNTIME DESTINATION lib) ++ RUNTIME DESTINATION bin) + + install (TARGETS avrogencpp RUNTIME DESTINATION bin) + diff --git a/recipes/libavrocpp/all/patches/0005-fix-breaking-include-1-11-1.patch b/recipes/libavrocpp/all/patches/0005-fix-breaking-include-1-11-1.patch new file mode 100644 index 00000000000000..778bdf6bbbdab7 --- /dev/null +++ b/recipes/libavrocpp/all/patches/0005-fix-breaking-include-1-11-1.patch @@ -0,0 +1,473 @@ +diff --git a/lang/c++/CMakeLists.txt b/lang/c++/CMakeLists.txt +index e19b5a9..0249c37 100644 +--- a/lang/c++/CMakeLists.txt ++++ b/lang/c++/CMakeLists.txt +@@ -106,7 +106,7 @@ set (AVRO_SOURCE_FILES + impl/json/JsonIO.cc + impl/json/JsonDom.cc + impl/Resolver.cc impl/Validator.cc +- impl/CustomFields.cc ++ impl/CustomAttributes.cc + ) + + add_library (avrocpp SHARED ${AVRO_SOURCE_FILES}) +diff --git b/lang/c++/api/CustomAttributes.hh b/lang/c++/api/CustomAttributes.hh +new file mode 100644 +index 0000000..2bd572c +--- /dev/null ++++ b/lang/c++/api/CustomAttributes.hh +@@ -0,0 +1,55 @@ ++/* ++ * Licensed to the Apache Software Foundation (ASF) under one ++ * or more contributor license agreements. See the NOTICE file ++ * distributed with this work for additional information ++ * regarding copyright ownership. The ASF licenses this file ++ * to you under the Apache License, Version 2.0 (the ++ * "License"); you may not use this file except in compliance ++ * with the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#ifndef avro_CustomAttributes_hh__ ++#define avro_CustomAttributes_hh__ ++ ++#include ++#include ++#include ++#include "Config.hh" ++ ++namespace avro { ++ ++// CustomAttributes class stores avro custom attributes. ++// Each attribute is represented by a unique name and value. ++// User is supposed to create CustomAttributes object and then add it to Schema. ++class AVRO_DECL CustomAttributes { ++ public: ++ // Retrieves the custom attribute json entity for that attributeName, returns an ++ // null if the attribute doesn't exist. ++ std::string getAttribute(const std::string &name) const; ++ ++ // Adds a custom attribute. If the attribute already exists, throw an exception. ++ void addAttribute(const std::string &name, const std::string &value); ++ ++ // Provides a way to iterate over the custom attributes or check attribute size. ++ const std::map &attributes() const { ++ return attributes_; ++ } ++ ++ // Prints the attribute value for the specific attribute. ++ void printJson(std::ostream& os, const std::string &name) const; ++ ++ private: ++ std::map attributes_; ++}; ++ ++} // namespace avro ++ ++#endif +diff --git a/lang/c++/api/CustomFields.hh a/lang/c++/api/CustomFields.hh +deleted file mode 100644 +index 01468ff..0000000 +--- a/lang/c++/api/CustomFields.hh ++++ /dev/null +@@ -1,55 +0,0 @@ +-/* +- * Licensed to the Apache Software Foundation (ASF) under one +- * or more contributor license agreements. See the NOTICE file +- * distributed with this work for additional information +- * regarding copyright ownership. The ASF licenses this file +- * to you under the Apache License, Version 2.0 (the +- * "License"); you may not use this file except in compliance +- * with the License. You may obtain a copy of the License at +- * +- * http://www.apache.org/licenses/LICENSE-2.0 +- * +- * Unless required by applicable law or agreed to in writing, software +- * distributed under the License is distributed on an "AS IS" BASIS, +- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +- * See the License for the specific language governing permissions and +- * limitations under the License. +- */ +- +-#ifndef avro_CustomFields_hh__ +-#define avro_CustomFields_hh__ +- +-#include +- +-#include "../impl/json/JsonDom.hh" +- +-namespace avro { +- +-// CustomFields class stores avro custom attributes. +-// Each field is represented by a unique name and value. +-// User is supposed to create CustomFields object and then add it to Schema. +-class AVRO_DECL CustomFields { +- public: +- // Retrieves the custom field json entity for that fieldName, returns an +- // null Entity if the field doesn't exist. +- json::Entity getField(const std::string &fieldName) const; +- +- // Adds a custom field. If the field already exists, throw an exception. +- void addField(const std::string &fieldName, const json::Entity &fieldValue); +- void addField(const std::string &fieldName, const std::string &fieldValue); +- +- // Provides a way to iterate over the custom fields or check field size. +- const std::map &fields() const { +- return fields_; +- } +- +- // Prints the json string for the specific field. +- void printJson(std::ostream& os, const std::string &fieldName) const; +- +- private: +- std::map fields_; +-}; +- +-} // namespace avro +- +-#endif +diff --git a/lang/c++/api/Node.hh b/lang/c++/api/Node.hh +index c9af126..3f5fe5b 100644 +--- a/lang/c++/api/Node.hh ++++ b/lang/c++/api/Node.hh +@@ -26,7 +26,7 @@ + #include + #include + +-#include "CustomFields.hh" ++#include "CustomAttributes.hh" + #include "Exception.hh" + #include "LogicalType.hh" + #include "SchemaResolution.hh" +@@ -154,7 +154,7 @@ public: + } + virtual size_t fixedSize() const = 0; + +- void addCustomAttributesForField(const CustomFields& customAttributes) { ++ void addCustomAttributesForField(const CustomAttributes& customAttributes) { + checkLock(); + doAddCustomAttribute(customAttributes); + } +@@ -191,7 +191,7 @@ protected: + virtual void doAddLeaf(const NodePtr &newLeaf) = 0; + virtual void doAddName(const std::string &name) = 0; + virtual void doSetFixedSize(size_t size) = 0; +- virtual void doAddCustomAttribute(const CustomFields& customFields) = 0; ++ virtual void doAddCustomAttribute(const CustomAttributes& customAttributes) = 0; + + private: + const Type type_; +diff --git a/lang/c++/api/NodeImpl.hh b/lang/c++/api/NodeImpl.hh +index 62e62eb..bf0e352 100644 +--- a/lang/c++/api/NodeImpl.hh ++++ b/lang/c++/api/NodeImpl.hh +@@ -32,7 +32,7 @@ + + #include "Node.hh" + #include "NodeConcepts.hh" +-#include "CustomFields.hh" ++#include "CustomAttributes.hh" + + namespace avro { + +@@ -160,8 +160,8 @@ protected: + + void setLeafToSymbolic(size_t index, const NodePtr &node) override; + +- void doAddCustomAttribute(const CustomFields &customfields) override { +- customAttributes_.add(customfields); ++ void doAddCustomAttribute(const CustomAttributes &customAttributes) override { ++ customAttributes_.add(customAttributes); + } + + SchemaResolution furtherResolution(const Node &reader) const { +@@ -223,8 +223,8 @@ using MultiLeaves = concepts::MultiAttribute; + + using NoLeafNames = concepts::NoAttribute; + using LeafNames = concepts::MultiAttribute; +-using MultiAttributes = concepts::MultiAttribute; +-using NoAttributes = concepts::NoAttribute; ++using MultiAttributes = concepts::MultiAttribute; ++using NoAttributes = concepts::NoAttribute; + + using NoSize = concepts::NoAttribute; + using HasSize = concepts::SingleAttribute; +diff --git a/lang/c++/api/Schema.hh b/lang/c++/api/Schema.hh +index fa50481..b0d1e39 100644 +--- a/lang/c++/api/Schema.hh ++++ b/lang/c++/api/Schema.hh +@@ -21,7 +21,7 @@ + + #include "Config.hh" + #include "NodeImpl.hh" +-#include "CustomFields.hh" ++#include "CustomAttributes.hh" + #include + + /// \file +@@ -103,7 +103,7 @@ public: + void addField(const std::string &name, const Schema &fieldSchema); + // Add a field with custom attributes + void addField(const std::string &name, const Schema &fieldSchema, +- const CustomFields &customFields); ++ const CustomAttributes &customFields); + + std::string getDoc() const; + void setDoc(const std::string &); +diff --git a/lang/c++/impl/Compiler.cc b/lang/c++/impl/Compiler.cc +index 014229e..383798c 100644 +--- a/lang/c++/impl/Compiler.cc ++++ b/lang/c++/impl/Compiler.cc +@@ -21,7 +21,7 @@ + #include + + #include "Compiler.hh" +-#include "CustomFields.hh" ++#include "CustomAttributes.hh" + #include "NodeConcepts.hh" + #include "Schema.hh" + #include "Stream.hh" +@@ -149,8 +149,8 @@ struct Field { + const string name; + const NodePtr schema; + const GenericDatum defaultValue; +- const CustomFields customFields; +- Field(string n, NodePtr v, GenericDatum dv, const CustomFields& cf) : name(std::move(n)), schema(std::move(v)), defaultValue(std::move(dv)), customFields(std::move(cf)) {} ++ const CustomAttributes customAttributes; ++ Field(string n, NodePtr v, GenericDatum dv, const CustomAttributes& ca) : name(std::move(n)), schema(std::move(v)), defaultValue(std::move(dv)), customAttributes(std::move(ca)) {} + }; + + static void assertType(const Entity &e, EntityType et) { +@@ -268,14 +268,14 @@ static const std::unordered_set& getKnownFields() { + return kKnownFields; + } + +-static void getCustomAttributes(const Object& m, CustomFields &customAttributes) ++static void getCustomAttributes(const Object& m, CustomAttributes &customAttributes) + { + // Don't add known fields on primitive type and fixed type into custom + // fields. + const std::unordered_set& kKnownFields = getKnownFields(); + for (const auto &entry : m) { + if (kKnownFields.find(entry.first) == kKnownFields.end()) { +- customAttributes.addField(entry.first, entry.second); ++ customAttributes.addAttribute(entry.first, entry.second.stringValue()); + } + } + } +@@ -291,7 +291,7 @@ static Field makeField(const Entity &e, SymbolTable &st, const string &ns) { + } + GenericDatum d = (it2 == m.end()) ? GenericDatum() : makeGenericDatum(node, it2->second, st); + // Get custom attributes +- CustomFields customAttributes; ++ CustomAttributes customAttributes; + getCustomAttributes(m, customAttributes); + + return Field(n, node, d, customAttributes); +@@ -304,7 +304,7 @@ static NodePtr makeRecordNode(const Entity &e, const Name &name, + const Array &v = getArrayField(e, m, "fields"); + concepts::MultiAttribute fieldNames; + concepts::MultiAttribute fieldValues; +- concepts::MultiAttribute customAttributes; ++ concepts::MultiAttribute customAttributes; + vector defaultValues; + + for (const auto &it : v) { +@@ -312,7 +312,7 @@ static NodePtr makeRecordNode(const Entity &e, const Name &name, + fieldNames.add(f.name); + fieldValues.add(f.schema); + defaultValues.push_back(f.defaultValue); +- customAttributes.add(f.customFields); ++ customAttributes.add(f.customAttributes); + } + NodeRecord *node; + if (doc == nullptr) { +diff --git b/lang/c++/impl/CustomAttributes.cc b/lang/c++/impl/CustomAttributes.cc +new file mode 100644 +index 0000000..bb56438 +--- /dev/null ++++ b/lang/c++/impl/CustomAttributes.cc +@@ -0,0 +1,51 @@ ++ ++/** ++ * Licensed to the Apache Software Foundation (ASF) under one ++ * or more contributor license agreements. See the NOTICE file ++ * distributed with this work for additional information ++ * regarding copyright ownership. The ASF licenses this file ++ * to you under the Apache License, Version 2.0 (the ++ * "License"); you may not use this file except in compliance ++ * with the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++#include "CustomAttributes.hh" ++#include ++#include ++#include "Exception.hh" ++ ++namespace avro { ++ ++std::string CustomAttributes::getAttribute(const std::string &name) const { ++ std::map::const_iterator iter = ++ attributes_.find(name); ++ if (iter == attributes_.end()) { ++ return NULL; ++ } ++ return iter->second; ++} ++ ++void CustomAttributes::addAttribute(const std::string& name, ++ const std::string& value) { ++ auto iter_and_find = ++ attributes_.insert(std::pair(name, value)); ++ if (!iter_and_find.second) { ++ throw Exception(name + " already exists and cannot be added"); ++ } ++} ++ ++void CustomAttributes::printJson(std::ostream& os, ++ const std::string& name) const { ++ if (attributes().find(name) == attributes().end()) { ++ throw Exception(name + " doesn't exist"); ++ } ++ os << "\"" << name << "\": \"" << attributes().at(name) << "\""; ++} ++} // namespace avro +diff --git a/lang/c++/impl/CustomFields.cc a/lang/c++/impl/CustomFields.cc +deleted file mode 100644 +index 04541da..0000000 +--- a/lang/c++/impl/CustomFields.cc ++++ /dev/null +@@ -1,59 +0,0 @@ +- +-/** +- * Licensed to the Apache Software Foundation (ASF) under one +- * or more contributor license agreements. See the NOTICE file +- * distributed with this work for additional information +- * regarding copyright ownership. The ASF licenses this file +- * to you under the Apache License, Version 2.0 (the +- * "License"); you may not use this file except in compliance +- * with the License. You may obtain a copy of the License at +- * +- * http://www.apache.org/licenses/LICENSE-2.0 +- * +- * Unless required by applicable law or agreed to in writing, software +- * distributed under the License is distributed on an "AS IS" BASIS, +- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +- * See the License for the specific language governing permissions and +- * limitations under the License. +- */ +-#include "CustomFields.hh" +-#include +-#include +-#include "Exception.hh" +- +-namespace avro { +- +-using json::Entity; +- +-Entity CustomFields::getField(const std::string &fieldName) const { +- std::map::const_iterator iter = +- fields_.find(fieldName); +- if (iter == fields_.end()) { +- return Entity(); +- } +- return iter->second; +-} +- +-void CustomFields::addField(const std::string& fieldName, +- const std::string& fieldValue) { +- addField(fieldName, +- json::Entity(std::make_shared(fieldValue))); +-} +- +-void CustomFields::addField(const std::string& fieldName, +- const Entity& fieldValue) { +- auto iter_and_find = +- fields_.insert(std::pair(fieldName, fieldValue)); +- if (!iter_and_find.second) { +- throw Exception(fieldName + " already exists and cannot be added"); +- } +-} +- +-void CustomFields::printJson(std::ostream& os, +- const std::string& fieldName) const { +- if (fields_.find(fieldName) == fields_.end()) { +- throw Exception(fieldName + " doesn't exist"); +- } +- os << "\"" << fieldName << "\": " << fields_.at(fieldName).toString(); +-} +-} // namespace avro +diff --git a/lang/c++/impl/NodeImpl.cc b/lang/c++/impl/NodeImpl.cc +index 37c8555..5549c68 100644 +--- a/lang/c++/impl/NodeImpl.cc ++++ b/lang/c++/impl/NodeImpl.cc +@@ -83,13 +83,13 @@ std::ostream &operator<<(std::ostream &os, indent x) { + return os; + } + +-void printCustomFields(const CustomFields& customFields, int depth, ++void printCustomAttributes(const CustomAttributes& customAttributes, int depth, + std::ostream &os) { +- std::map::const_iterator iter = +- customFields.fields().begin(); +- while (iter != customFields.fields().end()) { ++ std::map::const_iterator iter = ++ customAttributes.attributes().begin(); ++ while (iter != customAttributes.attributes().end()) { + os << ",\n" << indent(depth); +- customFields.printJson(os, iter->first); ++ customAttributes.printJson(os, iter->first); + ++iter; + } + } +@@ -287,7 +287,7 @@ void NodeRecord::printJson(std::ostream &os, size_t depth) const { + } + } + if(customAttributes_.size() == fields) { +- printCustomFields(customAttributes_.get(i), depth, os); ++ printCustomAttributes(customAttributes_.get(i), depth, os); + } + os << '\n'; + os << indent(--depth) << '}'; +diff --git a/lang/c++/impl/Schema.cc b/lang/c++/impl/Schema.cc +index fa90d34..3315f25 100644 +--- a/lang/c++/impl/Schema.cc ++++ b/lang/c++/impl/Schema.cc +@@ -19,7 +19,7 @@ + #include + + #include "Schema.hh" +-#include "CustomFields.hh" ++#include "CustomAttributes.hh" + + namespace avro { + +@@ -28,11 +28,11 @@ RecordSchema::RecordSchema(const std::string &name) : Schema(new NodeRecord) { + } + + void RecordSchema::addField(const std::string &name, const Schema &fieldSchema) { +- const CustomFields emptyCustomField; +- addField(name, fieldSchema, emptyCustomField); ++ const CustomAttributes emptyCustomAttribute; ++ addField(name, fieldSchema, emptyCustomAttribute); + } + +-void RecordSchema::addField(const std::string &name, const Schema &fieldSchema, const CustomFields &customFields) { ++void RecordSchema::addField(const std::string &name, const Schema &fieldSchema, const CustomAttributes &customFields) { + // add the name first. it will throw if the name is a duplicate, preventing + // the leaf from being added + node_->addName(name); diff --git a/recipes/libavrocpp/all/test_package/CMakeLists.txt b/recipes/libavrocpp/all/test_package/CMakeLists.txt index 68d787b464e8d9..b68f9ecbb512a1 100644 --- a/recipes/libavrocpp/all/test_package/CMakeLists.txt +++ b/recipes/libavrocpp/all/test_package/CMakeLists.txt @@ -1,13 +1,10 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(libavrocpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) if(TARGET libavrocpp::avrocpp) target_link_libraries(${PROJECT_NAME} libavrocpp::avrocpp) diff --git a/recipes/libavrocpp/all/test_package/conanfile.py b/recipes/libavrocpp/all/test_package/conanfile.py index 75634e62bcb667..a9fb96656f2039 100644 --- a/recipes/libavrocpp/all/test_package/conanfile.py +++ b/recipes/libavrocpp/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools - class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libavrocpp/all/test_v1_package/CMakeLists.txt b/recipes/libavrocpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/libavrocpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libavrocpp/all/test_v1_package/conanfile.py b/recipes/libavrocpp/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/libavrocpp/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libavrocpp/config.yml b/recipes/libavrocpp/config.yml index ed319d069e4869..9fcb2d236146c1 100644 --- a/recipes/libavrocpp/config.yml +++ b/recipes/libavrocpp/config.yml @@ -1,4 +1,6 @@ versions: + 1.11.1: + folder: all 1.11.0: folder: all 1.10.2: diff --git a/recipes/libbacktrace/all/conanfile.py b/recipes/libbacktrace/all/conanfile.py index ca9c6497fea499..c0bdadcedebed4 100644 --- a/recipes/libbacktrace/all/conanfile.py +++ b/recipes/libbacktrace/all/conanfile.py @@ -5,11 +5,10 @@ from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, rm from conan.tools.gnu import Autotools, AutotoolsToolchain from conan.tools.layout import basic_layout -from conan.tools.microsoft import is_msvc, unix_path -from conan.tools.scm import Version +from conan.tools.microsoft import check_min_vs, is_msvc, unix_path import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class LibbacktraceConan(ConanFile): @@ -46,23 +45,15 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def layout(self): basic_layout(self, src_folder="src") def validate(self): + check_min_vs(self, "180") if is_msvc(self) and self.info.options.shared: raise ConanInvalidConfiguration("libbacktrace shared is not supported with Visual Studio") @@ -83,8 +74,8 @@ def generate(self): env.generate() tc = AutotoolsToolchain(self) - if (self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) >= "12") or \ - (self.settings.compiler == "msvc" and Version(self.settings.compiler.version) >= "180"): + if is_msvc(self): + # https://github.com/conan-io/conan/issues/6514 tc.extra_cflags.append("-FS") tc.generate() diff --git a/recipes/libcap/all/conandata.yml b/recipes/libcap/all/conandata.yml index 847c16afd3b785..96d617e32dbb60 100644 --- a/recipes/libcap/all/conandata.yml +++ b/recipes/libcap/all/conandata.yml @@ -23,29 +23,71 @@ sources: "2.65": url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.65.tar.xz" sha256: "73e350020cc31fe15360879d19384ffa3395a825f065fcf6bda3a5cdf965bebd" + "2.66": + url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.66.tar.xz" + sha256: "15c40ededb3003d70a283fe587a36b7d19c8b3b554e33f86129c059a4bb466b2" patches: "2.45": - patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" - patch_file: "patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch" + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" "2.46": - patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" - patch_file: "patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch" + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" "2.48": - patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" - patch_file: "patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch" + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" "2.50": - patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" - patch_file: "patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch" + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" "2.57": - patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" - patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch" + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" "2.58": - patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" - patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch" + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" "2.62": - patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" - patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch" + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" "2.65": - patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" - patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch" + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" + "2.66": + - patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" + - patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch" + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" diff --git a/recipes/libcap/all/conanfile.py b/recipes/libcap/all/conanfile.py index 735fde82a02435..84f7ed56fc46a5 100644 --- a/recipes/libcap/all/conanfile.py +++ b/recipes/libcap/all/conanfile.py @@ -3,11 +3,12 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.build import cross_building -from conan.tools.files import apply_conandata_patches, copy, chdir, get, rmdir -from conan.tools.layout import basic_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, chdir, export_conandata_patches, get, rmdir from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class LibcapConan(ConanFile): @@ -17,7 +18,7 @@ class LibcapConan(ConanFile): homepage = "https://git.kernel.org/pub/scm/libs/libcap/libcap.git" description = "This is a library for getting and setting POSIX.1e" \ " (formerly POSIX 6) draft 15 capabilities" - topics = ("libcap", "capabilities") + topics = ("capabilities") settings = "os", "compiler", "build_type", "arch" options = { "shared": [True, False], @@ -29,26 +30,22 @@ class LibcapConan(ConanFile): "fPIC": True, "psx_syscals": False, } - exports_sources = "patches/**" def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def validate(self): if self.info.settings.os != "Linux": - raise ConanInvalidConfiguration("Only Linux supported") + raise ConanInvalidConfiguration(f"{self.ref} only supports Linux") def layout(self): - basic_layout(self, src_folder="source") + basic_layout(self, src_folder="src") + + def export_sources(self): + export_conandata_patches(self) def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) @@ -64,8 +61,10 @@ def generate(self): env.define("lib", "lib") if cross_building(self) and not env.vars(self).get("BUILD_CC"): - native_cc = "cc" - self.output.info("Using native compiler '{}'".format(native_cc)) + native_cc = VirtualBuildEnv(self).vars().get("CC") + if not native_cc: + native_cc = "cc" + self.output.info(f"Using native compiler '{native_cc}'") env.define("BUILD_CC", native_cc) tc.generate(env) diff --git a/recipes/libcap/all/test_package/conanfile.py b/recipes/libcap/all/test_package/conanfile.py index 2e57d4c1e40559..833f2d61cd5bb9 100644 --- a/recipes/libcap/all/test_package/conanfile.py +++ b/recipes/libcap/all/test_package/conanfile.py @@ -2,23 +2,20 @@ from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import CMake +from conan.tools.cmake import CMake, cmake_layout from conan.tools.env import Environment -from conan.tools.cmake import cmake_layout - -required_conan_version = ">=1.38.0" class LibcapTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "CMakeToolchain", "PkgConfigDeps", "VirtualBuildEnv" + generators = "CMakeToolchain", "PkgConfigDeps", "VirtualBuildEnv", "VirtualRunEnv" test_type = "explicit" def requirements(self): self.requires(self.tested_reference_str) def build_requirements(self): - self.tool_requires("pkgconf/1.7.4") + self.tool_requires("pkgconf/1.9.3") def layout(self): cmake_layout(self) diff --git a/recipes/libcap/all/test_v1_package/CMakeLists.txt b/recipes/libcap/all/test_v1_package/CMakeLists.txt index 2b3baa53f33471..925ecbe19e448d 100644 --- a/recipes/libcap/all/test_v1_package/CMakeLists.txt +++ b/recipes/libcap/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(PackageTest C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +conan_basic_setup(TARGETS) -find_package(PkgConfig REQUIRED) -pkg_check_modules(CAP REQUIRED IMPORTED_TARGET libcap) - -add_executable(example ../test_package/example.c) -target_link_libraries(example PRIVATE PkgConfig::CAP) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libcap/all/test_v1_package/conanfile.py b/recipes/libcap/all/test_v1_package/conanfile.py index f90b4e8b52f6ed..8ee3af7509e31b 100644 --- a/recipes/libcap/all/test_v1_package/conanfile.py +++ b/recipes/libcap/all/test_v1_package/conanfile.py @@ -10,7 +10,7 @@ class LibcapTestConan(ConanFile): generators = "cmake", "pkg_config" def build_requirements(self): - self.tool_requires("pkgconf/1.7.4") + self.tool_requires("pkgconf/1.9.3") def build(self): cmake = CMake(self) diff --git a/recipes/libcap/config.yml b/recipes/libcap/config.yml index ee4c4ae443408b..58715d0f047445 100644 --- a/recipes/libcap/config.yml +++ b/recipes/libcap/config.yml @@ -15,3 +15,5 @@ versions: folder: all "2.65": folder: all + "2.66": + folder: all diff --git a/recipes/libcbor/all/conandata.yml b/recipes/libcbor/all/conandata.yml index 62e7073df986d0..a14b76e6d87db8 100644 --- a/recipes/libcbor/all/conandata.yml +++ b/recipes/libcbor/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.10.1": + url: "https://github.com/PJK/libcbor/archive/v0.10.1.tar.gz" + sha256: "e8fa0a726b18861c24428561c80b3c95aca95f468df4e2f3e3ac618be12d3047" + "0.10.0": + url: "https://github.com/PJK/libcbor/archive/v0.10.0.tar.gz" + sha256: "4f79c6a9e587aaf877f1c4e74a842a599f2b56b5afb6bf59e51bc643b4f69ba0" "0.9.0": url: "https://github.com/PJK/libcbor/archive/v0.9.0.tar.gz" sha256: "da81e4f9333e0086d4e2745183c7052f04ecc4dbcffcf910029df24f103c15d1" @@ -8,6 +14,12 @@ sources: patches: "0.9.0": - patch_file: "patches/0.7.0/002_fix_cmake_module_path.patch" + patch_description: "fix cmake module path" + patch_type: "portability" "0.7.0": - patch_file: "patches/0.7.0/001_fix_shared_build.patch" + patch_description: "fix shared build compilation error" + patch_type: "conan" - patch_file: "patches/0.7.0/002_fix_cmake_module_path.patch" + patch_description: "fix cmake module path" + patch_type: "portability" diff --git a/recipes/libcbor/all/test_package/CMakeLists.txt b/recipes/libcbor/all/test_package/CMakeLists.txt index fc2cbc0d5af6e0..94fca8fa664068 100644 --- a/recipes/libcbor/all/test_package/CMakeLists.txt +++ b/recipes/libcbor/all/test_package/CMakeLists.txt @@ -5,3 +5,7 @@ find_package(libcbor REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} PRIVATE libcbor::libcbor) + +if(libcbor_VERSION VERSION_GREATER_EQUAL "0.10.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE -DLIBCBOR_DEPRECATE_CUSTOM_ALLOC) +endif() diff --git a/recipes/libcbor/all/test_package/test_package.c b/recipes/libcbor/all/test_package/test_package.c index aeae930f3bd7be..63def1fbfb9b05 100644 --- a/recipes/libcbor/all/test_package/test_package.c +++ b/recipes/libcbor/all/test_package/test_package.c @@ -3,7 +3,9 @@ int main(int argc, char *argv[]) { printf("Hello from libcbor %s\n", CBOR_VERSION); +#ifndef LIBCBOR_DEPRECATE_CUSTOM_ALLOC printf("Custom allocation support: %s\n", CBOR_CUSTOM_ALLOC ? "yes" : "no"); +#endif printf("Pretty-printer support: %s\n", CBOR_PRETTY_PRINTER ? "yes" : "no"); printf("Buffer growth factor: %f\n", (float)CBOR_BUFFER_GROWTH); cbor_item_t *array = cbor_new_definite_array(4); diff --git a/recipes/libcbor/config.yml b/recipes/libcbor/config.yml index b4b6b81f6444ee..ec48c826910673 100644 --- a/recipes/libcbor/config.yml +++ b/recipes/libcbor/config.yml @@ -1,4 +1,8 @@ versions: + "0.10.1": + folder: "all" + "0.10.0": + folder: "all" "0.9.0": folder: "all" "0.7.0": diff --git a/recipes/libcurl/all/conandata.yml b/recipes/libcurl/all/conandata.yml index 65ff7d7373b901..5fb0b0c8d8687f 100644 --- a/recipes/libcurl/all/conandata.yml +++ b/recipes/libcurl/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "7.87.0": + url: "https://curl.se/download/curl-7.87.0.tar.gz" + sha256: "8a063d664d1c23d35526b87a2bf15514962ffdd8ef7fd40519191b3c23e39548" "7.86.0": url: "https://curl.se/download/curl-7.86.0.tar.gz" sha256: "3dfdd39ba95e18847965cd3051ea6d22586609d9011d91df7bc5521288987a82" diff --git a/recipes/libcurl/all/conanfile.py b/recipes/libcurl/all/conanfile.py index dd2fe94b93cc0b..2e301658084e78 100644 --- a/recipes/libcurl/all/conanfile.py +++ b/recipes/libcurl/all/conanfile.py @@ -2,7 +2,7 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.apple import is_apple_os, fix_apple_shared_install_name from conan.tools.build import cross_building -from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout from conan.tools.env import VirtualBuildEnv, VirtualRunEnv from conan.tools.files import apply_conandata_patches, copy, download, export_conandata_patches, get, load, replace_in_file, rm, rmdir, save from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps, PkgConfigDeps @@ -153,6 +153,12 @@ def config_options(self): del self.options.with_zstd if not self._has_metalink_option: del self.options.with_libmetalink + + # Before 7.86.0, enabling unix sockets configure option would fail on windows + # It was fixed with this PR: https://github.com/curl/curl/pull/9688 + if self._is_mingw and Version(self.version) < "7.86.0": + del self.options.with_unix_sockets + # Default options self.options.with_ssl = "darwinssl" if is_apple_os(self) else "openssl" @@ -220,7 +226,7 @@ def layout(self): def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - download(self, "https://curl.haxx.se/ca/cacert.pem", "cacert.pem", verify=True, sha256="2cff03f9efdaf52626bd1b451d700605dc1ea000c5da56bd0fc59f8f43071040") + download(self, "https://curl.se/ca/cacert-2023-01-10.pem", "cacert.pem", verify=True, sha256="fb1ecd641d0a02c01bc9036d513cb658bbda62a75e246bedbc01764560a639f0") def generate(self): env = VirtualBuildEnv(self) @@ -299,7 +305,8 @@ def _patch_autotools(self): # add directives to build dll # used only for native mingw-make if not cross_building(self): - added_content = load(self, "lib_Makefile_add.am") + # The patch file is located in the base src folder + added_content = load(self, os.path.join(self.folders.base_source, "lib_Makefile_add.am")) save(self, lib_makefile, added_content, append=True) def _patch_cmake(self): @@ -385,7 +392,7 @@ def _generate_with_autotools(self): f"--enable-manual={self._yes_no(self.options.with_docs)}", f"--enable-verbose={self._yes_no(self.options.with_verbose_debug)}", f"--enable-symbol-hiding={self._yes_no(self.options.with_symbol_hiding)}", - f"--enable-unix-sockets={self._yes_no(self.options.with_unix_sockets)}", + f"--enable-unix-sockets={self._yes_no(self.options.get_safe('with_unix_sockets'))}", ]) # Since 7.77.0, disabling TLS must be explicitly requested otherwise it fails @@ -468,6 +475,8 @@ def _generate_with_autotools(self): elif self.settings.os == "Android": pass # this just works, conan is great! + env = tc.environment() + # tweaks for mingw if self._is_mingw: rcflags = "-O COFF" @@ -476,7 +485,6 @@ def _generate_with_autotools(self): elif self.settings.arch == "x86_64": rcflags += " --target=pe-x86-64" tc.extra_defines.append("_AMD64_") - env = tc.environment() env.define("RCFLAGS", rcflags) if self.settings.os != "Windows": @@ -486,7 +494,7 @@ def _generate_with_autotools(self): if cross_building(self) and is_apple_os(self): tc.extra_defines.extend(['HAVE_SOCKET', 'HAVE_FCNTL_O_NONBLOCK']) - tc.generate() + tc.generate(env) tc = PkgConfigDeps(self) tc.generate() tc = AutotoolsDeps(self) @@ -515,10 +523,13 @@ def _arm_version(self, arch): return version def _generate_with_cmake(self): + dc = CMakeDeps(self) + dc.generate() if self._is_win_x_android: tc = CMakeToolchain(self, generator="Ninja") else: tc = CMakeToolchain(self) + tc.variables["ENABLE_UNICODE"] = True tc.variables["BUILD_TESTING"] = False tc.variables["BUILD_CURL_EXE"] = False tc.variables["CURL_DISABLE_LDAP"] = not self.options.with_ldap @@ -595,9 +606,9 @@ def package(self): rm(self, "*.la", os.path.join(self.package_folder, "lib")) if self._is_mingw and self.options.shared: # Handle only mingw libs - copy(self, pattern="*.dll", src=self.build_folder, dst="bin", keep_path=False) - copy(self, pattern="*.dll.a", src=self.build_folder, dst="lib", keep_path=False) - copy(self, pattern="*.lib", src=self.build_folder, dst="lib", keep_path=False) + copy(self, pattern="*.dll", src=self.build_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, pattern="*.dll.a", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, pattern="*.lib", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): diff --git a/recipes/libcurl/all/test_package/test_package.c b/recipes/libcurl/all/test_package/test_package.c index ed7ab4e3952c68..309b36d2e45f90 100644 --- a/recipes/libcurl/all/test_package/test_package.c +++ b/recipes/libcurl/all/test_package/test_package.c @@ -23,7 +23,7 @@ int main(void) /* provide a buffer to store errors in */ curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errbuf); - /* always cleanup */ + /* always cleanup */ curl_easy_cleanup(curl); printf("Succeed\n"); } else { diff --git a/recipes/libcurl/config.yml b/recipes/libcurl/config.yml index 67489a56924a20..5bb005da00271e 100644 --- a/recipes/libcurl/config.yml +++ b/recipes/libcurl/config.yml @@ -1,4 +1,6 @@ versions: + "7.87.0": + folder: all "7.86.0": folder: all "7.85.0": diff --git a/recipes/libdc1394/all/conanfile.py b/recipes/libdc1394/all/conanfile.py index 70313aabec6d8d..f52cb3b8083396 100644 --- a/recipes/libdc1394/all/conanfile.py +++ b/recipes/libdc1394/all/conanfile.py @@ -1,28 +1,33 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name, is_apple_os +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import chdir, copy, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -import shutil -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class Libdc1394Conan(ConanFile): name = "libdc1394" license = "LGPL-2.1-or-later" url = "https://github.com/conan-io/conan-center-index" - homepage = 'https://damien.douxchamps.net/ieee1394/libdc1394/' + homepage = "https://damien.douxchamps.net/ieee1394/libdc1394/" description = "libdc1394 provides a complete high level API to control IEEE 1394 based cameras" - topics = ("conan", "ieee1394", "camera", "iidc", "dcam") - settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - - generators = "pkg_config" - _env_build = None - - @property - def _source_subfolder(self): - return "source_subfolder" + topics = ("ieee1394", "camera", "iidc", "dcam") + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } def config_options(self): if self.settings.os == "Windows": @@ -30,65 +35,69 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("libusb/1.0.24") + self.requires("libusb/1.0.26") def validate(self): - if self.settings.os == "Windows": + if self.info.settings.os == "Windows": raise ConanInvalidConfiguration("Windows is not supported yet in this recipe") - if self.settings.compiler == "clang": + if self.info.settings.compiler == "clang": raise ConanInvalidConfiguration("Clang doesn't support VLA") def build_requirements(self): - self.build_requires("gnu-config/cci.20201022") - self.build_requires("pkgconf/1.7.4") + self.tool_requires("gnu-config/cci.20210814") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @property - def _user_info_build(self): - return getattr(self, "user_info_build", None) or self.deps_user_info - - def _configure_autotools(self): - if not self._env_build: - self._env_build = AutoToolsBuildEnvironment(self) - if self.options.shared: - args = ["--disable-static", "--enable-shared"] - else: - args = ["--disable-shared", "--enable-static"] - args.extend(["--disable-examples"]) - self._env_build.configure(args=args) - return self._env_build + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.configure_args.append("--disable-examples") + tc.generate() + deps = PkgConfigDeps(self) + deps.generate() + + def _patch_sources(self): + for gnu_config in [ + self.conf.get("user.gnu-config:config_guess", check_type=str), + self.conf.get("user.gnu-config:config_sub", check_type=str), + ]: + if gnu_config: + copy(self, os.path.basename(gnu_config), src=os.path.dirname(gnu_config), dst=self.source_folder) def build(self): - shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, - os.path.join(self._source_subfolder, "config.sub")) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, - os.path.join(self._source_subfolder, "config.guess")) - with tools.chdir(self._source_subfolder): - env_build = self._configure_autotools() - env_build.make() + self._patch_sources() + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - with tools.chdir(self._source_subfolder): - env_build = self._configure_autotools() - env_build.install() - - self.copy(pattern="COPYING", src=self._source_subfolder, dst="licenses") - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.install() + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.names["pkg_config"] = "libdc1394-{}".format(tools.Version(self.version).major) + self.cpp_info.set_property("pkg_config_name", f"libdc1394-{Version(self.version).major}") self.cpp_info.libs = ["dc1394"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") - elif tools.is_apple_os(self.settings.os): + elif is_apple_os(self): self.cpp_info.frameworks.extend(["CoreFoundation", "CoreServices", "IOKit"]) diff --git a/recipes/libdc1394/all/test_package/CMakeLists.txt b/recipes/libdc1394/all/test_package/CMakeLists.txt index 40d74d212ef720..97fa5a2906309e 100644 --- a/recipes/libdc1394/all/test_package/CMakeLists.txt +++ b/recipes/libdc1394/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(PackageTest C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libdc1394 REQUIRED CONFIG) -add_executable(example test_package.c) -target_link_libraries(example ${CONAN_LIBS}) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libdc1394::libdc1394) diff --git a/recipes/libdc1394/all/test_package/conanfile.py b/recipes/libdc1394/all/test_package/conanfile.py index c1297fa185e7a9..0a6bc68712d901 100644 --- a/recipes/libdc1394/all/test_package/conanfile.py +++ b/recipes/libdc1394/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" -class Libdc1394TestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "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/libdc1394/all/test_v1_package/CMakeLists.txt b/recipes/libdc1394/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/libdc1394/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libdc1394/all/test_v1_package/conanfile.py b/recipes/libdc1394/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/libdc1394/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/libdeflate/all/conandata.yml b/recipes/libdeflate/all/conandata.yml index a438f626651c74..a4d8bdf0c97fa1 100644 --- a/recipes/libdeflate/all/conandata.yml +++ b/recipes/libdeflate/all/conandata.yml @@ -1,44 +1,7 @@ sources: - "1.14": - url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.14.tar.gz" - sha256: "89e7df898c37c3427b0f39aadcf733731321a278771d20fc553f92da8d4808ac" - "1.12": - url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.12.tar.gz" - sha256: "ba89fb167a5ab6bbdfa6ee3b1a71636e8140fa8471cce8a311697584948e4d06" - "1.10": - url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.10.tar.gz" - sha256: "5c1f75c285cd87202226f4de49985dcb75732f527eefba2b3ddd70a8865f2533" - "1.9": - url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.9.tar.gz" - sha256: "a537ab6125c226b874c02b166488b326aece954930260dbf682d88fc339137e3" - "1.8": - url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.8.tar.gz" - sha256: "50711ad4e9d3862f8dfb11b97eb53631a86ee3ce49c0e68ec2b6d059a9662f61" - "1.7": - url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.7.tar.gz" - sha256: "a5e6a0a9ab69f40f0f59332106532ca76918977a974e7004977a9498e3f11350" -patches: - "1.14": - - patch_file: "patches/1.14-0001-fix-makefiles.patch" - patch_description: "disable optimization and apply compiler settings on conan recipe" - patch_type: "conan" - "1.12": - - patch_file: "patches/1.12-0001-fix-makefiles.patch" - patch_description: "disable optimization and apply compiler settings on conan recipe" - patch_type: "conan" - "1.10": - - patch_file: "patches/1.9-0001-fix-makefiles.patch" - patch_description: "disable optimization and apply compiler settings on conan recipe" - patch_type: "conan" - "1.9": - - patch_file: "patches/1.9-0001-fix-makefiles.patch" - patch_description: "disable optimization and apply compiler settings on conan recipe" - patch_type: "conan" - "1.8": - - patch_file: "patches/1.7-0001-fix-makefiles.patch" - patch_description: "disable optimization and apply compiler settings on conan recipe" - patch_type: "conan" - "1.7": - - patch_file: "patches/1.7-0001-fix-makefiles.patch" - patch_description: "disable optimization and apply compiler settings on conan recipe" - patch_type: "conan" + "1.17": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.17.tar.gz" + sha256: "fa4615af671513fa2a53dc2e7a89ff502792e2bdfc046869ef35160fcc373763" + "1.15": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.15.tar.gz" + sha256: "58b95040df7383dc0413defb700d9893c194732474283cc4c8f144b00a68154b" diff --git a/recipes/libdeflate/all/conanfile.py b/recipes/libdeflate/all/conanfile.py index 5f72c64aad8c64..0dfcbb1a51a820 100644 --- a/recipes/libdeflate/all/conanfile.py +++ b/recipes/libdeflate/all/conanfile.py @@ -1,9 +1,6 @@ from conan import ConanFile -from conan.tools.env import Environment, VirtualBuildEnv -from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, rm, rmdir -from conan.tools.gnu import Autotools, AutotoolsToolchain -from conan.tools.layout import basic_layout -from conan.tools.microsoft import is_msvc, unix_path, VCVars +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import collect_libs, copy, get, rmdir import os required_conan_version = ">=1.53.0" @@ -26,17 +23,6 @@ class LibdeflateConan(ConanFile): "fPIC": True, } - @property - def _is_clangcl(self): - return self.settings.compiler == "clang" and self.settings.os == "Windows" - - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) - - def export_sources(self): - export_conandata_patches(self) - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -48,80 +34,44 @@ def configure(self): self.settings.rm_safe("compiler.libcxx") def layout(self): - basic_layout(self, src_folder="src") - - def build_requirements(self): - if self._settings_build.os == "Windows" and not (is_msvc(self) or self._is_clangcl): - self.win_bash = True - if not self.conf.get("tools.microsoft.bash:path", check_type=str): - self.tool_requires("msys2/cci.latest") + cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def generate(self): - env = VirtualBuildEnv(self) - env.generate() - - if is_msvc(self) or self._is_clangcl: - vc = VCVars(self) - vc.generate() - # FIXME: no conan v2 build helper for NMake yet (see https://github.com/conan-io/conan/issues/12188) - # So populate CL with AutotoolsToolchain cflags - env = Environment() - c_flags = AutotoolsToolchain(self).cflags - if c_flags: - env.define("CL", c_flags) - env.vars(self).save_script("conanbuildenv_nmake") - else: - tc = AutotoolsToolchain(self) - tc.generate() - - def _build_nmake(self): - with chdir(self, self.source_folder): - target = "libdeflate.dll" if self.options.shared else "libdeflatestatic.lib" - self.run(f"nmake /f Makefile.msc {target}") - - def _build_make(self): - autotools = Autotools(self) - with chdir(self, self.source_folder): - autotools.make() + tc = CMakeToolchain(self) + tc.variables["LIBDEFLATE_BUILD_STATIC_LIB"] = not self.options.shared + tc.variables["LIBDEFLATE_BUILD_SHARED_LIB"] = self.options.shared + tc.variables["LIBDEFLATE_BUILD_GZIP"] = False + tc.variables["LIBDEFLATE_BUILD_TESTS"] = False + tc.generate() def build(self): - apply_conandata_patches(self) - if is_msvc(self) or self._is_clangcl: - self._build_nmake() - else: - self._build_make() - - def _package_windows(self): - copy(self, "libdeflate.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder) - if self.options.shared: - copy(self, "*deflate.lib", dst=os.path.join(self.package_folder, "lib"), src=self.source_folder) - copy(self, "*deflate.dll", dst=os.path.join(self.package_folder, "bin"), src=self.source_folder) - else: - copy(self, "*deflatestatic.lib", dst=os.path.join(self.package_folder, "lib"), src=self.source_folder) - - def _package_make(self): - autotools = Autotools(self) - with chdir(self, self.source_folder): - # Note: not actually an autotools project, is a Makefile project. - autotools.install(args=[f"PREFIX={unix_path(self, self.package_folder)}"]) - rmdir(self, os.path.join(self.package_folder, "bin")) - rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) - rm(self, "*.a" if self.options.shared else "*.[so|dylib]*", os.path.join(self.package_folder, "lib") ) + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): copy(self, "COPYING", self.source_folder, dst=os.path.join(self.package_folder, "licenses")) - if self.settings.os == "Windows": - self._package_windows() - else: - self._package_make() + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "libdeflate") + target_suffix = "" if self.options.shared else "_static" + self.cpp_info.set_property("cmake_target_name", f"libdeflate::libdeflate{target_suffix}") self.cpp_info.set_property("pkg_config_name", "libdeflate") - prefix = "lib" if self.settings.os == "Windows" else "" - suffix = "static" if self.settings.os == "Windows" and not self.options.shared else "" - self.cpp_info.libs = [f"{prefix}deflate{suffix}"] + # TODO: back to global scope in conan v2 + self.cpp_info.components["_libdeflate"].libs = collect_libs(self) if self.settings.os == "Windows" and self.options.shared: - self.cpp_info.defines = ["LIBDEFLATE_DLL"] + self.cpp_info.components["_libdeflate"].defines.append("LIBDEFLATE_DLL") + + # TODO: to remove in conan v2 + self.cpp_info.components["_libdeflate"].names["cmake_find_package"] = f"libdeflate{target_suffix}" + self.cpp_info.components["_libdeflate"].names["cmake_find_package_multi"] = f"libdeflate{target_suffix}" + self.cpp_info.components["_libdeflate"].set_property("cmake_target_name", f"libdeflate::libdeflate{target_suffix}") + self.cpp_info.components["_libdeflate"].set_property("pkg_config_name", "libdeflate") diff --git a/recipes/libdeflate/all/test_package/CMakeLists.txt b/recipes/libdeflate/all/test_package/CMakeLists.txt index 4fdc2b4814ab35..267cdbc24f8b8b 100644 --- a/recipes/libdeflate/all/test_package/CMakeLists.txt +++ b/recipes/libdeflate/all/test_package/CMakeLists.txt @@ -1,7 +1,11 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) find_package(libdeflate REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE libdeflate::libdeflate) +if(TARGET libdeflate::libdeflate_static) + target_link_libraries(${PROJECT_NAME} PRIVATE libdeflate::libdeflate_static) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE libdeflate::libdeflate) +endif() diff --git a/recipes/libdeflate/config.yml b/recipes/libdeflate/config.yml index 4a96e3e23227b1..297f2db78fab2a 100644 --- a/recipes/libdeflate/config.yml +++ b/recipes/libdeflate/config.yml @@ -1,13 +1,17 @@ versions: + "1.17": + folder: "all" + "1.15": + folder: "all" "1.14": - folder: all + folder: "pre_1.15" "1.12": - folder: all + folder: "pre_1.15" "1.10": - folder: all + folder: "pre_1.15" "1.9": - folder: all + folder: "pre_1.15" "1.8": - folder: all + folder: "pre_1.15" "1.7": - folder: all + folder: "pre_1.15" diff --git a/recipes/libdeflate/pre_1.15/conandata.yml b/recipes/libdeflate/pre_1.15/conandata.yml new file mode 100644 index 00000000000000..a438f626651c74 --- /dev/null +++ b/recipes/libdeflate/pre_1.15/conandata.yml @@ -0,0 +1,44 @@ +sources: + "1.14": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.14.tar.gz" + sha256: "89e7df898c37c3427b0f39aadcf733731321a278771d20fc553f92da8d4808ac" + "1.12": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.12.tar.gz" + sha256: "ba89fb167a5ab6bbdfa6ee3b1a71636e8140fa8471cce8a311697584948e4d06" + "1.10": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.10.tar.gz" + sha256: "5c1f75c285cd87202226f4de49985dcb75732f527eefba2b3ddd70a8865f2533" + "1.9": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.9.tar.gz" + sha256: "a537ab6125c226b874c02b166488b326aece954930260dbf682d88fc339137e3" + "1.8": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.8.tar.gz" + sha256: "50711ad4e9d3862f8dfb11b97eb53631a86ee3ce49c0e68ec2b6d059a9662f61" + "1.7": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.7.tar.gz" + sha256: "a5e6a0a9ab69f40f0f59332106532ca76918977a974e7004977a9498e3f11350" +patches: + "1.14": + - patch_file: "patches/1.14-0001-fix-makefiles.patch" + patch_description: "disable optimization and apply compiler settings on conan recipe" + patch_type: "conan" + "1.12": + - patch_file: "patches/1.12-0001-fix-makefiles.patch" + patch_description: "disable optimization and apply compiler settings on conan recipe" + patch_type: "conan" + "1.10": + - patch_file: "patches/1.9-0001-fix-makefiles.patch" + patch_description: "disable optimization and apply compiler settings on conan recipe" + patch_type: "conan" + "1.9": + - patch_file: "patches/1.9-0001-fix-makefiles.patch" + patch_description: "disable optimization and apply compiler settings on conan recipe" + patch_type: "conan" + "1.8": + - patch_file: "patches/1.7-0001-fix-makefiles.patch" + patch_description: "disable optimization and apply compiler settings on conan recipe" + patch_type: "conan" + "1.7": + - patch_file: "patches/1.7-0001-fix-makefiles.patch" + patch_description: "disable optimization and apply compiler settings on conan recipe" + patch_type: "conan" diff --git a/recipes/libdeflate/pre_1.15/conanfile.py b/recipes/libdeflate/pre_1.15/conanfile.py new file mode 100644 index 00000000000000..47e0d742be3d17 --- /dev/null +++ b/recipes/libdeflate/pre_1.15/conanfile.py @@ -0,0 +1,127 @@ +from conan import ConanFile +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path, VCVars +import os + +required_conan_version = ">=1.53.0" + + +class LibdeflateConan(ConanFile): + name = "libdeflate" + description = "Heavily optimized library for DEFLATE/zlib/gzip compression and decompression." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ebiggers/libdeflate" + topics = ("compression", "decompression", "deflate", "zlib", "gzip") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _is_clangcl(self): + return self.settings.compiler == "clang" and self.settings.os == "Windows" + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") + + def build_requirements(self): + if self._settings_build.os == "Windows" and not (is_msvc(self) or self._is_clangcl): + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + if is_msvc(self) or self._is_clangcl: + vc = VCVars(self) + vc.generate() + # FIXME: no conan v2 build helper for NMake yet (see https://github.com/conan-io/conan/issues/12188) + # So populate CL with AutotoolsToolchain cflags + env = Environment() + c_flags = AutotoolsToolchain(self).cflags + if c_flags: + env.define("CL", c_flags) + env.vars(self).save_script("conanbuildenv_nmake") + else: + tc = AutotoolsToolchain(self) + tc.generate() + + def _build_nmake(self): + with chdir(self, self.source_folder): + target = "libdeflate.dll" if self.options.shared else "libdeflatestatic.lib" + self.run(f"nmake /f Makefile.msc {target}") + + def _build_make(self): + autotools = Autotools(self) + with chdir(self, self.source_folder): + autotools.make() + + def build(self): + apply_conandata_patches(self) + if is_msvc(self) or self._is_clangcl: + self._build_nmake() + else: + self._build_make() + + def _package_windows(self): + copy(self, "libdeflate.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder) + if self.options.shared: + copy(self, "*deflate.lib", dst=os.path.join(self.package_folder, "lib"), src=self.source_folder) + copy(self, "*deflate.dll", dst=os.path.join(self.package_folder, "bin"), src=self.source_folder) + else: + copy(self, "*deflatestatic.lib", dst=os.path.join(self.package_folder, "lib"), src=self.source_folder) + + def _package_make(self): + autotools = Autotools(self) + with chdir(self, self.source_folder): + # Note: not actually an autotools project, is a Makefile project. + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}", "PREFIX=/"]) + rmdir(self, os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.a" if self.options.shared else "*.[so|dylib]*", os.path.join(self.package_folder, "lib") ) + + def package(self): + copy(self, "COPYING", self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if self.settings.os == "Windows": + self._package_windows() + else: + self._package_make() + + def package_info(self): + self.cpp_info.set_property("pkg_config_name", "libdeflate") + prefix = "lib" if self.settings.os == "Windows" else "" + suffix = "static" if self.settings.os == "Windows" and not self.options.shared else "" + self.cpp_info.libs = [f"{prefix}deflate{suffix}"] + if self.settings.os == "Windows" and self.options.shared: + self.cpp_info.defines = ["LIBDEFLATE_DLL"] diff --git a/recipes/libdeflate/all/patches/1.12-0001-fix-makefiles.patch b/recipes/libdeflate/pre_1.15/patches/1.12-0001-fix-makefiles.patch similarity index 100% rename from recipes/libdeflate/all/patches/1.12-0001-fix-makefiles.patch rename to recipes/libdeflate/pre_1.15/patches/1.12-0001-fix-makefiles.patch diff --git a/recipes/libdeflate/all/patches/1.14-0001-fix-makefiles.patch b/recipes/libdeflate/pre_1.15/patches/1.14-0001-fix-makefiles.patch similarity index 100% rename from recipes/libdeflate/all/patches/1.14-0001-fix-makefiles.patch rename to recipes/libdeflate/pre_1.15/patches/1.14-0001-fix-makefiles.patch diff --git a/recipes/libdeflate/all/patches/1.7-0001-fix-makefiles.patch b/recipes/libdeflate/pre_1.15/patches/1.7-0001-fix-makefiles.patch similarity index 100% rename from recipes/libdeflate/all/patches/1.7-0001-fix-makefiles.patch rename to recipes/libdeflate/pre_1.15/patches/1.7-0001-fix-makefiles.patch diff --git a/recipes/libdeflate/all/patches/1.9-0001-fix-makefiles.patch b/recipes/libdeflate/pre_1.15/patches/1.9-0001-fix-makefiles.patch similarity index 100% rename from recipes/libdeflate/all/patches/1.9-0001-fix-makefiles.patch rename to recipes/libdeflate/pre_1.15/patches/1.9-0001-fix-makefiles.patch diff --git a/recipes/libdeflate/pre_1.15/test_package/CMakeLists.txt b/recipes/libdeflate/pre_1.15/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..4fdc2b4814ab35 --- /dev/null +++ b/recipes/libdeflate/pre_1.15/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +find_package(libdeflate REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libdeflate::libdeflate) diff --git a/recipes/libdeflate/pre_1.15/test_package/conanfile.py b/recipes/libdeflate/pre_1.15/test_package/conanfile.py new file mode 100644 index 00000000000000..e845ae751a3017 --- /dev/null +++ b/recipes/libdeflate/pre_1.15/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libdeflate/pre_1.15/test_package/test_package.c b/recipes/libdeflate/pre_1.15/test_package/test_package.c new file mode 100644 index 00000000000000..9fe99b840f34da --- /dev/null +++ b/recipes/libdeflate/pre_1.15/test_package/test_package.c @@ -0,0 +1,8 @@ +#include + +int main () { + struct libdeflate_compressor *c; + c = libdeflate_alloc_compressor(12); + libdeflate_free_compressor(c); + return 0; +} diff --git a/recipes/libdeflate/pre_1.15/test_v1_package/CMakeLists.txt b/recipes/libdeflate/pre_1.15/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/libdeflate/pre_1.15/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libdeflate/pre_1.15/test_v1_package/conanfile.py b/recipes/libdeflate/pre_1.15/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/libdeflate/pre_1.15/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/libdrm/all/conandata.yml b/recipes/libdrm/all/conandata.yml index 385cbe19798415..c664ae449755db 100644 --- a/recipes/libdrm/all/conandata.yml +++ b/recipes/libdrm/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.4.114": + url: "https://dri.freedesktop.org/libdrm/libdrm-2.4.114.tar.xz" + sha256: "3049cf843a47d12e5eeefbc3be3496d782fa09f42346bf0b7defe3d1e598d026" "2.4.109": url: "https://dri.freedesktop.org/libdrm/libdrm-2.4.109.tar.xz" sha256: "629352e08c1fe84862ca046598d8a08ce14d26ab25ee1f4704f993d074cb7f26" diff --git a/recipes/libdrm/all/conanfile.py b/recipes/libdrm/all/conanfile.py index cbc5ff81fd540f..aad89cccd5bf6d 100644 --- a/recipes/libdrm/all/conanfile.py +++ b/recipes/libdrm/all/conanfile.py @@ -1,8 +1,11 @@ import os import re -from conans import ConanFile, Meson, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, load, mkdir, rmdir, save +from conan.tools.scm import Version +from conans import Meson class LibdrmConan(ConanFile): @@ -63,11 +66,13 @@ def _build_subfolder(self): return "build_subfolder" def build_requirements(self): - self.build_requires("meson/0.59.0") + self.build_requires("meson/0.64.1") def config_options(self): if self.settings.os == 'Windows': del self.options.fPIC + if Version(self.version) >= "2.4.111": + del self.options.libkms def configure(self): del self.settings.compiler.libcxx @@ -86,19 +91,28 @@ def validate(self): raise ConanInvalidConfiguration("libdrm supports only Linux or FreeBSD") def source(self): - tools.get(**self.conan_data["sources"][self.version], + get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) def _configure_meson(self): meson = Meson(self) defs={ - "cairo-tests" : "false", + "cairo-tests" : "disabled" if Version(self.version) >= "2.4.113" else "false", "install-test-programs": "false" } - for o in ["libkms", "intel", "radeon", "amdgpu","nouveau", "vmwgfx", "omap", "exynos", - "freedreno", "tegra", "vc4", "etnaviv", "valgrind", "freedreno-kgsl", "udev"]: - defs[o] = "true" if getattr(self.options, o) else "false" + if Version(self.version) < "2.4.111": + defs["libkms"] = "true" if self.options.libkms else "false" + + defs["freedreno-kgsl"] = "true" if getattr(self.options, "freedreno-kgsl") else "false" + defs["udev"] = "true" if self.options.udev else "false" + + for o in ["intel", "radeon", "amdgpu","nouveau", "vmwgfx", "omap", "exynos", + "freedreno", "tegra", "vc4", "etnaviv", "valgrind"]: + if Version(self.version) >= "2.4.113": + defs[o] = "enabled" if getattr(self.options, o) else "disabled" + else: + defs[o] = "true" if getattr(self.options, o) else "false" defs["datadir"] = os.path.join(self.package_folder, "res") defs["mandir"] = os.path.join(self.package_folder, "res", "man") @@ -116,12 +130,12 @@ def build(self): def package(self): meson = self._configure_meson() meson.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.mkdir(os.path.join(self.package_folder, "licenses")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + mkdir(self, os.path.join(self.package_folder, "licenses")) # Extract the License/s from the header to a file - tmp = tools.load(os.path.join(self._source_subfolder, "include", "drm", "drm.h")) + tmp = load(self, os.path.join(self._source_subfolder, "include", "drm", "drm.h")) license_contents = re.search("\*\/.*(\/\*(\*(?!\/)|[^*])*\*\/)", tmp, re.DOTALL)[1] - tools.save(os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents) + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents) def package_info(self): self.cpp_info.components["libdrm_libdrm"].libs = ["drm"] @@ -130,11 +144,12 @@ def package_info(self): if self.settings.os == "Linux": self.cpp_info.components["libdrm_libdrm"].requires = ["linux-headers-generic::linux-headers-generic"] - if self.options.libkms: - self.cpp_info.components["libdrm_libkms"].libs = ["kms"] - self.cpp_info.components["libdrm_libkms"].includedirs.append(os.path.join('include', 'libkms')) - self.cpp_info.components["libdrm_libkms"].requires = ["libdrm_libdrm"] - self.cpp_info.components["libdrm_libkms"].set_property("pkg_config_name", "libkms") + if Version(self.version) < "2.4.111": + if self.options.libkms: + self.cpp_info.components["libdrm_libkms"].libs = ["kms"] + self.cpp_info.components["libdrm_libkms"].includedirs.append(os.path.join('include', 'libkms')) + self.cpp_info.components["libdrm_libkms"].requires = ["libdrm_libdrm"] + self.cpp_info.components["libdrm_libkms"].set_property("pkg_config_name", "libkms") if self.options.vc4: self.cpp_info.components["libdrm_vc4"].requires = ["libdrm_libdrm"] diff --git a/recipes/libdrm/config.yml b/recipes/libdrm/config.yml index 4beea198f8d482..90fca8a547e3e5 100644 --- a/recipes/libdrm/config.yml +++ b/recipes/libdrm/config.yml @@ -1,3 +1,5 @@ versions: + "2.4.114": + folder: all "2.4.109": folder: all diff --git a/recipes/libdxfrw/all/CMakeLists.txt b/recipes/libdxfrw/all/CMakeLists.txt deleted file mode 100644 index d17aaff199b4a6..00000000000000 --- a/recipes/libdxfrw/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/libdxfrw/all/conandata.yml b/recipes/libdxfrw/all/conandata.yml index 56e52bb33b6944..163bfa884b042a 100644 --- a/recipes/libdxfrw/all/conandata.yml +++ b/recipes/libdxfrw/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.2.0": + url: "https://github.com/LibreCAD/libdxfrw/archive/refs/tags/LC2.2.0.tar.gz" + sha256: "b56535f8c234bb119b94e11b2436651531869ba0171bb10166b007588e97d69f" "1.0.1": url: "https://github.com/LibreCAD/libdxfrw/archive/1.0.1.tar.gz" sha256: "eea1021b296cb9ba4cab4417106e41d53a8fadfffe2cd108efe46afb04e2ec34" diff --git a/recipes/libdxfrw/all/conanfile.py b/recipes/libdxfrw/all/conanfile.py index 7f1e177de05d8e..22166b390cae7c 100644 --- a/recipes/libdxfrw/all/conanfile.py +++ b/recipes/libdxfrw/all/conanfile.py @@ -1,62 +1,80 @@ +from conan import ConanFile +from conan.tools.files import get, copy, rmdir, replace_in_file +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os -from conans import ConanFile, CMake, tools +required_conan_version = ">=1.53.0" class LibdxfrwConan(ConanFile): name = "libdxfrw" + description = "C++ library to read/write DXF and read DWG files" license = "GPL-2.0-or-later" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/LibreCAD/libdxfrw" - description = "C++ library to read/write DXF and read DWG files" topics = ("dxf", "dwg", "cad") - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" - exports_sources = "CMakeLists.txt" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], - "fPIC": [True, False] + "fPIC": [True, False], } default_options = { "shared": False, - "fPIC": True + "fPIC": True, } - _cmake = None @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_folder = self.name + "-" + self.version - os.rename(extracted_folder, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LIBDXFRW_BUILD_DOC"] = False + tc.generate() def build(self): - cmake = self._configure_cmake() + if Version(self.version) >= "2.2.0": + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "-Werror", "") + + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH env var: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) self.cpp_info.libs = ["dxfrw"] + + self.cpp_info.set_property("pkg_config_name", "libdxfrw") + if self.settings.os == "Linux": self.cpp_info.system_libs = ["m"] + + bin_path = os.path.join(self.package_folder, "bin") + self.output.info(f"Appending PATH env var: {bin_path}") + self.env_info.PATH.append(bin_path) diff --git a/recipes/libdxfrw/all/test_package/CMakeLists.txt b/recipes/libdxfrw/all/test_package/CMakeLists.txt index 6aab347eddf535..3fefb4e7b7d8ad 100644 --- a/recipes/libdxfrw/all/test_package/CMakeLists.txt +++ b/recipes/libdxfrw/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libdxfrw REQUIRED CONFIG) -add_executable(example example.cpp) -target_link_libraries(example ${CONAN_LIBS}) -set_property(TARGET example PROPERTY CXX_STANDARD 11) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libdxfrw::libdxfrw) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/libdxfrw/all/test_package/conanfile.py b/recipes/libdxfrw/all/test_package/conanfile.py index 44bb963d9da9a8..a9fb96656f2039 100644 --- a/recipes/libdxfrw/all/test_package/conanfile.py +++ b/recipes/libdxfrw/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" -class LibdxfrwTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -13,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - self.run(os.path.join("bin", "example"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libdxfrw/all/test_package/example.cpp b/recipes/libdxfrw/all/test_package/test_package.cpp similarity index 100% rename from recipes/libdxfrw/all/test_package/example.cpp rename to recipes/libdxfrw/all/test_package/test_package.cpp diff --git a/recipes/libdxfrw/all/test_v1_package/CMakeLists.txt b/recipes/libdxfrw/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/libdxfrw/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libdxfrw/all/test_v1_package/conanfile.py b/recipes/libdxfrw/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/libdxfrw/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libdxfrw/config.yml b/recipes/libdxfrw/config.yml index 715e55357a17be..a9f4753aaca711 100644 --- a/recipes/libdxfrw/config.yml +++ b/recipes/libdxfrw/config.yml @@ -1,3 +1,5 @@ versions: + "2.2.0": + folder: all "1.0.1": folder: all diff --git a/recipes/libffi/all/conanfile.py b/recipes/libffi/all/conanfile.py index fca2894b5fa7bc..0e8716fc839caa 100644 --- a/recipes/libffi/all/conanfile.py +++ b/recipes/libffi/all/conanfile.py @@ -10,7 +10,7 @@ import os import shutil -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class LibffiConan(ConanFile): @@ -44,18 +44,9 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): basic_layout(self, src_folder="src") diff --git a/recipes/libftdi/1.x/CMakeLists.txt b/recipes/libftdi/1.x/CMakeLists.txt deleted file mode 100644 index f4e5078f422288..00000000000000 --- a/recipes/libftdi/1.x/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) -add_subdirectory(source_subfolder) diff --git a/recipes/libftdi/1.x/conandata.yml b/recipes/libftdi/1.x/conandata.yml index db04076175670b..3548dde53d9187 100644 --- a/recipes/libftdi/1.x/conandata.yml +++ b/recipes/libftdi/1.x/conandata.yml @@ -5,5 +5,5 @@ sources: patches: "1.5": - patch_file: "patches/0001-cmake-targets.patch" - base_path: "source_subfolder" - + patch_description: "Fix cmake targets and call project after cmake_minimum_required." + patch_type: "conan" diff --git a/recipes/libftdi/1.x/conanfile.py b/recipes/libftdi/1.x/conanfile.py index 951dbaa4f8b8a1..16c0bb3e46d342 100644 --- a/recipes/libftdi/1.x/conanfile.py +++ b/recipes/libftdi/1.x/conanfile.py @@ -1,103 +1,111 @@ import os -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.files import get, rmdir, export_conandata_patches +from conan.tools.files import apply_conandata_patches, copy +from conan.tools.cmake import CMakeToolchain, CMake, CMakeDeps, cmake_layout +from conan.tools.microsoft import is_msvc +from conan.errors import ConanInvalidConfiguration +required_conan_version = ">=1.53.0" class LibFtdiConan(ConanFile): name = "libftdi" description = "A library to talk to FTDI chips" license = "LGPL-2.0-only", "GPLv2-or-later" - topics = ("conan", "libftdi1") + topics = "ftdi" homepage = "https://www.intra2net.com/en/developer/libftdi/" url = "https://github.com/conan-io/conan-center-index" - exports_sources = ["CMakeLists.txt", "patches/*"] - generators = "cmake", "cmake_find_package", "pkg_config" settings = "os", "arch", "compiler", "build_type" options = { - "shared" : [True, False], + "shared" : [True, False], "fPIC" : [True, False], "enable_cpp_wrapper" : [True, False], "build_eeprom_tool" : [True, False], "use_streaming" : [True, False], } default_options = { - "shared": False, + "shared": False, "fPIC": True, "enable_cpp_wrapper": True, "build_eeprom_tool" : False, "use_streaming" : True, } - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "libftdi1-" + self.version - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + strip_root=True) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if self.settings.compiler == "Visual Studio": + if is_msvc(self): self.options.use_streaming = False + def layout(self): + cmake_layout(self, src_folder="src") + def configure(self): if self.options.shared: - del self.options.fPIC - - def _configure_cmake(self): - if self._cmake: - return self._cmake + self.options.rm_safe("fPIC") + self.license = ("LGPL-2.1-only", "GPL-2.0-only") if self.options.build_eeprom_tool or self.options.enable_cpp_wrapper else ("LGPL-2.1-only") - self._cmake = CMake(self) - options = { - "BUILD_TESTS": False, - "EXAMPLES": False, - "FTDI_EEPROM": self.options.build_eeprom_tool, - "FTDIPP" : self.options.enable_cpp_wrapper, - "STATICLIBS": not self.options.shared, - "ENABLE_STREAMING": self.options.use_streaming, - } - self._cmake.definitions.update(options) - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTS"] = False + tc.variables["EXAMPLES"] = False + tc.variables["FTDI_EEPROM"] = self.options.build_eeprom_tool + tc.variables["FTDIPP"] = self.options.enable_cpp_wrapper + tc.variables["ENABLE_STREAMING"] = self.options.use_streaming + tc.variables["LIB_SUFFIX"] = "" + tc.generate() + tc = CMakeDeps(self) + tc.generate() def requirements(self): - self.requires("libusb/1.0.24") - self.requires("boost/1.75.0") + self.requires("libusb/1.0.26") + if self.options.enable_cpp_wrapper: + self.requires("boost/1.80.0") def validate(self): - if self.settings.compiler == "Visual Studio" and self.options.use_streaming: + if is_msvc(self) and self.options.use_streaming: raise ConanInvalidConfiguration("VS doesn't not compile with enabled option use_streaming") def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING.LIB", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + if self.options.build_eeprom_tool or self.options.enable_cpp_wrapper: + copy(self, "COPYING.GPL", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - lib_folder = os.path.join(self.package_folder, "lib",) - tools.rmdir(os.path.join(lib_folder, "cmake")) - tools.rmdir(os.path.join(lib_folder, "pkgconfig")) + lib_folder = os.path.join(self.package_folder, "lib") + rmdir(self, os.path.join(lib_folder, "cmake")) + rmdir(self, os.path.join(lib_folder, "pkgconfig")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "LibFTDI1" - self.cpp_info.names["cmake_find_package_multi"] = "LibFTDI1" - self.cpp_info.names["pkgconfig"] = "libftdi1" + # Remove "self.cpp_info.filenames.." statements in Conan V2 + self.cpp_info.filenames['cmake_find_package'] = "LibFTDI1" + self.cpp_info.filenames['cmake_find_package_multi'] = "LibFTDI1" - self.cpp_info.components["ftdi"].names["pkg_config"] = "libftdi1" + self.cpp_info.set_property("cmake_file_name", "LibFTDI1") + self.cpp_info.components["ftdi"].set_property("pkg_config_name", "libftdi1") self.cpp_info.components["ftdi"].libs = ["ftdi1"] self.cpp_info.components["ftdi"].requires = ["libusb::libusb"] self.cpp_info.components["ftdi"].includedirs.append(os.path.join("include", "libftdi1")) + self.cpp_info.components["ftdi"].names["pkg_config"] = "libftdi1" - self.cpp_info.components["ftdipp"].names["pkg_config"] = "libftdi1pp" - self.cpp_info.components["ftdipp"].libs = ["ftdipp1"] - self.cpp_info.components["ftdipp"].requires = ["ftdi", "boost::headers"] - self.cpp_info.components["ftdipp"].includedirs.append(os.path.join("include", "libftdipp1")) + if self.options.enable_cpp_wrapper: + self.cpp_info.components["ftdipp"].set_property("pkg_config_name", "libftdipp1") + self.cpp_info.components["ftdipp"].libs = ["ftdipp1"] + self.cpp_info.components["ftdipp"].requires = ["ftdi", "boost::headers"] + self.cpp_info.components["ftdipp"].names["pkg_config"] = "libftdipp1" + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["ftdipp"].system_libs.append("m") diff --git a/recipes/libftdi/1.x/patches/0001-cmake-targets.patch b/recipes/libftdi/1.x/patches/0001-cmake-targets.patch index 751ff4099d9f07..9ca28ffd1fc5eb 100644 --- a/recipes/libftdi/1.x/patches/0001-cmake-targets.patch +++ b/recipes/libftdi/1.x/patches/0001-cmake-targets.patch @@ -4,7 +4,9 @@ index 5aecafc..abb133f 100644 +++ b/CMakeLists.txt @@ -1,36 +1,54 @@ -# Project - project(libftdi1 C) +-project(libftdi1 C) ++cmake_minimum_required(VERSION 3.15 FATAL_ERROR) ++project(libftdi1) + set(MAJOR_VERSION 1) set(MINOR_VERSION 5) @@ -21,7 +23,6 @@ index 5aecafc..abb133f 100644 set(CMAKE_COLOR_MAKEFILE ON) -cmake_minimum_required(VERSION 2.6 FATAL_ERROR) + -+cmake_minimum_required(VERSION 3.0 FATAL_ERROR) +if(POLICY CMP0057) + cmake_policy(SET CMP0057 NEW) +endif() diff --git a/recipes/libftdi/1.x/test_package/CMakeLists.txt b/recipes/libftdi/1.x/test_package/CMakeLists.txt index 9664d7d8fd8453..efdfd6bd92c126 100644 --- a/recipes/libftdi/1.x/test_package/CMakeLists.txt +++ b/recipes/libftdi/1.x/test_package/CMakeLists.txt @@ -1,13 +1,11 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() find_package(LibFTDI1 REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(test_package - PRIVATE LibFTDI1::ftdipp) +target_link_libraries(${PROJECT_NAME} + PRIVATE libftdi::ftdipp) diff --git a/recipes/libftdi/1.x/test_package/conanfile.py b/recipes/libftdi/1.x/test_package/conanfile.py index b64dc731888531..39f848c25cab4b 100644 --- a/recipes/libftdi/1.x/test_package/conanfile.py +++ b/recipes/libftdi/1.x/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools - class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libftdi/1.x/test_v1_package/CMakeLists.txt b/recipes/libftdi/1.x/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..eb26d0c1b0943b --- /dev/null +++ b/recipes/libftdi/1.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) + +project(test_package) + + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) + diff --git a/recipes/libftdi/1.x/test_v1_package/conanfile.py b/recipes/libftdi/1.x/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..90c431a11ee68e --- /dev/null +++ b/recipes/libftdi/1.x/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libgd/all/CMakeLists.txt b/recipes/libgd/all/CMakeLists.txt deleted file mode 100644 index 088ba36390ce82..00000000000000 --- a/recipes/libgd/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.1.2) -project(cmake_wrapper) - -set(CMAKE_C_STANDARD 99) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/libgd/all/conandata.yml b/recipes/libgd/all/conandata.yml index 775ee73a32dbbc..e4acad43d15b22 100644 --- a/recipes/libgd/all/conandata.yml +++ b/recipes/libgd/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.3.3": + url: "https://github.com/libgd/libgd/archive/gd-2.3.3.tar.gz" + sha256: "24429f9d0dbe0f865aaa4b1a63558242396ba9134e6cfd32ca5e486a84483350" "2.3.2": url: "https://github.com/libgd/libgd/archive/gd-2.3.2.tar.gz" sha256: "dcc22244d775f469bee21dce1ea42552adbb72ba0cc423f9fa6a64601b3a1893" @@ -12,29 +15,47 @@ sources: url: "https://github.com/libgd/libgd/releases/download/gd-2.2.5/libgd-2.2.5.tar.gz" sha256: "a66111c9b4a04e818e9e2a37d7ae8d4aae0939a100a36b0ffb52c706a09074b5" patches: + "2.3.3": + - patch_file: "patches/2.3.3-qualify-nondll.patch" + patch_description: "use BGD_NONDLL instead NONDLL" + patch_type: "portability" + - patch_file: "patches/2.3.x-png-msvc.patch" + patch_description: "support png on msvc" + patch_type: "portability" "2.3.2": - patch_file: "patches/remove-unistd-h.patch" - base_path: "source_subfolder" + patch_description: "remove unistd.h to fix build error" + patch_type: "portability" - patch_file: "patches/2.3.2-qualify-nondll.patch" - base_path: "source_subfolder" + patch_description: "use BGD_NONDLL instead NONDLL" + patch_type: "portability" - patch_file: "patches/2.3.x-png-msvc.patch" - base_path: "source_subfolder" + patch_description: "support png on msvc" + patch_type: "portability" "2.3.1": - patch_file: "patches/remove-unistd-h.patch" - base_path: "source_subfolder" + patch_description: "remove unistd.h to fix build error" + patch_type: "portability" - patch_file: "patches/qualify-nondll.patch" - base_path: "source_subfolder" + patch_description: "use BGD_NONDLL instead NONDLL" + patch_type: "portability" - patch_file: "patches/2.3.x-png-msvc.patch" - base_path: "source_subfolder" + patch_description: "support png on msvc" + patch_type: "portability" "2.3.0": - patch_file: "patches/remove-unistd-h.patch" - base_path: "source_subfolder" + patch_description: "remove unistd.h to fix build error" + patch_type: "portability" - patch_file: "patches/qualify-nondll.patch" - base_path: "source_subfolder" + patch_description: "use BGD_NONDLL instead NONDLL" + patch_type: "portability" - patch_file: "patches/2.3.x-png-msvc.patch" - base_path: "source_subfolder" + patch_description: "support png on msvc" + patch_type: "conan" "2.2.5": - patch_file: "patches/2.2.5-msvc-static-lib.patch" - base_path: "source_subfolder" + patch_description: "support static build on msvc" + patch_type: "conan" - patch_file: "patches/2.2.5-qualify-nondll.patch" - base_path: "source_subfolder" + patch_description: "use BGD_NONDLL instead NONDLL" + patch_type: "conan" diff --git a/recipes/libgd/all/conanfile.py b/recipes/libgd/all/conanfile.py index b26dbdb4a30148..169f9e3ba1f8c7 100644 --- a/recipes/libgd/all/conanfile.py +++ b/recipes/libgd/all/conanfile.py @@ -1,21 +1,20 @@ from conan import ConanFile from conan.tools.microsoft import is_msvc -from conans import CMake -from conan.tools.files import get, patch, replace_in_file, rmdir, collect_libs +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, replace_in_file from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.47.0" - +required_conan_version = ">=1.53.0" class LibgdConan(ConanFile): name = "libgd" + description = ("GD is an open source code library for the dynamic" + "creation of images by programmers.") license = "BSD-like" url = "https://github.com/conan-io/conan-center-index" - description = ("GD is an open source code library for the dynamic " - "creation of images by programmers.") - topics = ("images", "graphics") homepage = "https://libgd.github.io" + topics = ("images", "graphics") settings = "os", "arch", "compiler", "build_type" options = { @@ -35,17 +34,8 @@ class LibgdConan(ConanFile): "with_freetype": False, } - exports_sources = "CMakeLists.txt", "patches/**" - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -53,77 +43,87 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_png: - self.requires("libpng/1.6.37") + self.requires("libpng/1.6.39") if is_msvc(self): self.requires("getopt-for-visual-studio/20200201") if self.options.with_jpeg: - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") if self.options.with_tiff: self.requires("libtiff/4.4.0") if self.options.with_freetype: self.requires("freetype/2.12.1") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_C_STANDARD"] = "99" + tc.variables["BUILD_STATIC_LIBS"] = not self.options.shared + if Version(self.version) >= "2.3.0": + tc.variables["ENABLE_GD_FORMATS"] = True + tc.variables["ENABLE_PNG"] = self.options.with_png + tc.variables["ENABLE_LIQ"] = False + tc.variables["ENABLE_JPEG"] = self.options.with_jpeg + tc.variables["ENABLE_TIFF"] = self.options.with_tiff + tc.variables["ENABLE_ICONV"] = False + tc.variables["ENABLE_XPM"] = False + tc.variables["ENABLE_FREETYPE"] = self.options.with_freetype + tc.variables["ENABLE_FONTCONFIG"] = False + tc.variables["ENABLE_WEBP"] = False + if Version(self.version) >= "2.3.2": + tc.variables["ENABLE_HEIF"] = False + tc.variables["ENABLE_AVIF"] = False + if Version(self.version) >= "2.3.0": + tc.variables["ENABLE_RAQM"] = False + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def _patch(self): - for patch_file in self.conan_data.get("patches", {}).get(self.version, []): - patch(self, **patch_file) - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") + apply_conandata_patches(self) + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") replace_in_file(self, cmakelists, "${CMAKE_SOURCE_DIR}", "${CMAKE_CURRENT_SOURCE_DIR}") replace_in_file(self, cmakelists, "SET(CMAKE_MODULE_PATH \"${GD_SOURCE_DIR}/cmake/modules\")", "LIST(APPEND CMAKE_MODULE_PATH \"${GD_SOURCE_DIR}/cmake/modules\")") - replace_in_file(self, os.path.join(self._source_subfolder, "src", "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), "RUNTIME DESTINATION bin", "RUNTIME DESTINATION bin BUNDLE DESTINATION bin") - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_STATIC_LIBS"] = not self.options.shared - if Version(self.version) >= "2.3.0": - self._cmake.definitions["ENABLE_GD_FORMATS"] = True - self._cmake.definitions["ENABLE_PNG"] = self.options.with_png - self._cmake.definitions["ENABLE_LIQ"] = False - self._cmake.definitions["ENABLE_JPEG"] = self.options.with_jpeg - self._cmake.definitions["ENABLE_TIFF"] = self.options.with_tiff - self._cmake.definitions["ENABLE_ICONV"] = False - self._cmake.definitions["ENABLE_XPM"] = False - self._cmake.definitions["ENABLE_FREETYPE"] = self.options.with_freetype - self._cmake.definitions["ENABLE_FONTCONFIG"] = False - self._cmake.definitions["ENABLE_WEBP"] = False - if Version(self.version) >= "2.3.2": - self._cmake.definitions["ENABLE_HEIF"] = False - self._cmake.definitions["ENABLE_AVIF"] = False - if Version(self.version) >= "2.3.0": - self._cmake.definitions["ENABLE_RAQM"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - def build(self): self._patch() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() + rmdir(self, os.path.join(self.package_folder, "share")) rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): - self.cpp_info.names["pkg_config"]= "gdlib" - self.cpp_info.libs = collect_libs(self) + prefix_libs = "lib" if self.settings.os == "Windows" else "" + suffix_libs = "_static" if self.settings.os == "Windows" and not self.options.shared else "" + self.cpp_info.libs = [f"{prefix_libs}gd{suffix_libs}"] + self.cpp_info.set_property("pkg_config_name", "gdlib") + if self.settings.os == "Windows" and not self.options.shared: self.cpp_info.defines.append("BGD_NONDLL") self.cpp_info.defines.append("BGDWIN32") @@ -133,3 +133,6 @@ def package_info(self): bin_path = os.path.join(self.package_folder, "bin") self.output.info("Appending PATH environment variable: {}".format(bin_path)) self.env_info.PATH.append(bin_path) + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["pkg_config"]= "gdlib" diff --git a/recipes/libgd/all/patches/2.3.3-qualify-nondll.patch b/recipes/libgd/all/patches/2.3.3-qualify-nondll.patch new file mode 100644 index 00000000000000..8dfcac14807e1b --- /dev/null +++ b/recipes/libgd/all/patches/2.3.3-qualify-nondll.patch @@ -0,0 +1,26 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 3839bc7..3b271a8 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -86,7 +86,7 @@ if (WIN32 AND NOT MINGW AND NOT MSYS) + # SET_TARGET_PROPERTIES(${GD_LIB} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:msvcrt.lib") + + if (BUILD_STATIC_LIBS) +- SET_PROPERTY(TARGET ${GD_LIB_STATIC} APPEND PROPERTY COMPILE_DEFINITIONS NONDLL=1) ++ SET_PROPERTY(TARGET ${GD_LIB_STATIC} APPEND PROPERTY COMPILE_DEFINITIONS BGD_NONDLL=1) + endif() + + ENDIF(WIN32 AND NOT MINGW AND NOT MSYS) +diff --git a/src/gd.h b/src/gd.h +index 3056039..e3635ab 100644 +--- a/src/gd.h ++++ b/src/gd.h +@@ -47,7 +47,7 @@ extern "C" { + /* http://gcc.gnu.org/wiki/Visibility */ + #if defined(_WIN32) || defined(CYGWIN) || defined(_WIN32_WCE) + # ifdef BGDWIN32 +-# ifdef NONDLL ++# ifdef BGD_NONDLL + # define BGD_EXPORT_DATA_PROT + # else + # ifdef __GNUC__ diff --git a/recipes/libgd/all/test_package/CMakeLists.txt b/recipes/libgd/all/test_package/CMakeLists.txt index e4f67d2408b0ac..bc37e91faebeb9 100644 --- a/recipes/libgd/all/test_package/CMakeLists.txt +++ b/recipes/libgd/all/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) find_package(libgd CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} PRIVATE libgd::libgd) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/libgd/all/test_package/conanfile.py b/recipes/libgd/all/test_package/conanfile.py index 38f4483872d47f..a9fb96656f2039 100644 --- a/recipes/libgd/all/test_package/conanfile.py +++ b/recipes/libgd/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libgd/all/test_v1_package/CMakeLists.txt b/recipes/libgd/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/libgd/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libgd/all/test_v1_package/conanfile.py b/recipes/libgd/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/libgd/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libgd/config.yml b/recipes/libgd/config.yml index 73437bcaccb055..5343c7968ac522 100644 --- a/recipes/libgd/config.yml +++ b/recipes/libgd/config.yml @@ -1,4 +1,6 @@ versions: + "2.3.3": + folder: all "2.3.2": folder: all "2.3.1": diff --git a/recipes/libhydrogen/all/conandata.yml b/recipes/libhydrogen/all/conandata.yml new file mode 100644 index 00000000000000..23536a9b5f3062 --- /dev/null +++ b/recipes/libhydrogen/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "cci.20221115": + url: "https://github.com/jedisct1/libhydrogen/archive/580da280c59f72ca67e56333f5122f8ef040c74d.tar.gz" + sha256: "cf52deeb31f83302acfc784e9dab4b93e9c13e77aad3f629cf0761d30cae7e72" +patches: + "cci.20221115": + - patch_file: "patches/0001-fix-cmake.patch" + patch_description: "CMake: Use C99 or higher, avoid to inject arch specific flags, fix dll install & don't build tests" + patch_type: "portability" diff --git a/recipes/libhydrogen/all/conanfile.py b/recipes/libhydrogen/all/conanfile.py new file mode 100644 index 00000000000000..5b5dc91e28942b --- /dev/null +++ b/recipes/libhydrogen/all/conanfile.py @@ -0,0 +1,71 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +import os + +required_conan_version = ">=1.53.0" + + +class LibhydrogenConan(ConanFile): + name = "libhydrogen" + description = "A lightweight, secure, easy-to-use crypto library suitable for constrained environments." + license = "ISC" + topics = ("cryptography", "crypto", "gimli") + homepage = "https://github.com/jedisct1/libhydrogen" + url = "https://github.com/conan-io/conan-center-index" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") + + 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["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "hydrogen") + self.cpp_info.set_property("cmake_target_name", "hydrogen::hydrogen") + self.cpp_info.libs = ["hydrogen"] + + # TODO: to remove in conan v2 + self.cpp_info.names["cmake_find_package"] = "hydrogen" + self.cpp_info.names["cmake_find_package_multi"] = "hydrogen" diff --git a/recipes/libhydrogen/all/patches/0001-fix-cmake.patch b/recipes/libhydrogen/all/patches/0001-fix-cmake.patch new file mode 100644 index 00000000000000..6fb76a8526ead5 --- /dev/null +++ b/recipes/libhydrogen/all/patches/0001-fix-cmake.patch @@ -0,0 +1,46 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 3.1) ++cmake_minimum_required(VERSION 3.8) + + project(hydrogen LANGUAGES C) + +@@ -39,6 +39,7 @@ set(arduino_files "library.properties") + + # Compile options + ++if(0) + get_setting(target_arch STRING "Target system architecture (fed to the compiler's -march=XXX).") + if(NOT target_arch AND NOT CMAKE_CROSSCOMPILING) + set(target_arch native) +@@ -84,6 +85,7 @@ set(compile_options + # unsigned" + /wd4310 # * suppress warning "cast truncates constant value" + >) ++endif() + + # Prefix project files with the project root + +@@ -106,6 +108,7 @@ set(targets_export_name "${PROJECT_NAME}-targets") + + install(TARGETS "${PROJECT_NAME}" + EXPORT "${targets_export_name}" ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}") + +@@ -134,6 +137,8 @@ install(FILES "${config_file}" DESTINATION "${install_config_dir}") + + export(EXPORT "${targets_export_name}" FILE "${targets_export_file}" NAMESPACE "${PROJECT_NAME}::") + ++target_compile_features(${PROJECT_NAME} PUBLIC c_std_99) ++if(0) + export(PACKAGE "${PROJECT_NAME}") + + # Tests +@@ -191,3 +196,4 @@ add_custom_command(OUTPUT "${arduino_package_file}" + VERBATIM) + + add_custom_target("${PROJECT_NAME}-arduino-package" DEPENDS "${arduino_package_file}" VERBATIM) ++endif() diff --git a/recipes/libhydrogen/all/test_package/CMakeLists.txt b/recipes/libhydrogen/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..2090c805028725 --- /dev/null +++ b/recipes/libhydrogen/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) + +find_package(hydrogen REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE hydrogen::hydrogen) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/libhydrogen/all/test_package/conanfile.py b/recipes/libhydrogen/all/test_package/conanfile.py new file mode 100644 index 00000000000000..0a6bc68712d901 --- /dev/null +++ b/recipes/libhydrogen/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libhydrogen/all/test_package/test_package.c b/recipes/libhydrogen/all/test_package/test_package.c new file mode 100644 index 00000000000000..2fc97802ccc3e4 --- /dev/null +++ b/recipes/libhydrogen/all/test_package/test_package.c @@ -0,0 +1,8 @@ +#include +#include + +int main() +{ + printf("%lu\n", (unsigned long)hydro_random_u32()); + return 0; +} diff --git a/recipes/libhydrogen/all/test_v1_package/CMakeLists.txt b/recipes/libhydrogen/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/libhydrogen/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libhydrogen/all/test_v1_package/conanfile.py b/recipes/libhydrogen/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/libhydrogen/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/libhydrogen/config.yml b/recipes/libhydrogen/config.yml new file mode 100644 index 00000000000000..7bdf816a5ffbd6 --- /dev/null +++ b/recipes/libhydrogen/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20221115": + folder: all diff --git a/recipes/libiberty/all/conandata.yml b/recipes/libiberty/all/conandata.yml index 45b4e09c87240d..b3c320fd465510 100644 --- a/recipes/libiberty/all/conandata.yml +++ b/recipes/libiberty/all/conandata.yml @@ -1,4 +1,4 @@ sources: "9.1.0": - sha256: be303f7a8292982a35381489f5a9178603cbe9a4715ee4fa4a815d6bcd2b658d - url: https://ftp.gnu.org/pub/gnu/gcc/gcc-9.1.0/gcc-9.1.0.tar.gz + url: "https://ftp.gnu.org/pub/gnu/gcc/gcc-9.1.0/gcc-9.1.0.tar.gz" + sha256: "be303f7a8292982a35381489f5a9178603cbe9a4715ee4fa4a815d6bcd2b658d" diff --git a/recipes/libiberty/all/conanfile.py b/recipes/libiberty/all/conanfile.py index 3454090fe5df77..3d6300e66678c8 100644 --- a/recipes/libiberty/all/conanfile.py +++ b/recipes/libiberty/all/conanfile.py @@ -1,16 +1,18 @@ -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 copy, get, rename, rmdir +from conan.tools.layout import basic_layout +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.microsoft import is_msvc, unix_path import os - -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class LibibertyConan(ConanFile): name = "libiberty" - version = "9.1.0" description = "A collection of subroutines used by various GNU programs" - topics = ("conan", "libiberty", "gnu", "gnu-collection") + topics = ("gnu", "gnu-collection") url = "https://github.com/conan-io/conan-center-index" homepage = "https://gcc.gnu.org/onlinedocs/libiberty" license = "LGPL-2.1" @@ -22,59 +24,65 @@ class LibibertyConan(ConanFile): "fPIC": True, } - _autotools = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _settings_build(self): + return getattr(self, "settings_build", self.settings) @property def _libiberty_folder(self): - return os.path.join(self._source_subfolder, self.name) + return os.path.join(self.source_folder, "libiberty") def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): - if self.settings.compiler == "Visual Studio": + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") + + def validate(self): + if is_msvc(self): raise ConanInvalidConfiguration("libiberty can not be built by Visual Studio.") - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + + def build_requirements(self): + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - tools.rmdir(os.path.join(self._source_subfolder, "gcc")) - tools.rmdir(os.path.join(self._source_subfolder, "libstdc++-v3")) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - conf_args = [ - "--enable-install-libiberty", - ] - self._autotools.configure(args=conf_args, configure_dir=self._libiberty_folder) - return self._autotools + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + rmdir(self, os.path.join(self.source_folder, "gcc")) + rmdir(self, os.path.join(self.source_folder, "libstdc++-v3")) + + def generate(self): + tc = AutotoolsToolchain(self) + tc.configure_args.append("--enable-install-libiberty") + tc.generate() def build(self): - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.configure(build_script_folder=self._libiberty_folder) autotools.make() def package(self): - self.copy(pattern="COPYING.LIB", src=self._libiberty_folder, dst="licenses") - autotools = self._configure_autotools() - autotools.install() + copy(self, "COPYING.LIB", src=self._libiberty_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) self._package_xx(32) self._package_xx(64) def _package_xx(self, arch): - lib_arch_dir = os.path.join(self.package_folder, "lib{}".format(arch)) + lib_arch_dir = os.path.join(self.package_folder, f"lib{arch}") if os.path.exists(lib_arch_dir): libdir = os.path.join(self.package_folder, "lib") - tools.rmdir(libdir) - tools.rename(lib_arch_dir, libdir) + rmdir(self, libdir) + rename(self, lib_arch_dir, libdir) def package_info(self): self.cpp_info.libs = ["iberty"] diff --git a/recipes/libiberty/all/test_package/CMakeLists.txt b/recipes/libiberty/all/test_package/CMakeLists.txt index 34af13462f44f8..c618a0e2a663be 100644 --- a/recipes/libiberty/all/test_package/CMakeLists.txt +++ b/recipes/libiberty/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libiberty REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libiberty::libiberty) diff --git a/recipes/libiberty/all/test_package/conanfile.py b/recipes/libiberty/all/test_package/conanfile.py index bd7165a553cf41..98ab55852ad565 100644 --- a/recipes/libiberty/all/test_package/conanfile.py +++ b/recipes/libiberty/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.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/libiberty/all/test_v1_package/CMakeLists.txt b/recipes/libiberty/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/libiberty/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libiberty/all/test_v1_package/conanfile.py b/recipes/libiberty/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/libiberty/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/libiconv/all/conanfile.py b/recipes/libiconv/all/conanfile.py index 0c3682db0b91ca..465c95b05f4f35 100644 --- a/recipes/libiconv/all/conanfile.py +++ b/recipes/libiconv/all/conanfile.py @@ -15,7 +15,6 @@ from conan.tools.layout import basic_layout from conan.tools.microsoft import is_msvc, unix_path from conan.tools.scm import Version -from conans.tools import get_gnu_triplet import os required_conan_version = ">=1.53.0" @@ -24,7 +23,7 @@ class LibiconvConan(ConanFile): name = "libiconv" description = "Convert text to and from Unicode" - license = "LGPL-2.1" + license = ("LGPL-2.0-or-later", "LGPL-2.1-or-later") url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.gnu.org/software/libiconv/" topics = ("iconv", "text", "encoding", "locale", "unicode", "conversion") @@ -63,6 +62,10 @@ def configure(self): self.options.rm_safe("fPIC") self.settings.rm_safe("compiler.libcxx") self.settings.rm_safe("compiler.cppstd") + if Version(self.version) >= "1.17": + self.license = "LGPL-2.1-or-later" + else: + self.license = "LGPL-2.0-or-later" def layout(self): basic_layout(self, src_folder="src") @@ -81,17 +84,23 @@ def generate(self): env.generate() tc = AutotoolsToolchain(self) - if (self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) >= "12") or \ - (self.settings.compiler == "msvc" and Version(self.settings.compiler.version) >= "180"): + msvc_version = {"Visual Studio": "12", "msvc": "180"} + if is_msvc(self) and Version(self.settings.compiler.version) >= msvc_version[str(self.settings.compiler)]: + # https://github.com/conan-io/conan/issues/6514 tc.extra_cflags.append("-FS") if cross_building(self) and is_msvc(self): + triplet_arch_windows = {"x86_64": "x86_64", "x86": "i686", "armv8": "aarch64"} # ICU doesn't like GNU triplet of conan for msvc (see https://github.com/conan-io/conan/issues/12546) - host = get_gnu_triplet(str(self.settings.os), str(self.settings.arch), "gcc") - build = get_gnu_triplet(str(self._settings_build.os), str(self._settings_build.arch), "gcc") - tc.configure_args.extend([ - f"--host={host}", - f"--build={build}", - ]) + host_arch = triplet_arch_windows.get(str(self.settings.arch)) + build_arch = triplet_arch_windows.get(str(self._settings_build.arch)) + + if host_arch and build_arch: + host = f"{host_arch}-w64-mingw32" + build = f"{build_arch}-w64-mingw32" + tc.configure_args.extend([ + f"--host={host}", + f"--build={build}", + ]) tc.generate() if is_msvc(self) or self._is_clang_cl: diff --git a/recipes/libinterpolate/all/conandata.yml b/recipes/libinterpolate/all/conandata.yml new file mode 100644 index 00000000000000..04998351d32b8b --- /dev/null +++ b/recipes/libinterpolate/all/conandata.yml @@ -0,0 +1,5 @@ +sources: + "2.6.2": + url: + - "https://github.com/CD3/libInterpolate/archive/refs/tags/2.6.2.tar.gz" + sha256: "42f40c9b77fda6e0c52ed39b522458456e89fb4981d63f812aa158c6f4be8ab0" diff --git a/recipes/libinterpolate/all/conanfile.py b/recipes/libinterpolate/all/conanfile.py new file mode 100644 index 00000000000000..62e7baa6e4ea42 --- /dev/null +++ b/recipes/libinterpolate/all/conanfile.py @@ -0,0 +1,101 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os + + +required_conan_version = ">=1.52.0" + + +class PackageConan(ConanFile): + name = "libinterpolate" + description = "A C++ interpolation library with a simple interface that supports multiple interpolation methods." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/CD3/libInterpolate" + topics = ("math", "spline", "interpolation", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "15", + "msvc": "19.0", + "gcc": "7", + "clang": "4", + "apple-clang": "10", + } + + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("boost/1.80.0", transitive_headers=True) + self.requires("eigen/3.3.7", transitive_headers=True) + + def validate(self): + if self.settings.os != "Linux": + raise ConanInvalidConfiguration("libInterpolate currently only supports Linux. Upstream PR's are welcome (https://github.com/CD3/libInterpolate/issues/14).") + + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get( + str(self.settings.compiler), False + ) + if ( + minimum_version + and Version(self.settings.compiler.version) < minimum_version + ): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def build(self): + pass + + def package(self): + copy( + self, + pattern="LICENSE.md", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + ) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "src"), + ) + + def package_id(self): + self.info.clear() + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "libInterpolate") + self.cpp_info.set_property( + "cmake_target_name", "libInterpolate::Interpolate" + ) + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "libInterpolate" + self.cpp_info.filenames["cmake_find_package_multi"] = "libInterpolate" + self.cpp_info.names["cmake_find_package"] = "libInterpolate" + self.cpp_info.names["cmake_find_package_multi"] = "libInterpolate" + self.cpp_info.components["Interpolate"].names["cmake_find_package"] = "Interpolate" + self.cpp_info.components["Interpolate"].names["cmake_find_package_multi"] = "Interpolate" + self.cpp_info.components["Interpolate"].requires = ["eigen::eigen","boost::boost"] diff --git a/recipes/libinterpolate/all/test_package/CMakeLists.txt b/recipes/libinterpolate/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..05a0c0e049e56f --- /dev/null +++ b/recipes/libinterpolate/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(libInterpolate REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libInterpolate::Interpolate) diff --git a/recipes/libinterpolate/all/test_package/conanfile.py b/recipes/libinterpolate/all/test_package/conanfile.py new file mode 100644 index 00000000000000..48499fa0989d9c --- /dev/null +++ b/recipes/libinterpolate/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +# It will become the standard on Conan 2.x +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libinterpolate/all/test_package/test_package.cpp b/recipes/libinterpolate/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..c42798ca5d0d03 --- /dev/null +++ b/recipes/libinterpolate/all/test_package/test_package.cpp @@ -0,0 +1,21 @@ +#include +#include + +#include + +int main(void) +{ + std::vector x(2), y(2); + + x[0] = 0; + x[1] = 1; + y[0] = 10; + y[1] = 20; + + _1D::LinearInterpolator interp; + interp.setData(x, y); + + std::cout << "f(0.5) = " << interp(0.5) << std::endl; + + return EXIT_SUCCESS; +} diff --git a/recipes/libinterpolate/all/test_v1_package/CMakeLists.txt b/recipes/libinterpolate/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..b5b37b01b534cd --- /dev/null +++ b/recipes/libinterpolate/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) + diff --git a/recipes/libinterpolate/all/test_v1_package/conanfile.py b/recipes/libinterpolate/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..c492184eec19c2 --- /dev/null +++ b/recipes/libinterpolate/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +# legacy validation with Conan 1.x +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libinterpolate/config.yml b/recipes/libinterpolate/config.yml new file mode 100644 index 00000000000000..8296a371553bed --- /dev/null +++ b/recipes/libinterpolate/config.yml @@ -0,0 +1,3 @@ +versions: + "2.6.2": + folder: all diff --git a/recipes/libjpeg/all/conandata.yml b/recipes/libjpeg/all/conandata.yml index 772d543a521400..b147d8fb1dd7dd 100644 --- a/recipes/libjpeg/all/conandata.yml +++ b/recipes/libjpeg/all/conandata.yml @@ -11,7 +11,13 @@ sources: patches: "9e": - patch_file: "patches/0001-9e-libjpeg-add-msvc-dll-support.patch" + patch_description: "Add support to generate DLL on Windows" + patch_type: "portability" "9d": - patch_file: "patches/0001-libjpeg-add-msvc-dll-support.patch" + patch_description: "Add support to generate DLL on Windows" + patch_type: "portability" "9c": - patch_file: "patches/0001-libjpeg-add-msvc-dll-support.patch" + patch_description: "Add support to generate DLL on Windows" + patch_type: "portability" diff --git a/recipes/libjpeg/all/conanfile.py b/recipes/libjpeg/all/conanfile.py index a3daa952b7fe24..bc3d55d6dfc4ab 100644 --- a/recipes/libjpeg/all/conanfile.py +++ b/recipes/libjpeg/all/conanfile.py @@ -9,6 +9,7 @@ import re import shutil + required_conan_version = ">=1.53.0" diff --git a/recipes/libjpeg/all/test_package/CMakeLists.txt b/recipes/libjpeg/all/test_package/CMakeLists.txt index f6e52def001115..7885c9011ac59a 100644 --- a/recipes/libjpeg/all/test_package/CMakeLists.txt +++ b/recipes/libjpeg/all/test_package/CMakeLists.txt @@ -1,18 +1,20 @@ cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES C) -if(MSVC) - add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS) -endif() - -find_package(JPEG REQUIRED) +find_package(JPEG REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} PRIVATE JPEG::JPEG) target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) +if (MSVC) + target_compile_definitions(${PROJECT_NAME} PRIVATE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS) +endif() if(BUILD_TRANSUPP) add_executable(test_transupp test_transupp.c ${LIBJPEG_RES_DIR}/transupp.c) target_link_libraries(test_transupp PRIVATE JPEG::JPEG) target_compile_features(test_transupp PRIVATE c_std_99) + if (MSVC) + target_compile_definitions(test_transupp PRIVATE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS) + endif() endif() diff --git a/recipes/libjpeg/all/test_v1_package/CMakeLists.txt b/recipes/libjpeg/all/test_v1_package/CMakeLists.txt index e6eccdbfe81845..961b416af6b075 100644 --- a/recipes/libjpeg/all/test_v1_package/CMakeLists.txt +++ b/recipes/libjpeg/all/test_v1_package/CMakeLists.txt @@ -4,16 +4,5 @@ project(test_package LANGUAGES C) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -if(MSVC) - add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS) -endif() - -find_package(JPEG REQUIRED) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE JPEG::JPEG) -target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) - -add_executable(test_transupp ../test_package/test_transupp.c "${CONAN_LIBJPEG_ROOT}/res/transupp.c") -target_link_libraries(test_transupp PRIVATE JPEG::JPEG) -target_compile_features(test_transupp PRIVATE c_std_99) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libjpeg/all/test_v1_package/conanfile.py b/recipes/libjpeg/all/test_v1_package/conanfile.py index d9893410defb60..803919e9ca6722 100644 --- a/recipes/libjpeg/all/test_v1_package/conanfile.py +++ b/recipes/libjpeg/all/test_v1_package/conanfile.py @@ -5,7 +5,7 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" + generators = "cmake", "cmake_find_package", "cmake_find_package_multi" @property def _test_transupp(self): @@ -14,6 +14,9 @@ def _test_transupp(self): def build(self): cmake = CMake(self) + cmake.definitions["BUILD_TRANSUPP"] = self._test_transupp + if self._test_transupp: + cmake.definitions["LIBJPEG_RES_DIR"] = os.path.join(self.deps_cpp_info["libjpeg"].rootpath, "res").replace("\\", "/") cmake.configure() cmake.build() diff --git a/recipes/libmicrohttpd/all/conandata.yml b/recipes/libmicrohttpd/all/conandata.yml index 0276eb4f1e40eb..ead353a01eb871 100644 --- a/recipes/libmicrohttpd/all/conandata.yml +++ b/recipes/libmicrohttpd/all/conandata.yml @@ -4,9 +4,6 @@ sources: sha256: "9278907a6f571b391aab9644fd646a5108ed97311ec66f6359cebbedb0a4e3bb" patches: "0.9.75": - - patch_file: "patches/0.9.75-0001-msbuild-RuntimeLibrary.patch" - patch_description: "Remove RuntimeLibrary from vcxproject + use conantoolchain.props" - patch_type: "conan" - - patch_file: "patches/0.9.75-0002-allow-release-with-debug-runtime.patch" - patch_description: "Remove RuntimeLibrary from vcxproject + use conantoolchain.props" + - patch_file: "patches/0.9.75-0001-allow-release-with-debug-runtime.patch" + patch_description: "Allow to build Release with Debug runtime" patch_type: "conan" diff --git a/recipes/libmicrohttpd/all/conanfile.py b/recipes/libmicrohttpd/all/conanfile.py index 1811e1503e36c7..82ca43a61b7adc 100644 --- a/recipes/libmicrohttpd/all/conanfile.py +++ b/recipes/libmicrohttpd/all/conanfile.py @@ -1,12 +1,15 @@ -from conan import ConanFile, Version -from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir -from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps -from conan.tools.microsoft import MSBuild, MSBuildToolchain, is_msvc, vs_layout -from conan.tools.layout import basic_layout +from conan import ConanFile from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, MSBuild, MSBuildToolchain import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.54.0" class LibmicrohttpdConan(ConanFile): @@ -42,12 +45,13 @@ class LibmicrohttpdConan(ConanFile): def _settings_build(self): return getattr(self, "settings_build", self.settings) + def export_sources(self): + export_conandata_patches(self) + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC if self.settings.os != "Linux": - try: - del self.options.fPIC - except Exception: - pass del self.options.epoll if is_msvc(self): del self.options.with_https @@ -58,62 +62,45 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") - def validate(self): - if is_msvc(self): - if self.info.settings.arch not in ("x86", "x86_64"): - raise ConanInvalidConfiguration("Unsupported architecture (only x86 and x86_64 are supported)") - if self.info.settings.build_type not in ("Release", "Debug"): - raise ConanInvalidConfiguration("Unsupported build type (only Release and Debug are supported)") + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - if self.options.get_safe("with_zlib", False): + if self.options.get_safe("with_zlib"): self.requires("zlib/1.2.13") - if self.options.get_safe("with_https", False): + + def validate(self): + if is_msvc(self) and self.settings.arch not in ("x86", "x86_64"): + raise ConanInvalidConfiguration("Unsupported architecture (only x86 and x86_64 are supported)") + if self.options.get_safe("with_https"): raise ConanInvalidConfiguration("gnutls is not (yet) available in cci") def build_requirements(self): if self._settings_build.os == "Windows" and not is_msvc(self): self.win_bash = True - if not self.conf.get("tools.microsoft.bash:path", default=False, check_type=str): + if not self.conf.get("tools.microsoft.bash:path", check_type=str): self.tool_requires("msys2/cci.latest") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) - - def export_sources(self): - export_conandata_patches(self) - - def layout(self): - if is_msvc(self): - vs_layout(self) - else: - basic_layout(self) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): if is_msvc(self): tc = MSBuildToolchain(self) tc.configuration = self._msvc_configuration + tc.properties["WholeProgramOptimization"] = "false" tc.generate() else: + VirtualBuildEnv(self).generate() + if not cross_building(self): + VirtualRunEnv(self).generate(scope="build") + tc = AutotoolsToolchain(self) yes_no = lambda v: "yes" if v else "no" - pkg = PkgConfigDeps(self) - pkg.generate() - autotools = AutotoolsToolchain(self) - autotools.configure_args.extend([ + tc.configure_args.extend([ f"--enable-shared={yes_no(self.options.shared)}", f"--enable-static={yes_no(not self.options.shared)}", f"--enable-https={yes_no(self.options.with_https)}", @@ -125,44 +112,48 @@ def generate(self): "--disable-examples", "--disable-curl", ]) - if self.settings.os == "Windows": - if self.options.with_zlib: - # This fixes libtool refusing to build a shared library when it sees `-lz` - libdir = self.deps_cpp_info["zlib"].lib_paths[0] - autotools.extra_ldflags.extend([os.path.join(libdir, lib).replace("\\", "/") for lib in os.listdir(libdir)]) - autotools.generate() + tc.generate() + AutotoolsDeps(self).generate() @property def _msvc_configuration(self): - return f"{self.settings.build_type}-{'dll' if self.options.shared else 'static'}" + prefix = "Debug" if self.settings.build_type == "Debug" else "Release" + suffix = "dll" if self.options.shared else "static" + return f"{prefix}-{suffix}" @property def _msvc_sln_folder(self): - if self.settings.compiler == "Visual Studio": - if Version(self.settings.compiler.version) >= 16: - subdir = "VS-Any-Version" - else: - subdir = "VS2017" - else: - subdir = "VS-Any-Version" - return os.path.join("w32", subdir) - - @property - def _msvc_platform(self): - return { - "x86": "Win32", - "x86_64": "x64", - }[str(self.settings.arch)] - - def _patch_sources(self): - apply_conandata_patches(self) + # TODO: use VS-Any-Version folder once https://github.com/conan-io/conan/pull/12817 available in conan client + return os.path.join(self.source_folder, "w32", "VS2022") def build(self): - self._patch_sources() + apply_conandata_patches(self) if is_msvc(self): + #============================== + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + vcxproj_file = os.path.join(self._msvc_sln_folder, "libmicrohttpd.vcxproj") + replace_in_file( + self, vcxproj_file, + "true", + "", + ) + toolset = MSBuildToolchain(self).toolset + replace_in_file( + self, vcxproj_file, + "v143", + f"{toolset}", + ) + conantoolchain_props = os.path.join(self.generators_folder, MSBuildToolchain.filename) + replace_in_file( + self, vcxproj_file, + "", + f"", + ) + #============================== + msbuild = MSBuild(self) msbuild.build_type = self._msvc_configuration - msbuild.platform = self._msvc_platform + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform msbuild.build(sln=os.path.join(self._msvc_sln_folder, "libmicrohttpd.sln"), targets=["libmicrohttpd"]) else: autotools = Autotools(self) @@ -170,22 +161,18 @@ def build(self): autotools.make() def package(self): - copy(self, "COPYING", os.path.join(self.source_folder), os.path.join(self.package_folder, "licenses")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) if is_msvc(self): - # 32-bit (x86) libraries are stored in the root - output_dir = os.path.join(self.build_folder, self._msvc_sln_folder, "Output") - if self.settings.arch in ("x86_64", ): - # 64-bit (x64) libraries are stored in a subfolder - output_dir = os.path.join(output_dir, self._msvc_platform) - copy(self, "*.lib", output_dir, os.path.join(self.package_folder, "lib")) - copy(self, "*.dll", output_dir, os.path.join(self.package_folder, "bin")) - copy(self, "*.h", output_dir, os.path.join(self.package_folder, "include")) + output_dir = os.path.join(self._msvc_sln_folder, "Output") + copy(self, "*.lib", src=output_dir, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dll", src=output_dir, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "*.h", src=output_dir, dst=os.path.join(self.package_folder, "include"), keep_path=False) else: autotools = Autotools(self) autotools.install() - rm(self, "*.la", os.path.join(self.package_folder, "lib")) rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.set_property("pkg_config_name", "libmicrohttps") diff --git a/recipes/libmicrohttpd/all/patches/0.9.75-0002-allow-release-with-debug-runtime.patch b/recipes/libmicrohttpd/all/patches/0.9.75-0001-allow-release-with-debug-runtime.patch similarity index 79% rename from recipes/libmicrohttpd/all/patches/0.9.75-0002-allow-release-with-debug-runtime.patch rename to recipes/libmicrohttpd/all/patches/0.9.75-0001-allow-release-with-debug-runtime.patch index c833862d3cee1e..1f25b932b8a7a9 100644 --- a/recipes/libmicrohttpd/all/patches/0.9.75-0002-allow-release-with-debug-runtime.patch +++ b/recipes/libmicrohttpd/all/patches/0.9.75-0001-allow-release-with-debug-runtime.patch @@ -1,4 +1,3 @@ -This patch allows building libmicrohttpd in Release configuration with a debug runtime (e.g. MTd) --- src/microhttpd/mhd_assert.h +++ src/microhttpd/mhd_assert.h @@ -35,7 +35,7 @@ diff --git a/recipes/libmicrohttpd/all/patches/0.9.75-0001-msbuild-RuntimeLibrary.patch b/recipes/libmicrohttpd/all/patches/0.9.75-0001-msbuild-RuntimeLibrary.patch deleted file mode 100644 index b3dc82df26fa99..00000000000000 --- a/recipes/libmicrohttpd/all/patches/0.9.75-0001-msbuild-RuntimeLibrary.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- w32/common/common-build-settings.vcxproj -+++ w32/common/common-build-settings.vcxproj -@@ -5,7 +5,7 @@ - Only 0 and 1 are used currently --> - 0 - 1 -- -+ - - $(SolutionDir);$(MhdW32Common);$(MhdSrc)include;$(IncludePath) - ---- w32/common/libmicrohttpd-build-settings.vcxproj -+++ w32/common/libmicrohttpd-build-settings.vcxproj -@@ -31,8 +31,8 @@ - - - _LIB;MHD_W32LIB;%(PreprocessorDefinitions) -- MultiThreadedDebug -- MultiThreaded -+ - - - Ws2_32.lib -@@ -45,8 +45,8 @@ - - - _USRDLL;MHD_W32DLL;%(PreprocessorDefinitions) -- MultiThreadedDebugDLL -- MultiThreadedDLL -+ - - - Ws2_32.lib;%(AdditionalDependencies) diff --git a/recipes/libmicrohttpd/all/test_package/conanfile.py b/recipes/libmicrohttpd/all/test_package/conanfile.py index f72d1f660e19fb..98ab55852ad565 100644 --- a/recipes/libmicrohttpd/all/test_package/conanfile.py +++ b/recipes/libmicrohttpd/all/test_package/conanfile.py @@ -1,12 +1,12 @@ from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeDeps", "VirtualRunEnv" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" test_type = "explicit" def layout(self): @@ -15,10 +15,6 @@ def layout(self): def requirements(self): self.requires(self.tested_reference_str) - def generate(self): - tc = CMakeToolchain(self) - tc.generate() - def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/libmicrohttpd/all/test_v1_package/CMakeLists.txt b/recipes/libmicrohttpd/all/test_v1_package/CMakeLists.txt index 0b95e58322269d..0d20897301b68b 100644 --- a/recipes/libmicrohttpd/all/test_v1_package/CMakeLists.txt +++ b/recipes/libmicrohttpd/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(libmicrohttpd REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE libmicrohttpd::libmicrohttpd) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libmount/all/conanfile.py b/recipes/libmount/all/conanfile.py index 8285c441a6f9af..301b7a46d28de9 100644 --- a/recipes/libmount/all/conanfile.py +++ b/recipes/libmount/all/conanfile.py @@ -40,7 +40,7 @@ def layout(self): def validate(self): if self.info.settings.os != "Linux": - raise ConanInvalidConfiguration("only Linux is supported") + raise ConanInvalidConfiguration(f"{self.ref} only supports Linux") def source(self): get(self, **self.conan_data["sources"][self.version], @@ -67,9 +67,11 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "sbin")) 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, "usr")) rm(self, "*.la", os.path.join(self.package_folder, "lib")) def package_info(self): self.cpp_info.libs = ["mount", "blkid"] + self.cpp_info.system_libs = ["rt"] self.cpp_info.includedirs.append(os.path.join("include", "libmount")) self.cpp_info.set_property("pkg_config_name", "mount") diff --git a/recipes/libmp3lame/all/conanfile.py b/recipes/libmp3lame/all/conanfile.py index a7f412633c3e7c..2ccdfa9388237d 100644 --- a/recipes/libmp3lame/all/conanfile.py +++ b/recipes/libmp3lame/all/conanfile.py @@ -1,4 +1,5 @@ from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name from conan.tools.env import Environment, VirtualBuildEnv from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, rename, replace_in_file, rm, rmdir from conan.tools.gnu import Autotools, AutotoolsToolchain @@ -155,6 +156,7 @@ def package(self): autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) rmdir(self, os.path.join(self.package_folder, "share")) rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.libs = ["mp3lame"] diff --git a/recipes/libmysqlclient/all/conandata.yml b/recipes/libmysqlclient/all/conandata.yml index 3284d28321c06a..b97a4d30e8770b 100644 --- a/recipes/libmysqlclient/all/conandata.yml +++ b/recipes/libmysqlclient/all/conandata.yml @@ -1,4 +1,9 @@ sources: + "8.0.31": + url: + - "https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.31.tar.gz" + - "https://mirrors.huaweicloud.com/mysql/Downloads/MySQL-8.0/mysql-8.0.31.tar.gz" + sha256: "67bb8cba75b28e95c7f7948563f01fb84528fcbb1a35dba839d4ce44fe019baa" "8.0.30": url: - "https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.30.tar.gz" @@ -16,6 +21,9 @@ sources: url: "https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.17.tar.gz" sha256: "c6e3f38199a77bfd8a4925ca00b252d3b6159b90e4980c7232f1c58d6ca759d6" patches: + "8.0.31": + - patch_file: "patches/0006-fix-cpp20-build-8.0.29.patch" + base_path: "source_subfolder" "8.0.30": - patch_file: "patches/0006-fix-cpp20-build-8.0.29.patch" base_path: "source_subfolder" diff --git a/recipes/libmysqlclient/config.yml b/recipes/libmysqlclient/config.yml index 33b7ea062fadba..7e3ed9bab4222e 100644 --- a/recipes/libmysqlclient/config.yml +++ b/recipes/libmysqlclient/config.yml @@ -1,4 +1,6 @@ versions: + "8.0.31": + folder: all "8.0.30": folder: all "8.0.29": diff --git a/recipes/libpcap/all/CMakeLists.txt b/recipes/libpcap/all/CMakeLists.txt deleted file mode 100644 index 1632809b71a7a3..00000000000000 --- a/recipes/libpcap/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/libpcap/all/conanfile.py b/recipes/libpcap/all/conanfile.py index be545689c190c7..b2ff6d95b30ce3 100644 --- a/recipes/libpcap/all/conanfile.py +++ b/recipes/libpcap/all/conanfile.py @@ -1,11 +1,19 @@ -from conan.tools.microsoft import msvc_runtime_flag -from conans import AutoToolsBuildEnvironment, tools, ConanFile, CMake -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name, is_apple_os +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import chdir, copy, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version import glob import os import shutil -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.53.0" class LibPcapConan(ConanFile): @@ -21,33 +29,18 @@ class LibPcapConan(ConanFile): "shared": [True, False], "fPIC": [True, False], "enable_libusb": [True, False], - "enable_universal": [True, False, "deprecated"], } default_options = { "shared": False, "fPIC": True, "enable_libusb": False, - "enable_universal": "deprecated", } - exports_sources = "CMakeLists.txt" - generators = "cmake" - _cmake = None - _autotools = None - # TODO: Add dbus-glib when available # TODO: Add libnl-genl when available # TODO: Add libbluetooth when available # TODO: Add libibverbs when available - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) @@ -60,98 +53,93 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd - if self.options.enable_universal != "deprecated": - self.output.warn("enable_universal is a deprecated option. Do not use.") + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + if self.settings.os == "Windows": + cmake_layout(self, src_folder="src") + else: + basic_layout(self, src_folder="src") def requirements(self): if self.options.get_safe("enable_libusb"): - self.requires("libusb/1.0.24") + self.requires("libusb/1.0.26") def validate(self): - if tools.Version(self.version) < "1.10.0" and self.settings.os == "Macos" and self.options.shared: - raise ConanInvalidConfiguration("libpcap {} can not be built as shared on OSX.".format(self.version)) - if hasattr(self, "settings_build") and tools.cross_building(self) and \ - self.options.shared and tools.is_apple_os(self.settings.os): + if Version(self.version) < "1.10.0" and self.settings.os == "Macos" and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared on OSX.") + if hasattr(self, "settings_build") and cross_building(self) and \ + self.options.shared and is_apple_os(self): raise ConanInvalidConfiguration("cross-build of libpcap shared is broken on Apple") - if tools.Version(self.version) < "1.10.1" and self.settings.os == "Windows" and not self.options.shared: - raise ConanInvalidConfiguration("libpcap can not be built static on Windows below version 1.10.1.") - - def package_id(self): - del self.info.options.enable_universal + if Version(self.version) < "1.10.1" and self.settings.os == "Windows" and not self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} can not be built static on Windows") def build_requirements(self): - if self._settings_build.os == "Windows": - self.build_requires("winflexbison/2.5.24") + if is_msvc(self, build_context=True): + self.tool_requires("winflexbison/2.5.24") else: - self.build_requires("bison/3.7.6") - self.build_requires("flex/2.6.4") + self.tool_requires("bison/3.8.2") + self.tool_requires("flex/2.6.4") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - self._autotools.libs = [] - yes_no = lambda v: "yes" if v else "no" - configure_args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--enable-usb={}".format(yes_no(self.options.get_safe("enable_libusb"))), - "--disable-universal", - "--without-libnl", - "--disable-bluetooth", - "--disable-packet-ring", - "--disable-dbus", - "--disable-rdma", - ] - if tools.cross_building(self): - target_os = "linux" if self.settings.os == "Linux" else "null" - configure_args.append("--with-pcap=%s" % target_os) - elif "arm" in self.settings.arch and self.settings.os == "Linux": - configure_args.append("--host=arm-linux") - self._autotools.configure(args=configure_args, configure_dir=self._source_subfolder) - # Relocatable shared lib on macOS - tools.replace_in_file("Makefile", "-install_name $(libdir)/", "-install_name @rpath/") - return self._autotools - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - if not self.options.shared: - self._cmake.definitions["ENABLE_REMOTE"] = False - if self._is_msvc: - self._cmake.definitions["USE_STATIC_RT"] = "MT" in msvc_runtime_flag(self) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + VirtualBuildEnv(self).generate() + + if self.settings.os == "Windows": + tc = CMakeToolchain(self) + if not self.options.shared: + tc.variables["ENABLE_REMOTE"] = False + if is_msvc(self): + tc.variables["USE_STATIC_RT"] = is_msvc_static_runtime(self) + else: + # Don't force -static-libgcc for MinGW, because conan users expect + # to inject this compilation flag themselves + tc.variables["USE_STATIC_RT"] = False + tc.generate() else: - # Don't force -static-libgcc for MinGW, because conan users expect - # to inject this compilation flag themselves - self._cmake.definitions["USE_STATIC_RT"] = False - self._cmake.configure() - return self._cmake + if not cross_building(self): + VirtualRunEnv(self).generate(scope="build") + + tc = AutotoolsToolchain(self) + yes_no = lambda v: "yes" if v else "no" + tc.configure_args.extend([ + f"--enable-usb={yes_no(self.options.get_safe('enable_libusb'))}", + "--disable-universal", + "--without-libnl", + "--disable-bluetooth", + "--disable-packet-ring", + "--disable-dbus", + "--disable-rdma", + ]) + if cross_building(self): + target_os = "linux" if self.settings.os == "Linux" else "null" + tc.configure_args.append(f"--with-pcap={target_os}") + elif "arm" in self.settings.arch and self.settings.os == "Linux": + tc.configure_args.append("--host=arm-linux") + tc.generate() + + AutotoolsDeps(self).generate() def build(self): if self.settings.os == "Windows": - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() else: - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) if self.settings.os == "Windows": - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.pdb") - if self.options.shared: - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "pcap_static.lib") def flatten_filetree(folder): for file in glob.glob(folder + "/**/*"): @@ -160,24 +148,27 @@ def flatten_filetree(folder): os.rmdir(subdir) # libpcap installs into a subfolder like x64 or amd64 - with tools.chdir(self.package_folder): + with chdir(self, self.package_folder): flatten_filetree("bin") flatten_filetree("lib") + + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + if self.options.shared: + rm(self, "pcap_static.lib", os.path.join(self.package_folder, "lib")) + rm(self, "libpcap.a", os.path.join(self.package_folder, "lib")) else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) if self.options.shared: - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.a") + rm(self, "*.a", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.set_property("pkg_config_name", "libpcap") suffix = "_static" if self.settings.os == "Windows" and not self.options.shared else "" - self.cpp_info.libs = ["pcap{}".format(suffix)] + self.cpp_info.libs = [f"pcap{suffix}"] if self.settings.os == "Windows": self.cpp_info.system_libs = ["ws2_32"] - - bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) - self.env_info.PATH.append(bindir) diff --git a/recipes/libpcap/all/test_package/CMakeLists.txt b/recipes/libpcap/all/test_package/CMakeLists.txt index f77be2959f6fc5..647522630d58c8 100644 --- a/recipes/libpcap/all/test_package/CMakeLists.txt +++ b/recipes/libpcap/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(libpcap REQUIRED CONFIG) add_executable(test_package test_package.c) -target_link_libraries(test_package libpcap::libpcap) +target_link_libraries(test_package PRIVATE libpcap::libpcap) diff --git a/recipes/libpcap/all/test_package/conanfile.py b/recipes/libpcap/all/test_package/conanfile.py index 38f4483872d47f..98ab55852ad565 100644 --- a/recipes/libpcap/all/test_package/conanfile.py +++ b/recipes/libpcap/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libpcap/all/test_v1_package/CMakeLists.txt b/recipes/libpcap/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/libpcap/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libpcap/all/test_v1_package/conanfile.py b/recipes/libpcap/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/libpcap/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/libpciaccess/all/conandata.yml b/recipes/libpciaccess/all/conandata.yml index a9f6a4bea00576..223034d0c456a9 100644 --- a/recipes/libpciaccess/all/conandata.yml +++ b/recipes/libpciaccess/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.17": + url: "https://www.x.org/archive//individual/lib/libpciaccess-0.17.tar.xz" + sha256: "74283ba3c974913029e7a547496a29145b07ec51732bbb5b5c58d5025ad95b73" "0.16": - url: "https://gitlab.freedesktop.org/xorg/lib/libpciaccess/-/archive/libpciaccess-0.16/libpciaccess-libpciaccess-0.16.tar.gz" - sha256: "983b31ab586e3f2da810bd6bcbbcf9d643f8968d2280c6e573fec95b556e971f" + url: "https://www.x.org/archive//individual/lib/libpciaccess-0.16.tar.gz" + sha256: "84413553994aef0070cf420050aa5c0a51b1956b404920e21b81e96db6a61a27" diff --git a/recipes/libpciaccess/all/test_v1_package/conanfile.py b/recipes/libpciaccess/all/test_v1_package/conanfile.py index 75c0cd81d2d2f3..38f4483872d47f 100644 --- a/recipes/libpciaccess/all/test_v1_package/conanfile.py +++ b/recipes/libpciaccess/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/libpciaccess/config.yml b/recipes/libpciaccess/config.yml index 95828182e346dd..5b9c678c9d3927 100644 --- a/recipes/libpciaccess/config.yml +++ b/recipes/libpciaccess/config.yml @@ -1,3 +1,5 @@ versions: + "0.17": + folder: all "0.16": folder: all diff --git a/recipes/libpq/all/conanfile.py b/recipes/libpq/all/conanfile.py index bedadf84e5a0c5..39386dc4ee730b 100644 --- a/recipes/libpq/all/conanfile.py +++ b/recipes/libpq/all/conanfile.py @@ -1,9 +1,18 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import cross_building +from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, msvc_runtime_flag, unix_path, VCVars +from conan.tools.files import replace_in_file, rmdir +from conan.tools.scm import Version import os import glob -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class LibpqConan(ConanFile): @@ -30,14 +39,6 @@ class LibpqConan(ConanFile): _autotools = None - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _is_clang8_x86(self): return self.settings.os == "Linux" and \ @@ -50,147 +51,134 @@ def _settings_build(self): return getattr(self, "settings_build", self.settings) def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": - del self.options.fPIC - del self.options.disable_rpath + self.options.rm_safe('fPIC') + self.options.rm_safe('disable_rpath') def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe('fPIC') + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.with_openssl: - self.requires("openssl/1.1.1q") - - def validate(self): - if self.settings.os == "Windows" and self.settings.compiler == "gcc" and self.options.shared: - raise ConanInvalidConfiguration("static mingw build is not possible") + self.requires("openssl/1.1.1s") def build_requirements(self): - if self._is_msvc: - self.build_requires("strawberryperl/5.30.0.1") - elif self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if is_msvc(self): + self.tool_requires("strawberryperl/5.32.1.1") + elif self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", default=False, check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, - destination=self._source_subfolder) - - def _configure_autotools(self): - if not self._autotools: - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - args = ['--without-readline'] - args.append('--without-zlib') - args.append('--with-openssl' if self.options.with_openssl else '--without-openssl') - if tools.cross_building(self) and not self.options.with_openssl: - args.append("--disable-strong-random") - if tools.cross_building(self, skip_x64_x86=True): - args.append("USE_DEV_URANDOM=1") + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if is_msvc(self): + vcvars = VCVars(self) + vcvars.generate() + config = "DEBUG" if self.settings.build_type == "Debug" else "RELEASE" + env = Environment() + env.define("CONFIG", config) + env.vars(self).save_script("conanbuild_msvc") + else: + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + tc = AutotoolsToolchain(self) + tc.configure_args.append('--without-readline') + tc.configure_args.append('--without-zlib') + tc.configure_args.append('--with-openssl' if self.options.with_openssl else '--without-openssl') + if cross_building(self) and not self.options.with_openssl: + tc.configure_args.append("--disable-strong-random") + if cross_building(self, skip_x64_x86=True): + tc.configure_args.append("USE_DEV_URANDOM=1") if self.settings.os != "Windows" and self.options.disable_rpath: - args.append('--disable-rpath') + tc.configure_args.append('--disable-rpath') if self._is_clang8_x86: - self._autotools.flags.append("-msse2") - with tools.chdir(self._source_subfolder): - self._autotools.configure(args=args) - return self._autotools - - @property - def _make_args(self): - args = [] - if self.settings.os == "Windows": - args.append("MAKE_DLL={}".format(str(self.options.shared).lower())) - return args - - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + tc.extra_cflags.append("-msse2") + tc.make_args.append(f"DESTDIR={unix_path(self, self.package_folder)}") + if self.settings.os == "Windows": + tc.make_args.append("MAKE_DLL={}".format(str(self.options.shared).lower())) + tc.generate() - if self._is_msvc: + def _patch_sources(self): + if is_msvc(self): # https://www.postgresql.org/docs/8.3/install-win32-libpq.html # https://github.com/postgres/postgres/blob/master/src/tools/msvc/README if not self.options.shared: - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "tools", "msvc", "MKvcbuild.pm"), + replace_in_file(self,os.path.join(self.source_folder, "src", "tools", "msvc", "MKvcbuild.pm"), "$libpq = $solution->AddProject('libpq', 'dll', 'interfaces',", "$libpq = $solution->AddProject('libpq', 'lib', 'interfaces',") system_libs = ", ".join(["'{}.lib'".format(lib) for lib in self.deps_cpp_info.system_libs]) - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "tools", "msvc", "Project.pm"), + replace_in_file(self,os.path.join(self.source_folder, "src", "tools", "msvc", "Project.pm"), "libraries => [],", "libraries => [{}],".format(system_libs)) - if self.settings.compiler == "Visual Studio": - runtime = { - "MT": "MultiThreaded", - "MTd": "MultiThreadedDebug", - "MD": "MultiThreadedDLL", - "MDd": "MultiThreadedDebugDLL", - }.get(str(self.settings.compiler.runtime)) - else: - runtime = "MultiThreaded{}{}".format( - "Debug" if self.settings.compiler.runtime_type == "Debug" else "", - "DLL" if self.settings.compiler.runtime == "dynamic" else "", - ) - msbuild_project_pm = os.path.join(self._source_subfolder, "src", "tools", "msvc", "MSBuildProject.pm") - tools.replace_in_file(msbuild_project_pm, "", """ + runtime = { + "MT": "MultiThreaded", + "MTd": "MultiThreadedDebug", + "MD": "MultiThreadedDLL", + "MDd": "MultiThreadedDebugDLL", + }.get(msvc_runtime_flag(self)) + msbuild_project_pm = os.path.join(self.source_folder, "src", "tools", "msvc", "MSBuildProject.pm") + replace_in_file(self,msbuild_project_pm, "", """ $targetmachine """) - tools.replace_in_file(msbuild_project_pm, "'MultiThreadedDebugDLL'", "'%s'" % runtime) - tools.replace_in_file(msbuild_project_pm, "'MultiThreadedDLL'", "'%s'" % runtime) - config_default_pl = os.path.join(self._source_subfolder, "src", "tools", "msvc", "config_default.pl") - solution_pm = os.path.join(self._source_subfolder, "src", "tools", "msvc", "Solution.pm") + replace_in_file(self,msbuild_project_pm, "'MultiThreadedDebugDLL'", "'%s'" % runtime) + replace_in_file(self,msbuild_project_pm, "'MultiThreadedDLL'", "'%s'" % runtime) + config_default_pl = os.path.join(self.source_folder, "src", "tools", "msvc", "config_default.pl") + solution_pm = os.path.join(self.source_folder, "src", "tools", "msvc", "Solution.pm") if self.options.with_openssl: + openssl = self.dependencies["openssl"] for ssl in ["VC\libssl32", "VC\libssl64", "libssl"]: - tools.replace_in_file(solution_pm, + replace_in_file(self,solution_pm, "%s.lib" % ssl, - "%s.lib" % self.deps_cpp_info["openssl"].libs[0]) + "%s.lib" % openssl.libs[0]) for crypto in ["VC\libcrypto32", "VC\libcrypto64", "libcrypto"]: - tools.replace_in_file(solution_pm, + replace_in_file(self,solution_pm, "%s.lib" % crypto, - "%s.lib" % self.deps_cpp_info["openssl"].libs[1]) - tools.replace_in_file(config_default_pl, + "%s.lib" % openssl.libs[1]) + replace_in_file(self,config_default_pl, "openssl => undef", - "openssl => '%s'" % self.deps_cpp_info["openssl"].rootpath.replace("\\", "/")) - with tools.vcvars(self.settings): - config = "DEBUG" if self.settings.build_type == "Debug" else "RELEASE" - with tools.environment_append({"CONFIG": config}): - with tools.chdir(os.path.join(self._source_subfolder, "src", "tools", "msvc")): - self.run("perl build.pl libpq") - if not self.options.shared: - self.run("perl build.pl libpgport") + "openssl => '%s'" % openssl.package_folder.replace("\\", "/")) + + def build(self): + apply_conandata_patches(self) + self._patch_sources() + if is_msvc(self): + with chdir(self, os.path.join(self.source_folder, "src", "tools", "msvc")): + self.run("perl build.pl libpq") + if not self.options.shared: + self.run("perl build.pl libpgport") else: - # relocatable shared lib on macOS - tools.replace_in_file( - os.path.join(self._source_subfolder, "src", "Makefile.shlib"), - "-install_name '$(libdir)/", - "-install_name '@rpath/", - ) - # avoid SIP issues on macOS when dependencies are shared - if tools.is_apple_os(self.settings.os): - libpaths = ":".join(self.deps_cpp_info.lib_paths) - tools.replace_in_file( - os.path.join(self._source_subfolder, "configure"), - "#! /bin/sh\n", - "#! /bin/sh\nexport DYLD_LIBRARY_PATH={}:$DYLD_LIBRARY_PATH\n".format(libpaths), - ) - autotools = self._configure_autotools() - with tools.chdir(os.path.join(self._source_subfolder, "src", "backend")): - autotools.make(args=self._make_args, target="generated-headers") - with tools.chdir(os.path.join(self._source_subfolder, "src", "common")): - autotools.make(args=self._make_args) - if tools.Version(self.version) >= "12": - with tools.chdir(os.path.join(self._source_subfolder, "src", "port")): - autotools.make(args=self._make_args) - with tools.chdir(os.path.join(self._source_subfolder, "src", "include")): - autotools.make(args=self._make_args) - with tools.chdir(os.path.join(self._source_subfolder, "src", "interfaces", "libpq")): - autotools.make(args=self._make_args) - with tools.chdir(os.path.join(self._source_subfolder, "src", "bin", "pg_config")): - autotools.make(args=self._make_args) + autotools = Autotools(self) + with chdir(self, os.path.join(self.source_folder)): + autotools.configure() + with chdir(self, os.path.join(self.source_folder, "src", "backend")): + autotools.make(target="generated-headers") + with chdir(self, os.path.join(self.source_folder, "src", "common")): + autotools.make() + with chdir(self, os.path.join(self.source_folder, "src", "include")): + autotools.make() + with chdir(self, os.path.join(self.source_folder, "src", "interfaces", "libpq")): + autotools.make() + if Version(self.version) >= 12: + with chdir(self, os.path.join(self.source_folder, "src", "port")): + autotools.make() + with chdir(self, os.path.join(self.source_folder, "src", "bin", "pg_config")): + autotools.make() def _remove_unused_libraries_from_package(self): if self.options.shared: @@ -204,55 +192,48 @@ def _remove_unused_libraries_from_package(self): os.path.join(self.package_folder, "bin", "*.dll"), os.path.join(self.package_folder, "lib", "libpq*.dylib") ] - if self.settings.os == "Windows": - os.unlink(os.path.join(self.package_folder, "lib", "libpq.dll")) for globi in globs: for file in glob.glob(globi): os.remove(file) def package(self): - self.copy(pattern="COPYRIGHT", dst="licenses", src=self._source_subfolder) - if self._is_msvc: - self.copy("*postgres_ext.h", src=self._source_subfolder, dst="include", keep_path=False) - self.copy("*pg_config.h", src=self._source_subfolder, dst="include", keep_path=False) - self.copy("*pg_config_ext.h", src=self._source_subfolder, dst="include", keep_path=False) - self.copy("*libpq-fe.h", src=self._source_subfolder, dst="include", keep_path=False) - self.copy("*libpq-events.h", src=self._source_subfolder, dst="include", keep_path=False) - self.copy("*.h", src=os.path.join(self._source_subfolder, "src", "include", "libpq"), dst=os.path.join("include", "libpq"), keep_path=False) - self.copy("*genbki.h", src=self._source_subfolder, dst=os.path.join("include", "catalog"), keep_path=False) - self.copy("*pg_type.h", src=self._source_subfolder, dst=os.path.join("include", "catalog"), keep_path=False) + copy(self, pattern="COPYRIGHT", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder, keep_path=False) + if is_msvc(self): + copy(self, pattern="*postgres_ext.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder, keep_path=False) + copy(self, pattern="*pg_config.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder, keep_path=False) + copy(self, pattern="*pg_config_ext.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder, keep_path=False) + copy(self, pattern="*libpq-fe.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder, keep_path=False) + copy(self, pattern="*libpq-events.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder, keep_path=False) + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, os.path.join("include", "libpq")), src=os.path.join(self.source_folder, "src", "include", "libpq"), keep_path=False) + copy(self, pattern="*genbki.h", dst=os.path.join(self.package_folder, os.path.join("include", "catalog")), src=self.source_folder, keep_path=False) + copy(self, pattern="*pg_type.h", dst=os.path.join(self.package_folder, os.path.join("include", "catalog")), src=self.source_folder, keep_path=False) if self.options.shared: - self.copy("**/libpq.dll", src=self._source_subfolder, dst="bin", keep_path=False) - self.copy("**/libpq.lib", src=self._source_subfolder, dst="lib", keep_path=False) + copy(self, pattern="**/libpq.dll", dst=os.path.join(self.package_folder, "bin"), src=self.source_folder, keep_path=False) + copy(self, pattern="**/libpq.lib", dst=os.path.join(self.package_folder, "lib"), src=self.source_folder, keep_path=False) else: - self.copy("*.lib", src=self._source_subfolder, dst="lib", keep_path=False) + copy(self, pattern="*.lib", dst=os.path.join(self.package_folder, "lib"), src=self.source_folder, keep_path=False) else: - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)#self._configure_autotools() - with tools.chdir(os.path.join(self._source_subfolder, "src", "common")): - autotools.install(args=self._make_args) - with tools.chdir(os.path.join(self._source_subfolder, "src", "include")): - autotools.install(args=self._make_args) - with tools.chdir(os.path.join(self._source_subfolder, "src", "interfaces", "libpq")): - autotools.install(args=self._make_args) - if tools.Version(self.version) >= "12": - with tools.chdir(os.path.join(self._source_subfolder, "src", "port")): - autotools.install(args=self._make_args) - - with tools.chdir(os.path.join(self._source_subfolder, "src", "bin", "pg_config")): - autotools.install(args=self._make_args) + autotools = Autotools(self) + with chdir(self, os.path.join(self.source_folder, "src", "common")): + autotools.install() + with chdir(self, os.path.join(self.source_folder, "src", "include")): + autotools.install() + with chdir(self, os.path.join(self.source_folder, "src", "interfaces", "libpq")): + autotools.install() + if Version(self.version) >= 12: + with chdir(self, os.path.join(self.source_folder, "src", "port")): + autotools.install() + with chdir(self, os.path.join(self.source_folder, "src", "bin", "pg_config")): + autotools.install() self._remove_unused_libraries_from_package() - tools.rmdir(os.path.join(self.package_folder, "include", "postgresql", "server")) - self.copy(pattern="*.h", dst=os.path.join("include", "catalog"), src=os.path.join(self._source_subfolder, "src", "include", "catalog")) - self.copy(pattern="*.h", dst=os.path.join("include", "catalog"), src=os.path.join(self._source_subfolder, "src", "backend", "catalog")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - - def _construct_library_name(self, name): - if self._is_msvc: - return "lib{}".format(name) - return name + rmdir(self, os.path.join(self.package_folder, "include", "postgresql", "server")) + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include", "catalog"), src=os.path.join(self.build_folder, "src", "include", "catalog"), keep_path=False) + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include", "catalog"), src=os.path.join(self.build_folder, "src", "backend", "catalog"), keep_path=False) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") @@ -260,35 +241,32 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "PostgreSQL::PostgreSQL") self.cpp_info.set_property("pkg_config_name", "libpq") - self.cpp_info.names["cmake_find_package"] = "PostgreSQL" - self.cpp_info.names["cmake_find_package_multi"] = "PostgreSQL" - self.env_info.PostgreSQL_ROOT = self.package_folder - self.cpp_info.components["pq"].libs = [self._construct_library_name("pq")] + self.cpp_info.components["pq"].libs = [f"{'lib' if is_msvc(self) else ''}pq"] if self.options.with_openssl: self.cpp_info.components["pq"].requires.append("openssl::openssl") if not self.options.shared: - if self._is_msvc: - if tools.Version(self.version) < "12": - self.cpp_info.components["pgport"].libs = ["libpgport"] - self.cpp_info.components["pq"].requires.extend(["pgport"]) - else: + if is_msvc(self): + self.cpp_info.components["pgport"].libs = ["libpgport"] + self.cpp_info.components["pq"].requires.append("pgport") + if Version(self.version) >= "12": self.cpp_info.components["pgcommon"].libs = ["libpgcommon"] - self.cpp_info.components["pgport"].libs = ["libpgport"] - self.cpp_info.components["pq"].requires.extend(["pgport", "pgcommon"]) + self.cpp_info.components["pq"].requires.append("pgcommon") else: - if tools.Version(self.version) < "12": - self.cpp_info.components["pgcommon"].libs = ["pgcommon"] - self.cpp_info.components["pq"].requires.extend(["pgcommon"]) - else: - self.cpp_info.components["pgcommon"].libs = ["pgcommon", "pgcommon_shlib"] + self.cpp_info.components["pgcommon"].libs = ["pgcommon"] + self.cpp_info.components["pq"].requires.append("pgcommon") + if Version(self.version) >= "12": + self.cpp_info.components["pgcommon"].libs.append("pgcommon_shlib") self.cpp_info.components["pgport"].libs = ["pgport", "pgport_shlib"] - self.cpp_info.components["pq"].requires.extend(["pgport", "pgcommon"]) + self.cpp_info.components["pgcommon"].requires.append("pgport") if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["pq"].system_libs = ["pthread"] elif self.settings.os == "Windows": self.cpp_info.components["pq"].system_libs = ["ws2_32", "secur32", "advapi32", "shell32", "crypt32", "wldap32"] + + self.cpp_info.names["cmake_find_package"] = "PostgreSQL" + self.cpp_info.names["cmake_find_package_multi"] = "PostgreSQL" diff --git a/recipes/libpq/all/test_package/CMakeLists.txt b/recipes/libpq/all/test_package/CMakeLists.txt index 537d802359b5d9..db0dafd7c09848 100644 --- a/recipes/libpq/all/test_package/CMakeLists.txt +++ b/recipes/libpq/all/test_package/CMakeLists.txt @@ -1,10 +1,6 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - +project(test_package LANGUAGES C) find_package(PostgreSQL REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} PostgreSQL::PostgreSQL) +target_link_libraries(${PROJECT_NAME} PRIVATE PostgreSQL::PostgreSQL) diff --git a/recipes/libpq/all/test_package/conanfile.py b/recipes/libpq/all/test_package/conanfile.py index 8a563eaeb2264b..e845ae751a3017 100644 --- a/recipes/libpq/all/test_package/conanfile.py +++ b/recipes/libpq/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -21,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libpq/all/test_v1_package/CMakeLists.txt b/recipes/libpq/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..de3b75d9538de0 --- /dev/null +++ b/recipes/libpq/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libpq/all/test_v1_package/conanfile.py b/recipes/libpq/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5f9efeb33878bd --- /dev/null +++ b/recipes/libpq/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libraw/all/CMakeLists.txt b/recipes/libraw/all/CMakeLists.txt index 2022d590fa2a2b..1aba64dbf532a4 100644 --- a/recipes/libraw/all/CMakeLists.txt +++ b/recipes/libraw/all/CMakeLists.txt @@ -1,20 +1,24 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) +project(LibRaw LANGUAGES CXX) -project(LibRaw) +file(GLOB_RECURSE headers "${LIBRAW_SRC_DIR}/libraw/*.h") -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) -file(GLOB_RECURSE headers "source_subfolder/libraw/*.h") +if(RAW_LIB_VERSION_STRING VERSION_LESS 0.21) + set(libraw_LIB_SRCS ${LIBRAW_SRC_DIR}/internal/dcraw_common.cpp + ${LIBRAW_SRC_DIR}/internal/dcraw_fileio.cpp + ${LIBRAW_SRC_DIR}/internal/demosaic_packs.cpp + ${LIBRAW_SRC_DIR}/src/libraw_cxx.cpp + ${LIBRAW_SRC_DIR}/src/libraw_c_api.cpp + ${LIBRAW_SRC_DIR}/src/libraw_datastream.cpp + ) +else() + file(GLOB_RECURSE libraw_LIB_SRCS CONFIGURE_DEPENDS "${LIBRAW_SRC_DIR}/src/*.cpp") -set(sources - "source_subfolder/src/libraw_c_api.cpp" - "source_subfolder/src/libraw_cxx.cpp" - "source_subfolder/src/libraw_datastream.cpp" - "source_subfolder/internal/dcraw_common.cpp" - "source_subfolder/internal/dcraw_fileio.cpp" - "source_subfolder/internal/demosaic_packs.cpp" -) + # Exclude placeholder (stub) implementations + file(GLOB_RECURSE exclude_libraw_LIB_SRCS CONFIGURE_DEPENDS "${LIBRAW_SRC_DIR}/src/*_ph.cpp") + list(REMOVE_ITEM libraw_LIB_SRCS ${exclude_libraw_LIB_SRCS}) +endif() if(WIN32) add_definitions(-DWIN32) @@ -26,32 +30,41 @@ if(WIN32) endif() endif() -if (TARGET CONAN_PKG::libjpeg OR TARGET CONAN_PKG::libjpeg-turbo) +find_package(JPEG CONFIG) +find_package(libjpeg-turbo CONFIG) +find_package(lcms CONFIG) +find_package(Jasper CONFIG) + +if (TARGET JPEG::JPEG OR TARGET libjpeg-turbo::jpeg OR TARGET libjpeg-turbo::jpeg_static) add_definitions(-DUSE_JPEG -DUSE_JPEG8) endif () -if (TARGET CONAN_PKG::lcms) +if (TARGET lcms::lcms) add_definitions(-DUSE_LCMS2) endif () -if (TARGET CONAN_PKG::jasper) +if (TARGET Jasper::Jasper) add_definitions(-DUSE_JASPER) endif () -add_library(raw ${headers} ${sources}) -set_property(TARGET raw PROPERTY CXX_STANDARD 11) -target_include_directories(raw PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/") +add_library(raw ${headers} ${libraw_LIB_SRCS}) +target_compile_features(raw PRIVATE cxx_std_11) +target_include_directories(raw PUBLIC "${LIBRAW_SRC_DIR}") +set_target_properties(raw PROPERTIES LINKER_LANGUAGE CXX) target_compile_options(raw PUBLIC $<$:/W0>) -if (TARGET CONAN_PKG::libjpeg) - target_link_libraries(raw PUBLIC CONAN_PKG::libjpeg) +if (TARGET JPEG::JPEG) + target_link_libraries(raw PUBLIC JPEG::JPEG) +endif () +if (TARGET libjpeg-turbo::jpeg) + target_link_libraries(raw PUBLIC libjpeg-turbo::jpeg) endif () -if (TARGET CONAN_PKG::libjpeg-turbo) - target_link_libraries(raw PUBLIC CONAN_PKG::libjpeg-turbo) +if (TARGET libjpeg-turbo::jpeg_static) + target_link_libraries(raw PUBLIC libjpeg-turbo::jpeg_static) endif () -if (TARGET CONAN_PKG::lcms) - target_link_libraries(raw PUBLIC CONAN_PKG::lcms) +if (TARGET lcms::lcms) + target_link_libraries(raw PUBLIC lcms::lcms) endif () -if (TARGET CONAN_PKG::jasper) - target_link_libraries(raw PUBLIC CONAN_PKG::jasper) +if (TARGET Jasper::Jasper) + target_link_libraries(raw PUBLIC Jasper::Jasper) endif () -install(DIRECTORY "source_subfolder/libraw" DESTINATION include) +install(DIRECTORY "${LIBRAW_SRC_DIR}/libraw" DESTINATION include) install(TARGETS raw ARCHIVE DESTINATION lib RUNTIME DESTINATION bin LIBRARY DESTINATION lib) diff --git a/recipes/libraw/all/conandata.yml b/recipes/libraw/all/conandata.yml index 47981769832c65..2293cc11d33ee7 100644 --- a/recipes/libraw/all/conandata.yml +++ b/recipes/libraw/all/conandata.yml @@ -1,10 +1,13 @@ sources: - "0.19.5": - url: "https://github.com/LibRaw/LibRaw/archive/0.19.5.tar.gz" - sha256: "9a2a40418e4fb0ab908f6d384ff6f9075f4431f8e3d79a0e44e5a6ea9e75abdc" - "0.20.0": - url: "https://github.com/LibRaw/LibRaw/archive/0.20.0.tar.gz" - sha256: "f38cd2620d5adc32d2c9f51cd0dc66d72c75671f1c81dfd13d30c45c6be80d40" + "0.21.1": + url: "https://github.com/LibRaw/LibRaw/archive/0.21.1.tar.gz" + sha256: "b63d7ffa43463f74afcc02f9083048c231349b41cc9255dec0840cf8a67b52e0" "0.20.2": url: "https://github.com/LibRaw/LibRaw/archive/0.20.2.tar.gz" sha256: "02df7d403b34602b769bb38e5bf7d4258e075eeefbe980b6832e6e1491989d60" + "0.20.0": + url: "https://github.com/LibRaw/LibRaw/archive/0.20.0.tar.gz" + sha256: "f38cd2620d5adc32d2c9f51cd0dc66d72c75671f1c81dfd13d30c45c6be80d40" + "0.19.5": + url: "https://github.com/LibRaw/LibRaw/archive/0.19.5.tar.gz" + sha256: "9a2a40418e4fb0ab908f6d384ff6f9075f4431f8e3d79a0e44e5a6ea9e75abdc" diff --git a/recipes/libraw/all/conanfile.py b/recipes/libraw/all/conanfile.py index 47b1f62f9d69b6..e68c86171e78e4 100644 --- a/recipes/libraw/all/conanfile.py +++ b/recipes/libraw/all/conanfile.py @@ -1,17 +1,19 @@ -from conans import ConanFile, tools, CMake +from conan import ConanFile +from conan.tools.files import get, copy, collect_libs +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os +required_conan_version = ">=1.53.0" + class LibRawConan(ConanFile): name = "libraw" description = "LibRaw is a library for reading RAW files obtained from digital photo cameras (CRW/CR2, NEF, RAF, DNG, and others)." - topics = ["image", "photography", "raw"] + license = "CDDL-1.0", "LGPL-2.1-only" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.libraw.org/" - license = "CDDL-1.0/LGPL-2.1-only" - exports_sources = ["CMakeLists.txt"] - generators = "cmake" + topics = ["image", "photography", "raw"] settings = "os", "arch", "compiler", "build_type" - options = { "shared": [True, False], "fPIC": [True, False], @@ -26,12 +28,11 @@ class LibRawConan(ConanFile): "with_lcms": True, "with_jasper": True } - - _cmake = None + exports_sources = ["CMakeLists.txt"] @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 def config_options(self): if self.settings.os == "Windows": @@ -39,51 +40,56 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): # TODO: RawSpeed dependency (-DUSE_RAWSPEED) # TODO: DNG SDK dependency (-DUSE_DNGSDK) if self.options.with_jpeg == "libjpeg": - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") elif self.options.with_jpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.1") + self.requires("libjpeg-turbo/2.1.4") if self.options.with_lcms: - self.requires("lcms/2.12") + self.requires("lcms/2.14") if self.options.with_jasper: - self.requires("jasper/2.0.33") + self.requires("jasper/4.0.0") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("LibRaw-" + self.version, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["RAW_LIB_VERSION_STRING"] = self.version + tc.variables["LIBRAW_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, pattern="LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="COPYRIGHT", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - - self.copy("LICENSE.*", src=self._source_subfolder, dst="licenses") def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) if self.settings.os == "Windows": self.cpp_info.defines.append("WIN32") + self.cpp_info.system_libs.append("ws2_32") if not self.options.shared: self.cpp_info.defines.append("LIBRAW_NODLL") diff --git a/recipes/libraw/all/test_package/CMakeLists.txt b/recipes/libraw/all/test_package/CMakeLists.txt index 33ae887aa6aea3..a201657a760805 100644 --- a/recipes/libraw/all/test_package/CMakeLists.txt +++ b/recipes/libraw/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libraw REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE libraw::libraw) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/libraw/all/test_package/conanfile.py b/recipes/libraw/all/test_package/conanfile.py index 4903f1a7e8fa0f..a9fb96656f2039 100644 --- a/recipes/libraw/all/test_package/conanfile.py +++ b/recipes/libraw/all/test_package/conanfile.py @@ -1,9 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libraw/all/test_v1_package/CMakeLists.txt b/recipes/libraw/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/libraw/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libraw/all/test_v1_package/conanfile.py b/recipes/libraw/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/libraw/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libraw/config.yml b/recipes/libraw/config.yml index 07ec3840f78d8a..35c98427b7408f 100644 --- a/recipes/libraw/config.yml +++ b/recipes/libraw/config.yml @@ -1,7 +1,9 @@ versions: - "0.19.5": + "0.21.1": + folder: all + "0.20.2": folder: all "0.20.0": folder: all - "0.20.2": + "0.19.5": folder: all diff --git a/recipes/libressl/all/CMakeLists.txt b/recipes/libressl/all/CMakeLists.txt index 1848ca5a77c355..de350ebd519a2c 100644 --- a/recipes/libressl/all/CMakeLists.txt +++ b/recipes/libressl/all/CMakeLists.txt @@ -4,4 +4,7 @@ project(cmake_wrapper) include(conanbuildinfo.cmake) conan_basic_setup() +if(MSVC) + add_definitions(/D_CRT_SUPPRESS_RESTRICT) +endif() add_subdirectory("source_subfolder") diff --git a/recipes/libsafec/all/conanfile.py b/recipes/libsafec/all/conanfile.py index 5e2784dc36adc3..6924adfd04703a 100644 --- a/recipes/libsafec/all/conanfile.py +++ b/recipes/libsafec/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration, ConanException +from conan.tools.files import get, rmdir, copy, rm, chdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version +from conans import AutoToolsBuildEnvironment, tools import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class LibSafeCConan(ConanFile): @@ -18,14 +22,16 @@ class LibSafeCConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], + "strmax": ["ANY"], + "memmax": ["ANY"], } default_options = { "shared": False, "fPIC": True, + "strmax": 4096, + "memmax": 268435456, } - exports_sources = "patches/*" - _autotools = None @property @@ -42,20 +48,20 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def build_requirements(self): - self.build_requires("libtool/2.4.6") + self.tool_requires("libtool/2.4.6") if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("msys2/cci.latest") @property def _supported_compiler(self): compiler = self.settings.compiler - version = tools.Version(self.settings.compiler.version) - if compiler == "Visual Studio": + version = Version(self.settings.compiler.version) + if is_msvc(self): return False if compiler == "gcc" and version < "5": return False @@ -63,14 +69,16 @@ def _supported_compiler(self): def validate(self): if self.settings.os == "Macos" and self.settings.arch == "armv8": - raise ConanInvalidConfiguration("This platform is not yet supported by libsafec (os=Macos arch=armv8)") + raise ConanInvalidConfiguration(f"This platform is not yet supported by {self.ref} (os=Macos arch=armv8)") if not self._supported_compiler: raise ConanInvalidConfiguration( - "libsafec doesn't support {}/{}".format( - self.settings.compiler, self.settings.compiler.version)) + f"{self.ref} doesn't support {self.settings.compiler}-{self.settings.compiler.version}") + + if not str(self.info.options.strmax).isdigit(): + raise ConanException(f"{self.ref} option 'strmax' must be a valid integer number.") def source(self): - tools.get(**self.conan_data["sources"][self.version], + get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) def _configure_autotools(self): @@ -84,28 +92,30 @@ def _configure_autotools(self): "--enable-debug={}".format(yes_no(self.settings.build_type == "Debug")), "--disable-doc", "--disable-Werror", + "--enable-strmax={}".format(self.options.strmax), + "--enable-memmax={}".format(self.options.memmax), ] self._autotools.configure(args=args, configure_dir=self._source_subfolder) return self._autotools def build(self): - with tools.chdir(self._source_subfolder): + with chdir(self, self._source_subfolder): self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows, run_environment=True) autotools = self._configure_autotools() autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") + copy(self, "COPYING", src=self._source_subfolder, dst=os.path.join(self.package_folder, "licenses")) autotools = self._configure_autotools() autotools.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) def package_info(self): self.cpp_info.includedirs.append(os.path.join("include", "libsafec")) self.cpp_info.libs = ["safec-{}".format(self.version)] - self.cpp_info.names["pkg_config"] = "libsafec" + self.cpp_info.set_property("pkg_config_name", "libsafec") bin_dir = os.path.join(self.package_folder, "bin") self.output.info("Appending PATH environment variable: {}".format(bin_dir)) diff --git a/recipes/libselinux/all/conanfile.py b/recipes/libselinux/all/conanfile.py index 3583de7934d4e5..28dbcacbb82607 100644 --- a/recipes/libselinux/all/conanfile.py +++ b/recipes/libselinux/all/conanfile.py @@ -7,7 +7,7 @@ from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class LibSELinuxConan(ConanFile): @@ -17,7 +17,7 @@ class LibSELinuxConan(ConanFile): "of utilities with enhanced security functionality designed to add " "mandatory access controls to Linux" ) - topics = ("selinux", "security-enhanced linux") + topics = ("linux", "selinux", "security", "security-enhanced") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/SELinuxProject/selinux" license = "Unlicense" @@ -36,15 +36,9 @@ def export_sources(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def requirements(self): self.requires("pcre2/10.40") diff --git a/recipes/libserial/all/conandata.yml b/recipes/libserial/all/conandata.yml new file mode 100644 index 00000000000000..6677947184a94b --- /dev/null +++ b/recipes/libserial/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20200930": + url: "https://github.com/crayzeewulf/libserial/archive/1d1e47a2faae0470f93eb291263b0ce7ea119a81.tar.gz" + sha256: "a433b04bd42e8b4504e5e1fbe7ec22b648f2872d3d125e58c17b9c6c1b171bba" diff --git a/recipes/libserial/all/conanfile.py b/recipes/libserial/all/conanfile.py new file mode 100644 index 00000000000000..9415f1c8d2625a --- /dev/null +++ b/recipes/libserial/all/conanfile.py @@ -0,0 +1,92 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy, rm, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + + +required_conan_version = ">=1.53.0" + +class LibserialConan(ConanFile): + name = "libserial" + description = "Serial Port Programming in C++" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/crayzeewulf/libserial" + topics = ("serial-ports", "rs232", "usb-serial") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _min_cppstd(self): + return 14 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "7", + } + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.os != "Linux": + raise ConanInvalidConfiguration(f"{self.ref} support Linux only.") + + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LIBSERIAL_ENABLE_TESTING"] = False + tc.variables["LIBSERIAL_BUILD_EXAMPLES"] = False + tc.variables["LIBSERIAL_PYTHON_ENABLE"] = False + tc.variables["LIBSERIAL_BUILD_DOCS"] = False + tc.variables["INSTALL_STATIC"] = not self.options.shared + tc.variables["INSTALL_SHARED"] = self.options.shared + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "Makefile.am", os.path.join(self.package_folder, "include", "libserial")) + + def package_info(self): + self.cpp_info.libs = ["serial"] + + self.cpp_info.set_property("pkg_config_name", "libserial") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.system_libs.append("pthread") diff --git a/recipes/libserial/all/test_package/CMakeLists.txt b/recipes/libserial/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..c896bd464b19d3 --- /dev/null +++ b/recipes/libserial/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package LANGUAGES CXX) + +find_package(libserial REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libserial::libserial) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/libserial/all/test_package/conanfile.py b/recipes/libserial/all/test_package/conanfile.py new file mode 100644 index 00000000000000..a9fb96656f2039 --- /dev/null +++ b/recipes/libserial/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libserial/all/test_package/test_package.cpp b/recipes/libserial/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..00c0ba2b470c9b --- /dev/null +++ b/recipes/libserial/all/test_package/test_package.cpp @@ -0,0 +1,18 @@ +#include + +#include +#include + +int main(void) { + using LibSerial::SerialPort ; + using LibSerial::SerialStream ; + + // Instantiate a Serial Port and a Serial Stream object. + SerialPort serial_port ; + SerialStream serial_stream ; + + serial_port.IsOpen(); + serial_stream.IsOpen(); + + return EXIT_SUCCESS; +} diff --git a/recipes/libserial/all/test_v1_package/CMakeLists.txt b/recipes/libserial/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/libserial/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libserial/all/test_v1_package/conanfile.py b/recipes/libserial/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/libserial/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libserial/config.yml b/recipes/libserial/config.yml new file mode 100644 index 00000000000000..27812caf46f4d9 --- /dev/null +++ b/recipes/libserial/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20200930": + folder: all diff --git a/recipes/libsigcpp/2.x.x/conanfile.py b/recipes/libsigcpp/2.x.x/conanfile.py index f3ba2371146338..9cb40725e278e0 100644 --- a/recipes/libsigcpp/2.x.x/conanfile.py +++ b/recipes/libsigcpp/2.x.x/conanfile.py @@ -1,20 +1,23 @@ -from conans import ConanFile, Meson, tools -from conan.tools.files import rename -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +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 copy, get, rename, replace_in_file, rm, rmdir +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain import glob import os -import shutil -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" -class LibSigCppConanV2(ConanFile): +class LibSigCppConan(ConanFile): name = "libsigcpp" homepage = "https://github.com/libsigcplusplus/libsigcplusplus" url = "https://github.com/conan-io/conan-center-index" - license = "LGPL-3.0" + license = "LGPL-3.0-only" description = "libsigc++ implements a typesafe callback system for standard C++." - topics = ("libsigcpp", "callback") + topics = ("callback") settings = "os", "arch", "compiler", "build_type" options = { @@ -26,88 +29,81 @@ class LibSigCppConanV2(ConanFile): "fPIC": True, } - generators = "pkg_config" - short_paths = True - - def validate(self): - if hasattr(self, "settings_build") and tools.cross_building(self): - raise ConanInvalidConfiguration("Cross-building not implemented") - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + basic_layout(self, src_folder="src") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def build_requirements(self): - self.build_requires("meson/0.59.1") - self.build_requires("pkgconf/1.7.4") + self.tool_requires("meson/0.64.1") def source(self): - tools.get( - **self.conan_data["sources"][self.version], - strip_root=True, - destination=self._source_subfolder - ) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = MesonToolchain(self) + tc.project_options["build-examples"] = "false" + tc.project_options["build-documentation"] = "false" + tc.generate() + + def _patch_sources(self): + if not self.options.shared: + replace_in_file( + self, os.path.join(self.source_folder, "sigc++config.h.meson"), + "define SIGC_DLL 1", "undef SIGC_DLL", + ) def build(self): - if not self.options.shared: - tools.replace_in_file( - os.path.join(self._source_subfolder, "sigc++config.h.meson"), - "define SIGC_DLL 1", "undef SIGC_DLL") - with tools.environment_append(tools.RunEnvironment(self).vars): - meson = self._configure_meson() - meson.build() - - def _configure_meson(self): + self._patch_sources() meson = Meson(self) - defs = {} - defs["build-examples"] = "false" - defs["build-documentation"] = "false" - defs["default_library"] = "shared" if self.options.shared else "static" - meson.configure( - defs=defs, - build_folder=self._build_subfolder, - source_folder=self._source_subfolder, - pkg_config_paths=[self.install_folder], - ) - return meson + meson.configure() + meson.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - meson = self._configure_meson() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + meson = Meson(self) meson.install() - if self.settings.compiler == "Visual Studio": - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.pdb") - if not self.options.shared: - rename(self, - os.path.join(self.package_folder, "lib", "libsigc-2.0.a"), - os.path.join(self.package_folder, "lib", "sigc-2.0.lib")) - for header_file in glob.glob(os.path.join(self.package_folder, "lib", "sigc++-2.0", "include", "*.h")): - shutil.move( - header_file, - os.path.join(self.package_folder, "include", - "sigc++-2.0", os.path.basename(header_file)) - ) - - for dir_to_remove in ["pkgconfig", "sigc++-2.0"]: - tools.rmdir(os.path.join( - self.package_folder, "lib", dir_to_remove)) + dst = os.path.join(self.package_folder, "include", "sigc++-2.0", os.path.basename(header_file)) + rename(self, header_file, dst) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "sigc++-2.0")) + fix_apple_shared_install_name(self) + fix_msvc_libname(self) def package_info(self): - self.cpp_info.components["sigc++-2.0"].names["pkg_config"] = "sigc++-2.0" - self.cpp_info.components["sigc++-2.0"].includedirs.append(os.path.join("include", "sigc++-2.0")) - self.cpp_info.components["sigc++-2.0"].libs = ["sigc-2.0"] + self.cpp_info.set_property("pkg_config_name", "sigc++-2.0") + self.cpp_info.includedirs.append(os.path.join("include", "sigc++-2.0")) + self.cpp_info.libs = ["sigc-2.0"] + +def fix_msvc_libname(conanfile, remove_lib_prefix=True): + """remove lib prefix & change extension to .lib""" + from conan.tools.files import rename + from conan.tools.microsoft import is_msvc + import glob + import os + if not is_msvc(conanfile): + return + libdirs = getattr(conanfile.cpp.package, "libdirs") + for libdir in libdirs: + for ext in [".dll.a", ".dll.lib", ".a"]: + full_folder = os.path.join(conanfile.package_folder, libdir) + for filepath in glob.glob(os.path.join(full_folder, f"*{ext}")): + libname = os.path.basename(filepath)[0:-len(ext)] + if remove_lib_prefix and libname[0:3] == "lib": + libname = libname[3:] + rename(conanfile, filepath, os.path.join(os.path.dirname(filepath), f"{libname}.lib")) diff --git a/recipes/libsigcpp/2.x.x/test_package/CMakeLists.txt b/recipes/libsigcpp/2.x.x/test_package/CMakeLists.txt index 21ca4ecbf6eee5..0fb07d5ca03ae3 100644 --- a/recipes/libsigcpp/2.x.x/test_package/CMakeLists.txt +++ b/recipes/libsigcpp/2.x.x/test_package/CMakeLists.txt @@ -1,12 +1,9 @@ -cmake_minimum_required(VERSION 3.6) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGET) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(PkgConfig REQUIRED) pkg_search_module(SIGCPP IMPORTED_TARGET REQUIRED sigc++-2.0) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} PkgConfig::SIGCPP) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::SIGCPP) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/libsigcpp/2.x.x/test_package/conanfile.py b/recipes/libsigcpp/2.x.x/test_package/conanfile.py index ffedca59f065bb..d5daeb4ad54672 100644 --- a/recipes/libsigcpp/2.x.x/test_package/conanfile.py +++ b/recipes/libsigcpp/2.x.x/test_package/conanfile.py @@ -1,13 +1,30 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.env import Environment import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "pkg_config" + generators = "CMakeToolchain", "PkgConfigDeps", "VirtualBuildEnv", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build_requirements(self): - self.build_requires("pkgconf/1.7.4") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") + + def generate(self): + # TODO: to remove once conan 1.55.0 deployed in c3i (see https://github.com/conan-io/conan/pull/12513) + env = Environment() + env.prepend_path("PKG_CONFIG_PATH", self.generators_folder) + env.vars(self).save_script("conanbuild_pkg_config_path") def build(self): cmake = CMake(self) @@ -15,6 +32,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libsigcpp/2.x.x/test_v1_package/CMakeLists.txt b/recipes/libsigcpp/2.x.x/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/libsigcpp/2.x.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libsigcpp/2.x.x/test_v1_package/conanfile.py b/recipes/libsigcpp/2.x.x/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..e6b0fdb8110e8d --- /dev/null +++ b/recipes/libsigcpp/2.x.x/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "pkg_config" + + def build_requirements(self): + self.build_requires("pkgconf/1.9.3") + + 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/libsigcpp/3.x.x/CMakeLists.txt b/recipes/libsigcpp/3.x.x/CMakeLists.txt deleted file mode 100644 index 1848ca5a77c355..00000000000000 --- a/recipes/libsigcpp/3.x.x/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/libsigcpp/3.x.x/conandata.yml b/recipes/libsigcpp/3.x.x/conandata.yml index 22e051100ec2ed..ca82ebd4ecc93a 100644 --- a/recipes/libsigcpp/3.x.x/conandata.yml +++ b/recipes/libsigcpp/3.x.x/conandata.yml @@ -8,7 +8,5 @@ sources: patches: "3.0.7": - patch_file: "patches/3.0.7-0001-libsigcpp.patch" - base_path: "source_subfolder" "3.0.0": - patch_file: "patches/3.0.0-0001-libsigcpp.patch" - base_path: "source_subfolder" diff --git a/recipes/libsigcpp/3.x.x/conanfile.py b/recipes/libsigcpp/3.x.x/conanfile.py index dbf3fc6323f8cb..7f5cc01dd330a0 100644 --- a/recipes/libsigcpp/3.x.x/conanfile.py +++ b/recipes/libsigcpp/3.x.x/conanfile.py @@ -1,20 +1,25 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import ( + apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, + rename, replace_in_file, rmdir, save +) import glob import os -import shutil import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class LibSigCppConan(ConanFile): name = "libsigcpp" homepage = "https://github.com/libsigcplusplus/libsigcplusplus" url = "https://github.com/conan-io/conan-center-index" - license = "LGPL-3.0" + license = "LGPL-3.0-only" description = "libsigc++ implements a typesafe callback system for standard C++." - topics = ("libsigcpp", "callback") + topics = ("callback") settings = "os", "arch", "compiler", "build_type" options = { @@ -26,21 +31,22 @@ class LibSigCppConan(ConanFile): "fPIC": True, } - generators = "cmake" - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "17" @property - def _build_subfolder(self): - return "build_subfolder" + def _minimum_compilers_version(self): + return { + "Visual Studio": "15.7", + "msvc": "191", + "gcc": "7", + "clang": "6", + "apple-clang": "10", + } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -48,64 +54,56 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - @property - def _minimum_compilers_version(self): - return { - "Visual Studio": "15.7", - "gcc": "7", - "clang": "6", - "apple-clang": "10", - } + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 17) + check_min_cppstd(self, self._min_cppstd) - def lazy_lt_semver(v1, v2): + def loose_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] lv2 = [int(v) for v in v2.split(".")] min_length = min(len(lv1), len(lv2)) return lv1[:min_length] < lv2[:min_length] minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler), False) - if not minimum_version: - self.output.warn("libsigcpp requires C++17. Your compiler is unknown. Assuming it supports C++17.") - elif lazy_lt_semver(str(self.settings.compiler.version), minimum_version): - raise ConanInvalidConfiguration("libsigcpp requires C++17, which your compiler does not support.") + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.generate() - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + def _patch_sources(self): + apply_conandata_patches(self) if not self.options.shared: - tools.replace_in_file(os.path.join(self._source_subfolder, "sigc++config.h.cmake"), + replace_in_file(self, os.path.join(self.source_folder, "sigc++config.h.cmake"), "define SIGC_DLL 1", "undef SIGC_DLL") - cmake = self._configure_cmake() + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() for header_file in glob.glob(os.path.join(self.package_folder, "lib", "sigc++-3.0", "include", "*.h")): - shutil.move( - header_file, - os.path.join(self.package_folder, "include", "sigc++-3.0", os.path.basename(header_file)) - ) + dst = os.path.join(self.package_folder, "include", "sigc++-3.0", os.path.basename(header_file)) + rename(self, header_file, dst) for dir_to_remove in ["cmake", "pkgconfig", "sigc++-3.0"]: - tools.rmdir(os.path.join(self.package_folder, "lib", dir_to_remove)) + rmdir(self, os.path.join(self.package_folder, "lib", dir_to_remove)) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( @@ -113,21 +111,20 @@ def package(self): {"sigc-3.0": "sigc++-3::sigc-3.0"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "sigc++-3") @@ -136,7 +133,7 @@ def package_info(self): # TODO: back to global scope in conan v2 once cmake_find_package* generators removed self.cpp_info.components["sigc++"].includedirs = [os.path.join("include", "sigc++-3.0")] - self.cpp_info.components["sigc++"].libs = tools.collect_libs(self) + self.cpp_info.components["sigc++"].libs = collect_libs(self) if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.components["sigc++"].system_libs.append("m") diff --git a/recipes/libsigcpp/3.x.x/test_package/CMakeLists.txt b/recipes/libsigcpp/3.x.x/test_package/CMakeLists.txt index 5ed3e9d81f8917..3c0d6af8191fb0 100644 --- a/recipes/libsigcpp/3.x.x/test_package/CMakeLists.txt +++ b/recipes/libsigcpp/3.x.x/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(sigc++-3 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} sigc-3.0) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) +target_link_libraries(${PROJECT_NAME} PRIVATE sigc-3.0) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/libsigcpp/3.x.x/test_package/conanfile.py b/recipes/libsigcpp/3.x.x/test_package/conanfile.py index 38f4483872d47f..98ab55852ad565 100644 --- a/recipes/libsigcpp/3.x.x/test_package/conanfile.py +++ b/recipes/libsigcpp/3.x.x/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libsigcpp/3.x.x/test_v1_package/CMakeLists.txt b/recipes/libsigcpp/3.x.x/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/libsigcpp/3.x.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libsigcpp/3.x.x/test_v1_package/conanfile.py b/recipes/libsigcpp/3.x.x/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/libsigcpp/3.x.x/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/libsodium/all/conanfile.py b/recipes/libsodium/all/conanfile.py index 48c328202cd684..f895ac1f52b3c6 100644 --- a/recipes/libsodium/all/conanfile.py +++ b/recipes/libsodium/all/conanfile.py @@ -1,13 +1,14 @@ from conan import ConanFile -from conan.errors import ConanInvalidConfiguration, ConanException +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name from conan.tools.env import VirtualBuildEnv -from conan.tools.files import export_conandata_patches, apply_conandata_patches, get, rmdir, copy, rm, replace_in_file +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir from conan.tools.gnu import Autotools, AutotoolsToolchain from conan.tools.layout import basic_layout -from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, MSBuildDeps, MSBuildToolchain, MSBuild, VCVars, unix_path, msvc_runtime_flag, vs_layout +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, MSBuild, MSBuildToolchain import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.54.0" class LibsodiumConan(ConanFile): @@ -49,24 +50,12 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): - if is_msvc(self): - vs_layout(self) - else: - basic_layout(self, src_folder="src") + basic_layout(self, src_folder="src") def validate(self): if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self): @@ -81,136 +70,87 @@ def build_requirements(self): if not self.conf.get("tools.microsoft.bash:path", check_type=str): self.tool_requires("msys2/cci.latest") + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + def generate(self): if is_msvc(self): tc = MSBuildToolchain(self) - tc.generate() - tc = MSBuildDeps(self) - tc.generate() - tc = VCVars(self) + tc.configuration = "{}{}".format( + "Debug" if self.settings.build_type == "Debug" else "Release", + "DLL" if self.options.shared else "LIB", + ) tc.generate() else: - tc = AutotoolsToolchain(self) + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) yes_no = lambda v: "yes" if v else "no" tc.configure_args.append("--enable-soname-versions={}".format(yes_no(self.options.use_soname))) tc.configure_args.append("--enable-pie={}".format(yes_no(self.options.PIE))) - - env = tc.environment() - - # if self._is_mingw: - # add libssp (gcc support library) for some missing symbols (e.g. __strcpy_chk) - # FIXME how do I do this in conan v2? - # autotools.libs.append("ssp") - + if self._is_mingw: + tc.extra_ldflags.append("-lssp") if self.settings.os == "Emscripten": # FIXME: this is an old comment/test, has not been re-tested with conan2 upgrade self.output.warn("os=Emscripten is not tested/supported by this recipe") # FIXME: ./dist-build/emscripten.sh does not respect options of this recipe - - tc.generate(env) - - env = VirtualBuildEnv(self) - env.generate() - - def source(self): - get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + tc.generate() @property def _msvc_sln_folder(self): - if self.settings.compiler == "Visual Studio": - folder = { + sln_folders = { + "Visual Studio": { "10": "vs2010", "11": "vs2012", "12": "vs2013", "14": "vs2015", "15": "vs2017", "16": "vs2019", - } - elif self.settings.compiler == "msvc": - folder = { + }, + "msvc": { + "170": "vs2012", + "180": "vs2013", "190": "vs2015", "191": "vs2017", "192": "vs2019", - } - else: - raise ConanException("Should not call this function with any other compiler") - + }, + } + default_folder = "vs2019" if self.version != "1.0.18": - if self.settings.compiler == "Visual Studio": - folder["17"] = "vs2022" - else: - folder["193"] = "vs2022" + sln_folders["Visual Studio"]["17"] = "vs2022" + sln_folders["msvc"]["193"] = "vs2022" + default_folder = "vs2022" - return folder.get(str(self.settings.compiler.version)) + return sln_folders.get(str(self.settings.compiler), {}).get(str(self.settings.compiler.version), default_folder) - @property - def _msvc_platform(self): - return { - "x86": "Win32", - "x86_64": "x64", - }[str(self.settings.arch)] - - # Method copied from xz_utils - def _fix_msvc_platform_toolset(self, vcxproj_file, old_toolset): - platform_toolset = { - "Visual Studio": { - "8": "v80", - "9": "v90", - "10": "v100", - "11": "v110", - "12": "v120", - "14": "v140", - "15": "v141", - "16": "v142", - "17": "v143", - }, - "msvc": { - "170": "v110", - "180": "v120", - "190": "v140", - "191": "v141", - "192": "v142", - "193": "v143", - } - }.get(str(self.settings.compiler), {}).get(str(self.settings.compiler.version)) - if not platform_toolset: - raise ConanException( - f"Unknown platform toolset for {self.settings.compiler} {self.settings.compiler.version}", + def _build_msvc(self): + msvc_sln_folder = os.path.join(self.source_folder, "builds", "msvc", self._msvc_sln_folder) + + #============================== + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + if self.version == "1.0.18" and self._msvc_sln_folder == "vs2019": + toolset = MSBuildToolchain(self).toolset + replace_in_file( + self, os.path.join(msvc_sln_folder, "libsodium", "libsodium.vcxproj"), + "v142", + f"{toolset}", ) + conantoolchain_props = os.path.join(self.generators_folder, MSBuildToolchain.filename) replace_in_file( - self, - vcxproj_file, - f"{old_toolset}", - f"{platform_toolset}", + self, os.path.join(msvc_sln_folder, "libsodium", "libsodium.vcxproj"), + "", + f"", ) + #============================== - def _build_msvc(self): - msvc_ver_subfolder = self._msvc_sln_folder or ("vs2022" if self.version != "1.0.18" else "vs2019") - msvc_sln_folder = os.path.join(self.build_folder, self.source_folder, "builds", "msvc", msvc_ver_subfolder) - - msvc_sln_path = os.path.join(msvc_sln_folder, "libsodium.sln") - - # 1.0.18 only supported up to vs2019. Add support for newer toolsets. - if self.version == "1.0.18" and msvc_ver_subfolder == "vs2019": - vcxproj_path = os.path.join(msvc_sln_folder, "libsodium", "libsodium.vcxproj") - self._fix_msvc_platform_toolset(vcxproj_path, "v142") - - build_type = "{}{}".format( + msbuild = MSBuild(self) + msbuild.build_type = "{}{}".format( "Dyn" if self.options.shared else "Static", "Debug" if self.settings.build_type == "Debug" else "Release", ) - - platform = { - "x86": "Win32", - "x86_64": "x64", - }[str(self.settings.arch)] - - msbuild = MSBuild(self) - msbuild.build_type = build_type - msbuild.platform = platform - msbuild.build(msvc_sln_path) - + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + msbuild.build(os.path.join(msvc_sln_folder, "libsodium.sln")) def build(self): apply_conandata_patches(self) @@ -218,22 +158,25 @@ def build(self): self._build_msvc() else: autotools = Autotools(self) + if self._is_mingw: + autotools.autoreconf() autotools.configure() autotools.make() def package(self): - copy(self, "*LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"), keep_path=False) + copy(self, "*LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) if is_msvc(self): - copy(self, "*.lib", src=self.source_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) - copy(self, "*.dll", src=self.source_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) - inc_src = os.path.join(self.source_folder, "src", self.name, "include") - copy(self, "*.h", src=inc_src, dst=os.path.join(self.package_folder, "include"), keep_path=True, excludes=("*/private/*")) + output_dir = os.path.join(self.source_folder, "bin") + copy(self, "*.lib", src=output_dir, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dll", src=output_dir, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + inc_src = os.path.join(self.source_folder, "src", "libsodium", "include") + copy(self, "*.h", src=inc_src, dst=os.path.join(self.package_folder, "include"), excludes=("*/private/*")) else: autotools = Autotools(self) - # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed - autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + autotools.install() rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.set_property("pkg_config_name", "libsodium") diff --git a/recipes/libsodium/all/test_package/CMakeLists.txt b/recipes/libsodium/all/test_package/CMakeLists.txt index b1d5e6b147fa44..ffb72d743454e6 100644 --- a/recipes/libsodium/all/test_package/CMakeLists.txt +++ b/recipes/libsodium/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) find_package(libsodium REQUIRED CONFIG) diff --git a/recipes/libsodium/all/test_v1_package/CMakeLists.txt b/recipes/libsodium/all/test_v1_package/CMakeLists.txt index b8e19e1fbee268..0d20897301b68b 100644 --- a/recipes/libsodium/all/test_v1_package/CMakeLists.txt +++ b/recipes/libsodium/all/test_v1_package/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +conan_basic_setup(TARGETS) -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libsodium/all/test_v1_package/conanfile.py b/recipes/libsodium/all/test_v1_package/conanfile.py index 5a299b64446c96..38f4483872d47f 100644 --- a/recipes/libsodium/all/test_v1_package/conanfile.py +++ b/recipes/libsodium/all/test_v1_package/conanfile.py @@ -3,8 +3,8 @@ class TestPackageConan(ConanFile): - settings = "os", "compiler", "arch", "build_type" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" def build(self): cmake = CMake(self) diff --git a/recipes/libspng/all/conandata.yml b/recipes/libspng/all/conandata.yml index 7ca9b017ec8e04..20e5a777bfee5d 100644 --- a/recipes/libspng/all/conandata.yml +++ b/recipes/libspng/all/conandata.yml @@ -1,8 +1,22 @@ sources: + "0.7.3": + url: "https://github.com/randy408/libspng/archive/refs/tags/v0.7.3.tar.gz" + sha256: "a50cadbe808ffda1a7fab17d145f52a23b163f34b3eb3696c7ecb5a52340fc1d" "0.7.2": url: "https://github.com/randy408/libspng/archive/refs/tags/v0.7.2.tar.gz" sha256: "4acf25571d31f540d0b7ee004f5461d68158e0a13182505376805da99f4ccc4e" patches: + "0.7.3": + - patch_file: "patches/0.7.3-0001-fix-dll-install.patch" + patch_description: "fix install path" + patch_type: "portability" + - patch_file: "patches/0.7.3-0002-allow-miniz.patch" + patch_description: "add miniz option which is written in docs/BUILD.md" + patch_type: "portability" "0.7.2": - patch_file: "patches/0.7.2-0001-fix-dll-install.patch" + patch_description: "fix install path" + patch_type: "portability" - patch_file: "patches/0.7.2-0002-allow-miniz.patch" + patch_description: "add miniz option which is written in docs/BUILD.md" + patch_type: "portability" diff --git a/recipes/libspng/all/conanfile.py b/recipes/libspng/all/conanfile.py index f75595db035488..fda5245bb07eb8 100644 --- a/recipes/libspng/all/conanfile.py +++ b/recipes/libspng/all/conanfile.py @@ -43,7 +43,7 @@ def layout(self): def requirements(self): if self.options.with_miniz: - self.requires("miniz/2.2.0") + self.requires("miniz/3.0.1") else: self.requires("zlib/1.2.13") diff --git a/recipes/libspng/all/patches/0.7.3-0001-fix-dll-install.patch b/recipes/libspng/all/patches/0.7.3-0001-fix-dll-install.patch new file mode 100644 index 00000000000000..4178460de5ec42 --- /dev/null +++ b/recipes/libspng/all/patches/0.7.3-0001-fix-dll-install.patch @@ -0,0 +1,18 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e6630a0..fff5d68 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -40,7 +40,12 @@ if(SPNG_SHARED) + add_library(spng SHARED ${spng_SOURCES}) + target_include_directories(spng PUBLIC ${PROJECT_SOURCE_DIR}/spng) + target_link_libraries(spng ${spng_LIBS}) +- install(TARGETS spng DESTINATION lib) ++ install( ++ TARGETS spng ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ) + + if(BUILD_EXAMPLES) + add_executable(example examples/example.c) diff --git a/recipes/libspng/all/patches/0.7.3-0002-allow-miniz.patch b/recipes/libspng/all/patches/0.7.3-0002-allow-miniz.patch new file mode 100644 index 00000000000000..88dd6636031a77 --- /dev/null +++ b/recipes/libspng/all/patches/0.7.3-0002-allow-miniz.patch @@ -0,0 +1,64 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index fff5d68..5ed4ad0 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -12,6 +12,7 @@ set(SPNG_VERSION ${SPNG_MAJOR}.${SPNG_MINOR}.${SPNG_REVISION}) + option(ENABLE_OPT "Enable architecture-specific optimizations" ON) + option(SPNG_SHARED "Build shared lib" ON) + option(SPNG_STATIC "Build static lib" ON) ++option(SPNG_USE_MINIZ "Use Miniz instead of zlib" OFF) + option(BUILD_EXAMPLES "Build examples" ON) + + include(GNUInstallDirs) +@@ -21,15 +22,19 @@ if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12") + cmake_policy(SET CMP0074 NEW) + endif() + +-find_package(ZLIB REQUIRED) +-include_directories(${ZLIB_INCLUDE_DIRS}) ++if(SPNG_USE_MINIZ) ++ find_package(miniz REQUIRED) ++ set(spng_LIBS miniz::miniz) ++else() ++ find_package(ZLIB REQUIRED) ++ set(spng_LIBS ZLIB::ZLIB) ++endif() + + set(spng_SOURCES spng/spng.c) + +-if(NOT CMAKE_HOST_WIN32) +- set(spng_LIBS -lm ${ZLIB_LIBRARIES}) +-else() +- set(spng_LIBS ${ZLIB_LIBRARIES}) ++find_library(LIBM NAMES m) ++if(LIBM) ++ list(APPEND spng_LIBS ${LIBM}) + endif() + + if(NOT ENABLE_OPT) +@@ -39,7 +44,10 @@ endif() + if(SPNG_SHARED) + add_library(spng SHARED ${spng_SOURCES}) + target_include_directories(spng PUBLIC ${PROJECT_SOURCE_DIR}/spng) +- target_link_libraries(spng ${spng_LIBS}) ++ target_link_libraries(spng PRIVATE ${spng_LIBS}) ++ if(SPNG_USE_MINIZ) ++ target_compile_definitions(spng PRIVATE SPNG_USE_MINIZ) ++ endif() + install( + TARGETS spng + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +@@ -56,7 +64,12 @@ endif() + + if(SPNG_STATIC) + add_library(spng_static STATIC ${spng_SOURCES}) +- target_include_directories(spng PUBLIC ${PROJECT_SOURCE_DIR}/spng) ++ target_link_libraries(spng_static PRIVATE ${spng_LIBS}) ++ if(SPNG_USE_MINIZ) ++ target_compile_definitions(spng_static PRIVATE SPNG_USE_MINIZ) ++ endif() ++ ++ target_include_directories(spng_static PUBLIC ${PROJECT_SOURCE_DIR}/spng) + target_compile_definitions(spng_static PUBLIC SPNG_STATIC) + install(TARGETS spng_static DESTINATION lib) + endif() diff --git a/recipes/libspng/config.yml b/recipes/libspng/config.yml index eb766ff2f024b8..ed848445a96cc2 100644 --- a/recipes/libspng/config.yml +++ b/recipes/libspng/config.yml @@ -1,3 +1,5 @@ versions: + "0.7.3": + folder: all "0.7.2": folder: all diff --git a/recipes/libsvtav1/all/conandata.yml b/recipes/libsvtav1/all/conandata.yml new file mode 100644 index 00000000000000..de724043d87d6d --- /dev/null +++ b/recipes/libsvtav1/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.2.1": + url: https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v1.2.1/SVT-AV1-v1.2.1.tar.bz2 + sha256: 805827daa8aedec4f1362b959f377075e2a811680bfc76b6f4fbf2ef4e7101d4 diff --git a/recipes/libsvtav1/all/conanfile.py b/recipes/libsvtav1/all/conanfile.py new file mode 100644 index 00000000000000..ec65f7fe245ee2 --- /dev/null +++ b/recipes/libsvtav1/all/conanfile.py @@ -0,0 +1,98 @@ +import os +from conan import ConanFile +from conan.tools.cmake import cmake_layout, CMakeToolchain, CMakeDeps, CMake +from conan.tools.files import copy, get, rmdir + +required_conan_version = ">=1.53.0" + + +class SVTAV1Conan(ConanFile): + name = "libsvtav1" + license = "BSD-3-Clause" + description = "An AV1-compliant software encoder/decoder library" + topics = "av1", "codec", "encoder", "ffmpeg", "video" + homepage = "https://gitlab.com/AOMediaCodec/SVT-AV1" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "build_encoder": [True, False], + "build_decoder": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "build_encoder": True, + "build_decoder": True, + } + + def config_options(self): + if self.settings.os == "Windows": + self.options.rm_safe("fPIC") + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def build_requirements(self): + if self.settings.arch in ("x86", "x86_64"): + self.tool_requires("nasm/2.15.05") + + def layout(self): + cmake_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_APPS"] = False + tc.variables["BUILD_DEC"] = self.options.build_decoder + tc.variables["BUILD_ENC"] = self.options.build_encoder + tc.variables["BUILD_SHARED_LIBS"] = self.options.shared + if self.settings.arch in ("x86", "x86_64"): + tc.variables["ENABLE_NASM"] = True + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy( + self, + "LICENSE.md", + self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + ) + copy( + self, + "PATENTS.md", + self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + ) + + cmake = CMake(self) + cmake.configure() + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + + def package_info(self): + if self.options.build_encoder: + self.cpp_info.components["encoder"].libs = ["SvtAv1Enc"] + self.cpp_info.components["encoder"].includedirs = ["include/svt-av1"] + self.cpp_info.components["encoder"].set_property("pkg_config_name", "SvtAv1Enc") + self.cpp_info.components["encoder"].names["pkg_config"] = "SvtAv1Enc" + if self.settings.os in ("FreeBSD", "Linux"): + self.cpp_info.components["encoder"].system_libs = ["pthread", "dl", "m"] + if self.options.build_decoder: + self.cpp_info.components["decoder"].libs = ["SvtAv1Dec"] + self.cpp_info.components["decoder"].includedirs = ["include/svt-av1"] + self.cpp_info.components["decoder"].set_property("pkg_config_name", "SvtAv1Dec") + self.cpp_info.components["decoder"].names["pkg_config"] = "SvtAv1Dec" + if self.settings.os in ("FreeBSD", "Linux"): + self.cpp_info.components["encoder"].system_libs = ["pthread", "dl", "m"] diff --git a/recipes/libsvtav1/all/test_package/CMakeLists.txt b/recipes/libsvtav1/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..57e131a83ee089 --- /dev/null +++ b/recipes/libsvtav1/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +find_package(libsvtav1 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libsvtav1::encoder) +target_link_libraries(${PROJECT_NAME} PRIVATE libsvtav1::decoder) diff --git a/recipes/libsvtav1/all/test_package/conanfile.py b/recipes/libsvtav1/all/test_package/conanfile.py new file mode 100644 index 00000000000000..f76921cc6be61e --- /dev/null +++ b/recipes/libsvtav1/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +import os +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libsvtav1/all/test_package/test_package.cpp b/recipes/libsvtav1/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..cb808440d268ee --- /dev/null +++ b/recipes/libsvtav1/all/test_package/test_package.cpp @@ -0,0 +1,6 @@ +#include "EbSvtAv1Enc.h" +#include "EbSvtAv1Dec.h" + +#include + +int main() { std::cout << svt_av1_get_version() << "\n"; } diff --git a/recipes/libsvtav1/all/test_v1_package/CMakeLists.txt b/recipes/libsvtav1/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/libsvtav1/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libsvtav1/all/test_v1_package/conanfile.py b/recipes/libsvtav1/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/libsvtav1/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libsvtav1/config.yml b/recipes/libsvtav1/config.yml new file mode 100644 index 00000000000000..b230418434b611 --- /dev/null +++ b/recipes/libsvtav1/config.yml @@ -0,0 +1,3 @@ +versions: + "1.2.1": + folder: all diff --git a/recipes/libsystemd/all/conandata.yml b/recipes/libsystemd/all/conandata.yml index bad16940c7037f..5c8e2c6ade205d 100644 --- a/recipes/libsystemd/all/conandata.yml +++ b/recipes/libsystemd/all/conandata.yml @@ -14,15 +14,18 @@ sources: "251.4": url: "https://github.com/systemd/systemd-stable/archive/v251.4.tar.gz" sha256: "3459239979f52b8c4ace33734d31c2fb69fa13cf81d04b1b982f7d8d4651e015" + "252.4": + url: "https://github.com/systemd/systemd-stable/archive/v252.4.tar.gz" + sha256: "cf2d27e67663d599a045101c7178cf0ec63d9df2962a54adf7de0d0357724f00" patches: "246.16": - patch_file: "patches/246.16/0001-Drop-bundled-copy-of-linux-if_arp.h.patch" patch_description: "fix build error with Linux headers >= 5.14 by removing a bundled copy of it" - patch_type: "backport" + patch_type: "portability" patch_source: "https://github.com/systemd/systemd-stable/commit/06dea04b38ce506c1436cd4fef9bf9919a34f441" - patch_file: "patches/246.16/0002-meson.build-change-operator-combining-bools-from-to-.patch" patch_description: "allow to build with meson >= 0.60.0 by fixing syntax error" - patch_type: "backport" + patch_type: "bugfix" patch_source: "https://github.com/systemd/systemd-stable/commit/3d0666d9091dd097022f02fae79890b5746285c1" - patch_file: "patches/246.16/0003-Remove-dependency-from-coreutils.patch" patch_description: "allow to build in environments without 'realpath --relative-to' by replacing it with conan-specific build variable" @@ -52,3 +55,10 @@ patches: - patch_file: "patches/251.4/0001-Remove-dependency-from-coreutils.patch" patch_description: "allow to build in environments without 'realpath --relative-to' by replacing it with conan-specific build variable" patch_type: "conan" + "252.4": + - patch_file: "patches/248.10/0001-missing_syscalls.py-Replace-unicode-with-ascii.patch" + patch_description: "allow to use meson.build with older versions of Python by replacing utf8 message to ascii message in the helper script" + patch_type: "conan" + - patch_file: "patches/251.4/0001-Remove-dependency-from-coreutils.patch" + patch_description: "allow to build in environments without 'realpath --relative-to' by replacing it with conan-specific build variable" + patch_type: "conan" diff --git a/recipes/libsystemd/config.yml b/recipes/libsystemd/config.yml index 46dd6c53cbb3c2..c1a22f5e0a469c 100644 --- a/recipes/libsystemd/config.yml +++ b/recipes/libsystemd/config.yml @@ -9,3 +9,5 @@ versions: folder: all "251.4": folder: all + "252.4": + folder: all diff --git a/recipes/libtar/all/conanfile.py b/recipes/libtar/all/conanfile.py index b6aa8c881a9850..60120c5cb3ca8e 100644 --- a/recipes/libtar/all/conanfile.py +++ b/recipes/libtar/all/conanfile.py @@ -7,13 +7,13 @@ from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class LibTarConan(ConanFile): name = "libtar" description = "libtar is a library for manipulating tar files from within C programs." - topics = ("libtar", "tar") + topics = ("tar") license = "BSD-3-Clause" homepage = "https://repo.or.cz/libtar.git" url = "https://github.com/conan-io/conan-center-index" @@ -35,25 +35,16 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): basic_layout(self, src_folder="src") def requirements(self): if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def validate(self): if self.info.settings.os == "Windows": diff --git a/recipes/libtar/all/test_v1_package/CMakeLists.txt b/recipes/libtar/all/test_v1_package/CMakeLists.txt index 9fcc6db676fb92..0d20897301b68b 100644 --- a/recipes/libtar/all/test_v1_package/CMakeLists.txt +++ b/recipes/libtar/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(libtar REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE libtar::libtar) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libtiff/all/conanfile.py b/recipes/libtiff/all/conanfile.py index 3ef7d44e84a73c..a288f9366d76a3 100644 --- a/recipes/libtiff/all/conanfile.py +++ b/recipes/libtiff/all/conanfile.py @@ -22,7 +22,7 @@ class LibtiffConan(ConanFile): "shared": [True, False], "fPIC": [True, False], "lzma": [True, False], - "jpeg": [False, "libjpeg-turbo", "libjpeg"], + "jpeg": [False, "libjpeg", "libjpeg-turbo", "mozjpeg"], "zlib": [True, False], "libdeflate": [True, False], "zstd": [True, False], @@ -82,13 +82,15 @@ def requirements(self): if self.options.zlib: self.requires("zlib/1.2.13") if self.options.get_safe("libdeflate"): - self.requires("libdeflate/1.12") + self.requires("libdeflate/1.15") if self.options.lzma: self.requires("xz_utils/5.2.5") if self.options.jpeg == "libjpeg": self.requires("libjpeg/9e") - if self.options.jpeg == "libjpeg-turbo": + elif self.options.jpeg == "libjpeg-turbo": self.requires("libjpeg-turbo/2.1.4") + elif self.options.jpeg == "mozjpeg": + self.requires("mozjpeg/4.1.1") if self.options.jbig: self.requires("jbig/20160605") if self.options.get_safe("zstd"): @@ -97,7 +99,7 @@ def requirements(self): self.requires("libwebp/1.2.4") def validate(self): - if self.info.options.get_safe("libdeflate") and not self.info.options.zlib: + if self.options.get_safe("libdeflate") and not self.options.zlib: raise ConanInvalidConfiguration("libtiff:libdeflate=True requires libtiff:zlib=True") def source(self): @@ -129,32 +131,13 @@ def generate(self): def _patch_sources(self): apply_conandata_patches(self) - top_cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") - libtiff_cmakelists = os.path.join(self.source_folder, "libtiff", "CMakeLists.txt") - - # Handle libjpeg-turbo - if self.options.jpeg == "libjpeg-turbo": - if Version(self.version) < "4.3.0": - file_find_package_jpeg = top_cmakelists - file_jpeg_target = top_cmakelists - else: - file_find_package_jpeg = os.path.join(self.source_folder, "cmake", "JPEGCodec.cmake") - file_jpeg_target = libtiff_cmakelists - cpp_info_jpeg_turbo = self.dependencies["libjpeg-turbo"].cpp_info - jpeg_config = cpp_info_jpeg_turbo.get_property("cmake_file_name") or "libjpeg-turbo" - jpeg_target = cpp_info_jpeg_turbo.components["jpeg"].get_property("cmake_target_name") or "libjpeg-turbo::jpeg" - replace_in_file(self, file_find_package_jpeg, - "find_package(JPEG)", - f"find_package({jpeg_config} REQUIRED CONFIG)\nset(JPEG_FOUND TRUE)") - replace_in_file(self, file_jpeg_target, "JPEG::JPEG", jpeg_target) - # Export symbols of tiffxx for msvc shared - replace_in_file(self, libtiff_cmakelists, + replace_in_file(self, os.path.join(self.source_folder, "libtiff", "CMakeLists.txt"), "set_target_properties(tiffxx PROPERTIES SOVERSION ${SO_COMPATVERSION})", "set_target_properties(tiffxx PROPERTIES SOVERSION ${SO_COMPATVERSION} WINDOWS_EXPORT_ALL_SYMBOLS ON)") # Disable tools, test, contrib, man & html generation - replace_in_file(self, top_cmakelists, + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "add_subdirectory(tools)\nadd_subdirectory(test)\nadd_subdirectory(contrib)\nadd_subdirectory(build)\n" "add_subdirectory(man)\nadd_subdirectory(html)", "") @@ -183,7 +166,26 @@ def package_info(self): if self.settings.os in ["Linux", "Android", "FreeBSD", "SunOS", "AIX"]: self.cpp_info.system_libs.append("m") + self.cpp_info.requires = [] + if self.options.zlib: + self.cpp_info.requires.append("zlib::zlib") + if self.options.get_safe("libdeflate"): + self.cpp_info.requires.append("libdeflate::libdeflate") + if self.options.lzma: + self.cpp_info.requires.append("xz_utils::xz_utils") + if self.options.jpeg == "libjpeg": + self.cpp_info.requires.append("libjpeg::libjpeg") + elif self.options.jpeg == "libjpeg-turbo": + self.cpp_info.requires.append("libjpeg-turbo::jpeg") + elif self.options.jpeg == "mozjpeg": + self.cpp_info.requires.append("mozjpeg::libjpeg") + if self.options.jbig: + self.cpp_info.requires.append("jbig::jbig") + if self.options.get_safe("zstd"): + self.cpp_info.requires.append("zstd::zstd") + if self.options.get_safe("webp"): + self.cpp_info.requires.append("libwebp::libwebp") + # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self.cpp_info.names["cmake_find_package"] = "TIFF" self.cpp_info.names["cmake_find_package_multi"] = "TIFF" - self.cpp_info.names["pkg_config"] = f"libtiff-{Version(self.version).major}" diff --git a/recipes/libtiff/all/patches/4.2.0-0001-cmake-dependencies.patch b/recipes/libtiff/all/patches/4.2.0-0001-cmake-dependencies.patch index 6639e9879408cc..7b04f533eb0f45 100644 --- a/recipes/libtiff/all/patches/4.2.0-0001-cmake-dependencies.patch +++ b/recipes/libtiff/all/patches/4.2.0-0001-cmake-dependencies.patch @@ -12,7 +12,7 @@ + if (1) set(DEFLATE_FOUND 1) - set(DEFLATE_LIBRARIES ${DEFLATE_LIBRARY}) -+ set(DEFLATE_LIBRARIES libdeflate::libdeflate) ++ set(DEFLATE_LIBRARIES $,libdeflate::libdeflate,libdeflate::libdeflate_static>) endif() endif() set(LIBDEFLATE_SUPPORT FALSE) diff --git a/recipes/libtiff/all/patches/4.3.0-0001-cmake-dependencies.patch b/recipes/libtiff/all/patches/4.3.0-0001-cmake-dependencies.patch index a14bbb01635d3c..497c6171bba324 100644 --- a/recipes/libtiff/all/patches/4.3.0-0001-cmake-dependencies.patch +++ b/recipes/libtiff/all/patches/4.3.0-0001-cmake-dependencies.patch @@ -63,7 +63,7 @@ endif() if(ZIP_SUPPORT AND LIBDEFLATE_SUPPORT) - target_link_libraries(tiff PRIVATE Deflate::Deflate) -+ target_link_libraries(tiff PRIVATE libdeflate::libdeflate) ++ target_link_libraries(tiff PRIVATE $,libdeflate::libdeflate,libdeflate::libdeflate_static>) endif() if(JPEG_SUPPORT) target_link_libraries(tiff PRIVATE JPEG::JPEG) diff --git a/recipes/libtiff/all/patches/4.4.0-0001-cmake-dependencies.patch b/recipes/libtiff/all/patches/4.4.0-0001-cmake-dependencies.patch index 6dcc12574992ca..e2a9148325180f 100644 --- a/recipes/libtiff/all/patches/4.4.0-0001-cmake-dependencies.patch +++ b/recipes/libtiff/all/patches/4.4.0-0001-cmake-dependencies.patch @@ -63,7 +63,7 @@ endif() if(ZIP_SUPPORT AND LIBDEFLATE_SUPPORT) - target_link_libraries(tiff PRIVATE Deflate::Deflate) -+ target_link_libraries(tiff PRIVATE libdeflate::libdeflate) ++ target_link_libraries(tiff PRIVATE $,libdeflate::libdeflate,libdeflate::libdeflate_static>) list(APPEND tiff_libs_private_list "${Deflate_LIBRARY}") endif() if(JPEG_SUPPORT) diff --git a/recipes/libunwind/all/conanfile.py b/recipes/libunwind/all/conanfile.py index ffee26f9f18537..a3d3087179b7ac 100644 --- a/recipes/libunwind/all/conanfile.py +++ b/recipes/libunwind/all/conanfile.py @@ -107,7 +107,7 @@ def package(self): shutil.copy(source_path, symlink_path) def package_info(self): - self.cpp_info.components["unwind"].names["pkg_config"] = "libunwind" + self.cpp_info.components["unwind"].set_property("pkg_config_name", "libunwind") self.cpp_info.components["unwind"].libs = ["unwind"] if self.options.minidebuginfo: self.cpp_info.components["unwind"].requires.append("xz_utils::xz_utils") @@ -115,18 +115,18 @@ def package_info(self): self.cpp_info.components["unwind"].requires.append("zlib::zlib") if self.settings.os == "Linux": self.cpp_info.components["unwind"].system_libs.append("pthread") - self.cpp_info.components["generic"].names["pkg_config"] = "libunwind-generic" + self.cpp_info.components["generic"].set_property("pkg_config_name", "libunwind-generic") self.cpp_info.components["generic"].libs = ["unwind-generic"] self.cpp_info.components["generic"].requires = ["unwind"] if self.options.ptrace: - self.cpp_info.components["ptrace"].names["pkg_config"] = "libunwind-ptrace" + self.cpp_info.components["ptrace"].set_property("pkg_config_name", "libunwind-ptrace") self.cpp_info.components["ptrace"].libs = ["unwind-ptrace"] self.cpp_info.components["ptrace"].requires = ["generic", "unwind"] if self.options.setjmp: - self.cpp_info.components["setjmp"].names["pkg_config"] = "libunwind-setjmp" + self.cpp_info.components["setjmp"].set_property("pkg_config_name", "libunwind-setjmp") self.cpp_info.components["setjmp"].libs = ["unwind-setjmp"] self.cpp_info.components["setjmp"].requires = ["unwind"] if self.options.coredump: - self.cpp_info.components["coredump"].names["pkg_config"] = "libunwind-coredump" + self.cpp_info.components["coredump"].set_property("pkg_config_name", "libunwind-coredump") self.cpp_info.components["coredump"].libs = ["unwind-coredump"] self.cpp_info.components["coredump"].requires = ["generic", "unwind"] diff --git a/recipes/libusb/all/conandata.yml b/recipes/libusb/all/conandata.yml index 77c9b6023c5e86..447075d3a8df87 100644 --- a/recipes/libusb/all/conandata.yml +++ b/recipes/libusb/all/conandata.yml @@ -1,13 +1,30 @@ sources: - "1.0.23": - sha256: db11c06e958a82dac52cf3c65cb4dd2c3f339c8a988665110e0d24d19312ad8d - url: https://github.com/libusb/libusb/releases/download/v1.0.23/libusb-1.0.23.tar.bz2 - "1.0.24": - sha256: 7efd2685f7b327326dcfb85cee426d9b871fd70e22caa15bb68d595ce2a2b12a - url: https://github.com/libusb/libusb/releases/download/v1.0.24/libusb-1.0.24.tar.bz2 + "1.0.26": + url: "https://github.com/libusb/libusb/releases/download/v1.0.26/libusb-1.0.26.tar.bz2" + sha256: "12ce7a61fc9854d1d2a1ffe095f7b5fac19ddba095c259e6067a46500381b5a5" "1.0.25": - sha256: 8a28ef197a797ebac2702f095e81975e2b02b2eeff2774fa909c78a74ef50849 - url: https://github.com/libusb/libusb/releases/download/v1.0.25/libusb-1.0.25.tar.bz2 + url: "https://github.com/libusb/libusb/releases/download/v1.0.25/libusb-1.0.25.tar.bz2" + sha256: "8a28ef197a797ebac2702f095e81975e2b02b2eeff2774fa909c78a74ef50849" + "1.0.24": + url: "https://github.com/libusb/libusb/releases/download/v1.0.24/libusb-1.0.24.tar.bz2" + sha256: "7efd2685f7b327326dcfb85cee426d9b871fd70e22caa15bb68d595ce2a2b12a" + "1.0.23": + url: "https://github.com/libusb/libusb/releases/download/v1.0.23/libusb-1.0.23.tar.bz2" + sha256: "db11c06e958a82dac52cf3c65cb4dd2c3f339c8a988665110e0d24d19312ad8d" +patches: "1.0.26": - sha256: 12ce7a61fc9854d1d2a1ffe095f7b5fac19ddba095c259e6067a46500381b5a5 - url: https://github.com/libusb/libusb/releases/download/v1.0.26/libusb-1.0.26.tar.bz2 + - patch_file: "patches/1.0.24-0001-relax-windows-sdk-restriction.patch" + patch_description: "Relax Windows SDK restriction" + patch_type: "conan" + "1.0.25": + - patch_file: "patches/1.0.24-0001-relax-windows-sdk-restriction.patch" + patch_description: "Relax Windows SDK restriction" + patch_type: "conan" + "1.0.24": + - patch_file: "patches/1.0.24-0001-relax-windows-sdk-restriction.patch" + patch_description: "Relax Windows SDK restriction" + patch_type: "conan" + "1.0.23": + - patch_file: "patches/1.0.23-0001-relax-windows-sdk-restriction.patch" + patch_description: "Relax Windows SDK restriction" + patch_type: "conan" diff --git a/recipes/libusb/all/conanfile.py b/recipes/libusb/all/conanfile.py index 0c93d90aac203b..60d9abeb38bd01 100644 --- a/recipes/libusb/all/conanfile.py +++ b/recipes/libusb/all/conanfile.py @@ -1,13 +1,14 @@ from conan import ConanFile from conan.tools.apple import fix_apple_shared_install_name -from conan.tools.microsoft import is_msvc -from conan.tools.files import get, chdir, rmdir, rm, replace_in_file +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, MSBuild, MSBuildToolchain from conan.tools.scm import Version -from conans import AutoToolsBuildEnvironment, MSBuild, tools import os -import re -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.54.0" class LibUSBConan(ConanFile): @@ -16,8 +17,8 @@ class LibUSBConan(ConanFile): license = "LGPL-2.1" homepage = "https://github.com/libusb/libusb" url = "https://github.com/conan-io/conan-center-index" - topics = ("conan", "libusb", "usb", "device") - settings = "os", "compiler", "build_type", "arch" + topics = ("usb", "device") + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -28,11 +29,6 @@ class LibUSBConan(ConanFile): "fPIC": True, "enable_udev": True, } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" @property def _is_mingw(self): @@ -40,7 +36,14 @@ def _is_mingw(self): @property def _settings_build(self): - return self.settings_build if hasattr(self, "settings_build") else self.settings + return getattr(self, "settings_build", self.settings) + + @property + def _msbuild_configuration(self): + return "Debug" if self.settings.build_type == "Debug" else "Release" + + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -53,97 +56,86 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): - pass - - def build_requirements(self): - if self._settings_build.os == "Windows" and not is_msvc(self) and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + basic_layout(self, src_folder="src") def requirements(self): if self.settings.os == "Linux": if self.options.enable_udev: self.requires("libudev/system") + def build_requirements(self): + if self._settings_build.os == "Windows" and not is_msvc(self): + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _build_visual_studio(self): - with chdir(self, self._source_subfolder): - # Assume we're using the latest Visual Studio and default to libusb_2019.sln - # (or libusb_2017.sln for libusb < 1.0.24). - # If we're not using the latest Visual Studio, select an appropriate solution file. - solution_msvc_year = 2019 if Version(self.version) >= "1.0.24" else 2017 - - solution_msvc_year = { - "11": 2012, - "12": 2013, - "14": 2015, - "15": 2017 - }.get(str(self.settings.compiler.version), solution_msvc_year) - - solution_file = os.path.join("msvc", "libusb_{}.sln".format(solution_msvc_year)) - platforms = {"x86":"Win32"} - properties = { - # Enable LTO when CFLAGS contains -GL - "WholeProgramOptimization": "true" if any(re.finditer("(^| )[/-]GL($| )", tools.get_env("CFLAGS", ""))) else "false", - } - msbuild = MSBuild(self) - build_type = "Debug" if self.settings.build_type == "Debug" else "Release" - msbuild.build(solution_file, platforms=platforms, upgrade_project=False, properties=properties, build_type=build_type) - - def _configure_autotools(self): - if not self._autotools: - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - configure_args = ["--enable-shared" if self.options.shared else "--disable-shared"] - configure_args.append("--enable-static" if not self.options.shared else "--disable-static") + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.configuration = self._msbuild_configuration + tc.properties["WholeProgramOptimization"] = "false" + tc.generate() + else: + VirtualBuildEnv(self).generate() + tc = AutotoolsToolchain(self) if self.settings.os in ["Linux", "Android"]: - configure_args.append("--enable-udev" if self.options.enable_udev else "--disable-udev") - elif self._is_mingw: - if self.settings.arch == "x86_64": - configure_args.append("--host=x86_64-w64-mingw32") - elif self.settings.arch == "x86": - configure_args.append("--build=i686-w64-mingw32") - configure_args.append("--host=i686-w64-mingw32") - self._autotools.configure(args=configure_args, configure_dir=self._source_subfolder) - return self._autotools + tc.configure_args.append("--enable-udev" if self.options.enable_udev else "--disable-udev") + tc.generate() def build(self): + apply_conandata_patches(self) if is_msvc(self): - if Version(self.version) < "1.0.24": - for vcxproj in ["fxload_2017", "getopt_2017", "hotplugtest_2017", "libusb_dll_2017", - "libusb_static_2017", "listdevs_2017", "stress_2017", "testlibusb_2017", "xusb_2017"]: - vcxproj_path = os.path.join(self._source_subfolder, "msvc", "%s.vcxproj" % vcxproj) - replace_in_file(self, vcxproj_path, "10.0.16299.0", "") - self._build_visual_studio() - else: - autotools = self._configure_autotools() - autotools.make() + solution_msvc_year = "2017" if Version(self.version) < "1.0.24" else "2019" + solution = f"libusb_{'dll' if self.options.shared else 'static'}_{solution_msvc_year}.vcxproj" + vcxproj_path = os.path.join(self.source_folder, "msvc", solution) + + #============================== + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + replace_in_file( + self, vcxproj_path, + "true", + "", + ) + old_toolset = "v141" if Version(self.version) < "1.0.24" else "v142" + new_toolset = MSBuildToolchain(self).toolset + replace_in_file( + self, vcxproj_path, + f"{old_toolset}", + f"{new_toolset}", + ) + conantoolchain_props = os.path.join(self.generators_folder, MSBuildToolchain.filename) + replace_in_file( + self, vcxproj_path, + "", + f"", + ) + #============================== - def _package_visual_studio(self): - self.copy(pattern="libusb.h", dst=os.path.join("include", "libusb-1.0"), src=os.path.join(self._source_subfolder, "libusb"), keep_path=False) - arch = "x64" if self.settings.arch == "x86_64" else "Win32" - source_dir = os.path.join(self._source_subfolder, arch, str(self.settings.build_type), "dll" if self.options.shared else "lib") - if self.options.shared: - self.copy(pattern="libusb-1.0.dll", dst="bin", src=source_dir, keep_path=False) - self.copy(pattern="libusb-1.0.lib", dst="lib", src=source_dir, keep_path=False) - self.copy(pattern="libusb-usbdk-1.0.dll", dst="bin", src=source_dir, keep_path=False) - self.copy(pattern="libusb-usbdk-1.0.lib", dst="lib", src=source_dir, keep_path=False) + msbuild = MSBuild(self) + msbuild.build_type = self._msbuild_configuration + msbuild.build(vcxproj_path) else: - self.copy(pattern="libusb-1.0.lib", dst="lib", src=source_dir, keep_path=False) - self.copy(pattern="libusb-usbdk-1.0.lib", dst="lib", src=source_dir, keep_path=False) + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses", keep_path=False) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) if is_msvc(self): - self._package_visual_studio() + copy(self, "libusb.h", src=os.path.join(self.source_folder, "libusb"), + dst=os.path.join(self.package_folder, "include", "libusb-1.0")) + copy(self, "*.dll", src=self.source_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "*.lib", src=self.source_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rm(self, "*.la", os.path.join(self.package_folder, "lib")) @@ -151,7 +143,8 @@ def package(self): def package_info(self): self.cpp_info.set_property("pkg_config_name", "libusb-1.0") - self.cpp_info.libs = tools.collect_libs(self) + prefix = "lib" if is_msvc(self) else "" + self.cpp_info.libs = [f"{prefix}usb-1.0"] self.cpp_info.includedirs.append(os.path.join("include", "libusb-1.0")) if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("pthread") diff --git a/recipes/libusb/all/patches/1.0.23-0001-relax-windows-sdk-restriction.patch b/recipes/libusb/all/patches/1.0.23-0001-relax-windows-sdk-restriction.patch new file mode 100644 index 00000000000000..1c12693d1700c2 --- /dev/null +++ b/recipes/libusb/all/patches/1.0.23-0001-relax-windows-sdk-restriction.patch @@ -0,0 +1,20 @@ +--- a/msvc/libusb_dll_2017.vcxproj ++++ b/msvc/libusb_dll_2017.vcxproj +@@ -38,7 +38,6 @@ + libusb-1.0 (dll) + {349EE8FA-7D25-4909-AAF5-FF3FADE72187} + libusbdll +- 10.0.16299.0 + true + true + +--- a/msvc/libusb_static_2017.vcxproj ++++ b/msvc/libusb_static_2017.vcxproj +@@ -38,7 +38,6 @@ + libusb-1.0 (static) + {349EE8F9-7D25-4909-AAF5-FF3FADE72187} + libusb +- 10.0.16299.0 + true + true + diff --git a/recipes/libusb/all/patches/1.0.24-0001-relax-windows-sdk-restriction.patch b/recipes/libusb/all/patches/1.0.24-0001-relax-windows-sdk-restriction.patch new file mode 100644 index 00000000000000..a45db143ab1b1e --- /dev/null +++ b/recipes/libusb/all/patches/1.0.24-0001-relax-windows-sdk-restriction.patch @@ -0,0 +1,20 @@ +--- a/msvc/libusb_dll_2019.vcxproj ++++ b/msvc/libusb_dll_2019.vcxproj +@@ -40,7 +40,6 @@ + libusbdll + true + true +- 10.0 + + + +--- a/msvc/libusb_static_2019.vcxproj ++++ b/msvc/libusb_static_2019.vcxproj +@@ -40,7 +40,6 @@ + libusb + true + true +- 10.0 + + + diff --git a/recipes/libusb/all/test_package/CMakeLists.txt b/recipes/libusb/all/test_package/CMakeLists.txt index a5ffd526aaea76..968df07ffe10ad 100644 --- a/recipes/libusb/all/test_package/CMakeLists.txt +++ b/recipes/libusb/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libusb REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} test_package.c) -target_link_libraries(${CMAKE_PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE libusb::libusb) diff --git a/recipes/libusb/all/test_package/conanfile.py b/recipes/libusb/all/test_package/conanfile.py index 3695635f5e0f5d..98ab55852ad565 100644 --- a/recipes/libusb/all/test_package/conanfile.py +++ b/recipes/libusb/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin","test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libusb/all/test_package/test_package.c b/recipes/libusb/all/test_package/test_package.c index 89a9b8ba85b345..0ccc95e9223f01 100644 --- a/recipes/libusb/all/test_package/test_package.c +++ b/recipes/libusb/all/test_package/test_package.c @@ -1,21 +1,18 @@ -#include "libusb-1.0/libusb.h" - +#include int main(int argc, char *argv[]) { - libusb_device **devs; - ssize_t cnt; - int r, i; + libusb_device **devs; - r = libusb_init(NULL); - if (r < 0) - return r; + int r = libusb_init(NULL); + if (r < 0) + return r; - cnt = libusb_get_device_list(NULL, &devs); - if (cnt < 0) - return (int)cnt; + ssize_t cnt = libusb_get_device_list(NULL, &devs); + if (cnt < 0) + return (int)cnt; - libusb_free_device_list(devs, 1); - libusb_exit(NULL); + libusb_free_device_list(devs, 1); + libusb_exit(NULL); - return 0; + return 0; } diff --git a/recipes/libusb/all/test_v1_package/CMakeLists.txt b/recipes/libusb/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/libusb/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libusb/all/test_v1_package/conanfile.py b/recipes/libusb/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..81f9e01d9be5d6 --- /dev/null +++ b/recipes/libusb/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin","test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libusb/config.yml b/recipes/libusb/config.yml index 8c9d67d1012f2c..21a7ffcef562b2 100644 --- a/recipes/libusb/config.yml +++ b/recipes/libusb/config.yml @@ -1,10 +1,9 @@ ---- versions: - "1.0.23": - folder: all - "1.0.24": + "1.0.26": folder: all "1.0.25": folder: all - "1.0.26": + "1.0.24": + folder: all + "1.0.23": folder: all diff --git a/recipes/libuuid/all/conanfile.py b/recipes/libuuid/all/conanfile.py index aa83c7a3c0314c..83191c7fd19231 100644 --- a/recipes/libuuid/all/conanfile.py +++ b/recipes/libuuid/all/conanfile.py @@ -7,7 +7,7 @@ from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class LibuuidConan(ConanFile): @@ -16,8 +16,7 @@ class LibuuidConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://sourceforge.net/projects/libuuid/" license = "BSD-3-Clause" - topics = ("libuuid", "uuid", "unique-id", "unique-identifier") - + topics = "id", "identifier", "unique", "uuid" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -37,25 +36,16 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass - try: - del self.settings.compiler.libcxx - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): basic_layout(self, src_folder="src") def validate(self): if self.info.settings.os == "Windows": - raise ConanInvalidConfiguration("libuuid is not supported on Windows") + raise ConanInvalidConfiguration(f"{self.ref} is not supported on Windows") def build_requirements(self): self.tool_requires("libtool/2.4.7") diff --git a/recipes/libuuid/all/test_v1_package/CMakeLists.txt b/recipes/libuuid/all/test_v1_package/CMakeLists.txt index 40c1a8324330c0..925ecbe19e448d 100644 --- a/recipes/libuuid/all/test_v1_package/CMakeLists.txt +++ b/recipes/libuuid/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES C) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(libuuid REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE libuuid::libuuid) -target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libuvc/all/CMakeLists.txt b/recipes/libuvc/all/CMakeLists.txt deleted file mode 100644 index c986d294c75479..00000000000000 --- a/recipes/libuvc/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/libuvc/all/conandata.yml b/recipes/libuvc/all/conandata.yml index 2a11d1f42776b2..080f9c58fdbad1 100644 --- a/recipes/libuvc/all/conandata.yml +++ b/recipes/libuvc/all/conandata.yml @@ -4,7 +4,9 @@ sources: sha256: "42175a53c1c704365fdc782b44233925e40c9344fbb7f942181c1090f06e2873" patches: "0.0.6": - - patch_file: "patches/0001-adjust-libusb.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-adjust-libusb-libjpeg.patch" + patch_description: "Robust discovery and injection of libusb & libjpeg" + patch_type: "conan" - patch_file: "patches/0002-adjust-install-folder.patch" - base_path: "source_subfolder" + patch_description: "Install to standard layout" + patch_type: "conan" diff --git a/recipes/libuvc/all/conanfile.py b/recipes/libuvc/all/conanfile.py index 3dc2f88c2a0c93..17b10736856bfd 100644 --- a/recipes/libuvc/all/conanfile.py +++ b/recipes/libuvc/all/conanfile.py @@ -1,14 +1,19 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.gnu import PkgConfigDeps +from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class LibuvcConan(ConanFile): name = "libuvc" description = "A cross-platform library for USB video devices" - topics = ("libuvc", "libusb", "usb", "video") + topics = ("libusb", "usb", "video") license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/libuvc/libuvc" @@ -17,33 +22,18 @@ class LibuvcConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], - "jpeg_turbo": [True, False], + "with_jpeg": [False, "libjpeg", "libjpeg-turbo", "mozjpeg"], + "jpeg_turbo": [True, False, "deprecated"], } default_options = { "shared": False, "fPIC": True, - "jpeg_turbo": False, + "with_jpeg": "libjpeg", + "jpeg_turbo": "deprecated", } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -51,55 +41,90 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + # TODO: to remove once deprecated jpeg_turbo option removed + if self.options.jpeg_turbo != "deprecated": + self.output.warning("jpeg_turbo option is deprecated, please use with_jpeg option instead") + if self.options.jpeg_turbo: + self.options.with_jpeg == "libjpeg-turbo" + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("libusb/1.0.24") - if self.options.jpeg_turbo: - self.requires("libjpeg-turbo/2.1.2") - else: - self.requires("libjpeg/9d") + self.requires("libusb/1.0.26") + if self.options.with_jpeg == "libjpeg": + self.requires("libjpeg/9e") + elif self.options.with_jpeg == "libjpeg-turbo": + self.requires("libjpeg-turbo/2.1.4") + elif self.options.with_jpeg == "mozjpeg": + self.requires("mozjpeg/4.1.1") + + def package_id(self): + # TODO: to remove once deprecated jpeg_turbo option removed + del self.info.options.jpeg_turbo def validate(self): - if self._is_msvc: + if is_msvc(self): # Upstream issues, e.g.: # https://github.com/libuvc/libuvc/issues/100 # https://github.com/libuvc/libuvc/issues/105 raise ConanInvalidConfiguration("libuvc is not compatible with Visual Studio.") + def build_requirements(self): + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") + def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + VirtualBuildEnv(self).generate() + + tc = CMakeToolchain(self) + tc.variables["CMAKE_BUILD_TARGET"] = "Shared" if self.options.shared else "Static" + tc.variables["LIBUVC_WITH_JPEG"] = bool(self.options.with_jpeg) + # Relocatable shared libs on macOS + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.definitions["CMAKE_BUILD_TARGET"] = "Shared" if self.options.shared else "Static" - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + CMakeDeps(self).generate() + PkgConfigDeps(self).generate() + # TODO: to remove when properly handled by conan (see https://github.com/conan-io/conan/issues/11962) + env = Environment() + env.prepend_path("PKG_CONFIG_PATH", self.generators_folder) + env.vars(self).save_script("conanbuildenv_pkg_config_path") def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): cmake_target = "UVCShared" if self.options.shared else "UVCStatic" self.cpp_info.set_property("cmake_file_name", "libuvc") - self.cpp_info.set_property("cmake_target_name", "LibUVC::{}".format(cmake_target)) + self.cpp_info.set_property("cmake_target_name", f"LibUVC::{cmake_target}") self.cpp_info.set_property("pkg_config_name", "libuvc") # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed - self.cpp_info.components["_libuvc"].libs = tools.collect_libs(self) + self.cpp_info.components["_libuvc"].libs = ["uvc"] + self.cpp_info.components["_libuvc"].requires = ["libusb::libusb"] + if self.options.with_jpeg == "libjpeg": + self.cpp_info.components["_libuvc"].requires.append("libjpeg::libjpeg") + elif self.options.with_jpeg == "libjpeg-turbo": + self.cpp_info.components["_libuvc"].requires.append("libjpeg-turbo::jpeg") + elif self.options.with_jpeg == "mozjpeg": + self.cpp_info.components["_libuvc"].requires.append("mozjpeg::libjpeg") # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "libuvc" @@ -108,9 +133,5 @@ def package_info(self): self.cpp_info.names["cmake_find_package_multi"] = "LibUVC" self.cpp_info.components["_libuvc"].names["cmake_find_package"] = cmake_target self.cpp_info.components["_libuvc"].names["cmake_find_package_multi"] = cmake_target - self.cpp_info.components["_libuvc"].set_property("cmake_target_name", "LibUVC::{}".format(cmake_target)) + self.cpp_info.components["_libuvc"].set_property("cmake_target_name", f"LibUVC::{cmake_target}") self.cpp_info.components["_libuvc"].set_property("pkg_config_name", "libuvc") - self.cpp_info.components["_libuvc"].requires = [ - "libusb::libusb", - "libjpeg-turbo::libjpeg-turbo" if self.options.jpeg_turbo else "libjpeg::libjpeg" - ] diff --git a/recipes/libuvc/all/patches/0001-adjust-libusb-libjpeg.patch b/recipes/libuvc/all/patches/0001-adjust-libusb-libjpeg.patch new file mode 100644 index 00000000000000..7becb18ff92a3b --- /dev/null +++ b/recipes/libuvc/all/patches/0001-adjust-libusb-libjpeg.patch @@ -0,0 +1,63 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -19,13 +19,16 @@ set(libuvc_VERSION ${libuvc_VERSION_MAJOR}.${libuvc_VERSION_MINOR}.${libuvc_VERS + set(libuvc_DESCRIPTION "A cross-platform library for USB video devices") + set(libuvc_URL "https://github.com/ktossell/libuvc") + +-find_package(PkgConfig) ++find_package(PkgConfig REQUIRED) + pkg_check_modules(LIBUSB libusb-1.0) ++link_directories(${LIBUSB_LIBRARY_DIRS}) + + # Try to find JPEG using a module or pkg-config. If that doesn't work, search for the header. +-find_package(jpeg QUIET) +-if(JPEG_FOUND) +- set(JPEG_LINK_FLAGS ${JPEG_LIBRARIES}) ++option(LIBUVC_WITH_JPEG "Support JPEG decoding" ON) ++if(LIBUVC_WITH_JPEG) ++find_package(JPEG REQUIRED) ++if(1) ++ set(JPEG_LINK_FLAGS JPEG::JPEG) + else() + pkg_check_modules(JPEG QUIET libjpeg) + if(JPEG_FOUND) +@@ -39,6 +42,7 @@ else() + endif() + endif() + endif() ++endif() + + include(GNUInstallDirs) + +@@ -57,7 +61,7 @@ include_directories( + ${LIBUSB_INCLUDE_DIRS} + ) + +-if(JPEG_FOUND) ++if(LIBUVC_WITH_JPEG) + message(STATUS "Building libuvc with JPEG support.") + include_directories(${JPEG_INCLUDE_DIR}) + SET(LIBUVC_HAS_JPEG TRUE) +@@ -84,6 +88,10 @@ endif() + + if(BUILD_UVC_STATIC) + add_library(uvc_static STATIC ${SOURCES}) ++ target_link_libraries(uvc_static ${LIBUSB_LIBRARIES}) ++ if(LIBUVC_WITH_JPEG) ++ target_link_libraries(uvc_static ${JPEG_LINK_FLAGS}) ++ endif() + set_target_properties(uvc_static PROPERTIES OUTPUT_NAME uvc) + list(APPEND UVC_TARGETS uvc_static) + endif() +@@ -97,9 +105,9 @@ foreach(target_name ${UVC_TARGETS}) + endforeach() + + if(BUILD_UVC_SHARED) +- if(JPEG_FOUND) ++ if(LIBUVC_WITH_JPEG) + target_link_libraries (uvc ${JPEG_LINK_FLAGS}) +- endif(JPEG_FOUND) ++ endif() + + target_link_libraries(uvc ${LIBUSB_LIBRARIES}) + diff --git a/recipes/libuvc/all/patches/0001-adjust-libusb.patch b/recipes/libuvc/all/patches/0001-adjust-libusb.patch deleted file mode 100644 index 24c0fe99c85a73..00000000000000 --- a/recipes/libuvc/all/patches/0001-adjust-libusb.patch +++ /dev/null @@ -1,51 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index a19209d..581a308 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -19,26 +19,9 @@ set(libuvc_VERSION ${libuvc_VERSION_MAJOR}.${libuvc_VERSION_MINOR}.${libuvc_VERS - set(libuvc_DESCRIPTION "A cross-platform library for USB video devices") - set(libuvc_URL "https://github.com/ktossell/libuvc") - --find_package(PkgConfig) --pkg_check_modules(LIBUSB libusb-1.0) -- - # Try to find JPEG using a module or pkg-config. If that doesn't work, search for the header. --find_package(jpeg QUIET) --if(JPEG_FOUND) -- set(JPEG_LINK_FLAGS ${JPEG_LIBRARIES}) --else() -- pkg_check_modules(JPEG QUIET libjpeg) -- if(JPEG_FOUND) -- set(JPEG_INCLUDE_DIR ${JPEG_INCLUDE_DIRS}) -- set(JPEG_LINK_FLAGS ${JPEG_LDFLAGS}) -- else() -- find_path(JPEG_INCLUDE_DIR jpeglib.h) -- if(JPEG_INCLUDE_DIR) -- set(JPEG_FOUND ON) -- set(JPEG_LINK_FLAGS -ljpeg) -- endif() -- endif() --endif() -+find_package(JPEG QUIET) -+set(JPEG_LINK_FLAGS ${JPEG_LIBRARIES}) - - include(GNUInstallDirs) - -@@ -54,7 +37,7 @@ SET(SOURCES src/ctrl.c src/ctrl-gen.c src/device.c src/diag.c - include_directories( - ${libuvc_SOURCE_DIR}/include - ${libuvc_BINARY_DIR}/include -- ${LIBUSB_INCLUDE_DIRS} -+ ${CONAN_INCLUDE_DIRS_LIBUSB} - ) - - if(JPEG_FOUND) -@@ -101,7 +84,7 @@ if(BUILD_UVC_SHARED) - target_link_libraries (uvc ${JPEG_LINK_FLAGS}) - endif(JPEG_FOUND) - -- target_link_libraries(uvc ${LIBUSB_LIBRARIES}) -+ target_link_libraries(uvc ${CONAN_LIBS_LIBUSB}) - - #add_executable(test src/test.c) - #target_link_libraries(test uvc ${LIBUSB_LIBRARIES} opencv_highgui diff --git a/recipes/libuvc/all/patches/0002-adjust-install-folder.patch b/recipes/libuvc/all/patches/0002-adjust-install-folder.patch index 6f0177f681d0a4..aa773f521427f6 100644 --- a/recipes/libuvc/all/patches/0002-adjust-install-folder.patch +++ b/recipes/libuvc/all/patches/0002-adjust-install-folder.patch @@ -1,16 +1,16 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 581a308..c3ccfa2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -93,8 +93,9 @@ endif() +@@ -118,9 +118,10 @@ endif() install(TARGETS ${UVC_TARGETS} EXPORT libuvcTargets - LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_LIBRARY_ARCHITECTURE}" - ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_LIBRARY_ARCHITECTURE}" -+ LIBRARY DESTINATION "lib" -+ ARCHIVE DESTINATION "lib" -+ RUNTIME DESTINATION "bin" - PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_PREFIX}/include/libuvc" +- PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_PREFIX}/include/libuvc" ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libuvc ) + export(TARGETS ${UVC_TARGETS} diff --git a/recipes/libuvc/all/test_package/CMakeLists.txt b/recipes/libuvc/all/test_package/CMakeLists.txt index 014804b013c2d5..ff4548b24f2950 100644 --- a/recipes/libuvc/all/test_package/CMakeLists.txt +++ b/recipes/libuvc/all/test_package/CMakeLists.txt @@ -1,14 +1,11 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(libuvc REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) if(TARGET LibUVC::UVCShared) - target_link_libraries(${PROJECT_NAME} LibUVC::UVCShared) + target_link_libraries(${PROJECT_NAME} PRIVATE LibUVC::UVCShared) else() - target_link_libraries(${PROJECT_NAME} LibUVC::UVCStatic) + target_link_libraries(${PROJECT_NAME} PRIVATE LibUVC::UVCStatic) endif() diff --git a/recipes/libuvc/all/test_package/conanfile.py b/recipes/libuvc/all/test_package/conanfile.py index 38f4483872d47f..98ab55852ad565 100644 --- a/recipes/libuvc/all/test_package/conanfile.py +++ b/recipes/libuvc/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libuvc/all/test_v1_package/CMakeLists.txt b/recipes/libuvc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/libuvc/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libuvc/all/test_v1_package/conanfile.py b/recipes/libuvc/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/libuvc/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libwebp/all/conandata.yml b/recipes/libwebp/all/conandata.yml index 73b2540022f74c..ef43b815c4921d 100644 --- a/recipes/libwebp/all/conandata.yml +++ b/recipes/libwebp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.0": + url: "https://github.com/webmproject/libwebp/archive/v1.3.0.tar.gz" + sha256: "dc9860d3fe06013266c237959e1416b71c63b36f343aae1d65ea9c94832630e1" "1.2.4": url: "https://github.com/webmproject/libwebp/archive/v1.2.4.tar.gz" sha256: "dfe7bff3390cd4958da11e760b65318f0a48c32913e4d5bc5e8d55abaaa2d32e" @@ -9,7 +12,7 @@ sources: url: "https://github.com/webmproject/libwebp/archive/v1.2.2.tar.gz" sha256: "51e9297aadb7d9eb99129fe0050f53a11fcce38a0848fb2b0389e385ad93695e" "1.2.1": - url: "https://github.com/webmproject/libwebp/archive/refs/tags/v1.2.1.tar.gz" + url: "https://github.com/webmproject/libwebp/archive/v1.2.1.tar.gz" sha256: "01bcde6a40a602294994050b81df379d71c40b7e39c819c024d079b3c56307f4" "1.2.0": url: "https://github.com/webmproject/libwebp/archive/v1.2.0.tar.gz" @@ -21,21 +24,48 @@ sources: url: "https://github.com/webmproject/libwebp/archive/v1.0.3.tar.gz" sha256: "082d114bcb18a0e2aafc3148d43367c39304f86bf18ba0b2e766447e111a4a91" patches: + "1.3.0": + - patch_file: "patches/1.3.0-0001-fix-cmake.patch" + patch_description: "disable PIC, disable prefix library name on MSVC" + patch_type: "conan" "1.2.4": - - patch_file: "patches/0001-fix-dll-export.patch" + - patch_file: "patches/1.0.3-0001-fix-dll-export.patch" + patch_description: "define WEBP_EXTERN for windows shared build" + patch_type: "portability" "1.2.3": - - patch_file: "patches/0001-fix-dll-export.patch" + - patch_file: "patches/1.0.3-0001-fix-dll-export.patch" + patch_description: "define WEBP_EXTERN for windows shared build" + patch_type: "portability" "1.2.2": - - patch_file: "patches/0001-fix-dll-export.patch" + - patch_file: "patches/1.0.3-0001-fix-dll-export.patch" + patch_description: "define WEBP_EXTERN for windows shared build" + patch_type: "portability" "1.2.1": - - patch_file: "patches/0001-fix-dll-export.patch" + - patch_file: "patches/1.0.3-0001-fix-dll-export.patch" + patch_description: "define WEBP_EXTERN for windows shared build" + patch_type: "portability" "1.2.0": - - patch_file: "patches/0001-fix-dll-export.patch" - - patch_file: "patches/0003-build-libwebpmux-1.2.0.patch" + - patch_file: "patches/1.0.3-0001-fix-dll-export.patch" + patch_description: "define WEBP_EXTERN for windows shared build" + patch_type: "portability" + - patch_file: "patches/1.2.0-0003-build-libwebpmux.patch" + patch_description: "always build libwebpmux" + patch_type: "conan" "1.1.0": - - patch_file: "patches/0001-fix-dll-export.patch" - - patch_file: "patches/0002-qnx.patch" - - patch_file: "patches/0003-build-libwebpmux-1.1.0.patch" + - patch_file: "patches/1.0.3-0001-fix-dll-export.patch" + patch_description: "define WEBP_EXTERN for windows shared build" + patch_type: "portability" + - patch_file: "patches/1.1.0-0002-qnx.patch" + patch_description: "work around cmake bug on QNX" + patch_type: "conan" + patch_source: "https://chromium-review.googlesource.com/c/webm/libwebp/+/2637274" + - patch_file: "patches/1.1.0-0003-build-libwebpmux.patch" + patch_description: "always build libwebpmux" + patch_type: "conan" "1.0.3": - - patch_file: "patches/0001-fix-dll-export.patch" - - patch_file: "patches/0003-build-libwebpmux-1.0.3.patch" + - patch_file: "patches/1.0.3-0001-fix-dll-export.patch" + patch_description: "define WEBP_EXTERN for windows shared build" + patch_type: "portability" + - patch_file: "patches/1.0.3-0002-build-libwebpmux.patch" + patch_description: "always build libwebpmux" + patch_type: "conan" diff --git a/recipes/libwebp/all/patches/0001-fix-dll-export.patch b/recipes/libwebp/all/patches/1.0.3-0001-fix-dll-export.patch similarity index 100% rename from recipes/libwebp/all/patches/0001-fix-dll-export.patch rename to recipes/libwebp/all/patches/1.0.3-0001-fix-dll-export.patch diff --git a/recipes/libwebp/all/patches/0003-build-libwebpmux-1.0.3.patch b/recipes/libwebp/all/patches/1.0.3-0002-build-libwebpmux.patch similarity index 100% rename from recipes/libwebp/all/patches/0003-build-libwebpmux-1.0.3.patch rename to recipes/libwebp/all/patches/1.0.3-0002-build-libwebpmux.patch diff --git a/recipes/libwebp/all/patches/0002-qnx.patch b/recipes/libwebp/all/patches/1.1.0-0002-qnx.patch similarity index 100% rename from recipes/libwebp/all/patches/0002-qnx.patch rename to recipes/libwebp/all/patches/1.1.0-0002-qnx.patch diff --git a/recipes/libwebp/all/patches/0003-build-libwebpmux-1.1.0.patch b/recipes/libwebp/all/patches/1.1.0-0003-build-libwebpmux.patch similarity index 100% rename from recipes/libwebp/all/patches/0003-build-libwebpmux-1.1.0.patch rename to recipes/libwebp/all/patches/1.1.0-0003-build-libwebpmux.patch diff --git a/recipes/libwebp/all/patches/0003-build-libwebpmux-1.2.0.patch b/recipes/libwebp/all/patches/1.2.0-0003-build-libwebpmux.patch similarity index 100% rename from recipes/libwebp/all/patches/0003-build-libwebpmux-1.2.0.patch rename to recipes/libwebp/all/patches/1.2.0-0003-build-libwebpmux.patch diff --git a/recipes/libwebp/all/patches/1.3.0-0001-fix-cmake.patch b/recipes/libwebp/all/patches/1.3.0-0001-fix-cmake.patch new file mode 100644 index 00000000000000..f9c41d4f6a5417 --- /dev/null +++ b/recipes/libwebp/all/patches/1.3.0-0001-fix-cmake.patch @@ -0,0 +1,21 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index 0a5af42..781f4c7 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -58,7 +58,6 @@ if(WEBP_LINK_STATIC) + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + endif() +- set(CMAKE_POSITION_INDEPENDENT_CODE ON) + # vwebp does not compile on Ubuntu with static libraries so disabling it for + # now. + set(WEBP_BUILD_VWEBP OFF) +@@ -142,7 +141,7 @@ endif() + set(PTHREAD_LIBS ${CMAKE_THREAD_LIBS_INIT}) + set(INSTALLED_LIBRARIES) + +-if(MSVC) ++if(0) + # match the naming convention used by nmake + set(webp_libname_prefix "lib") + set(CMAKE_SHARED_LIBRARY_PREFIX "${webp_libname_prefix}") diff --git a/recipes/libwebp/config.yml b/recipes/libwebp/config.yml index 2a1d6bc5117bc8..df097a6cc668fd 100644 --- a/recipes/libwebp/config.yml +++ b/recipes/libwebp/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.0": + folder: all "1.2.4": folder: all "1.2.3": diff --git a/recipes/libxlsxwriter/all/conandata.yml b/recipes/libxlsxwriter/all/conandata.yml index b6ef8ccb7684dc..44eb2bad3dada6 100644 --- a/recipes/libxlsxwriter/all/conandata.yml +++ b/recipes/libxlsxwriter/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.1.5": + url: "https://github.com/jmcnamara/libxlsxwriter/archive/RELEASE_1.1.5.tar.gz" + sha256: "12843587d591cf679e6ec63ecc629245befec2951736804a837696cdb5d61946" "1.1.4": url: "https://github.com/jmcnamara/libxlsxwriter/archive/RELEASE_1.1.4.tar.gz" sha256: "b379eb35fdd9c653ebe72485b9c992f612c7ea66f732784457997d6e782f619b" @@ -9,6 +12,11 @@ sources: url: "https://github.com/jmcnamara/libxlsxwriter/archive/RELEASE_1.0.0.tar.gz" sha256: "8b353379333c323d14a9d265cd2491d3a6c0032c8d6ec2141f10b82ab66a087c" patches: + "1.1.5": + - patch_file: "patches/1.1.5-0001-fix-cmake.patch" + patch_description: "Fix CMake: robust dependencies discovery & avoid some hardcoded flags" + patch_type: "conan" + sha256: "54bf92c1f9423d9c7b3820122ff806679e254392d66ae72696f58e7d36e4b16f" "1.1.4": - patch_file: "patches/1.1.3-0001-fix-cmake.patch" patch_description: "Fix CMake: robust dependencies discovery & avoid some hardcoded flags" diff --git a/recipes/libxlsxwriter/all/conanfile.py b/recipes/libxlsxwriter/all/conanfile.py index 467437938757a7..0d8e6136fd0e5e 100644 --- a/recipes/libxlsxwriter/all/conanfile.py +++ b/recipes/libxlsxwriter/all/conanfile.py @@ -6,7 +6,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class LibxlsxwriterConan(ConanFile): @@ -46,18 +46,9 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def layout(self): cmake_layout(self, src_folder="src") diff --git a/recipes/libxlsxwriter/all/patches/1.1.5-0001-fix-cmake.patch b/recipes/libxlsxwriter/all/patches/1.1.5-0001-fix-cmake.patch new file mode 100644 index 00000000000000..46175dd3778a65 --- /dev/null +++ b/recipes/libxlsxwriter/all/patches/1.1.5-0001-fix-cmake.patch @@ -0,0 +1,43 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e656184..b9002e7 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -178,9 +178,8 @@ endif() + + if(NOT BUILD_SHARED_LIBS) + if(UNIX) +- set(CMAKE_POSITION_INDEPENDENT_CODE ON) + elseif(MINGW OR MSYS) +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static -static-libgcc -Wno-char-subscripts -Wno-long-long") ++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-char-subscripts -Wno-long-long") + list(APPEND LXW_PRIVATE_COMPILE_DEFINITIONS USE_FILE32API) + elseif(MSVC) + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Fd\"${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pdb\"") +@@ -219,13 +218,13 @@ enable_language(CXX) + list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) + + # ZLIB +-find_package(ZLIB REQUIRED "1.0") ++find_package(ZLIB REQUIRED CONFIG) + list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}) + message("zlib version: " ${ZLIB_VERSION}) + + # MINIZIP + if (USE_SYSTEM_MINIZIP) +- find_package(MINIZIP REQUIRED "1.0") ++ find_package(MINIZIP REQUIRED CONFIG) + list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${MINIZIP_INCLUDE_DIRS}) + endif() + +@@ -281,7 +280,10 @@ target_sources(${PROJECT_NAME} + PRIVATE ${LXW_SOURCES} + PUBLIC ${LXW_HEADERS} + ) +-target_link_libraries(${PROJECT_NAME} LINK_PUBLIC ${ZLIB_LIBRARIES} ${MINIZIP_LIBRARIES} ${LIB_CRYPTO} ${OPENSSL_CRYPTO_LIBRARY}) ++target_link_libraries(${PROJECT_NAME} PRIVATE ZLIB::ZLIB minizip::minizip) ++if(USE_OPENSSL_MD5) ++ target_link_libraries(${PROJECT_NAME} PRIVATE OpenSSL::Crypto) ++endif() + target_compile_definitions(${PROJECT_NAME} PRIVATE ${LXW_PRIVATE_COMPILE_DEFINITIONS}) + + # /utf-8 needs VS2015 Update 2 or above. diff --git a/recipes/libxlsxwriter/config.yml b/recipes/libxlsxwriter/config.yml index 3e62b328f7fc78..4690b80fd5fb3a 100644 --- a/recipes/libxlsxwriter/config.yml +++ b/recipes/libxlsxwriter/config.yml @@ -1,4 +1,6 @@ versions: + "1.1.5": + folder: "all" "1.1.4": folder: "all" "1.1.3": diff --git a/recipes/libxml2/all/conanfile.py b/recipes/libxml2/all/conanfile.py index 135d4bdbf88af4..c0b5bbc7032aa8 100644 --- a/recipes/libxml2/all/conanfile.py +++ b/recipes/libxml2/all/conanfile.py @@ -63,8 +63,9 @@ class Libxml2Conan(ConanFile): options = {name: [True, False] for name in default_options.keys()} @property - def _option_names(self): - return [name for name in self.info.options.keys() if name not in ["shared", "fPIC", "include_utils"]] + def _configure_option_names(self): + return [name for name in self.default_options.keys() if (name in self.options) + and (name not in ["shared", "fPIC", "include_utils"])] @property def _settings_build(self): @@ -86,6 +87,9 @@ def configure(self): self.settings.rm_safe("compiler.libcxx") self.settings.rm_safe("compiler.cppstd") + def layout(self): + basic_layout(self, src_folder="src") + def requirements(self): if self.options.zlib: self.requires("zlib/1.2.13") @@ -94,10 +98,7 @@ def requirements(self): if self.options.iconv: self.requires("libiconv/1.17") if self.options.icu: - self.requires("icu/71.1") - - def layout(self): - basic_layout(self, src_folder="src") + self.requires("icu/72.1") def build_requirements(self): if not (is_msvc(self) or self._is_mingw_windows): @@ -139,7 +140,7 @@ def generate(self): f"--enable-shared={yes_no(self.options.shared)}", f"--enable-static={yes_no(not self.options.shared)}", ]) - for option_name in self._option_names: + for option_name in self._configure_option_names: option_value = getattr(self.options, option_name) tc.configure_args.append(f"--with-{option_name}={yes_no(option_value)}") @@ -151,7 +152,6 @@ def generate(self): tc = AutotoolsDeps(self) tc.generate() - def _build_msvc(self): with chdir(self, os.path.join(self.source_folder, 'win32')): debug = "yes" if self.settings.build_type == "Debug" else "no" @@ -172,7 +172,7 @@ def _build_msvc(self): args.append(f"include=\"{';'.join(incdirs)}\"") args.append(f"lib=\"{';'.join(libdirs)}\"") - for name in self._option_names: + for name in self._configure_option_names: cname = {"mem-debug": "mem_debug", "run-debug": "run_debug", "docbook": "docb"}.get(name, name) @@ -188,7 +188,8 @@ def _build_msvc(self): def fix_library(option, package, old_libname): if option: libs = [] - for lib in itertools.chain(self.dependencies[package].cpp_info.libs, self.dependencies[package].cpp_info.system_libs): + aggregated_cpp_info = self.dependencies[package].cpp_info.aggregated_components() + for lib in itertools.chain(aggregated_cpp_info.libs, aggregated_cpp_info.system_libs): libname = lib if not libname.endswith('.lib'): libname += '.lib' @@ -215,7 +216,6 @@ def _package_msvc(self): if self.options.include_utils: self.run("nmake /f Makefile.msvc install-dist") - def _build_mingw(self): with chdir(self, os.path.join(self.source_folder, "win32")): # configuration @@ -234,7 +234,7 @@ def _build_mingw(self): args.append(f"include=\"{' -I'.join(incdirs)}\"") args.append(f"lib=\"{' -L'.join(libdirs)}\"") - for name in self._option_names: + for name in self._configure_option_names: cname = { "mem-debug": "mem_debug", "run-debug": "run_debug", @@ -248,10 +248,11 @@ def _build_mingw(self): # build def fix_library(option, package, old_libname): if option: + aggregated_cpp_info = self.dependencies[package].cpp_info.aggregated_components() replace_in_file(self, "Makefile.mingw", f"LIBS += -l{old_libname}", - f"LIBS += -l{' -l'.join(self.dependencies[package].cpp_info.libs)}", + f"LIBS += -l{' -l'.join(aggregated_cpp_info.libs)}", ) fix_library(self.options.iconv, "libiconv", "iconv") @@ -269,7 +270,6 @@ def _package_mingw(self): if self.options.include_utils: self.run("mingw32-make -f Makefile.mingw install-dist") - def _patch_sources(self): # Break dependency of install on build for makefile in ("Makefile.mingw", "Makefile.msvc"): @@ -281,7 +281,6 @@ def _patch_sources(self): "-install_name \\$rpath/", "-install_name @rpath/") - def build(self): self._patch_sources() if is_msvc(self): @@ -345,22 +344,31 @@ def package(self): def _create_cmake_module_variables(self, module_file): # FIXME: also define LIBXML2_XMLLINT_EXECUTABLE variable content = textwrap.dedent("""\ - if(DEFINED LibXml2_FOUND) - set(LIBXML2_FOUND ${LibXml2_FOUND}) - endif() - if(DEFINED LibXml2_INCLUDE_DIR) - set(LIBXML2_INCLUDE_DIR ${LibXml2_INCLUDE_DIR}) - set(LIBXML2_INCLUDE_DIRS ${LibXml2_INCLUDE_DIR}) + set(LibXml2_FOUND TRUE) + set(LIBXML2_FOUND TRUE) + if(DEFINED LibXml2_INCLUDE_DIRS) + set(LIBXML2_INCLUDE_DIR ${LibXml2_INCLUDE_DIRS}) + set(LIBXML2_INCLUDE_DIRS ${LibXml2_INCLUDE_DIRS}) + elseif(DEFINED libxml2_INCLUDE_DIRS) + set(LIBXML2_LIBRARIES ${libxml2_INCLUDE_DIRS}) + set(LIBXML2_LIBRARY ${libxml2_INCLUDE_DIRS}) endif() if(DEFINED LibXml2_LIBRARIES) set(LIBXML2_LIBRARIES ${LibXml2_LIBRARIES}) set(LIBXML2_LIBRARY ${LibXml2_LIBRARIES}) + elseif(DEFINED libxml2_LIBRARIES) + set(LIBXML2_LIBRARIES ${libxml2_LIBRARIES}) + set(LIBXML2_LIBRARY ${libxml2_LIBRARIES}) endif() if(DEFINED LibXml2_DEFINITIONS) set(LIBXML2_DEFINITIONS ${LibXml2_DEFINITIONS}) + elseif(DEFINED libxml2_DEFINITIONS) + set(LIBXML2_DEFINITIONS ${libxml2_DEFINITIONS}) endif() if(DEFINED LibXml2_VERSION) set(LIBXML2_VERSION_STRING ${LibXml2_VERSION}) + elseif(DEFINED libxml2_VERSION) + set(LIBXML2_VERSION_STRING ${libxml2_VERSION}) endif() """) save(self, module_file, content) diff --git a/recipes/libxml2/all/test_cmake_module_package/CMakeLists.txt b/recipes/libxml2/all/test_cmake_module_package/CMakeLists.txt index 39f1f2e09e014b..90d37ee9afb23e 100644 --- a/recipes/libxml2/all/test_cmake_module_package/CMakeLists.txt +++ b/recipes/libxml2/all/test_cmake_module_package/CMakeLists.txt @@ -1,15 +1,26 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package C) +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES C) -find_package(LibXml2 REQUIRED) - -message("LIBXML2_FOUND: ${LIBXML2_FOUND}") -message("LIBXML2_INCLUDE_DIR: ${LIBXML2_INCLUDE_DIR}") -message("LIBXML2_INCLUDE_DIRS: ${LIBXML2_INCLUDE_DIRS}") -message("LIBXML2_LIBRARIES: ${LIBXML2_LIBRARIES}") -message("LIBXML2_LIBRARY: ${LIBXML2_LIBRARY}") -message("LIBXML2_DEFINITIONS: ${LIBXML2_DEFINITIONS}") -message("LIBXML2_VERSION_STRING: ${LIBXML2_VERSION_STRING}") +find_package(LibXml2 REQUIRED MODULE) add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} LibXml2::LibXml2) +target_link_libraries(${PROJECT_NAME} PRIVATE LibXml2::LibXml2) + +# Test whether variables from https://cmake.org/cmake/help/latest/module/FindLibXml2.html +# are properly defined in conan generators +set(_custom_vars + LibXml2_FOUND # since CMake 3.14 + LIBXML2_FOUND # until CMake 3.14 + LIBXML2_INCLUDE_DIR + LIBXML2_INCLUDE_DIRS + LIBXML2_LIBRARIES + LIBXML2_DEFINITIONS + LIBXML2_VERSION_STRING +) +foreach(_custom_var ${_custom_vars}) + if(DEFINED _custom_var) + message(STATUS "${_custom_var}: ${${_custom_var}}") + else() + message(FATAL_ERROR "${_custom_var} not defined") + endif() +endforeach() diff --git a/recipes/libxml2/all/test_cmake_module_package/conanfile.py b/recipes/libxml2/all/test_cmake_module_package/conanfile.py index 3eab19928545d3..20481a742d6149 100644 --- a/recipes/libxml2/all/test_cmake_module_package/conanfile.py +++ b/recipes/libxml2/all/test_cmake_module_package/conanfile.py @@ -23,5 +23,5 @@ def build(self): def test(self): if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") - xml_path = os.path.join(self.source_folder, "..", "test_package", "books.xml") + xml_path = os.path.join(self.source_folder, os.pardir, "test_package", "books.xml") self.run(f"{bin_path} {xml_path}", env="conanrun") diff --git a/recipes/libxml2/all/test_package/CMakeLists.txt b/recipes/libxml2/all/test_package/CMakeLists.txt index 60662e900b4c8a..9d8bc300051af7 100644 --- a/recipes/libxml2/all/test_package/CMakeLists.txt +++ b/recipes/libxml2/all/test_package/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -find_package(libxml2 CONFIG REQUIRED) +find_package(libxml2 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} LibXml2::LibXml2) +target_link_libraries(${PROJECT_NAME} PRIVATE LibXml2::LibXml2) diff --git a/recipes/libxml2/all/test_v1_cmake_module_package/CMakeLists.txt b/recipes/libxml2/all/test_v1_cmake_module_package/CMakeLists.txt index 487747f324c50d..1de7a7ee473fdc 100644 --- a/recipes/libxml2/all/test_v1_cmake_module_package/CMakeLists.txt +++ b/recipes/libxml2/all/test_v1_cmake_module_package/CMakeLists.txt @@ -1,18 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(LibXml2 REQUIRED) - -message("LIBXML2_FOUND: ${LIBXML2_FOUND}") -message("LIBXML2_INCLUDE_DIR: ${LIBXML2_INCLUDE_DIR}") -message("LIBXML2_INCLUDE_DIRS: ${LIBXML2_INCLUDE_DIRS}") -message("LIBXML2_LIBRARIES: ${LIBXML2_LIBRARIES}") -message("LIBXML2_LIBRARY: ${LIBXML2_LIBRARY}") -message("LIBXML2_DEFINITIONS: ${LIBXML2_DEFINITIONS}") -message("LIBXML2_VERSION_STRING: ${LIBXML2_VERSION_STRING}") - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} LibXml2::LibXml2) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_cmake_module_package + ${CMAKE_CURRENT_BINARY_DIR}/test_cmake_module_package) diff --git a/recipes/libxml2/all/test_v1_cmake_module_package/conanfile.py b/recipes/libxml2/all/test_v1_cmake_module_package/conanfile.py index 3bec0de0bab22b..ca3b4e232a4f3b 100644 --- a/recipes/libxml2/all/test_v1_cmake_module_package/conanfile.py +++ b/recipes/libxml2/all/test_v1_cmake_module_package/conanfile.py @@ -14,6 +14,5 @@ def build(self): def test(self): if not tools.cross_building(self): bin_path = os.path.join("bin", "test_package") - xml_path = os.path.join(self.source_folder, "..", "test_package", "books.xml") - bin_arg_path = "%s %s" % (bin_path, xml_path) - self.run(bin_arg_path, run_environment=True) + xml_path = os.path.join(self.source_folder, os.pardir, "test_package", "books.xml") + self.run(f"{bin_path} {xml_path}", run_environment=True) diff --git a/recipes/libxml2/all/test_v1_package/CMakeLists.txt b/recipes/libxml2/all/test_v1_package/CMakeLists.txt index ea045cdb5efca4..0d20897301b68b 100644 --- a/recipes/libxml2/all/test_v1_package/CMakeLists.txt +++ b/recipes/libxml2/all/test_v1_package/CMakeLists.txt @@ -1,17 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(LibXml2 REQUIRED) -message("LIBXML2_FOUND: ${LIBXML2_FOUND}") -message("LIBXML2_INCLUDE_DIR: ${LIBXML2_INCLUDE_DIR}") -message("LIBXML2_INCLUDE_DIRS: ${LIBXML2_INCLUDE_DIRS}") -message("LIBXML2_LIBRARIES: ${LIBXML2_LIBRARIES}") -message("LIBXML2_LIBRARY: ${LIBXML2_LIBRARY}") -message("LIBXML2_DEFINITIONS: ${LIBXML2_DEFINITIONS}") -message("LIBXML2_VERSION_STRING: ${LIBXML2_VERSION_STRING}") - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} LibXml2::LibXml2) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libxml2/all/test_v1_package/conanfile.py b/recipes/libxml2/all/test_v1_package/conanfile.py index 3bec0de0bab22b..ae0f76f08489bc 100644 --- a/recipes/libxml2/all/test_v1_package/conanfile.py +++ b/recipes/libxml2/all/test_v1_package/conanfile.py @@ -3,8 +3,8 @@ class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" def build(self): cmake = CMake(self) @@ -14,6 +14,5 @@ def build(self): def test(self): if not tools.cross_building(self): bin_path = os.path.join("bin", "test_package") - xml_path = os.path.join(self.source_folder, "..", "test_package", "books.xml") - bin_arg_path = "%s %s" % (bin_path, xml_path) - self.run(bin_arg_path, run_environment=True) + xml_path = os.path.join(self.source_folder, os.pardir, "test_package", "books.xml") + self.run(f"{bin_path} {xml_path}", run_environment=True) diff --git a/recipes/libxshmfence/all/conanfile.py b/recipes/libxshmfence/all/conanfile.py index a4136cd3cae484..abd496668a102b 100644 --- a/recipes/libxshmfence/all/conanfile.py +++ b/recipes/libxshmfence/all/conanfile.py @@ -1,9 +1,11 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, rm, rmdir +from conans import tools, AutoToolsBuildEnvironment import contextlib import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class LibxshmfenceConan(ConanFile): name = "libxshmfence" @@ -38,31 +40,35 @@ def _settings_build(self): def _user_info_build(self): return getattr(self, "user_info_build", self.deps_user_info) + def export_sources(self): + export_conandata_patches(self) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - + def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + # for plain C projects only + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def validate(self): if self.settings.os == "Windows": raise ConanInvalidConfiguration("Windows is not supported by libxshmfence recipe. Contributions are welcome") def build_requirements(self): - self.build_requires("automake/1.16.4") - self.build_requires("pkgconf/1.7.4") + self.build_requires("automake/1.16.5") + self.build_requires("pkgconf/1.9.3") if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): self.build_requires("msys2/cci.latest") def requirements(self): - self.requires("xorg-proto/2021.4") + self.requires("xorg-proto/2022.2") def source(self): - tools.get(**self.conan_data["sources"][self.version], + get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) @contextlib.contextmanager @@ -91,8 +97,7 @@ def _configure_autotools(self): return self._autotools def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) with self._build_context(): autotools = self._configure_autotools() autotools.make() @@ -102,9 +107,10 @@ def package(self): with self._build_context(): autotools = self._configure_autotools() autotools.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) def package_info(self): self.cpp_info.libs = ["xshmfence"] self.cpp_info.names["pkg_config"] = "xshmfence" + self.cpp_info.set_property("pkg_config_name", "xshmfence") diff --git a/recipes/libyuv/all/conandata.yml b/recipes/libyuv/all/conandata.yml index 0096cb0d06e2fb..e839599c0c5fc3 100644 --- a/recipes/libyuv/all/conandata.yml +++ b/recipes/libyuv/all/conandata.yml @@ -1,6 +1,8 @@ # Versions from LIBYUV_VERSION definition in include/libyuv/version.h # Pay attention to package commits incrementing this definition sources: + "1854": + url: "https://chromium.googlesource.com/libyuv/libyuv/+archive/3abd6f36b6e4f5a2e0ce236580a8bc1da3c7cf7e.tar.gz" "1845": url: "https://chromium.googlesource.com/libyuv/libyuv/+archive/b9adaef1133ee835efc8970d1dcdcf23a5b68eba.tar.gz" "1841": @@ -8,15 +10,19 @@ sources: "1768": url: "https://chromium.googlesource.com/libyuv/libyuv/+archive/dfaf7534e0e536f7e5ef8ddd7326797bd09b8622.tar.gz" patches: + "1854": + - patch_file: "patches/1854-0001-fix-cmake.patch" + patch_description: "Fix CMake to be more robust & predictable" + patch_type: "conan" "1845": - - patch_file: "patches/0001-fix-cmake-1841.patch" + - patch_file: "patches/1841-0001-fix-cmake.patch" patch_description: "Fix CMake to be more robust & predictable" - patch_type: "compatibility" + patch_type: "conan" "1841": - - patch_file: "patches/0001-fix-cmake-1841.patch" + - patch_file: "patches/1841-0001-fix-cmake.patch" patch_description: "Fix CMake to be more robust & predictable" - patch_type: "compatibility" + patch_type: "conan" "1768": - - patch_file: "patches/0001-fix-cmake-1768.patch" + - patch_file: "patches/1768-0001-fix-cmake.patch" patch_description: "Fix CMake to be more robust & predictable" - patch_type: "compatibility" + patch_type: "conan" diff --git a/recipes/libyuv/all/conanfile.py b/recipes/libyuv/all/conanfile.py index 3c7a9857e98ba6..7e0ba399e3d6e1 100644 --- a/recipes/libyuv/all/conanfile.py +++ b/recipes/libyuv/all/conanfile.py @@ -1,10 +1,9 @@ from conan import ConanFile -from conan.errors import ConanInvalidConfiguration from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class LibyuvConan(ConanFile): @@ -19,7 +18,7 @@ class LibyuvConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], - "with_jpeg": [False, "libjpeg", "libjpeg-turbo"], + "with_jpeg": [False, "libjpeg", "libjpeg-turbo", "mozjpeg"], } default_options = { "shared": False, @@ -36,10 +35,7 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") @@ -48,13 +44,9 @@ def requirements(self): if self.options.with_jpeg == "libjpeg": self.requires("libjpeg/9e") elif self.options.with_jpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.0.5") - - def validate(self): - if self.info.options.with_jpeg == "libjpeg-turbo": - raise ConanInvalidConfiguration( - "libjpeg-turbo is an invalid option right now, as it is not supported by the cmake script.", - ) + self.requires("libjpeg-turbo/2.1.4") + elif self.options.with_jpeg == "mozjpeg": + self.requires("mozjpeg/4.1.1") def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder) @@ -80,8 +72,13 @@ def package(self): def package_info(self): self.cpp_info.libs = ["yuv"] + self.cpp_info.requires = [] + if self.options.with_jpeg == "libjpeg": + self.cpp_info.requires.append("libjpeg::libjpeg") + elif self.options.with_jpeg == "libjpeg-turbo": + self.cpp_info.requires.append("libjpeg-turbo::jpeg") + elif self.options.with_jpeg == "mozjpeg": + self.cpp_info.requires.append("mozjpeg::libjpeg") # TODO: to remove in conan v2 - bin_path = os.path.join(self.package_folder, "bin") - self.output.info(f"Appending PATH environment variable: {bin_path}") - self.env_info.PATH.append(bin_path) + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/libyuv/all/patches/0001-fix-cmake-1768.patch b/recipes/libyuv/all/patches/1768-0001-fix-cmake.patch similarity index 100% rename from recipes/libyuv/all/patches/0001-fix-cmake-1768.patch rename to recipes/libyuv/all/patches/1768-0001-fix-cmake.patch diff --git a/recipes/libyuv/all/patches/0001-fix-cmake-1841.patch b/recipes/libyuv/all/patches/1841-0001-fix-cmake.patch similarity index 100% rename from recipes/libyuv/all/patches/0001-fix-cmake-1841.patch rename to recipes/libyuv/all/patches/1841-0001-fix-cmake.patch diff --git a/recipes/libyuv/all/patches/1854-0001-fix-cmake.patch b/recipes/libyuv/all/patches/1854-0001-fix-cmake.patch new file mode 100644 index 00000000000000..1a2b79c67847ce --- /dev/null +++ b/recipes/libyuv/all/patches/1854-0001-fix-cmake.patch @@ -0,0 +1,69 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -2,8 +2,8 @@ + # Originally created for "roxlu build system" to compile libyuv on windows + # Run with -DTEST=ON to build unit tests + ++CMAKE_MINIMUM_REQUIRED( VERSION 3.8 ) + PROJECT ( YUV C CXX ) # "C" is required even for C++ projects +-CMAKE_MINIMUM_REQUIRED( VERSION 2.8.12 ) + OPTION( TEST "Built unit tests" OFF ) + + SET ( ly_base_dir ${PROJECT_SOURCE_DIR} ) +@@ -27,15 +27,11 @@ if(MSVC) + endif() + + # this creates the static library (.a) +-ADD_LIBRARY ( ${ly_lib_static} STATIC ${ly_source_files} ) ++ADD_LIBRARY ( ${ly_lib_static} ${ly_source_files} ) ++target_compile_features(${ly_lib_static} PUBLIC cxx_std_11) ++set_target_properties(${ly_lib_static} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) + + # this creates the shared library (.so) +-ADD_LIBRARY ( ${ly_lib_shared} SHARED ${ly_source_files} ) +-SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES OUTPUT_NAME "${ly_lib_name}" ) +-SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES PREFIX "lib" ) +-if(WIN32) +- SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES IMPORT_PREFIX "lib" ) +-endif() + + # this creates the conversion tool + ADD_EXECUTABLE ( yuvconvert ${ly_base_dir}/util/yuvconvert.cc ) +@@ -44,12 +40,18 @@ TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_static} ) + # this creates the yuvconstants tool + ADD_EXECUTABLE ( yuvconstants ${ly_base_dir}/util/yuvconstants.c ) + TARGET_LINK_LIBRARIES ( yuvconstants ${ly_lib_static} ) ++include(CheckFunctionExists) ++check_function_exists(round HAVE_MATH_SYSTEM) ++if(NOT HAVE_MATH_SYSTEM) ++ target_link_libraries(yuvconstants m) ++endif() + +-find_package ( JPEG ) +-if (JPEG_FOUND) +- include_directories( ${JPEG_INCLUDE_DIR} ) +- target_link_libraries( ${ly_lib_shared} ${JPEG_LIBRARY} ) +- add_definitions( -DHAVE_JPEG ) ++option(LIBYUV_WITH_JPEG "Build libyuv with jpeg" ON) ++if (LIBYUV_WITH_JPEG) ++ find_package(JPEG REQUIRED) ++ target_link_libraries(${ly_lib_static} JPEG::JPEG ) ++ target_compile_definitions(${ly_lib_static} PRIVATE HAVE_JPEG) ++ target_compile_definitions(yuvconvert PRIVATE HAVE_JPEG) + endif() + + if(TEST) +@@ -91,11 +93,9 @@ endif() + + + # install the conversion tool, .so, .a, and all the header files +-INSTALL ( PROGRAMS ${CMAKE_BINARY_DIR}/yuvconvert DESTINATION bin ) +-INSTALL ( TARGETS ${ly_lib_static} DESTINATION lib ) +-INSTALL ( TARGETS ${ly_lib_shared} LIBRARY DESTINATION lib RUNTIME DESTINATION bin ) ++INSTALL ( TARGETS yuvconvert yuvconstants DESTINATION bin) ++INSTALL ( TARGETS ${ly_lib_static} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) + INSTALL ( DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include ) + + # create the .deb and .rpm packages using cpack +-INCLUDE ( CM_linux_packages.cmake ) + diff --git a/recipes/libyuv/all/test_v1_package/CMakeLists.txt b/recipes/libyuv/all/test_v1_package/CMakeLists.txt index a044d49d31fdef..0d20897301b68b 100644 --- a/recipes/libyuv/all/test_v1_package/CMakeLists.txt +++ b/recipes/libyuv/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(libyuv REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE libyuv::libyuv) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libyuv/config.yml b/recipes/libyuv/config.yml index 336e0262a0b451..c1f0cfd37130fd 100644 --- a/recipes/libyuv/config.yml +++ b/recipes/libyuv/config.yml @@ -1,4 +1,6 @@ versions: + "1854": + folder: all "1845": folder: all "1841": diff --git a/recipes/libzip/all/conandata.yml b/recipes/libzip/all/conandata.yml index 914eae250b9a59..567f243d79a980 100644 --- a/recipes/libzip/all/conandata.yml +++ b/recipes/libzip/all/conandata.yml @@ -1,11 +1,25 @@ sources: + "1.9.2": + url: [ + "https://libzip.org/download/libzip-1.9.2.tar.gz", + "https://github.com/nih-at/libzip/releases/download/v1.9.2/libzip-1.9.2.tar.gz", + ] + sha256: "fd6a7f745de3d69cf5603edc9cb33d2890f0198e415255d0987a0cf10d824c6f" "1.8.0": - url: "https://libzip.org/download/libzip-1.8.0.tar.gz" + url: [ + "https://libzip.org/download/libzip-1.8.0.tar.gz", + "https://github.com/nih-at/libzip/releases/download/v1.8.0/libzip-1.8.0.tar.gz", + ] sha256: "30ee55868c0a698d3c600492f2bea4eb62c53849bcf696d21af5eb65f3f3839e" "1.7.3": - url: "https://libzip.org/download/libzip-1.7.3.tar.gz" + url: [ + "https://libzip.org/download/libzip-1.7.3.tar.gz", + "https://github.com/nih-at/libzip/releases/download/v1.7.3/libzip-1.7.3.tar.gz", + ] sha256: "0e2276c550c5a310d4ebf3a2c3dfc43fb3b4602a072ff625842ad4f3238cb9cc" patches: + "1.9.2": + - patch_file: "patches/0001-cmake-install-bundle.patch" "1.8.0": - patch_file: "patches/0001-cmake-install-bundle.patch" "1.7.3": diff --git a/recipes/libzip/all/conanfile.py b/recipes/libzip/all/conanfile.py index 751e5721f786d9..aa51f4e16ed75a 100644 --- a/recipes/libzip/all/conanfile.py +++ b/recipes/libzip/all/conanfile.py @@ -114,8 +114,13 @@ def _patch_sources(self): top_cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") # Honor zstd enabled if self._has_zstd_support: + def zstd_find_package_pattern(version): + if version >= "1.9.2": + return "find_package(Zstd 1.3.6)" + else: + return "find_package(Zstd)" lib_cmakelists = os.path.join(self.source_folder, "lib", "CMakeLists.txt") - replace_in_file(self, top_cmakelists, "find_package(Zstd)", "find_package(zstd)") + replace_in_file(self, top_cmakelists, zstd_find_package_pattern(Version(self.version)), "find_package(zstd)") replace_in_file(self, top_cmakelists, "Zstd_FOUND", "zstd_FOUND") replace_in_file( self, diff --git a/recipes/libzip/config.yml b/recipes/libzip/config.yml index 46f6fe51385c71..63ddbcf63ff111 100644 --- a/recipes/libzip/config.yml +++ b/recipes/libzip/config.yml @@ -1,4 +1,6 @@ versions: + "1.9.2": + folder: all "1.8.0": folder: all "1.7.3": diff --git a/recipes/libzippp/all/conandata.yml b/recipes/libzippp/all/conandata.yml index 49a240e225faf8..f31401deb346d5 100644 --- a/recipes/libzippp/all/conandata.yml +++ b/recipes/libzippp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "6.0-1.9.2": + url: "https://github.com/ctabin/libzippp/archive/libzippp-v6.0-1.9.2.tar.gz" + sha256: "f9aef9811802a18e69cd50527381d70c2e0f0d8a839f1d41914f6234f5964fc3" "5.0-1.8.0": url: "https://github.com/ctabin/libzippp/archive/libzippp-v5.0-1.8.0.tar.gz" sha256: "b70f2d0f64eb68b00a16290bac40ac1a3fd3d2896cfddc93e370a7fa28c591c5" diff --git a/recipes/libzippp/all/conanfile.py b/recipes/libzippp/all/conanfile.py index fa1cfae1a117c0..b05dfec2510118 100644 --- a/recipes/libzippp/all/conanfile.py +++ b/recipes/libzippp/all/conanfile.py @@ -1,33 +1,35 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy, rmdir, replace_in_file +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.53.0" class LibZipppConan(ConanFile): name = "libzippp" description = "A simple basic C++ wrapper around the libzip library" + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ctabin/libzippp" - license = "BSD-3-Clause" - topics = ("zip", "libzippp", "zip-archives", "zip-editing") - exports_sources = ["CMakeLists.txt"] - generators = "cmake", "cmake_find_package_multi" - settings = "os", "compiler", "build_type", "arch" + topics = ("zip", "zlib", "libzip", "zip-archives", "zip-editing") + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "with_encryption": [True, False] + "with_encryption": [True, False], } default_options = { "shared": False, "fPIC": True, - "with_encryption": False + "with_encryption": False, } - _cmake = None @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 def config_options(self): if self.settings.os == "Windows": @@ -35,54 +37,72 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - def validate(self): - libzippp_version = str(self.version) - if libzippp_version != "4.0" and len(libzippp_version.split("-")) != 2: - raise tools.ConanInvalidConfiguration("{}: version number must include '-'. (ex. '5.0-1.8.0')".format(self.name)) + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.11") - if tools.Version(self.version) == "4.0": + self.requires("zlib/1.2.13") + if Version(self.version) == "4.0": self.requires("libzip/1.7.3") else: - libzip_version = str(self.version).split("-")[1] - self.requires("libzip/{}".format(libzip_version)) + versions = str(self.version).split("-") + if len(versions) == 2: + self.requires(f"libzip/{versions[1]}") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + + libzippp_version = str(self.version) + if libzippp_version != "4.0" and len(libzippp_version.split("-")) != 2: + raise ConanInvalidConfiguration(f"{self.ref}: version number must include '-'. (ex. '5.0-1.8.0')") + + if self.settings.compiler == "clang" and self.settings.compiler.get_safe("libcxx") == "libc++": + raise ConanInvalidConfiguration(f"{self.ref} does not support clang with libc++. Use libstdc++ instead.") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["LIBZIPPP_INSTALL"] = True - self._cmake.definitions["LIBZIPPP_INSTALL_HEADERS"] = True - self._cmake.definitions["LIBZIPPP_ENABLE_ENCRYPTION"] = self.options.with_encryption - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_CXX_STANDARD"] = 11 + tc.variables["LIBZIPPP_INSTALL"] = True + tc.variables["LIBZIPPP_INSTALL_HEADERS"] = True + tc.variables["LIBZIPPP_ENABLE_ENCRYPTION"] = self.options.with_encryption + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def _patch_source(self): - tools.replace_in_file('source_subfolder/CMakeLists.txt', - 'find_package(LIBZIP MODULE REQUIRED)', - 'find_package(libzip REQUIRED CONFIG)') + replace_in_file(self, os.path.join(self.source_folder, 'CMakeLists.txt'), + 'find_package(LIBZIP MODULE REQUIRED)', + 'find_package(libzip REQUIRED CONFIG)') def build(self): self._patch_source() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, pattern="LICENCE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - self.copy(pattern="LICENCE", dst="licenses", src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "cmake")) + + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "cmake")) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + prefix = "lib" if self.settings.os == "Windows" else "" + postfix = "" if self.options.shared else "_static" + self.cpp_info.libs = [f"{prefix}zippp{postfix}"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.names["cmake_find_package"] = "libzippp" self.cpp_info.names["cmake_find_package_multi"] = "libzippp" self.cpp_info.set_property("cmake_file_name", "libzippp") diff --git a/recipes/libzippp/all/test_package/CMakeLists.txt b/recipes/libzippp/all/test_package/CMakeLists.txt index 148357d043ba66..5514f16e5d6bbb 100644 --- a/recipes/libzippp/all/test_package/CMakeLists.txt +++ b/recipes/libzippp/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(libzippp REQUIRED) +find_package(libzippp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} libzippp::libzippp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE libzippp::libzippp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/libzippp/all/test_package/conanfile.py b/recipes/libzippp/all/test_package/conanfile.py index 3da371b660e0a3..a9fb96656f2039 100644 --- a/recipes/libzippp/all/test_package/conanfile.py +++ b/recipes/libzippp/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libzippp/all/test_v1_package/CMakeLists.txt b/recipes/libzippp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/libzippp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libzippp/all/test_v1_package/conanfile.py b/recipes/libzippp/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/libzippp/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libzippp/config.yml b/recipes/libzippp/config.yml index a529e567c09754..4ba054a3032a99 100644 --- a/recipes/libzippp/config.yml +++ b/recipes/libzippp/config.yml @@ -1,4 +1,6 @@ versions: + "6.0-1.9.2": + folder: all "5.0-1.8.0": folder: all "4.0": diff --git a/recipes/lief/all/conanfile.py b/recipes/lief/all/conanfile.py index eed55b5ff591b7..4a9cf2b5cd9723 100644 --- a/recipes/lief/all/conanfile.py +++ b/recipes/lief/all/conanfile.py @@ -8,7 +8,7 @@ import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class LiefConan(ConanFile): name = "lief" @@ -60,10 +60,7 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def validate(self): if self.info.settings.compiler.cppstd: @@ -82,13 +79,6 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("rang/3.2") - self.requires("mbedtls/3.2.1") - if self.options.with_json: - self.requires("nlohmann_json/3.11.2") - if self.options.with_frozen: - self.requires("frozen/1.1.1") - if Version(self.version) < "0.12.2": self.requires("rang/3.2") self.requires("mbedtls/3.2.1") @@ -97,9 +87,10 @@ def requirements(self): if self.options.with_frozen: self.requires("frozen/1.1.1") if Version(self.version) >= "0.12.2": - self.requires("utfcpp/3.2.1") + self.requires("utfcpp/3.2.2") + # lief doesn't supprot spdlog/1.11.0 with fmt/9.x yet. self.requires("spdlog/1.10.0") - self.requires("boost/1.80.0") + self.requires("boost/1.81.0") self.requires("tcb-span/cci.20220616") def source(self): diff --git a/recipes/lief/all/test_v1_package/CMakeLists.txt b/recipes/lief/all/test_v1_package/CMakeLists.txt index 6b1097615e03a8..9d54a092e0a67e 100644 --- a/recipes/lief/all/test_v1_package/CMakeLists.txt +++ b/recipes/lief/all/test_v1_package/CMakeLists.txt @@ -4,11 +4,5 @@ project(test_package LANGUAGES CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(LIEF REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE LIEF::LIEF) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) - -# It is required for gcc 5 -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/linmath.h/all/conandata.yml b/recipes/linmath.h/all/conandata.yml new file mode 100644 index 00000000000000..c521734fe3fb83 --- /dev/null +++ b/recipes/linmath.h/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20220619": + url: "https://github.com/datenwolf/linmath.h/archive/3eef82841046507e16a0f6194a61cee2eadd34b3.tar.gz" + sha256: "786c3f9c5e415cc1607d377242759eca736ea1002dcf6312a7f6ae08bc3d6e87" diff --git a/recipes/linmath.h/all/conanfile.py b/recipes/linmath.h/all/conanfile.py new file mode 100644 index 00000000000000..72dbc48e507a80 --- /dev/null +++ b/recipes/linmath.h/all/conanfile.py @@ -0,0 +1,41 @@ +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.50.0" + + +class LinmathConan(ConanFile): + name = "linmath.h" + description = ( + "A lean linear math library, aimed at graphics programming. Supports " + "vec3, vec4, mat4x4 and quaternions" + ) + license = "WTFPL" + topics = ("math", "graphics", "linear-algebra", "vector", "matrix", "quaternion") + homepage = "https://github.com/datenwolf/linmath.h" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + def package_id(self): + self.info.clear() + + def layout(self): + basic_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass + + def package(self): + copy(self, "LICENCE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "linmath.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/linmath.h/all/test_package/CMakeLists.txt b/recipes/linmath.h/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..5ff54df0112b28 --- /dev/null +++ b/recipes/linmath.h/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(linmath.h REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE linmath.h::linmath.h) diff --git a/recipes/linmath.h/all/test_package/conanfile.py b/recipes/linmath.h/all/test_package/conanfile.py new file mode 100644 index 00000000000000..0a6bc68712d901 --- /dev/null +++ b/recipes/linmath.h/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/linmath.h/all/test_package/test_package.c b/recipes/linmath.h/all/test_package/test_package.c new file mode 100644 index 00000000000000..1f59cf9ccad914 --- /dev/null +++ b/recipes/linmath.h/all/test_package/test_package.c @@ -0,0 +1,8 @@ +#include + +int main() +{ + quat q; + quat_identity(q); + return 0; +} diff --git a/recipes/linmath.h/all/test_v1_package/CMakeLists.txt b/recipes/linmath.h/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/linmath.h/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/linmath.h/all/test_v1_package/conanfile.py b/recipes/linmath.h/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/linmath.h/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/linmath.h/config.yml b/recipes/linmath.h/config.yml new file mode 100644 index 00000000000000..5d463c9509aed4 --- /dev/null +++ b/recipes/linmath.h/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20220619": + folder: all diff --git a/recipes/llvm-core/all/CMakeLists.txt b/recipes/llvm-core/all/CMakeLists.txt index 22006c4e484203..e88dcfa9534958 100644 --- a/recipes/llvm-core/all/CMakeLists.txt +++ b/recipes/llvm-core/all/CMakeLists.txt @@ -12,11 +12,14 @@ if(LLVM_ENABLE_ZLIB) list(GET ZLIB_LIBRARIES 0 ZLIB_LIBRARY) set_property(TARGET ZLIB::ZLIB PROPERTY LOCATION "${ZLIB_LIBRARY}") + # Additionally LLVM 11.1.0 requires the zlib lib dir to be in the library path. + # This is not needed for later versions and can be removed once + # LLVM-12 becomes the oldest supported version. if(UNIX) - # Additionally LLVM 11.1.0 requires the zlib lib dir to be in the library path. - # This is not needed for later versions and can be removed once - # LLVM-12 becomes the oldest supported version. set(ENV{LIBRARY_PATH} "${CONAN_LIB_DIRS_ZLIB}:$ENV{LIBRARY_PATH}") + elseif(WIN32) + file(TO_NATIVE_PATH "${CONAN_LIB_DIRS_ZLIB}" WINDOWS_ZLIB_PATH) + string(APPEND CMAKE_EXE_LINKER_FLAGS " /LIBPATH:${WINDOWS_ZLIB_PATH}") endif() endif() diff --git a/recipes/llvm-core/all/conanfile.py b/recipes/llvm-core/all/conanfile.py index 4e58bd0cf9c4d4..263cb7360506ca 100644 --- a/recipes/llvm-core/all/conanfile.py +++ b/recipes/llvm-core/all/conanfile.py @@ -196,7 +196,6 @@ def export_sources(self): def config_options(self): if self.settings.os == 'Windows': del self.options.fPIC - del self.options.with_zlib del self.options.with_xml2 def requirements(self): diff --git a/recipes/luajit/all/conandata.yml b/recipes/luajit/all/conandata.yml index b066a8d0de9646..1e7abff8db36b0 100644 --- a/recipes/luajit/all/conandata.yml +++ b/recipes/luajit/all/conandata.yml @@ -1,4 +1,12 @@ sources: + "2.1.0-beta3": + url: "https://luajit.org/download/LuaJIT-2.1.0-beta3.tar.gz" + sha256: "1ad2e34b111c802f9d0cdf019e986909123237a28c746b21295b63c9e785d9c3" "2.0.5": url: "http://luajit.org/download/LuaJIT-2.0.5.tar.gz" sha256: "874b1f8297c697821f561f9b73b57ffd419ed8f4278c82e05b48806d30c1e979" +patches: + "2.1.0-beta3": + - patch_file: "patches/2.1.0-beta3-0001-remove-mac-deploy.patch" + patch_type: "conan" + patch_description: "Do not enforce default value for MACOSX_DEPLOYMENT_TARGET" diff --git a/recipes/luajit/all/conanfile.py b/recipes/luajit/all/conanfile.py index 7d70d0b565c900..5271897d749e21 100644 --- a/recipes/luajit/all/conanfile.py +++ b/recipes/luajit/all/conanfile.py @@ -1,6 +1,16 @@ +from conan import ConanFile +from conan.tools.scm import Version +from conan.tools.files import get, chdir, replace_in_file, copy, rmdir, export_conandata_patches, apply_conandata_patches +from conan.tools.microsoft import is_msvc, MSBuildToolchain, VCVars, unix_path +from conan.tools.layout import basic_layout +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.apple import is_apple_os +from conan.tools.build import cross_building +from conan.errors import ConanInvalidConfiguration import os -import platform -from conans import ConanFile, tools, VisualStudioBuildEnvironment, AutoToolsBuildEnvironment + + +required_conan_version = ">=1.53.0" class LuajitConan(ConanFile): @@ -9,99 +19,124 @@ class LuajitConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "http://luajit.org" description = "LuaJIT is a Just-In-Time Compiler (JIT) for the Lua programming language." - topics = ("conan", "lua", "jit") + topics = ("lua", "jit") settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], - "fPIC": [True, False]} - default_options = {"shared": False, - "fPIC": True} - _env_build = None + options = {"shared": [True, False], "fPIC": [True, False]} + default_options = {"shared": False, "fPIC": True} - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC + def layout(self): + basic_layout(self, src_folder="src") - def _configure_autotools(self): - if not self._env_build: - self._env_build = AutoToolsBuildEnvironment(self) - return self._env_build + def validate(self): + if self.settings.os == "Macos" and self.settings.arch == "armv8" and cross_building(self): + raise ConanInvalidConfiguration(f"{self.ref} can not be cross-built to Mac M1. Please, try any version >=2.1") + elif Version(self.version) <= "2.1.0-beta1" and self.settings.os == "Macos" and self.settings.arch == "armv8": + raise ConanInvalidConfiguration(f"{self.ref} is not supported by Mac M1. Please, try any version >=2.1") - def build(self): - if self.settings.compiler == 'Visual Studio': - with tools.chdir(os.path.join(self._source_subfolder, 'src')): - env_build = VisualStudioBuildEnvironment(self) - with tools.environment_append(env_build.vars), tools.vcvars(self): - variant = '' if self.options.shared else 'static' - self.run("msvcbuild.bat %s" % variant) + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.generate() + tc = VCVars(self) + tc.generate() else: + tc = AutotoolsToolchain(self) + tc.generate() + + def _patch_sources(self): + if not is_msvc(self): buildmode = 'shared' if self.options.shared else 'static' - makefile = os.path.join(self._source_subfolder, 'src', 'Makefile') - tools.replace_in_file(makefile, + makefile = os.path.join(self.source_folder, 'src', 'Makefile') + replace_in_file(self, makefile, 'BUILDMODE= mixed', 'BUILDMODE= %s' % buildmode) - tools.replace_in_file(makefile, + replace_in_file(self, makefile, 'TARGET_DYLIBPATH= $(TARGET_LIBPATH)/$(TARGET_DYLIBNAME)', 'TARGET_DYLIBPATH= $(TARGET_DYLIBNAME)') # adjust mixed mode defaults to build either .so or .a, but not both if not self.options.shared: - tools.replace_in_file(makefile, + replace_in_file(self, makefile, 'TARGET_T= $(LUAJIT_T) $(LUAJIT_SO)', 'TARGET_T= $(LUAJIT_T) $(LUAJIT_A)') - tools.replace_in_file(makefile, + replace_in_file(self, makefile, 'TARGET_DEP= $(LIB_VMDEF) $(LUAJIT_SO)', 'TARGET_DEP= $(LIB_VMDEF) $(LUAJIT_A)') else: - tools.replace_in_file(makefile, + replace_in_file(self, makefile, 'TARGET_O= $(LUAJIT_A)', 'TARGET_O= $(LUAJIT_SO)') - env = dict() - if self.settings.os == "Macos": - # Per https://luajit.org/install.html: If MACOSX_DEPLOYMENT_TARGET - # is not set then it's forced to 10.4, which breaks compile on Mojave. - version = self.settings.get_safe("os.version") - if not version and platform.system() == "Darwin": - major, minor, _ = platform.mac_ver()[0].split(".") - version = "%s.%s" % (major, minor) - env["MACOSX_DEPLOYMENT_TARGET"] = version - with tools.chdir(self._source_subfolder), tools.environment_append(env): - env_build = self._configure_autotools() - env_build.make(args=["PREFIX=%s" % self.package_folder]) + if "clang" in str(self.settings.compiler): + replace_in_file(self, makefile, 'CC= $(DEFAULT_CC)', 'CC= clang') + + @property + def _macosx_deployment_target(self): + return self.settings.get_safe("os.version") + + @property + def _make_arguments(self): + args = [f"PREFIX={unix_path(self, self.package_folder)}"] + if is_apple_os(self) and self._macosx_deployment_target: + args.append(f"MACOSX_DEPLOYMENT_TARGET={self._macosx_deployment_target}") + return args + + @property + def _luajit_include_folder(self): + luaversion = Version(self.version) + if luaversion.major == "2": + return f"luajit-{luaversion.major}.{luaversion.minor}" + return "luajit-2.1" + + def build(self): + apply_conandata_patches(self) + self._patch_sources() + if is_msvc(self): + with chdir(self, os.path.join(self.source_folder, "src")): + variant = '' if self.options.shared else 'static' + self.run(f"msvcbuild.bat {variant}", env="conanbuild") + else: + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.make(args=self._make_arguments) def package(self): - self.copy("COPYRIGHT", dst="licenses", src=self._source_subfolder) - if self.settings.compiler == 'Visual Studio': - ljs = os.path.join(self._source_subfolder, "src") - inc = os.path.join(self.package_folder, "include", "luajit-2.0") - self.copy("lua.h", dst=inc, src=ljs) - self.copy("lualib.h", dst=inc, src=ljs) - self.copy("lauxlib.h", dst=inc, src=ljs) - self.copy("luaconf.h", dst=inc, src=ljs) - self.copy("lua.hpp", dst=inc, src=ljs) - self.copy("luajit.h", dst=inc, src=ljs) - self.copy("lua51.lib", dst="lib", src=ljs) - self.copy("lua51.dll", dst="bin", src=ljs) + copy(self, "COPYRIGHT", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + src_folder = os.path.join(self.source_folder, "src") + include_folder = os.path.join(self.package_folder, "include", self._luajit_include_folder) + if is_msvc(self): + copy(self, "lua.h", src=src_folder, dst=include_folder) + copy(self, "lualib.h", src=src_folder, dst=include_folder) + copy(self, "lauxlib.h", src=src_folder, dst=include_folder) + copy(self, "luaconf.h", src=src_folder, dst=include_folder) + copy(self, "lua.hpp", src=src_folder, dst=include_folder) + copy(self, "luajit.h", src=src_folder, dst=include_folder) + copy(self, "lua51.lib", src=src_folder, dst=os.path.join(self.package_folder, "lib")) + copy(self, "lua51.dll", src=src_folder, dst=os.path.join(self.package_folder, "bin")) else: - with tools.chdir(self._source_subfolder): - env_build = self._configure_autotools() - env_build.install(args=["PREFIX=%s" % self.package_folder]) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.install(args=self._make_arguments + ["DESTDIR="]) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): - self.cpp_info.libs = ["lua51" if self.settings.compiler == "Visual Studio" else "luajit-5.1"] - self.cpp_info.includedirs = [os.path.join(self.package_folder, "include", "luajit-2.0")] - if self.settings.os == "Linux": + self.cpp_info.libs = ["lua51" if is_msvc(self) else "luajit-5.1"] + self.cpp_info.set_property("pkg_config_name", "luajit") + self.cpp_info.includedirs = [os.path.join("include", self._luajit_include_folder)] + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["m", "dl"]) diff --git a/recipes/luajit/all/patches/2.1.0-beta3-0001-remove-mac-deploy.patch b/recipes/luajit/all/patches/2.1.0-beta3-0001-remove-mac-deploy.patch new file mode 100644 index 00000000000000..26345dc4f02f06 --- /dev/null +++ b/recipes/luajit/all/patches/2.1.0-beta3-0001-remove-mac-deploy.patch @@ -0,0 +1,14 @@ +diff --git a/src/Makefile b/src/Makefile +index f56465d..a6838bc 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -312,9 +312,6 @@ ifeq (,$(shell $(TARGET_CC) -o /dev/null -c -x c /dev/null -fno-stack-protector + TARGET_XCFLAGS+= -fno-stack-protector + endif + ifeq (Darwin,$(TARGET_SYS)) +- ifeq (,$(MACOSX_DEPLOYMENT_TARGET)) +- export MACOSX_DEPLOYMENT_TARGET=10.4 +- endif + TARGET_STRIP+= -x + TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC + TARGET_DYNXLDOPTS= diff --git a/recipes/luajit/all/patches/20230104-0001-remove-mac-deploy.patch b/recipes/luajit/all/patches/20230104-0001-remove-mac-deploy.patch new file mode 100644 index 00000000000000..42e0eca4a7fb66 --- /dev/null +++ b/recipes/luajit/all/patches/20230104-0001-remove-mac-deploy.patch @@ -0,0 +1,14 @@ +diff --git a/src/Makefile b/src/Makefile +index 30d64be..b753ea1 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -316,9 +316,6 @@ ifeq (,$(shell $(TARGET_CC) -o /dev/null -c -x c /dev/null -fno-stack-protector + TARGET_XCFLAGS+= -fno-stack-protector + endif + ifeq (Darwin,$(TARGET_SYS)) +- ifeq (,$(MACOSX_DEPLOYMENT_TARGET)) +- $(error missing: export MACOSX_DEPLOYMENT_TARGET=XX.YY) +- endif + TARGET_STRIP+= -x + TARGET_XCFLAGS+= -DLUAJIT_UNWIND_EXTERNAL + TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC diff --git a/recipes/luajit/all/test_package/CMakeLists.txt b/recipes/luajit/all/test_package/CMakeLists.txt index c4a786d6190860..c0ae2aa0ba9ba9 100644 --- a/recipes/luajit/all/test_package/CMakeLists.txt +++ b/recipes/luajit/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +project(test_package C) find_package(luajit REQUIRED CONFIG) diff --git a/recipes/luajit/all/test_package/conanfile.py b/recipes/luajit/all/test_package/conanfile.py index 7e2dfe859bb27b..1d87f369a24da2 100644 --- a/recipes/luajit/all/test_package/conanfile.py +++ b/recipes/luajit/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan.tools.build import can_run +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/luajit/all/test_v1_package/CMakeLists.txt b/recipes/luajit/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..2f6b1a2f7ec79d --- /dev/null +++ b/recipes/luajit/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/luajit/all/test_v1_package/conanfile.py b/recipes/luajit/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..9d6b68dd18b5e8 --- /dev/null +++ b/recipes/luajit/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/luajit/config.yml b/recipes/luajit/config.yml index 1630e08ca5f328..f13e8f0f1a9ec4 100644 --- a/recipes/luajit/config.yml +++ b/recipes/luajit/config.yml @@ -1,3 +1,5 @@ versions: + "2.1.0-beta3": + folder: "all" "2.0.5": folder: "all" diff --git a/recipes/luau/all/conandata.yml b/recipes/luau/all/conandata.yml index 321396ad713ec5..75a36ad5ed9102 100644 --- a/recipes/luau/all/conandata.yml +++ b/recipes/luau/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.558": + url: "https://github.com/Roblox/luau/archive/0.558.tar.gz" + sha256: "3484adddb18872700e033f5917af44d90c266f9e0fff2fac21aec1061f472a06" + "0.556": + url: "https://github.com/Roblox/luau/archive/0.556.tar.gz" + sha256: "dc72f91f4e866a2b25f7608e062c91c84e92a2e5611026e9789f127c3caf39f6" "0.552": url: "https://github.com/Roblox/luau/archive/0.552.tar.gz" sha256: "c638aee88010197d7e6f22e592fa12360e38a69f54ed91980b11ac0f89676db5" @@ -25,6 +31,20 @@ sources: sha256: "24122d3192083b2133de47d8039fb744b8007c6667fc1b6f254a2a8d72e15d53" patches: + "0.558": + - patch_file: "patches/0.552-0001-fix-cmake.patch" + patch_description: "enable shared build" + patch_type: "portability" + - patch_file: "patches/0.536-0002-rename-lerp.patch" + patch_description: "rename lerp function to avoid name conflict" + patch_type: "portability" + "0.556": + - patch_file: "patches/0.552-0001-fix-cmake.patch" + patch_description: "enable shared build" + patch_type: "portability" + - patch_file: "patches/0.536-0002-rename-lerp.patch" + patch_description: "rename lerp function to avoid name conflict" + patch_type: "portability" "0.552": - patch_file: "patches/0.552-0001-fix-cmake.patch" patch_description: "enable shared build" diff --git a/recipes/luau/all/conanfile.py b/recipes/luau/all/conanfile.py index 6545f6caa610ff..7e65b178d4892d 100644 --- a/recipes/luau/all/conanfile.py +++ b/recipes/luau/all/conanfile.py @@ -1,6 +1,6 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.microsoft import is_msvc from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, replace_in_file from conan.tools.build import check_min_cppstd from conan.tools.scm import Version @@ -8,7 +8,7 @@ import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class LuauConan(ConanFile): name = "luau" @@ -43,6 +43,8 @@ def _compilers_minimum_version(self): "gcc": "8" if Version(self.version) < "0.549" else "9", "clang": "7", "apple-clang": "12", + "Visual Studio": "15", + "msvc": "191", } def export_sources(self): @@ -55,10 +57,7 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") if Version(self.version) < "0.549": del self.options.native_code_gen @@ -68,7 +67,6 @@ def layout(self): def validate(self): if self.info.settings.compiler.cppstd: check_min_cppstd(self, self._minimum_cpp_standard) - check_min_vs(self, 191) minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration( diff --git a/recipes/luau/all/test_v1_package/CMakeLists.txt b/recipes/luau/all/test_v1_package/CMakeLists.txt index cbcc5c4d883901..9d54a092e0a67e 100644 --- a/recipes/luau/all/test_v1_package/CMakeLists.txt +++ b/recipes/luau/all/test_v1_package/CMakeLists.txt @@ -4,8 +4,5 @@ project(test_package LANGUAGES CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(Luau REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE Luau::Luau) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/luau/config.yml b/recipes/luau/config.yml index a88454dd149ef0..56f7f8911914b5 100644 --- a/recipes/luau/config.yml +++ b/recipes/luau/config.yml @@ -1,4 +1,8 @@ versions: + "0.558": + folder: all + "0.556": + folder: all "0.552": folder: all "0.548": diff --git a/recipes/lz4/all/conandata.yml b/recipes/lz4/all/conandata.yml index b7956998236465..577763acfe7a6a 100644 --- a/recipes/lz4/all/conandata.yml +++ b/recipes/lz4/all/conandata.yml @@ -11,7 +11,15 @@ sources: patches: "1.9.3": - patch_file: "patches/0003-cmake-minimum-required-first-1.9.3.patch" + patch_description: "Move cmake_minimum_required to the top of CMakeFile.txt" + patch_type: conan "1.9.2": - patch_file: "patches/0001-cmake-add-shared-DEFINE_SYMBOL.patch" + patch_description: "Add LZ4_DLL_EXPORT to MSVC" + patch_type: portability - patch_file: "patches/0002-cmake-optional-cli.patch" + patch_description: "Add ability not to compile the CLI" + patch_type: conan - patch_file: "patches/0003-cmake-minimum-required-first-1.9.2.patch" + patch_description: "Move cmake_minimum_required to the top of CMakeFile.txt" + patch_type: conan diff --git a/recipes/lz4/all/conanfile.py b/recipes/lz4/all/conanfile.py index 0f12071b01ef24..00e8eb7116e692 100644 --- a/recipes/lz4/all/conanfile.py +++ b/recipes/lz4/all/conanfile.py @@ -1,12 +1,12 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save from conan.tools.microsoft import is_msvc from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class LZ4Conan(ConanFile): @@ -15,7 +15,7 @@ class LZ4Conan(ConanFile): license = ("BSD-2-Clause", "BSD-3-Clause") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/lz4/lz4" - topics = ("lz4", "compression") + topics = ("compression") settings = "os", "arch", "compiler", "build_type" options = { @@ -28,8 +28,7 @@ class LZ4Conan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -37,15 +36,9 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") diff --git a/recipes/lz4/all/test_v1_package/conanfile.py b/recipes/lz4/all/test_v1_package/conanfile.py index a2c12d9cb383dd..77061a2f84fa08 100644 --- a/recipes/lz4/all/test_v1_package/conanfile.py +++ b/recipes/lz4/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake from conan.tools.build import cross_building import os diff --git a/recipes/lzham/all/conandata.yml b/recipes/lzham/all/conandata.yml new file mode 100644 index 00000000000000..17b541de9d7b8a --- /dev/null +++ b/recipes/lzham/all/conandata.yml @@ -0,0 +1,33 @@ +sources: + "cci.20220103": + sha256: "3e3ccf7a57b1e6a90099784597aa7da30de3249a5f7fe532cefb3a77db5acbfb" + url: "https://github.com/richgel999/lzham_codec/archive/d379b1f9121e2197881c61cfc4713c78848bdfe7.zip" +patches: + "cci.20220103": + - patch_file: "patches/aarch64-yield-cci.20220103.patch" + patch_description: 'Uses "yield" rather than "pause" mneumonic to fix + aarch64 build' + patch_type: portability + + - patch_file: "patches/cmake-min-req-swap-cci.20220103.patch" + patch_description: 'Puts cmake_minimum_required before project in all + CMakeLists' + patch_type: portability + + - patch_file: "patches/fix-osx-cci.20220103.patch" + patch_description: "Fixes building on OSX" + patch_type: portability + + - patch_file: "patches/use-lzham-types-cci.20220103.patch" + patch_description: 'Uses typedefs prefixed with LZHAM to fix linux build + errors' + patch_type: portability + + - patch_file: "patches/cmake-rm-tests-cci.20220103.patch" + patch_description: "Skips building of lzhamtest for CMake" + patch_type: conan + + - patch_file: "patches/msvc-conan-cci.20220103.patch" + patch_description: 'Skips building of lzhamtest and examples for MSVC, + and injects conan toolchain for MSVC' + patch_type: conan diff --git a/recipes/lzham/all/conanfile.py b/recipes/lzham/all/conanfile.py new file mode 100644 index 00000000000000..b1b9dc2a684e4f --- /dev/null +++ b/recipes/lzham/all/conanfile.py @@ -0,0 +1,158 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import ( + apply_conandata_patches, + copy, + export_conandata_patches, + get, + rmdir +) +from conan.tools.microsoft import ( + MSBuild, MSBuildDeps, MSBuildToolchain, VCVars, is_msvc, vs_layout +) + +required_conan_version = ">=1.52.0" + +SLN_FILE = "lzham.sln" + + +class PackageConan(ConanFile): + name = "lzham" + + description = ( + "Compression algorithm similar compression ratio and faster " + "decompression than LZMA." + ) + + license = "LicenseRef-LICENSE" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/richgel999/lzham_codec" + topics = ("compression", "lz-compression") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + if is_msvc(self): + vs_layout(self) + else: + cmake_layout(self, src_folder="src") + + def source(self): + get( + self, + **self.conan_data["sources"][self.version], + destination=self.source_folder, + strip_root=True + ) + + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.generate() + tc = MSBuildDeps(self) + tc.generate() + tc = VCVars(self) + tc.generate() + else: + tc = CMakeToolchain(self) + + # Honor BUILD_SHARED_LIBS from conan_toolchain (see + # https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + + def build(self): + apply_conandata_patches(self) + if is_msvc(self): + msbuild = MSBuild(self) + msbuild.build_type = ( + "Debug" if self.settings.build_type == "Debug" else "Release" + ) + msbuild.platform = ( + "Win32" if self.settings.arch == "x86" else msbuild.platform + ) + msbuild.build(sln="lzham.sln") + else: + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy( + self, + pattern="LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder + ) + + if is_msvc(self): + suffix = "x64D" if self.settings.build_type == "Debug" else "x64" + copy( + self, + pattern=f"lzham_{suffix}.lib", + dst=os.path.join(self.package_folder, "lib"), + src=os.path.join(self.build_folder, "lib", "x64"), + keep_path=False + ) + copy( + self, + pattern=f"lzham_{suffix}.dll", + dst=os.path.join(self.package_folder, "bin"), + src=os.path.join(self.build_folder, "bin"), + keep_path=False + ) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) + else: + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "res")) + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread"]) + + if is_msvc(self): + lib_name = "lzham_x64" + if self.settings.build_type == "Debug": + lib_name += "D" + self.cpp_info.libs = [lib_name] + else: + self.cpp_info.libs = ["lzhamdll", "lzhamcomp", "lzhamdecomp"] + self.cpp_info.set_property("cmake_file_name", "lzham") + self.cpp_info.set_property("cmake_target_name", "lzham::lzham") + self.cpp_info.set_property("pkg_config_name", "lzham") + + # TODO: to remove in conan v2 once cmake_find_package_* generators + # removed + self.cpp_info.names["cmake_find_package"] = "lzham" + self.cpp_info.names["cmake_find_package_multi"] = "lzham" + self.cpp_info.names["pkg_config"] = "lzham" diff --git a/recipes/lzham/all/patches/aarch64-yield-cci.20220103.patch b/recipes/lzham/all/patches/aarch64-yield-cci.20220103.patch new file mode 100644 index 00000000000000..313029dda755c5 --- /dev/null +++ b/recipes/lzham/all/patches/aarch64-yield-cci.20220103.patch @@ -0,0 +1,16 @@ +diff --git a/lzhamdecomp/lzham_platform.h b/lzhamdecomp/lzham_platform.h +index 01704be..920a8f4 100644 +--- a/lzhamdecomp/lzham_platform.h ++++ b/lzhamdecomp/lzham_platform.h +@@ -24,7 +24,11 @@ void lzham_fail(const char* pExp, const char* pFile, unsigned line); + #if defined(__GNUC__) && LZHAM_PLATFORM_PC + extern __inline__ __attribute__((__always_inline__,__gnu_inline__)) void lzham_yield_processor() + { ++ #if defined(__aarch64__) ++ __asm__ __volatile__("yield"); ++ #else + __asm__ __volatile__("pause"); ++ #endif + } + #elif LZHAM_PLATFORM_X360 + #define lzham_yield_processor() \ diff --git a/recipes/lzham/all/patches/cmake-min-req-swap-cci.20220103.patch b/recipes/lzham/all/patches/cmake-min-req-swap-cci.20220103.patch new file mode 100644 index 00000000000000..8c598c5b49697e --- /dev/null +++ b/recipes/lzham/all/patches/cmake-min-req-swap-cci.20220103.patch @@ -0,0 +1,55 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 428cdfc..b8980e5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,5 @@ +-# PROJECT(lzham) + cmake_minimum_required(VERSION 2.8) ++PROJECT(lzham) + option(BUILD_X64 "build 64-bit" ON) + option(BUILD_SHARED_LIBS "build shared/static libs" ON) + +diff --git a/lzhamcomp/CMakeLists.txt b/lzhamcomp/CMakeLists.txt +index c80cc66..a3f77e7 100644 +--- a/lzhamcomp/CMakeLists.txt ++++ b/lzhamcomp/CMakeLists.txt +@@ -1,5 +1,5 @@ +-PROJECT(lzhamcomp) + cmake_minimum_required(VERSION 2.8) ++PROJECT(lzhamcomp) + option(BUILD_X64 "build 64-bit" TRUE) + + message("Initial BUILD_X64=${BUILD_X64}") +diff --git a/lzhamdecomp/CMakeLists.txt b/lzhamdecomp/CMakeLists.txt +index bf87a02..723379e 100644 +--- a/lzhamdecomp/CMakeLists.txt ++++ b/lzhamdecomp/CMakeLists.txt +@@ -1,5 +1,5 @@ +-PROJECT(lzhamdecomp) + cmake_minimum_required(VERSION 2.8) ++PROJECT(lzhamdecomp) + option(BUILD_X64 "build 64-bit" TRUE) + + message("Initial BUILD_X64=${BUILD_X64}") +diff --git a/lzhamdll/CMakeLists.txt b/lzhamdll/CMakeLists.txt +index f77f3fe..5a162b6 100644 +--- a/lzhamdll/CMakeLists.txt ++++ b/lzhamdll/CMakeLists.txt +@@ -1,5 +1,5 @@ +-PROJECT(lzhamdll) + cmake_minimum_required(VERSION 2.8) ++PROJECT(lzhamdll) + option(BUILD_X64 "build 64-bit" TRUE) + + message("Initial BUILD_X64=${BUILD_X64}") +diff --git a/lzhamtest/CMakeLists.txt b/lzhamtest/CMakeLists.txt +index 3349911..b8833b9 100644 +--- a/lzhamtest/CMakeLists.txt ++++ b/lzhamtest/CMakeLists.txt +@@ -1,5 +1,5 @@ +-PROJECT(lzhamtest) + cmake_minimum_required(VERSION 2.8) ++PROJECT(lzhamtest) + option(BUILD_X64 "build 64-bit" TRUE) + + message("Initial BUILD_X64=${BUILD_X64}") diff --git a/recipes/lzham/all/patches/cmake-rm-tests-cci.20220103.patch b/recipes/lzham/all/patches/cmake-rm-tests-cci.20220103.patch new file mode 100644 index 00000000000000..7b5cf8afef5f7b --- /dev/null +++ b/recipes/lzham/all/patches/cmake-rm-tests-cci.20220103.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 428cdfc..1857db2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,7 +6,6 @@ option(BUILD_SHARED_LIBS "build shared/static libs" ON) + add_subdirectory(lzhamdecomp) + add_subdirectory(lzhamcomp) + add_subdirectory(lzhamdll) +-add_subdirectory(lzhamtest) + + install(FILES include/lzham_dynamic_lib.h + include/lzham_exports.inc diff --git a/recipes/lzham/all/patches/fix-osx-cci.20220103.patch b/recipes/lzham/all/patches/fix-osx-cci.20220103.patch new file mode 100644 index 00000000000000..156502e3464437 --- /dev/null +++ b/recipes/lzham/all/patches/fix-osx-cci.20220103.patch @@ -0,0 +1,28 @@ +diff --git a/lzhamdecomp/lzham_platform.cpp b/lzhamdecomp/lzham_platform.cpp +index cfc85c1..599a847 100644 +--- a/lzhamdecomp/lzham_platform.cpp ++++ b/lzhamdecomp/lzham_platform.cpp +@@ -61,7 +61,7 @@ void lzham_debug_break(void) + { + #if LZHAM_USE_WIN32_API + DebugBreak(); +-#elif (TARGET_OS_MAC == 1) && (TARGET_IPHONE_SIMULATOR == 0) && (TARGET_OS_IPHONE == 0) ++#elif (TARGET_OS_MAC == 1) && (TARGET_IPHONE_SIMULATOR == 0) && (TARGET_OS_IPHONE == 0) && !defined(__clang__) + __asm {int 3} + #else + assert(0); +diff --git a/lzhamdecomp/lzham_traits.h b/lzhamdecomp/lzham_traits.h +index ea7214f..e103bad 100644 +--- a/lzhamdecomp/lzham_traits.h ++++ b/lzhamdecomp/lzham_traits.h +@@ -67,7 +67,9 @@ namespace lzham + // Defines type Q as bitwise copyable. + #define LZHAM_DEFINE_BITWISE_COPYABLE(Q) template<> struct bitwise_copyable { enum { cFlag = true }; }; + +-#if defined(__APPLE__) || defined(__NetBSD__) ++#if defined(__APPLE__) ++ #define LZHAM_IS_POD(T) std::is_pod::value ++#elif defined(__NetBSD__) + #define LZHAM_IS_POD(T) std::__is_pod::__value + #else + #define LZHAM_IS_POD(T) __is_pod(T) diff --git a/recipes/lzham/all/patches/msvc-conan-cci.20220103.patch b/recipes/lzham/all/patches/msvc-conan-cci.20220103.patch new file mode 100644 index 00000000000000..ca0b641855eedc --- /dev/null +++ b/recipes/lzham/all/patches/msvc-conan-cci.20220103.patch @@ -0,0 +1,83 @@ +diff --git a/lzham.sln b/lzham.sln +index 5c0edb6..63343f3 100644 +--- a/lzham.sln ++++ b/lzham.sln +@@ -3,22 +3,12 @@ Microsoft Visual Studio Solution File, Format Version 11.00 + # Visual Studio 2010 + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzhamdll", "lzhamdll\lzham.vcxproj", "{763BE79D-1280-41B7-81C5-7DC41E2BDB44}" + EndProject +-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzhamtest", "lzhamtest\lzhamtest.vcxproj", "{BBE16587-150E-460C-8AB4-F18B92D0B981}" +-EndProject + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzhamdecomp", "lzhamdecomp\lzhamdecomp.vcxproj", "{8DA0CD32-701D-48D7-AE92-728338501500}" + EndProject + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzhamcomp", "lzhamcomp\lzhamcomp.vcxproj", "{8DA0CD46-791D-48D7-AE92-728338501500}" + EndProject +-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example1", "example1\example1.vcxproj", "{BBE16587-150E-460C-8AB4-E18B92D0B982}" +-EndProject + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzhamlib", "lzhamlib\lzhamlib.vcxproj", "{83A2F0B5-1D02-4A13-B579-714F60E31774}" + EndProject +-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example2", "example2\example2.vcxproj", "{CBE16587-150E-460C-8AB4-E18B92D0B983}" +-EndProject +-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example3", "example3\example3.vcxproj", "{1BE16587-150E-460C-8AB4-E18B92D0BA87}" +-EndProject +-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example4", "example4\example4.vcxproj", "{1BE16587-260E-460C-8AB4-E18B92D0BA87}" +-EndProject + Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 +diff --git a/lzhamcomp/lzhamcomp.vcxproj b/lzhamcomp/lzhamcomp.vcxproj +index 5fd6155..b45f3dc 100644 +--- a/lzhamcomp/lzhamcomp.vcxproj ++++ b/lzhamcomp/lzhamcomp.vcxproj +@@ -23,6 +23,9 @@ + lzhamcomp + Win32Proj + ++ ++ ++ + + + StaticLibrary +diff --git a/lzhamdecomp/lzhamdecomp.vcxproj b/lzhamdecomp/lzhamdecomp.vcxproj +index dbaf54c..5f78ca5 100644 +--- a/lzhamdecomp/lzhamdecomp.vcxproj ++++ b/lzhamdecomp/lzhamdecomp.vcxproj +@@ -23,6 +23,9 @@ + lzhamdecomp + Win32Proj + ++ ++ ++ + + + StaticLibrary +diff --git a/lzhamdll/lzham.vcxproj b/lzhamdll/lzham.vcxproj +index ec0a280..5536234 100644 +--- a/lzhamdll/lzham.vcxproj ++++ b/lzhamdll/lzham.vcxproj +@@ -24,6 +24,9 @@ + lzham + Win32Proj + ++ ++ ++ + + + DynamicLibrary +diff --git a/lzhamlib/lzhamlib.vcxproj b/lzhamlib/lzhamlib.vcxproj +index 954dd99..cdd2c26 100644 +--- a/lzhamlib/lzhamlib.vcxproj ++++ b/lzhamlib/lzhamlib.vcxproj +@@ -23,6 +23,9 @@ + lzhamlib + Win32Proj + ++ ++ ++ + + + StaticLibrary diff --git a/recipes/lzham/all/patches/use-lzham-types-cci.20220103.patch b/recipes/lzham/all/patches/use-lzham-types-cci.20220103.patch new file mode 100644 index 00000000000000..db6f4925fa490c --- /dev/null +++ b/recipes/lzham/all/patches/use-lzham-types-cci.20220103.patch @@ -0,0 +1,142 @@ +diff --git a/lzhamcomp/lzham_win32_threading.h b/lzhamcomp/lzham_win32_threading.h +index 0e1d16b..4aaff8c 100644 +--- a/lzhamcomp/lzham_win32_threading.h ++++ b/lzhamcomp/lzham_win32_threading.h +@@ -43,9 +43,9 @@ namespace lzham + } + } + +- bool wait(uint32 milliseconds = UINT32_MAX) ++ bool wait(uint32 milliseconds = LZHAM_UINT32_MAX) + { +- LZHAM_ASSUME(INFINITE == UINT32_MAX); ++ LZHAM_ASSUME(INFINITE == LZHAM_UINT32_MAX); + + DWORD result = WaitForSingleObject(m_handle, milliseconds); + +diff --git a/lzhamdecomp/lzham_huffman_codes.cpp b/lzhamdecomp/lzham_huffman_codes.cpp +index 11bdbd4..788414a 100644 +--- a/lzhamdecomp/lzham_huffman_codes.cpp ++++ b/lzhamdecomp/lzham_huffman_codes.cpp +@@ -224,7 +224,7 @@ namespace lzham + + sym_freq& sf = state.syms0[num_used_syms]; + sf.m_left = (uint16)i; +- sf.m_right = UINT16_MAX; ++ sf.m_right = LZHAM_UINT16_MAX; + sf.m_freq = freq; + num_used_syms++; + } +diff --git a/lzhamdecomp/lzham_prefix_coding.cpp b/lzhamdecomp/lzham_prefix_coding.cpp +index e9ada15..52377c9 100644 +--- a/lzhamdecomp/lzham_prefix_coding.cpp ++++ b/lzhamdecomp/lzham_prefix_coding.cpp +@@ -149,7 +149,7 @@ namespace lzham + { + uint c = pCodesizes[i]; + +- LZHAM_ASSERT(!c || (next_code[c] <= UINT16_MAX)); ++ LZHAM_ASSERT(!c || (next_code[c] <= LZHAM_UINT16_MAX)); + + pCodes[i] = static_cast(next_code[c]++); + +@@ -296,7 +296,7 @@ namespace lzham + + LZHAM_ASSERT(t < (1U << table_bits)); + +- LZHAM_ASSERT(pTables->m_lookup[t] == UINT32_MAX); ++ LZHAM_ASSERT(pTables->m_lookup[t] == LZHAM_UINT32_MAX); + + pTables->m_lookup[t] = sym_index | (codesize << 16U); + } +diff --git a/lzhamdecomp/lzham_symbol_codec.cpp b/lzhamdecomp/lzham_symbol_codec.cpp +index 5623584..b2ea7ee 100644 +--- a/lzhamdecomp/lzham_symbol_codec.cpp ++++ b/lzhamdecomp/lzham_symbol_codec.cpp +@@ -581,7 +581,7 @@ namespace lzham + freq++; + m_sym_freq[sym] = static_cast(freq); + +- LZHAM_ASSERT(freq <= UINT16_MAX); ++ LZHAM_ASSERT(freq <= LZHAM_UINT16_MAX); + + if (--m_symbols_until_update == 0) + { +@@ -828,7 +828,7 @@ namespace lzham + freq++; + model.m_sym_freq[sym] = static_cast(freq); + +- LZHAM_ASSERT(freq <= UINT16_MAX); ++ LZHAM_ASSERT(freq <= LZHAM_UINT16_MAX); + + if (--model.m_symbols_until_update == 0) + { +@@ -1265,8 +1265,8 @@ namespace lzham + { + uint32 t = pTables->m_lookup[m_bit_buf >> (cBitBufSize - pTables->m_table_bits)]; + +- LZHAM_ASSERT(t != UINT32_MAX); +- sym = t & UINT16_MAX; ++ LZHAM_ASSERT(t != LZHAM_UINT32_MAX); ++ sym = t & LZHAM_UINT16_MAX; + len = t >> 16; + + LZHAM_ASSERT(model.m_code_sizes[sym] == len); +@@ -1301,7 +1301,7 @@ namespace lzham + freq++; + model.m_sym_freq[sym] = static_cast(freq); + +- LZHAM_ASSERT(freq <= UINT16_MAX); ++ LZHAM_ASSERT(freq <= LZHAM_UINT16_MAX); + + if (--model.m_symbols_until_update == 0) + { +diff --git a/lzhamdecomp/lzham_symbol_codec.h b/lzhamdecomp/lzham_symbol_codec.h +index 306d59b..b231530 100644 +--- a/lzhamdecomp/lzham_symbol_codec.h ++++ b/lzhamdecomp/lzham_symbol_codec.h +@@ -19,7 +19,7 @@ namespace lzham + typedef uint64 bit_cost_t; + const uint32 cBitCostScaleShift = 24; + const uint32 cBitCostScale = (1U << cBitCostScaleShift); +- const bit_cost_t cBitCostMax = UINT64_MAX; ++ const bit_cost_t cBitCostMax = LZHAM_UINT64_MAX; + + inline bit_cost_t convert_to_scaled_bitcost(uint bits) { LZHAM_ASSERT(bits <= 255); uint32 scaled_bits = bits << cBitCostScaleShift; return static_cast(scaled_bits); } + +@@ -444,7 +444,7 @@ namespace lzham + if (LZHAM_BUILTIN_EXPECT(k <= pTables->m_table_max_code, 1)) \ + { \ + uint32 t = pTables->m_lookup[bit_buf >> (symbol_codec::cBitBufSize - pTables->m_table_bits)]; \ +- result = t & UINT16_MAX; \ ++ result = t & LZHAM_UINT16_MAX; \ + len = t >> 16; \ + } \ + else \ +@@ -465,7 +465,7 @@ namespace lzham + uint freq = pModel->m_sym_freq[result]; \ + freq++; \ + pModel->m_sym_freq[result] = static_cast(freq); \ +- LZHAM_ASSERT(freq <= UINT16_MAX); \ ++ LZHAM_ASSERT(freq <= LZHAM_UINT16_MAX); \ + if (LZHAM_BUILTIN_EXPECT(--pModel->m_symbols_until_update == 0, 0)) \ + { \ + pModel->update_tables(); \ +@@ -501,7 +501,7 @@ namespace lzham + if (LZHAM_BUILTIN_EXPECT(k <= pTables->m_table_max_code, 1)) \ + { \ + uint32 t = pTables->m_lookup[bit_buf >> (symbol_codec::cBitBufSize - pTables->m_table_bits)]; \ +- result = t & UINT16_MAX; \ ++ result = t & LZHAM_UINT16_MAX; \ + len = t >> 16; \ + } \ + else \ +@@ -522,7 +522,7 @@ namespace lzham + uint freq = pModel->m_sym_freq[result]; \ + freq++; \ + pModel->m_sym_freq[result] = static_cast(freq); \ +- LZHAM_ASSERT(freq <= UINT16_MAX); \ ++ LZHAM_ASSERT(freq <= LZHAM_UINT16_MAX); \ + if (LZHAM_BUILTIN_EXPECT(--pModel->m_symbols_until_update == 0, 0)) \ + { \ + pModel->update_tables(); \ diff --git a/recipes/lzham/all/test_package/CMakeLists.txt b/recipes/lzham/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..c4780ae45756cc --- /dev/null +++ b/recipes/lzham/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +find_package(lzham REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PUBLIC lzham::lzham) diff --git a/recipes/lzham/all/test_package/conanfile.py b/recipes/lzham/all/test_package/conanfile.py new file mode 100644 index 00000000000000..eea09bfb32ab12 --- /dev/null +++ b/recipes/lzham/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +import os + +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/lzham/all/test_package/test_package.cpp b/recipes/lzham/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..c588215577f5f2 --- /dev/null +++ b/recipes/lzham/all/test_package/test_package.cpp @@ -0,0 +1,23 @@ +#include +#include + +#include + +int main() { + unsigned char in[] = "Hello Conan Center!"; + unsigned char out[sizeof(in)]; + + lzham_z_stream stream; + std::memset(&stream, 0, sizeof(stream)); + stream.next_in = in; + stream.avail_in = sizeof(in); + stream.next_out = out; + stream.avail_out = sizeof(out); + if (lzham_z_deflateInit(&stream, LZHAM_Z_BEST_COMPRESSION) != LZHAM_Z_OK) + return EXIT_FAILURE; + + if (lzham_z_deflate(&stream, LZHAM_Z_FULL_FLUSH) != LZHAM_Z_OK) + return EXIT_FAILURE; + + return EXIT_SUCCESS; +} diff --git a/recipes/lzham/all/test_v1_package/CMakeLists.txt b/recipes/lzham/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..231cec51e4ab95 --- /dev/null +++ b/recipes/lzham/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(lzham REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PUBLIC lzham::lzham) diff --git a/recipes/lzham/all/test_v1_package/conanfile.py b/recipes/lzham/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..0f735b51a26422 --- /dev/null +++ b/recipes/lzham/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/lzham/config.yml b/recipes/lzham/config.yml new file mode 100644 index 00000000000000..d334d7a80bf723 --- /dev/null +++ b/recipes/lzham/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20220103": + folder: all diff --git a/recipes/m4/all/conanfile.py b/recipes/m4/all/conanfile.py index ceb7e83548ca84..0420d3bb0e6418 100644 --- a/recipes/m4/all/conanfile.py +++ b/recipes/m4/all/conanfile.py @@ -12,6 +12,7 @@ class M4Conan(ConanFile): name = "m4" + package_type = "application" description = "GNU M4 is an implementation of the traditional Unix macro processor" topics = ("macro", "preprocessor") homepage = "https://www.gnu.org/software/m4/" diff --git a/recipes/m4/all/test_package/conanfile.py b/recipes/m4/all/test_package/conanfile.py index 22e16b15f81187..b665b86aad8f3a 100644 --- a/recipes/m4/all/test_package/conanfile.py +++ b/recipes/m4/all/test_package/conanfile.py @@ -32,5 +32,5 @@ def test(self): self.run(f"m4 -R {self.source_folder}/frozen.m4f {self.source_folder}/test.m4") output = StringIO() - self.run(f"m4 -P {self._m4_input_path}", output=output) + self.run(f"m4 -P {self._m4_input_path}", output) assert "Harry, Jr. met Sally" in output.getvalue() diff --git a/recipes/magic_enum/all/conandata.yml b/recipes/magic_enum/all/conandata.yml index 489178f9d1b090..f1eb6c3e300733 100644 --- a/recipes/magic_enum/all/conandata.yml +++ b/recipes/magic_enum/all/conandata.yml @@ -23,3 +23,6 @@ sources: "0.8.1": url: "https://github.com/Neargye/magic_enum/archive/v0.8.1.tar.gz" sha256: "6b948d1680f02542d651fc82154a9e136b341ce55c5bf300736b157e23f9df11" + "0.8.2": + url: "https://github.com/Neargye/magic_enum/archive/v0.8.2.tar.gz" + sha256: "62bd7034bbbfc3d7806001767d5775ab42f3ff33bb38366e1ceb21102f0dff9a" diff --git a/recipes/magic_enum/config.yml b/recipes/magic_enum/config.yml index 099df9650d39ce..affbfa65ae445d 100644 --- a/recipes/magic_enum/config.yml +++ b/recipes/magic_enum/config.yml @@ -15,3 +15,5 @@ versions: folder: all "0.8.1": folder: all + "0.8.2": + folder: all diff --git a/recipes/mailio/all/CMakeLists.txt b/recipes/mailio/all/CMakeLists.txt deleted file mode 100644 index 8977c3f43d6f8d..00000000000000 --- a/recipes/mailio/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/mailio/all/conandata.yml b/recipes/mailio/all/conandata.yml index a365e3a29f7a84..068f2f54981f16 100644 --- a/recipes/mailio/all/conandata.yml +++ b/recipes/mailio/all/conandata.yml @@ -8,7 +8,9 @@ sources: patches: "0.21.0": - patch_file: "patches/0.21.0-adapt-cmakelists.patch" - base_path: "source_subfolder" + patch_description: "fix install path" + patch_type: "conan" "0.20.0": - patch_file: "patches/0.20.0-adapt-cmakelists.patch" - base_path: "source_subfolder" + patch_description: "fix install path" + patch_type: "conan" diff --git a/recipes/mailio/all/conanfile.py b/recipes/mailio/all/conanfile.py index a0a2c6874d4a74..8024179a3697b6 100644 --- a/recipes/mailio/all/conanfile.py +++ b/recipes/mailio/all/conanfile.py @@ -1,17 +1,23 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc_static_runtime, is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir, replace_in_file +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class mailioConan(ConanFile): name = "mailio" + description = "mailio is a cross platform C++ library for MIME format and SMTP, POP3 and IMAP protocols." license = "BSD-2-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/karastojko/mailio" - description = "mailio is a cross platform C++ library for MIME format and SMTP, POP3 and IMAP protocols." topics = ("smtp", "imap", "email", "mail", "libraries", "cpp") - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], "shared": [True, False] @@ -20,38 +26,24 @@ class mailioConan(ConanFile): "fPIC": True, "shared": False } - generators = "cmake", "cmake_find_package" short_paths = True - _cmake = None - - _compiler_required_cpp17 = { - "gcc": "8.3", - "clang": "6", - "Visual Studio": "15", - "apple-clang": "10", - } @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 17 @property - def _build_subfolder(self): - return "build_subfolder" - - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.definitions["MAILIO_BUILD_SHARED_LIBRARY"] = self.options.shared - self._cmake.definitions["MAILIO_BUILD_DOCUMENTATION"] = False - self._cmake.definitions["MAILIO_BUILD_EXAMPLES"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def _compiler_required_cpp(self): + return { + "gcc": "8.3", + "clang": "6", + "Visual Studio": "15", + "msvc": "191", + "apple-clang": "10", + } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -59,42 +51,57 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("boost/1.79.0") - self.requires("openssl/1.1.1q") + self.requires("boost/1.81.0") + self.requires("openssl/1.1.1s") def validate(self): if self.settings.get_safe("compiler.cppstd"): - tools.check_min_cppstd(self, "17") + check_min_cppstd(self, self._min_cppstd) try: - minimum_required_compiler_version = self._compiler_required_cpp17[str(self.settings.compiler)] - if tools.Version(self.settings.compiler.version) < minimum_required_compiler_version: - raise ConanInvalidConfiguration("This package requires c++17 support. The current compiler does not support it.") + minimum_required_compiler_version = self._compiler_required_cpp[str(self.settings.compiler)] + if Version(self.settings.compiler.version) < minimum_required_compiler_version: + raise ConanInvalidConfiguration(f"{self.ref} requires c++{self._min_cppstd} support. The current compiler does not support it.") except KeyError: - self.output.warn("This recipe has no support for the current compiler. Please consider adding it.") + self.output.warn(f"{self.ref} has no support for the current compiler. Please consider adding it.") def build_requirements(self): # mailio requires cmake >= 3.16.3 - self.build_requires("cmake/3.23.2") + self.tool_requires("cmake/3.25.0") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["MAILIO_BUILD_SHARED_LIBRARY"] = self.options.shared + tc.variables["MAILIO_BUILD_DOCUMENTATION"] = False + tc.variables["MAILIO_BUILD_EXAMPLES"] = False + tc.generate() + + dpes = CMakeDeps(self) + dpes.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.libs = ["mailio"] self.cpp_info.requires = ["boost::system", "boost::date_time", "boost::regex", "openssl::openssl"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/mailio/all/test_package/CMakeLists.txt b/recipes/mailio/all/test_package/CMakeLists.txt index 6a193e3e9907d5..efd57b8a24474a 100644 --- a/recipes/mailio/all/test_package/CMakeLists.txt +++ b/recipes/mailio/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(mailio REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} mailio::mailio) -target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) +target_link_libraries(${PROJECT_NAME} PRIVATE mailio::mailio) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/mailio/all/test_package/conanfile.py b/recipes/mailio/all/test_package/conanfile.py index 0d81e955db7e7c..1111583fea732f 100644 --- a/recipes/mailio/all/test_package/conanfile.py +++ b/recipes/mailio/all/test_package/conanfile.py @@ -1,28 +1,27 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools +# It will become the standard on Conan 2.x +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" -class mailioTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) cmake.configure() cmake.build() - def build_requirements(self): - if hasattr(self, "settings_build") and tools.cross_building(self) and \ - self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") - def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mailio/all/test_v1_package/CMakeLists.txt b/recipes/mailio/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/mailio/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/mailio/all/test_v1_package/conanfile.py b/recipes/mailio/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/mailio/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/mbits-args/all/CMakeLists.txt b/recipes/mbits-args/all/CMakeLists.txt deleted file mode 100644 index bd3083b512cb93..00000000000000 --- a/recipes/mbits-args/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/mbits-args/all/conandata.yml b/recipes/mbits-args/all/conandata.yml index 9396e3b4afe52f..c5ec46f3c1e273 100644 --- a/recipes/mbits-args/all/conandata.yml +++ b/recipes/mbits-args/all/conandata.yml @@ -1,4 +1,10 @@ sources: - 0.12.3: + "0.12.3": url: "https://github.com/mbits-libs/args/archive/v0.12.3.tar.gz" sha256: "1a1dc5793e927a7f8c34b77c776b4d4a88f7ce9557657d8e806fca2922bd07a0" +patches: + "0.12.3": + - patch_file: "patches/0.12.3-0001-export-cmake-config.patch" + patch_description: "conan v2: drop the unneeded dependency, export cmake config" + patch_source: "https://github.com/mbits-libs/args/commit/f0593ed24d8edc33bcef5acaad5a2d27bf566ede" + patch_type: "conan" diff --git a/recipes/mbits-args/all/conanfile.py b/recipes/mbits-args/all/conanfile.py index 67fd62d66485dd..061c5b3a891b0b 100644 --- a/recipes/mbits-args/all/conanfile.py +++ b/recipes/mbits-args/all/conanfile.py @@ -1,103 +1,122 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.files import ( + apply_conandata_patches, + export_conandata_patches, + get, + copy, + rmdir, +) +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os +required_conan_version = ">=1.53.0" + + class MBitsArgsConan(ConanFile): name = "mbits-args" - description = "Small open-source library for program argument parser, inspired by Python's `argparse`, " \ - "depending only on the standard library, with C++17 as minimum requirement." - homepage = "https://github.com/mbits-libs/args" + description = ( + "Small open-source library for program argument parser, inspired by Python's `argparse`, " + "depending only on the standard library, with C++17 as minimum requirement." + ) license = "MIT" - topics = ("command-line", "commandline", "commandline-interface", - "program-arguments", "argparse", "argparser", "argument-parsing") - url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mbits-libs/args" + topics = ( + "command-line", + "commandline", + "commandline-interface", + "program-arguments", + "argparse", + "argparser", + "argument-parsing", + ) settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - generators = "cmake" - exports_sources = "CMakeLists.txt" - - _cmake = None + options = {"fPIC": [True, False]} + default_options = {"fPIC": True} - _compilers_minimum_version = { - "gcc": "8", - "clang": "7.0", - "Visual Studio": "16", - "apple-clang": "10.0", - } + @property + def _min_cppstd(self): + return 17 @property - def _source_subfolder(self): - return "source_subfolder" + def _compilers_minimum_version(self): + return { + "gcc": "8", + "clang": "12", + "Visual Studio": "16", + "msvc": "192", + "apple-clang": "10.0", + } + + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - def configure(self): - if self.options.shared: - del self.options.fPIC - - if self.settings.compiler == "Visual Studio" and "MT" in str(self.settings.compiler.runtime): + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 192) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get( + str(self.settings.compiler), False + ) + if ( + minimum_version + and Version(self.settings.compiler.version) < minimum_version + ): raise ConanInvalidConfiguration( - "mbits-args: combining shared library with private C++ " - "library (MT/MTd) is not supported.") - - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "17") - - minimum_version = self._compilers_minimum_version.get( - str(self.settings.compiler), False) - if not minimum_version: - self.output.warn( - "mbits-args requires C++17. Your compiler is unknown. Assuming it supports C++17.") - elif tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("mbits-args: Unsupported compiler: {} {}; " - "minimal version known to work is {}." - .format(self.settings.compiler, self.settings.compiler.version, minimum_version)) - elif str(self.settings.compiler) == "clang" and tools.Version(self.settings.compiler.version) < "8": - libcxx = self.settings.compiler.get_safe("libcxx") - if libcxx and str(libcxx) == "libc++": - raise ConanInvalidConfiguration("mbits-args: Unsupported compiler: clang {} with libc++;\n" - "minimal version known to work is either clang 8 with " - "libc++ or clang {} with libstdc++/libstdc++11." - .format(self.settings.compiler.version, minimum_version)) + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("args-{}".format(self.version), - self._source_subfolder) - - def _configure_cmake(self): - if self._cmake is not None: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["LIBARGS_TESTING"] = False - self._cmake.definitions["LIBARGS_INSTALL"] = True - self._cmake.definitions["LIBARGS_SHARED"] = self.options.shared - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LIBARGS_TESTING"] = False + tc.variables["LIBARGS_INSTALL"] = True + tc.generate() def build(self): - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + copy( + self, + pattern="LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + ) + cmake = CMake(self) cmake.install() - self.copy("LICENSE", - "licenses", keep_path=False, src=self._source_subfolder) + + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.filenames["cmake_find_package"] = "args" - self.cpp_info.filenames["cmake_find_package_multi"] = "args" + self.cpp_info.libs = ["args"] + + self.cpp_info.set_property("cmake_file_name", "mbits-args") + self.cpp_info.set_property("cmake_target_name", "mbits::args") + + self.cpp_info.filenames["cmake_find_package"] = "mbits-args" + self.cpp_info.filenames["cmake_find_package_multi"] = "mbits-args" self.cpp_info.names["cmake_find_package"] = "mbits" self.cpp_info.names["cmake_find_package_multi"] = "mbits" - self.cpp_info.components["libargs"].names["cmake_find_package"] = "args" - self.cpp_info.components["libargs"].names["cmake_find_package_multi"] = "args" - self.cpp_info.components["libargs"].libs = tools.collect_libs(self) - - # FIXME: CMake imported target shouldn't be namespaced (requires https://github.com/conan-io/conan/issues/7615) - # https://github.com/mbits-libs/args/blob/72f5f2b87ae39f26638a585fa4ad0b96b4152ae6/CMakeLists.txt#L152 + self.cpp_info.components["args"].set_property( + "cmake_target_name", "mbits::args" + ) + self.cpp_info.components["args"].libs = ["args"] diff --git a/recipes/mbits-args/all/patches/0.12.3-0001-export-cmake-config.patch b/recipes/mbits-args/all/patches/0.12.3-0001-export-cmake-config.patch new file mode 100644 index 00000000000000..b14f33f3a470e2 --- /dev/null +++ b/recipes/mbits-args/all/patches/0.12.3-0001-export-cmake-config.patch @@ -0,0 +1,36 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3d9271c..28c176f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -9,9 +9,6 @@ set(PROJECT_VERSION_STABILITY "") # or "-alpha", or "-beta", or "-rc.5" + if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) + message(STATUS "Libargs: Standalone") + +- include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +- conan_basic_setup(TARGETS) +- + set(LIBARG_TESTING_DEFAULT ON) + set(LIBARG_INSTALL_DEFAULT ON) + set_property(GLOBAL PROPERTY USE_FOLDERS ON) +@@ -123,8 +120,9 @@ target_compile_definitions(args PRIVATE LIBARGS_EXPORTING) + target_compile_features(args PRIVATE cxx_std_17) + target_include_directories(args + PUBLIC +- ${CMAKE_CURRENT_SOURCE_DIR}/include +- ${CMAKE_CURRENT_BINARY_DIR}/include ++ $ ++ $ ++ $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) + + if (LIBARGS_SHARED) +@@ -149,7 +147,8 @@ endif() + ################################################################## + + if (LIBARGS_INSTALL) +- install(TARGETS args) ++ install(TARGETS args EXPORT mbits) ++ install(EXPORT mbits NAMESPACE "mbits::" DESTINATION lib/cmake) + install(DIRECTORY include/args DESTINATION include) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/include/args/version.hpp" DESTINATION include/args) + endif() diff --git a/recipes/mbits-args/all/test_package/CMakeLists.txt b/recipes/mbits-args/all/test_package/CMakeLists.txt index edca4cb0bfe7f4..6048bc9a7928f9 100644 --- a/recipes/mbits-args/all/test_package/CMakeLists.txt +++ b/recipes/mbits-args/all/test_package/CMakeLists.txt @@ -1,14 +1,8 @@ -cmake_minimum_required(VERSION 3.12) -project(PackageTest CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(mbits-args REQUIRED CONFIG) -find_package(args REQUIRED CONFIG) - -add_executable(example example.cpp) -# FIXME: CMake imported target shouldn't be namespaced (requires https://github.com/conan-io/conan/issues/7615) -target_link_libraries(example mbits::args) -set_target_properties(example PROPERTIES - CXX_STANDARD 20 - CXX_STANDARD_REQUIRED OFF) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE mbits::args) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/mbits-args/all/test_package/conanfile.py b/recipes/mbits-args/all/test_package/conanfile.py index 9ded35e45e703c..3202cf875bb921 100644 --- a/recipes/mbits-args/all/test_package/conanfile.py +++ b/recipes/mbits-args/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" -class LibargsTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -13,7 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "example") - self.run("{} --sum 1000 700 1".format(bin_path), - run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run("{} --sum 1000 700 1".format(bin_path), env="conanrun") diff --git a/recipes/mbits-args/all/test_package/example.cpp b/recipes/mbits-args/all/test_package/test_package.cpp similarity index 100% rename from recipes/mbits-args/all/test_package/example.cpp rename to recipes/mbits-args/all/test_package/test_package.cpp diff --git a/recipes/mbits-args/all/test_v1_package/CMakeLists.txt b/recipes/mbits-args/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/mbits-args/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/mbits-args/all/test_v1_package/conanfile.py b/recipes/mbits-args/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..897d76acb188aa --- /dev/null +++ b/recipes/mbits-args/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +# legacy validation with Conan 1.x +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run("{} --sum 1000 700 1".format(bin_path), run_environment=True) diff --git a/recipes/mbits-args/config.yml b/recipes/mbits-args/config.yml index 0ea23cbe62531a..fba0b105d56efa 100644 --- a/recipes/mbits-args/config.yml +++ b/recipes/mbits-args/config.yml @@ -1,3 +1,3 @@ versions: - 0.12.3: + "0.12.3": folder: all diff --git a/recipes/mbits-mstch/all/conandata.yml b/recipes/mbits-mstch/all/conandata.yml new file mode 100644 index 00000000000000..252a49a795bd6a --- /dev/null +++ b/recipes/mbits-mstch/all/conandata.yml @@ -0,0 +1,5 @@ +sources: + # Newer versions at the top + "1.0.4": + url: "https://github.com/mbits-libs/libmstch/archive/v1.0.4.tar.gz" + sha256: "ee3052b9c2321b46fffabb5db5d5659e5f963070cdfd0004701b515867ed6857" diff --git a/recipes/mbits-mstch/all/conanfile.py b/recipes/mbits-mstch/all/conanfile.py new file mode 100644 index 00000000000000..a06f83e964b39b --- /dev/null +++ b/recipes/mbits-mstch/all/conanfile.py @@ -0,0 +1,105 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.files import export_conandata_patches, get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + + +required_conan_version = ">=1.53.0" + + +class MBitsMstchConan(ConanFile): + name = "mbits-mstch" + description = "libmstch implemented in terms of C++17 variant." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mbits-libs/libmstch" + topics = ("parser", "mstch", "mustache", "libmstch", "libmstch-parser") + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC": [True, False], + } + default_options = { + "fPIC": True, + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "11", + "clang": "12", + "msvc": "192", + "apple-clang": "11.0.3", + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 192) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get( + str(self.settings.compiler), False + ) + if ( + minimum_version + and Version(self.settings.compiler.version) < minimum_version + ): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy( + self, + pattern="LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + ) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.libs = ["mstch"] + + self.cpp_info.set_property("cmake_file_name", "mbits-mstch") + self.cpp_info.set_property("cmake_target_name", "mbits::mstch") + + self.cpp_info.filenames["cmake_find_package"] = "mbits-mstch" + self.cpp_info.filenames["cmake_find_package_multi"] = "mbits-mstch" + self.cpp_info.names["cmake_find_package"] = "mbits" + self.cpp_info.names["cmake_find_package_multi"] = "mbits" + self.cpp_info.components["mstch"].set_property( + "cmake_target_name", "mbits::mstch" + ) + self.cpp_info.components["mstch"].libs = ["mstch"] diff --git a/recipes/mbits-mstch/all/test_package/CMakeLists.txt b/recipes/mbits-mstch/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..b7067fa3ea38e6 --- /dev/null +++ b/recipes/mbits-mstch/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +find_package(mbits-mstch REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE mbits::mstch) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/mbits-mstch/all/test_package/conanfile.py b/recipes/mbits-mstch/all/test_package/conanfile.py new file mode 100644 index 00000000000000..a9fb96656f2039 --- /dev/null +++ b/recipes/mbits-mstch/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mbits-mstch/all/test_package/test_package.cpp b/recipes/mbits-mstch/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..dee76b9b4ce2e1 --- /dev/null +++ b/recipes/mbits-mstch/all/test_package/test_package.cpp @@ -0,0 +1,26 @@ +#include +#include + +int main() { + mstch::map root{ + {"it", "works"}, + {"happy", true}, + {"various", + mstch::array{ + mstch::map{{"value", nullptr}}, + mstch::map{{"value", 0ll}}, + mstch::map{{"value", 3.14}}, + mstch::map{{"value", false}}, + }}, + }; + + puts(mstch::render(R"(>>> It {{it}} + I'm {{^happy}}not {{/happy}}happy about it. + Various: +{{#various}} + - {{value}}; +{{/various}} +)", + root) + .c_str()); +} diff --git a/recipes/mbits-mstch/all/test_v1_package/CMakeLists.txt b/recipes/mbits-mstch/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/mbits-mstch/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/mbits-mstch/all/test_v1_package/conanfile.py b/recipes/mbits-mstch/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/mbits-mstch/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/mbits-mstch/config.yml b/recipes/mbits-mstch/config.yml new file mode 100644 index 00000000000000..a7562f7a5313ac --- /dev/null +++ b/recipes/mbits-mstch/config.yml @@ -0,0 +1,4 @@ +versions: + # Newer versions at the top + "1.0.4": + folder: all diff --git a/recipes/mbits-semver/all/conandata.yml b/recipes/mbits-semver/all/conandata.yml new file mode 100644 index 00000000000000..dfbd10562ef662 --- /dev/null +++ b/recipes/mbits-semver/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + 0.1.1: + url: "https://github.com/mbits-libs/semver/archive/v0.1.1.tar.gz" + sha256: "edfa9b04bdffd8efbdea31c9cfd7064801483d8cab0b2de5734018bdb318cf18" diff --git a/recipes/mbits-semver/all/conanfile.py b/recipes/mbits-semver/all/conanfile.py new file mode 100644 index 00000000000000..f0cda9dbb4ea72 --- /dev/null +++ b/recipes/mbits-semver/all/conanfile.py @@ -0,0 +1,103 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.files import export_conandata_patches, get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + + +required_conan_version = ">=1.53.0" + + +class MBitsSemverConan(ConanFile): + name = "mbits-semver" + description = "Semantic Version type for C++17" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mbits-libs/semver" + topics = ("semver", "semantic-versioning") + settings = "os", "compiler", "build_type", "arch" + options = {"fPIC": [True, False]} + default_options = {"fPIC": True} + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "11", + "clang": "12", + "Visual Studio": "16", + "msvc": "192", + "apple-clang": "11.0.3", + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 192) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get( + str(self.settings.compiler), False + ) + if ( + minimum_version + and Version(self.settings.compiler.version) < minimum_version + ): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["SEMVER_TESTING"] = False + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy( + self, + pattern="LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + ) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.libs = ["semver"] + + self.cpp_info.set_property("cmake_file_name", "mbits-semver") + self.cpp_info.set_property("cmake_target_name", "mbits::semver") + + self.cpp_info.filenames["cmake_find_package"] = "mbits-semver" + self.cpp_info.filenames["cmake_find_package_multi"] = "mbits-semver" + self.cpp_info.names["cmake_find_package"] = "mbits" + self.cpp_info.names["cmake_find_package_multi"] = "mbits" + self.cpp_info.components["semver"].set_property( + "cmake_target_name", "mbits::semver" + ) + self.cpp_info.components["semver"].libs = ["semver"] diff --git a/recipes/mbits-semver/all/test_package/CMakeLists.txt b/recipes/mbits-semver/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..4d8d4734ef1558 --- /dev/null +++ b/recipes/mbits-semver/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +find_package(mbits-semver REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE mbits::semver) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/mbits-semver/all/test_package/conanfile.py b/recipes/mbits-semver/all/test_package/conanfile.py new file mode 100644 index 00000000000000..1111583fea732f --- /dev/null +++ b/recipes/mbits-semver/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +# It will become the standard on Conan 2.x +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mbits-semver/all/test_package/test_package.cpp b/recipes/mbits-semver/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..fa9dbd47eb8373 --- /dev/null +++ b/recipes/mbits-semver/all/test_package/test_package.cpp @@ -0,0 +1,29 @@ +#include +#include +#include + +int main() { + auto const ver_data = std::string{"1.3.0-beta.5+something.mixed.5"}; + semver::project_version beta5{ver_data}; + + auto const ver_data_rc = std::string{"1.3.0-rc"}; + semver::project_version rc{ver_data_rc}; + + char const *verdict = semver::version.compatible_with(beta5) ? "" : "in"; + printf("Compiled-in version %s is %scompatible with runtime version %s\n", + semver::version.to_string().c_str(), verdict, + beta5.to_string().c_str()); + + verdict = semver::version.compatible_with(semver::get_version()) ? "" : "in"; + printf("Compiled-in version %s is %scompatible with runtime version %s\n", + semver::version.to_string().c_str(), verdict, + semver::get_version().to_string().c_str()); + + verdict = beta5.compatible_with(rc) ? "" : "in"; + printf("Compiled-in version %s is %scompatible with runtime version %s\n", + beta5.to_string().c_str(), verdict, rc.to_string().c_str()); + + verdict = rc.compatible_with(beta5) ? "" : "in"; + printf("Compiled-in version %s is %scompatible with runtime version %s\n", + rc.to_string().c_str(), verdict, beta5.to_string().c_str()); +} diff --git a/recipes/mbits-semver/all/test_v1_package/CMakeLists.txt b/recipes/mbits-semver/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/mbits-semver/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/mbits-semver/all/test_v1_package/conanfile.py b/recipes/mbits-semver/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..c492184eec19c2 --- /dev/null +++ b/recipes/mbits-semver/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +# legacy validation with Conan 1.x +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/mbits-semver/config.yml b/recipes/mbits-semver/config.yml new file mode 100644 index 00000000000000..931f26d75751d6 --- /dev/null +++ b/recipes/mbits-semver/config.yml @@ -0,0 +1,3 @@ +versions: + 0.1.1: + folder: all diff --git a/recipes/md4qt/all/conandata.yml b/recipes/md4qt/all/conandata.yml index 3e89e46b3e63ac..3d8d45af50a233 100644 --- a/recipes/md4qt/all/conandata.yml +++ b/recipes/md4qt/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.0.4": + url: "https://github.com/igormironchik/md4qt/archive/refs/tags/2.0.4.tar.gz" + sha256: "2980a0d0b5d3539a5a1402942a1345e97c8ab36acfc8e00d932df157d2e6edc2" "2.0.3": url: "https://github.com/igormironchik/md4qt/archive/refs/tags/2.0.3.tar.gz" sha256: "374bfc74aa6ebb1ea7d2332b96f8b2f6001118793bbe4e55109a13d0ffe7ce55" diff --git a/recipes/md4qt/config.yml b/recipes/md4qt/config.yml index 7529da0511999f..e588fe3f46fb3f 100644 --- a/recipes/md4qt/config.yml +++ b/recipes/md4qt/config.yml @@ -1,4 +1,6 @@ versions: + "2.0.4": + folder: all "2.0.3": folder: all "2.0.2": diff --git a/recipes/meson/all/conandata.yml b/recipes/meson/all/conandata.yml index 0195431f991641..1f58656822bf2f 100644 --- a/recipes/meson/all/conandata.yml +++ b/recipes/meson/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.0.0": + url: "https://github.com/mesonbuild/meson/releases/download/1.0.0/meson-1.0.0.tar.gz" + sha256: "aa50a4ba4557c25e7d48446abfde857957dcdf58385fffbe670ba0e8efacce05" "0.64.1": url: "https://github.com/mesonbuild/meson/archive/0.64.1.tar.gz" sha256: "1d12a4bc1cf3ab18946d12cf0b6452e5254ada1ad50aacc97f87e2cccd7da315" diff --git a/recipes/meson/all/conanfile.py b/recipes/meson/all/conanfile.py index 8168d4afa4b4fc..e2d65a1b60825c 100644 --- a/recipes/meson/all/conanfile.py +++ b/recipes/meson/all/conanfile.py @@ -1,32 +1,29 @@ +import os +import textwrap + from conan import ConanFile, conan_version from conan.tools.files import copy, get, rmdir, save from conan.tools.layout import basic_layout from conan.tools.scm import Version -import os -import textwrap required_conan_version = ">=1.52.0" class MesonConan(ConanFile): name = "meson" + package_type = "application" description = "Meson is a project to create the best possible next-generation build system" topics = ("meson", "mesonbuild", "build-system") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/mesonbuild/meson" license = "Apache-2.0" - settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) - def layout(self): basic_layout(self, src_folder="src") def requirements(self): - if self.conf.get("tools.meson.mesontoolchain:backend", default=False, check_type=str) in (False, "ninja"): + if self.conf.get("tools.meson.mesontoolchain:backend", default="ninja", check_type=str) == "ninja": self.requires("ninja/1.11.1") def package_id(self): @@ -36,24 +33,6 @@ def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - # FIXME: https://github.com/conan-io/conan/issues/10726 - def _fix_symlinks(root, files): - if not self._settings_build.os == "Windows": - return - for filename in files: - filename = os.path.join(root, filename) - if os.path.islink(filename): - target = os.readlink(filename) - if "/" in target: - self.output.info(f"fixing broken link {target}") - target = target.replace("/", "\\") - os.unlink(filename) - os.symlink(target, filename) - - for root, dirs, files in os.walk(self.source_folder): - _fix_symlinks(root, dirs) - _fix_symlinks(root, files) - def build(self): pass diff --git a/recipes/meson/all/test_package/conanfile.py b/recipes/meson/all/test_package/conanfile.py index 946c63a8024cb6..19ffe682ab919d 100644 --- a/recipes/meson/all/test_package/conanfile.py +++ b/recipes/meson/all/test_package/conanfile.py @@ -1,8 +1,9 @@ +import os + 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 class TestPackageConan(ConanFile): diff --git a/recipes/meson/config.yml b/recipes/meson/config.yml index 3c331d990af963..b08dc9001574f4 100644 --- a/recipes/meson/config.yml +++ b/recipes/meson/config.yml @@ -1,4 +1,6 @@ versions: + "1.0.0": + folder: all "0.64.1": folder: all "0.64.0": diff --git a/recipes/mikelankamp-fpm/all/conandata.yml b/recipes/mikelankamp-fpm/all/conandata.yml new file mode 100644 index 00000000000000..360fcf6413abcf --- /dev/null +++ b/recipes/mikelankamp-fpm/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.1.0": + url: "https://github.com/MikeLankamp/fpm/archive/refs/tags/v1.1.0.tar.gz" + sha256: "e34941b4cd1d1f1fbe9ecf39b740cb20b9c272a832f63be27fa24eddf400e51b" diff --git a/recipes/mikelankamp-fpm/all/conanfile.py b/recipes/mikelankamp-fpm/all/conanfile.py new file mode 100644 index 00000000000000..4f1037ea6348fd --- /dev/null +++ b/recipes/mikelankamp-fpm/all/conanfile.py @@ -0,0 +1,56 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.52.0" + +class MikeLankampFpmConan(ConanFile): + name = "mikelankamp-fpm" + description = "C++ header-only fixed-point math library" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/MikeLankamp/fpm" + topics = ("fixed-point", "math", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 11 + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "fpm") + self.cpp_info.set_property("cmake_target_name", "fpm::fpm") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "fpm" + self.cpp_info.filenames["cmake_find_package_multi"] = "fpm" + self.cpp_info.names["cmake_find_package"] = "fpm" + self.cpp_info.names["cmake_find_package_multi"] = "fpm" diff --git a/recipes/mikelankamp-fpm/all/test_package/CMakeLists.txt b/recipes/mikelankamp-fpm/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..4b78d3f578ec0a --- /dev/null +++ b/recipes/mikelankamp-fpm/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(fpm REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE fpm::fpm) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/mikelankamp-fpm/all/test_package/conanfile.py b/recipes/mikelankamp-fpm/all/test_package/conanfile.py new file mode 100644 index 00000000000000..48499fa0989d9c --- /dev/null +++ b/recipes/mikelankamp-fpm/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +# It will become the standard on Conan 2.x +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mikelankamp-fpm/all/test_package/test_package.cpp b/recipes/mikelankamp-fpm/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..f57e54c2093e5a --- /dev/null +++ b/recipes/mikelankamp-fpm/all/test_package/test_package.cpp @@ -0,0 +1,14 @@ +#include +#include +#include + +#include + +int main() { + std::cout << "Please input a number: "; + fpm::fixed_16_16 x; + std::cin >> x; + std::cout << "The cosine of " << x << " radians is: " << cos(x) << std::endl; + + return 0; +} diff --git a/recipes/mikelankamp-fpm/all/test_v1_package/CMakeLists.txt b/recipes/mikelankamp-fpm/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..9d54a092e0a67e --- /dev/null +++ b/recipes/mikelankamp-fpm/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/mikelankamp-fpm/all/test_v1_package/conanfile.py b/recipes/mikelankamp-fpm/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..20d4d2e28d57e0 --- /dev/null +++ b/recipes/mikelankamp-fpm/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/mikelankamp-fpm/config.yml b/recipes/mikelankamp-fpm/config.yml new file mode 100644 index 00000000000000..b5c0d3cb2d4091 --- /dev/null +++ b/recipes/mikelankamp-fpm/config.yml @@ -0,0 +1,3 @@ +versions: + "1.1.0": + folder: all diff --git a/recipes/minizip-ng/all/conandata.yml b/recipes/minizip-ng/all/conandata.yml index 3c2038ac4c0872..4e96dfa1d6b279 100644 --- a/recipes/minizip-ng/all/conandata.yml +++ b/recipes/minizip-ng/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.0.8": + url: "https://github.com/zlib-ng/minizip-ng/archive/3.0.8.tar.gz" + sha256: "27cc2f62cd02d79b71b346fc6ace02728385f8ba9c6b5f124062b0790a04629a" "3.0.7": url: "https://github.com/zlib-ng/minizip-ng/archive/3.0.7.tar.gz" sha256: "39981a0db1bb6da504909bce63d7493286c5e50825c056564544c990d15c55cf" @@ -21,6 +24,14 @@ sources: url: "https://github.com/zlib-ng/minizip-ng/archive/3.0.1.tar.gz" sha256: "96c95b274dd535984ce0e87691691388f2b976106e8cf8d527b15da552ac94e4" patches: + "3.0.8": + - patch_file: "patches/3.0.8-0001-fix-cmake-project.patch" + patch_description: "CMake: declare project() sooner" + patch_type: "conan" + - patch_file: "patches/3.0.6-0002-fix-lzma-libdir.patch" + patch_description: "CMake: inject libdir of lzma" + patch_type: "conan" + patch_source: "https://github.com/zlib-ng/minizip-ng/pull/658" "3.0.7": - patch_file: "patches/3.0.7-0001-fix-cmake-project.patch" patch_description: "CMake: declare project() sooner" diff --git a/recipes/minizip-ng/all/conanfile.py b/recipes/minizip-ng/all/conanfile.py index 5b4369c3f4103f..a40841850695a3 100644 --- a/recipes/minizip-ng/all/conanfile.py +++ b/recipes/minizip-ng/all/conanfile.py @@ -85,7 +85,7 @@ def requirements(self): if self.options.with_bzip2: self.requires("bzip2/1.0.8") if self.options.with_lzma: - self.requires("xz_utils/5.2.5") + self.requires("xz_utils/5.4.0") if self.options.with_zstd: self.requires("zstd/1.5.2") if self.options.with_openssl: diff --git a/recipes/minizip-ng/all/patches/3.0.8-0001-fix-cmake-project.patch b/recipes/minizip-ng/all/patches/3.0.8-0001-fix-cmake-project.patch new file mode 100644 index 00000000000000..608ac1f98c9c7c --- /dev/null +++ b/recipes/minizip-ng/all/patches/3.0.8-0001-fix-cmake-project.patch @@ -0,0 +1,20 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index a073919..7ff2b58 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -70,6 +70,7 @@ enable_language(C) + + # Library version + set(VERSION "3.0.8") ++project(minizip${MZ_PROJECT_SUFFIX} VERSION ${VERSION} LANGUAGES C) + + # API version + set(SOVERSION "3") +@@ -663,7 +664,6 @@ endif() + list(APPEND MINIZIP_INC ${CMAKE_CURRENT_SOURCE_DIR}) + + # Create minizip library +-project(minizip${MZ_PROJECT_SUFFIX} LANGUAGES C VERSION ${VERSION}) + + if(NOT ${MZ_PROJECT_SUFFIX} STREQUAL "") + message(STATUS "Project configured as ${PROJECT_NAME}") diff --git a/recipes/minizip-ng/config.yml b/recipes/minizip-ng/config.yml index 60ae0e8c451f87..7802f2e3e4d7f7 100644 --- a/recipes/minizip-ng/config.yml +++ b/recipes/minizip-ng/config.yml @@ -1,4 +1,6 @@ versions: + "3.0.8": + folder: all "3.0.7": folder: all "3.0.6": diff --git a/recipes/minizip/all/conanfile.py b/recipes/minizip/all/conanfile.py index 8786a7f6a46e76..f775fd9f5b9155 100644 --- a/recipes/minizip/all/conanfile.py +++ b/recipes/minizip/all/conanfile.py @@ -55,9 +55,9 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.13") + self.requires("zlib/1.2.13", transitive_headers=True) if self.options.bzip2: - self.requires("bzip2/1.0.8") + self.requires("bzip2/1.0.8", transitive_headers=True) def source(self): get(self, **self.conan_data["sources"][self.version], diff --git a/recipes/modern-cpp-kafka/all/conandata.yml b/recipes/modern-cpp-kafka/all/conandata.yml index 6dcb3eaf368bce..41a95649ec3454 100644 --- a/recipes/modern-cpp-kafka/all/conandata.yml +++ b/recipes/modern-cpp-kafka/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2022.12.07": + url: "https://github.com/morganstanley/modern-cpp-kafka/archive/v2022.12.07.tar.gz" + sha256: "980533fe5e0f5630d7deab6567ed051cf51d61ac341e4a75810f68d58cbff439" "2022.10.12": url: "https://github.com/morganstanley/modern-cpp-kafka/archive/v2022.10.12.tar.gz" sha256: "f60c6d6328e64a8ae0c3233921078160fc4e42a3484eb823d9918895f5f1b39f" @@ -6,5 +9,5 @@ sources: url: "https://github.com/morganstanley/modern-cpp-kafka/archive/v2022.08.01.tar.gz" sha256: "77998caf50ffcc55c77713571d9ce04a37020ccff7b713d14abad9eb8ceb05b3" "2022.06.15": - url: https://github.com/morganstanley/modern-cpp-kafka/archive/refs/tags/v2022.06.15.tar.gz - sha256: 478fcf560057b7cf7b4be851838ebf0520806d057b172de23261606fce088d27 + url: "https://github.com/morganstanley/modern-cpp-kafka/archive/refs/tags/v2022.06.15.tar.gz" + sha256: "478fcf560057b7cf7b4be851838ebf0520806d057b172de23261606fce088d27" diff --git a/recipes/modern-cpp-kafka/all/conanfile.py b/recipes/modern-cpp-kafka/all/conanfile.py index eebf2c5395b601..623a7a9a942f98 100644 --- a/recipes/modern-cpp-kafka/all/conanfile.py +++ b/recipes/modern-cpp-kafka/all/conanfile.py @@ -1,41 +1,71 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +from conan.tools.microsoft import check_min_vs, is_msvc import os -required_conan_version = ">=1.33.0" - +required_conan_version = ">=1.52.0" class ModernCppKafkaConan(ConanFile): name = "modern-cpp-kafka" description = "A C++ API for Kafka clients (i.e. KafkaProducer, KafkaConsumer, AdminClient)" license = "Apache-2.0" - topics = ("kafka", "librdkafka", "kafkaproducer", "kafkaconsumer") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/morganstanley/modern-cpp-kafka" - settings = "arch", "build_type", "compiler", "os" + topics = ("kafka", "librdkafka", "kafkaproducer", "kafkaconsumer", "header-only") + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - def requirements(self): - self.requires("librdkafka/1.8.2") + @property + def _min_cppstd(self): + return 17 @property - def _source_subfolder(self): - return "source_subfolder" + def _compilers_minimum_version(self): + return { + "gcc": "8", + "clang": "7", + "apple-clang": "12", + } - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("librdkafka/1.9.2") + + def package_id(self): + self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 17) + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 192) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) - def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*.h", dst="include", src=os.path.join(self._source_subfolder, "include")) + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def package_id(self): - self.info.header_only() + + 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"), + ) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "ModernCppKafka") self.cpp_info.set_property("cmake_target_name", "ModernCppKafka::ModernCppKafka") self.cpp_info.names["cmake_find_package"] = "ModernCppKafka" diff --git a/recipes/modern-cpp-kafka/all/test_package/CMakeLists.txt b/recipes/modern-cpp-kafka/all/test_package/CMakeLists.txt index 0d36924d633dab..e00b58eaa47439 100644 --- a/recipes/modern-cpp-kafka/all/test_package/CMakeLists.txt +++ b/recipes/modern-cpp-kafka/all/test_package/CMakeLists.txt @@ -1,12 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -set(CMAKE_CXX_STANDARD 17) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(ModernCppKafka REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ModernCppKafka::ModernCppKafka) +target_link_libraries(${PROJECT_NAME} PRIVATE ModernCppKafka::ModernCppKafka) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/modern-cpp-kafka/all/test_package/conanfile.py b/recipes/modern-cpp-kafka/all/test_package/conanfile.py index 81a08015e01f11..b9d7f11e89dcdd 100644 --- a/recipes/modern-cpp-kafka/all/test_package/conanfile.py +++ b/recipes/modern-cpp-kafka/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake -from conan.tools.build import cross_building +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +20,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/modern-cpp-kafka/all/test_v1_package/CMakeLists.txt b/recipes/modern-cpp-kafka/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/modern-cpp-kafka/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/modern-cpp-kafka/all/test_v1_package/conanfile.py b/recipes/modern-cpp-kafka/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/modern-cpp-kafka/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/modern-cpp-kafka/config.yml b/recipes/modern-cpp-kafka/config.yml index 7826a4cd0db75c..bc103feea50903 100644 --- a/recipes/modern-cpp-kafka/config.yml +++ b/recipes/modern-cpp-kafka/config.yml @@ -1,4 +1,6 @@ versions: + "2022.12.07": + folder: all "2022.10.12": folder: all "2022.08.01": diff --git a/recipes/mold/all/conandata.yml b/recipes/mold/all/conandata.yml index b90f73007307fe..1a021caadcd5c8 100644 --- a/recipes/mold/all/conandata.yml +++ b/recipes/mold/all/conandata.yml @@ -5,3 +5,9 @@ sources: "1.5.1": url: "https://github.com/rui314/mold/archive/refs/tags/v1.5.1.tar.gz" sha256: "ec94aa74758f1bc199a732af95c6304ec98292b87f2f4548ce8436a7c5b054a1" + "1.7.1": + url: "https://github.com/rui314/mold/archive/refs/tags/v1.7.1.tar.gz" + sha256: "fa2558664db79a1e20f09162578632fa856b3cde966fbcb23084c352b827dfa9" + "1.8.0": + url: "https://github.com/rui314/mold/archive/refs/tags/v1.8.0.tar.gz" + sha256: "7210225478796c2528aae30320232a5a3b93a640292575a8c55aa2b140041b5c" diff --git a/recipes/mold/all/conanfile.py b/recipes/mold/all/conanfile.py index fde5b3dec32935..7a48206ed37826 100644 --- a/recipes/mold/all/conanfile.py +++ b/recipes/mold/all/conanfile.py @@ -23,6 +23,8 @@ class MoldConan(ConanFile): } def validate(self): + #TODO most of these checks should run on validate_build, but the conan-center hooks are broken and fail the PR because they + # think we're raising on the build() method if self.settings.build_type == "Debug": raise ConanInvalidConfiguration('Mold is a build tool, specify mold:build_type=Release in your build profile, see https://github.com/conan-io/conan-center-index/pull/11536#issuecomment-1195607330') if self.settings.compiler in ["gcc", "clang", "intel-cc"] and self.settings.compiler.libcxx != "libstdc++11": @@ -42,11 +44,8 @@ def layout(self): def package_id(self): del self.info.settings.compiler - def build_requirements(self): - self.tool_requires("cmake/3.24.1") - def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") self.requires("openssl/1.1.1q") self.requires("xxhash/0.8.1") self.requires("onetbb/2021.3.0") @@ -62,12 +61,14 @@ def generate(self): tc.variables["MOLD_USE_MIMALLOC"] = self.options.with_mimalloc tc.variables["MOLD_USE_SYSTEM_MIMALLOC"] = True tc.variables["MOLD_USE_SYSTEM_TBB"] = True + tc.variables["CMAKE_INSTALL_LIBEXECDIR"] = "libexec" tc.generate() cd = CMakeDeps(self) cd.generate() - tc = VirtualBuildEnv(self) - tc.generate() + + vbe = VirtualBuildEnv(self) + vbe.generate() def build(self): cmake = CMake(self) @@ -81,10 +82,10 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) rmdir(self, os.path.join(self.package_folder, "share")) - + def package_info(self): bindir = os.path.join(self.package_folder, "bin") - mold_location = os.path.join(bindir, "bindir") + mold_location = os.path.join(bindir, "mold") self.output.info('Appending PATH environment variable: {}'.format(bindir)) self.env_info.PATH.append(bindir) diff --git a/recipes/mold/config.yml b/recipes/mold/config.yml index 73995b17f00b1c..7461d58f360be9 100644 --- a/recipes/mold/config.yml +++ b/recipes/mold/config.yml @@ -5,3 +5,7 @@ versions: folder: all "1.5.1": folder: all + "1.7.1": + folder: all + "1.8.0": + folder: all diff --git a/recipes/moltenvk/all/conandata.yml b/recipes/moltenvk/all/conandata.yml index 2f8e73cdf66130..f9cb951dc30544 100644 --- a/recipes/moltenvk/all/conandata.yml +++ b/recipes/moltenvk/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.2.1": + url: "https://github.com/KhronosGroup/MoltenVK/archive/refs/tags/v1.2.1.tar.gz" + sha256: "4742df8f35473c5a737f2b120ae06aa6b9e8a7a3753b88932e501b06b1d17ea8" "1.2.0": url: "https://github.com/KhronosGroup/MoltenVK/archive/refs/tags/v1.2.0.tar.gz" sha256: "6e7af2dad0530b2b404480dbe437ca4670c6615cc2ec6cf6a20ed04d9d75e0bd" @@ -33,9 +36,8 @@ patches: "1.2.0": - patch_file: "patches/1.2.0-0001-fix-version-number-icd-json.patch" patch_description: "Fix api_version in MoltenVK_icd.json" - patch_type: "backport" + patch_type: "portability" patch_source: "https://github.com/KhronosGroup/MoltenVK/pull/1747" - sha256: "80387a47d24c12b538bdcb60d6aa7c402af0800519ce55385abdfbf3d304ee07" "1.1.11": - patch_file: "patches/1.1.11-0001-vulkan-alias-private-extern.patch" patch_description: "Fix vulkan alias symbols when vulkan symbols are hidden" diff --git a/recipes/moltenvk/all/conanfile.py b/recipes/moltenvk/all/conanfile.py index 1bdfb7c033f013..cc911daf940adc 100644 --- a/recipes/moltenvk/all/conanfile.py +++ b/recipes/moltenvk/all/conanfile.py @@ -103,14 +103,14 @@ def package_id(self): self.compatible_packages.append(compatible_pkg) def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._min_cppstd) - if self.info.settings.os not in ["Macos", "iOS", "tvOS"]: + if self.settings.os not in ["Macos", "iOS", "tvOS"]: raise ConanInvalidConfiguration(f"{self.ref} only supported on MacOS, iOS and tvOS") - if self.info.settings.compiler != "apple-clang": + if self.settings.compiler != "apple-clang": raise ConanInvalidConfiguration(f"{self.ref} requires apple-clang") if Version(self.version) >= "1.0.42": - if Version(self.info.settings.compiler.version) < "12.0": + if Version(self.settings.compiler.version) < "12.0": raise ConanInvalidConfiguration(f"{self.ref} requires XCode 12.0 or higher at build time") def validate_build(self): @@ -162,8 +162,10 @@ def package_info(self): if self.options.shared: moltenvk_icd_path = os.path.join(self.package_folder, "lib", "MoltenVK_icd.json") + self.runenv_info.prepend_path("VK_DRIVER_FILES", moltenvk_icd_path) self.runenv_info.prepend_path("VK_ICD_FILENAMES", moltenvk_icd_path) # TODO: to remove after conan v2, it allows to not break consumers still relying on virtualenv generator + self.env_info.VK_DRIVER_FILES.append(moltenvk_icd_path) self.env_info.VK_ICD_FILENAMES.append(moltenvk_icd_path) if self.options.tools: diff --git a/recipes/moltenvk/all/dependencies/dependencies-1.2.1.yml b/recipes/moltenvk/all/dependencies/dependencies-1.2.1.yml new file mode 100644 index 00000000000000..ba333592e01993 --- /dev/null +++ b/recipes/moltenvk/all/dependencies/dependencies-1.2.1.yml @@ -0,0 +1,4 @@ +glslang: "1.3.236.0" +spirv-cross: "1.3.236.0" +spirv-tools: "1.3.236.0" +vulkan-headers: "1.3.236.0" diff --git a/recipes/moltenvk/config.yml b/recipes/moltenvk/config.yml index df5b0f8614cc4e..2199e02c929060 100644 --- a/recipes/moltenvk/config.yml +++ b/recipes/moltenvk/config.yml @@ -1,4 +1,6 @@ versions: + "1.2.1": + folder: all "1.2.0": folder: all "1.1.11": diff --git a/recipes/mongo-c-driver/all/conandata.yml b/recipes/mongo-c-driver/all/conandata.yml index 2546c26f4700e2..be9c59fe3dc4da 100644 --- a/recipes/mongo-c-driver/all/conandata.yml +++ b/recipes/mongo-c-driver/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.23.2": + url: "https://github.com/mongodb/mongo-c-driver/releases/download/1.23.2/mongo-c-driver-1.23.2.tar.gz" + sha256: "123c358827eea07cd76a31c40281bb1c81b6744f6587c96d0cf217be8b1234e3" + "1.22.2": + url: "https://github.com/mongodb/mongo-c-driver/releases/download/1.22.2/mongo-c-driver-1.22.2.tar.gz" + sha256: "2e59b9d38d600bd63ccc0b215dd44c6254a66eeb8085a5ac513748cd6220532e" "1.22.0": url: "https://github.com/mongodb/mongo-c-driver/releases/download/1.22.0/mongo-c-driver-1.22.0.tar.gz" sha256: "272067f75e7e57c98f90a6f0c42500ef818b4b085539343676b6ce6831655eaf" @@ -15,15 +21,49 @@ sources: url: "https://github.com/mongodb/mongo-c-driver/releases/download/1.17.2/mongo-c-driver-1.17.2.tar.gz" sha256: "bc53d5f72ab628a1ae549db6888325d6dc34db3ca31c5e16e550c1bb4266d864" patches: + "1.23.2": + - patch_file: "patches/1.23.2-0001-disable-shared-when-static.patch" + patch_description: "separate static and shared builds" + patch_type: "conan" + - patch_file: "patches/1.22.0-0002-fix-uninitialized-warning.patch" + patch_description: "fix uninitialized variable warning" + patch_type: "portability" + - patch_file: "patches/1.22.0-0003-disable-warning-errors.patch" + patch_description: "disable compiler flags to make warnings into errors" + patch_type: "conan" + "1.22.2": + - patch_file: "patches/1.22.0-0001-disable-shared-when-static.patch" + patch_description: "separate static and shared builds" + patch_type: "conan" + - patch_file: "patches/1.22.0-0002-fix-uninitialized-warning.patch" + patch_description: "fix uninitialized variable warning" + patch_type: "portability" + - patch_file: "patches/1.22.0-0003-disable-warning-errors.patch" + patch_description: "disable compiler flags to make warnings into errors" + patch_type: "conan" "1.22.0": - patch_file: "patches/1.22.0-0001-disable-shared-when-static.patch" + patch_description: "separate static and shared builds" + patch_type: "conan" - patch_file: "patches/1.22.0-0002-fix-uninitialized-warning.patch" + patch_description: "fix uninitialized variable warning" + patch_type: "portability" - patch_file: "patches/1.22.0-0003-disable-warning-errors.patch" + patch_description: "disable compiler flags to make warnings into errors" + patch_type: "conan" "1.17.6": - patch_file: "patches/1.17.6-0001-disable-shared-when-static.patch" + patch_description: "separate static and shared builds" + patch_type: "conan" "1.17.4": - patch_file: "patches/1.17.2-0001-disable-shared-when-static.patch" + patch_description: "separate static and shared builds" + patch_type: "conan" "1.17.3": - patch_file: "patches/1.17.2-0001-disable-shared-when-static.patch" + patch_description: "separate static and shared builds" + patch_type: "conan" "1.17.2": - patch_file: "patches/1.17.2-0001-disable-shared-when-static.patch" + patch_description: "separate static and shared builds" + patch_type: "conan" diff --git a/recipes/mongo-c-driver/all/conanfile.py b/recipes/mongo-c-driver/all/conanfile.py index e77d7e3ce949cf..71ed6d84f36274 100644 --- a/recipes/mongo-c-driver/all/conanfile.py +++ b/recipes/mongo-c-driver/all/conanfile.py @@ -77,7 +77,7 @@ def requirements(self): if self.options.with_zstd: self.requires("zstd/1.5.2") if self.options.with_icu: - self.requires("icu/71.1") + self.requires("icu/72.1") def validate(self): if self.info.options.with_ssl == "darwin" and not is_apple_os(self.settings.os): diff --git a/recipes/mongo-c-driver/all/patches/1.23.2-0001-disable-shared-when-static.patch b/recipes/mongo-c-driver/all/patches/1.23.2-0001-disable-shared-when-static.patch new file mode 100644 index 00000000000000..1b39914f6b9213 --- /dev/null +++ b/recipes/mongo-c-driver/all/patches/1.23.2-0001-disable-shared-when-static.patch @@ -0,0 +1,82 @@ +diff --git a/src/libbson/CMakeLists.txt b/src/libbson/CMakeLists.txt +index d6df66f..dccdfee 100644 +--- a/src/libbson/CMakeLists.txt ++++ b/src/libbson/CMakeLists.txt +@@ -209,6 +209,7 @@ set (HEADERS_FORWARDING + ${PROJECT_SOURCE_DIR}/src/bson/forwarding/bson.h + ) + ++if (NOT MONGOC_ENABLE_STATIC_BUILD) + add_library (bson_shared SHARED ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING}) + set (CMAKE_CXX_VISIBILITY_PRESET hidden) + target_compile_definitions (bson_shared +@@ -275,6 +276,7 @@ if (WIN32) + # must be handled specially since we can't resolve them + set (BSON_SYSTEM_LIBRARIES ${BSON_SYSTEM_LIBRARIES} ws2_32) + endif () ++endif() + + if (MONGOC_ENABLE_STATIC_BUILD) + add_library (bson_static STATIC ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING}) +@@ -349,7 +351,7 @@ set (BSON_HEADER_INSTALL_DIR + ) + + if (MONGOC_ENABLE_STATIC_INSTALL) +- set (TARGETS_TO_INSTALL bson_shared bson_static) ++ set (TARGETS_TO_INSTALL bson_static) + else () + set (TARGETS_TO_INSTALL bson_shared) + endif () +diff --git a/src/libmongoc/CMakeLists.txt b/src/libmongoc/CMakeLists.txt +index 39f66ac..3f4eefc 100644 +--- a/src/libmongoc/CMakeLists.txt ++++ b/src/libmongoc/CMakeLists.txt +@@ -758,6 +758,7 @@ if (MONGOC_ENABLE_MONGODB_AWS_AUTH) + endif() + endif () + ++if (NOT MONGOC_ENABLE_STATIC_BUILD) + add_library (mongoc_shared SHARED ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING}) + set_target_properties (mongoc_shared PROPERTIES CMAKE_CXX_VISIBILITY_PRESET hidden) + target_link_libraries (mongoc_shared PRIVATE ${LIBRARIES} PUBLIC ${BSON_LIBRARIES}) +@@ -795,6 +796,7 @@ target_include_directories ( + + set_target_properties (mongoc_shared PROPERTIES VERSION 0.0.0 SOVERSION 0) + set_target_properties (mongoc_shared PROPERTIES OUTPUT_NAME "${MONGOC_OUTPUT_BASENAME}-${MONGOC_API_VERSION}") ++endif() + + if (MONGOC_ENABLE_STATIC_BUILD) + add_library (mongoc_static STATIC ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING}) +@@ -835,6 +837,7 @@ if (MONGOC_ENABLE_STATIC_BUILD) + set_target_properties (mongoc_static PROPERTIES OUTPUT_NAME "${MONGOC_OUTPUT_BASENAME}-static-${MONGOC_API_VERSION}") + endif () + ++if (NOT MONGOC_ENABLE_STATIC_BUILD) + if (ENABLE_APPLE_FRAMEWORK) + set_target_properties (mongoc_shared PROPERTIES + FRAMEWORK TRUE +@@ -845,9 +848,15 @@ if (ENABLE_APPLE_FRAMEWORK) + PUBLIC_HEADER "${HEADERS}" + ) + endif () ++endif() + + add_executable (mongoc-stat ${PROJECT_SOURCE_DIR}/../../src/tools/mongoc-stat.c) ++if (NOT MONGOC_ENABLE_STATIC_BUILD) + target_link_libraries (mongoc-stat mongoc_shared ${LIBRARIES}) ++else () ++target_link_libraries (mongoc-stat mongoc_static ${STATIC_LIBRARIES}) ++endif () ++ + + # mongoc-stat works if shared memory performance counters are enabled. + if (ENABLE_SHM_COUNTERS STREQUAL "ON") +@@ -1128,7 +1137,7 @@ file (COPY ${PROJECT_SOURCE_DIR}/tests/x509gen DESTINATION ${PROJECT_BINARY_DIR} + file (COPY ${PROJECT_SOURCE_DIR}/tests/release_files DESTINATION ${PROJECT_BINARY_DIR}/tests) + + if (MONGOC_ENABLE_STATIC_INSTALL) +- set (TARGETS_TO_INSTALL mongoc_shared mongoc_static) ++ set (TARGETS_TO_INSTALL mongoc_static) + else () + set (TARGETS_TO_INSTALL mongoc_shared) + endif () diff --git a/recipes/mongo-c-driver/config.yml b/recipes/mongo-c-driver/config.yml index 59ca0a1a54b123..1b2d5cda4e3948 100644 --- a/recipes/mongo-c-driver/config.yml +++ b/recipes/mongo-c-driver/config.yml @@ -1,4 +1,8 @@ versions: + "1.23.2": + folder: all + "1.22.2": + folder: all "1.22.0": folder: all "1.17.6": diff --git a/recipes/mozjpeg/all/conanfile.py b/recipes/mozjpeg/all/conanfile.py index 691c801f8bb8ca..3dcf78b0f0e8ea 100644 --- a/recipes/mozjpeg/all/conanfile.py +++ b/recipes/mozjpeg/all/conanfile.py @@ -1,16 +1,17 @@ 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, export_conandata_patches from conan.tools.build import cross_building -from conan.tools.scm import Version -from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" + class MozjpegConan(ConanFile): name = "mozjpeg" @@ -18,7 +19,7 @@ class MozjpegConan(ConanFile): license = ("BSD", "BSD-3-Clause", "ZLIB") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/mozilla/mozjpeg" - topics = ("conan", "image", "format", "mozjpeg", "jpg", "jpeg", "picture", "multimedia", "graphics") + topics = ("image", "format", "mozjpeg", "jpg", "jpeg", "picture", "multimedia", "graphics") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -62,18 +63,9 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") self.provides = ["libjpeg", "libjpeg-turbo"] if self.options.turbojpeg else "libjpeg" @property @@ -87,9 +79,10 @@ def layout(self): basic_layout(self, src_folder='src') def build_requirements(self): - if not self._use_cmake and self.settings.os != "Windows": + if not self._use_cmake: self.tool_requires("libtool/2.4.7") - self.tool_requires("pkgconf/1.7.4") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") if self.options.get_safe("SIMD"): self.tool_requires("nasm/2.15.05") @@ -125,36 +118,31 @@ def generate_cmake(self): tc.variables["WITH_CRT_DLL"] = not is_msvc_static_runtime(self) tc.generate() - tc = CMakeDeps(self) - tc.generate() - def generate_autotools(self): - toolchain = AutotoolsToolchain(self) + tc = AutotoolsToolchain(self) yes_no = lambda v: "yes" if v else "no" - toolchain.configure_args.append("--with-pic={}".format(yes_no(self.options.get_safe("fPIC", True)))) - toolchain.configure_args.append("--with-simd={}".format(yes_no(self.options.get_safe("SIMD", False)))) - toolchain.configure_args.append("--with-arith-enc={}".format(yes_no(self.options.arithmetic_encoder))) - toolchain.configure_args.append("--with-arith-dec={}".format(yes_no(self.options.arithmetic_decoder))) - toolchain.configure_args.append("--with-jpeg7={}".format(yes_no(self.options.libjpeg7_compatibility))) - toolchain.configure_args.append("--with-jpeg8={}".format(yes_no(self.options.libjpeg8_compatibility))) - toolchain.configure_args.append("--with-mem-srcdst={}".format(yes_no(self.options.mem_src_dst))) - toolchain.configure_args.append("--with-turbojpeg={}".format(yes_no(self.options.turbojpeg))) - toolchain.configure_args.append("--with-java={}".format(yes_no(self.options.java))) - toolchain.configure_args.append("--with-12bit={}".format(yes_no(self.options.enable12bit))) - toolchain.generate() - - deps = AutotoolsDeps(self) - deps.generate() + tc.configure_args.extend([ + "--with-pic={}".format(yes_no(self.options.get_safe("fPIC", True))), + "--with-simd={}".format(yes_no(self.options.get_safe("SIMD", False))), + "--with-arith-enc={}".format(yes_no(self.options.arithmetic_encoder)), + "--with-arith-dec={}".format(yes_no(self.options.arithmetic_decoder)), + "--with-jpeg7={}".format(yes_no(self.options.libjpeg7_compatibility)), + "--with-jpeg8={}".format(yes_no(self.options.libjpeg8_compatibility)), + "--with-mem-srcdst={}".format(yes_no(self.options.mem_src_dst)), + "--with-turbojpeg={}".format(yes_no(self.options.turbojpeg)), + "--with-java={}".format(yes_no(self.options.java)), + "--with-12bit={}".format(yes_no(self.options.enable12bit)), + ]) + tc.generate() def generate(self): + env = VirtualBuildEnv(self) + env.generate() if self._use_cmake: self.generate_cmake() else: self.generate_autotools() - tc = VirtualBuildEnv(self) - tc.generate(scope="build") - def build(self): apply_conandata_patches(self) if self._use_cmake: @@ -193,14 +181,32 @@ def _lib_name(self, name): return name def package_info(self): + self.cpp_info.set_property("cmake_find_mode", "both") + self.cpp_info.set_property("cmake_module_file_name", "JPEG") + self.cpp_info.set_property("cmake_file_name", "mozjpeg") + + cmake_target_suffix = "-static" if not self.options.shared else "" + # libjpeg - self.cpp_info.components["libjpeg"].names["pkg_config"] = "libjpeg" + self.cpp_info.components["libjpeg"].set_property("cmake_module_target_name", "JPEG::JPEG") + self.cpp_info.components["libjpeg"].set_property("cmake_target_name", f"mozjpeg::jpeg{cmake_target_suffix}") + self.cpp_info.components["libjpeg"].set_property("pkg_config_name", "libjpeg") self.cpp_info.components["libjpeg"].libs = [self._lib_name("jpeg")] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["libjpeg"].system_libs.append("m") # libturbojpeg if self.options.turbojpeg: - self.cpp_info.components["libturbojpeg"].names["pkg_config"] = "libturbojpeg" + self.cpp_info.components["libturbojpeg"].set_property("cmake_target_name", f"mozjpeg::turbojpeg{cmake_target_suffix}") + self.cpp_info.components["libturbojpeg"].set_property("pkg_config_name", "libturbojpeg") self.cpp_info.components["libturbojpeg"].libs = [self._lib_name("turbojpeg")] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["libturbojpeg"].system_libs.append("m") + + # TODO: to remove in conan v2 + self.cpp_info.names["cmake_find_package"] = "JPEG" + self.cpp_info.names["cmake_find_package_multi"] = "mozjpeg" + self.cpp_info.components["libjpeg"].names["cmake_find_package"] = "JPEG" + self.cpp_info.components["libjpeg"].names["cmake_find_package_multi"] = f"jpeg{cmake_target_suffix}" + if self.options.turbojpeg: + self.cpp_info.components["libturbojpeg"].names["cmake_find_package"] = f"turbojpeg{cmake_target_suffix}" + self.cpp_info.components["libturbojpeg"].names["cmake_find_package_multi"] = f"turbojpeg{cmake_target_suffix}" diff --git a/recipes/mozjpeg/all/test_package/CMakeLists.txt b/recipes/mozjpeg/all/test_package/CMakeLists.txt index 9d43e05ca2a273..43fbdac6cca735 100644 --- a/recipes/mozjpeg/all/test_package/CMakeLists.txt +++ b/recipes/mozjpeg/all/test_package/CMakeLists.txt @@ -1,8 +1,11 @@ -cmake_minimum_required(VERSION 3.8) - -project(test_package C) +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) find_package(mozjpeg REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE mozjpeg::libjpeg) +if(TARGET mozjpeg::jpeg) + target_link_libraries(${PROJECT_NAME} PRIVATE mozjpeg::jpeg) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE mozjpeg::jpeg-static) +endif() diff --git a/recipes/mozjpeg/all/test_package/conanfile.py b/recipes/mozjpeg/all/test_package/conanfile.py index eb44b6270b92df..2494f49b77c0df 100644 --- a/recipes/mozjpeg/all/test_package/conanfile.py +++ b/recipes/mozjpeg/all/test_package/conanfile.py @@ -3,17 +3,18 @@ from conan.tools.cmake import cmake_layout, CMake import os + class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" test_type = "explicit" - def requirements(self): - self.requires(self.tested_reference_str) - def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/mozjpeg/all/test_package_module/CMakeLists.txt b/recipes/mozjpeg/all/test_package_module/CMakeLists.txt new file mode 100644 index 00000000000000..e21fd04d88d98e --- /dev/null +++ b/recipes/mozjpeg/all/test_package_module/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(JPEG REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE JPEG::JPEG) diff --git a/recipes/mozjpeg/all/test_package_module/conanfile.py b/recipes/mozjpeg/all/test_package_module/conanfile.py new file mode 100644 index 00000000000000..fd19bb14250572 --- /dev/null +++ b/recipes/mozjpeg/all/test_package_module/conanfile.py @@ -0,0 +1,27 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + img_name = os.path.join(self.source_folder, os.pardir, "test_package", "testimg.jpg") + self.run(f"{bin_path} {img_name}", env="conanrun") diff --git a/recipes/mozjpeg/all/test_v1_package/CMakeLists.txt b/recipes/mozjpeg/all/test_v1_package/CMakeLists.txt index f4df079837a44a..0d20897301b68b 100644 --- a/recipes/mozjpeg/all/test_v1_package/CMakeLists.txt +++ b/recipes/mozjpeg/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) - -project(test_package C) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(mozjpeg REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE mozjpeg::libjpeg) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/mozjpeg/all/test_v1_package_module/CMakeLists.txt b/recipes/mozjpeg/all/test_v1_package_module/CMakeLists.txt new file mode 100644 index 00000000000000..27f7a57e7a0b3e --- /dev/null +++ b/recipes/mozjpeg/all/test_v1_package_module/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package_module + ${CMAKE_CURRENT_BINARY_DIR}/test_package_module) diff --git a/recipes/mozjpeg/all/test_v1_package_module/conanfile.py b/recipes/mozjpeg/all/test_v1_package_module/conanfile.py new file mode 100644 index 00000000000000..b6600e428515ca --- /dev/null +++ b/recipes/mozjpeg/all/test_v1_package_module/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + img_name = os.path.join(self.source_folder, os.pardir, "test_package", "testimg.jpg") + self.run(f"{bin_path} {img_name}", run_environment=True) diff --git a/recipes/mppp/all/conanfile.py b/recipes/mppp/all/conanfile.py index b81c5b84c795ca..f6d828ae44a497 100644 --- a/recipes/mppp/all/conanfile.py +++ b/recipes/mppp/all/conanfile.py @@ -4,10 +4,11 @@ from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.scm import Version import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class MpppConan(ConanFile): name = "mppp" @@ -25,6 +26,7 @@ class MpppConan(ConanFile): "with_mpc": [True, False], "with_quadmath": [True, False], "with_boost": [True, False], + "with_fmt": [True, False], } default_options = { "shared": False, @@ -34,6 +36,7 @@ class MpppConan(ConanFile): "with_mpc": False, "with_quadmath": False, "with_boost": False, + "with_fmt": False, } @property @@ -49,10 +52,9 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") + if Version(self.version) < "0.27": + del self.options.with_fmt def layout(self): cmake_layout(self, src_folder="src") @@ -64,7 +66,9 @@ def requirements(self): if self.options.with_mpc == True: self.requires("mpc/1.2.0") if self.options.with_boost == True: - self.requires("boost/1.80.0") + self.requires("boost/1.81.0") + if self.options.get_safe("with_fmt"): + self.requires("fmt/9.1.0") def validate(self): if self.settings.compiler.get_safe("cppstd"): @@ -88,10 +92,11 @@ def generate(self): tc.variables["MPPP_WITH_MPC"] = self.options.with_mpc tc.variables["MPPP_WITH_QUADMATH"] = self.options.with_quadmath tc.variables["MPPP_WITH_BOOST_S11N"] = self.options.with_boost + if Version(self.version) >= "0.27": + tc.variables["MPPP_WITH_FMT"] = self.options.with_fmt if not self.options.shared: tc.variables["MPPP_BUILD_STATIC_LIBRARY_WITH_DYNAMIC_MSVC_RUNTIME"] = not is_msvc_static_runtime(self) tc.generate() - deps = CMakeDeps(self) deps.generate() @@ -115,6 +120,9 @@ def package_info(self): if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") + if self.options.get_safe("with_fmt"): + self.cpp_info.defines.append("MPPP_WITH_FMT") + # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.filenames["cmake_find_package"] = "mp++" self.cpp_info.filenames["cmake_find_package_multi"] = "mp++" diff --git a/recipes/msdfgen/all/CMakeLists.txt b/recipes/msdfgen/all/CMakeLists.txt deleted file mode 100644 index 361b35d4c17d9a..00000000000000 --- a/recipes/msdfgen/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/msdfgen/all/conandata.yml b/recipes/msdfgen/all/conandata.yml index 68280085d13a48..f43fd3e983ea60 100644 --- a/recipes/msdfgen/all/conandata.yml +++ b/recipes/msdfgen/all/conandata.yml @@ -6,6 +6,15 @@ sources: url: "https://github.com/Chlumsky/msdfgen/archive/refs/tags/v1.9.tar.gz" sha256: "909eb88c71268dc00cdda244a1fa40a0feefae45f68a779fbfddd5463559fa40" patches: + "1.9.1": + - patch_file: "patches/1.9-0001-unvendor-external-libs.patch" + patch_description: "Use external libs from conan instead of vendored ones" + patch_type: "conan" "1.9": - - patch_file: "patches/0001-fix-install-bundle.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.9-0001-unvendor-external-libs.patch" + patch_description: "Use external libs from conan instead of vendored ones" + patch_type: "conan" + - patch_file: "patches/1.9-0002-fix-install-bundle.patch" + patch_description: "Fix installation in iOS/tvOS/watchOS" + patch_type: "portability" + patch_source: "https://github.com/Chlumsky/msdfgen/pull/125" diff --git a/recipes/msdfgen/all/conanfile.py b/recipes/msdfgen/all/conanfile.py index 039af25baae112..fa5bc750fd0430 100644 --- a/recipes/msdfgen/all/conanfile.py +++ b/recipes/msdfgen/all/conanfile.py @@ -1,15 +1,19 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir +from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class MsdfgenConan(ConanFile): name = "msdfgen" description = "Multi-channel signed distance field generator" license = "MIT" - topics = ("msdfgen", "msdf", "shape", "glyph", "font") + topics = ("msdf", "shape", "glyph", "font") homepage = "https://github.com/Chlumsky/msdfgen" url = "https://github.com/conan-io/conan-center-index" @@ -29,21 +33,8 @@ class MsdfgenConan(ConanFile): "utility": True, } - 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): - 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,63 +42,67 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("freetype/2.11.1") + self.requires("freetype/2.12.1") self.requires("lodepng/cci.20200615") self.requires("tinyxml2/9.0.0") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - if self._is_msvc and self.options.shared: - raise ConanInvalidConfiguration("msdfgen shared not supported by Visual Studio") + check_min_cppstd(self, 11) + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} shared not supported by Visual Studio") if self.options.with_skia: raise ConanInvalidConfiguration("skia recipe not available yet in CCI") 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["MSDFGEN_BUILD_MSDFGEN_STANDALONE"] = self.options.utility + tc.variables["MSDFGEN_USE_OPENMP"] = self.options.with_openmp + tc.variables["MSDFGEN_USE_CPP11"] = True + tc.variables["MSDFGEN_USE_SKIA"] = self.options.with_skia + tc.variables["MSDFGEN_INSTALL"] = True + tc.generate() + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") - # unvendor lodepng & tinyxml2 - tools.rmdir(os.path.join(self._source_subfolder, "lib")) - tools.replace_in_file(cmakelists, "\"lib/*.cpp\"", "") - tools.replace_in_file(cmakelists, - "target_link_libraries(msdfgen-ext PUBLIC msdfgen::msdfgen Freetype::Freetype)", - "target_link_libraries(msdfgen-ext PUBLIC msdfgen::msdfgen ${CONAN_LIBS})") + apply_conandata_patches(self) + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + # workaround against CMAKE_FIND_PACKAGE_PREFER_CONFIG ON in conan toolchain + replace_in_file(self, cmakelists, "find_package(Freetype REQUIRED)", "find_package(Freetype REQUIRED MODULE)") + # remove bundled lodepng & tinyxml2 + rmdir(self, os.path.join(self.source_folder, "lib")) + rmdir(self, os.path.join(self.source_folder, "include")) # very weird but required for Visual Studio when libs are unvendored (at least for Ninja generator) - if self._is_msvc: - tools.replace_in_file(cmakelists, - "set_target_properties(msdfgen-standalone PROPERTIES ARCHIVE_OUTPUT_DIRECTORY archive OUTPUT_NAME msdfgen)", - "set_target_properties(msdfgen-standalone PROPERTIES OUTPUT_NAME msdfgen IMPORT_PREFIX foo)") - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["MSDFGEN_BUILD_MSDFGEN_STANDALONE"] = self.options.utility - self._cmake.definitions["MSDFGEN_USE_OPENMP"] = self.options.with_openmp - self._cmake.definitions["MSDFGEN_USE_CPP11"] = True - self._cmake.definitions["MSDFGEN_USE_SKIA"] = self.options.with_skia - self._cmake.definitions["MSDFGEN_INSTALL"] = True - self._cmake.configure() - return self._cmake + if is_msvc(self): + replace_in_file( + self, + cmakelists, + "set_target_properties(msdfgen-standalone PROPERTIES ARCHIVE_OUTPUT_DIRECTORY archive OUTPUT_NAME msdfgen)", + "set_target_properties(msdfgen-standalone PROPERTIES OUTPUT_NAME msdfgen IMPORT_PREFIX foo)", + ) def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "msdfgen") diff --git a/recipes/msdfgen/all/patches/1.9-0001-unvendor-external-libs.patch b/recipes/msdfgen/all/patches/1.9-0001-unvendor-external-libs.patch new file mode 100644 index 00000000000000..825ea34d6cfdfe --- /dev/null +++ b/recipes/msdfgen/all/patches/1.9-0001-unvendor-external-libs.patch @@ -0,0 +1,29 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -39,8 +39,6 @@ file(GLOB_RECURSE msdfgen-ext_PRIVATE_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DI + + file(GLOB_RECURSE msdfgen-ext_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + "ext/*.cpp" +- "lib/*.cpp" +- "lib/*.cpp" + ) + + # Build the library (aliased name because it's the same target name the exe) +@@ -86,14 +84,14 @@ add_library(msdfgen::msdfgen-ext ALIAS msdfgen-ext) + set_target_properties(msdfgen-ext PROPERTIES + PUBLIC_HEADER "${msdfgen-ext_PUBLIC_HEADERS}" + ) +-target_link_libraries(msdfgen-ext PUBLIC msdfgen::msdfgen Freetype::Freetype) ++find_package(lodepng REQUIRED CONFIG) ++find_package(tinyxml2 REQUIRED CONFIG) ++target_link_libraries(msdfgen-ext PUBLIC msdfgen::msdfgen Freetype::Freetype lodepng::lodepng tinyxml2::tinyxml2) + target_include_directories(msdfgen-ext + PUBLIC + $ + $ + +-PRIVATE +- ${CMAKE_CURRENT_SOURCE_DIR}/include + ) + + target_compile_definitions(msdfgen-ext PUBLIC MSDFGEN_CMAKE_BUILD) diff --git a/recipes/msdfgen/all/patches/0001-fix-install-bundle.patch b/recipes/msdfgen/all/patches/1.9-0002-fix-install-bundle.patch similarity index 88% rename from recipes/msdfgen/all/patches/0001-fix-install-bundle.patch rename to recipes/msdfgen/all/patches/1.9-0002-fix-install-bundle.patch index 195cb3e50f2fe8..70618310fd7673 100644 --- a/recipes/msdfgen/all/patches/0001-fix-install-bundle.patch +++ b/recipes/msdfgen/all/patches/1.9-0002-fix-install-bundle.patch @@ -1,6 +1,6 @@ --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -170,7 +170,7 @@ if(MSDFGEN_INSTALL) +@@ -168,7 +168,7 @@ if(MSDFGEN_INSTALL) ) if(MSDFGEN_BUILD_MSDFGEN_STANDALONE) diff --git a/recipes/msdfgen/all/test_package/CMakeLists.txt b/recipes/msdfgen/all/test_package/CMakeLists.txt index 21c326b4889f27..6016e8cfe3244f 100644 --- a/recipes/msdfgen/all/test_package/CMakeLists.txt +++ b/recipes/msdfgen/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(msdfgen REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} msdfgen::msdfgen msdfgen::msdfgen-ext) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE msdfgen::msdfgen msdfgen::msdfgen-ext) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/msdfgen/all/test_package/conanfile.py b/recipes/msdfgen/all/test_package/conanfile.py index 5a0706c8f6c9c0..c4fdfb4dbdc982 100644 --- a/recipes/msdfgen/all/test_package/conanfile.py +++ b/recipes/msdfgen/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") ttf_path = os.path.join(self.source_folder, "OpenSans-Bold.ttf") - bin_path = os.path.join("bin", "test_package") - self.run("{0} {1}".format(bin_path, ttf_path), run_environment=True) + self.run(f"{bin_path} {ttf_path}", env="conanrun") diff --git a/recipes/msdfgen/all/test_v1_package/CMakeLists.txt b/recipes/msdfgen/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/msdfgen/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/msdfgen/all/test_v1_package/conanfile.py b/recipes/msdfgen/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..7b775db727c08e --- /dev/null +++ b/recipes/msdfgen/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + ttf_path = os.path.join(self.source_folder, os.pardir, "test_package", "OpenSans-Bold.ttf") + self.run(f"{bin_path} {ttf_path}", run_environment=True) diff --git a/recipes/msys2/all/conanfile.py b/recipes/msys2/all/conanfile.py index 335f7da9b6296c..3025b93ffd61d1 100644 --- a/recipes/msys2/all/conanfile.py +++ b/recipes/msys2/all/conanfile.py @@ -47,12 +47,12 @@ class MSYS2Conan(ConanFile): license = "MSYS license" topics = ("msys", "unix", "subsystem") - settings = "os", "arch", "compiler", "build_type" + settings = "os", "arch" # "exclude_files" "packages" "additional_packages" values are a comma separated list options = { "exclude_files": ["ANY"], "packages": ["ANY"], - "additional_packages": ["ANY"], + "additional_packages": [None, "ANY"], } default_options = { "exclude_files": "*/link.exe", @@ -62,14 +62,10 @@ class MSYS2Conan(ConanFile): short_paths = True - def package_id(self): - del self.info.settings.compiler - del self.info.settings.build_type - def validate(self): - if self.info.settings.os != "Windows": + if self.settings.os != "Windows": raise ConanInvalidConfiguration("Only Windows supported") - if self.info.settings.arch != "x86_64": + if self.settings.arch != "x86_64": raise ConanInvalidConfiguration("Only Windows x64 supported") def source(self): diff --git a/recipes/msys2/all/test_package/conanfile.py b/recipes/msys2/all/test_package/conanfile.py index 93ee00629e591f..fa7d81b8ee739c 100644 --- a/recipes/msys2/all/test_package/conanfile.py +++ b/recipes/msys2/all/test_package/conanfile.py @@ -4,7 +4,7 @@ class TestPackageConan(ConanFile): - settings = "os", "arch", "compiler", "build_type" + settings = "os", "arch" generators = "VirtualBuildEnv" test_type = "explicit" @@ -30,6 +30,6 @@ def test(self): self.run('bash.exe -c ^"! test -f /usr/bin/link^"') output = StringIO() - self.run('bash.exe -c "echo $PKG_CONFIG_PATH"', output=output) + self.run('bash.exe -c "echo $PKG_CONFIG_PATH"', output) print(output.getvalue()) assert self._secret_value in output.getvalue() diff --git a/recipes/nanobench/all/conandata.yml b/recipes/nanobench/all/conandata.yml index b2980ea2da2118..35db0353ebb57f 100644 --- a/recipes/nanobench/all/conandata.yml +++ b/recipes/nanobench/all/conandata.yml @@ -1,16 +1,26 @@ sources: - "4.0.0": - url: "https://github.com/martinus/nanobench/archive/v4.0.0.tar.gz" - sha256: 34b9bbfc7bf3bc30599f3b7cb398455539edb8ea67930aaef22b707f1ad3824f - "4.3.0": - url: "https://github.com/martinus/nanobench/archive/v4.3.0.tar.gz" - sha256: 6cf97e940eca42394f64d4e9d341e72804c92575247269695beb24f7e2539e82 - "4.3.5": - url: "https://github.com/martinus/nanobench/archive/v4.3.5.tar.gz" - sha256: "205e6cf0ea901f64af971335bfe8011c1f6bd66f6ae678c616da0eddfbe70437" - "4.3.6": - url: "https://github.com/martinus/nanobench/archive/v4.3.6.tar.gz" - sha256: "cfa223fefca8752c0c96416f3440a9b02219f4695a8307db7e8c7054aaed7f01" + "4.3.9": + url: "https://github.com/martinus/nanobench/archive/v4.3.9.tar.gz" + sha256: "4a7fd8fdd5819e4d1c34ae558df010a0ccf36db0508c41c51cd0181bc04c6356" "4.3.7": url: "https://github.com/martinus/nanobench/archive/v4.3.7.tar.gz" sha256: "6a2dadb8230370c7fb7a9362be1c3677e44d8e06193a4ecb489a4748ef9483d7" + "4.3.6": + url: "https://github.com/martinus/nanobench/archive/v4.3.6.tar.gz" + sha256: "cfa223fefca8752c0c96416f3440a9b02219f4695a8307db7e8c7054aaed7f01" + "4.3.5": + url: "https://github.com/martinus/nanobench/archive/v4.3.5.tar.gz" + sha256: "205e6cf0ea901f64af971335bfe8011c1f6bd66f6ae678c616da0eddfbe70437" + "4.3.0": + url: "https://github.com/martinus/nanobench/archive/v4.3.0.tar.gz" + sha256: "6cf97e940eca42394f64d4e9d341e72804c92575247269695beb24f7e2539e82" + "4.0.0": + url: "https://github.com/martinus/nanobench/archive/v4.0.0.tar.gz" + sha256: "34b9bbfc7bf3bc30599f3b7cb398455539edb8ea67930aaef22b707f1ad3824f" + +patches: + "4.3.9": + - patch_file: "patches/4.3.9-0001-support-older-msvc.patch" + patch_description: "fix compilation error on msvc < 1928" + patch_type: "portability" + patch_source: "https://github.com/martinus/nanobench/pull/82" diff --git a/recipes/nanobench/all/conanfile.py b/recipes/nanobench/all/conanfile.py index 19c1a77a013b1f..67a58bc871cff0 100644 --- a/recipes/nanobench/all/conanfile.py +++ b/recipes/nanobench/all/conanfile.py @@ -1,33 +1,53 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy, export_conandata_patches, apply_conandata_patches +from conan.tools.layout import basic_layout import os -import glob -from conans import ConanFile, tools +required_conan_version = ">=1.52.0" class NanobenchConan(ConanFile): name = "nanobench" description = """ankerl::nanobench is a platform independent microbenchmarking library for C++11/14/17/20.""" - topics = ("conan", "nanobench", "benchmark", "microbenchmark") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/martinus/nanobench" - license = "MIT" - no_copy_source = True + topics = ("benchmark", "microbenchmark", "header-only") + settings = "os", "arch", "compiler", "build_type" @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob(self.name + "-*/")[0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def build(self): + apply_conandata_patches(self) def package(self): - include_folder = os.path.join( - self._source_subfolder, os.path.join("src", "include")) - self.copy(pattern="LICENSE", dst="licenses", - src=self._source_subfolder) - self.copy(pattern="*.h", dst="include", src=include_folder) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "src", "include"), + ) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/nanobench/all/patches/4.3.9-0001-support-older-msvc.patch b/recipes/nanobench/all/patches/4.3.9-0001-support-older-msvc.patch new file mode 100644 index 00000000000000..f7d7dccdcefd75 --- /dev/null +++ b/recipes/nanobench/all/patches/4.3.9-0001-support-older-msvc.patch @@ -0,0 +1,51 @@ +diff --git a/src/include/nanobench.h b/src/include/nanobench.h +index c03d9ad..30f7353 100644 +--- a/src/include/nanobench.h ++++ b/src/include/nanobench.h +@@ -405,7 +405,11 @@ struct Config { + Config& operator=(Config const&); + Config& operator=(Config&&); + Config(Config const&); ++#if defined(_MSC_VER) && _MSC_VER < 1928 ++ Config(Config&&); ++#else + Config(Config&&) noexcept; ++#endif + }; + ANKERL_NANOBENCH(IGNORE_PADDED_POP) + +@@ -431,7 +435,11 @@ public: + Result& operator=(Result const&); + Result& operator=(Result&&); + Result(Result const&); ++#if defined(_MSC_VER) && _MSC_VER < 1928 ++ Result(Result&&); ++#else + Result(Result&&) noexcept; ++#endif + + // adds new measurement results + // all values are scaled by iters (except iters...) +@@ -2854,14 +2862,22 @@ Config::~Config() = default; + Config& Config::operator=(Config const&) = default; + Config& Config::operator=(Config&&) = default; + Config::Config(Config const&) = default; ++#if defined(_MSC_VER) && _MSC_VER < 1928 ++Config::Config(Config&&) = default; ++#else + Config::Config(Config&&) noexcept = default; ++#endif + + // provide implementation here so it's only generated once + Result::~Result() = default; + Result& Result::operator=(Result const&) = default; + Result& Result::operator=(Result&&) = default; + Result::Result(Result const&) = default; ++#if defined(_MSC_VER) && _MSC_VER < 1928 ++Result::Result(Result&&) = default; ++#else + Result::Result(Result&&) noexcept = default; ++#endif + + namespace detail { + template diff --git a/recipes/nanobench/all/test_package/CMakeLists.txt b/recipes/nanobench/all/test_package/CMakeLists.txt index 829b5ca81b9ceb..39d04ec4c71041 100644 --- a/recipes/nanobench/all/test_package/CMakeLists.txt +++ b/recipes/nanobench/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(nanobench REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE nanobench::nanobench) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/nanobench/all/test_package/conanfile.py b/recipes/nanobench/all/test_package/conanfile.py index bd7165a553cf41..e845ae751a3017 100644 --- a/recipes/nanobench/all/test_package/conanfile.py +++ b/recipes/nanobench/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/nanobench/all/test_v1_package/CMakeLists.txt b/recipes/nanobench/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/nanobench/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/nanobench/all/test_v1_package/conanfile.py b/recipes/nanobench/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/nanobench/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/nanobench/config.yml b/recipes/nanobench/config.yml index a48eba85edbb2c..e4f35b37cfb39a 100644 --- a/recipes/nanobench/config.yml +++ b/recipes/nanobench/config.yml @@ -1,11 +1,13 @@ versions: - "4.0.0": + "4.3.9": folder: "all" - "4.3.0": + "4.3.7": + folder: "all" + "4.3.6": folder: "all" "4.3.5": folder: "all" - "4.3.6": + "4.3.0": folder: "all" - "4.3.7": + "4.0.0": folder: "all" diff --git a/recipes/netcdf/all/CMakeLists.txt b/recipes/netcdf/all/CMakeLists.txt deleted file mode 100644 index bd3083b512cb93..00000000000000 --- a/recipes/netcdf/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/netcdf/all/conandata.yml b/recipes/netcdf/all/conandata.yml index b00014281bd6c6..c96fc1ea18103d 100644 --- a/recipes/netcdf/all/conandata.yml +++ b/recipes/netcdf/all/conandata.yml @@ -7,12 +7,10 @@ sources: sha256: "bc018cc30d5da402622bf76462480664c6668b55eb16ba205a0dfb8647161dd0" patches: "4.7.4": - - base_path: "source_subfolder" - patch_file: "patches/4.7.4-0001-cmake-subproject.patch" - - base_path: "source_subfolder" - patch_file: "patches/4.7.4-0002-cmake-msvc.patch" - - base_path: "source_subfolder" - patch_file: "patches/4.7.4-0003-cmake-HDF5-cmake-components-wrong.patch" + - patch_file: "patches/4.7.4-0001-fix-cmake.patch" + patch_description: "fixes for cmake target_link_libraries and using deps" + patch_type: "conan" "4.8.1": - - base_path: "source_subfolder" - patch_file: "patches/4.8.1-0001-fix-cmake.patch" + - patch_file: "patches/4.8.1-0001-fix-cmake.patch" + patch_description: "fixes for cmake target_link_libraries and using deps" + patch_type: "conan" diff --git a/recipes/netcdf/all/conanfile.py b/recipes/netcdf/all/conanfile.py index 7a134d470624c6..5078a2341094ad 100644 --- a/recipes/netcdf/all/conanfile.py +++ b/recipes/netcdf/all/conanfile.py @@ -1,7 +1,9 @@ -from conans import CMake, ConanFile, 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, get, copy, rm, rmdir import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class NetcdfConan(ConanFile): @@ -11,7 +13,7 @@ class NetcdfConan(ConanFile): "scientific data access and a freely-distributed software library " "that provides an implementation of the interface." ) - topics = ("unidata", "unidata-netcdf", "networking") + topics = "unidata", "unidata-netcdf", "networking" license = "BSD-3-Clause" homepage = "https://github.com/Unidata/netcdf-c" url = "https://github.com/conan-io/conan-center-index" @@ -36,25 +38,12 @@ class NetcdfConan(ConanFile): "byterange": False, } - generators = "cmake_find_package", "cmake_find_package_multi", "cmake" - _cmake = None - @property def _with_hdf5(self): return self.options.with_hdf5 or self.options.netcdf4 - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -62,13 +51,16 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self._with_hdf5: - if self.version == "4.7.4": + if self.version == "4.7.4" and self.options.byterange: # 4.7.4 was built and tested with hdf5/1.12.0 # It would be nice to upgrade to 1.12.1, # but when the byterange feature is enabled, @@ -76,56 +68,58 @@ def requirements(self): # So we will require the older hdf5 to keep the older behaviour. self.requires("hdf5/1.12.0") else: - self.requires("hdf5/1.12.1") + self.requires("hdf5/1.13.1") if self.options.dap or self.options.byterange: - self.requires("libcurl/7.83.1") + self.requires("libcurl/7.86.0") 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_UTILITIES"] = False - self._cmake.definitions["ENABLE_TESTS"] = False - self._cmake.definitions["ENABLE_FILTER_TESTING"] = False - - self._cmake.definitions["ENABLE_NETCDF_4"] = self.options.netcdf4 - self._cmake.definitions["ENABLE_CDF5"] = self.options.cdf5 - self._cmake.definitions["ENABLE_DAP"] = self.options.dap - self._cmake.definitions["ENABLE_BYTERANGE"] = self.options.byterange - self._cmake.definitions["USE_HDF5"] = self.options.with_hdf5 - self._cmake.definitions["NC_FIND_SHARED_LIBS"] = self.options.with_hdf5 and self.options["hdf5"].shared - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.variables["BUILD_UTILITIES"] = False + tc.variables["ENABLE_TESTS"] = False + tc.variables["ENABLE_FILTER_TESTING"] = False + + tc.variables["ENABLE_NETCDF_4"] = self.options.netcdf4 + tc.variables["ENABLE_CDF5"] = self.options.cdf5 + tc.variables["ENABLE_DAP"] = self.options.dap + tc.variables["ENABLE_BYTERANGE"] = self.options.byterange + tc.variables["USE_HDF5"] = self.options.with_hdf5 + tc.variables["NC_FIND_SHARED_LIBS"] = self.options.with_hdf5 and self.dependencies["hdf5"].options.shared + + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" - cmake = self._configure_cmake() + tc.generate() + + tc = CMakeDeps(self) + tc.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYRIGHT", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "COPYRIGHT", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - os.unlink(os.path.join(self.package_folder, "bin", "nc-config")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.settings") - 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")) + rm(self, "nc-config", os.path.join(self.package_folder, "bin")) + rm(self, "*.settings", os.path.join(self.package_folder, "lib")) + 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")) if self.settings.os == "Windows" and self.options.shared: for vc_file in ["concrt*.dll", "msvcp*.dll", "vcruntime*.dll"]: - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), vc_file) - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*[!.dll]") + rm(self, vc_file, os.path.join(self.package_folder, "bin")) + rm(self, "*[!.dll]", os.path.join(self.package_folder, "bin")) else: - tools.rmdir(os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "bin")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "netCDF") diff --git a/recipes/netcdf/all/patches/4.7.4-0001-cmake-subproject.patch b/recipes/netcdf/all/patches/4.7.4-0001-cmake-subproject.patch deleted file mode 100644 index bb9e090d807a5a..00000000000000 --- a/recipes/netcdf/all/patches/4.7.4-0001-cmake-subproject.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -85,8 +85,7 @@ IF(MSVC) - ENDIF() - - #Add custom CMake Module --SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/" -- CACHE INTERNAL "Location of our custom CMake modules.") -+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/") - - # auto-configure style checks, other CMake modules. - INCLUDE(CheckLibraryExists) -@@ -789,7 +788,6 @@ ENDIF(USE_HDF5 OR ENABLE_NETCDF_4) - - # See if we have libcurl - FIND_PACKAGE(CURL) --ADD_DEFINITIONS(-DCURL_STATICLIB=1) - INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS}) - - # Check to see if CURLOPT_USERNAME is defined. -@@ -854,7 +852,7 @@ ENDIF() - # Option to support byte-range reading of remote datasets - OPTION(ENABLE_BYTERANGE "Enable byte-range access to remote datasets.." OFF) - --IF(NOT CURL_LIBRARY) -+IF(NOT CURL_FOUND) - IF(ENABLE_BYTERANGE) - MESSAGE(FATAL_ERROR "Byte-range support specified, CURL libraries are not found.") - ENDIF() ---- liblib/CMakeLists.txt -+++ liblib/CMakeLists.txt -@@ -88,7 +88,7 @@ IF(USE_HDF5 OR USE_NETCDF4) - ENDIF() - - IF(USE_DAP) -- SET(TLL_LIBS ${TLL_LIBS} ${CURL_LIBRARY}) -+ SET(TLL_LIBS ${TLL_LIBS} ${CURL_LIBRARIES}) - ENDIF() - - IF(USE_HDF4) diff --git a/recipes/netcdf/all/patches/4.7.4-0001-fix-cmake.patch b/recipes/netcdf/all/patches/4.7.4-0001-fix-cmake.patch new file mode 100644 index 00000000000000..6a6d55ecb336f6 --- /dev/null +++ b/recipes/netcdf/all/patches/4.7.4-0001-fix-cmake.patch @@ -0,0 +1,114 @@ +diff -ru a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt 2020-03-27 23:33:36.000000000 +0800 ++++ b/CMakeLists.txt 2022-12-14 16:52:33.780579500 +0800 +@@ -85,8 +85,7 @@ + ENDIF() + + #Add custom CMake Module +-SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/" +- CACHE INTERNAL "Location of our custom CMake modules.") ++list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/") + + # auto-configure style checks, other CMake modules. + INCLUDE(CheckLibraryExists) +@@ -615,7 +614,7 @@ + # examples, even though the previous version of what we + # had worked. + ##### +- IF(MSVC) ++ IF(0) + SET(SEARCH_PACKAGE_NAME ${HDF5_PACKAGE_NAME}) + FIND_PACKAGE(HDF5 NAMES ${SEARCH_PACKAGE_NAME} COMPONENTS C HL CONFIG REQUIRED ${NC_HDF5_LINK_TYPE}) + ELSE(MSVC) +@@ -789,7 +788,6 @@ + + # See if we have libcurl + FIND_PACKAGE(CURL) +-ADD_DEFINITIONS(-DCURL_STATICLIB=1) + INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS}) + + # Check to see if CURLOPT_USERNAME is defined. +@@ -854,7 +852,7 @@ + # Option to support byte-range reading of remote datasets + OPTION(ENABLE_BYTERANGE "Enable byte-range access to remote datasets.." OFF) + +-IF(NOT CURL_LIBRARY) ++IF(NOT CURL_FOUND) + IF(ENABLE_BYTERANGE) + MESSAGE(FATAL_ERROR "Byte-range support specified, CURL libraries are not found.") + ENDIF() +@@ -1733,6 +1731,8 @@ + ##### + SET(netCDF_LIB_CORENAME "netcdf") + ++add_subdirectory(liblib) ++ + ##### + # Set the true names of all the libraries, if customized by external project + ##### +@@ -1764,8 +1764,6 @@ + ADD_SUBDIRECTORY(libdap4) + ENDIF() + +-add_subdirectory(liblib) +- + IF(ENABLE_FILTER_TESTING) + add_subdirectory(plugins) + ENDIF() +@@ -1830,7 +1828,7 @@ + # install them in the binary dir. Grab all of the .libs, put them + # in the libdir. + ## +-IF(MSVC) ++IF(0) + FILE(GLOB COPY_FILES ${CMAKE_PREFIX_PATH}/lib/*.lib) + INSTALL(FILES ${COPY_FILES} + DESTINATION ${CMAKE_INSTALL_LIBDIR} +diff -ru a/libdap4/CMakeLists.txt b/libdap4/CMakeLists.txt +--- a/libdap4/CMakeLists.txt 2020-03-27 23:33:36.000000000 +0800 ++++ b/libdap4/CMakeLists.txt 2022-12-14 16:53:32.120065700 +0800 +@@ -7,6 +7,7 @@ + SET(dap4_SOURCES d4crc32.c d4curlfunctions.c d4fix.c d4data.c d4file.c d4parser.c d4meta.c d4varx.c d4dump.c d4swap.c d4chunk.c d4printer.c d4read.c d4http.c d4util.c d4odom.c d4cvt.c d4debug.c ncd4dispatch.c ezxml_extra.c ezxml.c) + + add_library(dap4 OBJECT ${dap4_SOURCES}) ++target_link_libraries(dap4 ${TLL_LIBS}) + + ### + # Options related to the man page generation. +diff -ru a/liblib/CMakeLists.txt b/liblib/CMakeLists.txt +--- a/liblib/CMakeLists.txt 2020-03-27 23:33:36.000000000 +0800 ++++ b/liblib/CMakeLists.txt 2022-12-14 16:52:22.028667900 +0800 +@@ -81,14 +81,14 @@ + # builds: + # Make sure that HDF5_C_LIBRARY appears *after* + # HDF5_HL_LIBRARY. +- SET(TLL_LIBS ${HDF5_HL_LIBRARIES} ${HDF5_C_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY}) ++ SET(TLL_LIBS ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY}) + ELSE() # Windows CMake defines HDF5_LIBRARIES. + SET(TLL_LIBS ${HDF5_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY}) + ENDIF() + ENDIF() + + IF(USE_DAP) +- SET(TLL_LIBS ${TLL_LIBS} ${CURL_LIBRARY}) ++ SET(TLL_LIBS ${TLL_LIBS} ${CURL_LIBRARIES}) + ENDIF() + + IF(USE_HDF4) +@@ -155,3 +155,5 @@ + FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.c) + SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am) + ADD_EXTRA_DIST("${CUR_EXTRA_DIST}") ++ ++SET(TLL_LIBS ${TLL_LIBS} PARENT_SCOPE) +diff -ru a/oc2/CMakeLists.txt b/oc2/CMakeLists.txt +--- a/oc2/CMakeLists.txt 2020-03-27 23:33:36.000000000 +0800 ++++ b/oc2/CMakeLists.txt 2022-12-14 16:53:32.035864200 +0800 +@@ -8,6 +8,7 @@ + + + add_library(oc2 OBJECT ${oc_SOURCES}) ++target_link_libraries(oc2 ${TLL_LIBS}) + + # Apparently fails under cmake + #set(ocprint_FILES ocprint.c ) diff --git a/recipes/netcdf/all/patches/4.7.4-0002-cmake-msvc.patch b/recipes/netcdf/all/patches/4.7.4-0002-cmake-msvc.patch deleted file mode 100644 index 8ae6c58c1cc05d..00000000000000 --- a/recipes/netcdf/all/patches/4.7.4-0002-cmake-msvc.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -614,7 +614,7 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4) - # examples, even though the previous version of what we - # had worked. - ##### -- IF(MSVC) -+ IF(0) - SET(SEARCH_PACKAGE_NAME ${HDF5_PACKAGE_NAME}) - FIND_PACKAGE(HDF5 NAMES ${SEARCH_PACKAGE_NAME} COMPONENTS C HL CONFIG REQUIRED ${NC_HDF5_LINK_TYPE}) - ELSE(MSVC) -@@ -1828,7 +1828,7 @@ ADD_SUBDIRECTORY(docs) - # install them in the binary dir. Grab all of the .libs, put them - # in the libdir. - ## --IF(MSVC) -+IF(0) - FILE(GLOB COPY_FILES ${CMAKE_PREFIX_PATH}/lib/*.lib) - INSTALL(FILES ${COPY_FILES} - DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/recipes/netcdf/all/patches/4.7.4-0003-cmake-HDF5-cmake-components-wrong.patch b/recipes/netcdf/all/patches/4.7.4-0003-cmake-HDF5-cmake-components-wrong.patch deleted file mode 100644 index 2e3f184605fc78..00000000000000 --- a/recipes/netcdf/all/patches/4.7.4-0003-cmake-HDF5-cmake-components-wrong.patch +++ /dev/null @@ -1,13 +0,0 @@ -conan-center-index is currently not able to correctly the components of HDF5. - ---- liblib/CMakeLists.txt -+++ liblib/CMakeLists.txt -@@ -81,7 +81,7 @@ - # builds: - # Make sure that HDF5_C_LIBRARY appears *after* - # HDF5_HL_LIBRARY. -- SET(TLL_LIBS ${HDF5_HL_LIBRARIES} ${HDF5_C_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY}) -+ SET(TLL_LIBS ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY}) - ELSE() # Windows CMake defines HDF5_LIBRARIES. - SET(TLL_LIBS ${HDF5_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY}) - ENDIF() diff --git a/recipes/netcdf/all/patches/4.8.1-0001-fix-cmake.patch b/recipes/netcdf/all/patches/4.8.1-0001-fix-cmake.patch index c64e1a3bb7d3f2..7ef3820efcd54b 100644 --- a/recipes/netcdf/all/patches/4.8.1-0001-fix-cmake.patch +++ b/recipes/netcdf/all/patches/4.8.1-0001-fix-cmake.patch @@ -29,6 +29,24 @@ index 6b39f0e4..76f69653 100644 INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS}) # Define a test flag for have curl library +@@ -1920,6 +1918,8 @@ + ##### + SET(netCDF_LIB_CORENAME "netcdf") + ++add_subdirectory(liblib) ++ + ##### + # Set the true names of all the libraries, if customized by external project + ##### +@@ -1962,8 +1963,6 @@ + DESTINATION ${netCDF_BINARY_DIR}/nczarr_test/) + ENDIF() + +-add_subdirectory(liblib) +- + IF(ENABLE_FILTER_TESTING) + add_subdirectory(plugins) + ENDIF() @@ -2028,7 +2026,7 @@ ADD_SUBDIRECTORY(docs) # install them in the binary dir. Grab all of the .libs, put them # in the libdir. @@ -59,3 +77,31 @@ index be72612c..e0edb4ca 100644 ENDIF() IF(USE_HDF4) +@@ -174,3 +174,5 @@ + FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.c) + SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am) + ADD_EXTRA_DIST("${CUR_EXTRA_DIST}") ++ ++SET(TLL_LIBS ${TLL_LIBS} PARENT_SCOPE) +diff -ru a/libdap4/CMakeLists.txt b/libdap4/CMakeLists.txt +--- a/libdap4/CMakeLists.txt 2021-08-19 01:49:05.000000000 +0800 ++++ b/libdap4/CMakeLists.txt 2022-12-14 15:03:47.416608700 +0800 +@@ -7,6 +7,7 @@ + SET(dap4_SOURCES d4curlfunctions.c d4fix.c d4data.c d4file.c d4parser.c d4meta.c d4varx.c d4dump.c d4swap.c d4chunk.c d4printer.c d4read.c d4http.c d4util.c d4odom.c d4cvt.c d4debug.c ncd4dispatch.c ezxml_extra.c ezxml.c) + + add_library(dap4 OBJECT ${dap4_SOURCES}) ++target_link_libraries(dap4 ${TLL_LIBS}) + + ### + # Options related to the man page generation. +diff -ru a/oc2/CMakeLists.txt b/oc2/CMakeLists.txt +--- a/oc2/CMakeLists.txt 2021-08-19 01:49:05.000000000 +0800 ++++ b/oc2/CMakeLists.txt 2022-12-14 15:05:29.788474600 +0800 +@@ -8,6 +8,7 @@ + + + add_library(oc2 OBJECT ${oc_SOURCES}) ++target_link_libraries(oc2 ${TLL_LIBS}) + + # Apparently fails under cmake + #set(ocprint_FILES ocprint.c ) diff --git a/recipes/netcdf/all/test_package/CMakeLists.txt b/recipes/netcdf/all/test_package/CMakeLists.txt index 9bfb2d959e54e0..2d1df83efe1db7 100644 --- a/recipes/netcdf/all/test_package/CMakeLists.txt +++ b/recipes/netcdf/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(netCDF REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} netCDF::netcdf) +target_link_libraries(${PROJECT_NAME} PRIVATE netCDF::netcdf) diff --git a/recipes/netcdf/all/test_package/conanfile.py b/recipes/netcdf/all/test_package/conanfile.py index 38f4483872d47f..a317735660a3c3 100644 --- a/recipes/netcdf/all/test_package/conanfile.py +++ b/recipes/netcdf/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", "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 +22,7 @@ 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/netcdf/all/test_v1_package/CMakeLists.txt b/recipes/netcdf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..5f8b62ff9d4937 --- /dev/null +++ b/recipes/netcdf/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(netCDF REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} netCDF::netcdf) diff --git a/recipes/netcdf/all/test_v1_package/conanfile.py b/recipes/netcdf/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/netcdf/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/nmos-cpp/all/CMakeLists.txt b/recipes/nmos-cpp/all/CMakeLists.txt deleted file mode 100644 index 446552b526f4b3..00000000000000 --- a/recipes/nmos-cpp/all/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# see https://github.com/conan-io/cmake-conan/issues/249#issuecomment-737011732 -cmake_minimum_required(VERSION 3.17) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -# conanfile.py source() method extracts to source_subfolder -# nmos-cpp top-level CMakeLists.txt is in Development -add_subdirectory("source_subfolder/Development") diff --git a/recipes/nmos-cpp/all/conandata.yml b/recipes/nmos-cpp/all/conandata.yml index bb8d60a8922bcf..94817c0d8466a9 100644 --- a/recipes/nmos-cpp/all/conandata.yml +++ b/recipes/nmos-cpp/all/conandata.yml @@ -1,20 +1,34 @@ sources: # see https://github.com/conan-io/conan-center-index/blob/master/docs/faqs.md#what-version-should-packages-use-for-libraries-without-official-releases - "cci.20210902": - url: "https://github.com/sony/nmos-cpp/archive/d3a8c7935f80ce5de6d4727c307ddcef667b5d57.tar.gz" - sha256: "f5bd0b96542810ac1ed3ebaf7237d7471f3c42e68d966ae8b2d39db2601a38f9" - "cci.20211015": - url: "https://github.com/sony/nmos-cpp/archive/d115866f8f1d2c1c55bb64d05d34aa7d61c039e3.tar.gz" - sha256: "74e48497d6d7cc76a97b5a6331f88a58b2c96ce2f24b78176d3631051caceb6a" - "cci.20220120": - url: "https://github.com/sony/nmos-cpp/archive/46750381f33d19ce6b12a2f760db2f2f5faf2818.tar.gz" - sha256: "cd6fd81b1a5a10fd0a917fec362aae517a72f13889ec4418c29beb3ec8996df7" - "cci.20220208": - url: "https://github.com/sony/nmos-cpp/archive/7ca64c4fb5604fb8a3e0c05db2e8f8ffe7ef3857.tar.gz" - sha256: "751e7a35501cdada0e3943dcfd23a4e4f5caa02661d7f961204e8f9fea567c42" + "cci.20221203": + url: "https://github.com/sony/nmos-cpp/archive/0fb6b51737f737ae011cbcc39cdfb2c5236ec59f.tar.gz" + sha256: "9e811b2707afe084c4470fcaa5664f57468fd03e86b1eebd03ec9216cf31cac1" + "cci.20220620": + url: "https://github.com/sony/nmos-cpp/archive/3a904a3fcc39057a8db74656a697f0d97d8a3651.tar.gz" + sha256: "49a16ad5c8b1cf45cd519b96c880340b369a737c6814f8c533fff1cf49439fda" "cci.20220428": url: "https://github.com/sony/nmos-cpp/archive/07b8742d5e3413c903a0b0e74d0c87a76e9ecdfa.tar.gz" sha256: "be305ea343822f0aa76376955b7adcbf61807b2fe54084c067daa837ef37b0cd" + "cci.20220208": + url: "https://github.com/sony/nmos-cpp/archive/7ca64c4fb5604fb8a3e0c05db2e8f8ffe7ef3857.tar.gz" + sha256: "751e7a35501cdada0e3943dcfd23a4e4f5caa02661d7f961204e8f9fea567c42" + "cci.20220120": + url: "https://github.com/sony/nmos-cpp/archive/46750381f33d19ce6b12a2f760db2f2f5faf2818.tar.gz" + sha256: "cd6fd81b1a5a10fd0a917fec362aae517a72f13889ec4418c29beb3ec8996df7" +patches: "cci.20220620": - url: "https://github.com/sony/nmos-cpp/archive/3a904a3fcc39057a8db74656a697f0d97d8a3651.tar.gz" - sha256: "49a16ad5c8b1cf45cd519b96c880340b369a737c6814f8c533fff1cf49439fda" + - patch_file: "patches/cmakedeps-targets.patch" + patch_type: "conan" + patch_description: "Fix upstream/CMakeDeps target names" + "cci.20220428": + - patch_file: "patches/cmakedeps-targets.patch" + patch_type: "conan" + patch_description: "Fix upstream/CMakeDeps target names" + "cci.20220208": + - patch_file: "patches/cmakedeps-targets.patch" + patch_type: "conan" + patch_description: "Fix upstream/CMakeDeps target names" + "cci.20220120": + - patch_file: "patches/cmakedeps-targets.patch" + patch_type: "conan" + patch_description: "Fix upstream/CMakeDeps target names" diff --git a/recipes/nmos-cpp/all/conanfile.py b/recipes/nmos-cpp/all/conanfile.py index 4a2aae9486b392..be9549d77d691f 100644 --- a/recipes/nmos-cpp/all/conanfile.py +++ b/recipes/nmos-cpp/all/conanfile.py @@ -1,9 +1,12 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools import build, files +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import json import os import re -from conans import ConanFile, CMake, tools -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class NmosCppConan(ConanFile): name = "nmos-cpp" @@ -25,23 +28,10 @@ class NmosCppConan(ConanFile): "with_dnssd": "mdnsresponder", } - # wrapper CMakeLists.txt to call conan_basic_setup() - exports_sources = ["CMakeLists.txt"] - # use cmake_find_package_multi and prefer config-file packages - generators = "cmake", "cmake_find_package_multi" - short_paths = True - _cmake = None - - # for out-of-source build, cf. wrapper CMakeLists.txt - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + files.export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -56,11 +46,13 @@ def config_options(self): def requirements(self): # for now, consistent with project's conanfile.txt - self.requires("boost/1.79.0") + self.requires("boost/1.80.0") self.requires("cpprestsdk/2.10.18") self.requires("websocketpp/0.8.2") - self.requires("openssl/1.1.1o") - self.requires("json-schema-validator/2.1.0") + self.requires("openssl/1.1.1s") + self.requires("json-schema-validator/2.2.0") + self.requires("nlohmann_json/3.11.2") + self.requires("zlib/1.2.13") if self.options.get_safe("with_dnssd") == "mdnsresponder": self.requires("mdnsresponder/878.200.35") @@ -73,57 +65,65 @@ def requirements(self): def build_requirements(self): # nmos-cpp needs CMake 3.17 or higher but CCI doesn't allow version ranges - self.build_requires("cmake/3.23.2") + self.build_requires("cmake/3.24.2") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + if self.info.settings.os in ["Macos"]: + raise ConanInvalidConfiguration(f"{self.ref} is not currently supported on {self.info.settings.os}. Contributions welcomed.") + if self.info.settings.compiler.get_safe("cppstd"): + build.check_min_cppstd(self, 11) def package_id(self): self.info.requires["boost"].minor_mode() + self.info.requires["nlohmann_json"].patch_mode() + + 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) + files.get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + files.rm(self, "conanfile.txt", os.path.join(self.source_folder, "Development")) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) + def generate(self): + tc = CMakeToolchain(self) # prefer config-file packages created by cmake_find_package_multi # over any system-installed find-module packages - self._cmake.definitions["CMAKE_FIND_PACKAGE_PREFER_CONFIG"] = True + tc.cache_variables["CMAKE_FIND_PACKAGE_PREFER_CONFIG"] = True + # disable cmake-conan, consume conan packages in local cache to avoid incompatible requirements + # between this recipe and project's conanfile.txt + tc.cache_variables["CONAN_EXPORTED"] = True # (on Linux) select Avahi or mDNSResponder - self._cmake.definitions["NMOS_CPP_USE_AVAHI"] = self.options.get_safe("with_dnssd") == "avahi" + tc.variables["NMOS_CPP_USE_AVAHI"] = self.options.get_safe("with_dnssd") == "avahi" # (on Windows) use the Conan package for DNSSD (mdnsresponder), not the project's own DLL stub library - self._cmake.definitions["NMOS_CPP_USE_BONJOUR_SDK"] = True + tc.variables["NMOS_CPP_USE_BONJOUR_SDK"] = True # no need to build unit tests - self._cmake.definitions["NMOS_CPP_BUILD_TESTS"] = False + tc.variables["NMOS_CPP_BUILD_TESTS"] = False # the examples (nmos-cpp-registry and nmos-cpp-node) are useful utilities for users - self._cmake.definitions["NMOS_CPP_BUILD_EXAMPLES"] = True - # out-of-source build - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.variables["NMOS_CPP_BUILD_EXAMPLES"] = True + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + files.apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder="Development") cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + files.copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() cmake_folder = os.path.join(self.package_folder, "lib", "cmake") self._create_components_file_from_cmake_target_file(os.path.join(cmake_folder, "nmos-cpp", "nmos-cpp-targets.cmake")) # remove the project's own generated config-file package - tools.rmdir(cmake_folder) + files.rmdir(self, cmake_folder) - # based on abseil recipe - # see https://github.com/conan-io/conan-center-index/blob/master/recipes/abseil/all/conanfile.py def _create_components_file_from_cmake_target_file(self, target_file_path): components = {} - target_content = tools.load(target_file_path) + target_content = files.load(self, target_file_path) cmake_functions = re.findall(r"(?Padd_library|set_target_properties)[\n|\s]*\([\n|\s]*(?P[^)]*)\)", target_content) for (cmake_function_name, cmake_function_args) in cmake_functions: @@ -162,21 +162,22 @@ def _create_components_file_from_cmake_target_file(self, target_file_path): match_private = re.fullmatch(r"\$", dependency) if match_private: dependency = match_private.group(1) - if "::" in dependency: + # target dependencies can be treated fairly consistently + if "::" in dependency or dependency in ["nlohmann_json_schema_validator"]: dependency = dependency.replace("nmos-cpp::", "") # Conan component name cannot be the same as the package name if dependency == "nmos-cpp": dependency = "nmos-cpp-lib" # Conan packages for Boost, cpprestsdk, websocketpp, OpenSSL and Avahi have component names that (except for being lowercase) match the CMake targets - # json-schema-validator overrides cmake_find_package[_multi] names - elif dependency == "nlohmann_json_schema_validator::nlohmann_json_schema_validator": + # json-schema-validator overrides cmake_find_package[_multi] names and v2 cmake_target_name + elif dependency == "nlohmann_json_schema_validator": dependency = "json-schema-validator::json-schema-validator" # mdnsresponder overrides cmake_find_package[_multi] names elif dependency == "DNSSD::DNSSD": dependency = "mdnsresponder::mdnsresponder" components[component_name].setdefault("requires" if not match_private else "requires_private", []).append(dependency.lower()) elif "${_IMPORT_PREFIX}/lib/" in dependency: - self.output.warn("{} recipe does not handle {} {} (yet)".format(self.name, property_type, dependency)) + self.output.warn(f"{self.name} recipe does not handle {property_type} {dependency} (yet)") else: components[component_name].setdefault("system_libs", []).append(dependency) elif property_type == "INTERFACE_COMPILE_DEFINITIONS": @@ -185,7 +186,7 @@ def _create_components_file_from_cmake_target_file(self, target_file_path): elif property_type == "INTERFACE_COMPILE_FEATURES": for property_value in property_values: if property_value not in ["cxx_std_11"]: - self.output.warn("{} recipe does not handle {} {} (yet)".format(self.name, property_type, property_value)) + self.output.warn(f"{self.name} recipe does not handle {property_type} {property_value} (yet)") elif property_type == "INTERFACE_COMPILE_OPTIONS": for property_value in property_values: # handle forced include (Visual Studio /FI, gcc -include) by relying on includedirs containing "include" @@ -194,7 +195,7 @@ def _create_components_file_from_cmake_target_file(self, target_file_path): elif property_type == "INTERFACE_INCLUDE_DIRECTORIES": for property_value in property_values: if property_value not in ["${_IMPORT_PREFIX}/include"]: - self.output.warn("{} recipe does not handle {} {} (yet)".format(self.name, property_type, property_value)) + self.output.warn(f"{self.name} recipe does not handle {property_type} {property_value} (yet)") elif property_type == "INTERFACE_LINK_OPTIONS": for property_value in property_values: # workaround required because otherwise "/ignore:4099" gets converted to "\ignore:4099.obj" @@ -206,10 +207,10 @@ def _create_components_file_from_cmake_target_file(self, target_file_path): property_value = re.sub(r"^/", r"-", property_value) components[component_name].setdefault("linkflags", []).append(property_value) else: - self.output.warn("{} recipe does not handle {} (yet)".format(self.name, property_type)) + self.output.warn(f"{self.name} recipe does not handle {property_type} (yet)") # Save components informations in json file - with open(self._components_helper_filepath, "w") as json_file: + with open(self._components_helper_filepath, "w", encoding="utf-8") as json_file: json.dump(components, json_file, indent=4) @property @@ -224,9 +225,11 @@ def package_info(self): config_install_dir = "Debug" if self.settings.build_type == "Debug" else "Release" bindir = os.path.join(bindir, config_install_dir) libdir = os.path.join(libdir, config_install_dir) + self.cpp_info.bindirs = [bindir] + self.cpp_info.libdirs = [libdir] def _register_components(): - components_json_file = tools.load(self._components_helper_filepath) + components_json_file = files.load(self, self._components_helper_filepath) components = json.loads(components_json_file) for component_name, values in components.items(): cmake_target = values["cmake_target"] @@ -249,5 +252,5 @@ def _register_components(): # add nmos-cpp-registry and nmos-cpp-node to the path bin_path = os.path.join(self.package_folder, bindir) - 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/nmos-cpp/all/patches/cmakedeps-targets.patch b/recipes/nmos-cpp/all/patches/cmakedeps-targets.patch new file mode 100644 index 00000000000000..15a9e60940ea6e --- /dev/null +++ b/recipes/nmos-cpp/all/patches/cmakedeps-targets.patch @@ -0,0 +1,20 @@ +--- a/Development/cmake/NmosCppDependencies.cmake ++++ b/Development/cmake/NmosCppDependencies.cmake +@@ -197,7 +197,7 @@ + endif() + + add_library(json_schema_validator INTERFACE) +- target_link_libraries(json_schema_validator INTERFACE nlohmann_json_schema_validator::nlohmann_json_schema_validator) ++ target_link_libraries(json_schema_validator INTERFACE nlohmann_json_schema_validator) + else() + set(JSON_SCHEMA_VALIDATOR_SOURCES + third_party/nlohmann/json-patch.cpp +@@ -264,7 +264,7 @@ + message(STATUS "Found Avahi version " ${Avahi_VERSION}) + endif() + +- target_link_libraries(DNSSD INTERFACE Avahi::compat-libdns_sd) ++ target_link_libraries(DNSSD INTERFACE avahi::compat-libdns_sd) + else() + find_package(DNSSD REQUIRED) + if(NOT DNSSD_VERSION) diff --git a/recipes/nmos-cpp/all/test_package/CMakeLists.txt b/recipes/nmos-cpp/all/test_package/CMakeLists.txt index 9fd1df2d45f219..fd5f713e08b827 100644 --- a/recipes/nmos-cpp/all/test_package/CMakeLists.txt +++ b/recipes/nmos-cpp/all/test_package/CMakeLists.txt @@ -1,11 +1,9 @@ -cmake_minimum_required(VERSION 3.1) -project(NmosCppTestPackage CXX) +cmake_minimum_required(VERSION 3.8) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package CXX) -find_package(nmos-cpp REQUIRED) +find_package(nmos-cpp REQUIRED CONFIG) -add_executable(test_package main.cpp) -target_link_libraries(test_package nmos-cpp::compile-settings nmos-cpp::nmos-cpp) -set_target_properties(test_package PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE nmos-cpp::compile-settings nmos-cpp::nmos-cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/nmos-cpp/all/test_package/conanfile.py b/recipes/nmos-cpp/all/test_package/conanfile.py index bc0089a6ae3740..dbb752cd0c9a26 100644 --- a/recipes/nmos-cpp/all/test_package/conanfile.py +++ b/recipes/nmos-cpp/all/test_package/conanfile.py @@ -1,12 +1,22 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os +import shutil import subprocess from six import StringIO -from conans import ConanFile, CMake, tools + class NmosCppTestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - # use cmake_find_package_multi because the project installs a config-file package - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -14,14 +24,15 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - with open("registry-config.json", "w") as config: + if can_run(self): + with open("registry-config.json", "w", encoding="utf-8") as config: config.write('{"http_port": 10000, "domain": "local.", "pri": 51967}') - with open("node-config.json", "w") as config: + with open("node-config.json", "w", encoding="utf-8") as config: config.write('{"http_port": 20000, "domain": "local.", "highest_pri": 51967, "lowest_pri": 51967}') - # start up the installed nmos-cpp-registry to check it works - registry = subprocess.Popen(["nmos-cpp-registry", "registry-config.json"], + # find and start up the installed nmos-cpp-registry to check it works + registry_path = shutil.which("nmos-cpp-registry", path=os.pathsep.join(self.env["PATH"])) + registry = subprocess.Popen([registry_path, "registry-config.json"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True) @@ -29,8 +40,8 @@ def test(self): # run the test_package node which should have time to register and then exit node_out = StringIO() try: - bin_path = os.path.join("bin", "test_package") - self.run(bin_path + " node-config.json", run_environment=True, output=node_out) + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path + " node-config.json", env="conanrun", output=node_out) finally: registry.terminate() if "Adopting registered operation" not in node_out.getvalue(): diff --git a/recipes/nmos-cpp/all/test_package/main.cpp b/recipes/nmos-cpp/all/test_package/test_package.cpp similarity index 100% rename from recipes/nmos-cpp/all/test_package/main.cpp rename to recipes/nmos-cpp/all/test_package/test_package.cpp diff --git a/recipes/nmos-cpp/all/test_v1_package/CMakeLists.txt b/recipes/nmos-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/nmos-cpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/nmos-cpp/all/test_v1_package/conanfile.py b/recipes/nmos-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..bc0089a6ae3740 --- /dev/null +++ b/recipes/nmos-cpp/all/test_v1_package/conanfile.py @@ -0,0 +1,43 @@ +import os +import subprocess +from six import StringIO +from conans import ConanFile, CMake, tools + +class NmosCppTestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + # use cmake_find_package_multi because the project installs a config-file package + 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): + with open("registry-config.json", "w") as config: + config.write('{"http_port": 10000, "domain": "local.", "pri": 51967}') + with open("node-config.json", "w") as config: + config.write('{"http_port": 20000, "domain": "local.", "highest_pri": 51967, "lowest_pri": 51967}') + + # start up the installed nmos-cpp-registry to check it works + registry = subprocess.Popen(["nmos-cpp-registry", "registry-config.json"], + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + universal_newlines=True) + + # run the test_package node which should have time to register and then exit + node_out = StringIO() + try: + bin_path = os.path.join("bin", "test_package") + self.run(bin_path + " node-config.json", run_environment=True, output=node_out) + finally: + registry.terminate() + if "Adopting registered operation" not in node_out.getvalue(): + self.output.warn("test_package node failed to register with nmos-cpp-registry\n" + "\n" + "nmos-cpp-registry log:\n" + "{}\n" + "test_package log:\n" + "{}" + .format(registry.communicate()[0], node_out.getvalue())) diff --git a/recipes/nmos-cpp/config.yml b/recipes/nmos-cpp/config.yml index 3ebe54b261d3dd..1ebebe8a73c09c 100644 --- a/recipes/nmos-cpp/config.yml +++ b/recipes/nmos-cpp/config.yml @@ -1,13 +1,11 @@ versions: - "cci.20210902": + "cci.20221203": folder: all - "cci.20211015": + "cci.20220620": folder: all - "cci.20220120": + "cci.20220428": folder: all "cci.20220208": folder: all - "cci.20220428": - folder: all - "cci.20220620": + "cci.20220120": folder: all diff --git a/recipes/nss/all/conandata.yml b/recipes/nss/all/conandata.yml index 88be662960c5d3..ba9a629c0dc743 100644 --- a/recipes/nss/all/conandata.yml +++ b/recipes/nss/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "3.87": + url: "https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_87_RTM/src/nss-3.87.tar.gz" + sha256: "68a1894496d3d158babc75f8a5dda3f55b7c1560573936e3b101a10fa4ac152d" + "3.86": + url: "https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_86_RTM/src/nss-3.86.tar.gz" + sha256: "3f385fc686476bbba811035fa6821b542475d55747b18c20c221d4d66573b975" "3.85": url: "https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_85_RTM/src/nss-3.85.tar.gz" sha256: "afd9d64510b1154debbd6cab3571e9ff64a3373898e03483e4c85cdada13d297" diff --git a/recipes/nss/config.yml b/recipes/nss/config.yml index e5a9f36b4d7718..3a207829091408 100644 --- a/recipes/nss/config.yml +++ b/recipes/nss/config.yml @@ -1,4 +1,8 @@ versions: + "3.87": + folder: all + "3.86": + folder: all "3.85": folder: all "3.84": diff --git a/recipes/numcpp/all/conanfile.py b/recipes/numcpp/all/conanfile.py index 7a0ac9c3536e92..7a09bc41279eca 100644 --- a/recipes/numcpp/all/conanfile.py +++ b/recipes/numcpp/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class NumCppConan(ConanFile): @@ -26,66 +30,70 @@ class NumCppConan(ConanFile): no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "14" + + @property + def _compilers_minimum_version(self): + return { + "gcc": "5", + "clang": "3.4", + "apple-clang": "10", + "Visual Studio": "14", + "msvc": "190", + } def config_options(self): - if tools.Version(self.version) < "2.5.0": + if Version(self.version) < "2.5.0": del self.options.with_boost self.options.threads = True + def layout(self): + basic_layout(self, src_folder="src") + def requirements(self): - if tools.Version(self.version) < "2.5.0" or self.options.with_boost: - self.requires("boost/1.78.0") + if self.options.get_safe("with_boost", True): + self.requires("boost/1.80.0", transitive_headers=True) def package_id(self): - self.info.header_only() + self.info.clear() def validate(self): - minimal_cpp_standard = "14" if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, minimal_cpp_standard) - minimal_version = { - "gcc": "5", - "clang": "3.4", - "apple-clang": "10", - "Visual Studio": "14" - } - compiler = str(self.settings.compiler) - if compiler not in minimal_version: - self.output.warn( - "%s recipe lacks information about the %s compiler standard version support" % (self.name, compiler)) - self.output.warn( - "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) - return - version = tools.Version(self.settings.compiler.version) - if version < minimal_version[compiler]: - raise ConanInvalidConfiguration("%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) + check_min_cppstd(self, self._min_cppstd) + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - include_folder = os.path.join(self._source_subfolder, "include") - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*", dst="include", src=include_folder) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "NumCpp") self.cpp_info.set_property("cmake_target_name", "NumCpp::NumCpp") - if not self.options.get_safe("with_boost", False): + if self.options.get_safe("with_boost", True): + self.cpp_info.requires = ["boost::headers"] + else: self.cpp_info.defines.append("NUMCPP_NO_USE_BOOST") - if tools.Version(self.version) < "2.5.0" and not self.options.threads: + if Version(self.version) < "2.5.0" and not self.options.threads: self.cpp_info.defines.append("NO_MULTITHREAD") - if tools.Version(self.version) >= "2.5.0" and self.options.threads: + if Version(self.version) >= "2.5.0" and self.options.threads: self.cpp_info.defines.append("NUMCPP_USE_MULTITHREAD") self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "NumCpp" diff --git a/recipes/numcpp/all/test_package/CMakeLists.txt b/recipes/numcpp/all/test_package/CMakeLists.txt index 0be7b056897e12..b99c5d153ee5b7 100644 --- a/recipes/numcpp/all/test_package/CMakeLists.txt +++ b/recipes/numcpp/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(NumCpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} NumCpp::NumCpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) +target_link_libraries(${PROJECT_NAME} PRIVATE NumCpp::NumCpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/numcpp/all/test_package/conanfile.py b/recipes/numcpp/all/test_package/conanfile.py index 38f4483872d47f..0a6bc68712d901 100644 --- a/recipes/numcpp/all/test_package/conanfile.py +++ b/recipes/numcpp/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/numcpp/all/test_v1_package/CMakeLists.txt b/recipes/numcpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/numcpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/numcpp/all/test_v1_package/conanfile.py b/recipes/numcpp/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/numcpp/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/oboe/all/conandata.yml b/recipes/oboe/all/conandata.yml new file mode 100644 index 00000000000000..93bb5ba9ec0896 --- /dev/null +++ b/recipes/oboe/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "1.7.0": + url: "https://github.com/google/oboe/archive/refs/tags/1.7.0.tar.gz" + sha256: "b01896f9180f725a38806cfef73a29b36b2ea37f91389ed4e69d664ce83b79b6" +patches: + "1.7.0": + - patch_file: "patches/1.7.0-0001-fix-cmake.patch" + patch_description: "Fix CMakeLists" + patch_type: "conan" diff --git a/recipes/oboe/all/conanfile.py b/recipes/oboe/all/conanfile.py new file mode 100644 index 00000000000000..a70215ca04760d --- /dev/null +++ b/recipes/oboe/all/conanfile.py @@ -0,0 +1,65 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +import os + +required_conan_version = ">=1.53.0" + + +class OboeConan(ConanFile): + name = "oboe" + description = "Oboe is a C++ library which makes it easy to build high-performance audio apps on Android." + license = "Apache-2.0" + topics = ("android", "audio") + homepage = "https://github.com/google/oboe" + url = "https://github.com/conan-io/conan-center-index" + + settings = "os", "arch", "compiler", "build_type", + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + def export_sources(self): + export_conandata_patches(self) + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def validate(self): + if self.settings.os != "Android": + raise ConanInvalidConfiguration("oboe supports Android only") + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 17) + + def layout(self): + cmake_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["oboe"] + self.cpp_info.system_libs.extend(["log", "OpenSLES"]) diff --git a/recipes/oboe/all/patches/1.7.0-0001-fix-cmake.patch b/recipes/oboe/all/patches/1.7.0-0001-fix-cmake.patch new file mode 100644 index 00000000000000..452cd94a1c2bbf --- /dev/null +++ b/recipes/oboe/all/patches/1.7.0-0001-fix-cmake.patch @@ -0,0 +1,30 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -79,13 +79,13 @@ target_include_directories(oboe + # Enable -Ofast + target_compile_options(oboe + PRIVATE +- -std=c++17 + -Wall + -Wextra-semi + -Wshadow + -Wshadow-field + -Ofast +- "$<$:-Werror>") ++) ++target_compile_features(oboe PUBLIC cxx_std_17) + + # Enable logging of D,V for debug builds + target_compile_definitions(oboe PUBLIC $<$:OBOE_ENABLE_LOGGING=1>) +@@ -94,8 +94,8 @@ target_link_libraries(oboe PRIVATE log OpenSLES) + + # When installing oboe put the libraries in the lib/ folder e.g. lib/arm64-v8a + install(TARGETS oboe +- LIBRARY DESTINATION lib/${ANDROID_ABI} +- ARCHIVE DESTINATION lib/${ANDROID_ABI}) ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib) + + # Also install the headers + install(DIRECTORY include/oboe DESTINATION include) +\ No newline at end of file diff --git a/recipes/oboe/all/test_package/CMakeLists.txt b/recipes/oboe/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..9f44285ca4f5d1 --- /dev/null +++ b/recipes/oboe/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(oboe REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE oboe::oboe) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/oboe/all/test_package/conanfile.py b/recipes/oboe/all/test_package/conanfile.py new file mode 100644 index 00000000000000..0a6bc68712d901 --- /dev/null +++ b/recipes/oboe/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/oboe/all/test_package/test_package.cpp b/recipes/oboe/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..2fda5758397707 --- /dev/null +++ b/recipes/oboe/all/test_package/test_package.cpp @@ -0,0 +1,11 @@ +#include + +int main() { + oboe::AudioStreamBuilder builder; + builder.setDirection(oboe::Direction::Output); + builder.setPerformanceMode(oboe::PerformanceMode::LowLatency); + builder.setSharingMode(oboe::SharingMode::Exclusive); + builder.setFormat(oboe::AudioFormat::Float); + builder.setChannelCount(oboe::ChannelCount::Mono); + return 0; +} diff --git a/recipes/oboe/all/test_v1_package/CMakeLists.txt b/recipes/oboe/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/oboe/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/oboe/all/test_v1_package/conanfile.py b/recipes/oboe/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/oboe/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/oboe/config.yml b/recipes/oboe/config.yml new file mode 100644 index 00000000000000..0f57b11de8fb0a --- /dev/null +++ b/recipes/oboe/config.yml @@ -0,0 +1,3 @@ +versions: + "1.7.0": + folder: all diff --git a/recipes/odbc/all/conanfile.py b/recipes/odbc/all/conanfile.py index 929c7ac4a289fe..9bd75ab0988ca4 100644 --- a/recipes/odbc/all/conanfile.py +++ b/recipes/odbc/all/conanfile.py @@ -10,6 +10,7 @@ class OdbcConan(ConanFile): name = "odbc" + package_type = "library" description = "Package providing unixODBC" topics = ("odbc", "database", "dbms", "data-access") url = "https://github.com/conan-io/conan-center-index" diff --git a/recipes/odbc/all/test_package/conanfile.py b/recipes/odbc/all/test_package/conanfile.py index 1278841f612987..a0bef6bd96975d 100644 --- a/recipes/odbc/all/test_package/conanfile.py +++ b/recipes/odbc/all/test_package/conanfile.py @@ -13,7 +13,7 @@ def layout(self): cmake_layout(self) def requirements(self): - self.requires(self.tested_reference_str) + self.requires(self.tested_reference_str, run=True) def build(self): cmake = CMake(self) diff --git a/recipes/opencv/4.x/CMakeLists.txt b/recipes/opencv/4.x/CMakeLists.txt deleted file mode 100644 index a401f82668b0c2..00000000000000 --- a/recipes/opencv/4.x/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -if (WITH_OPENEXR) - set(CMAKE_CXX_STANDARD 11) -endif() - -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}) -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -if(NOT CMAKE_SYSTEM_PROCESSOR) - set(CMAKE_SYSTEM_PROCESSOR ${CONAN_OPENCV_SYSTEM_PROCESSOR}) -endif() - -add_subdirectory("source_subfolder") diff --git a/recipes/opencv/4.x/conandata.yml b/recipes/opencv/4.x/conandata.yml index 88bdca68c62a1a..8eacd70bbab688 100644 --- a/recipes/opencv/4.x/conandata.yml +++ b/recipes/opencv/4.x/conandata.yml @@ -30,8 +30,66 @@ sources: - url: "https://github.com/opencv/opencv_contrib/archive/4.1.2.tar.gz" sha256: "0f6c3d30baa39e3e7611afb481ee86dea45dafb182cac87d570c95dccd83eb8b" patches: + "4.5.5": + - patch_file: "patches/4.5.5-0001-find-openexr.patch" + patch_description: "Robust discovery & injection of OpenEXR" + patch_type: "conan" + - patch_file: "patches/4.5.0-0002-find-ade.patch" + patch_description: "Robust discovery & injection of ade" + patch_type: "conan" + - patch_file: "patches/4.1.2-0003-find-quirc.patch" + patch_description: "Robust discovery & injection of quirc" + patch_type: "conan" + "4.5.3": + - patch_file: "patches/4.5.3-0001-find-openexr.patch" + patch_description: "Robust discovery & injection of OpenEXR" + patch_type: "conan" + - patch_file: "patches/4.5.0-0002-find-ade.patch" + patch_description: "Robust discovery & injection of ade" + patch_type: "conan" + - patch_file: "patches/4.1.2-0003-find-quirc.patch" + patch_description: "Robust discovery & injection of quirc" + patch_type: "conan" + "4.5.2": + - patch_file: "patches/4.1.2-0001-find-openexr.patch" + patch_description: "Robust discovery & injection of OpenEXR" + patch_type: "conan" + - patch_file: "patches/4.5.0-0002-find-ade.patch" + patch_description: "Robust discovery & injection of ade" + patch_type: "conan" + - patch_file: "patches/4.1.2-0003-find-quirc.patch" + patch_description: "Robust discovery & injection of quirc" + patch_type: "conan" + "4.5.1": + - patch_file: "patches/4.1.2-0001-find-openexr.patch" + patch_description: "Robust discovery & injection of OpenEXR" + patch_type: "conan" + - patch_file: "patches/4.5.0-0002-find-ade.patch" + patch_description: "Robust discovery & injection of ade" + patch_type: "conan" + - patch_file: "patches/4.1.2-0003-find-quirc.patch" + patch_description: "Robust discovery & injection of quirc" + patch_type: "conan" + "4.5.0": + - patch_file: "patches/4.1.2-0001-find-openexr.patch" + patch_description: "Robust discovery & injection of OpenEXR" + patch_type: "conan" + - patch_file: "patches/4.5.0-0002-find-ade.patch" + patch_description: "Robust discovery & injection of ade" + patch_type: "conan" + - patch_file: "patches/4.1.2-0003-find-quirc.patch" + patch_description: "Robust discovery & injection of quirc" + patch_type: "conan" "4.1.2": - - patch_file: "patches/0001-jasper.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-openexr.patch" - base_path: "source_subfolder" + - patch_file: "patches/4.1.2-0001-find-openexr.patch" + patch_description: "Robust discovery & injection of OpenEXR" + patch_type: "conan" + - patch_file: "patches/4.1.2-0002-find-ade.patch" + patch_description: "Robust discovery & injection of ade" + patch_type: "conan" + - patch_file: "patches/4.1.2-0003-find-quirc.patch" + patch_description: "Robust discovery & injection of quirc" + patch_type: "conan" + - patch_file: "patches/4.1.2-0004-jasper.patch" + patch_description: "Compatibility with recent jasper versions" + patch_type: "portability" diff --git a/recipes/opencv/4.x/conanfile.py b/recipes/opencv/4.x/conanfile.py index dc6c82ea44df3d..442154091f09dc 100644 --- a/recipes/opencv/4.x/conanfile.py +++ b/recipes/opencv/4.x/conanfile.py @@ -1,10 +1,16 @@ -from conan.tools.microsoft import msvc_runtime_flag -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, rename, replace_in_file, rmdir, save +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version +from conans.tools import to_android_abi import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.54.0" class OpenCVConan(ConanFile): @@ -25,7 +31,7 @@ class OpenCVConan(ConanFile): "parallel": [False, "tbb", "openmp"], "with_ipp": [False, "intel-ipp", "opencv-icv"], "with_ade": [True, False], - "with_jpeg": [False, "libjpeg", "libjpeg-turbo"], + "with_jpeg": [False, "libjpeg", "libjpeg-turbo", "mozjpeg"], "with_png": [True, False], "with_tiff": [True, False], "with_jpeg2000": [False, "jasper", "openjpeg"], @@ -47,9 +53,9 @@ class OpenCVConan(ConanFile): "neon": [True, False], "dnn": [True, False], "dnn_cuda": [True, False], - "cuda_arch_bin": "ANY", - "cpu_baseline": "ANY", - "cpu_dispatch": "ANY", + "cuda_arch_bin": [None, "ANY"], + "cpu_baseline": [None, "ANY"], + "cpu_dispatch": [None, "ANY"], "nonfree": [True, False], } default_options = { @@ -90,24 +96,10 @@ class OpenCVConan(ConanFile): } short_paths = True - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" @property def _contrib_folder(self): - return "contrib" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + return os.path.join(self.source_folder, "contrib") @property def _has_with_jpeg2000_option(self): @@ -123,12 +115,10 @@ def _has_with_ffmpeg_option(self): @property def _protobuf_version(self): - return "protobuf/3.17.1" + return "3.17.1" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -154,7 +144,7 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if not self.options.contrib: del self.options.contrib_freetype del self.options.contrib_sfm @@ -175,356 +165,339 @@ def configure(self): if self.settings.os == "Android": self.options.with_openexr = False # disabled because this forces linkage to libc++_shared.so + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_jpeg == "libjpeg": - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") elif self.options.with_jpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.2") + self.requires("libjpeg-turbo/2.1.4") + elif self.options.with_jpeg == "mozjpeg": + self.requires("mozjpeg/4.1.1") if self.options.get_safe("with_jpeg2000") == "jasper": - self.requires("jasper/2.0.33") + self.requires("jasper/4.0.0") elif self.options.get_safe("with_jpeg2000") == "openjpeg": - self.requires("openjpeg/2.4.0") + self.requires("openjpeg/2.5.0") if self.options.with_png: - self.requires("libpng/1.6.37") + self.requires("libpng/1.6.39") if self.options.with_openexr: - self.requires("openexr/2.5.7") + if Version(self.version) < "4.5.3": + # opencv < 4.5.3 doesn't support openexr >= 3 + self.requires("openexr/2.5.7") + else: + self.requires("openexr/3.1.5") if self.options.get_safe("with_tiff"): - self.requires("libtiff/4.3.0") + self.requires("libtiff/4.4.0") if self.options.with_eigen: self.requires("eigen/3.3.9") if self.options.get_safe("with_ffmpeg"): + # opencv doesn't support ffmpeg >= 5.0.0 for the moment (until 4.5.5 at least) self.requires("ffmpeg/4.4") if self.options.parallel == "tbb": - self.requires("onetbb/2020.3") + self.requires("onetbb/2021.7.0") if self.options.with_ipp == "intel-ipp": self.requires("intel-ipp/2020") if self.options.with_webp: - self.requires("libwebp/1.2.2") + self.requires("libwebp/1.2.4") if self.options.get_safe("contrib_freetype"): - self.requires("freetype/2.11.1") - self.requires("harfbuzz/3.2.0") + self.requires("freetype/2.12.1") + self.requires("harfbuzz/6.0.0") if self.options.get_safe("contrib_sfm"): self.requires("gflags/2.2.2") - self.requires("glog/0.5.0") + self.requires("glog/0.6.0") if self.options.with_quirc: self.requires("quirc/1.1") if self.options.get_safe("with_gtk"): self.requires("gtk/system") if self.options.dnn: - self.requires(self._protobuf_version) + self.requires(f"protobuf/{self._protobuf_version}") if self.options.with_ade: - self.requires("ade/0.1.1f") + self.requires("ade/0.1.2a") def validate(self): - if self.options.shared and self._is_msvc and "MT" in msvc_runtime_flag(self): + if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self): raise ConanInvalidConfiguration("Visual Studio with static runtime is not supported for shared library.") - if self.settings.compiler == "clang" and tools.Version(self.settings.compiler.version) < "4": + if self.settings.compiler == "clang" and Version(self.settings.compiler.version) < "4": raise ConanInvalidConfiguration("Clang 3.x can't build OpenCV 4.x due to an internal bug.") if self.options.with_cuda and not self.options.contrib: raise ConanInvalidConfiguration("contrib must be enabled for cuda") - if self.options.get_safe("dnn_cuda", False) and \ + if self.options.get_safe("dnn_cuda") and \ (not self.options.with_cuda or not self.options.contrib or not self.options.with_cublas or not self.options.with_cudnn): raise ConanInvalidConfiguration("with_cublas, with_cudnn and contrib must be enabled for dnn_cuda") if self.options.with_ipp == "opencv-icv" and \ (not str(self.settings.arch) in ["x86", "x86_64"] or \ not str(self.settings.os) in ["Linux", "Macos", "Windows"]): - raise ConanInvalidConfiguration("opencv-icv is not available for %s/%s" % \ - (str(self.settings.os), str(self.settings.arch))) + raise ConanInvalidConfiguration(f"opencv-icv is not available for {self.settings.os}/{self.settings.arch}") def build_requirements(self): - if self.options.dnn and hasattr(self, "settings_build"): - self.build_requires(self._protobuf_version) + if self.options.dnn: + if hasattr(self, "settings_build") and cross_building(self): + self.tool_requires(f"protobuf/{self._protobuf_version}") def source(self): - tools.get(**self.conan_data["sources"][self.version][0], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version][0], + destination=self.source_folder, strip_root=True) - tools.get(**self.conan_data["sources"][self.version][1], - destination=self._contrib_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version][1], + destination=self._contrib_folder, strip_root=True) - def _patch_opencv(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - for directory in ['libjasper', 'libjpeg-turbo', 'libjpeg', 'libpng', 'libtiff', 'libwebp', 'openexr', 'protobuf', 'zlib', 'quirc']: - tools.rmdir(os.path.join(self._source_subfolder, '3rdparty', directory)) - if self.options.with_openexr: - find_openexr = os.path.join(self._source_subfolder, "cmake", "OpenCVFindOpenEXR.cmake") - tools.replace_in_file(find_openexr, - r'SET(OPENEXR_ROOT "C:/Deploy" CACHE STRING "Path to the OpenEXR \"Deploy\" folder")', - "") - tools.replace_in_file(find_openexr, "SET(OPENEXR_LIBSEARCH_SUFFIXES x64/Release x64 x64/Debug)", "") - tools.replace_in_file(find_openexr, "SET(OPENEXR_LIBSEARCH_SUFFIXES Win32/Release Win32 Win32/Debug)", "") + def _patch_sources(self): + apply_conandata_patches(self) + for directory in ["libjasper", "libjpeg-turbo", "libjpeg", "libpng", "libtiff", "libwebp", "openexr", "protobuf", "zlib", "quirc"]: + rmdir(self, os.path.join(self.source_folder, "3rdparty", directory)) - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), "ANDROID OR NOT UNIX", "FALSE") - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), "elseif(EMSCRIPTEN)", "elseif(QNXNTO)\nelseif(EMSCRIPTEN)") - tools.replace_in_file(os.path.join(self._source_subfolder, "modules", "imgcodecs", "CMakeLists.txt"), "JASPER_", "Jasper_") + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "ANDROID OR NOT UNIX", "FALSE") + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "elseif(EMSCRIPTEN)", "elseif(QNXNTO)\nelseif(EMSCRIPTEN)") + replace_in_file(self, os.path.join(self.source_folder, "modules", "imgcodecs", "CMakeLists.txt"), "JASPER_", "Jasper_") + + # Fix detection of ffmpeg + replace_in_file(self, os.path.join(self.source_folder, "modules", "videoio", "cmake", "detect_ffmpeg.cmake"), + "FFMPEG_FOUND", "ffmpeg_FOUND") # Cleanup RPATH - if tools.Version(self.version) < "4.1.2": - install_layout_file = os.path.join(self._source_subfolder, "CMakeLists.txt") + if Version(self.version) < "4.1.2": + install_layout_file = os.path.join(self.source_folder, "CMakeLists.txt") else: - install_layout_file = os.path.join(self._source_subfolder, "cmake", "OpenCVInstallLayout.cmake") - tools.replace_in_file(install_layout_file, + install_layout_file = os.path.join(self.source_folder, "cmake", "OpenCVInstallLayout.cmake") + replace_in_file(self, install_layout_file, "ocv_update(CMAKE_INSTALL_RPATH \"${CMAKE_INSTALL_PREFIX}/${OPENCV_LIB_INSTALL_PATH}\")", "") - tools.replace_in_file(install_layout_file, "set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)", "") + replace_in_file(self, install_layout_file, "set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)", "") if self.options.dnn: - find_protobuf = os.path.join(self._source_subfolder, "cmake", "OpenCVFindProtobuf.cmake") - # variables generated by protobuf recipe have all lowercase prefixes - tools.replace_in_file(find_protobuf, - 'find_package(Protobuf QUIET)', - '''find_package(Protobuf QUIET) - if(NOT DEFINED Protobuf_LIBRARIES) - set(Protobuf_LIBRARIES ${protobuf_LIBRARIES}) - endif() - if(NOT DEFINED Protobuf_LIBRARY) - set(Protobuf_LIBRARY ${protobuf_LIBS}) - endif() - if(NOT DEFINED Protobuf_INCLUDE_DIR) - set(Protobuf_INCLUDE_DIR ${protobuf_INCLUDE_DIR}) - endif()''') + find_protobuf = os.path.join(self.source_folder, "cmake", "OpenCVFindProtobuf.cmake") + # OpenCV expects to find FindProtobuf.cmake, not the config file + replace_in_file(self, find_protobuf, + "find_package(Protobuf QUIET)", + "find_package(Protobuf REQUIRED MODULE)") # in 'if' block, get_target_property() produces an error - if tools.Version(self.version) >= "4.4.0": - tools.replace_in_file(find_protobuf, + if Version(self.version) >= "4.4.0": + replace_in_file(self, find_protobuf, 'if(TARGET "${Protobuf_LIBRARIES}")', 'if(FALSE) # patch: disable if(TARGET "${Protobuf_LIBRARIES}")') - if self.options.with_ade: - ade_cmake = os.path.join(self._source_subfolder, "modules", "gapi", - "cmake", "init.cmake") - replacement = '''find_package(ade REQUIRED) - if(ade_DIR)''' - tools.replace_in_file(ade_cmake, 'if(ade_DIR)', replacement, strict=False) - tools.replace_in_file(ade_cmake, 'if (ade_DIR)', replacement, strict=False) - tools.replace_in_file(ade_cmake, "TARGET ade", "TARGET ade::ade") - gapi_cmake = os.path.join(self._source_subfolder, "modules", "gapi", "CMakeLists.txt") - tools.replace_in_file(gapi_cmake, " ade)", " ade::ade)") - - if self.options.contrib and self.options.contrib_sfm and tools.Version(self.version) <= "4.5.2": + + if self.options.get_safe("contrib_freetype"): + freetype_cmake = os.path.join(self._contrib_folder, "modules", "freetype", "CMakeLists.txt") + replace_in_file(self, freetype_cmake, "ocv_check_modules(FREETYPE freetype2)", "find_package(Freetype REQUIRED MODULE)") + replace_in_file(self, freetype_cmake, "FREETYPE_", "Freetype_") + + replace_in_file(self, freetype_cmake, "ocv_check_modules(HARFBUZZ harfbuzz)", "find_package(harfbuzz REQUIRED)") + replace_in_file(self, freetype_cmake, "HARFBUZZ_", "harfbuzz_") + + if self.options.get_safe("contrib_sfm") and Version(self.version) <= "4.5.2": sfm_cmake = os.path.join(self._contrib_folder, "modules", "sfm", "CMakeLists.txt") - ver = tools.Version(self.version) + ver = Version(self.version) if ver <= "4.5.0": - search = ' find_package(Glog QUIET)\nendif()' + search = " find_package(Glog QUIET)\nendif()" else: search = ' set(GLOG_INCLUDE_DIRS "${GLOG_INCLUDE_DIR}")\nendif()' - tools.replace_in_file(sfm_cmake, search, """{} + replace_in_file(self, sfm_cmake, search, f"""{search} if(NOT GFLAGS_LIBRARIES AND TARGET gflags::gflags) set(GFLAGS_LIBRARIES gflags::gflags) endif() if(NOT GLOG_LIBRARIES AND TARGET glog::glog) set(GLOG_LIBRARIES glog::glog) - endif()""".format(search)) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["OPENCV_CONFIG_INSTALL_PATH"] = "cmake" - self._cmake.definitions["OPENCV_BIN_INSTALL_PATH"] = "bin" - self._cmake.definitions["OPENCV_LIB_INSTALL_PATH"] = "lib" - self._cmake.definitions["OPENCV_3P_LIB_INSTALL_PATH"] = "lib" - self._cmake.definitions["OPENCV_OTHER_INSTALL_PATH"] = "res" - self._cmake.definitions["OPENCV_LICENSES_INSTALL_PATH"] = "licenses" - - self._cmake.definitions["BUILD_CUDA_STUBS"] = False - self._cmake.definitions["BUILD_DOCS"] = False - self._cmake.definitions["BUILD_EXAMPLES"] = False - self._cmake.definitions["BUILD_FAT_JAVA_LIB"] = False - self._cmake.definitions["BUILD_IPP_IW"] = False - self._cmake.definitions["BUILD_ITT"] = False - self._cmake.definitions["BUILD_JASPER"] = False - self._cmake.definitions["BUILD_JAVA"] = False - self._cmake.definitions["BUILD_JPEG"] = False - self._cmake.definitions["BUILD_OPENEXR"] = False - self._cmake.definitions["BUILD_OPENJPEG"] = False - self._cmake.definitions["BUILD_TESTS"] = False - self._cmake.definitions["BUILD_PROTOBUF"] = False - self._cmake.definitions["BUILD_PACKAGE"] = False - self._cmake.definitions["BUILD_PERF_TESTS"] = False - self._cmake.definitions["BUILD_USE_SYMLINKS"] = False - self._cmake.definitions["BUILD_opencv_apps"] = False - self._cmake.definitions["BUILD_opencv_java"] = False - self._cmake.definitions["BUILD_opencv_java_bindings_gen"] = False - self._cmake.definitions["BUILD_opencv_js"] = False - self._cmake.definitions["BUILD_ZLIB"] = False - self._cmake.definitions["BUILD_PNG"] = False - self._cmake.definitions["BUILD_TIFF"] = False - self._cmake.definitions["BUILD_WEBP"] = False - self._cmake.definitions["BUILD_TBB"] = False - self._cmake.definitions["OPENCV_FORCE_3RDPARTY_BUILD"] = False - self._cmake.definitions["OPENCV_PYTHON_SKIP_DETECTION"] = True - self._cmake.definitions["BUILD_opencv_python2"] = False - self._cmake.definitions["BUILD_opencv_python3"] = False - self._cmake.definitions["BUILD_opencv_python_bindings_g"] = False - self._cmake.definitions["BUILD_opencv_python_tests"] = False - self._cmake.definitions["BUILD_opencv_ts"] = False - - self._cmake.definitions["WITH_1394"] = False - self._cmake.definitions["WITH_ADE"] = False - self._cmake.definitions["WITH_ARAVIS"] = False - self._cmake.definitions["WITH_CLP"] = False - self._cmake.definitions["WITH_NVCUVID"] = False - - self._cmake.definitions["WITH_FFMPEG"] = self.options.get_safe("with_ffmpeg") + endif()""") + + def generate(self): + if self.options.dnn: + if hasattr(self, "settings_build") and cross_building(self): + VirtualBuildEnv(self).generate() + else: + VirtualRunEnv(self).generate(scope="build") + + tc = CMakeToolchain(self) + tc.variables["OPENCV_CONFIG_INSTALL_PATH"] = "cmake" + tc.variables["OPENCV_BIN_INSTALL_PATH"] = "bin" + tc.variables["OPENCV_LIB_INSTALL_PATH"] = "lib" + tc.variables["OPENCV_3P_LIB_INSTALL_PATH"] = "lib" + tc.variables["OPENCV_OTHER_INSTALL_PATH"] = "res" + tc.variables["OPENCV_LICENSES_INSTALL_PATH"] = "licenses" + + tc.variables["BUILD_CUDA_STUBS"] = False + tc.variables["BUILD_DOCS"] = False + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_FAT_JAVA_LIB"] = False + tc.variables["BUILD_IPP_IW"] = False + tc.variables["BUILD_ITT"] = False + tc.variables["BUILD_JASPER"] = False + tc.variables["BUILD_JAVA"] = False + tc.variables["BUILD_JPEG"] = False + tc.variables["BUILD_OPENEXR"] = False + tc.variables["BUILD_OPENJPEG"] = False + tc.variables["BUILD_TESTS"] = False + tc.variables["BUILD_PROTOBUF"] = False + tc.variables["BUILD_PACKAGE"] = False + tc.variables["BUILD_PERF_TESTS"] = False + tc.variables["BUILD_USE_SYMLINKS"] = False + tc.variables["BUILD_opencv_apps"] = False + tc.variables["BUILD_opencv_java"] = False + tc.variables["BUILD_opencv_java_bindings_gen"] = False + tc.variables["BUILD_opencv_js"] = False + tc.variables["BUILD_ZLIB"] = False + tc.variables["BUILD_PNG"] = False + tc.variables["BUILD_TIFF"] = False + tc.variables["BUILD_WEBP"] = False + tc.variables["BUILD_TBB"] = False + tc.variables["OPENCV_FORCE_3RDPARTY_BUILD"] = False + tc.variables["OPENCV_PYTHON_SKIP_DETECTION"] = True + tc.variables["BUILD_opencv_python2"] = False + tc.variables["BUILD_opencv_python3"] = False + tc.variables["BUILD_opencv_python_bindings_g"] = False + tc.variables["BUILD_opencv_python_tests"] = False + tc.variables["BUILD_opencv_ts"] = False + + tc.variables["WITH_1394"] = False + tc.variables["WITH_ADE"] = False + tc.variables["WITH_ARAVIS"] = False + tc.variables["WITH_CLP"] = False + tc.variables["WITH_NVCUVID"] = False + + tc.variables["WITH_FFMPEG"] = self.options.get_safe("with_ffmpeg") if self.options.get_safe("with_ffmpeg"): - self._cmake.definitions["OPENCV_FFMPEG_SKIP_BUILD_CHECK"] = True - self._cmake.definitions["OPENCV_FFMPEG_SKIP_DOWNLOAD"] = True + tc.variables["OPENCV_FFMPEG_SKIP_BUILD_CHECK"] = True + tc.variables["OPENCV_FFMPEG_SKIP_DOWNLOAD"] = True # opencv will not search for ffmpeg package, but for # libavcodec;libavformat;libavutil;libswscale modules - self._cmake.definitions["OPENCV_FFMPEG_USE_FIND_PACKAGE"] = "ffmpeg" - self._cmake.definitions["OPENCV_INSTALL_FFMPEG_DOWNLOAD_SCRIPT"] = False - self._cmake.definitions["FFMPEG_LIBRARIES"] = "ffmpeg::avcodec;ffmpeg::avformat;ffmpeg::avutil;ffmpeg::swscale" + tc.variables["OPENCV_FFMPEG_USE_FIND_PACKAGE"] = "ffmpeg" + tc.variables["OPENCV_INSTALL_FFMPEG_DOWNLOAD_SCRIPT"] = False + tc.variables["FFMPEG_LIBRARIES"] = "ffmpeg::avcodec;ffmpeg::avformat;ffmpeg::avutil;ffmpeg::swscale" for component in ["avcodec", "avformat", "avutil", "swscale", "avresample"]: - self._cmake.definitions["FFMPEG_lib%s_VERSION" % component] = self.deps_cpp_info["ffmpeg"].components[component].version - - self._cmake.definitions["WITH_GSTREAMER"] = False - self._cmake.definitions["WITH_HALIDE"] = False - self._cmake.definitions["WITH_HPX"] = False - self._cmake.definitions["WITH_IMGCODEC_HDR"] = self.options.with_imgcodec_hdr - self._cmake.definitions["WITH_IMGCODEC_PFM"] = self.options.with_imgcodec_pfm - self._cmake.definitions["WITH_IMGCODEC_PXM"] = self.options.with_imgcodec_pxm - self._cmake.definitions["WITH_IMGCODEC_SUNRASTER"] = self.options.with_imgcodec_sunraster - self._cmake.definitions["WITH_INF_ENGINE"] = False - self._cmake.definitions["WITH_IPP"] = False + # TODO: use self.dependencies once https://github.com/conan-io/conan/issues/12728 fixed + ffmpeg_component_version = self.deps_cpp_info["ffmpeg"].components[component].version + tc.variables[f"FFMPEG_lib{component}_VERSION"] = ffmpeg_component_version + + tc.variables["WITH_GSTREAMER"] = False + tc.variables["WITH_HALIDE"] = False + tc.variables["WITH_HPX"] = False + tc.variables["WITH_IMGCODEC_HDR"] = self.options.with_imgcodec_hdr + tc.variables["WITH_IMGCODEC_PFM"] = self.options.with_imgcodec_pfm + tc.variables["WITH_IMGCODEC_PXM"] = self.options.with_imgcodec_pxm + tc.variables["WITH_IMGCODEC_SUNRASTER"] = self.options.with_imgcodec_sunraster + tc.variables["WITH_INF_ENGINE"] = False + tc.variables["WITH_IPP"] = False if self.options.with_ipp: - self._cmake.definitions["WITH_IPP"] = True + tc.variables["WITH_IPP"] = True if self.options.with_ipp == "intel-ipp": - ipp_root = self.deps_cpp_info["intel-ipp"].rootpath + ipp_root = self.dependencies["intel-ipp"].package_folder.replace("\\", "/") if self.settings.os == "Windows": ipp_root = ipp_root.replace("\\", "/") - self._cmake.definitions["IPPROOT"] = ipp_root - self._cmake.definitions["IPPIWROOT"] = ipp_root + tc.variables["IPPROOT"] = ipp_root + tc.variables["IPPIWROOT"] = ipp_root else: - self._cmake.definitions["BUILD_IPP_IW"] = True - self._cmake.definitions["WITH_ITT"] = False - self._cmake.definitions["WITH_LIBREALSENSE"] = False - self._cmake.definitions["WITH_MFX"] = False - self._cmake.definitions["WITH_NGRAPH"] = False - self._cmake.definitions["WITH_OPENCL"] = False - self._cmake.definitions["WITH_OPENCLAMDBLAS"] = False - self._cmake.definitions["WITH_OPENCLAMDFFT"] = False - self._cmake.definitions["WITH_OPENCL_SVM"] = False - self._cmake.definitions["WITH_OPENGL"] = False - self._cmake.definitions["WITH_OPENMP"] = False - self._cmake.definitions["WITH_OPENNI"] = False - self._cmake.definitions["WITH_OPENNI2"] = False - self._cmake.definitions["WITH_OPENVX"] = False - self._cmake.definitions["WITH_PLAIDML"] = False - self._cmake.definitions["WITH_PVAPI"] = False - self._cmake.definitions["WITH_QT"] = False - self._cmake.definitions["WITH_QUIRC"] = False - self._cmake.definitions["WITH_V4L"] = self.options.get_safe("with_v4l", False) - self._cmake.definitions["WITH_VA"] = False - self._cmake.definitions["WITH_VA_INTEL"] = False - self._cmake.definitions["WITH_VTK"] = False - self._cmake.definitions["WITH_VULKAN"] = False - self._cmake.definitions["WITH_XIMEA"] = False - self._cmake.definitions["WITH_XINE"] = False - self._cmake.definitions["WITH_LAPACK"] = False - - self._cmake.definitions["WITH_GTK"] = self.options.get_safe("with_gtk", False) - self._cmake.definitions["WITH_GTK_2_X"] = self._is_gtk_version2 - self._cmake.definitions["WITH_WEBP"] = self.options.with_webp - self._cmake.definitions["WITH_JPEG"] = self.options.with_jpeg != False - self._cmake.definitions["WITH_PNG"] = self.options.with_png + tc.variables["BUILD_IPP_IW"] = True + tc.variables["WITH_ITT"] = False + tc.variables["WITH_LIBREALSENSE"] = False + tc.variables["WITH_MFX"] = False + tc.variables["WITH_NGRAPH"] = False + tc.variables["WITH_OPENCL"] = False + tc.variables["WITH_OPENCLAMDBLAS"] = False + tc.variables["WITH_OPENCLAMDFFT"] = False + tc.variables["WITH_OPENCL_SVM"] = False + tc.variables["WITH_OPENGL"] = False + tc.variables["WITH_OPENMP"] = False + tc.variables["WITH_OPENNI"] = False + tc.variables["WITH_OPENNI2"] = False + tc.variables["WITH_OPENVX"] = False + tc.variables["WITH_PLAIDML"] = False + tc.variables["WITH_PVAPI"] = False + tc.variables["WITH_QT"] = False + tc.variables["WITH_QUIRC"] = False + tc.variables["WITH_V4L"] = self.options.get_safe("with_v4l", False) + tc.variables["WITH_VA"] = False + tc.variables["WITH_VA_INTEL"] = False + tc.variables["WITH_VTK"] = False + tc.variables["WITH_VULKAN"] = False + tc.variables["WITH_XIMEA"] = False + tc.variables["WITH_XINE"] = False + tc.variables["WITH_LAPACK"] = False + + tc.variables["WITH_GTK"] = self.options.get_safe("with_gtk", False) + tc.variables["WITH_GTK_2_X"] = self._is_gtk_version2 + tc.variables["WITH_WEBP"] = self.options.with_webp + tc.variables["WITH_JPEG"] = bool(self.options.with_jpeg) + tc.variables["WITH_PNG"] = self.options.with_png if self._has_with_tiff_option: - self._cmake.definitions["WITH_TIFF"] = self.options.with_tiff + tc.variables["WITH_TIFF"] = self.options.with_tiff if self._has_with_jpeg2000_option: - self._cmake.definitions["WITH_JASPER"] = self.options.with_jpeg2000 == "jasper" - self._cmake.definitions["WITH_OPENJPEG"] = self.options.with_jpeg2000 == "openjpeg" - self._cmake.definitions["WITH_OPENEXR"] = self.options.with_openexr - self._cmake.definitions["WITH_EIGEN"] = self.options.with_eigen - self._cmake.definitions["HAVE_QUIRC"] = self.options.with_quirc # force usage of quirc requirement - self._cmake.definitions["WITH_DSHOW"] = self._is_msvc - self._cmake.definitions["WITH_MSMF"] = self._is_msvc - self._cmake.definitions["WITH_MSMF_DXVA"] = self._is_msvc - self._cmake.definitions["OPENCV_MODULES_PUBLIC"] = "opencv" - self._cmake.definitions["OPENCV_ENABLE_NONFREE"] = self.options.nonfree + tc.variables["WITH_JASPER"] = self.options.with_jpeg2000 == "jasper" + tc.variables["WITH_OPENJPEG"] = self.options.with_jpeg2000 == "openjpeg" + tc.variables["WITH_OPENEXR"] = self.options.with_openexr + if self.options.with_openexr: + tc.variables["CMAKE_CXX_STANDARD"] = 11 + tc.variables["WITH_EIGEN"] = self.options.with_eigen + tc.variables["HAVE_QUIRC"] = self.options.with_quirc # force usage of quirc requirement + tc.variables["WITH_DSHOW"] = is_msvc(self) + tc.variables["WITH_MSMF"] = is_msvc(self) + tc.variables["WITH_MSMF_DXVA"] = is_msvc(self) + tc.variables["OPENCV_MODULES_PUBLIC"] = "opencv" + tc.variables["OPENCV_ENABLE_NONFREE"] = self.options.nonfree if self.options.cpu_baseline: - self._cmake.definitions["CPU_BASELINE"] = self.options.cpu_baseline + tc.variables["CPU_BASELINE"] = self.options.cpu_baseline if self.options.cpu_dispatch: - self._cmake.definitions["CPU_DISPATCH"] = self.options.cpu_dispatch + tc.variables["CPU_DISPATCH"] = self.options.cpu_dispatch if self.options.get_safe("neon") is not None: - self._cmake.definitions["ENABLE_NEON"] = self.options.get_safe("neon") + tc.variables["ENABLE_NEON"] = self.options.get_safe("neon") - self._cmake.definitions["WITH_PROTOBUF"] = self.options.dnn + tc.variables["WITH_PROTOBUF"] = self.options.dnn if self.options.dnn: - self._cmake.definitions["PROTOBUF_UPDATE_FILES"] = True - self._cmake.definitions["BUILD_opencv_dnn"] = True - self._cmake.definitions["OPENCV_DNN_CUDA"] = self.options.get_safe("dnn_cuda", False) + tc.variables["PROTOBUF_UPDATE_FILES"] = True + tc.variables["BUILD_opencv_dnn"] = True + tc.variables["OPENCV_DNN_CUDA"] = self.options.get_safe("dnn_cuda", False) if self.options.contrib: - self._cmake.definitions['OPENCV_EXTRA_MODULES_PATH'] = os.path.join(self.build_folder, self._contrib_folder, 'modules') - self._cmake.definitions['BUILD_opencv_freetype'] = self.options.get_safe("contrib_freetype", False) - self._cmake.definitions['BUILD_opencv_sfm'] = self.options.get_safe("contrib_sfm", False) + tc.variables["OPENCV_EXTRA_MODULES_PATH"] = os.path.join(self._contrib_folder, "modules").replace("\\", "/") + tc.variables["BUILD_opencv_freetype"] = self.options.get_safe("contrib_freetype", False) + tc.variables["BUILD_opencv_sfm"] = self.options.get_safe("contrib_sfm", False) - if self.options.with_openexr: - self._cmake.definitions["OPENEXR_ROOT"] = self.deps_cpp_info["openexr"].rootpath if self.options.get_safe("with_jpeg2000") == "openjpeg": - openjpeg_version = tools.Version(self.deps_cpp_info["openjpeg"].version) - self._cmake.definitions["OPENJPEG_MAJOR_VERSION"] = openjpeg_version.major - self._cmake.definitions["OPENJPEG_MINOR_VERSION"] = openjpeg_version.minor - self._cmake.definitions["OPENJPEG_BUILD_VERSION"] = openjpeg_version.patch + openjpeg_version = Version(self.dependencies["openjpeg"].ref.version) + tc.variables["OPENJPEG_MAJOR_VERSION"] = openjpeg_version.major + tc.variables["OPENJPEG_MINOR_VERSION"] = openjpeg_version.minor + tc.variables["OPENJPEG_BUILD_VERSION"] = openjpeg_version.patch if self.options.parallel: - self._cmake.definitions["WITH_TBB"] = self.options.parallel == "tbb" - self._cmake.definitions["WITH_OPENMP"] = self.options.parallel == "openmp" + tc.variables["WITH_TBB"] = self.options.parallel == "tbb" + tc.variables["WITH_OPENMP"] = self.options.parallel == "openmp" - self._cmake.definitions["WITH_CUDA"] = self.options.with_cuda - self._cmake.definitions["WITH_ADE"] = self.options.with_ade + tc.variables["WITH_CUDA"] = self.options.with_cuda + tc.variables["WITH_ADE"] = self.options.with_ade if self.options.with_cuda: # This allows compilation on older GCC/NVCC, otherwise build errors. - self._cmake.definitions["CUDA_NVCC_FLAGS"] = "--expt-relaxed-constexpr" + tc.variables["CUDA_NVCC_FLAGS"] = "--expt-relaxed-constexpr" if self.options.cuda_arch_bin: - self._cmake.definitions["CUDA_ARCH_BIN"] = self.options.cuda_arch_bin - self._cmake.definitions["WITH_CUBLAS"] = self.options.get_safe("with_cublas", False) - self._cmake.definitions["WITH_CUFFT"] = self.options.get_safe("with_cufft", False) - self._cmake.definitions["WITH_CUDNN"] = self.options.get_safe("with_cudnn", False) + tc.variables["CUDA_ARCH_BIN"] = self.options.cuda_arch_bin + tc.variables["WITH_CUBLAS"] = self.options.get_safe("with_cublas", False) + tc.variables["WITH_CUFFT"] = self.options.get_safe("with_cufft", False) + tc.variables["WITH_CUDNN"] = self.options.get_safe("with_cudnn", False) - self._cmake.definitions["ENABLE_PIC"] = self.options.get_safe("fPIC", True) - self._cmake.definitions["ENABLE_CCACHE"] = False + tc.variables["ENABLE_PIC"] = self.options.get_safe("fPIC", True) + tc.variables["ENABLE_CCACHE"] = False - if self._is_msvc: - self._cmake.definitions["BUILD_WITH_STATIC_CRT"] = "MT" in msvc_runtime_flag(self) + if is_msvc(self): + tc.variables["BUILD_WITH_STATIC_CRT"] = is_msvc_static_runtime(self) - if self.settings.os == "Android": - self._cmake.definitions["ANDROID_STL"] = "c++_static" - self._cmake.definitions["ANDROID_NATIVE_API_LEVEL"] = self.settings.os.api_level - self._cmake.definitions["ANDROID_ABI"] = tools.to_android_abi(str(self.settings.arch)) - self._cmake.definitions["BUILD_ANDROID_EXAMPLES"] = False - if "ANDROID_NDK_HOME" in os.environ: - self._cmake.definitions["ANDROID_NDK"] = os.environ.get("ANDROID_NDK_HOME") - - if tools.cross_building(self): - # FIXME: too specific and error prone, should be delegated to CMake helper - cmake_system_processor = { - "armv8": "aarch64", - "armv8.3": "aarch64", - }.get(str(self.settings.arch), str(self.settings.arch)) - self._cmake.definitions["CONAN_OPENCV_SYSTEM_PROCESSOR"] = cmake_system_processor - # Workaround for cross-build to at least iOS/tvOS/watchOS, - # when dependencies are found with find_path() and find_library() - self._cmake.definitions["CMAKE_FIND_ROOT_PATH_MODE_INCLUDE"] = "BOTH" - self._cmake.definitions["CMAKE_FIND_ROOT_PATH_MODE_LIBRARY"] = "BOTH" - - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.generate() + + CMakeDeps(self).generate() def build(self): - self._patch_opencv() - cmake = self._configure_cmake() + self._patch_sources() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "cmake")) if os.path.isfile(os.path.join(self.package_folder, "setup_vars_opencv4.cmd")): - tools.rename(os.path.join(self.package_folder, "setup_vars_opencv4.cmd"), + rename(self, os.path.join(self.package_folder, "setup_vars_opencv4.cmd"), os.path.join(self.package_folder, "res", "setup_vars_opencv4.cmd")) # TODO: to remove in conan v2 once cmake_find_package* generators removed @@ -533,21 +506,20 @@ def package(self): {component["target"]:"opencv::{}".format(component["target"]) for component in self._opencv_components} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") # returns true if GTK2 is selected. To do this, the version option # of the gtk/system package is checked or the conan package version @@ -556,11 +528,11 @@ def _module_file_rel_path(self): def _is_gtk_version2(self): if not self.options.get_safe("with_gtk", False): return False - gtk_version = self.deps_cpp_info["gtk"].version + gtk_version = self.dependencies["gtk"].ref.version if gtk_version == "system": return self.options["gtk"].version == 2 else: - return tools.Version(gtk_version) < "3.0.0" + return Version(gtk_version) < "3.0.0" @property def _opencv_components(self): @@ -570,8 +542,12 @@ def imageformats_deps(): components.append("{0}::{0}".format(self.options.with_jpeg2000)) if self.options.with_png: components.append("libpng::libpng") - if self.options.with_jpeg: - components.append("{0}::{0}".format(self.options.with_jpeg)) + if self.options.with_jpeg == "libjpeg": + components.append("libjpeg::libjpeg") + elif self.options.with_jpeg == "libjpeg-turbo": + components.append("libjpeg-turbo::jpeg") + elif self.options.with_jpeg == "mozjpeg": + components.append("mozjpeg::libjpeg") if self.options.get_safe("with_tiff"): components.append("libtiff::libtiff") if self.options.with_openexr: @@ -737,11 +713,11 @@ def package_info(self): def get_lib_name(module): if module == "ippiw": - return "%s%s" % (module, debug) + return f"{module}{debug}" elif module in ("correspondence", "multiview", "numeric"): return module else: - return "opencv_%s%s%s" % (module, version, debug) + return f"opencv_{module}{version}{debug}" def add_components(components): for component in components: @@ -770,15 +746,15 @@ def add_components(components): self.cpp_info.components[conan_component].system_libs.append("mediandk") if not self.options.shared: self.cpp_info.components[conan_component].libdirs.append( - os.path.join("sdk", "native", "staticlibs", tools.to_android_abi(str(self.settings.arch)))) + os.path.join("sdk", "native", "staticlibs", to_android_abi(str(self.settings.arch)))) if conan_component == "opencv_core": self.cpp_info.components[conan_component].libdirs.append("lib") - self.cpp_info.components[conan_component].libs += tools.collect_libs(self) + self.cpp_info.components[conan_component].libs += collect_libs(self) if self.settings.os in ["iOS", "Macos", "Linux", "Neutrino"]: if not self.options.shared: if conan_component == "opencv_core": - libs = list(filter(lambda x: not x.startswith("opencv"), tools.collect_libs(self))) + libs = list(filter(lambda x: not x.startswith("opencv"), collect_libs(self))) self.cpp_info.components[conan_component].libs += libs # TODO: to remove in conan v2 once cmake_find_package* generators removed @@ -791,11 +767,9 @@ def add_components(components): self.cpp_info.components[conan_component_alias].names["cmake_find_package"] = cmake_component self.cpp_info.components[conan_component_alias].names["cmake_find_package_multi"] = cmake_component self.cpp_info.components[conan_component_alias].requires = [conan_component] + self.cpp_info.components[conan_component_alias].bindirs = [] self.cpp_info.components[conan_component_alias].includedirs = [] self.cpp_info.components[conan_component_alias].libdirs = [] - self.cpp_info.components[conan_component_alias].resdirs = [] - self.cpp_info.components[conan_component_alias].bindirs = [] - self.cpp_info.components[conan_component_alias].frameworkdirs = [] self.cpp_info.set_property("cmake_file_name", "OpenCV") diff --git a/recipes/opencv/4.x/patches/0002-openexr.patch b/recipes/opencv/4.x/patches/0002-openexr.patch deleted file mode 100644 index f0a2e1826d2a16..00000000000000 --- a/recipes/opencv/4.x/patches/0002-openexr.patch +++ /dev/null @@ -1,143 +0,0 @@ -diff --git a/cmake/OpenCVFindOpenEXR.cmake b/cmake/OpenCVFindOpenEXR.cmake -index c0a46806e1..ef633e853a 100644 ---- a/cmake/OpenCVFindOpenEXR.cmake -+++ b/cmake/OpenCVFindOpenEXR.cmake -@@ -15,60 +15,97 @@ file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH) - - if(WIN32) - SET(OPENEXR_ROOT "C:/Deploy" CACHE STRING "Path to the OpenEXR \"Deploy\" folder") -- if(CMAKE_CL_64) -+ if(X86_64) - SET(OPENEXR_LIBSEARCH_SUFFIXES x64/Release x64 x64/Debug) - elseif(MSVC) - SET(OPENEXR_LIBSEARCH_SUFFIXES Win32/Release Win32 Win32/Debug) - endif() --else() -- set(OPENEXR_ROOT "") -+elseif(UNIX) -+ SET(OPENEXR_LIBSEARCH_SUFFIXES ${CMAKE_LIBRARY_ARCHITECTURE}) - endif() - --SET(LIBRARY_PATHS -- /usr/lib -- /usr/local/lib -- /sw/lib -- /opt/local/lib -- "${ProgramFiles_ENV_PATH}/OpenEXR/lib/static" -- "${OPENEXR_ROOT}/lib") -+SET(SEARCH_PATHS -+ "${OPENEXR_ROOT}" -+ /usr -+ /usr/local -+ /sw -+ /opt -+ "${ProgramFiles_ENV_PATH}/OpenEXR") - --FIND_PATH(OPENEXR_INCLUDE_PATH ImfRgbaFile.h -- PATH_SUFFIXES OpenEXR -- PATHS -- /usr/include -- /usr/local/include -- /sw/include -- /opt/local/include -- "${ProgramFiles_ENV_PATH}/OpenEXR/include" -- "${OPENEXR_ROOT}/include") -+MACRO(FIND_OPENEXR_LIBRARY LIBRARY_NAME LIBRARY_SUFFIX) -+ string(TOUPPER "${LIBRARY_NAME}" LIBRARY_NAME_UPPER) -+ FIND_LIBRARY(OPENEXR_${LIBRARY_NAME_UPPER}_LIBRARY -+ NAMES ${LIBRARY_NAME}${LIBRARY_SUFFIX} -+ PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES} -+ NO_DEFAULT_PATH -+ PATHS "${SEARCH_PATH}/lib" "${SEARCH_PATH}/lib/static") -+ENDMACRO() - --FIND_LIBRARY(OPENEXR_HALF_LIBRARY -- NAMES Half -- PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES} -- PATHS ${LIBRARY_PATHS}) -+MACRO(ocv_find_openexr LIBRARY_SUFFIX) -+ IF(NOT OPENEXR_FOUND) -+ FIND_OPENEXR_LIBRARY("Half" "${LIBRARY_SUFFIX}") -+ FIND_OPENEXR_LIBRARY("Iex" "${LIBRARY_SUFFIX}") -+ FIND_OPENEXR_LIBRARY("Imath" "${LIBRARY_SUFFIX}") -+ FIND_OPENEXR_LIBRARY("IlmImf" "${LIBRARY_SUFFIX}") -+ FIND_OPENEXR_LIBRARY("IlmThread" "${LIBRARY_SUFFIX}") -+ IF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY AND OPENEXR_ILMTHREAD_LIBRARY) -+ SET(OPENEXR_FOUND TRUE) -+ ELSE() -+ UNSET(OPENEXR_IMATH_LIBRARY) -+ UNSET(OPENEXR_ILMIMF_LIBRARY) -+ UNSET(OPENEXR_IEX_LIBRARY) -+ UNSET(OPENEXR_ILMTHREAD_LIBRARY) -+ UNSET(OPENEXR_HALF_LIBRARY) -+ ENDIF() -+ ENDIF() -+ENDMACRO() - --FIND_LIBRARY(OPENEXR_IEX_LIBRARY -- NAMES Iex -- PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES} -- PATHS ${LIBRARY_PATHS}) -+FOREACH(SEARCH_PATH ${SEARCH_PATHS}) -+ FIND_PATH(OPENEXR_INCLUDE_PATH ImfRgbaFile.h -+ PATH_SUFFIXES OpenEXR -+ NO_DEFAULT_PATH -+ PATHS -+ "${SEARCH_PATH}/include") - --FIND_LIBRARY(OPENEXR_IMATH_LIBRARY -- NAMES Imath -- PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES} -- PATHS ${LIBRARY_PATHS}) -+ IF (OPENEXR_INCLUDE_PATH) -+ SET(OPENEXR_VERSION_FILE "${OPENEXR_INCLUDE_PATH}/OpenEXRConfig.h") -+ IF (EXISTS ${OPENEXR_VERSION_FILE}) -+ FILE (STRINGS ${OPENEXR_VERSION_FILE} contents REGEX "#define OPENEXR_VERSION_MAJOR ") -+ IF (${contents} MATCHES "#define OPENEXR_VERSION_MAJOR ([0-9]+)") -+ SET(OPENEXR_VERSION_MAJOR "${CMAKE_MATCH_1}") -+ ENDIF () -+ FILE (STRINGS ${OPENEXR_VERSION_FILE} contents REGEX "#define OPENEXR_VERSION_MINOR ") -+ IF (${contents} MATCHES "#define OPENEXR_VERSION_MINOR ([0-9]+)") -+ SET(OPENEXR_VERSION_MINOR "${CMAKE_MATCH_1}") -+ ENDIF () -+ ENDIF () -+ ENDIF () - --FIND_LIBRARY(OPENEXR_ILMIMF_LIBRARY -- NAMES IlmImf -- PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES} -- PATHS ${LIBRARY_PATHS}) -+ IF (OPENEXR_VERSION_MAJOR AND OPENEXR_VERSION_MINOR) -+ set(OPENEXR_VERSION "${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR}") -+ ENDIF () - --FIND_LIBRARY(OPENEXR_ILMTHREAD_LIBRARY -- NAMES IlmThread -- PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES} -- PATHS ${LIBRARY_PATHS}) -+ ocv_find_openexr("-${OPENEXR_VERSION}") -+ ocv_find_openexr("-${OPENEXR_VERSION}_s") -+ ocv_find_openexr("-${OPENEXR_VERSION}_d") -+ ocv_find_openexr("-${OPENEXR_VERSION}_s_d") -+ ocv_find_openexr("") -+ ocv_find_openexr("_s") -+ ocv_find_openexr("_d") -+ ocv_find_openexr("_s_d") - --IF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY) -- SET(OPENEXR_FOUND TRUE) -+ IF (OPENEXR_FOUND) -+ BREAK() -+ ENDIF() -+ -+ UNSET(OPENEXR_INCLUDE_PATH) -+ UNSET(OPENEXR_VERSION_FILE) -+ UNSET(OPENEXR_VERSION_MAJOR) -+ UNSET(OPENEXR_VERSION_MINOR) -+ UNSET(OPENEXR_VERSION) -+ENDFOREACH() -+ -+IF (OPENEXR_FOUND) - SET(OPENEXR_INCLUDE_PATHS ${OPENEXR_INCLUDE_PATH} CACHE PATH "The include paths needed to use OpenEXR") - SET(OPENEXR_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY} CACHE STRING "The libraries needed to use OpenEXR" FORCE) - ENDIF () diff --git a/recipes/opencv/4.x/patches/4.1.2-0001-find-openexr.patch b/recipes/opencv/4.x/patches/4.1.2-0001-find-openexr.patch new file mode 100644 index 00000000000000..5fb088fdf08884 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.1.2-0001-find-openexr.patch @@ -0,0 +1,18 @@ +--- a/cmake/OpenCVFindOpenEXR.cmake ++++ b/cmake/OpenCVFindOpenEXR.cmake +@@ -9,6 +9,15 @@ + # OPENEXR_LIBRARIES = libraries that are needed to use OpenEXR. + # + ++find_package(OpenEXR REQUIRED) ++if(TARGET OpenEXR::OpenEXR) ++ set(OPENEXR_LIBRARIES OpenEXR::OpenEXR) ++else() ++ set(OPENEXR_LIBRARIES openexr::openexr) ++endif() ++set(OPENEXR_FOUND TRUE) ++set(OPENEXR_VERSION ${OpenEXR_VERSION}) ++return() + SET(OPENEXR_LIBRARIES "") + SET(OPENEXR_LIBSEARCH_SUFFIXES "") + file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH) diff --git a/recipes/opencv/4.x/patches/4.1.2-0002-find-ade.patch b/recipes/opencv/4.x/patches/4.1.2-0002-find-ade.patch new file mode 100644 index 00000000000000..98f88b7c0ec2d8 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.1.2-0002-find-ade.patch @@ -0,0 +1,11 @@ +--- a/modules/gapi/cmake/init.cmake ++++ b/modules/gapi/cmake/init.cmake +@@ -4,7 +4,7 @@ if(NOT WITH_ADE) + return() + endif() + +-if (ade_DIR) ++if (1) + # if ade_DIR is set, use ADE-supplied CMake script + # to set up variables to the prebuilt ADE + find_package(ade 0.1.0) diff --git a/recipes/opencv/4.x/patches/4.1.2-0003-find-quirc.patch b/recipes/opencv/4.x/patches/4.1.2-0003-find-quirc.patch new file mode 100644 index 00000000000000..acfad3e91a1e03 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.1.2-0003-find-quirc.patch @@ -0,0 +1,8 @@ +--- a/modules/objdetect/CMakeLists.txt ++++ b/modules/objdetect/CMakeLists.txt +@@ -5,3 +5,2 @@ if(HAVE_QUIRC) +- get_property(QUIRC_INCLUDE GLOBAL PROPERTY QUIRC_INCLUDE_DIR) +- ocv_include_directories(${QUIRC_INCLUDE}) +- ocv_target_link_libraries(${the_module} quirc) ++ find_package(quirc REQUIRED CONFIG) ++ ocv_target_link_libraries(${the_module} quirc::quirc) diff --git a/recipes/opencv/4.x/patches/0001-jasper.patch b/recipes/opencv/4.x/patches/4.1.2-0004-jasper.patch similarity index 100% rename from recipes/opencv/4.x/patches/0001-jasper.patch rename to recipes/opencv/4.x/patches/4.1.2-0004-jasper.patch diff --git a/recipes/opencv/4.x/patches/4.5.0-0002-find-ade.patch b/recipes/opencv/4.x/patches/4.5.0-0002-find-ade.patch new file mode 100644 index 00000000000000..cf954ad2c04e8a --- /dev/null +++ b/recipes/opencv/4.x/patches/4.5.0-0002-find-ade.patch @@ -0,0 +1,11 @@ +--- a/modules/gapi/cmake/init.cmake ++++ b/modules/gapi/cmake/init.cmake +@@ -7,7 +7,7 @@ if(NOT WITH_ADE) + return() + endif() + +-if(ade_DIR) ++if(1) + # if ade_DIR is set, use ADE-supplied CMake script + # to set up variables to the prebuilt ADE + find_package(ade 0.1.0) diff --git a/recipes/opencv/4.x/patches/4.5.3-0001-find-openexr.patch b/recipes/opencv/4.x/patches/4.5.3-0001-find-openexr.patch new file mode 100644 index 00000000000000..d78a290b65ab09 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.5.3-0001-find-openexr.patch @@ -0,0 +1,23 @@ +--- a/cmake/OpenCVFindOpenEXR.cmake ++++ b/cmake/OpenCVFindOpenEXR.cmake +@@ -9,13 +9,15 @@ + # OPENEXR_LIBRARIES = libraries that are needed to use OpenEXR. + # + +-find_package(OpenEXR 3.0 CONFIG QUIET) ++find_package(OpenEXR REQUIRED) + if(TARGET OpenEXR::OpenEXR) +- SET(OPENEXR_FOUND TRUE) +- SET(OPENEXR_LIBRARIES OpenEXR::OpenEXR) +- SET(OPENEXR_VERSION ${OpenEXR_VERSION}) +- return() ++ set(OPENEXR_LIBRARIES OpenEXR::OpenEXR) ++else() ++ set(OPENEXR_LIBRARIES openexr::openexr) + endif() ++set(OPENEXR_FOUND TRUE) ++set(OPENEXR_VERSION ${OpenEXR_VERSION}) ++return() + + SET(OPENEXR_LIBRARIES "") + SET(OPENEXR_LIBSEARCH_SUFFIXES "") diff --git a/recipes/opencv/4.x/patches/4.5.5-0001-find-openexr.patch b/recipes/opencv/4.x/patches/4.5.5-0001-find-openexr.patch new file mode 100644 index 00000000000000..67e0aad7b74307 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.5.5-0001-find-openexr.patch @@ -0,0 +1,32 @@ +--- a/cmake/OpenCVFindOpenEXR.cmake ++++ b/cmake/OpenCVFindOpenEXR.cmake +@@ -9,21 +9,15 @@ + # OPENEXR_LIBRARIES = libraries that are needed to use OpenEXR. + # + +-if(NOT OPENCV_SKIP_OPENEXR_FIND_PACKAGE) +- find_package(OpenEXR 3 QUIET) +- #ocv_cmake_dump_vars(EXR) +- if(OpenEXR_FOUND) +- if(TARGET OpenEXR::OpenEXR) # OpenEXR 3+ +- set(OPENEXR_LIBRARIES OpenEXR::OpenEXR) +- set(OPENEXR_INCLUDE_PATHS "") +- set(OPENEXR_VERSION "${OpenEXR_VERSION}") +- set(OPENEXR_FOUND 1) +- return() +- else() +- message(STATUS "Unsupported find_package(OpenEXR) - missing OpenEXR::OpenEXR target (version ${OpenEXR_VERSION})") +- endif() +- endif() ++find_package(OpenEXR REQUIRED) ++if(TARGET OpenEXR::OpenEXR) ++ set(OPENEXR_LIBRARIES OpenEXR::OpenEXR) ++else() ++ set(OPENEXR_LIBRARIES openexr::openexr) + endif() ++set(OPENEXR_FOUND TRUE) ++set(OPENEXR_VERSION ${OpenEXR_VERSION}) ++return() + + SET(OPENEXR_LIBRARIES "") + SET(OPENEXR_LIBSEARCH_SUFFIXES "") diff --git a/recipes/opencv/4.x/test_package/CMakeLists.txt b/recipes/opencv/4.x/test_package/CMakeLists.txt index 3361bc4c26e1f3..590e6c1b43a32a 100644 --- a/recipes/opencv/4.x/test_package/CMakeLists.txt +++ b/recipes/opencv/4.x/test_package/CMakeLists.txt @@ -1,28 +1,14 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(OpenCV REQUIRED imgcodecs highgui objdetect CONFIG) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) option(built_with_ade "Enabled if opencv is built with ade" OFF) -if(built_with_ade) - add_definitions(-DBUILT_WITH_ADE) -endif() - option(built_with_ffmpeg "Enabled if opencv is built with ffmpeg" OFF) -if(built_with_ffmpeg) - add_definitions(-DBUILT_WITH_FFMPEG) -endif() - option(built_contrib_sfm "Enabled if opencv is built contrib sfm" OFF) -if(built_contrib_sfm) - add_definitions(-DBUILT_CONTRIB_SFM) -endif() + +find_package(OpenCV REQUIRED imgcodecs highgui objdetect CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} +target_link_libraries(${PROJECT_NAME} PRIVATE opencv_imgcodecs opencv_highgui opencv_objdetect @@ -30,4 +16,13 @@ target_link_libraries(${PROJECT_NAME} $ $ ) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +if(built_with_ade) + target_compile_definitions(${PROJECT_NAME} PRIVATE BUILT_WITH_ADE) +endif() +if(built_with_ffmpeg) + target_compile_definitions(${PROJECT_NAME} PRIVATE BUILT_WITH_FFMPEG) +endif() +if(built_contrib_sfm) + target_compile_definitions(${PROJECT_NAME} PRIVATE BUILT_CONTRIB_SFM) +endif() diff --git a/recipes/opencv/4.x/test_package/conanfile.py b/recipes/opencv/4.x/test_package/conanfile.py index 1c034b84e089a1..8cbff65ecd5a3a 100644 --- a/recipes/opencv/4.x/test_package/conanfile.py +++ b/recipes/opencv/4.x/test_package/conanfile.py @@ -1,20 +1,33 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["built_with_ade"] = self.dependencies["opencv"].options.with_ade + tc.variables["built_with_ffmpeg"] = self.dependencies["opencv"].options.with_ffmpeg + tc.variables["built_contrib_sfm"] = self.dependencies["opencv"].options.contrib and self.dependencies["opencv"].options.contrib_sfm + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["built_with_ade"] = self.options["opencv"].with_ade - cmake.definitions["built_with_ffmpeg"] = self.options["opencv"].with_ffmpeg - cmake.definitions["built_contrib_sfm"] = self.options["opencv"].contrib and self.options["opencv"].contrib_sfm cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/opencv/4.x/test_package/test_package.cpp b/recipes/opencv/4.x/test_package/test_package.cpp index 046f0f961f9b27..220a68d7c84b1b 100644 --- a/recipes/opencv/4.x/test_package/test_package.cpp +++ b/recipes/opencv/4.x/test_package/test_package.cpp @@ -12,8 +12,9 @@ #include #include #endif -#ifdef BUILD_WITH_FFMPEF +#ifdef BUILT_WITH_FFMPEG #include +#include #endif #ifdef BUILT_CONTRIB_SFM #include @@ -218,7 +219,7 @@ void TestGAPI() void TestVideo() { -#ifdef BUILD_WITH_FFMPEG +#ifdef BUILT_WITH_FFMPEG if (!videoio_registry::hasBackend(CAP_FFMPEG)) throw std::runtime_error("FFmpeg backend was not found"); #endif diff --git a/recipes/opencv/4.x/test_v1_package/CMakeLists.txt b/recipes/opencv/4.x/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/opencv/4.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/opencv/4.x/test_v1_package/conanfile.py b/recipes/opencv/4.x/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..1c034b84e089a1 --- /dev/null +++ b/recipes/opencv/4.x/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["built_with_ade"] = self.options["opencv"].with_ade + cmake.definitions["built_with_ffmpeg"] = self.options["opencv"].with_ffmpeg + cmake.definitions["built_contrib_sfm"] = self.options["opencv"].contrib and self.options["opencv"].contrib_sfm + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/openexr/2.x/conanfile.py b/recipes/openexr/2.x/conanfile.py index e6fecd0261780b..9665a746c28dfd 100644 --- a/recipes/openexr/2.x/conanfile.py +++ b/recipes/openexr/2.x/conanfile.py @@ -1,14 +1,13 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.build import cross_building +from conan.tools.build import cross_building, stdcpp_library from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.files import copy, get, replace_in_file, rmdir, save from conan.tools.scm import Version -from conans import tools as tools_legacy import os import textwrap -required_conan_version = ">=1.50.2 <1.51.0 || >=1.51.2" +required_conan_version = ">=1.54.0" class OpenEXRConan(ConanFile): @@ -36,7 +35,7 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def requirements(self): self.requires("zlib/1.2.13") @@ -217,7 +216,7 @@ def package_info(self): self.cpp_info.components["ilmbase_ilmbaseconfig"].defines.append("OPENEXR_DLL") if not self.options.shared: - libcxx = tools_legacy.stdcpp_library(self) + libcxx = stdcpp_library(self) if libcxx: self.cpp_info.components["openexr_ilmimfconfig"].system_libs.append(libcxx) self.cpp_info.components["ilmbase_ilmbaseconfig"].system_libs.append(libcxx) diff --git a/recipes/openexr/3.x/conanfile.py b/recipes/openexr/3.x/conanfile.py index 8f95edf1a7078d..83b40c8cc3b063 100644 --- a/recipes/openexr/3.x/conanfile.py +++ b/recipes/openexr/3.x/conanfile.py @@ -37,13 +37,13 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def requirements(self): self.requires("zlib/1.2.13") # Note: OpenEXR and Imath are versioned independently. - self.requires("imath/3.1.5") + self.requires("imath/3.1.5", transitive_headers=True) def validate(self): if self.info.settings.compiler.cppstd: diff --git a/recipes/opengl/all/conanfile.py b/recipes/opengl/all/conanfile.py index bff45b47153335..a7f52cf28c574e 100644 --- a/recipes/opengl/all/conanfile.py +++ b/recipes/opengl/all/conanfile.py @@ -1,9 +1,8 @@ from conan import ConanFile -from conan.errors import ConanException from conan.tools.system import package_manager -from conans import tools +from conan.tools.gnu import PkgConfig -required_conan_version = ">=1.47" +required_conan_version = ">=1.50.0" class SysConfigOpenGLConan(ConanFile): @@ -16,47 +15,21 @@ class SysConfigOpenGLConan(ConanFile): license = "MIT" settings = "os", "arch", "compiler", "build_type" - def package_id(self): - self.info.header_only() - - def _fill_cppinfo_from_pkgconfig(self, name): - pkg_config = tools.PkgConfig(name) - if not pkg_config.provides: - raise ConanException("OpenGL development files aren't available, give up") - libs = [lib[2:] for lib in pkg_config.libs_only_l] - lib_dirs = [lib[2:] for lib in pkg_config.libs_only_L] - ldflags = [flag for flag in pkg_config.libs_only_other] - include_dirs = [include[2:] for include in pkg_config.cflags_only_I] - cflags = [flag for flag in pkg_config.cflags_only_other if not flag.startswith("-D")] - defines = [flag[2:] for flag in pkg_config.cflags_only_other if flag.startswith("-D")] + def layout(self): + pass - self.cpp_info.system_libs.extend(libs) - self.cpp_info.libdirs.extend(lib_dirs) - self.cpp_info.sharedlinkflags.extend(ldflags) - self.cpp_info.exelinkflags.extend(ldflags) - self.cpp_info.defines.extend(defines) - self.cpp_info.includedirs.extend(include_dirs) - self.cpp_info.cflags.extend(cflags) - self.cpp_info.cxxflags.extend(cflags) + def package_id(self): + self.info.clear() def system_requirements(self): dnf = package_manager.Dnf(self) - if tools.os_info.linux_distro == "fedora" and tools.os_info.os_version >= "32": - dnf.install(["libglvnd-devel"], update=True, check=True) - else: - dnf.install(["mesa-libGL-devel"], update=True, check=True) + dnf.install_substitutes(["libglvnd-devel"], ["mesa-libGL-devel"], update=True, check=True) yum = package_manager.Yum(self) yum.install(["mesa-libGL-devel"], update=True, check=True) apt = package_manager.Apt(self) - ubuntu_20_or_later = tools.os_info.linux_distro == "ubuntu" and tools.os_info.os_version >= "20" - debian_11_or_later = tools.os_info.linux_distro == "debian" and tools.os_info.os_version >= "11" - pop_os_20_or_later = tools.os_info.linux_distro == "pop" and tools.os_info.os_version >= "20" - if ubuntu_20_or_later or debian_11_or_later or pop_os_20_or_later: - apt.install(["libgl-dev"], update=True, check=True) - else: - apt.install(["libgl1-mesa-dev"], update=True, check=True) + apt.install_substitutes(["libgl-dev"], ["libgl1-mesa-dev"], update=True, check=True) pacman = package_manager.PacMan(self) pacman.install(["libglvnd"], update=True, check=True) @@ -74,6 +47,7 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "opengl_system") + self.cpp_info.bindirs = [] self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] if self.settings.os == "Macos": @@ -82,4 +56,5 @@ def package_info(self): elif self.settings.os == "Windows": self.cpp_info.system_libs = ["opengl32"] elif self.settings.os in ["Linux", "FreeBSD"]: - self._fill_cppinfo_from_pkgconfig('gl') + pkg_config = PkgConfig(self, 'gl') + pkg_config.fill_cpp_info(self.cpp_info, is_system=self.settings.os != "FreeBSD") diff --git a/recipes/opengl/all/test_cmake_module_package/CMakeLists.txt b/recipes/opengl/all/test_cmake_module_package/CMakeLists.txt new file mode 100644 index 00000000000000..9c1b23a3582d3c --- /dev/null +++ b/recipes/opengl/all/test_cmake_module_package/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 3.10) +project(test_package) + +find_package(OpenGL REQUIRED) + +set(SOURCES ../test_package/test_package.cpp) + +if(WIN32) + list(APPEND SOURCES ../test_package/win.cpp) +endif() + +if(APPLE) + list(APPEND SOURCES ../test_package/osx.mm) + set_source_files_properties(../test_package/osx.mm PROPERTIES COMPILE_FLAGS "-x objective-c++") + + list(APPEND PLATFORM_LIBS "objc") + + find_library(APPKIT_LIBRARY AppKit) + find_library(FOUNDATION_LIBRARY Foundation) + + if(APPKIT_LIBRARY) + list(APPEND PLATFORM_LIBS ${APPKIT_LIBRARY}) + endif() + + if(FOUNDATION_LIBRARY) + list(APPEND PLATFORM_LIBS ${FOUNDATION_LIBRARY}) + endif() +endif() + +add_executable(${PROJECT_NAME} ${SOURCES}) +target_link_libraries(${PROJECT_NAME} PRIVATE OpenGL::GL ${PLATFORM_LIBS}) diff --git a/recipes/opengl/all/test_cmake_module_package/conanfile.py b/recipes/opengl/all/test_cmake_module_package/conanfile.py new file mode 100644 index 00000000000000..3a91c9439218e3 --- /dev/null +++ b/recipes/opengl/all/test_cmake_module_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/opengl/all/test_package/CMakeLists.txt b/recipes/opengl/all/test_package/CMakeLists.txt index 9bda7d9ae1dc31..cedabff6c4ea6a 100644 --- a/recipes/opengl/all/test_package/CMakeLists.txt +++ b/recipes/opengl/all/test_package/CMakeLists.txt @@ -1,34 +1,31 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.10) project(test_package) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(opengl_system REQUIRED CONFIG) set(SOURCES test_package.cpp) if(WIN32) -list(APPEND SOURCES win.cpp) + list(APPEND SOURCES win.cpp) endif() if(APPLE) + list(APPEND SOURCES osx.mm) + set_source_files_properties(osx.mm PROPERTIES COMPILE_FLAGS "-x objective-c++") -list(APPEND SOURCES osx.mm) -set_source_files_properties(osx.mm PROPERTIES COMPILE_FLAGS "-x objective-c++") + list(APPEND PLATFORM_LIBS "objc") -list(APPEND PLATFORM_LIBS "objc") + find_library(APPKIT_LIBRARY AppKit) + find_library(FOUNDATION_LIBRARY Foundation) -find_library(APPKIT_LIBRARY AppKit) -find_library(FOUNDATION_LIBRARY Foundation) - -if(APPKIT_LIBRARY) -list(APPEND PLATFORM_LIBS ${APPKIT_LIBRARY}) -endif() - -if(FOUNDATION_LIBRARY) -list(APPEND PLATFORM_LIBS ${FOUNDATION_LIBRARY}) -endif() + if(APPKIT_LIBRARY) + list(APPEND PLATFORM_LIBS ${APPKIT_LIBRARY}) + endif() + if(FOUNDATION_LIBRARY) + list(APPEND PLATFORM_LIBS ${FOUNDATION_LIBRARY}) + endif() endif() add_executable(${PROJECT_NAME} ${SOURCES}) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS} ${PLATFORM_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE opengl::opengl ${PLATFORM_LIBS}) diff --git a/recipes/opengl/all/test_package/conanfile.py b/recipes/opengl/all/test_package/conanfile.py index d4128b04507778..3a91c9439218e3 100644 --- a/recipes/opengl/all/test_package/conanfile.py +++ b/recipes/opengl/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/opengl/all/test_v1_cmake_module_package/CMakeLists.txt b/recipes/opengl/all/test_v1_cmake_module_package/CMakeLists.txt new file mode 100644 index 00000000000000..1de7a7ee473fdc --- /dev/null +++ b/recipes/opengl/all/test_v1_cmake_module_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_cmake_module_package + ${CMAKE_CURRENT_BINARY_DIR}/test_cmake_module_package) diff --git a/recipes/opengl/all/test_v1_cmake_module_package/conanfile.py b/recipes/opengl/all/test_v1_cmake_module_package/conanfile.py new file mode 100644 index 00000000000000..19e6a0c06e3d81 --- /dev/null +++ b/recipes/opengl/all/test_v1_cmake_module_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/opengl/all/test_v1_package/CMakeLists.txt b/recipes/opengl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/opengl/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/opengl/all/test_v1_package/conanfile.py b/recipes/opengl/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/opengl/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/openh264/all/conanfile.py b/recipes/openh264/all/conanfile.py index 43796c374b53dd..a281705e13bc9f 100644 --- a/recipes/openh264/all/conanfile.py +++ b/recipes/openh264/all/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conans import tools +from conan.tools.build import stdcpp_library from conan.tools.env import VirtualBuildEnv from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, replace_in_file, chdir from conan.tools.gnu import Autotools, AutotoolsToolchain @@ -11,7 +11,7 @@ import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.54.0" class OpenH264Conan(ConanFile): @@ -185,7 +185,6 @@ def package_info(self): self.cpp_info.system_libs.extend(["m", "pthread"]) if self.settings.os == "Android": self.cpp_info.system_libs.append("m") - # TODO: switch to conan.tools.build.stdcpp_library in conan 1.54 - libcxx = tools.stdcpp_library(self) + libcxx = stdcpp_library(self) if libcxx: self.cpp_info.system_libs.append(libcxx) diff --git a/recipes/openssl/1.x.x/conandata.yml b/recipes/openssl/1.x.x/conandata.yml index 87f7543e6bbd64..bf78950f0ec358 100644 --- a/recipes/openssl/1.x.x/conandata.yml +++ b/recipes/openssl/1.x.x/conandata.yml @@ -27,13 +27,17 @@ sources: patches: 1.0.2u: - patch_file: patches/1.0.2u-darwin-arm64.patch - base_path: source_subfolder + patch_description: "Darwin ARM64 support" + patch_type: "portability" 1.1.1p: - patch_file: patches/1.1.1-tvos-watchos.patch - base_path: source_subfolder + patch_description: "TVOS and WatchOS don't like fork()" + patch_type: "portability" 1.1.1q: - patch_file: patches/1.1.1-tvos-watchos.patch - base_path: source_subfolder + patch_description: "TVOS and WatchOS don't like fork()" + patch_type: "portability" 1.1.1s: - patch_file: patches/1.1.1-tvos-watchos.patch - base_path: source_subfolder + patch_description: "TVOS and WatchOS don't like fork()" + patch_type: "portability" diff --git a/recipes/openssl/1.x.x/conanfile.py b/recipes/openssl/1.x.x/conanfile.py index d8ce6a3abfe8c7..9dafdd8695067b 100644 --- a/recipes/openssl/1.x.x/conanfile.py +++ b/recipes/openssl/1.x.x/conanfile.py @@ -1,22 +1,30 @@ -from conan import ConanFile +from conan import ConanFile, conan_version from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os, XCRun from conan.tools.build import cross_building -from conan.tools.files import rename, get, rmdir -from conan.tools.microsoft import is_msvc, msvc_runtime_flag -from conans import AutoToolsBuildEnvironment, tools +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import ( + apply_conandata_patches, chdir, copy, export_conandata_patches, + get, load, rename, replace_in_file, rm, rmdir, save +) +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, msvc_runtime_flag, unix_path +from conan.tools.scm import Version from contextlib import contextmanager from functools import total_ordering import fnmatch +import json import os import textwrap -required_conan_version = ">=1.47.0" - +required_conan_version = ">=1.53.0" @total_ordering class OpenSSLVersion(object): - def __init__(self, version_str): + def __init__(self, version): self._pre = "" + version_str = str(version) tokens = version_str.split("-") if len(tokens) > 1: @@ -59,7 +67,7 @@ def compare(self, other): other = OpenSSLVersion(other) if self.as_list == other.as_list: return 0 - elif self.as_list < other.as_list: + if self.as_list < other.as_list: return -1 else: return 1 @@ -67,6 +75,7 @@ def compare(self, other): class OpenSSLConan(ConanFile): name = "openssl" + package_type = "library" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/openssl/openssl" license = "OpenSSL" @@ -136,19 +145,13 @@ class OpenSSLConan(ConanFile): "no_tls1": [True, False], "capieng_dialog": [True, False], "enable_capieng": [True, False], - "openssldir": "ANY", + "openssldir": ["ANY", None] } default_options = {key: False for key in options.keys()} default_options["fPIC"] = True default_options["no_md2"] = True default_options["openssldir"] = None - _env_build = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _is_clangcl(self): return self.settings.compiler == "clang" and self.settings.os == "Windows" @@ -169,15 +172,8 @@ def _settings_build(self): def _full_version(self): return OpenSSLVersion(self.version) - @property - def _win_bash(self): - return self._settings_build.os == "Windows" and \ - not self._use_nmake and \ - (self._is_mingw or cross_building(self, skip_x64_x86=True)) - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self._full_version >= "1.1.0": @@ -223,16 +219,16 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def layout(self): - pass + basic_layout(self, src_folder="src") def requirements(self): - if self._full_version < "1.1.0" and self.options.get_safe("no_zlib") == False: - self.requires("zlib/1.2.12") + if self._full_version < "1.1.0" and not self.options.get_safe("no_zlib"): + self.requires("zlib/1.2.13") def validate(self): if self.settings.os == "Emscripten": @@ -241,16 +237,54 @@ def validate(self): def build_requirements(self): if self._settings_build.os == "Windows": - if not self._win_bash: - self.build_requires("strawberryperl/5.30.0.1") - if not self.options.no_asm and not tools.which("nasm"): - self.build_requires("nasm/2.15.05") - if self._win_bash and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if not self.options.no_asm: + self.tool_requires("nasm/2.15.05") + if self._use_nmake: + self.tool_requires("strawberryperl/5.32.1.1") + else: + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + destination=self.source_folder, strip_root=True) + + def generate(self): + VirtualBuildEnv(self).generate() + + tc = AutotoolsToolchain(self) + # workaround for random error: size too large (archive member extends past the end of the file) + # /Library/Developer/CommandLineTools/usr/bin/ar: internal ranlib command failed + if self.settings.os == "Macos" and self._full_version < "1.1.0": + tc.make_args = ["-j1"] + # 1.1.0 era Makefiles don't do well with parallel installs + if not self._use_nmake and self._full_version >= "1.1.0" and self._full_version < "1.1.1": + tc.make_args = ["-j1"] + if self.settings.os == "Macos" and not cross_building(self): + tc.extra_cflags = [f"-isysroot {XCRun(self).sdk_path}"] + tc.extra_cxxflags = [f"-isysroot {XCRun(self).sdk_path}"] + tc.extra_ldflags = [f"-isysroot {XCRun(self).sdk_path}"] + env = tc.environment() + env.define("PERL", self._perl) + tc.generate(env) + gen_info = {} + gen_info["CFLAGS"] = tc.cflags + gen_info["CXXFLAGS"] = tc.cxxflags + gen_info["DEFINES"] = tc.defines + gen_info["LDFLAGS"] = tc.ldflags + # Support for self.dependencies in build() method is currently restricted to `generate()` and `validate()` + # See https://github.com/conan-io/conan/issues/12411 for more details + if self._full_version < "1.1.0" and not self.options.get_safe("no_zlib"): + zlib_cpp_info = self.dependencies["zlib"].cpp_info + gen_info["zlib_include_path"] = zlib_cpp_info.includedirs[0] + if self.settings.os == "Windows": + gen_info["zlib_lib_path"] = f"{zlib_cpp_info.libdirs[0]}/{zlib_cpp_info.libs[0]}.lib" + else: + gen_info["zlib_lib_path"] = zlib_cpp_info.libdirs[0] # Just path, linux will find the right file + save(self, "gen_info.conf", json.dumps(gen_info)) + tc = AutotoolsDeps(self) + tc.generate() @property def _target_prefix(self): @@ -283,7 +317,7 @@ def _perlasm_scheme(self): "armv8_32": "ios64", "armv8.3": "ios64", "armv7k": "ios32"}.get(the_arch, None) - elif the_os == "Android": + if the_os == "Android": return {"armv7": "void", "armv8": "linux64", "mips": "o32", @@ -447,14 +481,14 @@ def _tool(self, env_name, apple_name): if env_name in os.environ: return os.environ[env_name] if self.settings.compiler == "apple-clang": - return getattr(tools.XCRun(self.settings), apple_name) + return getattr(XCRun(self), apple_name) return None def _patch_configure(self): # since _patch_makefile_org will replace binutils variables # use a more restricted regular expresion to prevent that Configure script trying to do it again - configure = os.path.join(self._source_subfolder, "Configure") - tools.replace_in_file(configure, r"s/^AR=\s*ar/AR= $ar/;", r"s/^AR=\s*ar\b/AR= $ar/;") + configure = os.path.join(self.source_folder, "Configure") + replace_in_file(self, configure, r"s/^AR=\s*ar/AR= $ar/;", r"s/^AR=\s*ar\b/AR= $ar/;",encoding="latin_1") def _adjust_path(self, path): return path.replace("\\", "/") if self._settings_build.os == "Windows" else path @@ -462,43 +496,36 @@ def _adjust_path(self, path): def _patch_makefile_org(self): # https://wiki.openssl.org/index.php/Compilation_and_Installation#Modifying_Build_Settings # its often easier to modify Configure and Makefile.org rather than trying to add targets to the configure scripts - makefile_org = os.path.join(self._source_subfolder, "Makefile.org") - env_build = self._get_env_build() - with tools.environment_append(env_build.vars): - if not "CROSS_COMPILE" in os.environ: - cc = os.environ.get("CC", "cc") - tools.replace_in_file(makefile_org, "CC= cc\n", "CC= %s %s\n" % (self._adjust_path(cc), os.environ["CFLAGS"])) - if "AR" in os.environ: - tools.replace_in_file(makefile_org, "AR=ar $(ARFLAGS) r\n", "AR=%s $(ARFLAGS) r\n" % self._adjust_path(os.environ["AR"])) - if "RANLIB" in os.environ: - tools.replace_in_file(makefile_org, "RANLIB= ranlib\n", "RANLIB= %s\n" % self._adjust_path(os.environ["RANLIB"])) - rc = os.environ.get("WINDRES", os.environ.get("RC")) - if rc: - tools.replace_in_file(makefile_org, "RC= windres\n", "RC= %s\n" % self._adjust_path(rc)) - if "NM" in os.environ: - tools.replace_in_file(makefile_org, "NM= nm\n", "NM= %s\n" % self._adjust_path(os.environ["NM"])) - if "AS" in os.environ: - tools.replace_in_file(makefile_org, "AS=$(CC) -c\n", "AS=%s\n" % self._adjust_path(os.environ["AS"])) - - def _get_env_build(self): - if not self._env_build: - self._env_build = AutoToolsBuildEnvironment(self) - return self._env_build + makefile_org = os.path.join(self.source_folder, "Makefile.org") + if not "CROSS_COMPILE" in os.environ: + cc = os.environ.get("CC", "cc") + gen_info = json.loads(load(self, os.path.join(self.generators_folder, "gen_info.conf"))) + replace_in_file(self, makefile_org, "CC= cc\n", "CC= %s %s\n" % (self._adjust_path(cc), gen_info["CFLAGS"])) + if "AR" in os.environ: + replace_in_file(self, makefile_org, "AR=ar $(ARFLAGS) r\n", "AR=%s $(ARFLAGS) r\n" % self._adjust_path(os.environ["AR"])) + if "RANLIB" in os.environ: + replace_in_file(self, makefile_org, "RANLIB= ranlib\n", "RANLIB= %s\n" % self._adjust_path(os.environ["RANLIB"])) + rc = os.environ.get("WINDRES", os.environ.get("RC")) + if rc: + replace_in_file(self, makefile_org, "RC= windres\n", "RC= %s\n" % self._adjust_path(rc)) + if "NM" in os.environ: + replace_in_file(self, makefile_org, "NM= nm\n", "NM= %s\n" % self._adjust_path(os.environ["NM"])) + if "AS" in os.environ: + replace_in_file(self, makefile_org, "AS=$(CC) -c\n", "AS=%s\n" % self._adjust_path(os.environ["AS"])) def _get_default_openssl_dir(self): if self.settings.os == "Linux" and self._full_version >= "1.1.0": return "/etc/ssl" - return os.path.join(self.package_folder, "res") + return "res" @property def _configure_args(self): openssldir = self.options.openssldir or self._get_default_openssl_dir() - prefix = tools.unix_path(self.package_folder) if self._win_bash else self.package_folder - openssldir = tools.unix_path(openssldir) if self._win_bash else openssldir + openssldir = unix_path(self, openssldir) if self.win_bash else openssldir args = [ '"%s"' % (self._target if self._full_version >= "1.1.0" else self._ancestor_target), "shared" if self.options.shared else "no-shared", - "--prefix=\"%s\"" % prefix, + "--prefix=/", "--openssldir=\"%s\"" % openssldir, "no-unit-test", "no-threads" if self.options.no_threads else "threads" @@ -510,6 +537,9 @@ def _configure_args(self): if self._full_version >= "1.1.0": args.append("--debug" if self.settings.build_type == "Debug" else "--release") + if self.settings.os == "Linux" and self.settings.arch == "x86_64": + args.append("--libdir=lib") # See https://github.com/openssl/openssl/blob/master/INSTALL.md#libdir + if self.settings.os in ["tvOS", "watchOS"]: args.append(" -DNO_FORK") # fork is not available on tvOS and watchOS if self.settings.os == "Android": @@ -535,27 +565,33 @@ def _configure_args(self): if self.options.get_safe("no_zlib"): args.append("no-zlib") else: - zlib_info = self.deps_cpp_info["zlib"] - include_path = zlib_info.include_paths[0] - if self.settings.os == "Windows": - lib_path = "%s/%s.lib" % (zlib_info.lib_paths[0], zlib_info.libs[0]) - else: - lib_path = zlib_info.lib_paths[0] # Just path, linux will find the right file + gen_info = json.loads(load(self, os.path.join(self.generators_folder, "gen_info.conf"))) + include_path = gen_info["zlib_include_path"] + lib_path = gen_info["zlib_lib_path"] # clang-cl doesn't like backslashes in #define CFLAGS (builldinf.h -> cversion.c) include_path = self._adjust_path(include_path) - lib_path = self._adjust_path(lib_path) + lib_path = self._adjust_path(lib_path) - if self.options["zlib"].shared: - args.append("zlib-dynamic") + if Version(conan_version).major <2 : + if self.options["zlib"].shared: + args.append("zlib-dynamic") + else: + args.append("zlib") else: - args.append("zlib") + if self.dependencies["zlib"].options.shared: + args.append("zlib-dynamic") + else: + args.append("zlib") args.extend(['--with-zlib-include="%s"' % include_path, '--with-zlib-lib="%s"' % lib_path]) - - for option_name in self.options.values.fields: - activated = getattr(self.options, option_name) + if Version(conan_version).major < 2: + possible_values = self.options.values.fields + else: + possible_values = self.options.possible_values + for option_name in possible_values: + activated = self.options.get_safe(option_name) if activated and option_name not in ["fPIC", "openssldir", "capieng_dialog", "enable_capieng", "no_md2"]: self.output.info("activated option: %s" % option_name) args.append(option_name.replace("_", "-")) @@ -581,11 +617,12 @@ def _create_targets(self): }}, ); """ + gen_info = json.loads(load(self, os.path.join(self.generators_folder, "gen_info.conf"))) + self.output.info(f"gen_info = {gen_info}") cflags = [] cxxflags = [] - env_build = self._get_env_build() - cflags.extend(env_build.vars_dict["CFLAGS"]) - cxxflags.extend(env_build.vars_dict["CXXFLAGS"]) + cflags.extend(gen_info["CFLAGS"]) + cxxflags.extend(gen_info["CXXFLAGS"]) cc = self._tool("CC", "cc") cxx = self._tool("CXX", "cxx") @@ -599,13 +636,11 @@ def _create_targets(self): cc = 'cc => "%s",' % cc if cc else "" cxx = 'cxx => "%s",' % cxx if cxx else "" ar = 'ar => "%s",' % ar if ar else "" - defines = " ".join(env_build.defines) - defines = 'defines => add("%s"),' % defines if defines else "" + defines = ", ".join(f'"{d}"' for d in gen_info["DEFINES"]) + defines = 'defines => add([%s]),' % defines if defines else "" ranlib = 'ranlib => "%s",' % ranlib if ranlib else "" targets = "my %targets" if self._full_version >= "1.1.1" else "%targets" - includes = ", ".join(['"%s"' % include for include in env_build.include_paths]) - if self.settings.os == "Windows": - includes = includes.replace('\\', '/') # OpenSSL doesn't like backslashes + includes = "" if self._asm_target: ancestor = '[ "%s", asm("%s") ]' % (self._ancestor_target, self._asm_target) @@ -616,7 +651,7 @@ def _create_targets(self): shared_target = '' if self.settings.os == 'Neutrino': if self.options.shared: - shared_extension = 'shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",' + shared_extension = r'shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",' shared_target = 'shared_target => "gnu-shared",' if self.options.get_safe("fPIC", True): shared_cflag='shared_cflag => "-fPIC",' @@ -636,38 +671,20 @@ def _create_targets(self): shared_target=shared_target, shared_extension=shared_extension, shared_cflag=shared_cflag, - lflags=" ".join(env_build.link_flags)) + lflags=" ".join(gen_info["LDFLAGS"])) self.output.info("using target: %s -> %s" % (self._target, self._ancestor_target)) self.output.info(config) - tools.save(os.path.join(self._source_subfolder, "Configurations", "20-conan.conf"), config) - - def _run_make(self, targets=None, makefile=None, parallel=True): - command = [self._make_program] - if makefile: - command.extend(["-f", makefile]) - if targets: - command.extend(targets) - if not self._use_nmake: - # workaround for random error: size too large (archive member extends past the end of the file) - # /Library/Developer/CommandLineTools/usr/bin/ar: internal ranlib command failed - if self.settings.os == "Macos" and self._full_version < "1.1.0": - parallel = False - - # Building in parallel for versions less than 1.0.2d causes errors - # See https://github.com/openssl/openssl/issues/298 - if self._full_version < "1.0.2d": - parallel = False - command.append(("-j%s" % tools.cpu_count()) if parallel else "-j1") - self.run(" ".join(command), win_bash=self._win_bash) + save(self, os.path.join(self.source_folder, "Configurations", "20-conan.conf"), config) @property def _perl(self): - if self._settings_build.os == "Windows" and not self._win_bash: + if self._use_nmake: # enforce strawberry perl, otherwise wrong perl could be used (from Git bash, MSYS, etc.) - if "strawberryperl" in self.deps_cpp_info.deps: - return os.path.join(self.deps_cpp_info["strawberryperl"].rootpath, "bin", "perl.exe") - elif hasattr(self, "user_info_build") and "strawberryperl" in self.user_info_build: + build_deps = (dependency.ref.name for require, dependency in self.dependencies.build.items()) + if "strawberryperl" in build_deps: + return os.path.join(self.dependencies.build["strawberryperl"].package_folder, "bin", "perl.exe") + if hasattr(self, "user_info_build") and "strawberryperl" in self.user_info_build: return self.user_info_build["strawberryperl"].perl return "perl" @@ -675,62 +692,6 @@ def _perl(self): def _nmake_makefile(self): return r"ms\ntdll.mak" if self.options.shared else r"ms\nt.mak" - def _make(self): - with tools.chdir(self._source_subfolder): - # workaround for clang-cl not producing .pdb files - if self._is_clangcl: - tools.save("ossl_static.pdb", "") - args = " ".join(self._configure_args) - self.output.info(self._configure_args) - - if self._use_nmake and self._full_version >= "1.1.0": - self._replace_runtime_in_file(os.path.join("Configurations", "10-main.conf")) - - self.run('{perl} ./Configure {args}'.format(perl=self._perl, args=args), win_bash=self._win_bash) - - self._patch_install_name() - - if self._use_nmake and self._full_version < "1.1.0": - if not self.options.no_asm and self.settings.arch == "x86": - self.run(r"ms\do_nasm") - else: - self.run(r"ms\do_ms" if self.settings.arch == "x86" else r"ms\do_win64a") - - self._replace_runtime_in_file(os.path.join("ms", "nt.mak")) - self._replace_runtime_in_file(os.path.join("ms", "ntdll.mak")) - if self.settings.arch == "x86": - tools.replace_in_file(os.path.join("ms", "nt.mak"), "-WX", "") - tools.replace_in_file(os.path.join("ms", "ntdll.mak"), "-WX", "") - - self._run_make(makefile=self._nmake_makefile) - else: - self._run_make() - - def _make_install(self): - with tools.chdir(self._source_subfolder): - # workaround for MinGW (https://github.com/openssl/openssl/issues/7653) - if not os.path.isdir(os.path.join(self.package_folder, "bin")): - os.makedirs(os.path.join(self.package_folder, "bin")) - - if self._use_nmake and self._full_version < "1.1.0": - self._run_make(makefile=self._nmake_makefile, targets=["install"], parallel=False) - else: - self._run_make(targets=["install_sw"], parallel=False) - - @property - def _cc(self): - if "CROSS_COMPILE" in os.environ: - return "gcc" - if "CC" in os.environ: - return os.environ["CC"] - if self.settings.compiler == "apple-clang": - return tools.XCRun(self.settings).find("clang") - elif self.settings.compiler == "clang": - return "clang" - elif self.settings.compiler == "gcc": - return "gcc" - return "cc" - @contextmanager def _make_context(self): if self._use_nmake: @@ -739,89 +700,131 @@ def _make_context(self): # break nmake (don't know about mingw make). So we fix them def sanitize_env_var(var): return '"{}"'.format(var).replace('/', '\\') if '"' not in var else var - env = {key: sanitize_env_var(tools.get_env(key)) for key in ("CC", "RC") if tools.get_env(key)} - with tools.environment_append(env): + env = Environment() + for key in ("CC", "RC"): + if os.getenv(key): + env.define(key, sanitize_env_var(os.getenv(key))) + with env.vars(self).apply(): yield else: yield def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - with tools.vcvars(self.settings) if self._use_nmake else tools.no_op(): - env_vars = {"PERL": self._perl} - if self._full_version < "1.1.0": - cflags = " ".join(self._get_env_build().vars_dict["CFLAGS"]) - env_vars["CC"] = "%s %s" % (self._cc, cflags) - if self.settings.compiler == "apple-clang": - xcrun = tools.XCRun(self.settings) - env_vars["CROSS_SDK"] = os.path.basename(xcrun.sdk_path) - env_vars["CROSS_TOP"] = os.path.dirname(os.path.dirname(xcrun.sdk_path)) - if self.settings.os in ["iOS", "tvOS", "watchOS"] and self.conf.get("tools.apple:enable_bitcode", check_type=bool): - cflags = " ".join(self._get_env_build().vars_dict["CFLAGS"]) - env_vars["CFLAGS"] = "%s %s" % (cflags, "-fembed-bitcode") - with tools.environment_append(env_vars): - if self._full_version > "1.1.0": - self._create_targets() + apply_conandata_patches(self) + autotools = Autotools(self) + if self._full_version >= "1.1.0": + self._create_targets() + else: + self._patch_configure() + self._patch_makefile_org() + with self._make_context(): + with chdir(self, self.source_folder): + # workaround for clang-cl not producing .pdb files + if self._is_clangcl: + save(self, "ossl_static.pdb", "") + args = " ".join(self._configure_args) + self.output.info(self._configure_args) + + if self._use_nmake and self._full_version >= "1.1.0": + self._replace_runtime_in_file(os.path.join("Configurations", "10-main.conf")) + + self.run(f'{self._perl} ./Configure {args}') + + self._patch_install_name() + + if not self._use_nmake: + autotools.make() else: - self._patch_configure() - self._patch_makefile_org() - with self._make_context(): - self._make() + if self._full_version >= "1.1.0": + self.run(f'nmake /F Makefile') + else: # nmake 1.0.2 support + # Note: 1.0.2 should not be used according to the OpenSSL Project + # See https://www.openssl.org/source/ - @property - def _make_program(self): - if self._use_nmake: - return "nmake" - make_program = tools.get_env("CONAN_MAKE_PROGRAM", tools.which("make") or tools.which('mingw32-make')) - make_program = tools.unix_path(make_program) if self._settings_build.os == "Windows" else make_program - if not make_program: - raise Exception('could not find "make" executable. please set "CONAN_MAKE_PROGRAM" environment variable') - return make_program + if not self.options.no_asm and self.settings.arch == "x86": + self.run(r"ms\do_nasm") + else: + self.run(r"ms\do_ms" if self.settings.arch == "x86" else r"ms\do_win64a") + + self._replace_runtime_in_file(os.path.join("ms", "nt.mak")) + self._replace_runtime_in_file(os.path.join("ms", "ntdll.mak")) + if self.settings.arch == "x86": + replace_in_file(self, os.path.join("ms", "nt.mak"), "-WX", "") + replace_in_file(self, os.path.join("ms", "ntdll.mak"), "-WX", "") + + # NMAKE interprets trailing backslash as line continuation + replace_in_file(self, self._nmake_makefile, 'INSTALLTOP=\\', 'INSTALLTOP=/') + + self.run(f'nmake /F {self._nmake_makefile}') def _patch_install_name(self): - if tools.is_apple_os(self.settings.os) and self.options.shared: + if is_apple_os(self) and self.options.shared: old_str = '-install_name $(INSTALLTOP)/$(LIBDIR)/' new_str = '-install_name @rpath/' - makefile = "Makefile" if self._full_version >= "1.1.1" else "Makefile.shared" - tools.replace_in_file(makefile, old_str, new_str, strict=self.in_local_cache) + replace_in_file(self, makefile, old_str, new_str, strict=self.in_local_cache) + if self._use_nmake: + # NMAKE interprets trailing backslash as line continuation + if self._full_version >= "1.1.0": + replace_in_file(self, "Makefile", 'INSTALLTOP_dir=\\', 'INSTALLTOP_dir=/') def _replace_runtime_in_file(self, filename): runtime = msvc_runtime_flag(self) for e in ["MDd", "MTd", "MD", "MT"]: - tools.replace_in_file(filename, "/{} ".format(e), "/{} ".format(runtime), strict=False) - tools.replace_in_file(filename, "/{}\"".format(e), "/{}\"".format(runtime), strict=False) + replace_in_file(self, filename, "/{} ".format(e), "/{} ".format(runtime), strict=False) + replace_in_file(self, filename, "/{}\"".format(e), "/{}\"".format(runtime), strict=False) def package(self): - self.copy(src=self._source_subfolder, pattern="*LICENSE", dst="licenses") - with tools.vcvars(self.settings) if self._use_nmake else tools.no_op(): - self._make_install() - for root, _, files in os.walk(self.package_folder): - for filename in files: - if fnmatch.fnmatch(filename, "*.pdb"): - os.unlink(os.path.join(self.package_folder, root, filename)) + copy(self, "*LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses"), keep_path=False) if self._use_nmake: - if self.settings.build_type == 'Debug' and self._full_version >= "1.1.0": - with tools.chdir(os.path.join(self.package_folder, 'lib')): + args = [] + if self._full_version >= "1.1.0": + target = "install_sw" + args.append(f"DESTDIR={self.package_folder}") + else: # 1.0.2 support + target = "install" + args.append(f"INSTALLTOP={self.package_folder}") + openssldir = self.options.openssldir or self._get_default_openssl_dir() + args.append(f"OPENSSLDIR={os.path.join(self.package_folder, openssldir)}") + + with chdir(self, self.source_folder): + if self._full_version >= "1.1.0": + self.run(f'nmake -f Makefile {target} {" ".join(args)}') + else: # 1.0.2 support + self.run(f'nmake -f {self._nmake_makefile} {target} {" ".join(args)}') + rm(self, "*.pdb", self.package_folder, recursive=True) + if self.settings.build_type == "Debug" and self._full_version >= "1.1.0": + with chdir(self, os.path.join(self.package_folder, "lib")): rename(self, "libssl.lib", "libssld.lib") rename(self, "libcrypto.lib", "libcryptod.lib") - # Old OpenSSL version family has issues with permissions. - # See https://github.com/conan-io/conan/issues/5831 - if self._full_version < "1.1.0" and self.options.shared and self.settings.os in ("Android", "FreeBSD", "Linux"): - with tools.chdir(os.path.join(self.package_folder, "lib")): - os.chmod("libssl.so.1.0.0", 0o755) - os.chmod("libcrypto.so.1.0.0", 0o755) + else: + autotools = Autotools(self) + args = [] + target = "install_sw" + if self._full_version >= "1.1.0": + args.append(f"DESTDIR={unix_path(self, self.package_folder)}") + else: # 1.0.2 support + args.append(f"INSTALL_PREFIX={unix_path(self, self.package_folder)}") + + with chdir(self, self.source_folder): + autotools.make(target=target, args=args) + + # Old OpenSSL version family has issues with permissions. + # See https://github.com/conan-io/conan/issues/5831 + if self._full_version < "1.1.0" and self.options.shared and self.settings.os in ("Android", "FreeBSD", "Linux"): + with chdir(self, os.path.join(self.package_folder, "lib")): + os.chmod("libssl.so.1.0.0", 0o755) + os.chmod("libcrypto.so.1.0.0", 0o755) - if self.options.shared: - libdir = os.path.join(self.package_folder, "lib") - for file in os.listdir(libdir): - if self._is_mingw and file.endswith(".dll.a"): - continue - if file.endswith(".a"): - os.unlink(os.path.join(libdir, file)) + if self.options.shared: + libdir = os.path.join(self.package_folder, "lib") + for file in os.listdir(libdir): + if self._is_mingw and file.endswith(".dll.a"): + continue + if file.endswith(".a"): + os.unlink(os.path.join(libdir, file)) - rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) self._create_cmake_module_variables( os.path.join(self.package_folder, self._module_file_rel_path) @@ -866,11 +869,11 @@ def _create_cmake_module_variables(self, module_file): set(OPENSSL_VERSION ${OpenSSL_VERSION}) endif() """ % {"config":str(self.settings.build_type).upper()}) - tools.save(module_file, content) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-variables.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") diff --git a/recipes/openssl/1.x.x/test_package/conanfile.py b/recipes/openssl/1.x.x/test_package/conanfile.py index 9534143abdfa60..e42aaed0f7cf11 100644 --- a/recipes/openssl/1.x.x/test_package/conanfile.py +++ b/recipes/openssl/1.x.x/test_package/conanfile.py @@ -53,4 +53,3 @@ def test(self): if not self._skip_test and can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "digest") self.run(bin_path, env="conanrun") - assert os.path.exists(os.path.join(self.deps_cpp_info["openssl"].rootpath, "licenses", "LICENSE")) diff --git a/recipes/openssl/1.x.x/test_package/digest.c b/recipes/openssl/1.x.x/test_package/digest.c index 88a5a900a54a4b..e93ed8d7789634 100644 --- a/recipes/openssl/1.x.x/test_package/digest.c +++ b/recipes/openssl/1.x.x/test_package/digest.c @@ -7,7 +7,7 @@ #include #include #if defined(WITH_ZLIB) -#include +#include #endif #if defined(_MSC_VER) && _MSC_VER < 1900 @@ -98,7 +98,8 @@ int main() printf("SSL library version: %s\n", OpenSSL_version(OPENSSL_VERSION)); #endif #if defined(WITH_ZLIB) - printf("ZLIB version: %s\n", ZLIB_VERSION); + COMP_METHOD *zlib_comp = COMP_zlib(); + printf("ZLIB compression method is named: %s\n", SSL_COMP_get_name(zlib_comp)); #endif return 0; diff --git a/recipes/opentdf-client/all/conandata.yml b/recipes/opentdf-client/all/conandata.yml index 602b2b329ae019..b3ede12a6440cc 100644 --- a/recipes/opentdf-client/all/conandata.yml +++ b/recipes/opentdf-client/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.6": + url: "https://github.com/opentdf/client-cpp/archive/1.3.6.tar.gz" + sha256: "e0d4cf1d0b1824d903a2b0ec1da528acb42623e32f3ca36aa28b2e950c3cc7a0" "1.3.4": url: "https://github.com/opentdf/client-cpp/archive/1.3.4.tar.gz" sha256: "4b9836bff368249b709fc40e67c3a8664fed85a5d8247475ca1f741486210409" diff --git a/recipes/opentdf-client/config.yml b/recipes/opentdf-client/config.yml index 8d88f51943495b..b9d93dc47c8d4b 100644 --- a/recipes/opentdf-client/config.yml +++ b/recipes/opentdf-client/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.6": + folder: all "1.3.4": folder: all "1.3.3": diff --git a/recipes/opentelemetry-cpp/all/conandata.yml b/recipes/opentelemetry-cpp/all/conandata.yml index 89d461c779342e..88ad3e40bea9c0 100644 --- a/recipes/opentelemetry-cpp/all/conandata.yml +++ b/recipes/opentelemetry-cpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.8.1": + url: "https://github.com/open-telemetry/opentelemetry-cpp/archive/v1.8.1.tar.gz" + sha256: "3d640201594b07f08dade9cd1017bd0b59674daca26223b560b9bb6bf56264c2" "1.7.0": url: "https://github.com/open-telemetry/opentelemetry-cpp/archive/v1.7.0.tar.gz" sha256: "2ad0911cdc94fe84a93334773bef4789a38bd1f01e39560cabd4a5c267e823c3" @@ -22,6 +25,10 @@ sources: sha256: "32f12ff15ec257e3462883f84bc291c2d5dc30055604c12ec4b46a36dfa3f189" patches: + "1.8.1": + - patch_file: "patches/1.8.1-0001-fix-cmake.patch" + patch_description: "fix lack of linking libraries due to conan not generating the variables that are expected" + patch_type: "conan" "1.7.0": - patch_file: "patches/1.7.0-0001-fix-cmake.patch" patch_description: "fix lack of linking libraries due to conan not generating the variables that are expected" diff --git a/recipes/opentelemetry-cpp/all/conanfile.py b/recipes/opentelemetry-cpp/all/conanfile.py index e8717c1870f72a..123f72d4a9130e 100644 --- a/recipes/opentelemetry-cpp/all/conanfile.py +++ b/recipes/opentelemetry-cpp/all/conanfile.py @@ -52,10 +52,10 @@ def layout(self): def requirements(self): self.requires("abseil/20220623.0") - self.requires("grpc/1.48.0") - self.requires("libcurl/7.85.0") + self.requires("grpc/1.50.1") + self.requires("libcurl/7.86.0") self.requires("nlohmann_json/3.11.2") - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") if Version(self.version) <= "1.4.1": self.requires("opentelemetry-proto/0.11.0") else: diff --git a/recipes/opentelemetry-cpp/all/patches/1.8.1-0001-fix-cmake.patch b/recipes/opentelemetry-cpp/all/patches/1.8.1-0001-fix-cmake.patch new file mode 100644 index 00000000000000..5c4fcae46b11bb --- /dev/null +++ b/recipes/opentelemetry-cpp/all/patches/1.8.1-0001-fix-cmake.patch @@ -0,0 +1,27 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9b9710d..6eb42bb 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -222,7 +222,6 @@ if(WITH_JAEGER) + find_package(Thrift QUIET) + if(Thrift_FOUND) + find_package(Boost REQUIRED) +- include_directories(${Boost_INCLUDE_DIR}) + else() + # Install Thrift and propagate via vcpkg toolchain file + if(WIN32 AND (NOT DEFINED CMAKE_TOOLCHAIN_FILE)) +diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake +index 47f57a6..ebf5869 100644 +--- a/cmake/opentelemetry-proto.cmake ++++ b/cmake/opentelemetry-proto.cmake +@@ -280,6 +280,10 @@ else() # cmake 3.8 or lower + target_link_libraries(opentelemetry_proto INTERFACE ${Protobuf_LIBRARIES}) + endif() + ++if(TARGET gRPC::grpc++) ++ target_link_libraries(opentelemetry_proto PUBLIC gRPC::grpc++) ++endif() ++ + if(BUILD_SHARED_LIBS) + set_property(TARGET opentelemetry_proto PROPERTY POSITION_INDEPENDENT_CODE ON) + endif() diff --git a/recipes/opentelemetry-cpp/config.yml b/recipes/opentelemetry-cpp/config.yml index 6c4770afa8cf57..4dd7c49be1a03a 100644 --- a/recipes/opentelemetry-cpp/config.yml +++ b/recipes/opentelemetry-cpp/config.yml @@ -1,4 +1,6 @@ versions: + "1.8.1": + folder: all "1.7.0": folder: all "1.6.1": diff --git a/recipes/openxlsx/all/conandata.yml b/recipes/openxlsx/all/conandata.yml new file mode 100644 index 00000000000000..b863f248b7ed46 --- /dev/null +++ b/recipes/openxlsx/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.4.1": + url: "https://github.com/troldal/OpenXLSX/archive/b80da42d1454f361c29117095ebe1989437db390.zip" + sha256: "feb03e603aebec3d901dc32c8bf0b3e5df63f6db9ad4bbe187aa4c1633cfd44b" diff --git a/recipes/openxlsx/all/conanfile.py b/recipes/openxlsx/all/conanfile.py new file mode 100644 index 00000000000000..47998aed0e0848 --- /dev/null +++ b/recipes/openxlsx/all/conanfile.py @@ -0,0 +1,102 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + +required_conan_version = ">=1.53.0" + +class OpenXlsxConan(ConanFile): + name = "openxlsx" + description = "reading, writing, creating and modifying Microsoft Excel® (.xlsx) files." + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/troldal/OpenXLSX" + topics = ("excel", "spreadsheet", "xlsx") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "9", + "clang": "9", + "apple-clang": "12", + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["OPENXLSX_CREATE_DOCS"] = False + tc.variables["OPENXLSX_BUILD_SAMPLES"] = False + tc.variables["OPENXLSX_BUILD_TESTS"] = False + tc.variables["OPENXLSX_BUILD_BENCHMARKS"] = False + tc.variables["OPENXLSX_LIBRARY_TYPE"] = "SHARED" if self.options.shared else "STATIC" + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE.md", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + lib_suffix = "d" if self.settings.build_type == "Debug" else "" + self.cpp_info.libs = [f"OpenXLSX{lib_suffix}"] + + self.cpp_info.set_property("cmake_file_name", "OpenXLSX") + self.cpp_info.set_property("cmake_target_name", "OpenXLSX::OpenXLSX") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.system_libs.append("pthread") + self.cpp_info.system_libs.append("dl") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "OpenXLSX" + self.cpp_info.filenames["cmake_find_package_multi"] = "OpenXLSX" + self.cpp_info.names["cmake_find_package"] = "OpenXLSX" + self.cpp_info.names["cmake_find_package_multi"] = "OpenXLSX" diff --git a/recipes/openxlsx/all/test_package/CMakeLists.txt b/recipes/openxlsx/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..63dbcb0eff0efc --- /dev/null +++ b/recipes/openxlsx/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package LANGUAGES CXX) + +find_package(OpenXLSX REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE OpenXLSX::OpenXLSX) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/openxlsx/all/test_package/conanfile.py b/recipes/openxlsx/all/test_package/conanfile.py new file mode 100644 index 00000000000000..a9fb96656f2039 --- /dev/null +++ b/recipes/openxlsx/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/openxlsx/all/test_package/test_package.cpp b/recipes/openxlsx/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..c717bd551aae31 --- /dev/null +++ b/recipes/openxlsx/all/test_package/test_package.cpp @@ -0,0 +1,14 @@ +#include +#include + +#include "OpenXLSX/OpenXLSX.hpp" + +using namespace std; +using namespace OpenXLSX; + +int main(void) { + XLDocument doc; + doc.close(); + + return 0; +} diff --git a/recipes/openxlsx/all/test_v1_package/CMakeLists.txt b/recipes/openxlsx/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/openxlsx/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/openxlsx/all/test_v1_package/conanfile.py b/recipes/openxlsx/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/openxlsx/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/openxlsx/config.yml b/recipes/openxlsx/config.yml new file mode 100644 index 00000000000000..3a9d5538921fcd --- /dev/null +++ b/recipes/openxlsx/config.yml @@ -0,0 +1,3 @@ +versions: + "0.4.1": + folder: all diff --git a/recipes/opusfile/all/conandata.yml b/recipes/opusfile/all/conandata.yml index eebd6b1e0a89c0..6248280777374c 100644 --- a/recipes/opusfile/all/conandata.yml +++ b/recipes/opusfile/all/conandata.yml @@ -8,7 +8,11 @@ sources: patches: "0.12": - patch_file: "patches/001-disable-cert-store-integration.patch" - base_path: "source_subfolder" + patch_description: "Allow to build with OpenSSL 1.1" + patch_type: "portability" + patch_source: "https://github.com/xiph/opusfile/issues/13#issuecomment-425349836" "0.11": - patch_file: "patches/001-disable-cert-store-integration.patch" - base_path: "source_subfolder" + patch_description: "Allow to build with OpenSSL 1.1" + patch_type: "portability" + patch_source: "https://github.com/xiph/opusfile/issues/13#issuecomment-425349836" diff --git a/recipes/opusfile/all/conanfile.py b/recipes/opusfile/all/conanfile.py index be6dba78da278e..c7c9a6ee8b4e26 100644 --- a/recipes/opusfile/all/conanfile.py +++ b/recipes/opusfile/all/conanfile.py @@ -1,8 +1,14 @@ -from conans import ConanFile, MSBuild, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, MSBuild, MSBuildDeps, MSBuildToolchain import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class OpusFileConan(ConanFile): @@ -24,118 +30,144 @@ class OpusFileConan(ConanFile): "http": True, } - generators = "pkg_config" - exports_sources = "patches/*" - - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) @property - def _is_msvc(self): - return self.settings.compiler == "Visual Studio" + def _msbuild_configuration(self): + return "Debug" if self.settings.build_type == "Debug" else "Release" + + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") - def validate(self): - if self._is_msvc and self.options.shared: - raise ConanInvalidConfiguration("Opusfile doesn't support building as shared with Visual Studio") + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): self.requires("ogg/1.3.5") self.requires("opus/1.3.1") if self.options.http: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") + + def validate(self): + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} doesn't support building as shared with Visual Studio") def build_requirements(self): - if not self._is_msvc: - self.build_requires("libtool/2.4.6") - self.build_requires("pkgconf/1.7.4") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if not is_msvc(self): + self.tool_requires("libtool/2.4.7") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.configuration = self._msbuild_configuration + tc.properties["WholeProgramOptimization"] = "false" + tc.generate() + deps = MSBuildDeps(self) + deps.configuration = self._msbuild_configuration + deps.generate() + else: + VirtualBuildEnv(self).generate() + tc = AutotoolsToolchain(self) + yes_no = lambda v: "yes" if v else "no" + tc.configure_args.extend([ + f"--enable-http={yes_no(self.options.http)}", + "--disable-examples", + ]) + tc.generate() + PkgConfigDeps(self).generate() - def _build_vs(self): - includedir = os.path.abspath(os.path.join(self._source_subfolder, "include")) - with tools.chdir(os.path.join(self._source_subfolder, "win32", "VS2015")): - msbuild = MSBuild(self) - build_type = str(self.settings.build_type) + def build(self): + apply_conandata_patches(self) + if is_msvc(self): + sln_folder = os.path.join(self.source_folder, "win32", "VS2015") + vcxproj = os.path.join(sln_folder, "opusfile.vcxproj") if not self.options.http: - build_type += "-NoHTTP" - msbuild.build_env.include_paths.append(includedir) - msbuild.build(project_file="opusfile.sln", targets=["opusfile"], - platforms={"x86": "Win32"}, build_type=build_type, - upgrade_project=False) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--enable-http={}".format(yes_no(self.options.http)), - "--disable-examples", - ] - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools + replace_in_file(self, vcxproj, "OP_ENABLE_HTTP;", "") + + #============================== + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + replace_in_file( + self, vcxproj, + "true", + "", + ) + replace_in_file( + self, vcxproj, + "v140", + f"{MSBuildToolchain(self).toolset}", + ) + import_conan_generators = "" + for props_file in [MSBuildToolchain.filename, "conandeps.props"]: + props_path = os.path.join(self.generators_folder, props_file) + if os.path.exists(props_path): + import_conan_generators += f"" + replace_in_file( + self, vcxproj, + "", + f"{import_conan_generators}", + ) + #============================== - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if self._is_msvc: - self._build_vs() + msbuild = MSBuild(self) + msbuild.build_type = self._msbuild_configuration + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + msbuild.build(os.path.join(sln_folder, "opusfile.sln"), targets=["opusfile"]) else: - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows, run_environment=True) - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() autotools.make() def package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - if self._is_msvc: - include_folder = os.path.join(self._source_subfolder, "include") - self.copy(pattern="*", dst=os.path.join("include", "opus"), src=include_folder) - self.copy(pattern="*.dll", dst="bin", keep_path=False) - self.copy(pattern="*.lib", dst="lib", keep_path=False) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + include_folder = os.path.join(self.source_folder, "include") + copy(self, "*", src=include_folder, dst=os.path.join(self.package_folder, "include", "opus")) + copy(self, "*.dll", src=self.source_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "*.lib", src=self.source_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.components["libopusfile"].names["pkg_config"] = "opusfile" + self.cpp_info.components["libopusfile"].set_property("pkg_config_name", "opusfile") self.cpp_info.components["libopusfile"].libs = ["opusfile"] self.cpp_info.components["libopusfile"].includedirs.append(os.path.join("include", "opus")) self.cpp_info.components["libopusfile"].requires = ["ogg::ogg", "opus::opus"] if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.components["libopusfile"].system_libs = ["m", "dl", "pthread"] - if self._is_msvc: + if is_msvc(self): if self.options.http: self.cpp_info.components["libopusfile"].requires.append("openssl::openssl") else: - self.cpp_info.components["opusurl"].names["pkg_config"] = "opusurl" + self.cpp_info.set_property("pkg_config_name", "opusfile-do-not-use") + self.cpp_info.components["opusurl"].set_property("pkg_config_name", "opusurl") self.cpp_info.components["opusurl"].libs = ["opusurl"] self.cpp_info.components["opusurl"].requires = ["libopusfile"] if self.options.http: diff --git a/recipes/opusfile/all/patches/001-disable-cert-store-integration.patch b/recipes/opusfile/all/patches/001-disable-cert-store-integration.patch index 72a77fc47f380e..d6aaf58d662c65 100644 --- a/recipes/opusfile/all/patches/001-disable-cert-store-integration.patch +++ b/recipes/opusfile/all/patches/001-disable-cert-store-integration.patch @@ -1,5 +1,3 @@ -patch taken from https://github.com/xiph/opusfile/issues/13#issuecomment-425349836 for OpenSSL 1.1.1 support - diff -Nur opusfile-0.11/src/http.c opusfile-0.11-patched/src/http.c --- a/src/http.c 2018-09-14 23:25:45.000000000 +0200 +++ b/src/http.c 2018-09-27 15:42:55.161531800 +0200 diff --git a/recipes/opusfile/all/test_package/CMakeLists.txt b/recipes/opusfile/all/test_package/CMakeLists.txt index 7b9b613cbb24a3..70e83b74bb91b5 100644 --- a/recipes/opusfile/all/test_package/CMakeLists.txt +++ b/recipes/opusfile/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(opusfile REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE opusfile::opusfile) diff --git a/recipes/opusfile/all/test_package/conanfile.py b/recipes/opusfile/all/test_package/conanfile.py index d4128b04507778..98ab55852ad565 100644 --- a/recipes/opusfile/all/test_package/conanfile.py +++ b/recipes/opusfile/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/opusfile/all/test_v1_package/CMakeLists.txt b/recipes/opusfile/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/opusfile/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/opusfile/all/test_v1_package/conanfile.py b/recipes/opusfile/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/opusfile/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/osmanip/all/conanfile.py b/recipes/osmanip/all/conanfile.py index 8a6899850a3b87..ccea62899d7104 100644 --- a/recipes/osmanip/all/conanfile.py +++ b/recipes/osmanip/all/conanfile.py @@ -39,7 +39,7 @@ def configure(self): self.options.rm_safe("fPIC") def requirements(self): - self.requires("boost/1.80.0") + self.requires("boost/1.81.0") if Version(self.version) < "4.2.0": self.requires("arsenalgear/1.2.2") else: diff --git a/recipes/osmanip/all/test_v1_package/CMakeLists.txt b/recipes/osmanip/all/test_v1_package/CMakeLists.txt index fbf268aae5e4a8..426dbc1aa18df9 100644 --- a/recipes/osmanip/all/test_v1_package/CMakeLists.txt +++ b/recipes/osmanip/all/test_v1_package/CMakeLists.txt @@ -5,8 +5,5 @@ project(test_package CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(osmanip REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE osmanip::osmanip) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/packio/all/conandata.yml b/recipes/packio/all/conandata.yml index 6e87f4c19f689e..409d2af8af9cf9 100644 --- a/recipes/packio/all/conandata.yml +++ b/recipes/packio/all/conandata.yml @@ -32,3 +32,6 @@ sources: "2.2.0": url: "https://github.com/qchateau/packio/archive/2.2.0.tar.gz" sha256: "ac9f33d5e8dd92bd3cdec106e10453424060bae9c4cd97281aa5d20fb20476f7" + "2.3.0": + url: "https://github.com/qchateau/packio/archive/2.3.0.tar.gz" + sha256: "4ef3bc76934855cc1a17eb00311bb42f5f14f616c75d4d1cc35151efcc988358" diff --git a/recipes/packio/config.yml b/recipes/packio/config.yml index 1ee2ce354c532a..84901be3d2175c 100644 --- a/recipes/packio/config.yml +++ b/recipes/packio/config.yml @@ -21,3 +21,5 @@ versions: folder: all "2.2.0": folder: all + "2.3.0": + folder: all diff --git a/recipes/pcre2/all/conandata.yml b/recipes/pcre2/all/conandata.yml index dd96870544fa53..344830544b429b 100644 --- a/recipes/pcre2/all/conandata.yml +++ b/recipes/pcre2/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "10.42": + url: "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.42/pcre2-10.42.tar.bz2" + sha256: "8d36cd8cb6ea2a4c2bb358ff6411b0c788633a2a45dabbf1aeb4b701d1b5e840" "10.40": url: "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.40/pcre2-10.40.tar.bz2" sha256: "14e4b83c4783933dc17e964318e6324f7cae1bc75d8f3c79bc6969f00c159d68" @@ -34,35 +37,35 @@ patches: "10.40": - patch_file: "patches/0001-fix-cmake-1.39.patch" patch_description: "correct the order of cmake_minimum_required() and project()" - patch_type: "backport" + patch_type: "conan" patch_source: "https://github.com/PCRE2Project/pcre2/pull/142" "10.39": - patch_file: "patches/0001-fix-cmake-1.39.patch" patch_description: "correct the order of cmake_minimum_required() and project()" - patch_type: "backport" + patch_type: "conan" patch_source: "https://github.com/PCRE2Project/pcre2/pull/142" "10.37": - patch_file: "patches/0001-fix-cmake-1.36.patch" patch_description: "correct the order of cmake_minimum_required() and project()" - patch_type: "backport" + patch_type: "conan" patch_source: "https://github.com/PCRE2Project/pcre2/pull/142" "10.36": - patch_file: "patches/0001-fix-cmake-1.36.patch" patch_description: "correct the order of cmake_minimum_required() and project()" - patch_type: "backport" + patch_type: "conan" patch_source: "https://github.com/PCRE2Project/pcre2/pull/142" "10.35": - patch_file: "patches/0001-fix-cmake-1.35.patch" patch_description: "correct the order of cmake_minimum_required() and project()" - patch_type: "backport" + patch_type: "conan" patch_source: "https://github.com/PCRE2Project/pcre2/pull/142" "10.33": - patch_file: "patches/0001-fix-cmake-1.33.patch" patch_description: "correct the order of cmake_minimum_required() and project()" - patch_type: "backport" + patch_type: "conan" patch_source: "https://github.com/PCRE2Project/pcre2/pull/142" "10.32": - patch_file: "patches/0001-fix-cmake-1.32.patch" patch_description: "correct the order of cmake_minimum_required() and project()" - patch_type: "backport" + patch_type: "conan" patch_source: "https://github.com/PCRE2Project/pcre2/pull/142" diff --git a/recipes/pcre2/all/conanfile.py b/recipes/pcre2/all/conanfile.py index 9c0c5f3407f587..5982290e7cdbe1 100644 --- a/recipes/pcre2/all/conanfile.py +++ b/recipes/pcre2/all/conanfile.py @@ -1,12 +1,12 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, replace_in_file, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir from conan.tools.microsoft import is_msvc, is_msvc_static_runtime from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class PCRE2Conan(ConanFile): @@ -44,8 +44,7 @@ class PCRE2Conan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -53,20 +52,17 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") if not self.options.build_pcre2grep: del self.options.with_zlib del self.options.with_bzip2 del self.options.grep_support_callout_fork + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): if self.options.get_safe("with_zlib"): self.requires("zlib/1.2.13") @@ -74,14 +70,11 @@ def requirements(self): self.requires("bzip2/1.0.8") def validate(self): - if not self.info.options.build_pcre2_8 and not self.info.options.build_pcre2_16 and not self.info.options.build_pcre2_32: + if not self.options.build_pcre2_8 and not self.options.build_pcre2_16 and not self.options.build_pcre2_32: raise ConanInvalidConfiguration("At least one of build_pcre2_8, build_pcre2_16 or build_pcre2_32 must be enabled") - if self.info.options.build_pcre2grep and not self.info.options.build_pcre2_8: + if self.options.build_pcre2grep and not self.options.build_pcre2_8: raise ConanInvalidConfiguration("build_pcre2_8 must be enabled for the pcre2grep program") - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) diff --git a/recipes/pcre2/all/test_package/conanfile.py b/recipes/pcre2/all/test_package/conanfile.py index 3a8c6c5442b33b..0a6bc68712d901 100644 --- a/recipes/pcre2/all/test_package/conanfile.py +++ b/recipes/pcre2/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/pcre2/all/test_v1_package/CMakeLists.txt b/recipes/pcre2/all/test_v1_package/CMakeLists.txt index e362ee08875dba..0d20897301b68b 100644 --- a/recipes/pcre2/all/test_v1_package/CMakeLists.txt +++ b/recipes/pcre2/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(PCRE2 REQUIRED 8BIT CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE PCRE2::8BIT) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/pcre2/config.yml b/recipes/pcre2/config.yml index 7ad15f550bc8d6..f488a0ecff8cbb 100644 --- a/recipes/pcre2/config.yml +++ b/recipes/pcre2/config.yml @@ -1,4 +1,6 @@ versions: + "10.42": + folder: all "10.40": folder: all "10.39": diff --git a/recipes/perfetto/all/CMakeLists.txt b/recipes/perfetto/all/CMakeLists.txt index 2a529e18fd1317..9fc76922c46c1f 100644 --- a/recipes/perfetto/all/CMakeLists.txt +++ b/recipes/perfetto/all/CMakeLists.txt @@ -4,7 +4,7 @@ project(perfetto LANGUAGES CXX) set(PUBLIC_HEADERS ${PERFETTO_SRC_DIR}/sdk/perfetto.h) add_library(perfetto ${PERFETTO_SRC_DIR}/sdk/perfetto.cc) -target_compile_features(perfetto PRIVATE cxx_std_11) +target_compile_features(perfetto PRIVATE ${PERFETTO_CXX_STANDARD}) set_target_properties(perfetto PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS}" WINDOWS_EXPORT_ALL_SYMBOLS TRUE @@ -27,6 +27,8 @@ if (MSVC) target_compile_options(perfetto PRIVATE "/bigobj") # The perfetto library needs permissive flag on MSVC target_compile_options(perfetto PRIVATE "/permissive-") + # https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ + target_compile_options(perfetto PRIVATE "/Zc:__cplusplus") endif (MSVC) include(GNUInstallDirs) diff --git a/recipes/perfetto/all/conandata.yml b/recipes/perfetto/all/conandata.yml index 1f7ca252d5475f..e05df11e263504 100644 --- a/recipes/perfetto/all/conandata.yml +++ b/recipes/perfetto/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "31.0": + url: "https://github.com/google/perfetto/archive/refs/tags/v31.0.tar.gz" + sha256: "544c68293590f53391ea4267d5a9b1a4594e1c8216fc5f5ce9d0f1227797922e" "30.0": url: "https://github.com/google/perfetto/archive/refs/tags/v30.0.tar.gz" sha256: "d1883793a2adb2a4105fc083478bf781badd566d72da45caa99095b61f938a2e" @@ -33,6 +36,12 @@ sources: url: "https://github.com/google/perfetto/archive/refs/tags/v20.1.tar.gz" sha256: "d681bb76e2b73e6ba46db53c1502f31f4f16c36cd6e91d4ae839a3b44272f646" patches: + "31.0": + - patch_file: "patches/v31.0/0001-tracing-fix-compile-on-MSVC.patch" + patch_description: "Fix compilation on MSVC" + patch_type: "backport" + patch_source: "https://android-review.googlesource.com/c/platform/external/perfetto/+/2355222" + sha256: "ad253a9bba3941bd8d1f206422d60eb1c06cb6d75d60eff5b5b8ae0f2ec7e15c" "25.0": - patch_file: "patches/v25.0/0001-MSVC-Fix-narrowing-conversion-error.patch" "22.1": diff --git a/recipes/perfetto/all/conanfile.py b/recipes/perfetto/all/conanfile.py index 18122a94ea687b..44d0edf055cd6e 100644 --- a/recipes/perfetto/all/conanfile.py +++ b/recipes/perfetto/all/conanfile.py @@ -3,6 +3,7 @@ from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +from conan.tools.microsoft import is_msvc from conan.tools.scm import Version import os @@ -30,6 +31,20 @@ class PerfettoConan(ConanFile): short_paths = True + @property + def _minimum_cpp_standard(self): + return 11 if Version(self.version) < "31.0" else 17 + + @property + def _minimum_compilers_version(self): + return { + "Visual Studio": "15" if Version(self.version) < "31.0" else "16", + "msvc": "190", + "gcc": "7", + "clang": "3.3" if Version(self.version) < "31.0" else "5", + "apple-clang": "5.0" if Version(self.version) < "31.0" else "9.1", + } + def export_sources(self): copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) export_conandata_patches(self) @@ -46,10 +61,21 @@ def layout(self): cmake_layout(self, src_folder="src") def validate(self): - if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < 7: - raise ConanInvalidConfiguration ("perfetto requires gcc >= 7") if self.info.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, 11) + check_min_cppstd(self, self._minimum_cpp_standard) + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + compiler = self.info.settings.compiler + min_version = self._minimum_compilers_version.get(str(compiler)) + if min_version and loose_lt_semver(str(compiler.version), min_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires {compiler} {min_version}. The current compiler is {compiler} {compiler.version}." + ) def source(self): get(self, **self.conan_data["sources"][self.version], @@ -59,6 +85,7 @@ def generate(self): tc = CMakeToolchain(self) tc.variables["PERFETTO_SRC_DIR"] = self.source_folder.replace("\\", "/") tc.variables["PERFETTO_DISABLE_LOGGING"] = self.options.disable_logging + tc.variables["PERFETTO_CXX_STANDARD"] = f"cxx_std_{self._minimum_cpp_standard}" tc.generate() def build(self): @@ -78,4 +105,6 @@ def package_info(self): self.cpp_info.system_libs.append("pthread") if self.settings.os == "Windows": self.cpp_info.system_libs.append("ws2_32") + if is_msvc(self): + self.cpp_info.cxxflags.append("/Zc:__cplusplus") diff --git a/recipes/perfetto/all/patches/v31.0/0001-tracing-fix-compile-on-MSVC.patch b/recipes/perfetto/all/patches/v31.0/0001-tracing-fix-compile-on-MSVC.patch new file mode 100644 index 00000000000000..0ad8e6cb604c63 --- /dev/null +++ b/recipes/perfetto/all/patches/v31.0/0001-tracing-fix-compile-on-MSVC.patch @@ -0,0 +1,19 @@ +diff --git a/sdk/perfetto.h b/sdk/perfetto.h +index 175c092..682cea7 100644 +--- a/sdk/perfetto.h ++++ b/sdk/perfetto.h +@@ -18090,8 +18090,9 @@ class TrackEventDataSource + } while (false) + + // C++17 doesn't like a move constructor being defined for the EventFinalizer +-// class but C++11 doesn't compile without it being defined so support both. +-#if PERFETTO_IS_AT_LEAST_CPP17() ++// class but C++11 and MSVC doesn't compile without it being defined so support ++// both. ++#if PERFETTO_IS_AT_LEAST_CPP17() && !PERFETTO_BUILDFLAG(PERFETTO_COMPILER_MSVC) + #define PERFETTO_INTERNAL_EVENT_FINALIZER_KEYWORD delete + #else + #define PERFETTO_INTERNAL_EVENT_FINALIZER_KEYWORD default +-- +2.24.3 (Apple Git-128) + diff --git a/recipes/perfetto/all/test_package/CMakeLists.txt b/recipes/perfetto/all/test_package/CMakeLists.txt index 525edf89222e6a..ad42eab5529ea1 100644 --- a/recipes/perfetto/all/test_package/CMakeLists.txt +++ b/recipes/perfetto/all/test_package/CMakeLists.txt @@ -4,5 +4,9 @@ project(test_package LANGUAGES CXX) find_package(perfetto REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +if(perfetto_VERSION VERSION_LESS "31.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() target_link_libraries(${PROJECT_NAME} PRIVATE perfetto::perfetto) diff --git a/recipes/perfetto/config.yml b/recipes/perfetto/config.yml index 252acc314d9f81..9f4eb56715091d 100644 --- a/recipes/perfetto/config.yml +++ b/recipes/perfetto/config.yml @@ -1,4 +1,6 @@ versions: + "31.0": + folder: all "30.0": folder: all "27.1": diff --git a/recipes/perlinnoise/all/conandata.yml b/recipes/perlinnoise/all/conandata.yml new file mode 100644 index 00000000000000..9b1218cce4fb3b --- /dev/null +++ b/recipes/perlinnoise/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "3.0.0": + url: "https://github.com/Reputeless/PerlinNoise/archive/refs/tags/v3.0.0.tar.gz" + sha256: "1fea1e7ebeb3c66b79d60c2c398aa83ccfadcef343bd396c0f0a684380e827fc" diff --git a/recipes/perlinnoise/all/conanfile.py b/recipes/perlinnoise/all/conanfile.py new file mode 100644 index 00000000000000..5c27415325d35c --- /dev/null +++ b/recipes/perlinnoise/all/conanfile.py @@ -0,0 +1,79 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.52.0" + +class PerlinnoiseConan(ConanFile): + name = "perlinnoise" + description = "Header-only Perlin noise library for modern C++ " + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Reputeless/PerlinNoise/" + topics = ("noise", "perlin", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 17 + + @property + def _compiler_required_cpp(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "7", + "apple-clang": "12.0", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compiler_required_cpp.get(str(self.settings.compiler), False) + if minimum_version: + if Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.") + else: + self.output.warn(f"{self.ref} requires C++{self._min_cppstd}. Your compiler is unknown. Assuming it supports C++{self._min_cppstd}.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def package(self): + copy(self, pattern="LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder, + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "PerlinNoise") + self.cpp_info.set_property("cmake_target_name", "siv::PerlinNoise") + + self.cpp_info.components["siv"].set_property("cmake_target_name", "siv::PerlinNoise") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "PerlinNoise" + self.cpp_info.filenames["cmake_find_package_multi"] = "PerlinNoise" + self.cpp_info.names["cmake_find_package"] = "siv" + self.cpp_info.names["cmake_find_package_multi"] = "siv" + + self.cpp_info.components["siv"].names["cmake_find_package"] = "PerlinNoise" + self.cpp_info.components["siv"].names["cmake_find_package_multi"] = "PerlinNoise" diff --git a/recipes/perlinnoise/all/test_package/CMakeLists.txt b/recipes/perlinnoise/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..18878f56fc9d56 --- /dev/null +++ b/recipes/perlinnoise/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(PerlinNoise REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE siv::PerlinNoise) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/perlinnoise/all/test_package/conanfile.py b/recipes/perlinnoise/all/test_package/conanfile.py new file mode 100644 index 00000000000000..e845ae751a3017 --- /dev/null +++ b/recipes/perlinnoise/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/perlinnoise/all/test_package/test_package.cpp b/recipes/perlinnoise/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..082d3dfe079317 --- /dev/null +++ b/recipes/perlinnoise/all/test_package/test_package.cpp @@ -0,0 +1,27 @@ +#include + +#include "PerlinNoise.hpp" + +int main(int argc, const char** argv) { + auto frequency = 32.f; + auto octaves = 9; + auto seed = siv::PerlinNoise::seed_type{74524}; + + auto generator = siv::PerlinNoise{seed}; + + auto width = 32; + auto height = 16; + + auto fx = width / frequency; + auto fy = height / frequency; + + for (auto y = 0; y < height; ++y) { + for (auto x = 0; x < width; ++x) { + auto color = generator.octave2D(x / fx, y / fy, octaves); + std::cout << color << " "; + } + std::cout << std::endl; + } + + return 0; +} diff --git a/recipes/perlinnoise/all/test_v1_package/CMakeLists.txt b/recipes/perlinnoise/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..be00a8c7f57c71 --- /dev/null +++ b/recipes/perlinnoise/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/perlinnoise/all/test_v1_package/conanfile.py b/recipes/perlinnoise/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/perlinnoise/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/perlinnoise/config.yml b/recipes/perlinnoise/config.yml new file mode 100644 index 00000000000000..c6ac749e0b234b --- /dev/null +++ b/recipes/perlinnoise/config.yml @@ -0,0 +1,3 @@ +versions: + "3.0.0": + folder: all diff --git a/recipes/platform.interfaces/all/conandata.yml b/recipes/platform.interfaces/all/conandata.yml index e6bc2843d36970..25b51e862badd7 100644 --- a/recipes/platform.interfaces/all/conandata.yml +++ b/recipes/platform.interfaces/all/conandata.yml @@ -1,4 +1,12 @@ sources: + "0.3.41": + source: + url: "https://github.com/linksplatform/Interfaces/releases/download/cpp_0.3.41/platform.interfaces_0.3.41.zip" + sha256: "26bfb96f8918db86390cf326eba5c76cfc29f06a785d30c789445fe59371bab4" + license: + url: "https://raw.githubusercontent.com/linksplatform/Interfaces/cpp_0.3.41/LICENSE" + sha256: "79d0fc44716007dddc375601bca8879ad45bc1165bf9342b7a16572b4f41abe8" "0.1.2": - url: https://github.com/linksplatform/Interfaces/archive/refs/tags/0.4.0_0.1.2.zip - sha256: 317c29e7ac6122af14e8b1cc8e674a71ba0969c0391ee54d9e045a88d25b5739 + source: + url: "https://github.com/linksplatform/Interfaces/archive/refs/tags/0.4.0_0.1.2.tar.gz" + sha256: "61283bf6488b9051e9f9e80e89ab0d1f85b76a1dbee3fd27f193e678f23903e2" diff --git a/recipes/platform.interfaces/all/conanfile.py b/recipes/platform.interfaces/all/conanfile.py index 4b44a9f82e9bd3..b269b0438ae49e 100644 --- a/recipes/platform.interfaces/all/conanfile.py +++ b/recipes/platform.interfaces/all/conanfile.py @@ -1,60 +1,93 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy, download +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration - -required_conan_version = ">=1.33.0" - +required_conan_version = ">=1.52.0" class PlatformInterfacesConan(ConanFile): name = "platform.interfaces" - license = "Unlicense" - homepage = "https://github.com/linksplatform/Interfaces" - url = "https://github.com/conan-io/conan-center-index" description = """platform.interfaces is one of the libraries of the LinksPlatform modular framework, which uses innovations from the C++20 standard, for easier use of static polymorphism. It also includes some auxiliary structures for more convenient work with containers.""" + license = "Unlicense" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/linksplatform/Interfaces" topics = ("platform", "concepts", "header-only") - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _subfolder_sources(self): + return os.path.join(self.source_folder, "cpp", "Platform.Interfaces") @property - def _subfolder_sources(self): - return os.path.join(self._source_subfolder, "cpp", "Platform.Interfaces") + def _min_cppstd(self): + return "20" @property def _compilers_minimum_version(self): return { - "gcc": "10", + "gcc": "11", "Visual Studio": "16", - "clang": "11", - "apple-clang": "11" + "msvc": "193", + "clang": "13", } + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + def validate(self): - minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - if tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("platform.interfaces/{} " - "requires C++20 with {}, " + if self.settings.compiler == "apple-clang": + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._min_cppstd}, " "which is not supported " - "by {} {}.".format(self.version, self.settings.compiler, self.settings.compiler, self.settings.compiler.version)) + f"by {self.settings.compiler}.") + if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 20) + check_min_cppstd(self, self._min_cppstd) + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._min_cppstd}, " + "which is not supported " + "by {self.settings.compiler} {self.settings.compiler.version}.") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version]["source"], strip_root=True) + if Version(self.version) >= "0.3.41": + download(self, **self.conan_data["sources"][self.version]["license"], filename="LICENSE") def package(self): - self.copy("*.h", dst="include", src=self._subfolder_sources) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - def package_id(self): - self.info.header_only() + if Version(self.version) < "0.3.41": + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "cpp", "Platform.Interfaces"), + ) + else: + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder, + ) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "Platform.Interfaces") + self.cpp_info.set_property("cmake_target_name", "Platform.Interfaces::Platform.Interfaces") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "Platform.Interfaces" self.cpp_info.names["cmake_find_package_multi"] = "Platform.Interfaces" diff --git a/recipes/platform.interfaces/all/test_package/CMakeLists.txt b/recipes/platform.interfaces/all/test_package/CMakeLists.txt index d7e44f864ad880..b54dd14513b954 100644 --- a/recipes/platform.interfaces/all/test_package/CMakeLists.txt +++ b/recipes/platform.interfaces/all/test_package/CMakeLists.txt @@ -1,9 +1,12 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package) +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(Platform.Interfaces REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} CONAN_PKG::platform.interfaces) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 20) +target_link_libraries(${PROJECT_NAME} PRIVATE Platform.Interfaces::Platform.Interfaces) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) + +if(Platform.Interfaces_VERSION VERSION_GREATER_EQUAL "0.2.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE -DPLATFORM_INTERFACES_0_2_0_LATER) +endif() diff --git a/recipes/platform.interfaces/all/test_package/conanfile.py b/recipes/platform.interfaces/all/test_package/conanfile.py index bd7165a553cf41..e845ae751a3017 100644 --- a/recipes/platform.interfaces/all/test_package/conanfile.py +++ b/recipes/platform.interfaces/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/platform.interfaces/all/test_package/test_package.cpp b/recipes/platform.interfaces/all/test_package/test_package.cpp index e7eb9119d9793e..58843ae8a5fa98 100644 --- a/recipes/platform.interfaces/all/test_package/test_package.cpp +++ b/recipes/platform.interfaces/all/test_package/test_package.cpp @@ -7,6 +7,8 @@ using namespace Platform::Interfaces; +#if not defined (PLATFORM_INTERFACES_0_2_0_LATER) + void print(IEnumerable auto&& enumerable) { auto size = std::ranges::size(enumerable); @@ -42,6 +44,45 @@ void add(Collection& collection, const std::same_as auto& item) } } +#else + +void print(CEnumerable auto&& enumerable) +{ + auto size = std::ranges::size(enumerable); + + std::cout << '['; + for (int i = 0; auto&& item : enumerable) + { + std::cout << item; + if (i < size - 1) + { + std::cout << ", "; + } + + i++; + } + std::cout << ']' << std::endl; +} + +template::Item> +requires + CList || + CSet || + CDictionary +void add(Collection& collection, const std::same_as auto& item) +{ + if constexpr (CList) + { + collection.push_back(item); + } + else + { + collection.insert(item); + } +} + +#endif + int main() { std::vector v { 1, 2, 3 }; diff --git a/recipes/platform.interfaces/all/test_v1_package/CMakeLists.txt b/recipes/platform.interfaces/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/platform.interfaces/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/platform.interfaces/all/test_v1_package/conanfile.py b/recipes/platform.interfaces/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/platform.interfaces/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/platform.interfaces/config.yml b/recipes/platform.interfaces/config.yml index b3c71bd313abc6..6293fc33900962 100644 --- a/recipes/platform.interfaces/config.yml +++ b/recipes/platform.interfaces/config.yml @@ -1,3 +1,5 @@ versions: + "0.3.41": + folder: all "0.1.2": folder: all diff --git a/recipes/plog/all/conandata.yml b/recipes/plog/all/conandata.yml index 62dac8352bca60..a2d1cb2b746a69 100644 --- a/recipes/plog/all/conandata.yml +++ b/recipes/plog/all/conandata.yml @@ -1,5 +1,7 @@ sources: + "1.1.9": + url: "https://github.com/SergiusTheBest/plog/archive/1.1.9.tar.gz" + sha256: "058315b9ec9611b659337d4333519ab4783fad3f2f23b1cc7bb84d977ea38055" "1.1.5": url: "https://github.com/SergiusTheBest/plog/archive/1.1.5.tar.gz" sha256: "6c80b4701183d2415bec927e1f5ca9b1761b3b5c65d3e09fb29c743e016d5609" - diff --git a/recipes/plog/all/conanfile.py b/recipes/plog/all/conanfile.py index 0837c0bceb43bb..791d2759099196 100644 --- a/recipes/plog/all/conanfile.py +++ b/recipes/plog/all/conanfile.py @@ -1,28 +1,37 @@ +from conan import ConanFile +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout import os -from conans import ConanFile, tools +required_conan_version = ">=1.52.0" class PlogConan(ConanFile): name = "plog" description = "Pretty powerful logging library in about 1000 lines of code" - homepage = "https://github.com/SergiusTheBest/plog" - url = "https://github.com/conan-io/conan-center-index" license = "MPL-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/SergiusTheBest/plog" topics = ("logging", "header-only", "portable") no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name + "-" + self.version - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*.h", src=os.path.join(self._source_subfolder, "include"), dst=os.path.join("include")) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/plog/all/test_package/CMakeLists.txt b/recipes/plog/all/test_package/CMakeLists.txt index 945696beb2efc2..690cbc43fe6947 100644 --- a/recipes/plog/all/test_package/CMakeLists.txt +++ b/recipes/plog/all/test_package/CMakeLists.txt @@ -1,8 +1,11 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(plog REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) -target_link_libraries(${CMAKE_PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE plog::plog) + +if(plog_VERSION VERSION_GREATER_EQUAL "1.1.6") + target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE -DPLOG_EXPLICIT_INIT) +endif() diff --git a/recipes/plog/all/test_package/conanfile.py b/recipes/plog/all/test_package/conanfile.py index 07847b3d9465f8..e845ae751a3017 100644 --- a/recipes/plog/all/test_package/conanfile.py +++ b/recipes/plog/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) - + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/plog/all/test_package/test_package.cpp b/recipes/plog/all/test_package/test_package.cpp index 3013bd66097690..7f43b933834551 100644 --- a/recipes/plog/all/test_package/test_package.cpp +++ b/recipes/plog/all/test_package/test_package.cpp @@ -1,6 +1,9 @@ #include #include +#ifdef PLOG_EXPLICIT_INIT +# include +#endif int main() { plog::init(plog::debug, "log.txt"); diff --git a/recipes/plog/all/test_v1_package/CMakeLists.txt b/recipes/plog/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/plog/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/plog/all/test_v1_package/conanfile.py b/recipes/plog/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/plog/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/plog/config.yml b/recipes/plog/config.yml index e48685771bd642..c3432fc6b2f2ae 100644 --- a/recipes/plog/config.yml +++ b/recipes/plog/config.yml @@ -1,3 +1,5 @@ versions: + "1.1.9": + folder: all "1.1.5": folder: all diff --git a/recipes/poppler-data/all/CMakeLists.txt b/recipes/poppler-data/all/CMakeLists.txt deleted file mode 100644 index bd3083b512cb93..00000000000000 --- a/recipes/poppler-data/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/poppler-data/all/conandata.yml b/recipes/poppler-data/all/conandata.yml index 687f86f4218623..77bee83d512e53 100644 --- a/recipes/poppler-data/all/conandata.yml +++ b/recipes/poppler-data/all/conandata.yml @@ -2,9 +2,6 @@ sources: "0.4.11": url: "https://poppler.freedesktop.org/poppler-data-0.4.11.tar.gz" sha256: "2cec05cd1bb03af98a8b06a1e22f6e6e1a65b1e2f3816cb3069bb0874825f08c" - "0.4.9": - url: "https://poppler.freedesktop.org/poppler-data-0.4.9.tar.gz" - sha256: "1f9c7e7de9ecd0db6ab287349e31bf815ca108a5a175cf906a90163bdbe32012" "0.4.10": url: "https://poppler.freedesktop.org/poppler-data-0.4.10.tar.gz" sha256: "6e2fcef66ec8c44625f94292ccf8af9f1d918b410d5aa69c274ce67387967b30" @@ -13,11 +10,8 @@ sources: sha256: "1f9c7e7de9ecd0db6ab287349e31bf815ca108a5a175cf906a90163bdbe32012" patches: "0.4.11": - - base_path: "source_subfolder" - patch_file: "patches/0001-cmake-use-GNUInstallDirs.patch" + - patch_file: "patches/0001-cmake-use-GNUInstallDirs.patch" "0.4.10": - - base_path: "source_subfolder" - patch_file: "patches/0001-cmake-use-GNUInstallDirs.patch" + - patch_file: "patches/0001-cmake-use-GNUInstallDirs.patch" "0.4.9": - - base_path: "source_subfolder" - patch_file: "patches/0001-cmake-use-GNUInstallDirs.patch" + - patch_file: "patches/0001-cmake-use-GNUInstallDirs.patch" diff --git a/recipes/poppler-data/all/conanfile.py b/recipes/poppler-data/all/conanfile.py index a71db99dc6085c..e414a6fa6dc4b5 100644 --- a/recipes/poppler-data/all/conanfile.py +++ b/recipes/poppler-data/all/conanfile.py @@ -1,70 +1,66 @@ -from conans import CMake, ConanFile, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os +required_conan_version = ">=1.52.0" + class PopplerDataConan(ConanFile): name = "poppler-data" description = "encoding files for use with poppler, enable CJK and Cyrrilic" homepage = "https://poppler.freedesktop.org/" - topics = "conan", "poppler", "pdf", "rendering" + topics = "poppler", "pdf", "rendering" license = "BSD-3-Clause", "GPL-2.0-or-later", "MIT" url = "https://github.com/conan-io/conan-center-index" - settings = "os", "arch", "compiler", "build_type" # Added to avoid hook warnings while building - exports_sources = "CMakeLists.txt", "patches/**" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" - _cmake = None + def export_sources(self): + export_conandata_patches(self) - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + cmake_layout(self, src_folder="src") - @property - def _build_subfolder(self): - return "build_subfolder" + def package_id(self): + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("poppler-data-{}".format(self.version), self._source_subfolder) - - def package_id(self): - self.info.header_only() + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) @property def _datadir(self): - return os.path.join(self.package_folder, "bin") - - def _configure_cmake(self): - # FIXME: USE_CMS - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["datadir"] = self._datadir - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + return os.path.join(self.package_folder, "res") - def _patch_sources(self): - for patchdata in self.conan_data["patches"][self.version]: - tools.patch(**patchdata) + def generate(self): + tc = CMakeToolchain(self) + tc.variables["datadir"] = self._datadir.replace("\\", "/") + tc.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING*", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "COPYING*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self._datadir, "pkgconfig")) + rmdir(self, os.path.join(self._datadir, "pkgconfig")) @property def _poppler_datadir(self): return os.path.join(self._datadir, "poppler") def package_info(self): - self.cpp_info.names["pkg_config"] = "poppler-data" + self.cpp_info.set_property("pkg_config_name", "poppler-data") self.cpp_info.bindirs = [] self.cpp_info.includedirs = [] - self.user_info.datadir = self._poppler_datadir + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = ["res"] self.cpp_info.defines = ["POPPLER_DATADIR={}".format(self._poppler_datadir.replace("\\", "//"))] + self.conf_info.define("user.poppler-data:datadir", self._poppler_datadir) + + # TODO: to remove in conan v2 + self.user_info.datadir = self._poppler_datadir diff --git a/recipes/poppler-data/all/test_package/conanfile.py b/recipes/poppler-data/all/test_package/conanfile.py index 5e1ecefcd1e186..87a69bb15fafe8 100644 --- a/recipes/poppler-data/all/test_package/conanfile.py +++ b/recipes/poppler-data/all/test_package/conanfile.py @@ -1,9 +1,14 @@ -from conans import ConanFile +from conan import ConanFile import os class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - if not os.path.isdir(self.deps_user_info["poppler-data"].datadir): + if not os.path.isdir(self.conf.get("user.poppler-data:datadir", check_type=str)): raise AssertionError("datadir is not a directory") diff --git a/recipes/poppler-data/all/test_v1_package/conanfile.py b/recipes/poppler-data/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..8a2bb2447ea7b6 --- /dev/null +++ b/recipes/poppler-data/all/test_v1_package/conanfile.py @@ -0,0 +1,10 @@ +from conans import ConanFile +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + def test(self): + if not os.path.isdir(self.deps_user_info["poppler-data"].datadir): + raise AssertionError("datadir is not a directory") diff --git a/recipes/proj/all/CMakeLists.txt b/recipes/proj/all/CMakeLists.txt deleted file mode 100644 index 7df5947f8f3f69..00000000000000 --- a/recipes/proj/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 NO_OUTPUT_DIRS KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/proj/all/conandata.yml b/recipes/proj/all/conandata.yml index cccd0f06021037..b3c7bcfc14d9d8 100644 --- a/recipes/proj/all/conandata.yml +++ b/recipes/proj/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "9.1.0": + url: "https://github.com/OSGeo/PROJ/releases/download/9.1.0/proj-9.1.0.tar.gz" + sha256: 81b2239b94cad0886222cde4f53cb49d34905aad2a1317244a0c30a553db2315 "9.0.1": url: "https://github.com/OSGeo/PROJ/releases/download/9.0.1/proj-9.0.1.tar.gz" sha256: "737eaacbe7906d0d6ff43f0d9ebedc5c734cccc9e6b8d7beefdec3ab22d9a6a3" @@ -30,35 +33,50 @@ sources: url: "https://github.com/OSGeo/PROJ/releases/download/6.3.1/proj-6.3.1.tar.gz" sha256: "6de0112778438dcae30fcc6942dee472ce31399b9e5a2b67e8642529868c86f8" patches: + "9.1.0": + - patch_file: "patches/0001-use-cmake-targets-9.1.0.patch" + patch_type: "conan" + patch_description: "Use cmake targets" "9.0.1": - patch_file: "patches/0001-use-cmake-targets-9.0.1.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Use cmake targets" "9.0.0": - patch_file: "patches/0001-use-cmake-targets-9.0.0.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Use cmake targets" - patch_file: "patches/0002-cmake-configure-proj-pc.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "cmake configure proj pc (fixed by https://github.com/OSGeo/PROJ/pull/3087)" "8.2.1": - patch_file: "patches/0001-use-cmake-targets-8.2.0.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Use cmake targets" "8.2.0": - patch_file: "patches/0001-use-cmake-targets-8.2.0.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Use cmake targets" "8.1.1": - patch_file: "patches/0001-use-cmake-targets-8.1.1.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Use cmake targets" "8.1.0": - patch_file: "patches/0001-use-cmake-targets-8.1.0.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Use cmake targets" "8.0.1": - patch_file: "patches/0001-use-cmake-targets-8.0.0.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Use cmake targets" "8.0.0": - patch_file: "patches/0001-use-cmake-targets-8.0.0.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Use cmake targets" "7.2.1": - patch_file: "patches/0001-use-cmake-targets-7.2.1.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Use cmake targets" "6.3.1": - patch_file: "patches/0001-use-cmake-targets-6.x.x.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Use cmake targets" diff --git a/recipes/proj/all/conanfile.py b/recipes/proj/all/conanfile.py index 7ad34317e533e6..b4cde813263f56 100644 --- a/recipes/proj/all/conanfile.py +++ b/recipes/proj/all/conanfile.py @@ -1,14 +1,23 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.apple import is_apple_os +from conans.tools import stdcpp_library +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, replace_in_file, collect_libs, rm, rename +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" + +required_conan_version = ">=1.53.0" class ProjConan(ConanFile): name = "proj" description = "Cartographic Projections and Coordinate Transformations Library." license = "MIT" - topics = ("dsp", "proj", "proj4", "projections", "gis", "geospatial") + topics = "dsp", "proj", "proj4", "projections", "gis", "geospatial" homepage = "https://proj.org" url = "https://github.com/conan-io/conan-center-index" @@ -30,162 +39,152 @@ class ProjConan(ConanFile): "build_executables": True, } - 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"] - - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if tools.Version(self.version) < "7.0.0": + if Version(self.version) < "7.0.0": del self.options.with_tiff del self.options.with_curl def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("nlohmann_json/3.10.5") - self.requires("sqlite3/3.38.5") + self.requires("nlohmann_json/3.11.2") + self.requires("sqlite3/3.40.0") if self.options.get_safe("with_tiff"): - self.requires("libtiff/4.3.0") + self.requires("libtiff/4.4.0") if self.options.get_safe("with_curl"): - self.requires("libcurl/7.83.1") + self.requires("libcurl/7.86.0") def build_requirements(self): - if hasattr(self, "settings_build"): - self.build_requires("sqlite3/3.38.5") + if hasattr(self, "settings_build") and cross_building(self): + self.tool_requires("sqlite3/3.40.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) - def build(self): - self._patch_sources() - # we should inject build env vars if 2 profile, here it's host env vars ! - with tools.run_environment(self): - cmake = self._configure_cmake() - cmake.build() + def generate(self): + if hasattr(self, "settings_build") and cross_building(self): + env = VirtualBuildEnv(self) + env.generate() + else: + env = VirtualRunEnv(self) + env.generate(scope="build") + + tc = CMakeToolchain(self) + tc.variables["USE_THREAD"] = self.options.threadsafe + tc.variables["BUILD_CCT"] = self.options.build_executables + tc.variables["BUILD_CS2CS"] = self.options.build_executables + tc.variables["BUILD_GEOD"] = self.options.build_executables + tc.variables["BUILD_GIE"] = self.options.build_executables + tc.variables["BUILD_PROJ"] = self.options.build_executables + tc.variables["BUILD_PROJINFO"] = self.options.build_executables + if Version(self.version) < "9.1.0": + tc.variables["PROJ_DATA_SUBDIR"] = "res" + if Version(self.version) < "7.0.0": + tc.variables["PROJ_TESTS"] = False + tc.variables["BUILD_LIBPROJ_SHARED"] = self.options.shared + tc.variables["ENABLE_LTO"] = False + tc.variables["JNI_SUPPORT"] = False + else: + tc.variables["ENABLE_TIFF"] = self.options.with_tiff + tc.variables["ENABLE_CURL"] = self.options.with_curl + tc.variables["BUILD_TESTING"] = False + tc.variables["ENABLE_IPO"] = False + tc.variables["BUILD_PROJSYNC"] = self.options.build_executables and self.options.with_curl + if Version(self.version) >= "8.1.0": + tc.variables["NLOHMANN_JSON_ORIGIN"] = "external" + tc.variables["CMAKE_MACOSX_BUNDLE"] = False + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + + 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) - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") - tools.replace_in_file(cmakelists, "/W4", "") + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + replace_in_file(self, cmakelists, "/W4", "") + + # Fix up usage of SQLite3 finder outputs + rm(self, "FindSqlite3.cmake", os.path.join(self.source_folder, "cmake")) + replace_in_file(self, cmakelists, "SQLITE3_FOUND", "SQLite3_FOUND") + replace_in_file(self, cmakelists, "SQLITE3_VERSION", "SQLite3_VERSION") + replace_in_file(self, cmakelists, "find_package(Sqlite3 REQUIRED)", "find_package(SQLite3 REQUIRED)") # Let CMake install shared lib with a clean rpath ! - if tools.Version(self.version) >= "7.1.0" and tools.Version(self.version) < "9.0.0": - tools.replace_in_file(cmakelists, + if Version(self.version) >= "7.1.0" and Version(self.version) < "9.0.0": + replace_in_file(self, cmakelists, "set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)", "") - # Trick to find sqlite3 executable for build machine - # TODO: shouldn't be necessary in conan v2 with VirtualBuildEnv? - sqlite3_exe = " ".join("\"{}\"".format(path.replace("\\", "/")) for path in self.deps_env_info["sqlite3"].PATH) - tools.replace_in_file( - cmakelists, - "find_program(EXE_SQLITE3 sqlite3)", - "find_program(EXE_SQLITE3 sqlite3 PATHS {} NO_DEFAULT_PATH)".format(sqlite3_exe), - ) - - # Agressive workaround against SIP on macOS, to handle sqlite3 executable + # Aggressive workaround against SIP on macOS, to handle sqlite3 executable # linked to shared sqlite3 lib - if tools.is_apple_os(self._settings_build.os): - # TODO: no hope for 2 profiles, wait for stable self.dependencies - # because we want absolute lib paths of build profile actually - if not hasattr(self, "settings_build"): - if tools.Version(self.version) < "8.1.0": - cmake_sqlite_call = "CMakeLists.txt" - pattern = "${EXE_SQLITE3}" - else: - cmake_sqlite_call = "generate_proj_db.cmake" - pattern = "\"${EXE_SQLITE3}\"" - lib_paths = self.deps_cpp_info["sqlite3"].lib_paths - tools.replace_in_file( - os.path.join(self._source_subfolder, "data", cmake_sqlite_call), - "COMMAND {}".format(pattern), - "COMMAND ${{CMAKE_COMMAND}} -E env \"DYLD_LIBRARY_PATH={}\" {}".format( - ":".join(lib_paths), pattern - ), - ) + if is_apple_os(self): + if Version(self.version) < "8.1.0": + cmake_sqlite_call = "CMakeLists.txt" + pattern = "${EXE_SQLITE3}" + else: + cmake_sqlite_call = "generate_proj_db.cmake" + pattern = "\"${EXE_SQLITE3}\"" + if hasattr(self, "settings_build") and cross_building(self): + lib_paths = self.dependencies.build["sqlite3"].cpp_info.libdirs + else: + lib_paths = self.dependencies["sqlite3"].cpp_info.libdirs + replace_in_file(self, + os.path.join(self.source_folder, "data", cmake_sqlite_call), + f"COMMAND {pattern}", + f"COMMAND ${{CMAKE_COMMAND}} -E env \"DYLD_LIBRARY_PATH={':'.join(lib_paths)}\" {pattern}" + ) # unvendor nlohmann_json - if tools.Version(self.version) < "8.1.0": - tools.rmdir(os.path.join(self._source_subfolder, "include", "proj", "internal", "nlohmann")) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["USE_THREAD"] = self.options.threadsafe - self._cmake.definitions["BUILD_CCT"] = self.options.build_executables - self._cmake.definitions["BUILD_CS2CS"] = self.options.build_executables - self._cmake.definitions["BUILD_GEOD"] = self.options.build_executables - self._cmake.definitions["BUILD_GIE"] = self.options.build_executables - self._cmake.definitions["BUILD_PROJ"] = self.options.build_executables - self._cmake.definitions["BUILD_PROJINFO"] = self.options.build_executables - self._cmake.definitions["PROJ_DATA_SUBDIR"] = "res" - if tools.Version(self.version) < "7.0.0": - self._cmake.definitions["PROJ_TESTS"] = False - self._cmake.definitions["BUILD_LIBPROJ_SHARED"] = self.options.shared - self._cmake.definitions["ENABLE_LTO"] = False - self._cmake.definitions["JNI_SUPPORT"] = False - else: - self._cmake.definitions["ENABLE_TIFF"] = self.options.with_tiff - self._cmake.definitions["ENABLE_CURL"] = self.options.with_curl - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.definitions["ENABLE_IPO"] = False - self._cmake.definitions["BUILD_PROJSYNC"] = self.options.build_executables and self.options.with_curl - if tools.Version(self.version) >= "8.1.0": - self._cmake.definitions["NLOHMANN_JSON_ORIGIN"] = "external" - self._cmake.definitions["CMAKE_MACOSX_BUNDLE"] = False - self._cmake.configure() - return self._cmake + if Version(self.version) < "8.1.0": + rmdir(self, os.path.join(self.source_folder, "include", "proj", "internal", "nlohmann")) + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + # recover the data ... 9.1.0 saves into share/proj rather than res directly + # the new PROJ_DATA_PATH can't seem to be controlled from conan. + if Version(self.version) >= "9.1.0": + rename(self, src=os.path.join(self.package_folder, "share", "proj"), dst=os.path.join(self.package_folder, "res")) + # delete the rest of the deployed data + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + def package_info(self): - proj_version = tools.Version(self.version) + proj_version = Version(self.version) cmake_config_filename = "proj" if proj_version >= "7.0.0" else "proj4" cmake_namespace = "PROJ" if proj_version >= "7.0.0" else "PROJ4" self.cpp_info.set_property("cmake_file_name", cmake_config_filename) - self.cpp_info.set_property("cmake_target_name", "{}::proj".format(cmake_namespace)) + self.cpp_info.set_property("cmake_target_name", f"{cmake_namespace}::proj") self.cpp_info.set_property("pkg_config_name", "proj") - self.cpp_info.components["projlib"].set_property("cmake_target_name", "{}::proj".format(cmake_namespace)) + self.cpp_info.components["projlib"].set_property("cmake_target_name", f"{cmake_namespace}::proj") self.cpp_info.components["projlib"].set_property("pkg_config_name", "proj") self.cpp_info.filenames["cmake_find_package"] = cmake_config_filename self.cpp_info.filenames["cmake_find_package_multi"] = cmake_config_filename - self.cpp_info.names["cmake_find_package"] = cmake_namespace - self.cpp_info.names["cmake_find_package_multi"] = cmake_namespace - self.cpp_info.components["projlib"].names["cmake_find_package"] = "proj" - self.cpp_info.components["projlib"].names["cmake_find_package_multi"] = "proj" - self.cpp_info.components["projlib"].libs = tools.collect_libs(self) + self.cpp_info.components["projlib"].libs = collect_libs(self) if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["projlib"].system_libs.append("m") if self.options.threadsafe: @@ -195,28 +194,35 @@ def package_info(self): self.cpp_info.components["projlib"].system_libs.append("shell32") if proj_version >= "7.1.0": self.cpp_info.components["projlib"].system_libs.append("Ole32") - if not self.options.shared and tools.stdcpp_library(self): - self.cpp_info.components["projlib"].system_libs.append(tools.stdcpp_library(self)) + if not self.options.shared and stdcpp_library(self): + self.cpp_info.components["projlib"].system_libs.append(stdcpp_library(self)) self.cpp_info.components["projlib"].requires.extend(["nlohmann_json::nlohmann_json", "sqlite3::sqlite3"]) if self.options.get_safe("with_tiff"): self.cpp_info.components["projlib"].requires.append("libtiff::libtiff") if self.options.get_safe("with_curl"): self.cpp_info.components["projlib"].requires.append("libcurl::libcurl") - if tools.Version(self.version) < "8.2.0": - if self.options.shared and self._is_msvc: + if Version(self.version) < "8.2.0": + if self.options.shared and is_msvc(self): self.cpp_info.components["projlib"].defines.append("PROJ_MSVC_DLL_IMPORT") else: if not self.options.shared: self.cpp_info.components["projlib"].defines.append("PROJ_DLL=") res_path = os.path.join(self.package_folder, "res") - self.output.info("Prepending to PROJ_LIB environment variable: {}".format(res_path)) + self.output.info(f"Prepending to PROJ_LIB environment variable: {res_path}") self.runenv_info.prepend_path("PROJ_LIB", res_path) + # TODO: to remove after conan v2, it allows to not break consumers still relying on virtualenv generator self.env_info.PROJ_LIB = res_path if self.options.build_executables: self.buildenv_info.prepend_path("PROJ_LIB", res_path) bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.PATH.append(bin_path) + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = cmake_namespace + self.cpp_info.names["cmake_find_package_multi"] = cmake_namespace + self.cpp_info.components["projlib"].names["cmake_find_package"] = "proj" + self.cpp_info.components["projlib"].names["cmake_find_package_multi"] = "proj" diff --git a/recipes/proj/all/patches/0001-use-cmake-targets-6.x.x.patch b/recipes/proj/all/patches/0001-use-cmake-targets-6.x.x.patch index 7f0ee8cc37587a..6bec96d49f9b31 100644 --- a/recipes/proj/all/patches/0001-use-cmake-targets-6.x.x.patch +++ b/recipes/proj/all/patches/0001-use-cmake-targets-6.x.x.patch @@ -1,6 +1,19 @@ ---- a/src/lib_proj.cmake -+++ b/src/lib_proj.cmake -@@ -311,7 +311,7 @@ source_group("Source Files\\Transformations" +diff -ru a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt 2020-02-10 17:29:51.000000000 +0800 ++++ b/CMakeLists.txt 2022-12-14 21:05:09.821289235 +0800 +@@ -114,6 +114,8 @@ + include(ProjMac) + include(policies) + ++find_package(nlohmann_json REQUIRED) ++ + ################################################################################ + # Check for sqlite3 + ################################################################################ +diff -ru a/src/lib_proj.cmake b/src/lib_proj.cmake +--- a/src/lib_proj.cmake 2019-12-29 06:23:06.000000000 +0800 ++++ b/src/lib_proj.cmake 2022-12-14 20:58:56.856752193 +0800 +@@ -311,7 +311,7 @@ source_group("Source Files\\ISO19111" FILES ${SRC_LIBPROJ_ISO19111}) @@ -9,13 +22,13 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) source_group("CMake Files" FILES CMakeLists.txt) -@@ -440,8 +440,7 @@ if(USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) +@@ -440,8 +440,7 @@ target_link_libraries(${PROJ_CORE_TARGET} ${CMAKE_THREAD_LIBS_INIT}) endif() -include_directories(${SQLITE3_INCLUDE_DIR}) -target_link_libraries(${PROJ_CORE_TARGET} ${SQLITE3_LIBRARY}) -+target_link_libraries(${PROJ_CORE_TARGET} CONAN_PKG::nlohmann_json CONAN_PKG::sqlite3) ++target_link_libraries(${PROJ_CORE_TARGET} nlohmann_json::nlohmann_json SQLite::SQLite3) if(MSVC AND BUILD_LIBPROJ_SHARED) target_compile_definitions(${PROJ_CORE_TARGET} diff --git a/recipes/proj/all/patches/0001-use-cmake-targets-7.2.1.patch b/recipes/proj/all/patches/0001-use-cmake-targets-7.2.1.patch index d23ded7d7b170f..6ee348ac9ddd07 100644 --- a/recipes/proj/all/patches/0001-use-cmake-targets-7.2.1.patch +++ b/recipes/proj/all/patches/0001-use-cmake-targets-7.2.1.patch @@ -1,3 +1,15 @@ +diff -ru a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt 2020-12-27 02:57:21.000000000 +0800 ++++ b/CMakeLists.txt 2022-12-14 21:21:31.516729458 +0800 +@@ -121,6 +121,8 @@ + include(ProjMac) + include(policies) + ++find_package(nlohmann_json REQUIRED) ++ + ################################################################################ + # Check for sqlite3 + ################################################################################ --- a/src/lib_proj.cmake +++ b/src/lib_proj.cmake @@ -414,19 +414,16 @@ if(USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) @@ -6,7 +18,7 @@ -target_include_directories(${PROJ_CORE_TARGET} PRIVATE ${SQLITE3_INCLUDE_DIR}) -target_link_libraries(${PROJ_CORE_TARGET} ${SQLITE3_LIBRARY}) -+target_link_libraries(${PROJ_CORE_TARGET} CONAN_PKG::nlohmann_json CONAN_PKG::sqlite3) ++target_link_libraries(${PROJ_CORE_TARGET} nlohmann_json::nlohmann_json SQLite::SQLite3) if(TIFF_ENABLED) target_compile_definitions(${PROJ_CORE_TARGET} PRIVATE -DTIFF_ENABLED) diff --git a/recipes/proj/all/patches/0001-use-cmake-targets-8.0.0.patch b/recipes/proj/all/patches/0001-use-cmake-targets-8.0.0.patch index fd68813a7e77c6..39da5da53f2231 100644 --- a/recipes/proj/all/patches/0001-use-cmake-targets-8.0.0.patch +++ b/recipes/proj/all/patches/0001-use-cmake-targets-8.0.0.patch @@ -1,12 +1,25 @@ ---- a/src/lib_proj.cmake -+++ b/src/lib_proj.cmake -@@ -394,21 +394,18 @@ if(USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) +diff -ru a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt 2021-02-26 02:37:25.000000000 +0800 ++++ b/CMakeLists.txt 2022-12-14 21:26:48.404915901 +0800 +@@ -121,6 +121,8 @@ + include(ProjMac) + include(policies) + ++find_package(nlohmann_json REQUIRED) ++ + ################################################################################ + # Check for sqlite3 + ################################################################################ +diff -ru a/src/lib_proj.cmake b/src/lib_proj.cmake +--- a/src/lib_proj.cmake 2021-02-20 19:15:52.000000000 +0800 ++++ b/src/lib_proj.cmake 2022-12-14 21:25:41.713734988 +0800 +@@ -394,21 +394,18 @@ target_link_libraries(proj PRIVATE ${CMAKE_THREAD_LIBS_INIT}) endif() -target_include_directories(proj PRIVATE ${SQLITE3_INCLUDE_DIR}) -target_link_libraries(proj PRIVATE ${SQLITE3_LIBRARY}) -+target_link_libraries(proj PUBLIC CONAN_PKG::nlohmann_json PRIVATE CONAN_PKG::sqlite3) ++target_link_libraries(proj PUBLIC nlohmann_json::nlohmann_json PRIVATE SQLite::SQLite3) if(TIFF_ENABLED) target_compile_definitions(proj PRIVATE -DTIFF_ENABLED) diff --git a/recipes/proj/all/patches/0001-use-cmake-targets-8.1.0.patch b/recipes/proj/all/patches/0001-use-cmake-targets-8.1.0.patch index 55848a7fbed027..332c0650174f9a 100644 --- a/recipes/proj/all/patches/0001-use-cmake-targets-8.1.0.patch +++ b/recipes/proj/all/patches/0001-use-cmake-targets-8.1.0.patch @@ -6,7 +6,7 @@ -target_include_directories(proj PRIVATE ${SQLITE3_INCLUDE_DIR}) -target_link_libraries(proj PRIVATE ${SQLITE3_LIBRARY}) -+target_link_libraries(proj PRIVATE CONAN_PKG::sqlite3) ++target_link_libraries(proj PRIVATE SQLite::SQLite3) if(NLOHMANN_JSON STREQUAL "external") target_compile_definitions(proj PRIVATE EXTERNAL_NLOHMANN_JSON) diff --git a/recipes/proj/all/patches/0001-use-cmake-targets-8.1.1.patch b/recipes/proj/all/patches/0001-use-cmake-targets-8.1.1.patch index a94324460a6f8e..bdb11d748aa629 100644 --- a/recipes/proj/all/patches/0001-use-cmake-targets-8.1.1.patch +++ b/recipes/proj/all/patches/0001-use-cmake-targets-8.1.1.patch @@ -6,7 +6,7 @@ -target_include_directories(proj PRIVATE ${SQLITE3_INCLUDE_DIR}) -target_link_libraries(proj PRIVATE ${SQLITE3_LIBRARY}) -+target_link_libraries(proj PRIVATE CONAN_PKG::sqlite3) ++target_link_libraries(proj PRIVATE SQLite::SQLite3) if(NLOHMANN_JSON STREQUAL "external") target_compile_definitions(proj PRIVATE EXTERNAL_NLOHMANN_JSON) diff --git a/recipes/proj/all/patches/0001-use-cmake-targets-8.2.0.patch b/recipes/proj/all/patches/0001-use-cmake-targets-8.2.0.patch index f7c146f168e4fc..8ce7c1895ee225 100644 --- a/recipes/proj/all/patches/0001-use-cmake-targets-8.2.0.patch +++ b/recipes/proj/all/patches/0001-use-cmake-targets-8.2.0.patch @@ -6,7 +6,7 @@ -target_include_directories(proj PRIVATE ${SQLITE3_INCLUDE_DIR}) -target_link_libraries(proj PRIVATE ${SQLITE3_LIBRARY}) -+target_link_libraries(proj PRIVATE CONAN_PKG::sqlite3) ++target_link_libraries(proj PRIVATE SQLite::SQLite3) if(NLOHMANN_JSON STREQUAL "external") target_compile_definitions(proj PRIVATE EXTERNAL_NLOHMANN_JSON) diff --git a/recipes/proj/all/patches/0001-use-cmake-targets-9.0.0.patch b/recipes/proj/all/patches/0001-use-cmake-targets-9.0.0.patch index 41f18cc8cd4e28..c7cf8eab51037b 100644 --- a/recipes/proj/all/patches/0001-use-cmake-targets-9.0.0.patch +++ b/recipes/proj/all/patches/0001-use-cmake-targets-9.0.0.patch @@ -6,7 +6,7 @@ -target_include_directories(proj PRIVATE ${SQLITE3_INCLUDE_DIR}) -target_link_libraries(proj PRIVATE ${SQLITE3_LIBRARY}) -+target_link_libraries(proj PRIVATE CONAN_PKG::sqlite3) ++target_link_libraries(proj PRIVATE SQLite::SQLite3) if(NLOHMANN_JSON STREQUAL "external") target_compile_definitions(proj PRIVATE EXTERNAL_NLOHMANN_JSON) diff --git a/recipes/proj/all/patches/0001-use-cmake-targets-9.0.1.patch b/recipes/proj/all/patches/0001-use-cmake-targets-9.0.1.patch index 87519f37854071..69204105518387 100644 --- a/recipes/proj/all/patches/0001-use-cmake-targets-9.0.1.patch +++ b/recipes/proj/all/patches/0001-use-cmake-targets-9.0.1.patch @@ -6,7 +6,7 @@ -target_include_directories(proj PRIVATE ${SQLITE3_INCLUDE_DIR}) -target_link_libraries(proj PRIVATE ${SQLITE3_LIBRARY}) -+target_link_libraries(proj PRIVATE CONAN_PKG::sqlite3) ++target_link_libraries(proj PRIVATE SQLite::SQLite3) if(NLOHMANN_JSON STREQUAL "external") target_compile_definitions(proj PRIVATE EXTERNAL_NLOHMANN_JSON) diff --git a/recipes/proj/all/patches/0001-use-cmake-targets-9.1.0.patch b/recipes/proj/all/patches/0001-use-cmake-targets-9.1.0.patch new file mode 100644 index 00000000000000..0a4659e2173fa3 --- /dev/null +++ b/recipes/proj/all/patches/0001-use-cmake-targets-9.1.0.patch @@ -0,0 +1,31 @@ +--- a/src/src/lib_proj.cmake 2022-08-29 01:53:05.000000000 +0800 ++++ b/src/lib_proj.cmake 2022-11-09 00:03:25.165493175 +0800 +@@ -447,8 +447,7 @@ + target_link_libraries(proj PRIVATE ${CMAKE_THREAD_LIBS_INIT}) + endif() + +-target_include_directories(proj PRIVATE ${SQLITE3_INCLUDE_DIR}) +-target_link_libraries(proj PRIVATE ${SQLITE3_LIBRARY}) ++target_link_libraries(proj PRIVATE SQLite::SQLite3) + + if(NLOHMANN_JSON STREQUAL "external") + target_compile_definitions(proj PRIVATE EXTERNAL_NLOHMANN_JSON) +@@ -458,16 +458,14 @@ + + if(TIFF_ENABLED) + target_compile_definitions(proj PRIVATE -DTIFF_ENABLED) +- target_include_directories(proj PRIVATE ${TIFF_INCLUDE_DIR}) +- target_link_libraries(proj PRIVATE ${TIFF_LIBRARY}) ++ target_link_libraries(proj PRIVATE TIFF::TIFF) + endif() + + if(CURL_ENABLED) + target_compile_definitions(proj PRIVATE -DCURL_ENABLED) +- target_include_directories(proj PRIVATE ${CURL_INCLUDE_DIRS}) + target_link_libraries(proj + PRIVATE +- ${CURL_LIBRARIES} ++ CURL::libcurl + $<$:ws2_32> + $<$:wldap32> + $<$:advapi32> diff --git a/recipes/proj/all/test_package/CMakeLists.txt b/recipes/proj/all/test_package/CMakeLists.txt index 80dae0a82c9f82..68d47d66efc394 100644 --- a/recipes/proj/all/test_package/CMakeLists.txt +++ b/recipes/proj/all/test_package/CMakeLists.txt @@ -1,14 +1,11 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - add_executable(test_package test_package.c) if(PROJ_VERSION_GE_7) find_package(proj REQUIRED CONFIG) - target_link_libraries(test_package PROJ::proj) + target_link_libraries(test_package PRIVATE PROJ::proj) else() find_package(proj4 REQUIRED CONFIG) - target_link_libraries(test_package PROJ4::proj) + target_link_libraries(test_package PRIVATE PROJ4::proj) endif() diff --git a/recipes/proj/all/test_package/conanfile.py b/recipes/proj/all/test_package/conanfile.py index a5ba3b6be23769..69dbaead1cf8c6 100644 --- a/recipes/proj/all/test_package/conanfile.py +++ b/recipes/proj/all/test_package/conanfile.py @@ -1,27 +1,32 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain +from conan.tools.scm import Version import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["PROJ_VERSION_GE_7"] = Version(self.dependencies["proj"].ref.version) >= "7.0.0" + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["PROJ_VERSION_GE_7"] = tools.Version(self.deps_cpp_info["proj"].version) >= "7.0.0" cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/proj/all/test_v1_package/CMakeLists.txt b/recipes/proj/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/proj/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/proj/all/test_v1_package/conanfile.py b/recipes/proj/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..0a0d55e2ef660f --- /dev/null +++ b/recipes/proj/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["PROJ_VERSION_GE_7"] = tools.Version(self.deps_cpp_info["proj"].version) >= "7.0.0" + 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/proj/config.yml b/recipes/proj/config.yml index 31de4855ab6b18..0024c64a0bcb76 100644 --- a/recipes/proj/config.yml +++ b/recipes/proj/config.yml @@ -1,4 +1,6 @@ versions: + "9.1.0": + folder: "all" "9.0.1": folder: "all" "9.0.0": diff --git a/recipes/protobuf/all/CMakeLists.txt b/recipes/protobuf/all/CMakeLists.txt deleted file mode 100644 index 70bacbfbf8f9a6..00000000000000 --- a/recipes/protobuf/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include("conanbuildinfo.cmake") -conan_basic_setup(TARGETS KEEP_RPATHS) - -add_subdirectory(source_subfolder/cmake) diff --git a/recipes/protobuf/all/conandata.yml b/recipes/protobuf/all/conandata.yml index 8c08d5344edff0..29f76dd85aed7d 100644 --- a/recipes/protobuf/all/conandata.yml +++ b/recipes/protobuf/all/conandata.yml @@ -17,10 +17,12 @@ sources: "3.18.1": url: "https://github.com/protocolbuffers/protobuf/archive/v3.18.1.tar.gz" sha256: "9111bf0b542b631165fadbd80aa60e7fb25b25311c532139ed2089d76ddf6dd7" - "3.17.1": - url: "https://github.com/protocolbuffers/protobuf/archive/v3.17.1.tar.gz" - sha256: "036d66d6eec216160dd898cfb162e9d82c1904627642667cc32b104d407bb411" patches: + "3.19.6": + - patch_file: "patches/upstream-pr-9437-msvc-runtime.patch" + patch_description: "Properly handle CMAKE_MSVC_RUNTIME_LIBRARY when using CMake >= 3.15" + patch_type: "backport" "3.19.4": - - patch_file: "patches/upstream-pr-9153-msvc-runtime.patch" - base_path: "source_subfolder" + - patch_file: "patches/upstream-pr-9437-msvc-runtime.patch" + patch_description: "Properly handle CMAKE_MSVC_RUNTIME_LIBRARY when using CMake >= 3.15" + patch_type: "backport" diff --git a/recipes/protobuf/all/conanfile.py b/recipes/protobuf/all/conanfile.py index d23242627557db..e4c785dc142eb9 100644 --- a/recipes/protobuf/all/conanfile.py +++ b/recipes/protobuf/all/conanfile.py @@ -1,17 +1,15 @@ -from conan.tools.files import rename, get, apply_conandata_patches, replace_in_file, rmdir, rm -from conan.tools.microsoft import msvc_runtime_flag, is_msvc -from conan.tools.scm import Version -from conan.tools.build import cross_building -from conan.errors import ConanInvalidConfiguration from conan import ConanFile -from conans import CMake +from conan.errors import ConanInvalidConfiguration from conan.tools.apple import is_apple_os +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, rename, get, apply_conandata_patches, export_conandata_patches, replace_in_file, rmdir, rm +from conan.tools.microsoft import check_min_vs, msvc_runtime_flag, is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version -import functools import os import textwrap -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.53" class ProtobufConan(ConanFile): @@ -41,19 +39,10 @@ class ProtobufConan(ConanFile): } short_paths = True - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" @property def _is_clang_cl(self): - return self.settings.compiler == 'clang' and self.settings.os == 'Windows' + return self.settings.compiler == "clang" and self.settings.os == "Windows" @property def _is_clang_x86(self): @@ -64,9 +53,7 @@ def _can_disable_rtti(self): return Version(self.version) >= "3.15.4" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -76,60 +63,56 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_zlib: self.requires("zlib/1.2.13") def validate(self): - if self.options.shared and str(self.settings.compiler.get_safe("runtime")) in ["MT", "MTd", "static"]: + if self.options.shared and is_msvc_static_runtime(self): raise ConanInvalidConfiguration("Protobuf can't be built with shared + MT(d) runtimes") - if self.settings.compiler == "Visual Studio": - if Version(self.settings.compiler.version) < "14": - raise ConanInvalidConfiguration("On Windows Protobuf can only be built with " - "Visual Studio 2015 or higher.") + check_min_vs(self, "190") if self.settings.compiler == "clang": if Version(self.version) >= "3.15.4" and Version(self.settings.compiler.version) < "4": raise ConanInvalidConfiguration("protobuf {} doesn't support clang < 4".format(self.version)) - if hasattr(self, "settings_build") and cross_building(self) and \ - self.settings.os == "Macos" and self.options.shared: - # FIXME: should be allowed, actually build succeeds but it fails at build time of test package due to SIP - raise ConanInvalidConfiguration("protobuf shared not supported yet in CCI while cross-building on Macos") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) @property def _cmake_install_base_path(self): return os.path.join("lib", "cmake", "protobuf") - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["CMAKE_INSTALL_CMAKEDIR"] = self._cmake_install_base_path.replace("\\", "/") - cmake.definitions["protobuf_WITH_ZLIB"] = self.options.with_zlib - cmake.definitions["protobuf_BUILD_TESTS"] = False - cmake.definitions["protobuf_BUILD_PROTOC_BINARIES"] = True + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["CMAKE_INSTALL_CMAKEDIR"] = self._cmake_install_base_path.replace("\\", "/") + tc.cache_variables["protobuf_WITH_ZLIB"] = self.options.with_zlib + tc.cache_variables["protobuf_BUILD_TESTS"] = False + tc.cache_variables["protobuf_BUILD_PROTOC_BINARIES"] = True if not self.options.debug_suffix: - cmake.definitions["protobuf_DEBUG_POSTFIX"] = "" + tc.cache_variables["protobuf_DEBUG_POSTFIX"] = "" if Version(self.version) >= "3.14.0": - cmake.definitions["protobuf_BUILD_LIBPROTOC"] = True + tc.cache_variables["protobuf_BUILD_LIBPROTOC"] = True if self._can_disable_rtti: - cmake.definitions["protobuf_DISABLE_RTTI"] = not self.options.with_rtti + tc.cache_variables["protobuf_DISABLE_RTTI"] = not self.options.with_rtti if is_msvc(self) or self._is_clang_cl: runtime = msvc_runtime_flag(self) if not runtime: runtime = self.settings.get_safe("compiler.runtime") - cmake.definitions["protobuf_MSVC_STATIC_RUNTIME"] = "MT" in runtime - if Version(self.version) < "3.18.0" and self._is_clang_cl: - cmake.definitions["CMAKE_RC_COMPILER"] = os.environ.get("RC", "llvm-rc") - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.cache_variables["protobuf_MSVC_STATIC_RUNTIME"] = "MT" in runtime + if is_apple_os(self) and self.options.shared: + # Workaround against SIP on macOS for consumers while invoking protoc when protobuf lib is shared + tc.variables["CMAKE_INSTALL_RPATH"] = "@loader_path/../lib" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): apply_conandata_patches(self) @@ -137,7 +120,7 @@ def _patch_sources(self): # Provide relocatable protobuf::protoc target and Protobuf_PROTOC_EXECUTABLE cache variable # TODO: some of the following logic might be disabled when conan will # allow to create executable imported targets in package_info() - protobuf_config_cmake = os.path.join(self._source_subfolder, "cmake", "protobuf-config.cmake.in") + protobuf_config_cmake = os.path.join(self.source_folder, "cmake", "protobuf-config.cmake.in") replace_in_file(self, protobuf_config_cmake, @@ -169,27 +152,9 @@ def _patch_sources(self): protoc_target ) - # Set DYLD_LIBRARY_PATH in command line to avoid issues with shared protobuf - # (even with virtualrunenv, this fix might be required due to SIP) - # Only works with cmake, cmake_find_package or cmake_find_package_multi generators - if is_apple_os(self): - replace_in_file(self, - protobuf_config_cmake, - "add_custom_command(", - ("set(CUSTOM_DYLD_LIBRARY_PATH ${CONAN_LIB_DIRS} ${Protobuf_LIB_DIRS} ${Protobuf_LIB_DIRS_RELEASE} ${Protobuf_LIB_DIRS_DEBUG} ${Protobuf_LIB_DIRS_RELWITHDEBINFO} ${Protobuf_LIB_DIRS_MINSIZEREL})\n" - "string(REPLACE \";\" \":\" CUSTOM_DYLD_LIBRARY_PATH \"${CUSTOM_DYLD_LIBRARY_PATH}\")\n" - "add_custom_command(") - ) - cmd_str = "COMMAND protobuf::protoc" if Version(self.version) < "3.20.0" else "COMMAND protobuf::protoc" - replace_in_file(self, - protobuf_config_cmake, - cmd_str, - "COMMAND ${CMAKE_COMMAND} -E env \"DYLD_LIBRARY_PATH=${CUSTOM_DYLD_LIBRARY_PATH}\" $" - ) - # Disable a potential warning in protobuf-module.cmake.in # TODO: remove this patch? Is it really useful? - protobuf_module_cmake = os.path.join(self._source_subfolder, "cmake", "protobuf-module.cmake.in") + protobuf_module_cmake = os.path.join(self.source_folder, "cmake", "protobuf-module.cmake.in") replace_in_file(self, protobuf_module_cmake, "if(DEFINED Protobuf_SRC_ROOT_FOLDER)", @@ -204,18 +169,20 @@ def _patch_sources(self): # https://github.com/protocolbuffers/protobuf/issues/9916 # it will be solved in protobuf 3.21.0 if Version(self.version) == "3.20.0": - replace_in_file(self, os.path.join(self._source_subfolder, "src", "google", "protobuf", "port_def.inc"), + replace_in_file(self, os.path.join(self.source_folder, "src", "google", "protobuf", "port_def.inc"), "#elif PROTOBUF_GNUC_MIN(12, 0)", "#elif PROTOBUF_GNUC_MIN(12, 2)") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake_root = "cmake" if Version(self.version) < "3.21" else None + cmake.configure(build_script_folder=cmake_root) cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) os.unlink(os.path.join(self.package_folder, self._cmake_install_base_path, "protobuf-config-version.cmake")) diff --git a/recipes/protobuf/all/patches/upstream-pr-9437-msvc-runtime.patch b/recipes/protobuf/all/patches/upstream-pr-9437-msvc-runtime.patch new file mode 100644 index 00000000000000..06cb0a97681d10 --- /dev/null +++ b/recipes/protobuf/all/patches/upstream-pr-9437-msvc-runtime.patch @@ -0,0 +1,17 @@ +Fix from Protobuf PR: https://github.com/protocolbuffers/protobuf/pull/9437 + +--- a/cmake/CMakeLists.txt ++++ b/cmake/CMakeLists.txt +@@ -182,7 +182,11 @@ else (protobuf_BUILD_SHARED_LIBS) + # making programmatic control difficult. Prefer the functionality in newer + # CMake versions when available. + if(CMAKE_VERSION VERSION_GREATER 3.15 OR CMAKE_VERSION VERSION_EQUAL 3.15) +- set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$:Debug>) ++ if (protobuf_MSVC_STATIC_RUNTIME) ++ set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$:Debug>) ++ else() ++ set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$:Debug>DLL) ++ endif() + else() + # In case we are building static libraries, link also the runtime library statically + # so that MSVCR*.DLL is not required at runtime. diff --git a/recipes/protobuf/all/test_package/CMakeLists.txt b/recipes/protobuf/all/test_package/CMakeLists.txt index ca3bf5d1881694..b49c2152bb22f3 100644 --- a/recipes/protobuf/all/test_package/CMakeLists.txt +++ b/recipes/protobuf/all/test_package/CMakeLists.txt @@ -1,21 +1,19 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package) +cmake_minimum_required(VERSION 3.15) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(protobuf CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp addressbook.proto) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) -target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_BINARY_DIR}") +target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") if (protobuf_LITE) - target_link_libraries(${PROJECT_NAME} protobuf::libprotobuf-lite) + target_link_libraries(${PROJECT_NAME} PRIVATE protobuf::libprotobuf-lite) else() - target_link_libraries(${PROJECT_NAME} protobuf::libprotobuf) + target_link_libraries(${PROJECT_NAME} PRIVATE protobuf::libprotobuf) endif() -target_link_libraries(${PROJECT_NAME} protobuf::libprotoc) +target_link_libraries(${PROJECT_NAME} PRIVATE protobuf::libprotoc) protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS TARGET ${PROJECT_NAME}) protobuf_generate(LANGUAGE cpp TARGET ${PROJECT_NAME} PROTOS addressbook.proto) diff --git a/recipes/protobuf/all/test_package/conanfile.py b/recipes/protobuf/all/test_package/conanfile.py index 06d5305cf8a670..3823d923c46842 100644 --- a/recipes/protobuf/all/test_package/conanfile.py +++ b/recipes/protobuf/all/test_package/conanfile.py @@ -1,24 +1,41 @@ from conan import ConanFile -from conan.tools.build import cross_building -from conans import CMake +from conan.tools.build import can_run, cross_building +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build_requirements(self): - if hasattr(self, "settings_build") and cross_building(self): - self.build_requires(str(self.requires["protobuf"])) + if cross_building(self) and hasattr(self, "settings_build"): + self.tool_requires(self.tested_reference_str) + + def generate(self): + VirtualRunEnv(self).generate() + if cross_building(self) and hasattr(self, "settings_build"): + VirtualBuildEnv(self).generate() + else: + VirtualRunEnv(self).generate(scope="build") + tc = CMakeToolchain(self) + tc.cache_variables["protobuf_LITE"] = self.dependencies[self.tested_reference_str].options.lite + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["protobuf_LITE"] = self.options["protobuf"].lite cmake.configure() cmake.build() def test(self): - if not cross_building(self): - self.run("protoc --version", run_environment=True) - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/protobuf/all/test_v1_package/CMakeLists.txt b/recipes/protobuf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..f16bc97992e860 --- /dev/null +++ b/recipes/protobuf/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_v1_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/protobuf/all/test_v1_package/conanfile.py b/recipes/protobuf/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..06d5305cf8a670 --- /dev/null +++ b/recipes/protobuf/all/test_v1_package/conanfile.py @@ -0,0 +1,24 @@ +from conan import ConanFile +from conan.tools.build import cross_building +from conans import CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build_requirements(self): + if hasattr(self, "settings_build") and cross_building(self): + self.build_requires(str(self.requires["protobuf"])) + + def build(self): + cmake = CMake(self) + cmake.definitions["protobuf_LITE"] = self.options["protobuf"].lite + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + self.run("protoc --version", run_environment=True) + self.run(os.path.join("bin", "test_package"), run_environment=True) diff --git a/recipes/protobuf/config.yml b/recipes/protobuf/config.yml index c22211a7a9d4ea..86eea577c6b032 100644 --- a/recipes/protobuf/config.yml +++ b/recipes/protobuf/config.yml @@ -11,5 +11,3 @@ versions: folder: all "3.18.1": folder: all - "3.17.1": - folder: all diff --git a/recipes/pybind11/all/test_package/conanfile.py b/recipes/pybind11/all/test_package/conanfile.py index a99c05cf3e7c1e..8c98920d26587b 100644 --- a/recipes/pybind11/all/test_package/conanfile.py +++ b/recipes/pybind11/all/test_package/conanfile.py @@ -1,9 +1,7 @@ from conan import ConanFile -from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain -from conan.tools.env import VirtualRunEnv +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import Environment, VirtualRunEnv from conan.tools.build import can_run -from conan.tools.layout import cmake_layout -from conans.tools import environment_append import os from pathlib import PurePath @@ -25,6 +23,10 @@ def generate(self): toolchain.variables["PYTHON_EXECUTABLE"] = PurePath(self._python_interpreter).as_posix() toolchain.generate() + env = Environment() + env.append_path("PYTHONPATH", os.path.join(self.build_folder, self.cpp.build.libdirs[0])) + env.vars(self, scope="run").save_script("testrun") + run = VirtualRunEnv(self) run.generate() @@ -44,7 +46,5 @@ def _python_interpreter(self): def test(self): if can_run(self): - python_path = os.path.join(self.build_folder, self.cpp.build.libdirs[0]) - with environment_append({"PYTHONPATH": python_path}): - module_path = os.path.join(self.source_folder, "test.py") - self.run(f"{self._python_interpreter} {module_path}", env="conanrun") + module_path = os.path.join(self.source_folder, "test.py") + self.run(f"{self._python_interpreter} {module_path}", env="conanrun") diff --git a/recipes/pybind11_json/all/conandata.yml b/recipes/pybind11_json/all/conandata.yml index 64febf91be27f9..58e86b8427d457 100644 --- a/recipes/pybind11_json/all/conandata.yml +++ b/recipes/pybind11_json/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.2.13": + url: "https://github.com/pybind/pybind11_json/archive/0.2.13.tar.gz" + sha256: "6b12ddb4930a3135322890318fc15c4a69134f21120ea82163827c11411107a3" "0.2.12": url: "https://github.com/pybind/pybind11_json/archive/0.2.12.tar.gz" sha256: "a9e308d4cf3de16d192cd0baf641bfe17a3a3046e8652e6724204afa3e736db7" diff --git a/recipes/pybind11_json/config.yml b/recipes/pybind11_json/config.yml index e4bc47aa25d0cc..d889e66f48c37a 100644 --- a/recipes/pybind11_json/config.yml +++ b/recipes/pybind11_json/config.yml @@ -1,4 +1,6 @@ versions: + "0.2.13": + folder: all "0.2.12": folder: all "0.2.11": diff --git a/recipes/pystring/all/conandata.yml b/recipes/pystring/all/conandata.yml index 9954fce4e61c8f..38de0bc9db7afb 100644 --- a/recipes/pystring/all/conandata.yml +++ b/recipes/pystring/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.1.4": + url: "https://github.com/imageworks/pystring/archive/refs/tags/v1.1.4.tar.gz" + sha256: "49da0fe2a049340d3c45cce530df63a2278af936003642330287b68cefd788fb" "1.1.3": url: "https://github.com/imageworks/pystring/archive/refs/tags/v1.1.3.tar.gz" sha256: "358a56e756e701836b69a31c75d3d9d41c34d447cf7b3775bbd5620dcd3203d9" diff --git a/recipes/pystring/all/conanfile.py b/recipes/pystring/all/conanfile.py index 15149dd2319cf6..aae1b97c58843a 100644 --- a/recipes/pystring/all/conanfile.py +++ b/recipes/pystring/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import copy, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class PystringConan(ConanFile): @@ -33,7 +33,7 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") diff --git a/recipes/pystring/all/test_package/conanfile.py b/recipes/pystring/all/test_package/conanfile.py index 3a8c6c5442b33b..0a6bc68712d901 100644 --- a/recipes/pystring/all/test_package/conanfile.py +++ b/recipes/pystring/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/pystring/all/test_v1_package/CMakeLists.txt b/recipes/pystring/all/test_v1_package/CMakeLists.txt index 2083f8e07beb9a..0d20897301b68b 100644 --- a/recipes/pystring/all/test_v1_package/CMakeLists.txt +++ b/recipes/pystring/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(pystring REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE pystring::pystring) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/pystring/all/test_v1_package/conanfile.py b/recipes/pystring/all/test_v1_package/conanfile.py index 75c0cd81d2d2f3..38f4483872d47f 100644 --- a/recipes/pystring/all/test_v1_package/conanfile.py +++ b/recipes/pystring/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/pystring/config.yml b/recipes/pystring/config.yml index e1c4f3be249832..7f3d713ab8481e 100644 --- a/recipes/pystring/config.yml +++ b/recipes/pystring/config.yml @@ -1,3 +1,5 @@ versions: + "1.1.4": + folder: all "1.1.3": folder: all diff --git a/recipes/qarchive/all/conandata.yml b/recipes/qarchive/all/conandata.yml index 7ae24ee9ad7cac..da2432b9b6e33b 100644 --- a/recipes/qarchive/all/conandata.yml +++ b/recipes/qarchive/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.2.4": + url: "https://github.com/antony-jr/QArchive/archive/v2.2.4.tar.gz" + sha256: "7c7f0e3bf3d6fb5130aa4632201873511944cd98ab16b273da5072198f53ad7b" "2.2.3": url: "https://github.com/antony-jr/QArchive/archive/v2.2.3.tar.gz" sha256: "2ada10efda34fe96c25744dd67e74ec68587d30ab01cc20be25cbcfb1e6262c4" diff --git a/recipes/qarchive/config.yml b/recipes/qarchive/config.yml index c6b70feeb93407..3db8c0c3676e91 100644 --- a/recipes/qarchive/config.yml +++ b/recipes/qarchive/config.yml @@ -1,4 +1,6 @@ versions: + "2.2.4": + folder: all "2.2.3": folder: all "2.1.1": diff --git a/recipes/qcustomplot/all/CMakeLists.txt b/recipes/qcustomplot/all/CMakeLists.txt index de077ce79626a0..108a85b9380f15 100644 --- a/recipes/qcustomplot/all/CMakeLists.txt +++ b/recipes/qcustomplot/all/CMakeLists.txt @@ -31,7 +31,7 @@ if(QCUSTOMPLOT_USE_OPENGL) # QCustomPlot does not use the QOpenGLFunctions class, and instead needs to link directly # to OpenGL32.lib on Windows, regardless of whether qt:opengl is 'dynamic' or 'desktop' - if(WIN32) + if(CMAKE_SYSTEM_NAME STREQUAL "Windows") find_package(OpenGL REQUIRED) target_link_libraries(${PROJECT_NAME} PRIVATE OpenGL::GL) endif() @@ -51,6 +51,7 @@ else() message(FATAL_ERROR "Qt < 5 not yet supported in this recipe") endif() +include(GNUInstallDirs) install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/recipes/qcustomplot/all/conandata.yml b/recipes/qcustomplot/all/conandata.yml index 817a87b4a32538..9655ef7e13aab0 100644 --- a/recipes/qcustomplot/all/conandata.yml +++ b/recipes/qcustomplot/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.1.1": + url: "https://www.qcustomplot.com/release/2.1.1/QCustomPlot-source.tar.gz" + sha256: "5e2d22dec779db8f01f357cbdb25e54fbcf971adaee75eae8d7ad2444487182f" "2.1.0": url: "https://www.qcustomplot.com/release/2.1.0fixed/QCustomPlot-source.tar.gz" sha256: "357b78be0f52b2d01c17ec3e2e1271255761810af7e8a9476cef51fccf1a0f44" diff --git a/recipes/qcustomplot/all/conanfile.py b/recipes/qcustomplot/all/conanfile.py index c33e4be280fd78..067cd911c84e96 100644 --- a/recipes/qcustomplot/all/conanfile.py +++ b/recipes/qcustomplot/all/conanfile.py @@ -2,21 +2,20 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, replace_in_file +from conan.tools.files import apply_conandata_patches, copy, get, export_conandata_patches, replace_in_file from conan.tools.scm import Version import os -required_conan_version = ">=1.50.2 <1.51.0 || >=1.51.2" +required_conan_version = ">=1.53.0" -class QcustomplotConan(ConanFile): +class QCustomPlotConan(ConanFile): name = "qcustomplot" description = "QCustomPlot is a Qt C++ widget for plotting and data visualization." license = "GPL-3.0-only" - topics = ("qcustomplot", "qt", "chart", "plot", "data-visualization") + topics = ("chart", "data-visualization", "graph", "plot", "qt") homepage = "https://www.qcustomplot.com" url = "https://github.com/conan-io/conan-center-index" - settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -31,8 +30,7 @@ class QcustomplotConan(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": @@ -40,16 +38,16 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") # FIXME: we shouldn't have to force shared in qt, but config file # generated by conan in qt static is likely broken, or maybe env vars. self.options["qt"].shared = True def requirements(self): if Version(self.version) >= "2.0.0": - self.requires("qt/6.3.0") + self.requires("qt/6.4.1") else: - self.requires("qt/5.15.3") + self.requires("qt/5.15.7") if self.options.with_opengl and self.settings.os == "Windows": self.requires("opengl/system") @@ -58,9 +56,9 @@ def validate(self): min_cppstd = "11" if Version(self.dependencies["qt"].ref.version) < "6.0.0" else "17" check_min_cppstd(self, min_cppstd) if not (self.dependencies["qt"].options.gui and self.dependencies["qt"].options.widgets): - raise ConanInvalidConfiguration("qcustomplot requires qt gui and widgets") + raise ConanInvalidConfiguration(f"{self.ref} requires qt gui and widgets") if self.info.options.with_opengl and self.dependencies["qt"].options.opengl == "no": - raise ConanInvalidConfiguration("qcustomplot with opengl requires Qt with opengl enabled") + raise ConanInvalidConfiguration(f"{self.ref} with opengl requires Qt with opengl enabled") def layout(self): cmake_layout(self, src_folder="src") diff --git a/recipes/qcustomplot/all/test_package/conanfile.py b/recipes/qcustomplot/all/test_package/conanfile.py index 5c787bba8a5a44..82919b2651addd 100644 --- a/recipes/qcustomplot/all/test_package/conanfile.py +++ b/recipes/qcustomplot/all/test_package/conanfile.py @@ -7,6 +7,7 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" def requirements(self): self.requires(self.tested_reference_str) diff --git a/recipes/qcustomplot/all/test_v1_package/CMakeLists.txt b/recipes/qcustomplot/all/test_v1_package/CMakeLists.txt index 664457fc1607fb..925ecbe19e448d 100644 --- a/recipes/qcustomplot/all/test_v1_package/CMakeLists.txt +++ b/recipes/qcustomplot/all/test_v1_package/CMakeLists.txt @@ -1,22 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) - -find_package(qcustomplot REQUIRED CONFIG) -target_link_libraries(${PROJECT_NAME} PRIVATE qcustomplot::qcustomplot) - -if(QT_VERSION VERSION_GREATER_EQUAL "6.0.0") - find_package(Qt6 COMPONENTS Core Widgets REQUIRED CONFIG) - target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Core Qt6::Widgets) - target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) -elseif(QT_VERSION VERSION_GREATER_EQUAL "5.0.0") - find_package(Qt5 COMPONENTS Core Widgets REQUIRED CONFIG) - target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Widgets) - target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11) -else() - message(FATAL_ERROR "Qt < 5 not yet supported in this recipe") -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/qcustomplot/config.yml b/recipes/qcustomplot/config.yml index 7d0ad87c0d0d85..a7d0cc4f0654be 100644 --- a/recipes/qcustomplot/config.yml +++ b/recipes/qcustomplot/config.yml @@ -1,4 +1,6 @@ versions: + "2.1.1": + folder: all "2.1.0": folder: all "1.3.2": diff --git a/recipes/qt/5.x.x/conandata.yml b/recipes/qt/5.x.x/conandata.yml index 1ffad75cd4fb3f..b156686dc16e78 100644 --- a/recipes/qt/5.x.x/conandata.yml +++ b/recipes/qt/5.x.x/conandata.yml @@ -1,4 +1,11 @@ sources: + "5.15.8": + url: + - "https://download.qt.io/archive/qt/5.15/5.15.8/single/qt-everywhere-opensource-src-5.15.8.tar.xz" + - "https://qt-mirror.dannhauer.de/archive/qt/5.15/5.15.8/single/qt-everywhere-opensource-src-5.15.8.tar.xz" + - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/5.15/5.15.8/single/qt-everywhere-opensource-src-5.15.8.tar.xz" + - "https://ftp.fau.de/qtproject/archive/qt/5.15/5.15.8/single/qt-everywhere-opensource-src-5.15.8.tar.xz" + sha256: "776a9302c336671f9406a53bd30b8e36f825742b2ec44a57c08217bff0fa86b9" "5.15.7": url: - "https://download.qt.io/archive/qt/5.15/5.15.7/single/qt-everywhere-opensource-src-5.15.7.tar.xz" @@ -21,7 +28,26 @@ sources: - "https://ftp.fau.de/qtproject/archive/qt/5.15/5.15.5/single/qt-everywhere-opensource-src-5.15.5.tar.xz" sha256: "5a97827bdf9fd515f43bc7651defaf64fecb7a55e051c79b8f80510d0e990f06" patches: + "5.15.8": + - patch_file: "patches/aa2a39dea5.diff" + base_path: "qt5/qtbase" + - patch_file: "patches/c72097e.diff" + base_path: "qt5/qtwebengine" + - patch_file: "patches/fix-macdeployqt.diff" + base_path: "qt5/qttools" + - patch_file: "patches/chromium-v8-missing-constexpr.patch" + base_path: "qt5/qtwebengine/src/3rdparty/chromium/v8" + - patch_file: "patches/chromium-skia-missing-iterator-include.patch" + base_path: "qt5/qtwebengine/src/3rdparty" + - patch_file: "patches/skia-cd397f3.diff" + base_path: "qt5/qtwebengine/src/3rdparty/chromium/third_party/skia" + - patch_file: "patches/0001-Find-fontconfig-using-pkg-config.patch" + base_path: "qt5/qtwebengine/src/3rdparty" + - patch_file: "patches/337f28c9ab-5.15.8.patch" + base_path: "qt5/qtbase" "5.15.7": + - patch_file: "patches/337f28c9ab.patch" + base_path: "qt5/qtbase" - patch_file: "patches/aa2a39dea5.diff" base_path: "qt5/qtbase" - patch_file: "patches/c72097e.diff" @@ -45,6 +71,8 @@ patches: - patch_file: "patches/0001-Find-fontconfig-using-pkg-config.patch" base_path: "qt5/qtwebengine/src/3rdparty" "5.15.6": + - patch_file: "patches/337f28c9ab.patch" + base_path: "qt5/qtbase" - patch_file: "patches/aa2a39dea5.diff" base_path: "qt5/qtbase" - patch_file: "patches/c72097e.diff" @@ -68,6 +96,8 @@ patches: - patch_file: "patches/0001-Find-fontconfig-using-pkg-config.patch" base_path: "qt5/qtwebengine/src/3rdparty" "5.15.5": + - patch_file: "patches/337f28c9ab-5.15.5.patch" + base_path: "qt5/qtbase" - patch_file: "patches/aa2a39dea5.diff" base_path: "qt5/qtbase" - patch_file: "patches/c72097e.diff" diff --git a/recipes/qt/5.x.x/conanfile.py b/recipes/qt/5.x.x/conanfile.py index 6a95c2ad7cbe2f..92d8d142151357 100644 --- a/recipes/qt/5.x.x/conanfile.py +++ b/recipes/qt/5.x.x/conanfile.py @@ -2,7 +2,7 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.apple import is_apple_os from conan.tools.build import build_jobs, check_min_cppstd, cross_building -from conan.tools.files import chdir, get, load, replace_in_file, rm, rmdir, save, export_conandata_patches, apply_conandata_patches +from conan.tools.files import chdir, copy, get, load, replace_in_file, rm, rmdir, save, export_conandata_patches, apply_conandata_patches from conan.tools.microsoft import msvc_runtime_flag, is_msvc from conan.tools.scm import Version from conans import tools, RunEnvironment @@ -52,7 +52,7 @@ class QtConan(ConanFile): topics = ("ui", "framework") url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.qt.io" - license = "LGPL-3.0" + license = "LGPL-3.0-only" settings = "os", "arch", "compiler", "build_type" options = { @@ -85,6 +85,7 @@ class QtConan(ConanFile): "with_gssapi": [True, False], "with_atspi": [True, False], "with_md4c": [True, False], + "with_x11": [True, False], "gui": [True, False], "widgets": [True, False], @@ -126,6 +127,7 @@ class QtConan(ConanFile): "with_gssapi": False, "with_atspi": False, "with_md4c": True, + "with_x11": True, "gui": True, "widgets": True, @@ -147,24 +149,24 @@ def _settings_build(self): return getattr(self, "settings_build", self.settings) def export(self): - self.copy(f"qtmodules{self.version}.conf") + copy(self, f"qtmodules{self.version}.conf", self.recipe_folder, self.export_folder) def export_sources(self): export_conandata_patches(self) def build_requirements(self): if self._settings_build.os == "Windows" and is_msvc(self): - self.build_requires("jom/1.1.3") + self.tool_requires("jom/1.1.3") if self.options.qtwebengine: - self.build_requires("ninja/1.11.1") - self.build_requires("nodejs/16.3.0") - self.build_requires("gperf/3.1") + self.tool_requires("ninja/1.11.1") + self.tool_requires("nodejs/16.3.0") + self.tool_requires("gperf/3.1") # gperf, bison, flex, python >= 2.7.5 & < 3 if self.settings.os != "Windows": - self.build_requires("bison/3.8.2") - self.build_requires("flex/2.6.4") + self.tool_requires("bison/3.8.2") + self.tool_requires("flex/2.6.4") else: - self.build_requires("winflexbison/2.5.24") + self.tool_requires("winflexbison/2.5.24") # Check if a valid python2 is available in PATH or it will failflex # Start by checking if python2 can be found @@ -202,13 +204,14 @@ def build_requirements(self): raise ConanInvalidConfiguration(msg) if self.options.qtwayland: - self.build_requires("wayland/1.21.0") + self.tool_requires("wayland/1.21.0") def config_options(self): if self.settings.os not in ["Linux", "FreeBSD"]: del self.options.with_icu del self.options.with_fontconfig del self.options.with_libalsa + del self.options.with_x11 del self.options.qtx11extras if self.settings.compiler == "apple-clang": if Version(self.settings.compiler.version) < "10.0": @@ -246,6 +249,7 @@ def configure(self): del self.options.with_libjpeg del self.options.with_libpng del self.options.with_md4c + del self.options.with_x11 if not self.options.with_dbus: del self.options.with_atspi @@ -343,10 +347,16 @@ def validate(self): # https://bugreports.qt.io/browse/QTBUG-95952 raise ConanInvalidConfiguration("Pulseaudio needs to be built with glib option or qt's configure script won't detect it") - if self.settings.os in ['Linux', 'FreeBSD'] and self.options.with_gssapi: - raise ConanInvalidConfiguration("gssapi cannot be enabled until conan-io/conan-center-index#4102 is closed") + if self.settings.os in ['Linux', 'FreeBSD']: + if self.options.with_gssapi: + raise ConanInvalidConfiguration("gssapi cannot be enabled until conan-io/conan-center-index#4102 is closed") + + if self.options.get_safe("with_x11", False) and not self.dependencies.direct_host["xkbcommon"].options.with_x11: + raise ConanInvalidConfiguration("The 'with_x11' option for the 'xkbcommon' package must be enabled when the 'with_x11' option is enabled") + if self.options.get_safe("qtwayland", False) and not self.dependencies.direct_host["xkbcommon"].options.with_wayland: + raise ConanInvalidConfiguration("The 'with_wayland' option for the 'xkbcommon' package must be enabled when the 'qtwayland' option is enabled") - if cross_building(self) and self.options.cross_compile == "None": + if cross_building(self) and self.options.cross_compile == "None" and not is_apple_os(self): raise ConanInvalidConfiguration("option cross_compile must be set for cross compilation " "cf https://doc.qt.io/qt-5/configure-options.html#cross-compilation-options") @@ -361,7 +371,7 @@ def requirements(self): if is_apple_os(self): self.requires("moltenvk/1.1.10") if self.options.with_glib: - self.requires("glib/2.74.0") + self.requires("glib/2.75.2") # if self.options.with_libiconv: # QTBUG-84708 # self.requires("libiconv/1.16")# QTBUG-84708 if self.options.with_doubleconversion and not self.options.multiconfiguration: @@ -380,7 +390,7 @@ def requirements(self): else: self.requires("libjpeg/9e") if self.options.get_safe("with_libpng", False) and not self.options.multiconfiguration: - self.requires("libpng/1.6.38") + self.requires("libpng/1.6.39") if self.options.with_sqlite3 and not self.options.multiconfiguration: self.requires("sqlite3/3.39.4") self.options["sqlite3"].enable_column_metadata = True @@ -395,9 +405,9 @@ def requirements(self): self.requires("openal/1.22.2") if self.options.get_safe("with_libalsa", False): self.requires("libalsa/1.2.7.2") - if self.options.gui and self.settings.os in ["Linux", "FreeBSD"]: + if self.options.get_safe("with_x11", False): + self.requires("xkbcommon/1.5.0") self.requires("xorg/system") - self.requires("xkbcommon/1.4.1") if self.options.get_safe("opengl", "no") != "no": self.requires("opengl/system") if self.options.with_zstd: @@ -405,7 +415,8 @@ def requirements(self): if self.options.qtwebengine and self.settings.os in ["Linux", "FreeBSD"]: self.requires("expat/2.4.9") self.requires("opus/1.3.1") - self.requires("xorg-proto/2022.2") + if not self.options.qtwayland: + self.requires("xorg-proto/2022.2") self.requires("libxshmfence/1.3") self.requires("nss/3.84") self.requires("libdrm/2.4.109") @@ -418,6 +429,7 @@ def requirements(self): self.requires("dbus/1.15.2") if self.options.qtwayland: self.requires("wayland/1.21.0") + self.requires("xkbcommon/1.5.0") if self.settings.os in ['Linux', 'FreeBSD'] and self.options.with_gssapi: self.requires("krb5/1.18.3") # conan-io/conan-center-index#4102 if self.options.get_safe("with_atspi"): @@ -550,6 +562,8 @@ def _xplatform(self): def build(self): args = ["-confirm-license", "-silent", "-nomake examples", "-nomake tests", f"-prefix {self.package_folder}"] + if cross_building(self): + args.append(f"-extprefix {self.package_folder}") args.append("-v") args.append("-archdatadir %s" % os.path.join(self.package_folder, "bin", "archdatadir")) args.append("-datadir %s" % os.path.join(self.package_folder, "bin", "datadir")) @@ -771,7 +785,7 @@ def _getenvpath(var): save(self, ".qmake.stash" , "") save(self, ".qmake.super" , "") - self.run("%s/qt5/configure %s" % (self.source_folder, " ".join(args)), run_environment=True) + self.run("%s %s" % (os.path.join(self.source_folder, "qt5", "configure"), " ".join(args)), run_environment=True) if self._settings_build.os == "Macos": save(self, "bash_env", 'export DYLD_LIBRARY_PATH="%s"' % ":".join(RunEnvironment(self).vars["DYLD_LIBRARY_PATH"])) with tools.environment_append({ @@ -802,7 +816,7 @@ def package(self): Translations = bin/datadir/translations Documentation = bin/datadir/doc Examples = bin/datadir/examples""") - self.copy("*LICENSE*", src="qt5/", dst="licenses") + copy(self, "*LICENSE*", os.path.join(self.source_folder, "qt5/"), os.path.join(self.package_folder, "licenses")) for module in self._submodules: if not self.options.get_safe(module): rmdir(self, os.path.join(self.package_folder, "licenses", module)) @@ -1020,7 +1034,10 @@ def _create_plugin(pluginname, libname, plugintype, requires): if self.options.get_safe("with_fontconfig", False): gui_reqs.append("fontconfig::fontconfig") if self.settings.os in ["Linux", "FreeBSD"]: - gui_reqs.extend(["xorg::xorg", "xkbcommon::xkbcommon"]) + if self.options.qtwayland or self.options.get_safe("with_x11", False): + gui_reqs.append("xkbcommon::xkbcommon") + if self.options.get_safe("with_x11", False): + gui_reqs.append("xorg::xorg") if self.options.get_safe("opengl", "no") != "no": gui_reqs.append("opengl::opengl") if self.options.get_safe("with_vulkan", False): @@ -1110,15 +1127,19 @@ def _create_plugin(pluginname, libname, plugintype, requires): service_support_reqs.append("DBus") _create_module("ServiceSupport", service_support_reqs) _create_module("EdidSupport") - _create_module("XkbCommonSupport", ["Core", "Gui", "xkbcommon::libxkbcommon-x11"]) - xcb_qpa_reqs = ["Core", "Gui", "ServiceSupport", "ThemeSupport", "FontDatabaseSupport", "EdidSupport", "XkbCommonSupport", "xorg::xorg"] + if self.options.get_safe("with_x11", False): + _create_module("XkbCommonSupport", ["Core", "Gui", "xkbcommon::libxkbcommon-x11"]) + xcb_qpa_reqs = ["Core", "Gui", "ServiceSupport", "ThemeSupport", "FontDatabaseSupport", "EdidSupport", "XkbCommonSupport", "xorg::xorg"] + elif self.options.qtwayland: + _create_module("XkbCommonSupport", ["Core", "Gui", "xkbcommon::libxkbcommon"]) if self.options.with_dbus and self.options.with_atspi: _create_module("LinuxAccessibilitySupport", ["Core", "DBus", "Gui", "AccessibilitySupport", "at-spi2-core::at-spi2-core"]) xcb_qpa_reqs.append("LinuxAccessibilitySupport") if self.options.get_safe("with_vulkan"): xcb_qpa_reqs.append("VulkanSupport") - _create_module("XcbQpa", xcb_qpa_reqs, has_include_dir=False) - _create_plugin("QXcbIntegrationPlugin", "qxcb", "platforms", ["Core", "Gui", "XcbQpa"]) + if self.options.get_safe("with_x11", False): + _create_module("XcbQpa", xcb_qpa_reqs, has_include_dir=False) + _create_plugin("QXcbIntegrationPlugin", "qxcb", "platforms", ["Core", "Gui", "XcbQpa"]) if self.options.with_sqlite3: _create_plugin("QSQLiteDriverPlugin", "qsqlite", "sqldrivers", ["sqlite3::sqlite3"]) diff --git a/recipes/qt/5.x.x/patches/337f28c9ab-5.15.5.patch b/recipes/qt/5.x.x/patches/337f28c9ab-5.15.5.patch new file mode 100644 index 00000000000000..a2ea249c1db5fa --- /dev/null +++ b/recipes/qt/5.x.x/patches/337f28c9ab-5.15.5.patch @@ -0,0 +1,40 @@ +From 337f28c9abb12f28538cfe2f49e5afc460578b32 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= +Date: Tue, 5 Jul 2022 15:38:33 +0200 +Subject: Darwin: Replace deprecated symbol kIOMasterPortDefault with + equivalent + +We can't use the replacement kIOMainPortDefault yet, as it's not +available in operating system versions we still support, but the +kIOMasterPortDefault documentation explicitly says that passing +NULL as a port argument indicates "use the default". + +As the underlying type of a mach_port_t is potentially either +a pointer or an unsigned int, we initialize the default to 0. + +Pick-to: 6.2 6.3 6.4 5.15 +Change-Id: I288aa94b8f2fbda47fd1cbaf329799db7ab988a0 +Reviewed-by: Alexandru Croitor +--- + src/corelib/global/qglobal.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +(limited to 'src/corelib/global/qglobal.cpp') + +diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp +index 738e39658f..c894471ad6 100644 +--- a/src/corelib/global/qglobal.cpp ++++ b/src/corelib/global/qglobal.cpp +@@ -3059,7 +3059,8 @@ QByteArray QSysInfo::machineUniqueId() + { + #if defined(Q_OS_DARWIN) && __has_include() + char uuid[UuidStringLen + 1]; +- io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice")); ++ static const mach_port_t defaultPort = 0; // Effectively kIOMasterPortDefault/kIOMainPortDefault ++ io_service_t service = IOServiceGetMatchingService(defaultPort, IOServiceMatching("IOPlatformExpertDevice")); + QCFString stringRef = (CFStringRef)IORegistryEntryCreateCFProperty(service, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0); + CFStringGetCString(stringRef, uuid, sizeof(uuid), kCFStringEncodingMacRoman); + return QByteArray(uuid); +-- +cgit v1.2.1 + diff --git a/recipes/qt/5.x.x/patches/337f28c9ab-5.15.8.patch b/recipes/qt/5.x.x/patches/337f28c9ab-5.15.8.patch new file mode 100644 index 00000000000000..053e6afa62e83b --- /dev/null +++ b/recipes/qt/5.x.x/patches/337f28c9ab-5.15.8.patch @@ -0,0 +1,39 @@ +From 337f28c9abb12f28538cfe2f49e5afc460578b32 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= +Date: Tue, 5 Jul 2022 15:38:33 +0200 +Subject: Darwin: Replace deprecated symbol kIOMasterPortDefault with + equivalent + +We can't use the replacement kIOMainPortDefault yet, as it's not +available in operating system versions we still support, but the +kIOMasterPortDefault documentation explicitly says that passing +NULL as a port argument indicates "use the default". + +As the underlying type of a mach_port_t is potentially either +a pointer or an unsigned int, we initialize the default to 0. + +Pick-to: 6.2 6.3 6.4 5.15 +Change-Id: I288aa94b8f2fbda47fd1cbaf329799db7ab988a0 +Reviewed-by: Alexandru Croitor +--- + src/corelib/global/qglobal.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +(limited to 'src/corelib/global/qglobal.cpp') + +diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp +index 738e39658f..c894471ad6 100644 +--- a/src/corelib/global/qglobal.cpp ++++ b/src/corelib/global/qglobal.cpp +@@ -3077,7 +3077,8 @@ QByteArray QSysInfo::machineUniqueId() + { + #if defined(Q_OS_DARWIN) && __has_include() + char uuid[UuidStringLen + 1]; +- io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice")); ++ static const mach_port_t defaultPort = 0; // Effectively kIOMasterPortDefault/kIOMainPortDefault ++ io_service_t service = IOServiceGetMatchingService(defaultPort, IOServiceMatching("IOPlatformExpertDevice")); + QCFString stringRef = (CFStringRef)IORegistryEntryCreateCFProperty(service, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0); + CFStringGetCString(stringRef, uuid, sizeof(uuid), kCFStringEncodingMacRoman); + return QByteArray(uuid); +-- +cgit v1.2.1 diff --git a/recipes/qt/5.x.x/patches/337f28c9ab.patch b/recipes/qt/5.x.x/patches/337f28c9ab.patch new file mode 100644 index 00000000000000..6784be15b8cfe0 --- /dev/null +++ b/recipes/qt/5.x.x/patches/337f28c9ab.patch @@ -0,0 +1,40 @@ +From 337f28c9abb12f28538cfe2f49e5afc460578b32 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= +Date: Tue, 5 Jul 2022 15:38:33 +0200 +Subject: Darwin: Replace deprecated symbol kIOMasterPortDefault with + equivalent + +We can't use the replacement kIOMainPortDefault yet, as it's not +available in operating system versions we still support, but the +kIOMasterPortDefault documentation explicitly says that passing +NULL as a port argument indicates "use the default". + +As the underlying type of a mach_port_t is potentially either +a pointer or an unsigned int, we initialize the default to 0. + +Pick-to: 6.2 6.3 6.4 5.15 +Change-Id: I288aa94b8f2fbda47fd1cbaf329799db7ab988a0 +Reviewed-by: Alexandru Croitor +--- + src/corelib/global/qglobal.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +(limited to 'src/corelib/global/qglobal.cpp') + +diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp +index 738e39658f..c894471ad6 100644 +--- a/src/corelib/global/qglobal.cpp ++++ b/src/corelib/global/qglobal.cpp +@@ -3067,7 +3067,8 @@ QByteArray QSysInfo::machineUniqueId() + { + #if defined(Q_OS_DARWIN) && __has_include() + char uuid[UuidStringLen + 1]; +- io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice")); ++ static const mach_port_t defaultPort = 0; // Effectively kIOMasterPortDefault/kIOMainPortDefault ++ io_service_t service = IOServiceGetMatchingService(defaultPort, IOServiceMatching("IOPlatformExpertDevice")); + QCFString stringRef = (CFStringRef)IORegistryEntryCreateCFProperty(service, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0); + CFStringGetCString(stringRef, uuid, sizeof(uuid), kCFStringEncodingMacRoman); + return QByteArray(uuid); +-- +cgit v1.2.1 + diff --git a/recipes/qt/6.x.x/qtmodules6.1.3.conf b/recipes/qt/5.x.x/qtmodules5.15.8.conf similarity index 78% rename from recipes/qt/6.x.x/qtmodules6.1.3.conf rename to recipes/qt/5.x.x/qtmodules5.15.8.conf index 1c6405c4bc77ec..452233655f279d 100644 --- a/recipes/qt/6.x.x/qtmodules6.1.3.conf +++ b/recipes/qt/5.x.x/qtmodules5.15.8.conf @@ -1,53 +1,60 @@ [submodule "qtbase"] path = qtbase url = ../qtbase.git - branch = 6.1.3 + branch = 5.15 status = essential [submodule "qtsvg"] depends = qtbase path = qtsvg url = ../qtsvg.git - branch = 6.1.3 + branch = 5.15 status = addon [submodule "qtdeclarative"] depends = qtbase recommends = qtsvg path = qtdeclarative url = ../qtdeclarative.git - branch = 6.1.3 + branch = 5.15 status = essential [submodule "qtactiveqt"] depends = qtbase path = qtactiveqt url = ../qtactiveqt.git - branch = 6.1.3 + branch = 5.15 status = addon +[submodule "qtscript"] + depends = qtbase + recommends = qttools + path = qtscript + url = ../qtscript.git + branch = 5.15 + status = deprecated [submodule "qtmultimedia"] depends = qtbase recommends = qtdeclarative path = qtmultimedia url = ../qtmultimedia.git - branch = dev - status = ignore + branch = 5.15 + status = essential [submodule "qttools"] depends = qtbase recommends = qtdeclarative qtactiveqt path = qttools url = ../qttools.git - branch = 6.1.3 + branch = 5.15 status = essential [submodule "qtxmlpatterns"] depends = qtbase recommends = qtdeclarative path = qtxmlpatterns url = ../qtxmlpatterns.git - branch = dev - status = ignore + branch = 5.15 + status = deprecated [submodule "qttranslations"] depends = qttools path = qttranslations url = ../qttranslations.git - branch = 6.1.3 + branch = 5.15 status = essential priority = 30 [submodule "qtdoc"] @@ -55,7 +62,7 @@ recommends = qtmultimedia qtquickcontrols qtquickcontrols2 path = qtdoc url = ../qtdoc.git - branch = 6.1.3 + branch = 5.15 status = essential priority = 40 [submodule "qtrepotools"] @@ -68,7 +75,7 @@ depends = qtbase path = qtqa url = ../qtqa.git - branch = dev + branch = master status = essential priority = 50 [submodule "qtlocation"] @@ -76,15 +83,15 @@ recommends = qtdeclarative qtquickcontrols qtquickcontrols2 qtserialport path = qtlocation url = ../qtlocation.git - branch = dev - status = ignore + branch = 5.15 + status = addon [submodule "qtsensors"] depends = qtbase recommends = qtdeclarative path = qtsensors url = ../qtsensors.git - branch = dev - status = ignore + branch = 5.15 + status = addon [submodule "qtsystems"] depends = qtbase recommends = qtdeclarative @@ -99,6 +106,12 @@ url = ../qtfeedback.git branch = master status = ignore +[submodule "qtdocgallery"] + depends = qtdeclarative + path = qtdocgallery + url = ../qtdocgallery.git + branch = master + status = ignore [submodule "qtpim"] depends = qtdeclarative path = qtpim @@ -110,100 +123,100 @@ recommends = qtdeclarative qtandroidextras path = qtconnectivity url = ../qtconnectivity.git - branch = dev - status = ignore + branch = 5.15 + status = addon [submodule "qtwayland"] depends = qtbase recommends = qtdeclarative path = qtwayland url = ../qtwayland.git - branch = 6.1.3 + branch = 5.15 status = addon [submodule "qt3d"] depends = qtbase - recommends = qtdeclarative qtshadertools + recommends = qtdeclarative qtimageformats qtgamepad path = qt3d url = ../qt3d.git - branch = 6.1.3 + branch = 5.15 status = addon [submodule "qtimageformats"] depends = qtbase path = qtimageformats url = ../qtimageformats.git - branch = 6.1.3 + branch = 5.15 status = addon [submodule "qtgraphicaleffects"] depends = qtdeclarative path = qtgraphicaleffects url = ../qtgraphicaleffects.git - branch = dev - status = ignore + branch = 5.15 + status = essential [submodule "qtquickcontrols"] depends = qtdeclarative recommends = qtgraphicaleffects path = qtquickcontrols url = ../qtquickcontrols.git - branch = dev - status = ignore + branch = 5.15 + status = addon [submodule "qtserialbus"] depends = qtbase recommends = qtserialport path = qtserialbus url = ../qtserialbus.git - branch = dev - status = ignore + branch = 5.15 + status = addon [submodule "qtserialport"] depends = qtbase path = qtserialport url = ../qtserialport.git - branch = dev - status = ignore + branch = 5.15 + status = addon [submodule "qtx11extras"] depends = qtbase path = qtx11extras url = ../qtx11extras.git - branch = dev - status = ignore + branch = 5.15 + status = addon [submodule "qtmacextras"] depends = qtbase path = qtmacextras url = ../qtmacextras.git - branch = dev - status = ignore + branch = 5.15 + status = addon [submodule "qtwinextras"] depends = qtbase recommends = qtdeclarative qtmultimedia path = qtwinextras url = ../qtwinextras.git - branch = dev - status = ignore + branch = 5.15 + status = addon [submodule "qtandroidextras"] depends = qtbase path = qtandroidextras url = ../qtandroidextras.git - branch = dev - status = ignore + branch = 5.15 + status = addon [submodule "qtwebsockets"] depends = qtbase recommends = qtdeclarative path = qtwebsockets url = ../qtwebsockets.git - branch = dev - status = ignore + branch = 5.15 + status = addon [submodule "qtwebchannel"] depends = qtbase recommends = qtdeclarative qtwebsockets path = qtwebchannel url = ../qtwebchannel.git - branch = dev - status = ignore + branch = 5.15 + status = addon [submodule "qtwebengine"] depends = qtdeclarative recommends = qtquickcontrols qtquickcontrols2 qtlocation qtwebchannel qttools path = qtwebengine url = ../qtwebengine.git - branch = dev - status = ignore + branch = 5.15 + status = addon priority = 10 [submodule "qtcanvas3d"] depends = qtdeclarative @@ -216,128 +229,98 @@ recommends = qtwebengine path = qtwebview url = ../qtwebview.git - branch = dev - status = ignore + branch = 5.15 + status = addon [submodule "qtquickcontrols2"] - depends = qtdeclarative - recommends = qtimageformats qtgraphicaleffects + depends = qtgraphicaleffects + recommends = qtimageformats path = qtquickcontrols2 url = ../qtquickcontrols2.git - branch = 6.1.3 + branch = 5.15 status = essential [submodule "qtpurchasing"] depends = qtbase recommends = qtdeclarative qtandroidextras path = qtpurchasing url = ../qtpurchasing.git - branch = dev - status = ignore + branch = 5.15 + status = addon [submodule "qtcharts"] depends = qtbase recommends = qtdeclarative qtmultimedia path = qtcharts url = ../qtcharts.git - branch = 6.1.3 + branch = 5.15 status = addon [submodule "qtdatavis3d"] depends = qtbase recommends = qtdeclarative qtmultimedia path = qtdatavis3d url = ../qtdatavis3d.git - branch = 6.1.3 + branch = 5.15 status = addon [submodule "qtvirtualkeyboard"] depends = qtbase qtdeclarative qtsvg recommends = qtmultimedia qtquickcontrols path = qtvirtualkeyboard url = ../qtvirtualkeyboard.git - branch = 6.1.3 + branch = 5.15 status = addon [submodule "qtgamepad"] depends = qtbase recommends = qtdeclarative path = qtgamepad url = ../qtgamepad.git - branch = dev - status = ignore + branch = 5.15 + status = addon [submodule "qtscxml"] depends = qtbase qtdeclarative path = qtscxml url = ../qtscxml.git - branch = 6.1.3 + branch = 5.15 status = addon [submodule "qtspeech"] depends = qtbase recommends = qtdeclarative qtmultimedia path = qtspeech url = ../qtspeech.git - branch = dev - status = ignore + branch = 5.15 + status = addon [submodule "qtnetworkauth"] depends = qtbase path = qtnetworkauth url = ../qtnetworkauth.git - branch = 6.1.3 + branch = 5.15 status = addon [submodule "qtremoteobjects"] depends = qtbase recommends = qtdeclarative path = qtremoteobjects url = ../qtremoteobjects.git - branch = dev - status = ignore + branch = 5.15 + status = addon [submodule "qtwebglplugin"] depends = qtbase qtwebsockets recommends = qtdeclarative path = qtwebglplugin url = ../qtwebglplugin.git - branch = dev - status = ignore + branch = 5.15 + status = addon [submodule "qtlottie"] depends = qtbase qtdeclarative path = qtlottie url = ../qtlottie.git - branch = 6.1.3 + branch = 5.15 status = addon [submodule "qtquicktimeline"] depends = qtbase qtdeclarative path = qtquicktimeline url = ../qtquicktimeline - branch = 6.1.3 + branch = 5.15 status = addon [submodule "qtquick3d"] - depends = qtbase qtdeclarative qtshadertools + depends = qtbase qtdeclarative path = qtquick3d url = ../qtquick3d.git - branch = 6.1.3 - status = addon -[submodule "qtshadertools"] - depends = qtbase - path = qtshadertools - url = ../qtshadertools.git - branch = 6.1.3 - status = addon -[submodule "qt5compat"] - depends = qtbase qtdeclarative - path = qt5compat - url = ../qt5compat.git - branch = 6.1.3 - status = deprecated -[submodule "qtcoap"] - depends = qtbase qttools - path = qtcoap - url = ../qtcoap.git - branch = 6.1.3 - status = addon -[submodule "qtmqtt"] - depends = qtbase qtdeclarative qttools - path = qtmqtt - url = ../qtmqtt.git - branch = 6.1.3 - status = addon -[submodule "qtopcua"] - depends = qtbase qtdeclarative qtquickcontrols2 qttools - path = qtopcua - url = ../qtopcua.git - branch = 6.1.3 + branch = 5.15 status = addon diff --git a/recipes/qt/5.x.x/test_package/conanfile.py b/recipes/qt/5.x.x/test_package/conanfile.py index bb73f38aa0625b..427887bd514f27 100644 --- a/recipes/qt/5.x.x/test_package/conanfile.py +++ b/recipes/qt/5.x.x/test_package/conanfile.py @@ -1,8 +1,11 @@ import os import shutil -from conans import ConanFile, tools, Meson, RunEnvironment, CMake -from conans.errors import ConanException +from conan import ConanFile +from conans import tools, Meson, RunEnvironment, CMake +from conan.tools.build import cross_building +from conan.errors import ConanInvalidConfiguration + class TestPackageConan(ConanFile): @@ -24,11 +27,16 @@ def _is_mingw(self): def _meson_supported(self): return self.options["qt"].shared and\ - not tools.cross_building(self) and\ + not cross_building(self) and\ not tools.os_info.is_macos and\ not self._is_mingw() + def _qmake_supported(self): + return self.options["qt"].shared + def _build_with_qmake(self): + if not self._qmake_supported(): + return tools.mkdir("qmake_folder") with tools.chdir("qmake_folder"): self.output.info("Building with qmake") @@ -72,7 +80,7 @@ def _build_with_meson(self): meson = Meson(self) try: meson.configure(build_folder="meson_folder", defs={"cpp_std": "c++11"}) - except ConanException: + except ConanInvalidConfiguration: self.output.info(open("meson_folder/meson-logs/meson-log.txt", 'r').read()) raise meson.build() @@ -94,6 +102,8 @@ def build(self): self._build_with_cmake_find_package_multi() def _test_with_qmake(self): + if not self._qmake_supported(): + return self.output.info("Testing qmake") bin_path = os.path.join("qmake_folder", "bin") if tools.os_info.is_macos: @@ -113,7 +123,7 @@ def _test_with_cmake_find_package_multi(self): self.run(os.path.join("bin", "test_package"), run_environment=True) def test(self): - if not tools.cross_building(self, skip_x64_x86=True): + if not cross_building(self, skip_x64_x86=True): self._test_with_qmake() self._test_with_meson() self._test_with_cmake_find_package_multi() diff --git a/recipes/qt/6.x.x/conandata.yml b/recipes/qt/6.x.x/conandata.yml index 5df64e614dfb22..fa3f6c751ce192 100644 --- a/recipes/qt/6.x.x/conandata.yml +++ b/recipes/qt/6.x.x/conandata.yml @@ -1,20 +1,28 @@ sources: - "6.0.4": + "6.4.2": url: - - "https://download.qt.io/archive/qt/6.0/6.0.4/single/qt-everywhere-src-6.0.4.tar.xz" - - "https://qt-mirror.dannhauer.de/archive/qt/6.0/6.0.4/single/qt-everywhere-src-6.0.4.tar.xz" - - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/6.0/6.0.4/single/qt-everywhere-src-6.0.4.tar.xz" - - "https://ftp.fau.de/qtproject/archive/qt/6.0/6.0.4/single/qt-everywhere-src-6.0.4.tar.xz" - - "https://mirrors.ustc.edu.cn/qtproject/archive/qt/6.0/6.0.4/single/qt-everywhere-src-6.0.4.tar.xz" - sha256: "677db6472420f9046b16f7c0d0aa15c4f11f344462a6374feb860625c12fc72b" - "6.1.3": + - "https://download.qt.io/archive/qt/6.4/6.4.2/single/qt-everywhere-src-6.4.2.tar.xz" + - "https://qt-mirror.dannhauer.de/archive/qt/6.4/6.4.2/single/qt-everywhere-src-6.4.2.tar.xz" + - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/6.4/6.4.2/single/qt-everywhere-src-6.4.2.tar.xz" + - "https://ftp.fau.de/qtproject/archive/qt/6.4/6.4.2/single/qt-everywhere-src-6.4.2.tar.xz" + - "https://mirrors.ustc.edu.cn/qtproject/archive/qt/6.4/6.4.2/single/qt-everywhere-src-6.4.2.tar.xz" + sha256: "689f53e6652da82fccf7c2ab58066787487339f28d1ec66a8765ad357f4976be" + "6.4.1": url: - - "https://download.qt.io/archive/qt/6.1/6.1.3/single/qt-everywhere-src-6.1.3.tar.xz" - - "https://qt-mirror.dannhauer.de/archive/qt/6.1/6.1.3/single/qt-everywhere-src-6.1.3.tar.xz" - - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/6.1/6.1.3/single/qt-everywhere-src-6.1.3.tar.xz" - - "https://ftp.fau.de/qtproject/archive/qt/6.1/6.1.3/single/qt-everywhere-src-6.1.3.tar.xz" - - "https://mirrors.ustc.edu.cn/qtproject/archive/qt/6.1/6.1.3/single/qt-everywhere-src-6.1.3.tar.xz" - sha256: "552342a81fa76967656b0301233b4b586d36967fad5cd110765347aebe07413c" + - "https://download.qt.io/archive/qt/6.4/6.4.1/single/qt-everywhere-src-6.4.1.tar.xz" + - "https://qt-mirror.dannhauer.de/archive/qt/6.4/6.4.1/single/qt-everywhere-src-6.4.1.tar.xz" + - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/6.4/6.4.1/single/qt-everywhere-src-6.4.1.tar.xz" + - "https://ftp.fau.de/qtproject/archive/qt/6.4/6.4.1/single/qt-everywhere-src-6.4.1.tar.xz" + - "https://mirrors.ustc.edu.cn/qtproject/archive/qt/6.4/6.4.1/single/qt-everywhere-src-6.4.1.tar.xz" + sha256: "e20b850b6134098a7f2e7701cfddfb213c6cf394b9e848e6fbc5b0e89dcfcc09" + "6.3.2": + url: + - "https://download.qt.io/archive/qt/6.3/6.3.2/single/qt-everywhere-src-6.3.2.tar.xz" + - "https://qt-mirror.dannhauer.de/archive/qt/6.3/6.3.2/single/qt-everywhere-src-6.3.2.tar.xz" + - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/6.3/6.3.2/single/qt-everywhere-src-6.3.2.tar.xz" + - "https://ftp.fau.de/qtproject/archive/qt/6.3/6.3.2/single/qt-everywhere-src-6.3.2.tar.xz" + - "https://mirrors.ustc.edu.cn/qtproject/archive/qt/6.3/6.3.2/single/qt-everywhere-src-6.3.2.tar.xz" + sha256: "b90524f686224a0e5a945c1d65307e16a375348dbe275c9ac11de171fe31374a" "6.2.4": url: - "https://download.qt.io/archive/qt/6.2/6.2.4/single/qt-everywhere-src-6.2.4.tar.xz" @@ -23,55 +31,53 @@ sources: - "https://ftp.fau.de/qtproject/archive/qt/6.2/6.2.4/single/qt-everywhere-src-6.2.4.tar.xz" - "https://mirrors.ustc.edu.cn/qtproject/archive/qt/6.2/6.2.4/single/qt-everywhere-src-6.2.4.tar.xz" sha256: "cfe41905b6bde3712c65b102ea3d46fc80a44c9d1487669f14e4a6ee82ebb8fd" - "6.3.0": - url: - - "https://download.qt.io/archive/qt/6.3/6.3.0/single/qt-everywhere-src-6.3.0.tar.xz" - - "https://qt-mirror.dannhauer.de/archive/qt/6.3/6.3.0/single/qt-everywhere-src-6.3.0.tar.xz" - - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/6.3/6.3.0/single/qt-everywhere-src-6.3.0.tar.xz" - - "https://ftp.fau.de/qtproject/archive/qt/6.3/6.3.0/single/qt-everywhere-src-6.3.0.tar.xz" - - "https://mirrors.ustc.edu.cn/qtproject/archive/qt/6.3/6.3.0/single/qt-everywhere-src-6.3.0.tar.xz" - sha256: "cd2789cade3e865690f3c18df58ffbff8af74cc5f01faae50634c12eb52dd85b" - "6.3.1": - url: - - "https://download.qt.io/archive/qt/6.3/6.3.1/single/qt-everywhere-src-6.3.1.tar.xz" - - "https://qt-mirror.dannhauer.de/archive/qt/6.3/6.3.1/single/qt-everywhere-src-6.3.1.tar.xz" - - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/6.3/6.3.1/single/qt-everywhere-src-6.3.1.tar.xz" - - "https://ftp.fau.de/qtproject/archive/qt/6.3/6.3.1/single/qt-everywhere-src-6.3.1.tar.xz" - - "https://mirrors.ustc.edu.cn/qtproject/archive/qt/6.3/6.3.1/single/qt-everywhere-src-6.3.1.tar.xz" - sha256: "51114e789485fdb6b35d112dfd7c7abb38326325ac51221b6341564a1c3cc726" patches: - "6.0.4": - - base_path: "qt6/qtbase/cmake" + "6.4.2": + - base_path: "qtbase/cmake" patch_file: "patches/qt6-pri-helpers-fix.diff" - "6.1.3": - - base_path: "qt6/qtdeclarative" - patch_file: "patches/32451d5.diff" - - base_path: "qt6/qtbase/cmake" + - patch_file: "patches/c72097e.diff" + base_path: "qtwebengine" + - patch_file: "patches/d13958d.diff" + base_path: "qtbase" + patch_description: "Fix PCRE2 detection" + patch_type: "bugfix" + patch_source: "https://codereview.qt-project.org/c/qt/qtbase/+/445885" + "6.4.1": + - base_path: "qtbase/cmake" + patch_file: "patches/qt6-pri-helpers-fix.diff" + - patch_file: "patches/c72097e.diff" + base_path: "qtwebengine" + - patch_file: "patches/d13958d.diff" + base_path: "qtbase" + patch_description: "Fix PCRE2 detection" + patch_type: "bugfix" + patch_source: "https://codereview.qt-project.org/c/qt/qtbase/+/445885" + - patch_file: "patches/3801bba82.patch" + base_path: "qtwebengine/src/3rdparty" + patch_description: "fix qtwebengine with MSVC2022" + patch_type: "portability" + patch_source: "https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/444132" + "6.3.2": + - base_path: "qtbase/cmake" patch_file: "patches/qt6-pri-helpers-fix.diff" + - patch_file: "patches/c72097e.diff" + base_path: "qtwebengine" + - patch_file: "patches/d13958d.diff" + base_path: "qtbase" "6.2.4": - - base_path: "qt6/qtdeclarative" + - base_path: "qtdeclarative" patch_file: "patches/32451d5.diff" - - base_path: "qt6/qtbase/cmake" + - base_path: "qtbase/cmake" patch_file: "patches/qt6-pri-helpers-fix.diff" - patch_file: "patches/c72097e.diff" - base_path: "qt6/qtwebengine" + base_path: "qtwebengine" - patch_file: "patches/138a720.diff" - base_path: "qt6/qtwebengine/src/3rdparty" + base_path: "qtwebengine/src/3rdparty" - patch_file: "patches/CVE-2022-1096-qtwebengine-6.2.diff" - base_path: "qt6/qtwebengine" + base_path: "qtwebengine" - patch_file: "patches/CVE-2022-25255-qprocess6-2.diff" - base_path: "qt6/qtbase" + base_path: "qtbase" - patch_file: "patches/CVE-2022-25643-6.2.diff" - base_path: "qt6/qtbase" - "6.3.0": - - base_path: "qt6/qtbase/cmake" - patch_file: "patches/qt6-pri-helpers-fix.diff" - - patch_file: "patches/c72097e.diff" - base_path: "qt6/qtwebengine" - - patch_file: "patches/CVE-2022-1096-qtwebengine-6.3.diff" - base_path: "qt6/qtwebengine" - "6.3.1": - - base_path: "qt6/qtbase/cmake" - patch_file: "patches/qt6-pri-helpers-fix.diff" - - patch_file: "patches/c72097e.diff" - base_path: "qt6/qtwebengine" + base_path: "qtbase" + - patch_file: "patches/d13958d_.diff" + base_path: "qtbase" diff --git a/recipes/qt/6.x.x/conanfile.py b/recipes/qt/6.x.x/conanfile.py index 4231c659272619..a469306c3601cb 100644 --- a/recipes/qt/6.x.x/conanfile.py +++ b/recipes/qt/6.x.x/conanfile.py @@ -1,19 +1,24 @@ from contextlib import contextmanager import configparser -import functools import glob import os import textwrap from conan import ConanFile -from conan.tools.build import cross_building -from conan.tools.microsoft import msvc_runtime_flag -from conans import tools, RunEnvironment, CMake -from conans.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.build import cross_building, check_min_cppstd, build_jobs, default_cppstd +from conan.tools.env import VirtualBuildEnv, Environment +from conan.tools.files import copy, get, replace_in_file, apply_conandata_patches, save, rm, rmdir, export_conandata_patches +from conan.tools.gnu import PkgConfigDeps +from conan.tools.microsoft import msvc_runtime_flag, is_msvc +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration +from conans import RunEnvironment, tools from conans.model import Generator -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.55.0" class qt(Generator): @@ -55,15 +60,15 @@ class QtConan(ConanFile): "qt3d", "qtimageformats", "qtnetworkauth", "qtcoap", "qtmqtt", "qtopcua", "qtmultimedia", "qtlocation", "qtsensors", "qtconnectivity", "qtserialbus", "qtserialport", "qtwebsockets", "qtwebchannel", "qtwebengine", "qtwebview", - "qtremoteobjects", "qtpositioning", "qtlanguageserver"] + "qtremoteobjects", "qtpositioning", "qtlanguageserver", + "qtspeech", "qthttpserver", "qtquick3dphysics"] - generators = "pkg_config", "cmake_find_package", "cmake" name = "qt" description = "Qt is a cross-platform framework for graphical user interfaces." - topics = ("qt", "ui") + topics = ("framework", "ui") url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.qt.io" - license = "LGPL-3.0" + license = "LGPL-3.0-only" settings = "os", "arch", "compiler", "build_type" options = { @@ -93,6 +98,7 @@ class QtConan(ConanFile): "with_pulseaudio": [True, False], "with_gssapi": [True, False], "with_md4c": [True, False], + "with_x11": [True, False], "gui": [True, False], "widgets": [True, False], @@ -135,6 +141,7 @@ class QtConan(ConanFile): "with_pulseaudio": False, "with_gssapi": False, "with_md4c": True, + "with_x11": True, "gui": True, "widgets": True, @@ -151,10 +158,6 @@ class QtConan(ConanFile): _submodules_tree = None - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _get_module_tree(self): if self._submodules_tree: @@ -162,7 +165,7 @@ def _get_module_tree(self): config = configparser.ConfigParser() config.read(os.path.join(self.recipe_folder, "qtmodules%s.conf" % self.version)) self._submodules_tree = {} - assert config.sections() + assert config.sections(), f"no qtmodules.conf file for version {self.version}" for s in config.sections(): section = str(s) assert section.startswith("submodule ") @@ -181,11 +184,10 @@ def _get_module_tree(self): return self._submodules_tree 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 export(self): - self.copy("qtmodules%s.conf" % self.version) + copy(self, f"qtmodules{self.version}.conf", self.recipe_folder, self.export_folder) def config_options(self): if self.settings.os not in ["Linux", "FreeBSD"]: @@ -193,6 +195,7 @@ def config_options(self): del self.options.with_fontconfig self.options.with_glib = False del self.options.with_libalsa + del self.options.with_x11 if self.settings.os == "Windows": self.options.opengl = "dynamic" @@ -224,6 +227,7 @@ def configure(self): del self.options.with_libjpeg del self.options.with_libpng del self.options.with_md4c + del self.options.with_x11 if not self.options.get_safe("qtmultimedia"): del self.options.with_libalsa @@ -249,17 +253,29 @@ def _enablemodule(mod): _enablemodule(module) def validate(self): + if os.getenv('NOT_ON_C3I', '0') == '0': + if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) >= "11" or \ + self.info.settings.compiler == "clang" and Version(self.info.settings.compiler.version) >= "12": + raise ConanInvalidConfiguration("qt is not supported on gcc11 and clang >= 12 on C3I until conan-io/conan-center-index#13472 is fixed\n"\ + "If your distro is modern enough (xcb >= 1.12), set environment variable NOT_ON_C3I=1") + # C++ minimum standard required if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 17) + check_min_cppstd(self, 17) minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler), False) if not minimum_version: self.output.warn("C++17 support required. Your compiler is unknown. Assuming it supports C++17.") - elif tools.Version(self.settings.compiler.version) < minimum_version: + elif Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration("C++17 support required, which your compiler does not support.") - if tools.Version(self.version) >= "6.3.0" and self.settings.compiler == "clang" and "libstdc++" in str(self.settings.compiler.libcxx): - raise ConanInvalidConfiguration("Qt needs recent libstdc++, with charconv. please switch to gcc, of to libc++") + if Version(self.version) >= "6.4.0" and self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) < "12": + raise ConanInvalidConfiguration("apple-clang >= 12 required by qt >= 6.4.0") + + if Version(self.version) >= "6.3.0" and self.settings.compiler == "clang" and "libstdc++" in str(self.settings.compiler.libcxx): + raise ConanInvalidConfiguration("Qt needs recent libstdc++, with charconv. please switch to gcc, or to libc++") + + if Version(self.version) < "6.3.0" and self.settings.compiler == "gcc" and Version(self.settings.compiler.version) >= "11": + raise ConanInvalidConfiguration("Qt lower then 6.3.0 needs to be compiled for gcc with a version lower then 11") if self.options.get_safe("qtwebengine"): if not self.options.shared: @@ -267,11 +283,13 @@ def validate(self): if not (self.options.gui and self.options.qtdeclarative and self.options.qtwebchannel): raise ConanInvalidConfiguration("option qt:qtwebengine requires also qt:gui, qt:qtdeclarative and qt:qtwebchannel") + if not self.options.with_dbus and self.settings.os == "Linux": + raise ConanInvalidConfiguration("option qt:webengine requires also qt:with_dbus on Linux") if hasattr(self, "settings_build") and cross_building(self, skip_x64_x86=True): raise ConanInvalidConfiguration("Cross compiling Qt WebEngine is not supported") - if tools.Version(self.version) < "6.3.0": + if Version(self.version) < "6.3.0": # Check if a valid python2 is available in PATH or it will failflex # Start by checking if python2 can be found python_exe = tools.which("python2") @@ -292,7 +310,7 @@ def validate(self): verstr = mybuf.getvalue().strip().split("Python ")[1] if verstr.endswith("+"): verstr = verstr[:-1] - version = tools.Version(verstr) + version = Version(verstr) # >= 2.7.5 & < 3 v_min = "2.7.5" v_max = "3.0.0" @@ -330,136 +348,317 @@ def validate(self): if self.settings.os in ['Linux', 'FreeBSD'] and self.options.with_gssapi: raise ConanInvalidConfiguration("gssapi cannot be enabled until conan-io/conan-center-index#4102 is closed") + if self.options.get_safe("with_x11", False) and not self.dependencies.direct_host["xkbcommon"].options.with_x11: + raise ConanInvalidConfiguration("The 'with_x11' option for the 'xkbcommon' package must be enabled when the 'with_x11' option is enabled") + if self.options.get_safe("qtwayland", False) and not self.dependencies.direct_host["xkbcommon"].options.with_wayland: + raise ConanInvalidConfiguration("The 'with_wayland' option for the 'xkbcommon' package must be enabled when the 'qtwayland' option is enabled") + + if cross_building(self): + raise ConanInvalidConfiguration("cross compiling qt 6 is not yet supported. Contributions are welcome") + + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.openssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") if self.options.with_pcre2: - self.requires("pcre2/10.37") # needs to be < 10.38 or qt fails to detect visual studio static library + self.requires("pcre2/10.40") if self.options.get_safe("with_vulkan"): - self.requires("vulkan-loader/1.3.221.0") - if tools.is_apple_os(self.settings.os): - self.requires("moltenvk/1.1.10") + self.requires("vulkan-loader/1.3.231.0") + if is_apple_os(self): + self.requires("moltenvk/1.2.0") if self.options.with_glib: - self.requires("glib/2.73.2") + self.requires("glib/2.75.1") if self.options.with_doubleconversion and not self.options.multiconfiguration: - self.requires("double-conversion/3.2.0") + self.requires("double-conversion/3.2.1") if self.options.get_safe("with_freetype", False) and not self.options.multiconfiguration: self.requires("freetype/2.12.1") if self.options.get_safe("with_fontconfig", False): self.requires("fontconfig/2.13.93") if self.options.get_safe("with_icu", False): - self.requires("icu/71.1") + self.requires("icu/72.1") if self.options.get_safe("with_harfbuzz", False) and not self.options.multiconfiguration: - self.requires("harfbuzz/4.4.1") + self.requires("harfbuzz/5.3.1") if self.options.get_safe("with_libjpeg", False) and not self.options.multiconfiguration: if self.options.with_libjpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.3") + self.requires("libjpeg-turbo/2.1.4") else: - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") if self.options.get_safe("with_libpng", False) and not self.options.multiconfiguration: - self.requires("libpng/1.6.37") + self.requires("libpng/1.6.39") if self.options.with_sqlite3 and not self.options.multiconfiguration: - self.requires("sqlite3/3.39.2") + self.requires("sqlite3/3.40.0") self.options["sqlite3"].enable_column_metadata = True if self.options.get_safe("with_mysql", False): - self.requires("libmysqlclient/8.0.29") + self.requires("libmysqlclient/8.0.30") if self.options.with_pq: - self.requires("libpq/14.2") + self.requires("libpq/14.5") if self.options.with_odbc: if self.settings.os != "Windows": - self.requires("odbc/2.3.9") + self.requires("odbc/2.3.11") if self.options.get_safe("with_openal", False): - self.requires("openal/1.22.1") + self.requires("openal/1.22.2") if self.options.get_safe("with_libalsa", False): self.requires("libalsa/1.2.7.2") - if self.options.gui and self.settings.os in ["Linux", "FreeBSD"]: - self.requires("xorg/system") + if self.options.get_safe("with_x11", False): self.requires("xkbcommon/1.4.1") + self.requires("xorg/system") if self.settings.os != "Windows" and self.options.get_safe("opengl", "no") != "no": self.requires("opengl/system") if self.options.with_zstd: self.requires("zstd/1.5.2") if self.options.qtwayland: + self.requires("xkbcommon/1.4.1") self.requires("wayland/1.21.0") if self.options.with_brotli: self.requires("brotli/1.0.9") if self.options.get_safe("qtwebengine") and self.settings.os == "Linux": - self.requires("expat/2.4.8") + self.requires("expat/2.5.0") self.requires("opus/1.3.1") - self.requires("xorg-proto/2021.4") + self.requires("xorg-proto/2022.2") self.requires("libxshmfence/1.3") - self.requires("nss/3.77") - self.requires("libdrm/2.4.109") + self.requires("nss/3.85") + self.requires("libdrm/2.4.114") if self.options.get_safe("with_gstreamer", False): self.requires("gst-plugins-base/1.19.2") if self.options.get_safe("with_pulseaudio", False): self.requires("pulseaudio/14.2") if self.options.with_dbus: - self.requires("dbus/1.12.20") + self.requires("dbus/1.15.2") if self.settings.os in ['Linux', 'FreeBSD'] and self.options.with_gssapi: self.requires("krb5/1.18.3") # conan-io/conan-center-index#4102 if self.options.get_safe("with_md4c", False): self.requires("md4c/0.4.8") def build_requirements(self): - self.build_requires("cmake/3.23.2") - self.build_requires("ninja/1.11.0") - self.build_requires("pkgconf/1.7.4") + self.tool_requires("cmake/3.25.0") + self.tool_requires("ninja/1.11.1") + self.tool_requires("pkgconf/1.9.3") if self.settings.os == "Windows": - self.build_requires('strawberryperl/5.30.0.1') + self.tool_requires('strawberryperl/5.32.1.1') if self.options.get_safe("qtwebengine"): - self.build_requires("nodejs/16.3.0") - self.build_requires("gperf/3.1") + self.tool_requires("nodejs/16.3.0") + self.tool_requires("gperf/3.1") # gperf, bison, flex, python >= 2.7.5 & < 3 if self.settings.os != "Windows": - self.build_requires("bison/3.7.6") - self.build_requires("flex/2.6.4") + self.tool_requires("bison/3.8.2") + self.tool_requires("flex/2.6.4") else: - self.build_requires("winflexbison/2.5.24") + self.tool_requires("winflexbison/2.5.24") if self.options.qtwayland: - self.build_requires("wayland/1.21.0") + self.tool_requires("wayland/1.21.0") + if cross_building(self): + self.tool_requires(f"qt/{self.version}") + + def generate(self): + ms = VirtualBuildEnv(self) + ms.generate() + + tc = CMakeDeps(self) + tc.set_property("libdrm", "cmake_file_name", "Libdrm") + tc.set_property("libdrm::libdrm_libdrm", "cmake_target_name", "Libdrm::Libdrm") + tc.set_property("wayland", "cmake_file_name", "Wayland") + tc.set_property("wayland::wayland-client", "cmake_target_name", "Wayland::Client") + tc.set_property("wayland::wayland-server", "cmake_target_name", "Wayland::Server") + tc.set_property("wayland::wayland-cursor", "cmake_target_name", "Wayland::Cursor") + tc.set_property("wayland::wayland-egl", "cmake_target_name", "Wayland::Egl") + tc.generate() + + for f in glob.glob("*.cmake"): + replace_in_file(self, f, + " IMPORTED)\n", + " IMPORTED GLOBAL)\n", strict=False) + + pc = PkgConfigDeps(self) + pc.generate() + + # TODO: to remove when properly handled by conan (see https://github.com/conan-io/conan/issues/11962) + env = Environment() + env.prepend_path("PKG_CONFIG_PATH", self.generators_folder) + env.vars(self).save_script("conanbuildenv_pkg_config_path") + + tc = CMakeToolchain(self, generator="Ninja") + + package_folder = self.package_folder.replace('\\', '/') + tc.variables["INSTALL_MKSPECSDIR"] = f"{package_folder}/res/archdatadir/mkspecs" + tc.variables["INSTALL_ARCHDATADIR"] = f"{package_folder}/res/archdatadir" + tc.variables["INSTALL_LIBEXECDIR"] = f"{package_folder}/bin" + tc.variables["INSTALL_DATADIR"] = f"{package_folder}/res/datadir" + tc.variables["INSTALL_SYSCONFDIR"] = f"{package_folder}/res/sysconfdir" + + tc.variables["QT_BUILD_TESTS"] = "OFF" + tc.variables["QT_BUILD_EXAMPLES"] = "OFF" + + if is_msvc(self) and "MT" in msvc_runtime_flag(self): + tc.variables["FEATURE_static_runtime"] = "ON" + + if self.options.multiconfiguration: + tc.variables["CMAKE_CONFIGURATION_TYPES"] = "Release;Debug" + tc.variables["FEATURE_optimize_size"] = ("ON" if self.settings.build_type == "MinSizeRel" else "OFF") + + for module in self._get_module_tree: + if module != 'qtbase': + tc.variables["BUILD_%s" % module] = ("ON" if self.options.get_safe(module) else "OFF") + + tc.variables["FEATURE_system_zlib"] = "ON" + + tc.variables["INPUT_opengl"] = self.options.get_safe("opengl", "no") + + # openSSL + if not self.options.openssl: + tc.variables["INPUT_openssl"] = "no" + else: + tc.variables["HAVE_openssl"] = "ON" + if self.options["openssl"].shared: + tc.variables["INPUT_openssl"] = "runtime" + else: + tc.variables["INPUT_openssl"] = "linked" + + if self.options.with_dbus: + tc.variables["INPUT_dbus"] = "linked" + else: + tc.variables["FEATURE_dbus"] = "OFF" + tc.variables["CMAKE_FIND_DEBUG_MODE"] = "FALSE" + + + for opt, conf_arg in [("with_glib", "glib"), + ("with_icu", "icu"), + ("with_fontconfig", "fontconfig"), + ("with_mysql", "sql_mysql"), + ("with_pq", "sql_psql"), + ("with_odbc", "sql_odbc"), + ("gui", "gui"), + ("widgets", "widgets"), + ("with_zstd", "zstd"), + ("with_vulkan", "vulkan"), + ("with_brotli", "brotli"), + ("with_gssapi", "gssapi")]: + tc.variables["FEATURE_%s" % conf_arg] = ("ON" if self.options.get_safe(opt, False) else "OFF") + + + for opt, conf_arg in [ + ("with_doubleconversion", "doubleconversion"), + ("with_freetype", "freetype"), + ("with_harfbuzz", "harfbuzz"), + ("with_libjpeg", "jpeg"), + ("with_libpng", "png"), + ("with_sqlite3", "sqlite"), + ("with_pcre2", "pcre2"),]: + if self.options.get_safe(opt, False): + if self.options.multiconfiguration: + tc.variables["FEATURE_%s" % conf_arg] = "ON" + else: + tc.variables["FEATURE_system_%s" % conf_arg] = "ON" + else: + tc.variables["FEATURE_%s" % conf_arg] = "OFF" + tc.variables["FEATURE_system_%s" % conf_arg] = "OFF" + + for opt, conf_arg in [ + ("with_doubleconversion", "doubleconversion"), + ("with_freetype", "freetype"), + ("with_harfbuzz", "harfbuzz"), + ("with_libjpeg", "libjpeg"), + ("with_libpng", "libpng"), + ("with_md4c", "libmd4c"), + ("with_pcre2", "pcre"),]: + if self.options.get_safe(opt, False): + if self.options.multiconfiguration: + tc.variables["INPUT_%s" % conf_arg] = "qt" + else: + tc.variables["INPUT_%s" % conf_arg] = "system" + else: + tc.variables["INPUT_%s" % conf_arg] = "no" + + for feature in str(self.options.disabled_features).split(): + tc.variables["FEATURE_%s" % feature] = "OFF" + + if self.settings.os == "Macos": + tc.variables["FEATURE_framework"] = "OFF" + elif self.settings.os == "Android": + tc.variables["CMAKE_ANDROID_NATIVE_API_LEVEL"] = self.settings.os.api_level + tc.variables["ANDROID_ABI"] = {"armv7": "armeabi-v7a", + "armv8": "arm64-v8a", + "x86": "x86", + "x86_64": "x86_64"}.get(str(self.settings.arch)) + + if self.options.sysroot: + tc.variables["CMAKE_SYSROOT"] = self.options.sysroot + + if self.options.device: + tc.variables["QT_QMAKE_TARGET_MKSPEC"] = f"devices/{self.options.device}" + else: + xplatform_val = self._xplatform() + if xplatform_val: + tc.variables["QT_QMAKE_TARGET_MKSPEC"] = xplatform_val + else: + self.output.warn("host not supported: %s %s %s %s" % + (self.settings.os, self.settings.compiler, + self.settings.compiler.version, self.settings.arch)) + if self.options.cross_compile: + tc.variables["QT_QMAKE_DEVICE_OPTIONS"] = "CROSS_COMPILE=%s" % self.options.cross_compile + + tc.variables["FEATURE_pkg_config"] = "ON" + if self.settings.compiler == "gcc" and self.settings.build_type == "Debug" and not self.options.shared: + tc.variables["BUILD_WITH_PCH"]= "OFF" # disabling PCH to save disk space + + if self.settings.os == "Windows": + tc.variables["HOST_PERL"] = getattr(self, "user_info_build", self.deps_user_info)["strawberryperl"].perl + #"set(QT_EXTRA_INCLUDEPATHS ${CONAN_INCLUDE_DIRS})\n" + #"set(QT_EXTRA_DEFINES ${CONAN_DEFINES})\n" + #"set(QT_EXTRA_LIBDIRS ${CONAN_LIB_DIRS})\n" + + current_cpp_std = self.settings.get_safe("compiler.cppstd", default_cppstd(self)) + current_cpp_std = str(current_cpp_std).replace("gnu", "") + cpp_std_map = { + "20": "FEATURE_cxx20" + } + if Version(self.version) >= "6.5.0": + cpp_std_map["23"] = "FEATURE_cxx2b" + + tc.variables[cpp_std_map.get(current_cpp_std, "FEATURE_cxx17")] = "ON" + + tc.generate() def source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination="qt6") + destination = self.source_folder + if self.settings.os == "Windows": + # Don't use os.path.join, or it removes the \\?\ prefix, which enables long paths + destination = f"\\\\?\\{self.source_folder}" + get(self, **self.conan_data["sources"][self.version], + strip_root=True, destination=destination) # patching in source method because of no_copy_source attribute - tools.replace_in_file(os.path.join("qt6", "CMakeLists.txt"), - "enable_testing()", - "include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)\nconan_basic_setup(KEEP_RPATHS)\n" - "set(QT_EXTRA_INCLUDEPATHS ${CONAN_INCLUDE_DIRS})\n" - "set(QT_EXTRA_DEFINES ${CONAN_DEFINES})\n" - "set(QT_EXTRA_LIBDIRS ${CONAN_LIB_DIRS})\n" - "enable_testing()") - - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if tools.Version(self.version) >= "6.2.0": + apply_conandata_patches(self) + if Version(self.version) >= "6.2.0": for f in ["renderer", os.path.join("renderer", "core"), os.path.join("renderer", "platform")]: - tools.replace_in_file(os.path.join(self.source_folder, "qt6", "qtwebengine", "src", "3rdparty", "chromium", "third_party", "blink", f, "BUILD.gn"), + replace_in_file(self, os.path.join(self.source_folder, "qtwebengine", "src", "3rdparty", "chromium", "third_party", "blink", f, "BUILD.gn"), " if (enable_precompiled_headers) {\n if (is_win) {", " if (enable_precompiled_headers) {\n if (false) {" ) - tools.replace_in_file(os.path.join("qt6", "qtbase", "cmake", "QtInternalTargets.cmake"), + replace_in_file(self, os.path.join(self.source_folder, "qtbase", "cmake", "QtInternalTargets.cmake"), "-Zc:wchar_t", "-Zc:wchar_t -Zc:twoPhase-") for f in ["FindPostgreSQL.cmake"]: - file = os.path.join("qt6", "qtbase", "cmake", f) + file = os.path.join(self.source_folder, "qtbase", "cmake", f) if os.path.isfile(file): os.remove(file) # workaround QTBUG-94356 - if tools.Version(self.version) >= "6.1.1": - zlib_file_name = "FindWrapSystemZLIB.cmake" if tools.Version(self.version) >= "6.3.1" else "FindWrapZLIB.cmake" - tools.replace_in_file(os.path.join("qt6", "qtbase", "cmake", zlib_file_name), '"-lz"', 'ZLIB::ZLIB') - tools.replace_in_file(os.path.join("qt6", "qtbase", "configure.cmake"), + if Version(self.version) >= "6.1.1": + zlib_file_name = "FindWrapSystemZLIB.cmake" if Version(self.version) >= "6.3.1" else "FindWrapZLIB.cmake" + replace_in_file(self, os.path.join(self.source_folder, "qtbase", "cmake", zlib_file_name), '"-lz"', 'ZLIB::ZLIB') + replace_in_file(self, os.path.join(self.source_folder, "qtbase", "configure.cmake"), "set_property(TARGET ZLIB::ZLIB PROPERTY IMPORTED_GLOBAL TRUE)", "") + if Version(self.version) <= "6.4.0": + # use official variable name https://cmake.org/cmake/help/latest/module/FindFontconfig.html + replace_in_file(self, os.path.join(self.source_folder, "qtbase", "src", "gui", "configure.cmake"), "FONTCONFIG_FOUND", "Fontconfig_FOUND") def _xplatform(self): if self.settings.os == "Linux": @@ -505,7 +704,7 @@ def _xplatform(self): }.get(str(self.settings.compiler)) elif self.settings.os == "WindowsStore": - if self._is_msvc: + if is_msvc(self): if self.settings.compiler == "Visual Studio": msvc_version = str(self.settings.compiler.version) else: @@ -561,193 +760,35 @@ def _xplatform(self): @contextmanager def _build_context(self): - with tools.vcvars(self) if self._is_msvc else tools.no_op(): + with tools.vcvars(self) if is_msvc(self) else tools.no_op(): # next lines force cmake package to be in PATH before the one provided by visual studio (vcvars) - build_env = tools.RunEnvironment(self).vars if self._is_msvc else {} - build_env["MAKEFLAGS"] = "j%d" % tools.cpu_count() + build_env = tools.RunEnvironment(self).vars if is_msvc(self) else {} + build_env["MAKEFLAGS"] = "j%d" % build_jobs(self) build_env["PKG_CONFIG_PATH"] = [self.build_folder] if self.settings.os == "Windows": if "PATH" not in build_env: build_env["PATH"] = [] - build_env["PATH"].append(os.path.join(self.source_folder, "qt6", "gnuwin32", "bin")) - if self._is_msvc: + build_env["PATH"].append(os.path.join(self.source_folder, "gnuwin32", "bin")) + if is_msvc(self): # this avoids cmake using gcc from strawberryperl build_env["CC"] = "cl" build_env["CXX"] = "cl" with tools.environment_append(build_env): - if tools.os_info.is_macos: - tools.save(".qmake.stash" , "") - tools.save(".qmake.super" , "") + if self.settings.os == "Macos": + save(self, ".qmake.stash" , "") + save(self, ".qmake.super" , "") yield - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self, generator="Ninja") - - cmake.definitions["INSTALL_MKSPECSDIR"] = os.path.join(self.package_folder, "res", "archdatadir", "mkspecs") - cmake.definitions["INSTALL_ARCHDATADIR"] = os.path.join(self.package_folder, "res", "archdatadir") - cmake.definitions["INSTALL_LIBEXECDIR"] = os.path.join(self.package_folder, "bin") - cmake.definitions["INSTALL_DATADIR"] = os.path.join(self.package_folder, "res", "datadir") - cmake.definitions["INSTALL_SYSCONFDIR"] = os.path.join(self.package_folder, "res", "sysconfdir") - - cmake.definitions["QT_BUILD_TESTS"] = "OFF" - cmake.definitions["QT_BUILD_EXAMPLES"] = "OFF" - - if self._is_msvc and "MT" in msvc_runtime_flag(self): - cmake.definitions["FEATURE_static_runtime"] = "ON" - - if self.options.multiconfiguration: - cmake.generator = "Ninja Multi-Config" - cmake.definitions["CMAKE_CONFIGURATION_TYPES"] = "Release;Debug" - cmake.definitions["FEATURE_optimize_size"] = ("ON" if self.settings.build_type == "MinSizeRel" else "OFF") - - for module in self._get_module_tree: - if module != 'qtbase': - cmake.definitions["BUILD_%s" % module] = ("ON" if self.options.get_safe(module) else "OFF") - - cmake.definitions["FEATURE_system_zlib"] = "ON" - - cmake.definitions["INPUT_opengl"] = self.options.get_safe("opengl", "no") - - # openSSL - if not self.options.openssl: - cmake.definitions["INPUT_openssl"] = "no" - else: - if self.options["openssl"].shared: - cmake.definitions["INPUT_openssl"] = "runtime" - else: - cmake.definitions["INPUT_openssl"] = "linked" - - if self.options.with_dbus: - cmake.definitions["INPUT_dbus"] = "linked" - else: - cmake.definitions["FEATURE_dbus"] = "OFF" - - - for opt, conf_arg in [("with_glib", "glib"), - ("with_icu", "icu"), - ("with_fontconfig", "fontconfig"), - ("with_mysql", "sql_mysql"), - ("with_pq", "sql_psql"), - ("with_odbc", "sql_odbc"), - ("gui", "gui"), - ("widgets", "widgets"), - ("with_zstd", "zstd"), - ("with_vulkan", "vulkan"), - ("with_brotli", "brotli"), - ("with_gssapi", "gssapi")]: - cmake.definitions["FEATURE_%s" % conf_arg] = ("ON" if self.options.get_safe(opt, False) else "OFF") - - - for opt, conf_arg in [ - ("with_doubleconversion", "doubleconversion"), - ("with_freetype", "freetype"), - ("with_harfbuzz", "harfbuzz"), - ("with_libjpeg", "jpeg"), - ("with_libpng", "png"), - ("with_sqlite3", "sqlite"), - ("with_pcre2", "pcre2"),]: - if self.options.get_safe(opt, False): - if self.options.multiconfiguration: - cmake.definitions["FEATURE_%s" % conf_arg] = "ON" - else: - cmake.definitions["FEATURE_system_%s" % conf_arg] = "ON" - else: - cmake.definitions["FEATURE_%s" % conf_arg] = "OFF" - cmake.definitions["FEATURE_system_%s" % conf_arg] = "OFF" - - for opt, conf_arg in [ - ("with_doubleconversion", "doubleconversion"), - ("with_freetype", "freetype"), - ("with_harfbuzz", "harfbuzz"), - ("with_libjpeg", "libjpeg"), - ("with_libpng", "libpng"), - ("with_md4c", "libmd4c"), - ("with_pcre2", "pcre"),]: - if self.options.get_safe(opt, False): - if self.options.multiconfiguration: - cmake.definitions["INPUT_%s" % conf_arg] = "qt" - else: - cmake.definitions["INPUT_%s" % conf_arg] = "system" - else: - cmake.definitions["INPUT_%s" % conf_arg] = "no" - - for feature in str(self.options.disabled_features).split(): - cmake.definitions["FEATURE_%s" % feature] = "OFF" - - if self.settings.os == "Macos": - cmake.definitions["FEATURE_framework"] = "OFF" - elif self.settings.os == "Android": - cmake.definitions["CMAKE_ANDROID_NATIVE_API_LEVEL"] = self.settings.os.api_level - cmake.definitions["ANDROID_ABI"] = {"armv7": "armeabi-v7a", - "armv8": "arm64-v8a", - "x86": "x86", - "x86_64": "x86_64"}.get(str(self.settings.arch)) - - if self.options.sysroot: - cmake.definitions["CMAKE_SYSROOT"] = self.options.sysroot - - if self.options.device: - cmake.definitions["QT_QMAKE_TARGET_MKSPEC"] = os.path.join("devices", self.options.device) - else: - xplatform_val = self._xplatform() - if xplatform_val: - cmake.definitions["QT_QMAKE_TARGET_MKSPEC"] = xplatform_val - else: - self.output.warn("host not supported: %s %s %s %s" % - (self.settings.os, self.settings.compiler, - self.settings.compiler.version, self.settings.arch)) - if self.options.cross_compile: - cmake.definitions["QT_QMAKE_DEVICE_OPTIONS"] = "CROSS_COMPILE=%s" % self.options.cross_compile - - cmake.definitions["FEATURE_pkg_config"] = "ON" - if self.settings.compiler == "gcc" and self.settings.build_type == "Debug" and not self.options.shared: - cmake.definitions["BUILD_WITH_PCH"]= "OFF" # disabling PCH to save disk space - - if self.settings.os == "Windows": - cmake.definitions["HOST_PERL"] = getattr(self, "user_info_build", self.deps_user_info)["strawberryperl"].perl - - try: - cmake.configure(source_folder="qt6") - except: - cmake_err_log = os.path.join(self.build_folder, "CMakeFiles", "CMakeError.log") - cmake_out_log = os.path.join(self.build_folder, "CMakeFiles", "CMakeOutput.log") - if os.path.isfile(cmake_err_log): - self.output.info(tools.load(cmake_err_log)) - if os.path.isfile(cmake_out_log): - self.output.info(tools.load(cmake_out_log)) - raise - return cmake - def build(self): - for f in glob.glob("*.cmake"): - tools.replace_in_file(f, - "$<$,SHARED_LIBRARY>:>", - "", strict=False) - tools.replace_in_file(f, - "$<$,MODULE_LIBRARY>:>", - "", strict=False) - tools.replace_in_file(f, - "$<$,EXECUTABLE>:>", - "", strict=False) - tools.replace_in_file(f, - "$<$,SHARED_LIBRARY>:-Wl,--export-dynamic>", - "", strict=False) - tools.replace_in_file(f, - "$<$,MODULE_LIBRARY>:-Wl,--export-dynamic>", - "", strict=False) - tools.replace_in_file(f, - " IMPORTED)\n", - " IMPORTED GLOBAL)\n", strict=False) - with self._build_context(): - cmake = self._configure_cmake() - if tools.os_info.is_macos: - tools.save("bash_env", 'export DYLD_LIBRARY_PATH="%s"' % ":".join(RunEnvironment(self).vars["DYLD_LIBRARY_PATH"])) + cmake = CMake(self) + cmake.configure() + if self.settings.os == "Macos": + save(self, "bash_env", 'export DYLD_LIBRARY_PATH="%s"' % ":".join(RunEnvironment(self).vars["DYLD_LIBRARY_PATH"])) with tools.environment_append({ "BASH_ENV": os.path.abspath("bash_env") - }) if tools.os_info.is_macos else tools.no_op(): + }) if self.settings.os == "Macos" else tools.no_op(): with tools.run_environment(self): with tools.remove_from_path("perl") if self.settings.os == "Windows" else tools.no_op(): cmake.build() @@ -765,32 +806,32 @@ def _cmake_qt6_private_file(self, module): def package(self): with self._build_context(): - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - tools.save(os.path.join(self.package_folder, "bin", "qt.conf"), qt.content_template("..", "res", self.settings.os)) - self.copy("*LICENSE*", src="qt6/", dst="licenses") + save(self, os.path.join(self.package_folder, "bin", "qt.conf"), qt.content_template("..", "res", self.settings.os)) + copy(self, "*LICENSE*", self.source_folder, os.path.join(self.package_folder, "licenses")) for module in self._get_module_tree: if module != "qtbase" and not self.options.get_safe(module): - tools.rmdir(os.path.join(self.package_folder, "licenses", module)) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "licenses", module)) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) for mask in ["Find*.cmake", "*Config.cmake", "*-config.cmake"]: - tools.remove_files_by_mask(self.package_folder, mask) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la*") - tools.remove_files_by_mask(self.package_folder, "*.pdb*") - tools.remove_files_by_mask(self.package_folder, "ensure_pro_file.cmake") + rm(self, mask, self.package_folder, recursive=True) + rm(self, "*.la*", os.path.join(self.package_folder, "lib"), recursive=True) + rm(self, "*.pdb*", self.package_folder, recursive=True) + rm(self, "ensure_pro_file.cmake", self.package_folder, recursive=True) os.remove(os.path.join(self.package_folder, "bin", "qt-cmake-private-install.cmake")) for m in os.listdir(os.path.join(self.package_folder, "lib", "cmake")): module = os.path.join(self.package_folder, "lib", "cmake", m, "%sMacros.cmake" % m) helper_modules = glob.glob(os.path.join(self.package_folder, "lib", "cmake", m, "QtPublic*Helpers.cmake")) if not os.path.isfile(module) and not helper_modules: - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake", m)) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake", m)) extension = "" if self.settings.os == "Windows": extension = ".exe" filecontents = "set(QT_CMAKE_EXPORT_NAMESPACE Qt6)\n" - ver = tools.Version(self.version) + ver = Version(self.version) filecontents += "set(QT_VERSION_MAJOR %s)\n" % ver.major filecontents += "set(QT_VERSION_MINOR %s)\n" % ver.minor filecontents += "set(QT_VERSION_PATCH %s)\n" % ver.patch @@ -835,7 +876,7 @@ def package(self): endif() """ % ver.major) filecontents += 'set(CMAKE_AUTOMOC_MACRO_NAMES "Q_OBJECT" "Q_GADGET" "Q_GADGET_EXPORT" "Q_NAMESPACE" "Q_NAMESPACE_EXPORT")\n' - tools.save(os.path.join(self.package_folder, self._cmake_executables_file), filecontents) + save(self, os.path.join(self.package_folder, self._cmake_executables_file), filecontents) def _create_private_module(module, dependencies=[]): dependencies_string = ';'.join('Qt6::%s' % dependency for dependency in dependencies) @@ -855,7 +896,7 @@ def _create_private_module(module, dependencies=[]): ) endif()""".format(module, self.version, dependencies_string)) - tools.save(os.path.join(self.package_folder, self._cmake_qt6_private_file(module)), contents) + save(self, os.path.join(self.package_folder, self._cmake_qt6_private_file(module)), contents) _create_private_module("Core", ["Core"]) @@ -881,12 +922,12 @@ def _create_private_module(module, dependencies=[]): TARGET ${QT_CMAKE_EXPORT_NAMESPACE}::Core APPEND PROPERTY INTERFACE_LINK_LIBRARIES "$<${entrypoint_conditions}:${QT_CMAKE_EXPORT_NAMESPACE}::EntryPointPrivate>" )""") - tools.save(os.path.join(self.package_folder, self._cmake_entry_point_file), contents) + save(self, os.path.join(self.package_folder, self._cmake_entry_point_file), contents) def package_id(self): del self.info.options.cross_compile del self.info.options.sysroot - if self.options.multiconfiguration and self._is_msvc: + if self.options.multiconfiguration and is_msvc(self): if self.settings.compiler == "Visual Studio": if "MD" in self.settings.compiler.runtime: self.info.settings.compiler.runtime = "MD/MDd" @@ -895,6 +936,11 @@ def package_id(self): else: self.info.settings.compiler.runtime_type = "Release/Debug" + @property + def _has_positioning(self): + return (self.options.get_safe("qtlocation") and Version(self.version) < "6.2.2") or \ + (self.options.get_safe("qtpositioning") and Version(self.version) >= "6.2.2") + def package_info(self): self.cpp_info.set_property("cmake_file_name", "Qt6") @@ -905,19 +951,32 @@ def package_info(self): self.runenv_info.define("QT_PLUGIN_PATH", os.path.join(self.package_folder, "res", "archdatadir", "plugins")) self.buildenv_info.define("QT_PLUGIN_PATH", os.path.join(self.package_folder, "res", "archdatadir", "plugins")) - build_modules = [] + self.buildenv_info.define("QT_HOST_PATH", self.package_folder) + + build_modules = {} + def _add_build_module(component, module): + if component not in build_modules: + build_modules[component] = [] + build_modules[component].append(module) + self.cpp_info.components[component].build_modules["cmake_find_package"].append(module) + self.cpp_info.components[component].build_modules["cmake_find_package_multi"].append(module) libsuffix = "" if self.settings.build_type == "Debug": if self.settings.os == "Windows": libsuffix = "d" - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): libsuffix = "_debug" def _get_corrected_reqs(requires): reqs = [] for r in requires: - reqs.append(r if "::" in r else "qt%s" % r) + if "::" in r: + corrected_req = r + else: + corrected_req = f"qt{r}" + assert corrected_req in self.cpp_info.components, f"{corrected_req} required but not yet present in self.cpp_info.components" + reqs.append(corrected_req) return reqs def _create_module(module, requires=[], has_include_dir=True): @@ -966,22 +1025,24 @@ def _create_plugin(pluginname, libname, type, requires): _create_module("Core", core_reqs) if self.settings.os == "Windows": - if tools.Version(self.version) >= "6.3.0": + if Version(self.version) >= "6.3.0": self.cpp_info.components["qtCore"].system_libs.append("authz") - if self._is_msvc: - if tools.Version(self.version) >= "6.3.0": + if is_msvc(self): + if Version(self.version) >= "6.3.0": self.cpp_info.components["qtCore"].cxxflags.append("-permissive-") - if tools.Version(self.version) >= "6.2.0": + if Version(self.version) >= "6.2.0": self.cpp_info.components["qtCore"].cxxflags.append("-Zc:__cplusplus") self.cpp_info.components["qtCore"].system_libs.append("synchronization") - if tools.Version(self.version) >= "6.2.1": + if Version(self.version) >= "6.2.1": self.cpp_info.components["qtCore"].system_libs.append("runtimeobject") self.cpp_info.components["qtPlatform"].set_property("cmake_target_name", "Qt6::Platform") self.cpp_info.components["qtPlatform"].names["cmake_find_package"] = "Platform" self.cpp_info.components["qtPlatform"].names["cmake_find_package_multi"] = "Platform" self.cpp_info.components["qtPlatform"].includedirs = [os.path.join("res", "archdatadir", "mkspecs", self._xplatform())] - if tools.Version(self.version) < "6.1.0": + if Version(self.version) < "6.1.0": self.cpp_info.components["qtCore"].libs.append("Qt6Core_qobject%s" % libsuffix) + if self.options.with_dbus: + _create_module("DBus", ["dbus::dbus"]) if self.options.gui: gui_reqs = [] if self.options.with_dbus: @@ -993,12 +1054,15 @@ def _create_plugin(pluginname, libname, type, requires): if self.options.get_safe("with_fontconfig", False): gui_reqs.append("fontconfig::fontconfig") if self.settings.os in ["Linux", "FreeBSD"]: - gui_reqs.extend(["xorg::xorg", "xkbcommon::xkbcommon"]) + if self.options.qtwayland or self.options.get_safe("with_x11", False): + gui_reqs.append("xkbcommon::xkbcommon") + if self.options.get_safe("with_x11", False): + gui_reqs.append("xorg::xorg") if self.settings.os != "Windows" and self.options.get_safe("opengl", "no") != "no": gui_reqs.append("opengl::opengl") if self.options.get_safe("with_vulkan", False): gui_reqs.append("vulkan-loader::vulkan-loader") - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): gui_reqs.append("moltenvk::moltenvk") if self.options.with_harfbuzz: gui_reqs.append("harfbuzz::harfbuzz") @@ -1008,11 +1072,13 @@ def _create_plugin(pluginname, libname, type, requires): gui_reqs.append("md4c::md4c") _create_module("Gui", gui_reqs) - build_modules.append(self._cmake_qt6_private_file("Gui")) - self.cpp_info.components["qtGui"].build_modules["cmake_find_package"].append(self._cmake_qt6_private_file("Gui")) - self.cpp_info.components["qtGui"].build_modules["cmake_find_package_multi"].append(self._cmake_qt6_private_file("Gui")) + _add_build_module("qtGui", self._cmake_qt6_private_file("Gui")) if self.settings.os == "Windows": + self.cpp_info.components["qtGui"].system_libs = ["advapi32", "gdi32", "ole32", "shell32", "user32", "d3d11", + "dxgi", "dxguid", "d2d1", "dwrite"] + if self.settings.compiler == "gcc": + self.cpp_info.components["qtGui"].system_libs.append("uuid") _create_plugin("QWindowsIntegrationPlugin", "qwindows", "platforms", ["Core", "Gui"]) _create_plugin("QWindowsVistaStylePlugin", "qwindowsvistastyle", "styles", ["Core", "Gui"]) self.cpp_info.components["qtQWindowsIntegrationPlugin"].system_libs = ["advapi32", "dwmapi", "gdi32", "imm32", @@ -1032,7 +1098,7 @@ def _create_plugin(pluginname, libname, type, requires): _create_plugin("QMinimalIntegrationPlugin", "qminimal", "platforms", []) elif self.settings.os == "Emscripten": _create_plugin("QWasmIntegrationPlugin", "qwasm", "platforms", ["Core", "Gui"]) - elif self.settings.os in ["Linux", "FreeBSD"]: + elif self.options.get_safe("with_x11", False): _create_module("XcbQpaPrivate", ["xkbcommon::libxkbcommon-x11", "xorg::xorg"], has_include_dir=False) _create_plugin("QXcbIntegrationPlugin", "qxcb", "platforms", ["Core", "Gui", "XcbQpaPrivate"]) @@ -1040,10 +1106,10 @@ def _create_plugin(pluginname, libname, type, requires): _create_plugin("QIcoPlugin", "qico", "imageformats", ["Gui"]) if self.options.get_safe("with_libjpeg"): jpeg_reqs = ["Gui"] - if self.options.with_libjpeg == "libjpeg-turbo": - jpeg_reqs.append("libjpeg-turbo::libjpeg-turbo") - if self.options.with_libjpeg == "libjpeg": - jpeg_reqs.append("libjpeg::libjpeg") + if self.options.with_libjpeg == "libjpeg-turbo": + jpeg_reqs.append("libjpeg-turbo::libjpeg-turbo") + if self.options.with_libjpeg == "libjpeg": + jpeg_reqs.append("libjpeg::libjpeg") _create_plugin("QJpegPlugin", "qjpeg", "imageformats", jpeg_reqs) if self.options.with_sqlite3: @@ -1065,17 +1131,13 @@ def _create_plugin(pluginname, libname, type, requires): _create_module("Test") if self.options.widgets: _create_module("Widgets", ["Gui"]) - build_modules.append(self._cmake_qt6_private_file("Widgets")) - self.cpp_info.components["qtWidgets"].build_modules["cmake_find_package"].append(self._cmake_qt6_private_file("Widgets")) - self.cpp_info.components["qtWidgets"].build_modules["cmake_find_package_multi"].append(self._cmake_qt6_private_file("Widgets")) + _add_build_module("qtWidgets", self._cmake_qt6_private_file("Widgets")) if self.options.gui and self.options.widgets: _create_module("PrintSupport", ["Gui", "Widgets"]) if self.options.get_safe("opengl", "no") != "no" and self.options.gui: _create_module("OpenGL", ["Gui"]) if self.options.widgets and self.options.get_safe("opengl", "no") != "no": _create_module("OpenGLWidgets", ["OpenGL", "Widgets"]) - if self.options.with_dbus: - _create_module("DBus", ["dbus::dbus"]) _create_module("Concurrent") _create_module("Xml") @@ -1083,13 +1145,11 @@ def _create_plugin(pluginname, libname, type, requires): _create_module("Core5Compat") # since https://github.com/qt/qtdeclarative/commit/4fb84137f1c0a49d64b8bef66fef8a4384cc2a68 - qt_quick_enabled = self.options.gui and (tools.Version(self.version) < "6.2.0" or self.options.qtshadertools) + qt_quick_enabled = self.options.gui and (Version(self.version) < "6.2.0" or self.options.qtshadertools) if self.options.qtdeclarative: _create_module("Qml", ["Network"]) - build_modules.append(self._cmake_qt6_private_file("Qml")) - self.cpp_info.components["qtQml"].build_modules["cmake_find_package"].append(self._cmake_qt6_private_file("Qml")) - self.cpp_info.components["qtQml"].build_modules["cmake_find_package_multi"].append(self._cmake_qt6_private_file("Qml")) + _add_build_module("qtQml", self._cmake_qt6_private_file("Qml")) _create_module("QmlModels", ["Qml"]) self.cpp_info.components["qtQmlImportScanner"].set_property("cmake_target_name", "Qt6::QmlImportScanner") self.cpp_info.components["qtQmlImportScanner"].names["cmake_find_package"] = "QmlImportScanner" # this is an alias for Qml and there to integrate with existing consumers @@ -1113,6 +1173,9 @@ def _create_plugin(pluginname, libname, type, requires): _create_module("Designer", ["Gui", "UiPlugin", "Widgets", "Xml"]) _create_module("Help", ["Gui", "Sql", "Widgets"]) + if self.options.qtshadertools and self.options.gui: + _create_module("ShaderTools", ["Gui"]) + if self.options.qtquick3d and qt_quick_enabled: _create_module("Quick3DUtils", ["Gui"]) _create_module("Quick3DAssetImport", ["Gui", "Qml", "Quick3DUtils"]) @@ -1120,13 +1183,10 @@ def _create_plugin(pluginname, libname, type, requires): _create_module("Quick3D", ["Gui", "Qml", "Quick", "Quick3DRuntimeRender"]) if (self.options.get_safe("qtquickcontrols2") or \ - (self.options.qtdeclarative and tools.Version(self.version) >= "6.2.0")) and qt_quick_enabled: + (self.options.qtdeclarative and Version(self.version) >= "6.2.0")) and qt_quick_enabled: _create_module("QuickControls2", ["Gui", "Quick"]) _create_module("QuickTemplates2", ["Gui", "Quick"]) - if self.options.qtshadertools and self.options.gui: - _create_module("ShaderTools", ["Gui"]) - if self.options.qtsvg and self.options.gui: _create_module("Svg", ["Gui"]) if self.options.widgets: @@ -1228,8 +1288,7 @@ def _create_plugin(pluginname, libname, type, requires): _create_plugin("AVFServicePlugin", "qavfcamera", "mediaservice", []) _create_plugin("CoreAudioPlugin", "qtaudio_coreaudio", "audio", []) - if (self.options.get_safe("qtlocation") and tools.Version(self.version) < "6.2.2") or \ - (self.options.get_safe("qtpositioning") and tools.Version(self.version) >= "6.2.2"): + if self._has_positioning: _create_module("Positioning") _create_plugin("QGeoPositionInfoSourceFactoryGeoclue2", "qtposition_geoclue2", "position", []) _create_plugin("QGeoPositionInfoSourceFactoryPoll", "qtposition_positionpoll", "position", []) @@ -1265,7 +1324,9 @@ def _create_plugin(pluginname, libname, type, requires): _create_module("WebChannel", ["Qml"]) if self.options.get_safe("qtwebengine") and qt_quick_enabled: - webenginereqs = ["Gui", "Quick", "WebChannel", "Positioning"] + webenginereqs = ["Gui", "Quick", "WebChannel"] + if self._has_positioning: + webenginereqs.append("Positioning") if self.settings.os == "Linux": webenginereqs.extend(["expat::expat", "opus::libopus", "xorg-proto::xorg-proto", "libxshmfence::libxshmfence", \ "nss::nss", "libdrm::libdrm"]) @@ -1332,16 +1393,10 @@ def _create_plugin(pluginname, libname, type, requires): self.cpp_info.components["qtPrintSupport"].system_libs.append("cups") self.cpp_info.components["qtCore"].builddirs.append(os.path.join("res","archdatadir","bin")) - build_modules.append(self._cmake_executables_file) - self.cpp_info.components["qtCore"].build_modules["cmake_find_package"].append(self._cmake_executables_file) - self.cpp_info.components["qtCore"].build_modules["cmake_find_package_multi"].append(self._cmake_executables_file) - build_modules.append(self._cmake_qt6_private_file("Core")) - self.cpp_info.components["qtCore"].build_modules["cmake_find_package"].append(self._cmake_qt6_private_file("Core")) - self.cpp_info.components["qtCore"].build_modules["cmake_find_package_multi"].append(self._cmake_qt6_private_file("Core")) + _add_build_module("qtCore", self._cmake_executables_file) + _add_build_module("qtCore", self._cmake_qt6_private_file("Core")) if self.settings.os in ["Windows", "iOS"]: - build_modules.append(self._cmake_entry_point_file) - self.cpp_info.components["qtCore"].build_modules["cmake_find_package"].append(self._cmake_entry_point_file) - self.cpp_info.components["qtCore"].build_modules["cmake_find_package_multi"].append(self._cmake_entry_point_file) + _add_build_module("qtCore", self._cmake_entry_point_file) for m in os.listdir(os.path.join("lib", "cmake")): module = os.path.join("lib", "cmake", m, "%sMacros.cmake" % m) @@ -1349,14 +1404,10 @@ def _create_plugin(pluginname, libname, type, requires): if component_name == "qt": component_name = "qtCore" if os.path.isfile(module): - build_modules.append(module) - self.cpp_info.components[component_name].build_modules["cmake_find_package"].append(module) - self.cpp_info.components[component_name].build_modules["cmake_find_package_multi"].append(module) + _add_build_module(component_name, module) - helper_modules = glob.glob(os.path.join(self.package_folder, "lib", "cmake", m, "QtPublic*Helpers.cmake")) - build_modules.extend(helper_modules) - self.cpp_info.components[component_name].build_modules["cmake_find_package"].extend(helper_modules) - self.cpp_info.components[component_name].build_modules["cmake_find_package_multi"].extend(helper_modules) + for helper_modules in glob.glob(os.path.join(self.package_folder, "lib", "cmake", m, "QtPublic*Helpers.cmake")): + _add_build_module(component_name, helper_modules) self.cpp_info.components[component_name].builddirs.append(os.path.join("lib", "cmake", m)) objects_dirs = glob.glob(os.path.join(self.package_folder, "lib", "objects-*/")) @@ -1372,4 +1423,16 @@ def _create_plugin(pluginname, libname, type, requires): self.cpp_info.components[component].exelinkflags.extend(obj_files) self.cpp_info.components[component].sharedlinkflags.extend(obj_files) - self.cpp_info.set_property("cmake_build_modules", build_modules) + build_modules_list = [] + + def _add_build_modules_for_component(component): + for req in self.cpp_info.components[component].requires: + if "::" in req: # not a qt component + continue + _add_build_modules_for_component(req) + build_modules_list.extend(build_modules.pop(component, [])) + + for c in self.cpp_info.components: + _add_build_modules_for_component(c) + + self.cpp_info.set_property("cmake_build_modules", build_modules_list) diff --git a/recipes/qt/6.x.x/patches/311d29d.patch b/recipes/qt/6.x.x/patches/311d29d.patch new file mode 100644 index 00000000000000..600bcca81e2653 --- /dev/null +++ b/recipes/qt/6.x.x/patches/311d29d.patch @@ -0,0 +1,30 @@ +From bb01fe6bdf2e52939698de928a1fbeaf3cce4259 Mon Sep 17 00:00:00 2001 +From: Ilya Fedin +Date: Tue, 12 Apr 2022 14:02:36 +0400 +Subject: [PATCH] Fix build on CentOS 7 + +This little change fixes the build on CentOS 7 + +Pick-to: 6.3 +Change-Id: Ic9717147c10ca78e36d6311944de417c6420211d +Reviewed-by: Thiago Macieira +--- + src/corelib/plugin/qelfparser_p.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/corelib/plugin/qelfparser_p.cpp b/src/corelib/plugin/qelfparser_p.cpp +index c6ccda92fb..def1e2494a 100644 +--- a/src/corelib/plugin/qelfparser_p.cpp ++++ b/src/corelib/plugin/qelfparser_p.cpp +@@ -409,7 +409,9 @@ Q_DECL_UNUSED Q_DECL_COLD_FUNCTION static QDebug &operator<<(QDebug &d, ElfHeade + case EM_NONE: d << ", no machine"; break; + case EM_ARM: d << ", ARM"; break; + case EM_AARCH64: d << ", AArch64"; break; ++#ifdef EM_BLACKFIN + case EM_BLACKFIN: d << ", Blackfin"; break; ++#endif + case EM_IA_64: d << ", IA-64"; break; + case EM_MIPS: d << ", MIPS"; break; + case EM_PPC: d << ", PowerPC"; break; +-- +2.34.1 diff --git a/recipes/qt/6.x.x/patches/3801bba82.patch b/recipes/qt/6.x.x/patches/3801bba82.patch new file mode 100644 index 00000000000000..79b347ce90a23b --- /dev/null +++ b/recipes/qt/6.x.x/patches/3801bba82.patch @@ -0,0 +1,27 @@ +From 3801bba822bf88c202a348d3e01dd493c0ca0551 Mon Sep 17 00:00:00 2001 +From: Nadim Asaduzzaman +Date: Fri, 18 Nov 2022 04:34:38 -0700 +Subject: [PATCH] skia: fix compilation with MSVC2022 + +compilation with MSVC2022 failed due to missing string definition within std namespace + +Fixes: QTBUG-108532 +Change-Id: I2119952d5809895e2511ce1c2c262022af3ba191 +Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/444132 +Reviewed-by: Allan Sandfeld Jensen +--- + chromium/third_party/skia/src/core/SkShaderCodeDictionary.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/chromium/third_party/skia/src/core/SkShaderCodeDictionary.h b/chromium/third_party/skia/src/core/SkShaderCodeDictionary.h +index 3a54bbe22e7..8612a469862 100644 +--- a/chromium/third_party/skia/src/core/SkShaderCodeDictionary.h ++++ b/chromium/third_party/skia/src/core/SkShaderCodeDictionary.h +@@ -9,6 +9,7 @@ + #define SkShaderCodeDictionary_DEFINED + + #include ++#include + #include + #include + #include "include/core/SkSpan.h" diff --git a/recipes/qt/6.x.x/patches/CVE-2022-1096-qtwebengine-6.3.diff b/recipes/qt/6.x.x/patches/CVE-2022-1096-qtwebengine-6.3.diff deleted file mode 100644 index e4ce50e78ddee6..00000000000000 --- a/recipes/qt/6.x.x/patches/CVE-2022-1096-qtwebengine-6.3.diff +++ /dev/null @@ -1,27 +0,0 @@ ---- a/src/3rdparty/chromium/v8/src/objects/objects.cc -+++ b/src/3rdparty/chromium/v8/src/objects/objects.cc -@@ -2491,6 +2491,12 @@ Maybe Object::SetPropertyInternal(LookupIterator* it, - Maybe result = - JSObject::SetPropertyWithInterceptor(it, should_throw, value); - if (result.IsNothing() || result.FromJust()) return result; -+ // Assuming that the callback have side effects, we use -+ // Object::SetSuperProperty() which works properly regardless on -+ // whether the property was present on the receiver or not when -+ // storing to the receiver. -+ // Proceed lookup from the next state. -+ it->Next(); - } else { - Maybe maybe_attributes = - JSObject::GetPropertyAttributesWithInterceptor(it); -@@ -2511,10 +2517,8 @@ Maybe Object::SetPropertyInternal(LookupIterator* it, - // property to the receiver. - it->NotFound(); - } -- return Object::SetSuperProperty(it, value, store_origin, -- should_throw); - } -- break; -+ return Object::SetSuperProperty(it, value, store_origin, should_throw); - } - - case LookupIterator::ACCESSOR: { diff --git a/recipes/qt/6.x.x/patches/d13958d.diff b/recipes/qt/6.x.x/patches/d13958d.diff new file mode 100644 index 00000000000000..1da1b661fd7339 --- /dev/null +++ b/recipes/qt/6.x.x/patches/d13958d.diff @@ -0,0 +1,26 @@ +From d13958dabb9f5542d772c6312cd33e4960bf1137 Mon Sep 17 00:00:00 2001 +From: Eric Lemanissier +Date: Tue, 29 Nov 2022 09:15:58 +0000 +Subject: [PATCH] fix pcre2 detection + +Pick-to: 6.3 +Change-Id: I89f167e11bf1c72c9fae474ddd12380636ac5df8 +--- + +diff --git a/cmake/FindWrapSystemPCRE2.cmake b/cmake/FindWrapSystemPCRE2.cmake +index f8516d3..3ac04b8 100644 +--- a/cmake/FindWrapSystemPCRE2.cmake ++++ b/cmake/FindWrapSystemPCRE2.cmake +@@ -6,11 +6,7 @@ + + find_package(PCRE2 ${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION} COMPONENTS 16BIT QUIET) + +-# TODO: pcre2-16 is not the target name provided by the upstream Config file. It is PCRE2::16BIT. +-# https://github.com/PCRE2Project/pcre2/blob/2410fbe3869cab403f02b94caa9ab37ee9f5854b/cmake/pcre2-config.cmake.in#L122 +-# We don't strictly need to handle that though, because the pkg-config code path below still +-# finds the correct libraries. +-set(__pcre2_target_name "PCRE2::pcre2-16") ++set(__pcre2_target_name "PCRE2::16BIT") + if(PCRE2_FOUND AND TARGET "${__pcre2_target_name}") + # Hunter case. + set(__pcre2_found TRUE) diff --git a/recipes/qt/6.x.x/patches/d13958d_.diff b/recipes/qt/6.x.x/patches/d13958d_.diff new file mode 100644 index 00000000000000..2e9d40bd0efc08 --- /dev/null +++ b/recipes/qt/6.x.x/patches/d13958d_.diff @@ -0,0 +1,23 @@ +From d13958dabb9f5542d772c6312cd33e4960bf1137 Mon Sep 17 00:00:00 2001 +From: Eric Lemanissier +Date: Tue, 29 Nov 2022 09:15:58 +0000 +Subject: [PATCH] fix pcre2 detection + +Pick-to: 6.3 +Change-Id: I89f167e11bf1c72c9fae474ddd12380636ac5df8 +--- + +diff --git a/cmake/FindWrapSystemPCRE2.cmake b/cmake/FindWrapSystemPCRE2.cmake +index f8516d3..3ac04b8 100644 +--- a/cmake/FindWrapSystemPCRE2.cmake ++++ b/cmake/FindWrapSystemPCRE2.cmake +@@ -6,7 +6,7 @@ + +-find_package(PCRE2 ${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION} CONFIG QUIET) ++find_package(PCRE2 ${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION} COMPONENTS 16BIT QUIET) + +-set(__pcre2_target_name "PCRE2::pcre2-16") ++set(__pcre2_target_name "PCRE2::16BIT") + if(PCRE2_FOUND AND TARGET "${__pcre2_target_name}") + # Hunter case. + set(__pcre2_found TRUE) diff --git a/recipes/qt/6.x.x/qtmodules6.3.1.conf b/recipes/qt/6.x.x/qtmodules6.3.2.conf similarity index 91% rename from recipes/qt/6.x.x/qtmodules6.3.1.conf rename to recipes/qt/6.x.x/qtmodules6.3.2.conf index 3d9bda713b80fb..b0e0878e68e97d 100644 --- a/recipes/qt/6.x.x/qtmodules6.3.1.conf +++ b/recipes/qt/6.x.x/qtmodules6.3.2.conf @@ -1,40 +1,40 @@ [submodule "qtbase"] path = qtbase url = ../qtbase.git - branch = 6.3.1 + branch = 6.3.2 status = essential [submodule "qtsvg"] depends = qtbase path = qtsvg url = ../qtsvg.git - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qtdeclarative"] depends = qtbase recommends = qtimageformats qtshadertools qtsvg qtlanguageserver path = qtdeclarative url = ../qtdeclarative.git - branch = 6.3.1 + branch = 6.3.2 status = essential [submodule "qtactiveqt"] depends = qtbase path = qtactiveqt url = ../qtactiveqt.git - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qtmultimedia"] depends = qtbase qtshadertools recommends = qtdeclarative path = qtmultimedia url = ../qtmultimedia.git - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qttools"] depends = qtbase recommends = qtdeclarative qtactiveqt path = qttools url = ../qttools.git - branch = 6.3.1 + branch = 6.3.2 status = essential [submodule "qtxmlpatterns"] depends = qtbase @@ -47,7 +47,7 @@ depends = qttools path = qttranslations url = ../qttranslations.git - branch = 6.3.1 + branch = 6.3.2 status = essential priority = 30 [submodule "qtdoc"] @@ -55,7 +55,7 @@ recommends = qtmultimedia path = qtdoc url = ../qtdoc.git - branch = 6.3.1 + branch = 6.3.2 status = essential priority = 40 [submodule "qtrepotools"] @@ -83,14 +83,14 @@ recommends = qtdeclarative qtserialport path = qtpositioning url = ../qtpositioning.git - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qtsensors"] depends = qtbase recommends = qtdeclarative path = qtsensors url = ../qtsensors.git - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qtsystems"] depends = qtbase @@ -117,61 +117,61 @@ recommends = qtdeclarative path = qtconnectivity url = ../qtconnectivity.git - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qtwayland"] depends = qtbase recommends = qtdeclarative path = qtwayland url = ../qtwayland.git - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qt3d"] depends = qtbase recommends = qtdeclarative qtshadertools path = qt3d url = ../qt3d.git - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qtimageformats"] depends = qtbase path = qtimageformats url = ../qtimageformats.git - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qtserialbus"] depends = qtbase recommends = qtserialport path = qtserialbus url = ../qtserialbus.git - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qtserialport"] depends = qtbase path = qtserialport url = ../qtserialport.git - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qtwebsockets"] depends = qtbase recommends = qtdeclarative path = qtwebsockets url = ../qtwebsockets.git - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qtwebchannel"] depends = qtbase recommends = qtdeclarative qtwebsockets path = qtwebchannel url = ../qtwebchannel.git - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qtwebengine"] depends = qtdeclarative recommends = qtwebchannel qttools qtpositioning path = qtwebengine url = ../qtwebengine.git - branch = 6.3.1 + branch = 6.3.2 status = addon priority = 10 [submodule "qtcanvas3d"] @@ -185,28 +185,28 @@ recommends = qtwebengine path = qtwebview url = ../qtwebview.git - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qtcharts"] depends = qtbase recommends = qtdeclarative qtmultimedia path = qtcharts url = ../qtcharts.git - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qtdatavis3d"] depends = qtbase recommends = qtdeclarative qtmultimedia path = qtdatavis3d url = ../qtdatavis3d.git - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qtvirtualkeyboard"] depends = qtbase qtdeclarative qtsvg recommends = qtmultimedia path = qtvirtualkeyboard url = ../qtvirtualkeyboard.git - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qtgamepad"] depends = qtbase @@ -219,27 +219,27 @@ depends = qtbase qtdeclarative path = qtscxml url = ../qtscxml.git - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qtspeech"] depends = qtbase recommends = qtdeclarative qtmultimedia path = qtspeech url = ../qtspeech.git - branch = 6.3 + branch = 6.3.2 status = ignore [submodule "qtnetworkauth"] depends = qtbase path = qtnetworkauth url = ../qtnetworkauth.git - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qtremoteobjects"] depends = qtbase recommends = qtdeclarative path = qtremoteobjects url = ../qtremoteobjects.git - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qtwebglplugin"] depends = qtbase qtwebsockets @@ -252,54 +252,54 @@ depends = qtbase qtdeclarative path = qtlottie url = ../qtlottie.git - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qtquicktimeline"] depends = qtbase qtdeclarative path = qtquicktimeline url = ../qtquicktimeline - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qtquick3d"] depends = qtbase qtdeclarative qtshadertools recommends = qtquicktimeline path = qtquick3d url = ../qtquick3d.git - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qtshadertools"] depends = qtbase path = qtshadertools url = ../qtshadertools.git - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qt5compat"] depends = qtbase qtdeclarative path = qt5compat url = ../qt5compat.git - branch = 6.3.1 + branch = 6.3.2 status = deprecated [submodule "qtcoap"] depends = qtbase path = qtcoap url = ../qtcoap.git - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qtmqtt"] depends = qtbase qtdeclarative path = qtmqtt url = ../qtmqtt.git - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qtopcua"] depends = qtbase qtdeclarative path = qtopcua url = ../qtopcua.git - branch = 6.3.1 + branch = 6.3.2 status = addon [submodule "qtlanguageserver"] depends = qtbase path = qtlanguageserver url = ../qtlanguageserver.git - branch = 6.3.1 + branch = 6.3.2 status = preview diff --git a/recipes/qt/6.x.x/qtmodules6.3.0.conf b/recipes/qt/6.x.x/qtmodules6.4.1.conf similarity index 85% rename from recipes/qt/6.x.x/qtmodules6.3.0.conf rename to recipes/qt/6.x.x/qtmodules6.4.1.conf index 1811e0a68249b7..0ab0c4ef102771 100644 --- a/recipes/qt/6.x.x/qtmodules6.3.0.conf +++ b/recipes/qt/6.x.x/qtmodules6.4.1.conf @@ -1,53 +1,53 @@ [submodule "qtbase"] path = qtbase url = ../qtbase.git - branch = 6.3.0 + branch = 6.4.1 status = essential [submodule "qtsvg"] depends = qtbase path = qtsvg url = ../qtsvg.git - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qtdeclarative"] depends = qtbase recommends = qtimageformats qtshadertools qtsvg qtlanguageserver path = qtdeclarative url = ../qtdeclarative.git - branch = 6.3.0 + branch = 6.4.1 status = essential [submodule "qtactiveqt"] depends = qtbase path = qtactiveqt url = ../qtactiveqt.git - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qtmultimedia"] depends = qtbase qtshadertools - recommends = qtdeclarative + recommends = qtdeclarative qtquick3d path = qtmultimedia url = ../qtmultimedia.git - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qttools"] depends = qtbase recommends = qtdeclarative qtactiveqt path = qttools url = ../qttools.git - branch = 6.3.0 + branch = 6.4.1 status = essential [submodule "qtxmlpatterns"] depends = qtbase recommends = qtdeclarative path = qtxmlpatterns url = ../qtxmlpatterns.git - branch = 6.3.0 + branch = dev status = ignore [submodule "qttranslations"] depends = qttools path = qttranslations url = ../qttranslations.git - branch = 6.3.0 + branch = 6.4.1 status = essential priority = 30 [submodule "qtdoc"] @@ -55,7 +55,7 @@ recommends = qtmultimedia path = qtdoc url = ../qtdoc.git - branch = 6.3.0 + branch = 6.4.1 status = essential priority = 40 [submodule "qtrepotools"] @@ -76,21 +76,21 @@ recommends = qtdeclarative path = qtlocation url = ../qtlocation.git - branch = 6.3.0 + branch = dev status = ignore [submodule "qtpositioning"] depends = qtbase recommends = qtdeclarative qtserialport path = qtpositioning url = ../qtpositioning.git - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qtsensors"] depends = qtbase recommends = qtdeclarative path = qtsensors url = ../qtsensors.git - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qtsystems"] depends = qtbase @@ -117,189 +117,202 @@ recommends = qtdeclarative path = qtconnectivity url = ../qtconnectivity.git - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qtwayland"] depends = qtbase recommends = qtdeclarative path = qtwayland url = ../qtwayland.git - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qt3d"] depends = qtbase recommends = qtdeclarative qtshadertools path = qt3d url = ../qt3d.git - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qtimageformats"] depends = qtbase path = qtimageformats url = ../qtimageformats.git - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qtserialbus"] depends = qtbase recommends = qtserialport path = qtserialbus url = ../qtserialbus.git - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qtserialport"] depends = qtbase path = qtserialport url = ../qtserialport.git - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qtwebsockets"] depends = qtbase recommends = qtdeclarative path = qtwebsockets url = ../qtwebsockets.git - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qtwebchannel"] depends = qtbase recommends = qtdeclarative qtwebsockets path = qtwebchannel url = ../qtwebchannel.git - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qtwebengine"] depends = qtdeclarative recommends = qtwebchannel qttools qtpositioning path = qtwebengine url = ../qtwebengine.git - branch = 6.3.0 + branch = 6.4.1 status = addon priority = 10 [submodule "qtcanvas3d"] depends = qtdeclarative path = qtcanvas3d url = ../qtcanvas3d.git - branch = 6.3.0 + branch = dev status = ignore [submodule "qtwebview"] depends = qtdeclarative recommends = qtwebengine path = qtwebview url = ../qtwebview.git - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qtcharts"] depends = qtbase recommends = qtdeclarative qtmultimedia path = qtcharts url = ../qtcharts.git - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qtdatavis3d"] depends = qtbase recommends = qtdeclarative qtmultimedia path = qtdatavis3d url = ../qtdatavis3d.git - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qtvirtualkeyboard"] depends = qtbase qtdeclarative qtsvg recommends = qtmultimedia path = qtvirtualkeyboard url = ../qtvirtualkeyboard.git - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qtgamepad"] depends = qtbase recommends = qtdeclarative path = qtgamepad url = ../qtgamepad.git - branch = 6.3.0 + branch = dev status = ignore [submodule "qtscxml"] depends = qtbase qtdeclarative path = qtscxml url = ../qtscxml.git - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qtspeech"] depends = qtbase recommends = qtdeclarative qtmultimedia path = qtspeech url = ../qtspeech.git - branch = 6.3.0 - status = ignore + branch = 6.4.1 + status = addon [submodule "qtnetworkauth"] depends = qtbase path = qtnetworkauth url = ../qtnetworkauth.git - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qtremoteobjects"] depends = qtbase recommends = qtdeclarative path = qtremoteobjects url = ../qtremoteobjects.git - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qtwebglplugin"] depends = qtbase qtwebsockets recommends = qtdeclarative path = qtwebglplugin url = ../qtwebglplugin.git - branch = 6.3.0 + branch = dev status = ignore [submodule "qtlottie"] depends = qtbase qtdeclarative path = qtlottie url = ../qtlottie.git - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qtquicktimeline"] depends = qtbase qtdeclarative path = qtquicktimeline url = ../qtquicktimeline - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qtquick3d"] depends = qtbase qtdeclarative qtshadertools recommends = qtquicktimeline path = qtquick3d url = ../qtquick3d.git - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qtshadertools"] depends = qtbase path = qtshadertools url = ../qtshadertools.git - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qt5compat"] depends = qtbase qtdeclarative path = qt5compat url = ../qt5compat.git - branch = 6.3.0 + branch = 6.4.1 status = deprecated [submodule "qtcoap"] depends = qtbase path = qtcoap url = ../qtcoap.git - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qtmqtt"] depends = qtbase qtdeclarative path = qtmqtt url = ../qtmqtt.git - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qtopcua"] depends = qtbase qtdeclarative path = qtopcua url = ../qtopcua.git - branch = 6.3.0 + branch = 6.4.1 status = addon [submodule "qtlanguageserver"] depends = qtbase path = qtlanguageserver url = ../qtlanguageserver.git - branch = 6.3.0 + branch = 6.4.1 + status = preview +[submodule "qthttpserver"] + depends = qtbase + recommends = qtwebsockets + path = qthttpserver + url = ../qthttpserver.git + branch = 6.4.1 + status = preview +[submodule "qtquick3dphysics"] + depends = qtbase qtdeclarative qtquick3d qtshadertools + path = qtquick3dphysics + url = ../qtquick3dphysics.git + branch = 6.4.1 status = preview diff --git a/recipes/qt/6.x.x/qtmodules6.0.4.conf b/recipes/qt/6.x.x/qtmodules6.4.2.conf similarity index 66% rename from recipes/qt/6.x.x/qtmodules6.0.4.conf rename to recipes/qt/6.x.x/qtmodules6.4.2.conf index 653b6f1fcb95c2..10324ecab234bc 100644 --- a/recipes/qt/6.x.x/qtmodules6.0.4.conf +++ b/recipes/qt/6.x.x/qtmodules6.4.2.conf @@ -1,40 +1,40 @@ [submodule "qtbase"] path = qtbase url = ../qtbase.git - branch = 6.0 + branch = 6.4.2 status = essential [submodule "qtsvg"] depends = qtbase path = qtsvg url = ../qtsvg.git - branch = 6.0 + branch = 6.4.2 status = addon [submodule "qtdeclarative"] depends = qtbase - recommends = qtsvg + recommends = qtimageformats qtshadertools qtsvg qtlanguageserver path = qtdeclarative url = ../qtdeclarative.git - branch = 6.0 + branch = 6.4.2 status = essential [submodule "qtactiveqt"] depends = qtbase path = qtactiveqt url = ../qtactiveqt.git - branch = dev - status = ignore + branch = 6.4.2 + status = addon [submodule "qtmultimedia"] - depends = qtbase - recommends = qtdeclarative + depends = qtbase qtshadertools + recommends = qtdeclarative qtquick3d path = qtmultimedia url = ../qtmultimedia.git - branch = dev - status = ignore + branch = 6.4.2 + status = addon [submodule "qttools"] depends = qtbase recommends = qtdeclarative qtactiveqt path = qttools url = ../qttools.git - branch = 6.0 + branch = 6.4.2 status = essential [submodule "qtxmlpatterns"] depends = qtbase @@ -47,15 +47,15 @@ depends = qttools path = qttranslations url = ../qttranslations.git - branch = 6.0 + branch = 6.4.2 status = essential priority = 30 [submodule "qtdoc"] depends = qtdeclarative qttools - recommends = qtmultimedia qtquickcontrols qtquickcontrols2 + recommends = qtmultimedia path = qtdoc url = ../qtdoc.git - branch = 6.0 + branch = 6.4.2 status = essential priority = 40 [submodule "qtrepotools"] @@ -72,19 +72,26 @@ status = essential priority = 50 [submodule "qtlocation"] - depends = qtbase - recommends = qtdeclarative qtquickcontrols qtquickcontrols2 qtserialport + depends = qtbase qtpositioning + recommends = qtdeclarative path = qtlocation url = ../qtlocation.git branch = dev status = ignore +[submodule "qtpositioning"] + depends = qtbase + recommends = qtdeclarative qtserialport + path = qtpositioning + url = ../qtpositioning.git + branch = 6.4.2 + status = addon [submodule "qtsensors"] depends = qtbase recommends = qtdeclarative path = qtsensors url = ../qtsensors.git - branch = dev - status = ignore + branch = 6.4.2 + status = addon [submodule "qtsystems"] depends = qtbase recommends = qtdeclarative @@ -107,103 +114,65 @@ status = ignore [submodule "qtconnectivity"] depends = qtbase - recommends = qtdeclarative qtandroidextras + recommends = qtdeclarative path = qtconnectivity url = ../qtconnectivity.git - branch = dev - status = ignore + branch = 6.4.2 + status = addon [submodule "qtwayland"] depends = qtbase recommends = qtdeclarative path = qtwayland url = ../qtwayland.git - branch = 6.0 + branch = 6.4.2 status = addon [submodule "qt3d"] depends = qtbase recommends = qtdeclarative qtshadertools path = qt3d url = ../qt3d.git - branch = 6.0 - status = additionalLibrary + branch = 6.4.2 + status = addon [submodule "qtimageformats"] depends = qtbase path = qtimageformats url = ../qtimageformats.git - branch = 6.0 - status = additionalLibrary -[submodule "qtgraphicaleffects"] - depends = qtdeclarative - path = qtgraphicaleffects - url = ../qtgraphicaleffects.git - branch = dev - status = ignore -[submodule "qtquickcontrols"] - depends = qtdeclarative - recommends = qtgraphicaleffects - path = qtquickcontrols - url = ../qtquickcontrols.git - branch = dev - status = ignore + branch = 6.4.2 + status = addon [submodule "qtserialbus"] depends = qtbase recommends = qtserialport path = qtserialbus url = ../qtserialbus.git - branch = dev - status = ignore + branch = 6.4.2 + status = addon [submodule "qtserialport"] depends = qtbase path = qtserialport url = ../qtserialport.git - branch = dev - status = ignore -[submodule "qtx11extras"] - depends = qtbase - path = qtx11extras - url = ../qtx11extras.git - branch = dev - status = ignore -[submodule "qtmacextras"] - depends = qtbase - path = qtmacextras - url = ../qtmacextras.git - branch = dev - status = ignore -[submodule "qtwinextras"] - depends = qtbase - recommends = qtdeclarative qtmultimedia - path = qtwinextras - url = ../qtwinextras.git - branch = dev - status = ignore -[submodule "qtandroidextras"] - depends = qtbase - path = qtandroidextras - url = ../qtandroidextras.git - branch = dev - status = ignore + branch = 6.4.2 + status = addon [submodule "qtwebsockets"] depends = qtbase recommends = qtdeclarative path = qtwebsockets url = ../qtwebsockets.git - branch = dev - status = ignore + branch = 6.4.2 + status = addon [submodule "qtwebchannel"] depends = qtbase recommends = qtdeclarative qtwebsockets path = qtwebchannel url = ../qtwebchannel.git - branch = dev - status = ignore + branch = 6.4.2 + status = addon [submodule "qtwebengine"] depends = qtdeclarative - recommends = qtquickcontrols qtquickcontrols2 qtlocation qtwebchannel qttools + recommends = qtwebchannel qttools qtpositioning path = qtwebengine url = ../qtwebengine.git - branch = dev - status = ignore + branch = 6.4.2 + status = addon priority = 10 [submodule "qtcanvas3d"] depends = qtdeclarative @@ -216,43 +185,29 @@ recommends = qtwebengine path = qtwebview url = ../qtwebview.git - branch = dev - status = ignore -[submodule "qtquickcontrols2"] - depends = qtdeclarative - recommends = qtimageformats qtgraphicaleffects - path = qtquickcontrols2 - url = ../qtquickcontrols2.git - branch = 6.0 - status = essential -[submodule "qtpurchasing"] - depends = qtbase - recommends = qtdeclarative qtandroidextras - path = qtpurchasing - url = ../qtpurchasing.git - branch = dev - status = ignore + branch = 6.4.2 + status = addon [submodule "qtcharts"] depends = qtbase recommends = qtdeclarative qtmultimedia path = qtcharts url = ../qtcharts.git - branch = dev - status = ignore + branch = 6.4.2 + status = addon [submodule "qtdatavis3d"] depends = qtbase recommends = qtdeclarative qtmultimedia path = qtdatavis3d url = ../qtdatavis3d.git - branch = dev - status = ignore + branch = 6.4.2 + status = addon [submodule "qtvirtualkeyboard"] depends = qtbase qtdeclarative qtsvg - recommends = qtmultimedia qtquickcontrols + recommends = qtmultimedia path = qtvirtualkeyboard url = ../qtvirtualkeyboard.git - branch = dev - status = ignore + branch = 6.4.2 + status = addon [submodule "qtgamepad"] depends = qtbase recommends = qtdeclarative @@ -264,28 +219,28 @@ depends = qtbase qtdeclarative path = qtscxml url = ../qtscxml.git - branch = dev - status = ignore + branch = 6.4.2 + status = addon [submodule "qtspeech"] depends = qtbase recommends = qtdeclarative qtmultimedia path = qtspeech url = ../qtspeech.git - branch = dev - status = ignore + branch = 6.4.2 + status = addon [submodule "qtnetworkauth"] depends = qtbase path = qtnetworkauth url = ../qtnetworkauth.git - branch = 6.0 - status = additionalLibrary + branch = 6.4.2 + status = addon [submodule "qtremoteobjects"] depends = qtbase recommends = qtdeclarative path = qtremoteobjects url = ../qtremoteobjects.git - branch = dev - status = ignore + branch = 6.4.2 + status = addon [submodule "qtwebglplugin"] depends = qtbase qtwebsockets recommends = qtdeclarative @@ -297,47 +252,67 @@ depends = qtbase qtdeclarative path = qtlottie url = ../qtlottie.git - branch = dev - status = ignore + branch = 6.4.2 + status = addon [submodule "qtquicktimeline"] depends = qtbase qtdeclarative path = qtquicktimeline url = ../qtquicktimeline - branch = 6.0 + branch = 6.4.2 status = addon [submodule "qtquick3d"] depends = qtbase qtdeclarative qtshadertools + recommends = qtquicktimeline path = qtquick3d url = ../qtquick3d.git - branch = 6.0 + branch = 6.4.2 status = addon [submodule "qtshadertools"] depends = qtbase path = qtshadertools url = ../qtshadertools.git - branch = 6.0 + branch = 6.4.2 status = addon [submodule "qt5compat"] - depends = qtbase + depends = qtbase qtdeclarative path = qt5compat url = ../qt5compat.git - branch = 6.0 + branch = 6.4.2 status = deprecated [submodule "qtcoap"] - depends = qtbase qttools + depends = qtbase path = qtcoap url = ../qtcoap.git - branch = 6.0 - status = additionalLibrary + branch = 6.4.2 + status = addon [submodule "qtmqtt"] - depends = qtbase qtdeclarative qttools + depends = qtbase qtdeclarative path = qtmqtt url = ../qtmqtt.git - branch = 6.0 - status = additionalLibrary + branch = 6.4.2 + status = addon [submodule "qtopcua"] - depends = qtbase qtdeclarative qtquickcontrols2 qttools + depends = qtbase qtdeclarative path = qtopcua url = ../qtopcua.git - branch = 6.0 - status = additionalLibrary + branch = 6.4.2 + status = addon +[submodule "qtlanguageserver"] + depends = qtbase + path = qtlanguageserver + url = ../qtlanguageserver.git + branch = 6.4.2 + status = preview +[submodule "qthttpserver"] + depends = qtbase + recommends = qtwebsockets + path = qthttpserver + url = ../qthttpserver.git + branch = 6.4.2 + status = preview +[submodule "qtquick3dphysics"] + depends = qtbase qtdeclarative qtquick3d qtshadertools + path = qtquick3dphysics + url = ../qtquick3dphysics.git + branch = 6.4.2 + status = preview diff --git a/recipes/qt/6.x.x/test_package/conanfile.py b/recipes/qt/6.x.x/test_package/conanfile.py index 173462e5a7e862..fd00ecad1f71c8 100644 --- a/recipes/qt/6.x.x/test_package/conanfile.py +++ b/recipes/qt/6.x.x/test_package/conanfile.py @@ -3,6 +3,8 @@ from conan import ConanFile from conan.tools.build import cross_building +from conan.tools.files import mkdir, chdir +from conan.tools.microsoft import is_msvc from conans import tools, Meson, RunEnvironment, CMake from conan.errors import ConanException @@ -13,9 +15,9 @@ class TestPackageConan(ConanFile): generators = "qt", "cmake", "cmake_find_package_multi", "cmake_find_package", "pkg_config", "qmake" def build_requirements(self): - self.build_requires("cmake/3.23.2") + self.tool_requires("cmake/3.25.0") if self._meson_supported(): - self.build_requires("meson/0.60.2") + self.tool_requires("meson/0.60.2") def _is_mingw(self): return self.settings.os == "Windows" and self.settings.compiler == "gcc" @@ -23,23 +25,20 @@ def _is_mingw(self): def _meson_supported(self): return False and self.options["qt"].shared and\ not cross_building(self) and\ - not tools.os_info.is_macos and\ + not self.settings.os == "Macos" and\ not self._is_mingw() def _qmake_supported(self): - return self.settings.compiler != "Visual Studio" or self.options["qt"].shared - - def _cmake_multi_supported(self): - return True + return self.options["qt"].shared def _build_with_qmake(self): if not self._qmake_supported(): return - tools.mkdir("qmake_folder") - with tools.chdir("qmake_folder"): + mkdir(self, "qmake_folder") + with chdir(self, "qmake_folder"): self.output.info("Building with qmake") - with tools.vcvars(self.settings) if self.settings.compiler == "Visual Studio" else tools.no_op(): + with tools.vcvars(self.settings) if is_msvc(self) else tools.no_op(): args = [self.source_folder, "DESTDIR=bin"] def _getenvpath(var): @@ -66,7 +65,7 @@ def _getenvpath(var): self.run("qmake %s" % " ".join(args), run_environment=True) if tools.os_info.is_windows: - if self.settings.compiler == "Visual Studio": + if is_msvc(self): self.run("nmake", run_environment=True) else: self.run("mingw32-make", run_environment=True) @@ -76,7 +75,7 @@ def _getenvpath(var): def _build_with_meson(self): if self._meson_supported(): self.output.info("Building with Meson") - tools.mkdir("meson_folder") + mkdir(self, "meson_folder") with tools.environment_append(RunEnvironment(self).vars): meson = Meson(self) try: @@ -87,8 +86,6 @@ def _build_with_meson(self): meson.build() def _build_with_cmake_find_package_multi(self): - if not self._cmake_multi_supported(): - return self.output.info("Building with cmake_find_package_multi") env_build = RunEnvironment(self) with tools.environment_append(env_build.vars): @@ -109,7 +106,7 @@ def _test_with_qmake(self): return self.output.info("Testing qmake") bin_path = os.path.join("qmake_folder", "bin") - if tools.os_info.is_macos: + if self.settings.os == "Macos": bin_path = os.path.join(bin_path, "test_package.app", "Contents", "MacOS") shutil.copy("qt.conf", bin_path) self.run(os.path.join(bin_path, "test_package"), run_environment=True) @@ -121,8 +118,6 @@ def _test_with_meson(self): self.run(os.path.join("meson_folder", "test_package"), run_environment=True) def _test_with_cmake_find_package_multi(self): - if not self._cmake_multi_supported(): - return self.output.info("Testing CMake_find_package_multi") shutil.copy("qt.conf", "bin") self.run(os.path.join("bin", "test_package"), run_environment=True) diff --git a/recipes/qt/config.yml b/recipes/qt/config.yml index 71933750fc704a..c0a8dca335737b 100644 --- a/recipes/qt/config.yml +++ b/recipes/qt/config.yml @@ -1,15 +1,17 @@ versions: + "6.4.2": + folder: 6.x.x + "6.4.1": + folder: 6.x.x + "6.3.2": + folder: 6.x.x + "6.2.4": + folder: 6.x.x + "5.15.8": + folder: 5.x.x "5.15.7": folder: 5.x.x "5.15.6": folder: 5.x.x "5.15.5": folder: 5.x.x - "6.1.3": - folder: 6.x.x - "6.2.4": - folder: 6.x.x - "6.3.0": - folder: 6.x.x - "6.3.1": - folder: 6.x.x diff --git a/recipes/qtxlsxwriter/all/CMakeLists.txt b/recipes/qtxlsxwriter/all/CMakeLists.txt index 2e87c1aa790e78..ff829c64bd1d97 100644 --- a/recipes/qtxlsxwriter/all/CMakeLists.txt +++ b/recipes/qtxlsxwriter/all/CMakeLists.txt @@ -1,86 +1,39 @@ -cmake_minimum_required(VERSION 3.15) +cmake_minimum_required(VERSION 3.12) +project(qtxlsxwriter LANGUAGES CXX) -project(qtxlsxwriter) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED Core Gui CONFIG) -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -set(QTXLSXWRITER_TARGET_NAME qtxlsxwriter) - -include(conan_qt_executables_variables) -set(CMAKE_AUTOMOC ON) - -file(GLOB QTXLSXWRITER_HEADERS LIST_DIRECTORIES=false source_subfolder/src/xlsx/*.h) -file(GLOB QTXLSXWRITER_SOURCES LIST_DIRECTORIES=false source_subfolder/src/xlsx/*.cpp) - -add_library(${QTXLSXWRITER_TARGET_NAME} - ${QTXLSXWRITER_HEADERS} - ${QTXLSXWRITER_SOURCES} -) - -set(QT_VERSION "${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}") -target_include_directories(${QTXLSXWRITER_TARGET_NAME} - PRIVATE - $ - # qtxlsxwriter uses qt private headers - $ - $ - $ - INTERFACE - $ - $ -) +file(GLOB QTXLSXWRITER_SOURCES ${QTXLSXWRITER_SRC_DIR}/src/xlsx/*.cpp) +file(GLOB QTXLSXWRITER_PRIVATE_HEADERS ${QTXLSXWRITER_SRC_DIR}/src/xlsx/*_p.h) +file(GLOB QTXLSXWRITER_PUBLIC_HEADERS ${QTXLSXWRITER_SRC_DIR}/src/xlsx/*.h) +list(REMOVE_ITEM QTXLSXWRITER_PUBLIC_HEADERS ${QTXLSXWRITER_PRIVATE_HEADERS}) -target_compile_features(${QTXLSXWRITER_TARGET_NAME} - PRIVATE - cxx_range_for +add_library(qtxlsxwriter ${QTXLSXWRITER_SOURCES}) +target_include_directories(qtxlsxwriter + PUBLIC + ${QTXLSXWRITER_SRC_DIR}/src/xlsx> + PRIVATE + # qtxlsxwriter uses qt private headers + ${QT_ROOT}/include/QtCore/${Qt${QT_VERSION_MAJOR}_VERSION} + ${QT_ROOT}/include/QtGui/${Qt${QT_VERSION_MAJOR}_VERSION} + ${QT_ROOT}/include/QtGui/${Qt${QT_VERSION_MAJOR}_VERSION}/QtGui ) - -# TODO: remove when the qt recipe is fixed -# and this package is linked to the target for qt -target_include_directories(${PROJECT_NAME} PRIVATE ${CONAN_INCLUDE_DIRS}) -target_link_directories(${PROJECT_NAME} PRIVATE ${CONAN_LIB_DIRS}) -target_compile_definitions(${PROJECT_NAME} PRIVATE ${CONAN_DEFINES_QTXLSXWRITER}) - -# get the actual library file name of the Qt GUI module (for ex. it can be `Qt5Gui_debug`) -foreach(lib ${CONAN_LIBS}) - string(FIND ${lib} "Qt5Gui" qtgui_found) - if(NOT (qtgui_found EQUAL -1)) - set(qtgui_name ${lib}) - break() - endif() -endforeach() - -# place qt::Gui before qt::Core (important for some toolchains) -# since the current qt recipe provides an incorrect order of libraries -# TODO: link to the target when the qt recipe is fixed -target_link_libraries(${QTXLSXWRITER_TARGET_NAME} - ${qtgui_name} - ${CONAN_LIBS} +target_compile_features(qtxlsxwriter PRIVATE cxx_range_for) +target_link_libraries(qtxlsxwriter PUBLIC Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui) +set_target_properties(qtxlsxwriter PROPERTIES + PUBLIC_HEADER "${QTXLSXWRITER_PUBLIC_HEADERS}" + DEFINE_SYMBOL QT_BUILD_XLSX_LIB + AUTOMOC ON ) - -get_target_property(target_type ${QTXLSXWRITER_TARGET_NAME} TYPE) -if (target_type STREQUAL "STATIC_LIBRARY") - target_compile_definitions(${QTXLSXWRITER_TARGET_NAME} - PUBLIC - QTXLSX_STATIC - ) +if(NOT BUILD_SHARED_LIBS) + target_compile_definitions(qtxlsxwriter PUBLIC QTXLSX_STATIC) endif() -set_target_properties(${QTXLSXWRITER_TARGET_NAME} PROPERTIES - DEFINE_SYMBOL QT_BUILD_XLSX_LIB +include(GNUInstallDirs) +install( + TARGETS qtxlsxwriter + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) - -file(GLOB QTXLSXWRITER_PRIVATE_HEADERS LIST_DIRECTORIES=false source_subfolder/src/xlsx/*_p.h) -set(QTXLSXWRITER_PUBLIC_HEADERS ${QTXLSXWRITER_HEADERS}) -list(REMOVE_ITEM QTXLSXWRITER_PUBLIC_HEADERS ${QTXLSXWRITER_PRIVATE_HEADERS}) -set_property(TARGET ${QTXLSXWRITER_TARGET_NAME} PROPERTY - PUBLIC_HEADER ${QTXLSXWRITER_PUBLIC_HEADERS} -) - -# define installing rules for target files -install(TARGETS ${QTXLSXWRITER_TARGET_NAME} - PUBLIC_HEADER DESTINATION include -) - -set_property(GLOBAL PROPERTY AUTOGEN_SOURCE_GROUP "Generated Files") diff --git a/recipes/qtxlsxwriter/all/conandata.yml b/recipes/qtxlsxwriter/all/conandata.yml index 53f8961b58d934..324be919abbe39 100644 --- a/recipes/qtxlsxwriter/all/conandata.yml +++ b/recipes/qtxlsxwriter/all/conandata.yml @@ -1,10 +1,11 @@ sources: "0.3.0": - - url: "https://github.com/dbzhang800/QtXlsxWriter/archive/v0.3.0.zip" + source: + url: "https://github.com/dbzhang800/QtXlsxWriter/archive/v0.3.0.zip" sha256: "e665317de4f1551936d519781ab8f96b6738926595f3f26ecb6c50db4ff0419e" - - url: "https://raw.githubusercontent.com/dbzhang800/QtXlsxWriter/d013edc9cf39b450f035528114b349a70b1507ba/LICENSE" + license: + url: "https://raw.githubusercontent.com/dbzhang800/QtXlsxWriter/d013edc9cf39b450f035528114b349a70b1507ba/LICENSE" sha256: "b89e97a417a8061f438c437d0485e3e4d135a6c25d976cc457a9a23281ee5f51" patches: "0.3.0": - - base_path: "source_subfolder" - patch_file: "patches/0.3.0/fix-export-macro.patch" + - patch_file: "patches/0.3.0/fix-export-macro.patch" diff --git a/recipes/qtxlsxwriter/all/conanfile.py b/recipes/qtxlsxwriter/all/conanfile.py index 1a5097bcfd4008..a67db1337017f9 100644 --- a/recipes/qtxlsxwriter/all/conanfile.py +++ b/recipes/qtxlsxwriter/all/conanfile.py @@ -1,5 +1,13 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, copy, download, export_conandata_patches, get +from conan.tools.scm import Version import os -from conans import CMake, ConanFile, tools + +required_conan_version = ">=1.53.0" class QtXlsxWriterConan(ConanFile): @@ -8,34 +16,21 @@ class QtXlsxWriterConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/dbzhang800/QtXlsxWriter" description = ".xlsx file reader and writer for Qt5" - topics = ("qtxlsxwriter", "excel", "xlsx", "conan-recipe") + topics = ("excel", "xlsx") - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], - "fPIC": [True, False] + "fPIC": [True, False], } default_options = { "shared": False, - "fPIC": True + "fPIC": True, } - generators = "cmake" - exports_sources = "CMakeLists.txt", "patches/**" - - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["QT_ROOT"] = self.deps_cpp_info["qt"].rootpath.replace("\\", "/") - self._cmake.configure() - return self._cmake + def export_sources(self): + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -43,30 +38,59 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("qt/5.15.2") + self.requires("qt/5.15.7") + + def validate(self): + if not self.dependencies["qt"].options.gui: + raise ConanInvalidConfiguration(f"{self.ref} requires qt gui") + # FIXME: to remove once https://github.com/conan-io/conan/issues/11385 fixed + if hasattr(self, "settings_build") and cross_building(self): + raise ConanInvalidConfiguration(f"{self.ref} recipe does not support cross-compilation yet") + + def build_requirements(self): + if hasattr(self, "settings_build") and cross_building(self): + self.tool_requires("qt/5.15.7") def source(self): - for source in self.conan_data["sources"][self.version]: - url = source["url"] - filename = url.rsplit("/", 1)[-1] - tools.download(url, filename, sha256=source["sha256"]) - tools.unzip(os.path.join(self.source_folder, "v0.3.0.zip"), self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version]["source"], + destination=self.source_folder, strip_root=True) + download(self, **self.conan_data["sources"][self.version]["license"], filename="LICENSE") + + def generate(self): + if hasattr(self, "settings_build") and cross_building(self): + env = VirtualBuildEnv(self) + env.generate() + else: + env = VirtualRunEnv(self) + env.generate(scope="build") + + tc = CMakeToolchain(self) + tc.variables["QTXLSXWRITER_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.variables["QT_VERSION_MAJOR"] = str(Version(self.dependencies["qt"].ref.version).major) + tc.variables["QT_ROOT"] = self.dependencies["qt"].package_folder.replace("\\", "/") + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - self.copy("LICENSE", dst="licenses") def package_info(self): + self.cpp_info.libs = ["qtxlsxwriter"] if not self.options.shared: self.cpp_info.defines = ["QTXLSX_STATIC"] - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.requires = ["qt::qtCore", "qt::qtGui"] diff --git a/recipes/qtxlsxwriter/all/test_package/CMakeLists.txt b/recipes/qtxlsxwriter/all/test_package/CMakeLists.txt index 73ad95d57c2099..e2353a278197b0 100644 --- a/recipes/qtxlsxwriter/all/test_package/CMakeLists.txt +++ b/recipes/qtxlsxwriter/all/test_package/CMakeLists.txt @@ -1,37 +1,10 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_executable(${PROJECT_NAME} example.cpp) - -# workaround to deal with the error: -# "Qt requires a C++11 compiler and yours does not seem to be that." -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) - -# TODO: remove when the qt recipe is fixed -# and the test package is linked to the target -target_include_directories(${PROJECT_NAME} PRIVATE ${CONAN_INCLUDE_DIRS}) -target_link_directories(${PROJECT_NAME} PRIVATE ${CONAN_LIB_DIRS}) -target_compile_definitions(${PROJECT_NAME} PRIVATE ${CONAN_DEFINES_QTXLSXWRITER}) - -# get the actual library file name of the Qt GUI module (for ex. it can be `Qt5Gui_debug`) -foreach(lib ${CONAN_LIBS}) - string(FIND ${lib} "Qt5Gui" qtgui_found) - if(NOT (qtgui_found EQUAL -1)) - set(qtgui_name ${lib}) - break() - endif() -endforeach() - -# place qt::Gui before qt::Core (important for some toolchains) -# since the current qt recipe provides an incorrect order of libraries -# TODO: link to the target when the qt recipe is fixed -target_link_libraries(${PROJECT_NAME} - ${qtgui_name} - ${CONAN_LIBS} -) +find_package(qtxlsxwriter REQUIRED CONFIG) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE qtxlsxwriter::qtxlsxwriter) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) # `fPIC` option must be used because qt was built with `reduce-relocations` target_compile_options(${PROJECT_NAME} PRIVATE -fPIC) diff --git a/recipes/qtxlsxwriter/all/test_package/conanfile.py b/recipes/qtxlsxwriter/all/test_package/conanfile.py index 77d6a0f32925a2..e845ae751a3017 100644 --- a/recipes/qtxlsxwriter/all/test_package/conanfile.py +++ b/recipes/qtxlsxwriter/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 QtXlsxWriterTestConan(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 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/qtxlsxwriter/all/test_package/example.cpp b/recipes/qtxlsxwriter/all/test_package/test_package.cpp similarity index 100% rename from recipes/qtxlsxwriter/all/test_package/example.cpp rename to recipes/qtxlsxwriter/all/test_package/test_package.cpp diff --git a/recipes/qtxlsxwriter/all/test_v1_package/CMakeLists.txt b/recipes/qtxlsxwriter/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/qtxlsxwriter/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/qtxlsxwriter/all/test_v1_package/conanfile.py b/recipes/qtxlsxwriter/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/qtxlsxwriter/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/quill/all/conandata.yml b/recipes/quill/all/conandata.yml index 67985d018cfe1f..2eafed83e3a7f6 100644 --- a/recipes/quill/all/conandata.yml +++ b/recipes/quill/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.6.0": + url: "https://github.com/odygrd/quill/archive/v2.6.0.tar.gz" + sha256: "d72fd5a01bf8d3e59ed93a789a8f103bc31efe0fb3c09182c74036a2e3a8451b" "2.5.1": url: "https://github.com/odygrd/quill/archive/v2.5.1.tar.gz" sha256: "62227595cc2b4c0c42ed35f17ef5b7487d8231aca9e75234a4c0e346cea19928" @@ -23,15 +26,6 @@ sources: "2.0.2": url: "https://github.com/odygrd/quill/archive/v2.0.2.tar.gz" sha256: "d2dc9004886b787f8357e97d2f2d0c74a460259f7f95d65ab49d060fe34a9b5c" - "2.0.1": - url: "https://github.com/odygrd/quill/archive/v2.0.1.tar.gz" - sha256: "39527aca74edd02d9df0bba62211df9f6d53984d4f6cca470734e19c4d8b69fb" "1.7.3": url: "https://github.com/odygrd/quill/archive/v1.7.3.tar.gz" sha256: "3fff0c5ffb19bbde5429369079741f84a6acce3a781b504cec5e677b05461208" - "1.6.3": - url: "https://github.com/odygrd/quill/archive/v1.6.3.tar.gz" - sha256: "886120b084db952aafe651c64f459e69fec481b4e189c14daa8c4108afebcba3" - "1.5.2": - url: "https://github.com/odygrd/quill/archive/v1.5.2.tar.gz" - sha256: "e409fda0bd949e997f63de4d422a8f17ccc9cb0d58f11403bd309c7a93aa0d6b" diff --git a/recipes/quill/all/test_package/CMakeLists.txt b/recipes/quill/all/test_package/CMakeLists.txt index 417fe001a33124..d53c2b924044a5 100644 --- a/recipes/quill/all/test_package/CMakeLists.txt +++ b/recipes/quill/all/test_package/CMakeLists.txt @@ -4,7 +4,7 @@ project(test_package LANGUAGES CXX) find_package(quill REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} quill::quill) +target_link_libraries(${PROJECT_NAME} PRIVATE quill::quill) if(quill_VERSION VERSION_GREATER_EQUAL "2.0.0") target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) else() diff --git a/recipes/quill/config.yml b/recipes/quill/config.yml index dfa317084ea31f..2790b70d22e862 100644 --- a/recipes/quill/config.yml +++ b/recipes/quill/config.yml @@ -1,4 +1,6 @@ versions: + "2.6.0": + folder: "all" "2.5.1": folder: "all" "2.4.2": @@ -15,11 +17,5 @@ versions: folder: "all" "2.0.2": folder: "all" - "2.0.1": - folder: "all" "1.7.3": folder: "all" - "1.6.3": - folder: "all" - "1.5.2": - folder: "all" diff --git a/recipes/qwt/all/conanfile.py b/recipes/qwt/all/conanfile.py index 491142fd39f27e..e2134db89385ff 100644 --- a/recipes/qwt/all/conanfile.py +++ b/recipes/qwt/all/conanfile.py @@ -2,6 +2,7 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.build import cross_building from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir from conan.tools.scm import Version import os @@ -73,12 +74,20 @@ def validate(self): raise ConanInvalidConfiguration("qwt:designer=True requires qt:qttools=True, qt::gui=True and qt::widgets=True") def build_requirements(self): - self.tool_requires("qt/5.15.7") + if hasattr(self, "settings_build") and cross_building(self): + self.tool_requires("qt/5.15.7") def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def generate(self): + if hasattr(self, "settings_build") and cross_building(self): + env = VirtualBuildEnv(self) + env.generate() + else: + env = VirtualRunEnv(self) + env.generate(scope="build") + tc = CMakeToolchain(self) tc.variables["QWT_DLL"] = self.options.shared tc.variables["QWT_STATIC "] = not self.options.shared diff --git a/recipes/qxlsx/all/conandata.yml b/recipes/qxlsx/all/conandata.yml index 7e3a5bc31390d5..68d91ea6c08310 100644 --- a/recipes/qxlsx/all/conandata.yml +++ b/recipes/qxlsx/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.4.5": + url: "https://github.com/QtExcel/QXlsx/archive/refs/tags/v1.4.5.zip" + sha256: "eadcad2718335673f86fe20fd91e822e6c1e3624483be9d79cf79254e5426067" "1.4.4": url: "https://github.com/QtExcel/QXlsx/archive/refs/tags/v1.4.4.zip" sha256: "3efbd6f63a1ffd521c535dce7b5a5a7e9ebd23db51e6ae8e3e2eb89796e57675" @@ -7,5 +10,9 @@ sources: sha256: "d2f7c6aff71f2f30ade8d8020682e36a3d63f422a5d2f1c5831b55573241bd4a" patches: "1.4.3": - - patch_file: "patches/0001-allow-shared.patch" - - patch_file: "patches/0002-add-install-target.patch" + - patch_file: "patches/1.4.3/0001-allow-shared.patch" + patch_type: "conan" + patch_source: "https://github.com/QtExcel/QXlsx/pull/197" + - patch_file: "patches/1.4.3/0002-add-install-target.patch" + patch_type: "conan" + patch_source: "https://github.com/QtExcel/QXlsx/pull/197" diff --git a/recipes/qxlsx/all/conanfile.py b/recipes/qxlsx/all/conanfile.py index 2323a1dec48f6c..2db27dce4134a0 100644 --- a/recipes/qxlsx/all/conanfile.py +++ b/recipes/qxlsx/all/conanfile.py @@ -1,10 +1,11 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class QXlsxConan(ConanFile): @@ -25,9 +26,12 @@ class QXlsxConan(ConanFile): "fPIC": True } + @property + def _qt_version(self): + return Version(self.dependencies["qt"].ref.version).major + def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -35,13 +39,28 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def requirements(self): - self.requires("qt/5.15.5") + self.requires("qt/5.15.7") def layout(self): - cmake_layout(self) + cmake_layout(self, src_folder="src") + + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output=output) + m = re.search(r"cmake version (\d+\.\d+\.\d+)", output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False + + def build_requirements(self): + if Version(self.version) >= "1.4.4" and not self._cmake_new_enough("3.16"): + self.tool_requires("cmake/3.25.0") def source(self): get(self, **self.conan_data["sources"][self.version], @@ -49,10 +68,12 @@ def source(self): def generate(self): tc = CMakeToolchain(self) - tc.variables["QT_VERSION_MAJOR"] = Version(self.deps_cpp_info["qt"].version).major + tc.variables["QT_VERSION_MAJOR"] = self._qt_version tc.generate() tc = CMakeDeps(self) tc.generate() + tc = VirtualBuildEnv(self) + tc.generate(scope="build") def build(self): apply_conandata_patches(self) @@ -63,6 +84,7 @@ def build(self): def package(self): copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) cmake = CMake(self) + cmake.configure(build_script_folder="QXlsx") cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) @@ -70,7 +92,10 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "QXlsx") self.cpp_info.set_property("cmake_target_name", "QXlsx::Core") # TODO: back to global scope in conan v2 once cmake_find_package* generators removed - self.cpp_info.components["qxlsx_core"].libs = ["QXlsx"] + if Version(self.version) <= "1.4.4": + self.cpp_info.components["qxlsx_core"].libs = ["QXlsx"] + else: + self.cpp_info.components["qxlsx_core"].libs = [f"QXlsxQt{self._qt_version}"] self.cpp_info.components["qxlsx_core"].includedirs = [os.path.join("include", "QXlsx")] self.cpp_info.components["qxlsx_core"].requires = ["qt::qtCore", "qt::qtGui"] diff --git a/recipes/qxlsx/all/patches/0001-allow-shared.patch b/recipes/qxlsx/all/patches/1.4.3/0001-allow-shared.patch similarity index 100% rename from recipes/qxlsx/all/patches/0001-allow-shared.patch rename to recipes/qxlsx/all/patches/1.4.3/0001-allow-shared.patch diff --git a/recipes/qxlsx/all/patches/0002-add-install-target.patch b/recipes/qxlsx/all/patches/1.4.3/0002-add-install-target.patch similarity index 100% rename from recipes/qxlsx/all/patches/0002-add-install-target.patch rename to recipes/qxlsx/all/patches/1.4.3/0002-add-install-target.patch diff --git a/recipes/qxlsx/config.yml b/recipes/qxlsx/config.yml index c3a2585d470758..c1105e15407295 100644 --- a/recipes/qxlsx/config.yml +++ b/recipes/qxlsx/config.yml @@ -1,4 +1,6 @@ versions: + "1.4.5": + folder: "all" "1.4.4": folder: "all" "1.4.3": diff --git a/recipes/range-v3/all/conanfile.py b/recipes/range-v3/all/conanfile.py index 7de33c5e7f88d9..4f9a2a5174d9a5 100644 --- a/recipes/range-v3/all/conanfile.py +++ b/recipes/range-v3/all/conanfile.py @@ -1,5 +1,6 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import is_msvc from conan.tools.scm import Version from conan.tools.layout import basic_layout from conan.tools.files import get, copy @@ -24,13 +25,14 @@ class Rangev3Conan(ConanFile): def _compilers_minimum_version(self): return { "gcc": "5" if Version(self.version) < "0.10.0" else "6.5", - "Visual Studio": "16", + "msvc": "192", + "Visual Studio": "16", # TODO: remove when only Conan2 is supported "clang": "3.6" if Version(self.version) < "0.10.0" else "3.9" } @property def _min_cppstd(self): - if self.settings.compiler == "Visual Studio": + if is_msvc(self): return "17" else: return "14" @@ -47,7 +49,7 @@ def validate(self): minimum_version = self._compilers_minimum_version.get( str(self.settings.compiler), False) if not minimum_version: - self.output.warn( + self.output.warning( f"{self.settings.compiler} {self.settings.compiler.version} support for range-v3 is unknown, assuming it is supported.") elif Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration( @@ -67,7 +69,7 @@ def package(self): def package_info(self): self.cpp_info.components["range-v3-meta"].names["cmake_find_package"] = "meta" self.cpp_info.components["range-v3-meta"].names["cmake_find_package_multi"] = "meta" - if self.settings.compiler == "Visual Studio": + if is_msvc(self): self.cpp_info.components["range-v3-meta"].cxxflags = ["/permissive-"] if "0.9.0" <= Version(self.version) < "0.11.0": diff --git a/recipes/rapidcsv/all/conandata.yml b/recipes/rapidcsv/all/conandata.yml index 1cab273fd5038d..4a94a5cab704f2 100644 --- a/recipes/rapidcsv/all/conandata.yml +++ b/recipes/rapidcsv/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "8.69": + url: "https://github.com/d99kris/rapidcsv/archive/v8.69.tar.gz" + sha256: "b63e58b1d18277f0331e211bbe6740587069fcd3e5b5a5fb63be7d2f17250d54" "8.64": url: "https://github.com/d99kris/rapidcsv/archive/v8.64.tar.gz" sha256: "e2ab5231b6e65f1e168dc279bbba2e34afd43c7bc6e2522726b107bcc4e8ebac" diff --git a/recipes/rapidcsv/all/conanfile.py b/recipes/rapidcsv/all/conanfile.py index cc5590d7435321..a9d964b6536a38 100644 --- a/recipes/rapidcsv/all/conanfile.py +++ b/recipes/rapidcsv/all/conanfile.py @@ -1,28 +1,47 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.33.0" - +required_conan_version = ">=1.52.0" class RapidcsvConan(ConanFile): name = "rapidcsv" description = "C++ CSV parser library" - topics = ("csv", "parser") + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/d99kris/rapidcsv" - license = "BSD-3-Clause" + topics = ("csv", "parser", "header-only") + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="rapidcsv.h", dst="include", src=os.path.join(self._source_subfolder, "src")) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "src"), + ) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/rapidcsv/all/test_package/CMakeLists.txt b/recipes/rapidcsv/all/test_package/CMakeLists.txt index d9d85dd378817c..30d340fa95be76 100644 --- a/recipes/rapidcsv/all/test_package/CMakeLists.txt +++ b/recipes/rapidcsv/all/test_package/CMakeLists.txt @@ -1,13 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(rapidcsv REQUIRED) +find_package(rapidcsv REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE rapidcsv::rapidcsv) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/rapidcsv/all/test_package/conanfile.py b/recipes/rapidcsv/all/test_package/conanfile.py index 49a3a66ea5bad4..e845ae751a3017 100644 --- a/recipes/rapidcsv/all/test_package/conanfile.py +++ b/recipes/rapidcsv/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/rapidcsv/all/test_v1_package/CMakeLists.txt b/recipes/rapidcsv/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/rapidcsv/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/rapidcsv/all/test_v1_package/conanfile.py b/recipes/rapidcsv/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/rapidcsv/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/rapidcsv/config.yml b/recipes/rapidcsv/config.yml index 4ce50b4cd62f58..fa4a806018292a 100644 --- a/recipes/rapidcsv/config.yml +++ b/recipes/rapidcsv/config.yml @@ -1,4 +1,6 @@ versions: + "8.69": + folder: "all" "8.64": folder: "all" "8.62": diff --git a/recipes/rapidyaml/all/conandata.yml b/recipes/rapidyaml/all/conandata.yml index 28db57dc0078f6..dd5074af2a9b9f 100644 --- a/recipes/rapidyaml/all/conandata.yml +++ b/recipes/rapidyaml/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.5.0": + url: "https://github.com/biojppm/rapidyaml/releases/download/v0.5.0/rapidyaml-0.5.0-src.tgz" + sha256: "6493557778791a3a2375510ce6c0ecd70163fc8ce4f8ed683acc36e3e55ee881" "0.4.1": url: "https://github.com/biojppm/rapidyaml/releases/download/v0.4.1/rapidyaml-0.4.1-src.tgz" sha256: "3c0a671a7a5aab972f7d259736d14beb9f428c4441f0c220dc0717a4946b495c" @@ -9,6 +12,10 @@ sources: url: "https://github.com/biojppm/rapidyaml/releases/download/v0.3.0/rapidyaml-0.3.0-src.tgz" sha256: "38854b8359eaf42cc27352f4b7321f509f6775445a3e2746cc8cd1e468a52aa9" patches: + "0.5.0": + - patch_file: "patches/0.5.0-001-remove-internal-c4core.patch" + patch_description: "disable using internal c4core" + patch_type: "conan" "0.4.1": - patch_file: "patches/0.4.1-001-remove-internal-c4core.patch" patch_description: "disable using internal c4core" diff --git a/recipes/rapidyaml/all/conanfile.py b/recipes/rapidyaml/all/conanfile.py index fbdfd5da9b5b70..9b33134d2e034e 100644 --- a/recipes/rapidyaml/all/conanfile.py +++ b/recipes/rapidyaml/all/conanfile.py @@ -6,7 +6,7 @@ from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class RapidYAMLConan(ConanFile): name = "rapidyaml" @@ -44,16 +44,13 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("c4core/0.1.10") + self.requires("c4core/0.1.11") def validate(self): if self.info.settings.compiler.cppstd: diff --git a/recipes/rapidyaml/all/patches/0.5.0-001-remove-internal-c4core.patch b/recipes/rapidyaml/all/patches/0.5.0-001-remove-internal-c4core.patch new file mode 100644 index 00000000000000..b9735434a58e10 --- /dev/null +++ b/recipes/rapidyaml/all/patches/0.5.0-001-remove-internal-c4core.patch @@ -0,0 +1,43 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 11c52e0..e79d144 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,7 +6,7 @@ project(ryml + LANGUAGES CXX) + include(./compat.cmake) + +-c4_project(VERSION 0.5.0 STANDALONE ++c4_project(VERSION 0.5.0 + AUTHOR "Joao Paulo Magalhaes ") + + +@@ -21,8 +21,7 @@ option(RYML_DBG "Enable (very verbose) ryml debug prints." OFF) + + #------------------------------------------------------- + +-c4_require_subproject(c4core INCORPORATE +- SUBDIRECTORY ${RYML_EXT_DIR}/c4core) ++find_package(c4core REQUIRED CONFIG) + + c4_add_library(ryml + SOURCES +@@ -56,9 +55,8 @@ c4_add_library(ryml + INC_DIRS + $ + $ +- LIBS c4core +- INCORPORATE c4core +- ) ++ LIBS c4core::c4core ++) + + if(RYML_WITH_TAB_TOKENS) + target_compile_definitions(ryml PUBLIC RYML_WITH_TAB_TOKENS) +@@ -76,7 +74,6 @@ endif() + #------------------------------------------------------- + + c4_install_target(ryml) +-c4_install_exports(DEPENDENCIES c4core) + c4_pack_project() + + diff --git a/recipes/rapidyaml/all/test_v1_package/CMakeLists.txt b/recipes/rapidyaml/all/test_v1_package/CMakeLists.txt index 2cbec639fb36cd..bc541ea90b5128 100644 --- a/recipes/rapidyaml/all/test_v1_package/CMakeLists.txt +++ b/recipes/rapidyaml/all/test_v1_package/CMakeLists.txt @@ -1,15 +1,9 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(ryml REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE ryml::ryml) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) -if(ryml_VERSION VERSION_GREATER_EQUAL "0.4.0") - target_compile_definitions(${PROJECT_NAME} PRIVATE RYML_USE_PARSE_IN_ARENA) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/rapidyaml/config.yml b/recipes/rapidyaml/config.yml index 0c5f8691c06f8c..a10a27debb1f08 100644 --- a/recipes/rapidyaml/config.yml +++ b/recipes/rapidyaml/config.yml @@ -1,4 +1,6 @@ versions: + "0.5.0": + folder: all "0.4.1": folder: all "0.4.0": diff --git a/recipes/re2/all/conandata.yml b/recipes/re2/all/conandata.yml index 15ba52699710ad..5f09249638cadb 100644 --- a/recipes/re2/all/conandata.yml +++ b/recipes/re2/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "20221201": + url: "https://github.com/google/re2/archive/refs/tags/2022-12-01.tar.gz" + sha256: "665b65b6668156db2b46dddd33405cd422bd611352c5052ab3dae6a5fbac5506" "20220601": url: "https://github.com/google/re2/archive/refs/tags/2022-06-01.tar.gz" sha256: "f89c61410a072e5cbcf8c27e3a778da7d6fd2f2b5b1445cd4f4508bee946ab0f" diff --git a/recipes/re2/all/conanfile.py b/recipes/re2/all/conanfile.py index fa0b9e1fcd233f..a4b44532b5660d 100644 --- a/recipes/re2/all/conanfile.py +++ b/recipes/re2/all/conanfile.py @@ -4,7 +4,7 @@ from conan.tools.files import copy, get, rmdir import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class Re2Conan(ConanFile): @@ -18,11 +18,11 @@ class Re2Conan(ConanFile): settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], - "fPIC": [True, False] + "fPIC": [True, False], } default_options = { "shared": False, - "fPIC": True + "fPIC": True, } def config_options(self): @@ -31,15 +31,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 11) + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") + def validate(self): + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -61,10 +61,12 @@ def package(self): cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "re2") self.cpp_info.set_property("cmake_target_name", "re2::re2") + self.cpp_info.set_property("pkg_config_name", "re2") self.cpp_info.libs = ["re2"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m", "pthread"] diff --git a/recipes/re2/all/test_package/conanfile.py b/recipes/re2/all/test_package/conanfile.py index 3a8c6c5442b33b..0a6bc68712d901 100644 --- a/recipes/re2/all/test_package/conanfile.py +++ b/recipes/re2/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/re2/all/test_v1_package/CMakeLists.txt b/recipes/re2/all/test_v1_package/CMakeLists.txt index 40160fdcc34400..0d20897301b68b 100644 --- a/recipes/re2/all/test_v1_package/CMakeLists.txt +++ b/recipes/re2/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(re2 REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE re2::re2) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/re2/all/test_v1_package/conanfile.py b/recipes/re2/all/test_v1_package/conanfile.py index 75c0cd81d2d2f3..38f4483872d47f 100644 --- a/recipes/re2/all/test_v1_package/conanfile.py +++ b/recipes/re2/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/re2/config.yml b/recipes/re2/config.yml index d4ddea306645eb..2eb4d5ecd73f05 100644 --- a/recipes/re2/config.yml +++ b/recipes/re2/config.yml @@ -1,4 +1,6 @@ versions: + "20221201": + folder: all "20220601": folder: all "20220201": diff --git a/recipes/read-excel/all/conandata.yml b/recipes/read-excel/all/conandata.yml index 60d02b8ef24cb1..e92cf97bbd3871 100644 --- a/recipes/read-excel/all/conandata.yml +++ b/recipes/read-excel/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.2.8": + url: "https://github.com/igormironchik/read-excel/archive/refs/tags/1.2.8.tar.gz" + sha256: "26859a7262500bfb7703197bb2726ea9bca33455f3102eb3e15e4ddfc97c6a07" "1.2.7": url: "https://github.com/igormironchik/read-excel/archive/refs/tags/1.2.7.tar.gz" sha256: "9ed9518e796167c1c121bb20c2d395c8c8ae52cf469613914254d55ca517ab34" diff --git a/recipes/read-excel/all/conanfile.py b/recipes/read-excel/all/conanfile.py index be087afee96b93..11abb986cdd319 100644 --- a/recipes/read-excel/all/conanfile.py +++ b/recipes/read-excel/all/conanfile.py @@ -1,7 +1,12 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -import textwrap + +required_conan_version = ">=1.50.0" class ReadExcelConan(ConanFile): @@ -15,8 +20,8 @@ class ReadExcelConan(ConanFile): no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "14" @property def _compilers_minimum_version(self): @@ -29,28 +34,32 @@ def _compilers_minimum_version(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "14") - - compiler = str(self.settings.compiler) - if compiler not in self._compilers_minimum_version: - self.output.warn("Unknown compiler, assuming it supports at least C++14") - return + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.name} {self.version} requires C++{self._min_cppstd}, which your compiler does not support.", + ) - version = tools.Version(self.settings.compiler.version) - if version < self._compilers_minimum_version[compiler]: - raise ConanInvalidConfiguration("args-parser requires a compiler that supports at least C++14") + def layout(self): + basic_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - self.copy("*.hpp", src=os.path.join(self._source_subfolder, "read-excel"), dst=os.path.join("include", "read-excel")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.hpp", src=os.path.join(self.source_folder, "read-excel"), dst=os.path.join(self.package_folder, "include", "read-excel")) def package_id(self): - self.info.header_only() + self.info.clear() def package_info(self): - self.cpp_info.names["cmake_find_package"] = "read-excel" - self.cpp_info.names["cmake_find_package_multi"] = "read-excel" - self.cpp_info.includedirs.append(os.path.join("include", "read-excel")) + self.cpp_info.set_property("cmake_file_name", "read-excel") + self.cpp_info.set_property("cmake_target_name", "read-excel::read-excel") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/read-excel/all/test_package/CMakeLists.txt b/recipes/read-excel/all/test_package/CMakeLists.txt index d8e08669536009..a5298e30eba450 100644 --- a/recipes/read-excel/all/test_package/CMakeLists.txt +++ b/recipes/read-excel/all/test_package/CMakeLists.txt @@ -1,18 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -project(read-excel.test) +find_package(read-excel REQUIRED CONFIG) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) - -conan_basic_setup(TARGETS) - -find_package(read-excel REQUIRED) - -add_executable(${PROJECT_NAME} example.cpp) - -target_link_libraries(${PROJECT_NAME} read-excel::read-excel) - -set_target_properties(${PROJECT_NAME} PROPERTIES - CXX_STANDARD 14 - CXX_STANDARD_REQUIRED ON -) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE read-excel::read-excel) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/read-excel/all/test_package/conanfile.py b/recipes/read-excel/all/test_package/conanfile.py index 9c4e599a17f728..bddb5e263d5d62 100644 --- a/recipes/read-excel/all/test_package/conanfile.py +++ b/recipes/read-excel/all/test_package/conanfile.py @@ -1,8 +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 ReadExcelTestConan(ConanFile): - generators = "cmake", "cmake_find_package" + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -10,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "read-excel.test") - xls_path = os.path.join(self.source_folder, "sample.xls"); - self.run("{} \"{}\"".format(bin_path, xls_path), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + xls_path = os.path.join(self.source_folder, "sample.xls") + self.run("{} \"{}\"".format(bin_path, xls_path), env="conanrun") diff --git a/recipes/read-excel/all/test_package/example.cpp b/recipes/read-excel/all/test_package/test_package.cpp similarity index 100% rename from recipes/read-excel/all/test_package/example.cpp rename to recipes/read-excel/all/test_package/test_package.cpp diff --git a/recipes/read-excel/all/test_v1_package/CMakeLists.txt b/recipes/read-excel/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..8af52c82738051 --- /dev/null +++ b/recipes/read-excel/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/read-excel/all/test_v1_package/conanfile.py b/recipes/read-excel/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..3524db189d6f0b --- /dev/null +++ b/recipes/read-excel/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + xls_path = os.path.join(self.source_folder, os.pardir, "test_package", "sample.xls") + self.run("{} \"{}\"".format(bin_path, xls_path), run_environment=True) diff --git a/recipes/read-excel/config.yml b/recipes/read-excel/config.yml index 41cc43a4d480b8..e85e4f8b47c322 100644 --- a/recipes/read-excel/config.yml +++ b/recipes/read-excel/config.yml @@ -1,4 +1,6 @@ versions: + "1.2.8": + folder: "all" "1.2.7": folder: "all" "1.2.6": diff --git a/recipes/redis-plus-plus/all/conandata.yml b/recipes/redis-plus-plus/all/conandata.yml index ce8377c9cadd8b..2437f2fe67b154 100644 --- a/recipes/redis-plus-plus/all/conandata.yml +++ b/recipes/redis-plus-plus/all/conandata.yml @@ -1,17 +1,24 @@ sources: + "1.3.7": + url: "https://github.com/sewenew/redis-plus-plus/archive/1.3.7.tar.gz" + sha256: "89cb83b0a23ac5825300c301814eab74aa3cdcfcd12e87d443c2692e367768ba" "1.3.3": - sha256: 23689059b7ba50fcd8fa673c5dbb7bdb010b896b14abad5aa80a5ec48eb64f26 - url: https://github.com/sewenew/redis-plus-plus/archive/1.3.3.tar.gz + url: "https://github.com/sewenew/redis-plus-plus/archive/1.3.3.tar.gz" + sha256: "23689059b7ba50fcd8fa673c5dbb7bdb010b896b14abad5aa80a5ec48eb64f26" "1.3.2": - sha256: e172cd8dcfeaf649e20a2d24537f8676c7cabed5c24182d73be189e53a013289 - url: https://github.com/sewenew/redis-plus-plus/archive/1.3.2.tar.gz + url: "https://github.com/sewenew/redis-plus-plus/archive/1.3.2.tar.gz" + sha256: "e172cd8dcfeaf649e20a2d24537f8676c7cabed5c24182d73be189e53a013289" "1.2.3": - sha256: 1a3336752133019c963e06c28667b96690d6395b804e5e326671777ff88982ea - url: https://github.com/sewenew/redis-plus-plus/archive/1.2.3.tar.gz + url: "https://github.com/sewenew/redis-plus-plus/archive/1.2.3.tar.gz" + sha256: "1a3336752133019c963e06c28667b96690d6395b804e5e326671777ff88982ea" "1.2.1": - sha256: f09c9fcc362955edb887632cd008102887278c94934d7e8c9d0acb8707671902 - url: https://github.com/sewenew/redis-plus-plus/archive/1.2.1.tar.gz + url: "https://github.com/sewenew/redis-plus-plus/archive/1.2.1.tar.gz" + sha256: "f09c9fcc362955edb887632cd008102887278c94934d7e8c9d0acb8707671902" patches: + "1.3.7": + - patch_file: "patches/1.3.7-0001-fix-dependencies-injection.patch" + patch_description: "Robust discovery & injection of dependencies, and handle missing hiredis_ssl-config.cmake" + patch_type: "conan" "1.3.3": - patch_file: "patches/1.3.3-0001-fix-dependencies-injection.patch" patch_description: "Robust discovery & injection of dependencies, and handle missing hiredis_ssl-config.cmake" diff --git a/recipes/redis-plus-plus/all/conanfile.py b/recipes/redis-plus-plus/all/conanfile.py index 0fdfa9ba24d649..b10c66e4f7f94c 100644 --- a/recipes/redis-plus-plus/all/conanfile.py +++ b/recipes/redis-plus-plus/all/conanfile.py @@ -67,7 +67,7 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("hiredis/1.0.2") + self.requires("hiredis/1.1.0") if self.options.get_safe("build_async"): self.requires("libuv/1.44.2") @@ -142,6 +142,7 @@ def package_info(self): self.cpp_info.components["redis++lib"].requires.append("libuv::libuv") if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["redis++lib"].system_libs.append("pthread") + self.cpp_info.components["redis++lib"].system_libs.append("m") # TODO: to remove in conan v2 self.cpp_info.names["cmake_find_package"] = "redis++" diff --git a/recipes/redis-plus-plus/all/patches/1.3.7-0001-fix-dependencies-injection.patch b/recipes/redis-plus-plus/all/patches/1.3.7-0001-fix-dependencies-injection.patch new file mode 100644 index 00000000000000..19ec65facf381f --- /dev/null +++ b/recipes/redis-plus-plus/all/patches/1.3.7-0001-fix-dependencies-injection.patch @@ -0,0 +1,33 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index 69794d9..fbb75b7 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -34,8 +34,7 @@ if(REDIS_PLUS_PLUS_BUILD_ASYNC) + message(STATUS "redis-plus-plus build async interface with libuv") + + # libuv dependency +- find_path(REDIS_PLUS_PLUS_ASYNC_LIB_HEADER NAMES uv.h) +- find_library(REDIS_PLUS_PLUS_ASYNC_LIB uv) ++ find_package(libuv REQUIRED CONFIG) + else() + message(FATAL_ERROR "invalid REDIS_PLUS_PLUS_BUILD_ASYNC") + endif() +@@ -191,7 +190,7 @@ if(REDIS_PLUS_PLUS_BUILD_STATIC) + + if(REDIS_PLUS_PLUS_BUILD_ASYNC) + target_include_directories(${STATIC_LIB} PUBLIC $) +- target_include_directories(${STATIC_LIB} PUBLIC $) ++ target_link_libraries(${STATIC_LIB} PUBLIC $,uv,uv_a>) + if(REDIS_PLUS_PLUS_ASYNC_FUTURE STREQUAL "boost") + target_include_directories(${STATIC_LIB} SYSTEM PUBLIC $) + endif() +@@ -245,8 +244,7 @@ if(REDIS_PLUS_PLUS_BUILD_SHARED) + + if(REDIS_PLUS_PLUS_BUILD_ASYNC) + target_include_directories(${SHARED_LIB} PUBLIC $) +- target_include_directories(${SHARED_LIB} PUBLIC $) +- target_link_libraries(${SHARED_LIB} PUBLIC ${REDIS_PLUS_PLUS_ASYNC_LIB}) ++ target_link_libraries(${SHARED_LIB} PUBLIC $,uv,uv_a>) + if(REDIS_PLUS_PLUS_ASYNC_FUTURE STREQUAL "boost") + target_include_directories(${SHARED_LIB} SYSTEM PUBLIC $) + endif() diff --git a/recipes/redis-plus-plus/config.yml b/recipes/redis-plus-plus/config.yml index c4181ae02bba7d..923fc0f3c1acbd 100644 --- a/recipes/redis-plus-plus/config.yml +++ b/recipes/redis-plus-plus/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.7": + folder: all "1.3.3": folder: all "1.3.2": diff --git a/recipes/roaring/all/conandata.yml b/recipes/roaring/all/conandata.yml index 62857710d6c8c3..8f0024fd425aab 100644 --- a/recipes/roaring/all/conandata.yml +++ b/recipes/roaring/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.8.1": + url: "https://github.com/RoaringBitmap/CRoaring/archive/v0.8.1.tar.gz" + sha256: "5359f2a051f10e42cea5edc3cb3650fd272e9125e6a0538901cf30619939d4f8" "0.8.0": url: "https://github.com/RoaringBitmap/CRoaring/archive/v0.8.0.tar.gz" sha256: "cd6c4770baccfea385c0c6891a8a80133ba26093209740ca0a3eea348aff1a20" diff --git a/recipes/roaring/config.yml b/recipes/roaring/config.yml index 1dc23bfdde0f2e..e7836bd317d3c4 100644 --- a/recipes/roaring/config.yml +++ b/recipes/roaring/config.yml @@ -1,4 +1,6 @@ versions: + "0.8.1": + folder: all "0.8.0": folder: all "0.7.3": diff --git a/recipes/rply/all/CMakeLists.txt b/recipes/rply/all/CMakeLists.txt new file mode 100644 index 00000000000000..b354602f836505 --- /dev/null +++ b/recipes/rply/all/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.4) +project(rply LANGUAGES C) + +add_library(rply ${RPLY_SRC_DIR}/rply.c) +target_include_directories(rply PUBLIC ${RPLY_SRC_DIR}) +set_target_properties(rply PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) + +include(GNUInstallDirs) +install( + TARGETS rply + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) +install( + FILES ${RPLY_SRC_DIR}/rply.h ${RPLY_SRC_DIR}/rplyfile.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) diff --git a/recipes/rply/all/conandata.yml b/recipes/rply/all/conandata.yml new file mode 100644 index 00000000000000..2c48d7c782b77d --- /dev/null +++ b/recipes/rply/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.1.4": + url: "https://w3.impa.br/~diego/software/rply/rply-1.1.4.tar.gz" + sha256: "daf0b060fe701adf72aab0d525323d2e2e1bde9aa6aa9713ff1a5ef1e768d703" diff --git a/recipes/rply/all/conanfile.py b/recipes/rply/all/conanfile.py new file mode 100644 index 00000000000000..7ec833263602a2 --- /dev/null +++ b/recipes/rply/all/conanfile.py @@ -0,0 +1,62 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get +import os + +required_conan_version = ">=1.53.0" + + +class RplyConan(ConanFile): + name = "rply" + description = "ANSI C Library for PLY file format input and output" + license = "MIT" + topics = ("ply", "3d", "reader", "writer") + homepage = "https://w3.impa.br/~diego/software/rply" + url = "https://github.com/conan-io/conan-center-index" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + exports_sources = "CMakeLists.txt" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["RPLY_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + cmake.build() + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["rply"] diff --git a/recipes/rply/all/test_package/CMakeLists.txt b/recipes/rply/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..5de7de58218bfe --- /dev/null +++ b/recipes/rply/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(rply REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE rply::rply) diff --git a/recipes/rply/all/test_package/conanfile.py b/recipes/rply/all/test_package/conanfile.py new file mode 100644 index 00000000000000..b1cd2f951eab32 --- /dev/null +++ b/recipes/rply/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + ply_file = os.path.join(self.source_folder, "triangle.ply") + self.run(f"{bin_path} {ply_file}", env="conanrun") diff --git a/recipes/rply/all/test_package/test_package.c b/recipes/rply/all/test_package/test_package.c new file mode 100644 index 00000000000000..6b98b23e1b4f30 --- /dev/null +++ b/recipes/rply/all/test_package/test_package.c @@ -0,0 +1,47 @@ +#include +#include + +static int vertex_cb(p_ply_argument argument) { + long eol; + ply_get_argument_user_data(argument, NULL, &eol); + printf("%g", ply_get_argument_value(argument)); + if (eol) printf("\n"); + else printf(" "); + return 1; +} + +static int face_cb(p_ply_argument argument) { + long length, value_index; + ply_get_argument_property(argument, NULL, &length, &value_index); + switch (value_index) { + case 0: + case 1: + printf("%g ", ply_get_argument_value(argument)); + break; + case 2: + printf("%g\n", ply_get_argument_value(argument)); + break; + default: + break; + } + return 1; +} + +int main(int argc, char **argv) { + if (argc < 2) { + printf("Need at least one argument\n"); + return 1; + } + long nvertices, ntriangles; + p_ply ply = ply_open(argv[1], NULL, 0, NULL); + if (!ply) return 1; + if (!ply_read_header(ply)) return 1; + nvertices = ply_set_read_cb(ply, "vertex", "x", vertex_cb, NULL, 0); + ply_set_read_cb(ply, "vertex", "y", vertex_cb, NULL, 0); + ply_set_read_cb(ply, "vertex", "z", vertex_cb, NULL, 1); + ntriangles = ply_set_read_cb(ply, "face", "vertex_indices", face_cb, NULL, 0); + printf("%ld\n%ld\n", nvertices, ntriangles); + if (!ply_read(ply)) return 1; + ply_close(ply); + return 0; +} diff --git a/recipes/rply/all/test_package/triangle.ply b/recipes/rply/all/test_package/triangle.ply new file mode 100644 index 00000000000000..a9a950416c055c --- /dev/null +++ b/recipes/rply/all/test_package/triangle.ply @@ -0,0 +1,15 @@ +ply +format ascii 1.0 +comment this is a simple file +obj_info any data, in one line of free form text +element vertex 3 +property float x +property float y +property float z +element face 1 +property list uchar int vertex_indices +end_header +-1 0 0 + 0 1 0 + 1 0 0 +3 0 1 2 diff --git a/recipes/rply/all/test_v1_package/CMakeLists.txt b/recipes/rply/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/rply/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/rply/all/test_v1_package/conanfile.py b/recipes/rply/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..8c7d6ccfd145d1 --- /dev/null +++ b/recipes/rply/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + ply_file = os.path.join(self.source_folder, os.pardir, "test_package", "triangle.ply") + self.run(f"{bin_path} {ply_file}", run_environment=True) diff --git a/recipes/rply/config.yml b/recipes/rply/config.yml new file mode 100644 index 00000000000000..f7bc2bb892fbd0 --- /dev/null +++ b/recipes/rply/config.yml @@ -0,0 +1,3 @@ +versions: + "1.1.4": + folder: all diff --git a/recipes/s2n/all/conandata.yml b/recipes/s2n/all/conandata.yml index 9b9a8f645b4eaf..119cdd4f58eb58 100644 --- a/recipes/s2n/all/conandata.yml +++ b/recipes/s2n/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.31": + url: "https://github.com/aws/s2n-tls/archive/v1.3.31.tar.gz" + sha256: "23cfb42f82cbe1ce94b59f3b1c1c8eb9d24af2a1ae4c8f854209ff88fddd3900" "1.3.15": url: "https://github.com/aws/s2n-tls/archive/v1.3.15.tar.gz" sha256: "e3fc3405bb56334cbec90c35cbdf0e8a0f53199749a3f4b8fddb8d8a41e6db8b" diff --git a/recipes/s2n/config.yml b/recipes/s2n/config.yml index c944c2b90155a4..611e0f7be0d88e 100644 --- a/recipes/s2n/config.yml +++ b/recipes/s2n/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.31": + folder: all "1.3.15": folder: all "1.3.9": diff --git a/recipes/safeint/all/conandata.yml b/recipes/safeint/all/conandata.yml index a813b97cd4e7d1..4a9ad7617a715b 100644 --- a/recipes/safeint/all/conandata.yml +++ b/recipes/safeint/all/conandata.yml @@ -1,7 +1,10 @@ sources: - "3.24": - url: "https://github.com/dcleblanc/SafeInt/archive/3.24.tar.gz" - sha256: "af6c7222a8420f6f87e198dc94791c28da75fe7241b605342c333fd03fd9dea6" + "3.0.27": + url: "https://github.com/dcleblanc/SafeInt/archive/refs/tags/3.0.27.tar.gz" + sha256: "489abb253514f819adb7e3aab3273b184c484dfe082fbe2166de2fd3a88dfb2b" "3.0.26": url: "https://github.com/dcleblanc/SafeInt/archive/refs/tags/3.0.26.tar.gz" sha256: "62fef99873ad975ddd8356923b3d51ed316209c1a05ac85814219373a13ae4d5" + "3.24": + url: "https://github.com/dcleblanc/SafeInt/archive/3.24.tar.gz" + sha256: "af6c7222a8420f6f87e198dc94791c28da75fe7241b605342c333fd03fd9dea6" diff --git a/recipes/safeint/all/conanfile.py b/recipes/safeint/all/conanfile.py index 5a9aa867bf18eb..4130a0caf6073f 100644 --- a/recipes/safeint/all/conanfile.py +++ b/recipes/safeint/all/conanfile.py @@ -11,12 +11,15 @@ class SafeintConan(ConanFile): name = "safeint" description = "SafeInt is a class library for C++ that manages integer overflows." license = "MIT" - topics = ("safeint", "integer", "overflow") + topics = ("integer", "overflow") homepage = "https://github.com/dcleblanc/SafeInt" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" no_copy_source = True + def layout(self): + basic_layout(self, src_folder="src") + def package_id(self): self.info.clear() @@ -24,9 +27,6 @@ def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) - def layout(self): - basic_layout(self, src_folder="src") - def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -40,6 +40,4 @@ def package(self): def package_info(self): self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] diff --git a/recipes/safeint/all/test_package/conanfile.py b/recipes/safeint/all/test_package/conanfile.py index d120a992c06a69..0a6bc68712d901 100644 --- a/recipes/safeint/all/test_package/conanfile.py +++ b/recipes/safeint/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/safeint/all/test_v1_package/CMakeLists.txt b/recipes/safeint/all/test_v1_package/CMakeLists.txt index e2ce73f44562cc..0d20897301b68b 100644 --- a/recipes/safeint/all/test_v1_package/CMakeLists.txt +++ b/recipes/safeint/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(safeint REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE safeint::safeint) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/safeint/config.yml b/recipes/safeint/config.yml index df1076f0d71c5b..375ce5296b1afa 100644 --- a/recipes/safeint/config.yml +++ b/recipes/safeint/config.yml @@ -1,5 +1,7 @@ versions: - "3.24": + "3.0.27": folder: all "3.0.26": folder: all + "3.24": + folder: all diff --git a/recipes/screen_capture_lite/all/conandata.yml b/recipes/screen_capture_lite/all/conandata.yml index 65b3da360c6802..ebf387ff02ee53 100644 --- a/recipes/screen_capture_lite/all/conandata.yml +++ b/recipes/screen_capture_lite/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "17.1.613": + url: "https://github.com/smasherprog/screen_capture_lite/archive/refs/tags/17.1.613.tar.gz" + sha256: "ab111e52379fc4bca852b9a79535329e12dca9b25a0b87a2ef84ab7348a64064" "17.1.462": url: "https://github.com/smasherprog/screen_capture_lite/archive/refs/tags/17.1.462.tar.gz" sha256: "4c7d9b23a458645534c4e2a7315eb12fc7d6dc0fb914f1d6787ee9d5d16e6dfd" diff --git a/recipes/screen_capture_lite/all/conanfile.py b/recipes/screen_capture_lite/all/conanfile.py index 2ff4ae6be6da02..b435b4fa5fdfbb 100644 --- a/recipes/screen_capture_lite/all/conanfile.py +++ b/recipes/screen_capture_lite/all/conanfile.py @@ -1,7 +1,7 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.microsoft import check_min_vs, is_msvc -from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, 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 @@ -79,6 +79,21 @@ def validate(self): is_apple_os(self) and Version(self.info.settings.compiler.version) <= "11": raise ConanInvalidConfiguration(f"{self.ref} requires CGPreflightScreenCaptureAccess which support macOS SDK 11 later.") + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output=output) + m = re.search(r'cmake version (\d+\.\d+\.\d+)', output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False + + def build_requirements(self): + if Version(self.version) >= "17.1.596" and not self._cmake_new_enough("3.16"): + self.tool_requires("cmake/3.25.0") + def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -88,6 +103,9 @@ def generate(self): if is_msvc(self): # fix "error C2039: 'CheckForDuplicateEntries': is not a member of 'Microsoft::WRL::Details'" tc.variables["CMAKE_SYSTEM_VERSION"] = "10.0.18362.0" + if Version(self.version) >= "17.1.613": + tc.variables["BUILD_CSHARP"] = False + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() deps = CMakeDeps(self) @@ -105,6 +123,7 @@ def package(self): cmake.install() rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.libs = ["screen_capture_lite_shared" if self.options.shared else "screen_capture_lite_static"] diff --git a/recipes/screen_capture_lite/all/test_v1_package/CMakeLists.txt b/recipes/screen_capture_lite/all/test_v1_package/CMakeLists.txt index 483105d61e33a1..925ecbe19e448d 100644 --- a/recipes/screen_capture_lite/all/test_v1_package/CMakeLists.txt +++ b/recipes/screen_capture_lite/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(screen_capture_lite REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE screen_capture_lite::screen_capture_lite) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/screen_capture_lite/config.yml b/recipes/screen_capture_lite/config.yml index dc442a6ad8c52b..f8e73a4caff7bd 100644 --- a/recipes/screen_capture_lite/config.yml +++ b/recipes/screen_capture_lite/config.yml @@ -1,4 +1,6 @@ versions: + "17.1.613": + folder: "all" "17.1.462": folder: "all" "17.1.439": diff --git a/recipes/sdl/all/CMakeLists.txt b/recipes/sdl/all/CMakeLists.txt deleted file mode 100644 index 94daaf65016d8d..00000000000000 --- a/recipes/sdl/all/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -cmake_minimum_required(VERSION 3.0) -project(cmake_wrapper) - -include(${CONAN_INSTALL_FOLDER}/conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -if(UNIX AND NOT APPLE) - if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) - add_definitions("-DGBM_BO_USE_CURSOR=2") - endif() - endif() -endif() - -add_subdirectory(source_subfolder) diff --git a/recipes/sdl/all/conandata.yml b/recipes/sdl/all/conandata.yml index e96121e1d94356..24d42d4c8fad29 100644 --- a/recipes/sdl/all/conandata.yml +++ b/recipes/sdl/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.26.1": + url: "https://www.libsdl.org/release/SDL2-2.26.1.tar.gz" + sha256: "02537cc7ebd74071631038b237ec4bfbb3f4830ba019e569434da33f42373e04" "2.26.0": url: "https://www.libsdl.org/release/SDL2-2.26.0.tar.gz" sha256: "8000d7169febce93c84b6bdf376631f8179132fd69f7015d4dadb8b9c2bdb295" @@ -23,14 +26,19 @@ sources: patches: "2.0.20": - patch_file: "patches/0004-2.0.20-ndk.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "ndk patch" "2.0.16": - patch_file: "patches/0003-2.0.16-wayland-scanner-buildrequires.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "wayland scanner buildrequires" "2.0.14": - patch_file: "patches/0001-fix-cmake-ios-tvos.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "fix cmake ios tvos" - patch_file: "patches/0002-mingw-improvements.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "mingw improvements" - patch_file: "patches/0003-2.0.14-wayland-scanner-buildrequires.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "wayland scanner buildrequires" diff --git a/recipes/sdl/all/conanfile.py b/recipes/sdl/all/conanfile.py index 698a088fe228a5..045807a9023bd8 100644 --- a/recipes/sdl/all/conanfile.py +++ b/recipes/sdl/all/conanfile.py @@ -1,15 +1,16 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.apple import is_apple_os -from conan.tools.files import apply_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, replace_in_file, rm, rmdir, copy from conan.tools.microsoft import is_msvc from conan.tools.build import cross_building from conan.tools.scm import Version -from conans import CMake, tools -import functools +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.env import Environment + import os -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.53.0" class SDLConan(ConanFile): @@ -21,6 +22,9 @@ class SDLConan(ConanFile): license = "Zlib" settings = "os", "arch", "compiler", "build_type" + + generators = "CMakeDeps", "PkgConfigDeps", "VirtualBuildEnv" + options = { "shared": [True, False], "fPIC": [True, False], @@ -80,20 +84,24 @@ class SDLConan(ConanFile): "libunwind": True, } - generators = ["cmake", "pkg_config"] + def layout(self): + cmake_layout(self, src_folder="src") - @property - def _source_subfolder(self): - return "source_subfolder" + def generate(self): + self.define_toolchain() + lib_paths = [lib for _, dep in self.dependencies.items() for lib in dep.cpp_info.libdirs] + env = Environment() + env.define_path("LIBRARY_PATH", os.pathsep.join(lib_paths)) + + # FIXME: remove and raise required_conan_version to 1.55 once it's on c3i + env.prepend_path("PKG_CONFIG_PATH", self.generators_folder) + + env = env.vars(self, scope="build") + env.save_script("sdl_env") - @property - def _build_subfolder(self): - return "build_subfolder" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -125,9 +133,9 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def requirements(self): if self.options.get_safe("iconv", False): @@ -185,12 +193,12 @@ def build_requirements(self): def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True, - destination=self._source_subfolder) + destination=self.source_folder) def _patch_sources(self): apply_conandata_patches(self) - replace_in_file(self, os.path.join(self._source_subfolder, "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), 'check_library_exists(c iconv_open "" HAVE_BUILTIN_ICONV)', '# check_library_exists(c iconv_open "" HAVE_BUILTIN_ICONV)') @@ -198,184 +206,193 @@ def _patch_sources(self): if self.options.get_safe("wayland") and Version(self.version) >= "2.0.18": wayland_bin_path = " ".join("\"{}\"".format(path) for path in self.deps_env_info["wayland"].PATH) replace_in_file(self, - os.path.join(self._source_subfolder, "cmake", "sdlchecks.cmake"), + os.path.join(self.source_folder, "cmake", "sdlchecks.cmake"), "find_program(WAYLAND_SCANNER NAMES wayland-scanner REQUIRED)", "find_program(WAYLAND_SCANNER NAMES wayland-scanner REQUIRED PATHS {} NO_DEFAULT_PATH)".format(wayland_bin_path), ) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["SDL2_DISABLE_INSTALL"] = False # SDL2_* options will get renamed to SDL_ options in the next SDL release + def define_toolchain(self): + tc = CMakeToolchain(self) + if self.settings.os == "Linux" and self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < 5.0: + tc.preprocessor_definitions["GBM_BO_USE_CURSOR"] = 2 + + tc.variables["SDL2_DISABLE_INSTALL"] = False # SDL2_* options will get renamed to SDL_ options in the next SDL release if is_apple_os(self): - cmake.definitions["CMAKE_OSX_ARCHITECTURES"] = { + tc.variables["CMAKE_OSX_ARCHITECTURES"] = { "armv8": "arm64", }.get(str(self.settings.arch), str(self.settings.arch)) cmake_required_includes = [] # List of directories used by CheckIncludeFile (https://cmake.org/cmake/help/latest/module/CheckIncludeFile.html) cmake_extra_ldflags = [] - # FIXME: self.install_folder not defined? Neccessary? - cmake.definitions["CONAN_INSTALL_FOLDER"] = self.install_folder + cmake_extra_libs = [] + if self.settings.os != "Windows" and not self.options.shared: - cmake.definitions["SDL_STATIC_PIC"] = self.options.fPIC + tc.variables["SDL_STATIC_PIC"] = self.options.fPIC if is_msvc(self) and not self.options.shared: - cmake.definitions["HAVE_LIBC"] = True - cmake.definitions["SDL_SHARED"] = self.options.shared - cmake.definitions["SDL_STATIC"] = not self.options.shared + tc.variables["HAVE_LIBC"] = True + tc.variables["SDL_SHARED"] = self.options.shared + tc.variables["SDL_STATIC"] = not self.options.shared if Version(self.version) < "2.0.18": - cmake.definitions["VIDEO_OPENGL"] = self.options.opengl - cmake.definitions["VIDEO_OPENGLES"] = self.options.opengles - cmake.definitions["VIDEO_VULKAN"] = self.options.vulkan + tc.variables["VIDEO_OPENGL"] = self.options.opengl + tc.variables["VIDEO_OPENGLES"] = self.options.opengles + tc.variables["VIDEO_VULKAN"] = self.options.vulkan if self.settings.os == "Linux": # See https://github.com/bincrafters/community/issues/696 - cmake.definitions["SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS"] = 1 + tc.variables["SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS"] = 1 - cmake.definitions["ALSA"] = self.options.alsa + tc.variables["ALSA"] = self.options.alsa if self.options.alsa: - cmake.definitions["ALSA_SHARED"] = self.deps_cpp_info["libalsa"].shared - cmake.definitions["HAVE_ASOUNDLIB_H"] = True - cmake.definitions["HAVE_LIBASOUND"] = True - cmake.definitions["JACK"] = self.options.jack + tc.variables["ALSA_SHARED"] = self.options["libalsa"].shared + tc.variables["HAVE_ASOUNDLIB_H"] = True + tc.variables["HAVE_LIBASOUND"] = True + tc.variables["JACK"] = self.options.jack if self.options.jack: - cmake.definitions["JACK_SHARED"] = self.deps_cpp_info["jack"].shared - cmake.definitions["ESD"] = self.options.esd + tc.variables["JACK_SHARED"] = self.options["jack"].shared + tc.variables["ESD"] = self.options.esd if self.options.esd: - cmake.definitions["ESD_SHARED"] = self.deps_cpp_info["esd"].shared - cmake.definitions["PULSEAUDIO"] = self.options.pulse + tc.variables["ESD_SHARED"] = self.options["esd"].shared + tc.variables["PULSEAUDIO"] = self.options.pulse if self.options.pulse: - cmake.definitions["PULSEAUDIO_SHARED"] = self.deps_cpp_info["pulseaudio"].shared - cmake.definitions["SNDIO"] = self.options.sndio + tc.variables["PULSEAUDIO_SHARED"] = self.options["pulseaudio"].shared + tc.variables["SNDIO"] = self.options.sndio if self.options.sndio: - cmake.definitions["SNDIO_SHARED"] = self.deps_cpp_info["sndio"].shared - cmake.definitions["NAS"] = self.options.nas + tc.variables["SNDIO_SHARED"] = self.options["sndio"].shared + tc.variables["NAS"] = self.options.nas if self.options.nas: cmake_extra_ldflags += ["-lXau"] # FIXME: SDL sources doesn't take into account transitive dependencies - cmake_required_includes += [os.path.join(self.deps_cpp_info["nas"].rootpath, str(it)) for it in self.deps_cpp_info["nas"].includedirs] - cmake.definitions["NAS_SHARED"] = self.options["nas"].shared - cmake.definitions["VIDEO_X11"] = self.options.x11 + cmake_required_includes += self.dependencies["nas"].cpp_info.includedirs + tc.variables["NAS_SHARED"] = self.options["nas"].shared + tc.variables["VIDEO_X11"] = self.options.x11 if self.options.x11: - cmake.definitions["HAVE_XEXT_H"] = True - cmake.definitions["VIDEO_X11_XCURSOR"] = self.options.xcursor + tc.variables["HAVE_XEXT_H"] = True + tc.variables["VIDEO_X11_XCURSOR"] = self.options.xcursor if self.options.xcursor: - cmake.definitions["HAVE_XCURSOR_H"] = True - cmake.definitions["VIDEO_X11_XINERAMA"] = self.options.xinerama + tc.variables["HAVE_XCURSOR_H"] = True + tc.variables["VIDEO_X11_XINERAMA"] = self.options.xinerama if self.options.xinerama: - cmake.definitions["HAVE_XINERAMA_H"] = True - cmake.definitions["VIDEO_X11_XINPUT"] = self.options.xinput + tc.variables["HAVE_XINERAMA_H"] = True + tc.variables["VIDEO_X11_XINPUT"] = self.options.xinput if self.options.xinput: - cmake.definitions["HAVE_XINPUT_H"] = True - cmake.definitions["VIDEO_X11_XRANDR"] = self.options.xrandr + tc.variables["HAVE_XINPUT_H"] = True + tc.variables["VIDEO_X11_XRANDR"] = self.options.xrandr if self.options.xrandr: - cmake.definitions["HAVE_XRANDR_H"] = True - cmake.definitions["VIDEO_X11_XSCRNSAVER"] = self.options.xscrnsaver + tc.variables["HAVE_XRANDR_H"] = True + tc.variables["VIDEO_X11_XSCRNSAVER"] = self.options.xscrnsaver if self.options.xscrnsaver: - cmake.definitions["HAVE_XSS_H"] = True - cmake.definitions["VIDEO_X11_XSHAPE"] = self.options.xshape + tc.variables["HAVE_XSS_H"] = True + tc.variables["VIDEO_X11_XSHAPE"] = self.options.xshape if self.options.xshape: - cmake.definitions["HAVE_XSHAPE_H"] = True - cmake.definitions["VIDEO_X11_XVM"] = self.options.xvm + tc.variables["HAVE_XSHAPE_H"] = True + tc.variables["VIDEO_X11_XVM"] = self.options.xvm if self.options.xvm: - cmake.definitions["HAVE_XF86VM_H"] = True - cmake.definitions["VIDEO_WAYLAND"] = self.options.wayland + tc.variables["HAVE_XF86VM_H"] = True + tc.variables["VIDEO_WAYLAND"] = self.options.wayland if self.options.wayland: # FIXME: Otherwise 2.0.16 links with system wayland (from egl/system requirement) - cmake_extra_ldflags += ["-L{}".format(os.path.join(self.deps_cpp_info["wayland"].rootpath, it)) for it in self.deps_cpp_info["wayland"].libdirs] - cmake.definitions["WAYLAND_SHARED"] = self.options["wayland"].shared - cmake.definitions["WAYLAND_SCANNER_1_15_FOUND"] = 1 # FIXME: Check actual build-requires version + cmake_extra_ldflags += ["-L{}".format(it) for it in self.dependencies["wayland"].cpp_info.libdirs] + tc.variables["WAYLAND_SHARED"] = self.options["wayland"].shared + tc.variables["WAYLAND_SCANNER_1_15_FOUND"] = 1 # FIXME: Check actual build-requires version - cmake.definitions["VIDEO_DIRECTFB"] = self.options.directfb - cmake.definitions["VIDEO_RPI"] = self.options.video_rpi - cmake.definitions["HAVE_LIBUNWIND_H"] = self.options.libunwind + tc.variables["VIDEO_DIRECTFB"] = self.options.directfb + tc.variables["VIDEO_RPI"] = self.options.video_rpi + tc.variables["HAVE_LIBUNWIND_H"] = self.options.libunwind elif self.settings.os == "Windows": - cmake.definitions["DIRECTX"] = self.options.directx + tc.variables["DIRECTX"] = self.options.directx else: - cmake.definitions["SDL_OPENGL"] = self.options.opengl - cmake.definitions["SDL_OPENGLES"] = self.options.opengles - cmake.definitions["SDL_VULKAN"] = self.options.vulkan + tc.variables["SDL_OPENGL"] = self.options.opengl + tc.variables["SDL_OPENGLES"] = self.options.opengles + tc.variables["SDL_VULKAN"] = self.options.vulkan if self.settings.os == "Linux": # See https://github.com/bincrafters/community/issues/696 - cmake.definitions["SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS"] = 1 + tc.variables["SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS"] = 1 - cmake.definitions["SDL_ALSA"] = self.options.alsa + tc.variables["SDL_ALSA"] = self.options.alsa if self.options.alsa: - cmake.definitions["SDL_ALSA_SHARED"] = self.deps_cpp_info["libalsa"].shared - cmake.definitions["HAVE_ASOUNDLIB_H"] = True - cmake.definitions["HAVE_LIBASOUND"] = True - cmake.definitions["SDL_JACK"] = self.options.jack + tc.variables["SDL_ALSA_SHARED"] = self.options["libalsa"].shared + tc.variables["HAVE_ASOUNDLIB_H"] = True + tc.variables["HAVE_LIBASOUND"] = True + tc.variables["SDL_JACK"] = self.options.jack if self.options.jack: - cmake.definitions["SDL_JACK_SHARED"] = self.deps_cpp_info["jack"].shared - cmake.definitions["SDL_ESD"] = self.options.esd + tc.variables["SDL_JACK_SHARED"] = self.options["jack"].shared + tc.variables["SDL_ESD"] = self.options.esd if self.options.esd: - cmake.definitions["SDL_ESD_SHARED"] = self.deps_cpp_info["esd"].shared - cmake.definitions["SDL_PULSEAUDIO"] = self.options.pulse + tc.variables["SDL_ESD_SHARED"] = self.options["esd"].shared + tc.variables["SDL_PULSEAUDIO"] = self.options.pulse if self.options.pulse: - cmake.definitions["SDL_PULSEAUDIO_SHARED"] = self.deps_cpp_info["pulseaudio"].shared - cmake.definitions["SDL_SNDIO"] = self.options.sndio + tc.variables["SDL_PULSEAUDIO_SHARED"] = self.options["pulseaudio"].shared + for component in self.dependencies["pulseaudio"].cpp_info.components: + if self.dependencies["pulseaudio"].cpp_info.components[component].libs: + cmake_extra_libs += self.dependencies["pulseaudio"].cpp_info.components[component].libs + cmake_extra_ldflags += ["-L{}".format(it) for it in self.dependencies["pulseaudio"].cpp_info.components[component].libdirs] + cmake_extra_ldflags += ["-lxcb", "-lrt"] # FIXME: SDL sources doesn't take into account transitive dependencies + tc.variables["SDL_SNDIO"] = self.options.sndio if self.options.sndio: - cmake.definitions["SDL_SNDIO_SHARED"] = self.deps_cpp_info["sndio"].shared - cmake.definitions["SDL_NAS"] = self.options.nas + tc.variables["SDL_SNDIO_SHARED"] = self.options["sndio"].shared + tc.variables["SDL_NAS"] = self.options.nas if self.options.nas: cmake_extra_ldflags += ["-lXau"] # FIXME: SDL sources doesn't take into account transitive dependencies - cmake_required_includes += [os.path.join(self.deps_cpp_info["nas"].rootpath, str(it)) for it in self.deps_cpp_info["nas"].includedirs] - cmake.definitions["SDL_NAS_SHARED"] = self.options["nas"].shared - cmake.definitions["SDL_X11"] = self.options.x11 + cmake_required_includes += self.dependencies["nas"].cpp_info.includedirs + tc.variables["SDL_NAS_SHARED"] = self.options["nas"].shared + tc.variables["SDL_X11"] = self.options.x11 if self.options.x11: - cmake.definitions["HAVE_XEXT_H"] = True - cmake.definitions["SDL_X11_XCURSOR"] = self.options.xcursor + tc.variables["HAVE_XEXT_H"] = True + tc.variables["SDL_X11_XCURSOR"] = self.options.xcursor if self.options.xcursor: - cmake.definitions["HAVE_XCURSOR_H"] = True - cmake.definitions["SDL_X11_XINERAMA"] = self.options.xinerama + tc.variables["HAVE_XCURSOR_H"] = True + tc.variables["SDL_X11_XINERAMA"] = self.options.xinerama if self.options.xinerama: - cmake.definitions["HAVE_XINERAMA_H"] = True - cmake.definitions["SDL_X11_XINPUT"] = self.options.xinput + tc.variables["HAVE_XINERAMA_H"] = True + tc.variables["SDL_X11_XINPUT"] = self.options.xinput if self.options.xinput: - cmake.definitions["HAVE_XINPUT_H"] = True - cmake.definitions["SDL_X11_XRANDR"] = self.options.xrandr + tc.variables["HAVE_XINPUT_H"] = True + tc.variables["SDL_X11_XRANDR"] = self.options.xrandr if self.options.xrandr: - cmake.definitions["HAVE_XRANDR_H"] = True - cmake.definitions["SDL_X11_XSCRNSAVER"] = self.options.xscrnsaver + tc.variables["HAVE_XRANDR_H"] = True + tc.variables["SDL_X11_XSCRNSAVER"] = self.options.xscrnsaver if self.options.xscrnsaver: - cmake.definitions["HAVE_XSS_H"] = True - cmake.definitions["SDL_X11_XSHAPE"] = self.options.xshape + tc.variables["HAVE_XSS_H"] = True + tc.variables["SDL_X11_XSHAPE"] = self.options.xshape if self.options.xshape: - cmake.definitions["HAVE_XSHAPE_H"] = True - cmake.definitions["SDL_X11_XVM"] = self.options.xvm + tc.variables["HAVE_XSHAPE_H"] = True + tc.variables["SDL_X11_XVM"] = self.options.xvm if self.options.xvm: - cmake.definitions["HAVE_XF86VM_H"] = True - cmake.definitions["SDL_WAYLAND"] = self.options.wayland + tc.variables["HAVE_XF86VM_H"] = True + tc.variables["SDL_WAYLAND"] = self.options.wayland if self.options.wayland: # FIXME: Otherwise 2.0.16 links with system wayland (from egl/system requirement) - cmake_extra_ldflags += ["-L{}".format(os.path.join(self.deps_cpp_info["wayland"].rootpath, it)) for it in self.deps_cpp_info["wayland"].libdirs] - cmake.definitions["SDL_WAYLAND_SHARED"] = self.options["wayland"].shared + cmake_extra_ldflags += ["-L{}".format(it) for it in self.dependencies["wayland"].cpp_info.libdirs] + tc.variables["SDL_WAYLAND_SHARED"] = self.options["wayland"].shared - cmake.definitions["SDL_DIRECTFB"] = self.options.directfb - cmake.definitions["SDL_RPI"] = self.options.video_rpi - cmake.definitions["HAVE_LIBUNWIND_H"] = self.options.libunwind + tc.variables["SDL_DIRECTFB"] = self.options.directfb + tc.variables["SDL_RPI"] = self.options.video_rpi + tc.variables["HAVE_LIBUNWIND_H"] = self.options.libunwind elif self.settings.os == "Windows": - cmake.definitions["SDL_DIRECTX"] = self.options.directx + tc.variables["SDL_DIRECTX"] = self.options.directx if Version(self.version) >= "2.0.22": - cmake.definitions["SDL2_DISABLE_SDL2MAIN"] = not self.options.sdl2main + tc.variables["SDL2_DISABLE_SDL2MAIN"] = not self.options.sdl2main # Add extra information collected from the deps - cmake.definitions["EXTRA_LDFLAGS"] = " ".join(cmake_extra_ldflags) - cmake.definitions["CMAKE_REQUIRED_INCLUDES"] = ";".join(cmake_required_includes) - cmake.configure(build_dir=self._build_subfolder) - return cmake + tc.variables["EXTRA_LDFLAGS"] = ";".join(cmake_extra_ldflags) + tc.variables["CMAKE_REQUIRED_INCLUDES"] = ";".join(cmake_required_includes) + cmake_extra_cflags = ["-I{}".format(path) for _, dep in self.dependencies.items() for path in dep.cpp_info.includedirs] + tc.variables["EXTRA_CFLAGS"] = ";".join(cmake_extra_cflags) + tc.variables["EXTRA_LIBS"] = ";".join(cmake_extra_libs) + tc.generate() def build(self): self._patch_sources() - lib_paths = [lib for dep in self.deps_cpp_info.deps for lib in self.deps_cpp_info[dep].lib_paths] - with tools.environment_append({"LIBRARY_PATH": os.pathsep.join(lib_paths)}): - cmake = self._configure_cmake() - cmake.build() + cmake = CMake(self) + cmake.configure() + cmake.build() + def package(self): + cmake = CMake(self) if self.version >= "2.0.16": - self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) + copy(self, pattern="LICENSE.txt", src=os.path.join(self.source_folder), dst=os.path.join(self.package_folder, "licenses")) else: - self.copy(pattern="COPYING.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="COPYING.txt", src=os.path.join(self.source_folder), dst=os.path.join(self.package_folder, "licenses")) cmake.install() rm(self, "sdl2-config", os.path.join(self.package_folder, "bin")) rmdir(self, os.path.join(self.package_folder, "cmake")) diff --git a/recipes/sdl/all/test_package/CMakeLists.txt b/recipes/sdl/all/test_package/CMakeLists.txt index 429003c689829e..4195ae0c9ad328 100644 --- a/recipes/sdl/all/test_package/CMakeLists.txt +++ b/recipes/sdl/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(SDL2 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) @@ -14,16 +11,3 @@ else() target_link_libraries(${PROJECT_NAME} SDL2::SDL2) endif() -function(add_option option) - if(${option}) - target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE "${option}") - endif() -endfunction() - -add_option(WITH_X11) -add_option(WITH_ALSA) -add_option(WITH_PULSE) -add_option(WITH_ESD) -add_option(WITH_ARTS) -add_option(WITH_DIRECTFB) -add_option(WITH_DIRECTX) diff --git a/recipes/sdl/all/test_package/conanfile.py b/recipes/sdl/all/test_package/conanfile.py index 0de69e86ca9dfd..956346bb808549 100644 --- a/recipes/sdl/all/test_package/conanfile.py +++ b/recipes/sdl/all/test_package/conanfile.py @@ -1,27 +1,32 @@ -from conans import ConanFile, CMake -from conan.tools.build import cross_building +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain import os +# It will become the standard on Conan 2.x class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + def build(self): cmake = CMake(self) - if self.settings.os == "Linux": - cmake.definitions["WITH_X11"] = self.options["sdl"].x11 - cmake.definitions["WITH_ALSA"] = self.options["sdl"].alsa - cmake.definitions["WITH_PULSE"] = self.options["sdl"].pulse - cmake.definitions["WITH_ESD"] = self.options["sdl"].esd - cmake.definitions["WITH_ARTS"] = self.options["sdl"].arts - cmake.definitions["WITH_DIRECTFB"] = self.options["sdl"].directfb - if self.settings.os == "Windows": - cmake.definitions["WITH_DIRECTX"] = self.options["sdl"].directx cmake.configure() cmake.build() def test(self): - if not cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/sdl/all/test_package/test_package.cpp b/recipes/sdl/all/test_package/test_package.cpp index 62a211f91d3037..69868e55398deb 100644 --- a/recipes/sdl/all/test_package/test_package.cpp +++ b/recipes/sdl/all/test_package/test_package.cpp @@ -1,81 +1,9 @@ #include -#include -#include -#include #include -#include -static void throw_exception(const char * message, const char * name) -{ - std::stringstream s; - s << message << " - " << name; - throw std::runtime_error(s.str().c_str()); -} - -static void check_audio_driver(const char * name) -{ - std::cout << "checking for audio driver " << name << " ... "; - bool found = false; - int count = SDL_GetNumAudioDrivers(); - for (int i = 0; i < count; ++i) { - if (0 == strcmp(name, SDL_GetAudioDriver(i))) { - found = true; - break; - } - } - if (!found) - throw_exception("audio driver wasn't found", name); - std::cout << "OK!" << std::endl; -} - -static void check_video_driver(const char * name) -{ - std::cout << "checking for video driver " << name << " ... "; - bool found = false; - int count = SDL_GetNumVideoDrivers(); - for (int i = 0; i < count; ++i) { - if (0 == strcmp(name, SDL_GetVideoDriver(i))) { - found = true; - break; - } - } - if (!found) - throw_exception("video driver wasn't found", name); - std::cout << "OK!" << std::endl; -} - - -int main(int argc, char *argv[]) try -{ +int main(int argc, char* args[]) { SDL_version v; SDL_GetVersion(&v); std::cout << "SDL version " << int(v.major) << "." << int(v.minor) << "." << int(v.patch) << std::endl; -#ifdef WITH_X11 - check_video_driver("x11"); -#endif -#ifdef WITH_ALSA - check_audio_driver("alsa"); -#endif -#ifdef WITH_PULSE - check_audio_driver("pulseaudio"); -#endif -#ifdef WITH_ESD - check_audio_driver("esd"); -#endif -#ifdef WITH_ARTS - check_audio_driver("arts"); -#endif -#ifdef WITH_DIRECTFB - check_video_driver("directfb"); -#endif -#ifdef WITH_DIRECTX - check_audio_driver("directsound"); -#endif - return EXIT_SUCCESS; -} -catch (std::runtime_error & e) -{ - std::cout << "FAIL!" << std::endl; - std::cerr << e.what() << std::endl; - return EXIT_FAILURE; + return 0; } diff --git a/recipes/sdl/all/test_v1_package/CMakeLists.txt b/recipes/sdl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..b272a5b7393038 --- /dev/null +++ b/recipes/sdl/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(SDL2 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} SDL2::SDL2main) +if(TARGET SDL2::SDL2-static) + target_link_libraries(${PROJECT_NAME} SDL2::SDL2-static) +else() + target_link_libraries(${PROJECT_NAME} SDL2::SDL2) +endif() diff --git a/recipes/sdl/all/test_v1_package/conanfile.py b/recipes/sdl/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..8037a9296cc42b --- /dev/null +++ b/recipes/sdl/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/sdl/all/test_v1_package/test_package.cpp b/recipes/sdl/all/test_v1_package/test_package.cpp new file mode 100644 index 00000000000000..69868e55398deb --- /dev/null +++ b/recipes/sdl/all/test_v1_package/test_package.cpp @@ -0,0 +1,9 @@ +#include +#include + +int main(int argc, char* args[]) { + SDL_version v; + SDL_GetVersion(&v); + std::cout << "SDL version " << int(v.major) << "." << int(v.minor) << "." << int(v.patch) << std::endl; + return 0; +} diff --git a/recipes/sdl/config.yml b/recipes/sdl/config.yml index 54cef5c632d3af..130fce619991af 100644 --- a/recipes/sdl/config.yml +++ b/recipes/sdl/config.yml @@ -1,4 +1,6 @@ versions: + "2.26.1": + folder: all "2.26.0": folder: all "2.24.1": diff --git a/recipes/seasocks/all/conandata.yml b/recipes/seasocks/all/conandata.yml index 1cc1c6a9f403a6..8ea105850a8bab 100644 --- a/recipes/seasocks/all/conandata.yml +++ b/recipes/seasocks/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.4.5": + url: "https://github.com/mattgodbolt/seasocks/archive/v1.4.5.tar.gz" + sha256: "82211959cf8aabc85b300358c5f68cf9c56dfdf4eaa09e548580fce908acfc1b" "1.4.4": url: "https://github.com/mattgodbolt/seasocks/archive/v1.4.4.tar.gz" sha256: "5ec016ee87d4985a031212fa23a00de3de5f0fa1ceb82d7b9a3d1c189356bf8d" diff --git a/recipes/seasocks/all/conanfile.py b/recipes/seasocks/all/conanfile.py index 5ae4859a7dc8d6..5a35a2a904c834 100644 --- a/recipes/seasocks/all/conanfile.py +++ b/recipes/seasocks/all/conanfile.py @@ -1,19 +1,20 @@ -from conans import CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy, rmdir, replace_in_file +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.53.0" class SeasocksConan(ConanFile): name = "seasocks" description = "A tiny embeddable C++ HTTP and WebSocket server for Linux" - topics = ("seasocks", "embeddable", "webserver", "websockets") - homepage = "https://github.com/mattgodbolt/seasocks" - url = "https://github.com/conan-io/conan-center-index" license = "BSD-2-Clause" - + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mattgodbolt/seasocks" + topics = ("embeddable", "webserver", "websockets") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,12 +27,22 @@ class SeasocksConan(ConanFile): "with_zlib": True, } - generators = "cmake", "cmake_find_package" - exports_sources = "CMakeLists.txt" + @property + def _min_cppstd(self): + return 11 if Version(self.version) < "1.4.5" else 17 @property - def _source_subfolder(self): - return "source_subfolder" + def _compilers_minimum_version(self): + if Version(self.version) < "1.4.5": + return {} + else: + return { + "Visual Studio": "16", + "msvc": "191", + "gcc": "7", + "clang": "7", + "apple-clang": "10", + } def config_options(self): if self.settings.os == "Windows": @@ -39,47 +50,60 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def validate(self): if self.settings.os not in ["Linux", "FreeBSD"]: - raise ConanInvalidConfiguration(f"Seasocks {self.version} doesn't support this os") + raise ConanInvalidConfiguration(f"{self.ref} doesn't support this os") + + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def _patch_sources(self): # No warnings as errors - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") - tools.replace_in_file(cmakelists, "-Werror", "") - tools.replace_in_file(cmakelists, "-pedantic-errors", "") + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + replace_in_file(self, cmakelists, "-Werror", "") + replace_in_file(self, cmakelists, "-pedantic-errors", "") - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["DEFLATE_SUPPORT"] = self.options.with_zlib - cmake.definitions["SEASOCKS_SHARED"] = self.options.shared - cmake.definitions["SEASOCKS_EXAMPLE_APP"] = False - cmake.definitions["UNITTESTS"] = False - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["DEFLATE_SUPPORT"] = self.options.with_zlib + tc.variables["SEASOCKS_SHARED"] = self.options.shared + tc.variables["SEASOCKS_EXAMPLE_APP"] = False + tc.variables["UNITTESTS"] = False + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "share")) + + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "Seasocks") @@ -88,7 +112,7 @@ def package_info(self): # TODO: back to global scope in conan v2 once cmake_find_package* generators removed self.cpp_info.components["libseasocks"].libs = ["seasocks"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["libseasocks"].system_libs.append("pthread") + self.cpp_info.components["libseasocks"].system_libs.extend(["pthread", "m"]) # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "Seasocks" diff --git a/recipes/seasocks/all/test_package/CMakeLists.txt b/recipes/seasocks/all/test_package/CMakeLists.txt index 0010361a5592eb..f005fadc417169 100644 --- a/recipes/seasocks/all/test_package/CMakeLists.txt +++ b/recipes/seasocks/all/test_package/CMakeLists.txt @@ -1,12 +1,13 @@ -cmake_minimum_required(VERSION 3.3) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(Seasocks REQUIRED CONFIG) find_package(Threads REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE Seasocks::seasocks Threads::Threads) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +if(Seasocks_VERSION VERSION_LESS "1.4.5") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() diff --git a/recipes/seasocks/all/test_package/conanfile.py b/recipes/seasocks/all/test_package/conanfile.py index 38f4483872d47f..a9fb96656f2039 100644 --- a/recipes/seasocks/all/test_package/conanfile.py +++ b/recipes/seasocks/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/seasocks/all/test_v1_package/CMakeLists.txt b/recipes/seasocks/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/seasocks/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/seasocks/all/test_v1_package/conanfile.py b/recipes/seasocks/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/seasocks/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/seasocks/config.yml b/recipes/seasocks/config.yml index c381a7e1424013..bcda68af0d12d3 100644 --- a/recipes/seasocks/config.yml +++ b/recipes/seasocks/config.yml @@ -1,3 +1,5 @@ versions: + "1.4.5": + folder: "all" "1.4.4": folder: "all" diff --git a/recipes/sentry-breakpad/all/conandata.yml b/recipes/sentry-breakpad/all/conandata.yml index 3c7fe86d983af4..ebc2e5e3d2cd54 100644 --- a/recipes/sentry-breakpad/all/conandata.yml +++ b/recipes/sentry-breakpad/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.5.3": + url: "https://github.com/getsentry/sentry-native/releases/download/0.5.3/sentry-native.zip" + sha256: "d9a2434783e558bc9e074518ce155bda129bfa12d376dde939e6a732c92f9757" "0.5.0": url: "https://github.com/getsentry/sentry-native/releases/download/0.5.0/sentry-native.zip" sha256: "1a65767a7c6c368a6dea44125eb268ed8374100f33168829f21df78cbfa8632b" @@ -17,4 +20,3 @@ sources: "0.2.6": url: "https://github.com/getsentry/sentry-native/releases/download/0.2.6/sentry-native-0.2.6.zip" sha256: "0d93bd77f70a64f3681d4928dfca6b327374218a84d33ee31489114d8e4716c0" -#patches: diff --git a/recipes/sentry-breakpad/config.yml b/recipes/sentry-breakpad/config.yml index 69f2362e8a2a3a..8b62ee8e2e1d6f 100644 --- a/recipes/sentry-breakpad/config.yml +++ b/recipes/sentry-breakpad/config.yml @@ -1,4 +1,6 @@ versions: + "0.5.3": + folder: all "0.5.0": folder: all "0.4.18": diff --git a/recipes/sentry-crashpad/all/CMakeLists.txt b/recipes/sentry-crashpad/all/CMakeLists.txt deleted file mode 100644 index 0d619e82907892..00000000000000 --- a/recipes/sentry-crashpad/all/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -if(MINGW) - find_program(JWASM_FOUND jwasm) - if (JWASM_FOUND) - set(CMAKE_ASM_MASM_COMPILER ${JWASM_FOUND}) - execute_process(COMMAND ${CMAKE_C_COMPILER} --version OUTPUT_VARIABLE COMPILER_VERSION_OUTPUT) - if (COMPILER_VERSION_OUTPUT) - if (COMPILER_VERSION_OUTPUT MATCHES "x86_64") - set(JWASM_FLAGS -win64) - else() - set(JWASM_FLAGS -coff) - endif() - endif() - endif() -endif() - -add_subdirectory(source_subfolder/external/crashpad) diff --git a/recipes/sentry-crashpad/all/conandata.yml b/recipes/sentry-crashpad/all/conandata.yml index f38fb6b1f43168..1eda14320322d2 100644 --- a/recipes/sentry-crashpad/all/conandata.yml +++ b/recipes/sentry-crashpad/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.5.3": + url: "https://github.com/getsentry/sentry-native/releases/download/0.5.3/sentry-native.zip" + sha256: "d9a2434783e558bc9e074518ce155bda129bfa12d376dde939e6a732c92f9757" "0.5.0": url: "https://github.com/getsentry/sentry-native/releases/download/0.5.0/sentry-native.zip" sha256: "1a65767a7c6c368a6dea44125eb268ed8374100f33168829f21df78cbfa8632b" @@ -20,4 +23,5 @@ sources: patches: "0.2.6": - patch_file: "patches/0.2.6-0001-missing-installed-headers.patch" - base_path: "source_subfolder" + patch_description: "Missing installed headers" + patch_type: "portability" diff --git a/recipes/sentry-crashpad/all/conanfile.py b/recipes/sentry-crashpad/all/conanfile.py index 502e2bdfac30ee..04d89296dc4f89 100644 --- a/recipes/sentry-crashpad/all/conanfile.py +++ b/recipes/sentry-crashpad/all/conanfile.py @@ -1,8 +1,14 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.apple import is_apple_os +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import get, apply_conandata_patches, copy, export_conandata_patches, rmdir, rm, replace_in_file +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration + import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.51.3" class SentryCrashpadConan(ConanFile): @@ -26,96 +32,86 @@ class SentryCrashpadConan(ConanFile): } short_paths = True - generators = "cmake" - _cmake = None @property def _is_mingw(self): return self.settings.os == "Windows" and self.settings.compiler == "gcc" - @property - def _build_subfolder(self): - return "build_subfolder" - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _minimum_compilers_version(self): return { - "Visual Studio": "15" if tools.Version(self.version) < "0.4.16" else "16", + "Visual Studio": "15" if Version(self.version) < "0.4.16" else "16", "gcc": "6", "clang": "3.4", "apple-clang": "5.1", } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if self.settings.os not in ("Linux", "Android") or tools.Version(self.version) < "0.4": + if self.settings.os not in ("Linux", "Android") or Version(self.version) < "0.4": del self.options.with_tls def build_requirements(self): if self._is_mingw: - self.build_requires("jwasm/2.13") + self.tool_requires("jwasm/2.13") def requirements(self): - self.requires("zlib/1.2.12") + self.requires("libcurl/7.86.0") + self.requires("zlib/1.2.13") if self.options.get_safe("with_tls"): - self.requires("openssl/1.1.1n") + self.requires("openssl/1.1.1s") def validate(self): if self.settings.compiler.get_safe("cppstd"): # Set as required in crashpad CMake file. # See https://github.com/getsentry/crashpad/blob/71bcaad4cf30294b8de1bfa02064ab629437163b/CMakeLists.txt#L67 - tools.check_min_cppstd(self, 14) + check_min_cppstd(self, 14) minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler), False) if not minimum_version: self.output.warn("Compiler is unknown. Assuming it supports C++14.") - elif tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("Build requires support for C++14. Minimum version for {} is {}" - .format(str(self.settings.compiler), minimum_version)) - if tools.Version(self.version) < "0.4.7" and self.settings.os == "Macos" and self.settings.arch == "armv8": + elif Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"Build requires support for C++14. Minimum version for {self.settings.compiler} is {minimum_version}") + if Version(self.version) < "0.4.7" and self.settings.os == "Macos" and self.settings.arch == "armv8": raise ConanInvalidConfiguration("This version doesn't support ARM compilation") - def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder) + def layout(self): + cmake_layout(self, src_folder="src") - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["CRASHPAD_ENABLE_INSTALL"] = True - self._cmake.definitions["CRASHPAD_ENABLE_INSTALL_DEV"] = True - self._cmake.definitions["CRASHPAD_ZLIB_SYSTEM"] = True + def source(self): + get(self, **self.conan_data["sources"][str(self.version)]) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CRASHPAD_ENABLE_INSTALL"] = True + tc.variables["CRASHPAD_ENABLE_INSTALL_DEV"] = True + tc.variables["CRASHPAD_ZLIB_SYSTEM"] = True + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if tools.Version(self.version) > "0.4": + apply_conandata_patches(self) + if Version(self.version) > "0.4": openssl_repl = "find_package(OpenSSL REQUIRED)" if self.options.get_safe("with_tls") else "" - tools.replace_in_file(os.path.join(self._source_subfolder, "external", "crashpad", "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "external", "crashpad", "CMakeLists.txt"), "find_package(OpenSSL)", openssl_repl) - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder="external/crashpad") cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=os.path.join(self._source_subfolder, "external", "crashpad")) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.configure(build_script_folder="external/crashpad") cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.pdb") + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "crashpad") @@ -126,7 +122,7 @@ def package_info(self): self.cpp_info.components["crashpad_mini_chromium"].libs = ["mini_chromium"] if self.settings.os in ("Linux", "FreeBSD"): self.cpp_info.components["crashpad_mini_chromium"].system_libs.append("pthread") - elif tools.is_apple_os(self.settings.os): + elif is_apple_os(self): self.cpp_info.components["crashpad_mini_chromium"].frameworks = ["CoreFoundation", "Foundation", "Security"] if self.settings.os == "Macos": self.cpp_info.components["crashpad_mini_chromium"].frameworks.extend(["ApplicationServices", "IOKit"]) @@ -137,7 +133,7 @@ def package_info(self): self.cpp_info.components["crashpad_compat"].set_property("cmake_target_name", "crashpad::compat") self.cpp_info.components["crashpad_compat"].includedirs.append(os.path.join("include", "crashpad")) # On Apple crashpad_compat is an interface library - if not tools.is_apple_os(self.settings.os): + if not is_apple_os(self): self.cpp_info.components["crashpad_compat"].libs = ["crashpad_compat"] if self.settings.os in ("Linux", "FreeBSD"): self.cpp_info.components["crashpad_compat"].system_libs.append("dl") @@ -179,7 +175,7 @@ def package_info(self): "crashpad_util", "crashpad_mini_chromium", ] - if tools.Version(self.version) > "0.3": + if Version(self.version) > "0.3": if self.settings.os == "Windows": # getopt self.cpp_info.components["crashpad_getopt"].set_property("cmake_target_name", "crashpad::getopt") @@ -200,7 +196,7 @@ def package_info(self): self.cpp_info.components["crashpad_tools"].libs = ["crashpad_tools"] bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.PATH.append(bin_path) # TODO: to remove in conan v2 once cmake_find_package* generators removed @@ -218,7 +214,7 @@ def package_info(self): self.cpp_info.components["crashpad_snapshot"].names["cmake_find_package_multi"] = "snapshot" self.cpp_info.components["crashpad_minidump"].names["cmake_find_package"] = "minidump" self.cpp_info.components["crashpad_minidump"].names["cmake_find_package_multi"] = "minidump" - if tools.Version(self.version) > "0.3": + if Version(self.version) > "0.3": if self.settings.os == "Windows": self.cpp_info.components["crashpad_getopt"].names["cmake_find_package"] = "getopt" self.cpp_info.components["crashpad_getopt"].names["cmake_find_package_multi"] = "getopt" diff --git a/recipes/sentry-crashpad/all/test_package/CMakeLists.txt b/recipes/sentry-crashpad/all/test_package/CMakeLists.txt index e918f75812c631..b9de1503ca01fb 100644 --- a/recipes/sentry-crashpad/all/test_package/CMakeLists.txt +++ b/recipes/sentry-crashpad/all/test_package/CMakeLists.txt @@ -1,11 +1,9 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package CXX) find_package(crashpad REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE crashpad::client) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/sentry-crashpad/all/test_package/conanfile.py b/recipes/sentry-crashpad/all/test_package/conanfile.py index a8b1104b7289cc..3a9d92c6be51d3 100644 --- a/recipes/sentry-crashpad/all/test_package/conanfile.py +++ b/recipes/sentry-crashpad/all/test_package/conanfile.py @@ -1,10 +1,20 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.files import mkdir +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,10 +22,10 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): + if can_run(self): test_env_dir = "test_env" - tools.mkdir(test_env_dir) - bin_path = os.path.join("bin", "test_package") + mkdir(self, test_env_dir) + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") handler_exe = "crashpad_handler.exe" if self.settings.os == "Windows" else "crashpad_handler" - handler_bin_path = os.path.join(self.deps_cpp_info["sentry-crashpad"].rootpath, "bin", handler_exe) - self.run("%s %s/db %s" % (bin_path, test_env_dir, handler_bin_path), run_environment=True) + handler_bin_path = os.path.join(self.deps_cpp_info["sentry-crashpad"].bin_paths[0], handler_exe) + self.run(f"{bin_path} {test_env_dir} {handler_bin_path}", run_environment=True) diff --git a/recipes/sentry-crashpad/all/test_v1_package/CMakeLists.txt b/recipes/sentry-crashpad/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/sentry-crashpad/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/sentry-crashpad/all/test_v1_package/conanfile.py b/recipes/sentry-crashpad/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..07143b37b946fc --- /dev/null +++ b/recipes/sentry-crashpad/all/test_v1_package/conanfile.py @@ -0,0 +1,23 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +from conan.tools.files import mkdir +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + test_env_dir = "test_env" + mkdir(self, test_env_dir) + bin_path = os.path.join("bin", "test_package") + handler_exe = "crashpad_handler.exe" if self.settings.os == "Windows" else "crashpad_handler" + handler_bin_path = os.path.join(self.deps_cpp_info["sentry-crashpad"].rootpath, "bin", handler_exe) + self.run(f"{bin_path} {test_env_dir} {handler_bin_path}", run_environment=True) diff --git a/recipes/sentry-crashpad/config.yml b/recipes/sentry-crashpad/config.yml index 69f2362e8a2a3a..8b62ee8e2e1d6f 100644 --- a/recipes/sentry-crashpad/config.yml +++ b/recipes/sentry-crashpad/config.yml @@ -1,4 +1,6 @@ versions: + "0.5.3": + folder: all "0.5.0": folder: all "0.4.18": diff --git a/recipes/sentry-native/all/conandata.yml b/recipes/sentry-native/all/conandata.yml index 50a4d6caf333cf..4c206ae279b56c 100644 --- a/recipes/sentry-native/all/conandata.yml +++ b/recipes/sentry-native/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.5.3": + url: "https://github.com/getsentry/sentry-native/releases/download/0.5.3/sentry-native.zip" + sha256: "d9a2434783e558bc9e074518ce155bda129bfa12d376dde939e6a732c92f9757" "0.5.0": url: "https://github.com/getsentry/sentry-native/releases/download/0.5.0/sentry-native.zip" sha256: "1a65767a7c6c368a6dea44125eb268ed8374100f33168829f21df78cbfa8632b" diff --git a/recipes/sentry-native/config.yml b/recipes/sentry-native/config.yml index 69f2362e8a2a3a..8b62ee8e2e1d6f 100644 --- a/recipes/sentry-native/config.yml +++ b/recipes/sentry-native/config.yml @@ -1,4 +1,6 @@ versions: + "0.5.3": + folder: all "0.5.0": folder: all "0.4.18": diff --git a/recipes/sfml/all/conandata.yml b/recipes/sfml/all/conandata.yml index 7ee890396d833d..58f8c7d9b6cc45 100644 --- a/recipes/sfml/all/conandata.yml +++ b/recipes/sfml/all/conandata.yml @@ -5,6 +5,18 @@ sources: patches: "2.5.1": - patch_file: "patches/0001-cmake-robust-find-deps.patch" + patch_description: "Robust discovery of dependencies" + patch_type: "conan" - patch_file: "patches/0002-allow-non-x86-64-macos.patch" + patch_description: "Allow compilation for macOS arm" + patch_type: "portability" - patch_file: "patches/0003-allow-shared-MT.patch" + patch_description: "Allow to build shared SFML with MT runtime" + patch_type: "portability" - patch_file: "patches/0004-fix-ios.patch" + patch_description: "Fix iOS detection logic in CMakeLists" + patch_type: "portability" + - patch_file: "patches/0005-remove-auto-ptr.patch" + patch_description: "Remove usage of auto_ptr to allow compilation with C++17 standard" + patch_type: "portability" + patch_source: "https://github.com/SFML/SFML/commit/bf92efe9a4035fee0258386173d53556aa196e49" diff --git a/recipes/sfml/all/conanfile.py b/recipes/sfml/all/conanfile.py index fbbe0cc38f82f7..32bcab86eaacb1 100644 --- a/recipes/sfml/all/conanfile.py +++ b/recipes/sfml/all/conanfile.py @@ -7,7 +7,7 @@ import os import textwrap -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class SfmlConan(ConanFile): @@ -45,10 +45,7 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") @@ -62,16 +59,16 @@ def requirements(self): self.requires("xorg/system") if self.options.graphics: self.requires("freetype/2.12.1") - self.requires("stb/cci.20210910") + self.requires("stb/cci.20220909") if self.options.audio: self.requires("flac/1.3.3") self.requires("openal/1.22.2") self.requires("vorbis/1.3.7") def validate(self): - if self.info.settings.os not in ["Windows", "Linux", "FreeBSD", "Android", "Macos", "iOS"]: - raise ConanInvalidConfiguration(f"{self.ref} not supported on {self.info.settings.os}") - if self.info.options.graphics and not self.info.options.window: + if self.settings.os not in ["Windows", "Linux", "FreeBSD", "Android", "Macos", "iOS"]: + raise ConanInvalidConfiguration(f"{self.ref} not supported on {self.settings.os}") + if self.options.graphics and not self.options.window: raise ConanInvalidConfiguration("sfml:graphics=True requires sfml:window=True") def source(self): diff --git a/recipes/sfml/all/patches/0005-remove-auto-ptr.patch b/recipes/sfml/all/patches/0005-remove-auto-ptr.patch new file mode 100644 index 00000000000000..63069f1d9cab4a --- /dev/null +++ b/recipes/sfml/all/patches/0005-remove-auto-ptr.patch @@ -0,0 +1,43 @@ +--- a/src/SFML/Audio/AudioDevice.cpp ++++ b/src/SFML/Audio/AudioDevice.cpp +@@ -29,7 +29,7 @@ + #include + #include + #include +-#include ++#include + + + namespace +@@ -107,9 +107,13 @@ bool AudioDevice::isExtensionSupported(const std::string& extension) + // This device will not be used in this function and merely + // makes sure there is a valid OpenAL device for extension + // queries if none has been created yet. +- std::auto_ptr device; ++ // ++ // Using an std::vector for this since auto_ptr is deprecated ++ // and we have no better STL facility for dynamically allocating ++ // a temporary instance with strong exception guarantee. ++ std::vector device; + if (!audioDevice) +- device.reset(new AudioDevice); ++ device.resize(1); + + if ((extension.length() > 2) && (extension.substr(0, 3) == "ALC")) + return alcIsExtensionPresent(audioDevice, extension.c_str()) != AL_FALSE; +@@ -125,9 +129,13 @@ int AudioDevice::getFormatFromChannelCount(unsigned int channelCount) + // This device will not be used in this function and merely + // makes sure there is a valid OpenAL device for format + // queries if none has been created yet. +- std::auto_ptr device; ++ // ++ // Using an std::vector for this since auto_ptr is deprecated ++ // and we have no better STL facility for dynamically allocating ++ // a temporary instance with strong exception guarantee. ++ std::vector device; + if (!audioDevice) +- device.reset(new AudioDevice); ++ device.resize(1); + + // Find the good format according to the number of channels + int format = 0; diff --git a/recipes/sfml/all/test_v1_package/CMakeLists.txt b/recipes/sfml/all/test_v1_package/CMakeLists.txt index 5ac31c943d9c4b..0d20897301b68b 100644 --- a/recipes/sfml/all/test_v1_package/CMakeLists.txt +++ b/recipes/sfml/all/test_v1_package/CMakeLists.txt @@ -1,33 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) - -set(SFML_COMPONENTS system) -set(SFML_TARGETS sfml-system) -if(SFML_WITH_WINDOW) - target_compile_definitions(${PROJECT_NAME} PRIVATE SFML_WITH_WINDOW) - list(APPEND SFML_COMPONENTS window) - list(APPEND SFML_TARGETS sfml-window) -endif() -if(SFML_WITH_GRAPHICS) - target_compile_definitions(${PROJECT_NAME} PRIVATE SFML_WITH_GRAPHICS) - list(APPEND SFML_COMPONENTS graphics) - list(APPEND SFML_TARGETS sfml-graphics) -endif() -if(SFML_WITH_NETWORK) - target_compile_definitions(${PROJECT_NAME} PRIVATE SFML_WITH_NETWORK) - list(APPEND SFML_COMPONENTS network) - list(APPEND SFML_TARGETS sfml-network) -endif() -if(SFML_WITH_AUDIO) - target_compile_definitions(${PROJECT_NAME} PRIVATE SFML_WITH_AUDIO) - list(APPEND SFML_COMPONENTS audio) - list(APPEND SFML_TARGETS sfml-audio) -endif() - -find_package(SFML REQUIRED ${SFML_COMPONENTS} CONFIG) -target_link_libraries(${PROJECT_NAME} PRIVATE ${SFML_TARGETS}) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/shapelib/all/conanfile.py b/recipes/shapelib/all/conanfile.py index a8c64fe9fc8b7a..19059022ab189c 100644 --- a/recipes/shapelib/all/conanfile.py +++ b/recipes/shapelib/all/conanfile.py @@ -1,11 +1,10 @@ import os from conan import ConanFile -from conan.tools.cmake import CMake, CMakeToolchain +from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir -from conan.tools.layout import cmake_layout -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class ShapelibConan(ConanFile): @@ -31,18 +30,9 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.compiler.rm_safe("cppstd") + self.settings.compiler.rm_safe("libcxx") def layout(self): cmake_layout(self, src_folder="src") @@ -51,8 +41,7 @@ def export_sources(self): export_conandata_patches(self) def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/simdutf/all/conandata.yml b/recipes/simdutf/all/conandata.yml index b57774fc543e1a..2c889449b402e3 100644 --- a/recipes/simdutf/all/conandata.yml +++ b/recipes/simdutf/all/conandata.yml @@ -1,4 +1,22 @@ sources: + "3.0.0": + url: "https://github.com/simdutf/simdutf/archive/v3.0.0.tar.gz" + sha256: "cc23b47fd0caf9018fc0dcf49ebeff2676654fff997f9f6ce50fa93cd36f661f" + "2.2.0": + url: "https://github.com/simdutf/simdutf/archive/v2.2.0.tar.gz" + sha256: "b0b8527e194700363cc47e75a7b8d58c88798b0dc31671f5ae5c8803d8678fe6" + "2.1.0": + url: "https://github.com/simdutf/simdutf/archive/v2.1.0.tar.gz" + sha256: "a8a8bbd71c8d8be1f7da16722776988d0640758fe0a46066eb3129868dad08da" + "2.0.9": + url: "https://github.com/simdutf/simdutf/archive/v2.0.9.tar.gz" + sha256: "ff6a19de4c23671e7f1077cf6c0f60bc01197f29c6e4f56fa485c9cd732576ac" + "2.0.8": + url: "https://github.com/simdutf/simdutf/archive/refs/tags/v2.0.8.tar.gz" + sha256: "bd7aa550a8d9a1aba2c0b4eb2088f90c964375b13394f9076f7ba49f51dc40b5" + "2.0.6": + url: "https://github.com/simdutf/simdutf/archive/refs/tags/v2.0.6.tar.gz" + sha256: "40f1f9a4403f81c2c3d736ef9c73662835b2241871caa262fcd654e0898f9e4e" "2.0.3": url: "https://github.com/simdutf/simdutf/archive/refs/tags/v2.0.3.tar.gz" sha256: "076bd07f6fd88c5befba28992cd5a9bf033225c5564d8b88559b8059c3c49cfc" @@ -9,6 +27,33 @@ sources: url: "https://github.com/simdutf/simdutf/archive/refs/tags/v1.0.1.tar.gz" sha256: "e7832ba58fb95fe00de76dbbb2f17d844a7ad02a6f5e3e9e5ce9520e820049a0" patches: + "3.0.0": + - patch_file: "patches/2.0.3-0001-fix-cmake.patch" + patch_description: "remove static build, enable rpath on macOS" + patch_type: "conan" + "2.2.0": + - patch_file: "patches/2.0.3-0001-fix-cmake.patch" + patch_description: "remove static build, enable rpath on macOS" + patch_type: "conan" + "2.1.0": + - patch_file: "patches/2.0.3-0001-fix-cmake.patch" + patch_description: "remove static build, enable rpath on macOS" + patch_type: "conan" + "2.0.9": + - patch_file: "patches/2.0.3-0001-fix-cmake.patch" + patch_description: "remove static build, enable rpath on macOS" + patch_type: "conan" + "2.0.8": + - patch_file: "patches/2.0.3-0001-fix-cmake.patch" + patch_description: "remove static build, enable rpath on macOS" + patch_type: "conan" + "2.0.6": + - patch_file: "patches/2.0.3-0001-fix-cmake.patch" + patch_description: "remove static build, enable rpath on macOS" + patch_type: "conan" + - patch_file: "patches/2.0.6-0002-add-workaround-gcc9.patch" + patch_description: "apply gcc8 workaround to gcc9" + patch_type: "portability" "2.0.3": - patch_file: "patches/2.0.3-0001-fix-cmake.patch" patch_description: "remove static build, enable rpath on macOS" @@ -18,7 +63,8 @@ patches: patch_type: "portability" "2.0.2": - patch_file: "patches/2.0.2-0001-fix-cmake.patch" - patch_description: "remove static build, stop to link static libc++ and enable rpath on macOS" + patch_description: "remove static build, stop to link static libc++ and enable\ + \ rpath on macOS" patch_type: "conan" - patch_file: "patches/2.0.2-0002-add-workaround-gcc9.patch" patch_description: "apply gcc8 workaround to gcc9" diff --git a/recipes/simdutf/all/conanfile.py b/recipes/simdutf/all/conanfile.py index 47c94ebd381ae5..6bdedd0dd5b54c 100644 --- a/recipes/simdutf/all/conanfile.py +++ b/recipes/simdutf/all/conanfile.py @@ -6,7 +6,7 @@ import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class SimdutfConan(ConanFile): name = "simdutf" @@ -38,10 +38,7 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") diff --git a/recipes/simdutf/all/patches/2.0.6-0002-add-workaround-gcc9.patch b/recipes/simdutf/all/patches/2.0.6-0002-add-workaround-gcc9.patch new file mode 100644 index 00000000000000..957a9759ee2fac --- /dev/null +++ b/recipes/simdutf/all/patches/2.0.6-0002-add-workaround-gcc9.patch @@ -0,0 +1,42 @@ +diff --git a/src/icelake/icelake_utf8_common.inl.cpp b/src/icelake/icelake_utf8_common.inl.cpp +index 962700b..a192a18 100644 +--- a/src/icelake/icelake_utf8_common.inl.cpp ++++ b/src/icelake/icelake_utf8_common.inl.cpp +@@ -448,12 +448,12 @@ __m512i prev(__m512i input, __m512i previous) { + static_assert(N<=32, "N must be no larger than 32"); + const __m512i movemask = _mm512_setr_epi32(28,29,30,31,0,1,2,3,4,5,6,7,8,9,10,11); + const __m512i rotated = _mm512_permutex2var_epi32(input, movemask, previous); +-#if SIMDUTF_GCC8 +- constexpr int shift = 16-N; // workaround for GCC8 ++#if SIMDUTF_GCC8 || SIMDUTF_GCC9 ++ constexpr int shift = 16-N; // workaround for GCC8,9 + return _mm512_alignr_epi8(input, rotated, shift); + #else + return _mm512_alignr_epi8(input, rotated, 16-N); +-#endif // SIMDUTF_GCC8 ++#endif // SIMDUTF_GCC8 || SIMDUTF_GCC9 + } + + template +diff --git a/src/simdutf/icelake/intrinsics.h b/src/simdutf/icelake/intrinsics.h +index c71a085..edcd289 100644 +--- a/src/simdutf/icelake/intrinsics.h ++++ b/src/simdutf/icelake/intrinsics.h +@@ -64,7 +64,9 @@ + #if defined(__GNUC__) && !defined(__clang__) + #if __GNUC__ == 8 + #define SIMDUTF_GCC8 1 +-#endif // __GNUC__ == 8 ++#elif __GNUC__ == 9 ++#define SIMDUTF_GCC9 1 ++#endif // __GNUC__ == 8 || __GNUC__ == 9 + #endif // defined(__GNUC__) && !defined(__clang__) + + #if SIMDUTF_GCC8 +@@ -83,4 +85,4 @@ inline __m512i _mm512_set_epi8(uint8_t a0, uint8_t a1, uint8_t a2, uint8_t a3, u + } + #endif // SIMDUTF_GCC8 + +-#endif // SIMDUTF_HASWELL_INTRINSICS_H +\ No newline at end of file ++#endif // SIMDUTF_HASWELL_INTRINSICS_H diff --git a/recipes/simdutf/config.yml b/recipes/simdutf/config.yml index c0918861ce43ef..6f40e329116345 100644 --- a/recipes/simdutf/config.yml +++ b/recipes/simdutf/config.yml @@ -1,4 +1,16 @@ versions: + "3.0.0": + folder: all + "2.2.0": + folder: all + "2.1.0": + folder: all + "2.0.9": + folder: all + "2.0.8": + folder: all + "2.0.6": + folder: all "2.0.3": folder: all "2.0.2": diff --git a/recipes/soundtouch/all/conandata.yml b/recipes/soundtouch/all/conandata.yml new file mode 100644 index 00000000000000..ed99d82ff219bb --- /dev/null +++ b/recipes/soundtouch/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "2.3.2": + url: "https://www.surina.net/soundtouch/soundtouch-2.3.2.tar.gz" + sha256: "3bde8ddbbc3661f04e151f72cf21ca9d8f8c88e265833b65935b8962d12d6b08" diff --git a/recipes/soundtouch/all/conanfile.py b/recipes/soundtouch/all/conanfile.py new file mode 100644 index 00000000000000..dd8ee784980902 --- /dev/null +++ b/recipes/soundtouch/all/conanfile.py @@ -0,0 +1,113 @@ +from conan import ConanFile +from conan.tools.microsoft import is_msvc +from conan.tools.files import get, copy, rm, rmdir +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + + +required_conan_version = ">=1.53.0" + +class SoundTouchConan(ConanFile): + name = "soundtouch" + description = "an open-source audio processing library that allows changing the sound tempo, pitch and playback rate parameters independently" + license = "LGPL-2.1-or-later" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://codeberg.org/soundtouch/soundtouch" + topics = ("audio", "processing", "tempo", "pitch", "playback") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "integer_samples": [True, False], + "with_openmp": [True, False], + "with_dll": [True, False], + "with_util": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "integer_samples": False, + "with_openmp": False, + "with_dll": False, + "with_util": False, + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def 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["INTEGER_SAMPLES"] = self.options.integer_samples + tc.variables["SOUNDTOUCH_DLL"] = self.options.with_dll + tc.variables["SOUNDSTRETCH"] = self.options.with_util + tc.variables["OPENMP"] = self.options.with_openmp + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="COPYING.TXT", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "SoundTouch") + + self.cpp_info.components["_soundtouch"].set_property("cmake_target_name", "SoundTouch::SoundTouch") + self.cpp_info.components["_soundtouch"].set_property("pkg_config_name", "soundtouch") + self.cpp_info.components["_soundtouch"].libs = ["SoundTouch"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["_soundtouch"].system_libs.append("m") + if not self.options.shared and self.options.with_openmp: + openmp_flags = [] + if is_msvc(self): + openmp_flags = ["-openmp"] + elif self.settings.compiler in ("gcc", "clang"): + openmp_flags = ["-fopenmp"] + elif self.settings.compiler == "apple-clang": + openmp_flags = ["-Xpreprocessor", "-fopenmp"] + self.cpp_info.components["_soundtouch"].sharedlinkflags = openmp_flags + self.cpp_info.components["_soundtouch"].exelinkflags = openmp_flags + + if self.options.with_dll: + self.cpp_info.components["SoundTouchDLL"].set_property("cmake_target_name", "SoundTouch::SoundTouchDLL") + self.cpp_info.components["SoundTouchDLL"].libs = ["SoundTouchDLL"] + self.cpp_info.components["SoundTouchDLL"].requires = ["_soundtouch"] + + if self.options.with_util: + bin_path = os.path.join(self.package_folder, "bin") + self.output.info(f"Appending PATH environment variable: {bin_path}") + self.env_info.PATH.append(bin_path) + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "SoundTouch" + self.cpp_info.names["cmake_find_package_multi"] = "SoundTouch" + self.cpp_info.components["_soundtouch"].names["cmake_find_package"] = "SoundTouch" + self.cpp_info.components["_soundtouch"].names["cmake_find_package_multi"] = "SoundTouch" + self.cpp_info.names["pkg_config"] = "SoundTouch" + if self.options.with_dll: + self.cpp_info.components["SoundTouchDLL"].names["cmake_find_package"] = "SoundTouchDLL" + self.cpp_info.components["SoundTouchDLL"].names["cmake_find_package_multi"] = "SoundTouchDLL" + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("mvec") diff --git a/recipes/soundtouch/all/test_package/CMakeLists.txt b/recipes/soundtouch/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..a768ac666be337 --- /dev/null +++ b/recipes/soundtouch/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) + +project(test_package LANGUAGES CXX) + +find_package(SoundTouch REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE SoundTouch::SoundTouch) diff --git a/recipes/soundtouch/all/test_package/conanfile.py b/recipes/soundtouch/all/test_package/conanfile.py new file mode 100644 index 00000000000000..a9fb96656f2039 --- /dev/null +++ b/recipes/soundtouch/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/soundtouch/all/test_package/test_package.cpp b/recipes/soundtouch/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..adcc0038ccd4c9 --- /dev/null +++ b/recipes/soundtouch/all/test_package/test_package.cpp @@ -0,0 +1,17 @@ +#include + +#include "soundtouch/SoundTouch.h" + +int main(int argc, char* argv[]) { + std::cout << "SoundTouch: " << soundtouch::SoundTouch::getVersionString() << "\n"; + + soundtouch::SoundTouch soundTouch; + soundTouch.setRate(0.5); + soundTouch.setTempo(1.5); + soundTouch.setPitch(0.8); + soundTouch.setChannels(2); + + soundTouch.flush(); + + return 0; +} diff --git a/recipes/soundtouch/all/test_v1_package/CMakeLists.txt b/recipes/soundtouch/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/soundtouch/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/soundtouch/all/test_v1_package/conanfile.py b/recipes/soundtouch/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/soundtouch/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/soundtouch/config.yml b/recipes/soundtouch/config.yml new file mode 100644 index 00000000000000..aee8de619ec303 --- /dev/null +++ b/recipes/soundtouch/config.yml @@ -0,0 +1,3 @@ +versions: + "2.3.2": + folder: all diff --git a/recipes/spdlog/all/conanfile.py b/recipes/spdlog/all/conanfile.py index 1921209fd47760..da547548f01b6f 100644 --- a/recipes/spdlog/all/conanfile.py +++ b/recipes/spdlog/all/conanfile.py @@ -1,4 +1,4 @@ -from conan import ConanFile, conan_version +from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout @@ -15,7 +15,7 @@ class SpdlogConan(ConanFile): description = "Fast C++ logging library" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/gabime/spdlog" - topics = ("logging", "log-filtering", "header-only") + topics = ("logger", "logging", "log-filtering", "file sink", "header-only") license = "MIT" settings = "os", "arch", "compiler", "build_type" options = { @@ -63,24 +63,19 @@ def requirements(self): self.requires("fmt/6.0.0", transitive_headers=True) def package_id(self): - if self.options.header_only: + if self.info.options.header_only: self.info.clear() - @property - def _info(self): - # FIXME: Conan 1.x is not able to parse self.info.xxx as Conan 2.x when is header-only - return self if Version(conan_version).major < 2 else self.info - def validate(self): - if self._info.settings.compiler.get_safe("cppstd"): + if self.settings.get_safe("compiler.cppstd"): check_min_cppstd(self, 11) - if self._info.settings.os != "Windows" and (self._info.options.wchar_support or self._info.options.wchar_filenames): + if self.settings.os != "Windows" and (self.options.wchar_support or self.options.wchar_filenames): raise ConanInvalidConfiguration("wchar is only supported under windows") - if self._info.options.get_safe("shared") and is_msvc_static_runtime(self): + if self.options.get_safe("shared") and is_msvc_static_runtime(self): raise ConanInvalidConfiguration("Visual Studio build for shared library with MT runtime is not supported") def source(self): - get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): if not self.options.header_only: @@ -152,8 +147,7 @@ def package_info(self): if self.options.header_only and self.settings.os in ("iOS", "tvOS", "watchOS"): self.cpp_info.components["libspdlog"].defines.append("SPDLOG_NO_TLS") - if Version(conan_version).major < 2: - self.cpp_info.names["cmake_find_package"] = "spdlog" - self.cpp_info.names["cmake_find_package_multi"] = "spdlog" - self.cpp_info.components["libspdlog"].names["cmake_find_package"] = target - self.cpp_info.components["libspdlog"].names["cmake_find_package_multi"] = target + self.cpp_info.names["cmake_find_package"] = "spdlog" + self.cpp_info.names["cmake_find_package_multi"] = "spdlog" + self.cpp_info.components["libspdlog"].names["cmake_find_package"] = target + self.cpp_info.components["libspdlog"].names["cmake_find_package_multi"] = target diff --git a/recipes/spirv-cross/all/conandata.yml b/recipes/spirv-cross/all/conandata.yml index ccac03d97d7f34..5df0322ea02ea5 100644 --- a/recipes/spirv-cross/all/conandata.yml +++ b/recipes/spirv-cross/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.236.0": + url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/refs/tags/sdk-1.3.236.0.tar.gz" + sha256: "8140a2b53d1e218e9be1f8d5e2749b1ebe854d456e5cb356218fd288747d5438" "1.3.231.1": url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/refs/tags/sdk-1.3.231.1.tar.gz" sha256: "3b42f5b6e46b45600e09fd55234f59edb7cfca803e49d7830dc6fb5a086143b1" @@ -42,6 +45,11 @@ sources: url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/2020-04-03.tar.gz" sha256: "93f3a6dfad17c9ca0bf4d2d80809e90118e13b47502eb395baba8784025d7e97" patches: + "1.3.236.0": + - patch_file: "patches/1.3.236.0-0001-fix-gcc5.patch" + patch_description: "Fix compilation with gcc-5" + patch_type: "portability" + base_path: "source_subfolder" "cci.20210621": - patch_file: "patches/0001-fix-bundle-install-cci.20210621.patch" base_path: "source_subfolder" diff --git a/recipes/spirv-cross/all/patches/1.3.236.0-0001-fix-gcc5.patch b/recipes/spirv-cross/all/patches/1.3.236.0-0001-fix-gcc5.patch new file mode 100644 index 00000000000000..70c5857924141d --- /dev/null +++ b/recipes/spirv-cross/all/patches/1.3.236.0-0001-fix-gcc5.patch @@ -0,0 +1,14 @@ +--- a/spirv_glsl.cpp ++++ b/spirv_glsl.cpp +@@ -4955,9 +4955,9 @@ SmallVector CompilerGLSL::get_composite_constant_ids(ConstantID cons + if (is_array(type) || type.basetype == SPIRType::Struct) + return constant->subconstants; + if (is_matrix(type)) +- return constant->m.id; ++ return SmallVector(constant->m.id); + if (is_vector(type)) +- return constant->m.c[0].id; ++ return SmallVector(constant->m.c[0].id); + SPIRV_CROSS_THROW("Unexpected scalar constant!"); + } + if (!const_composite_insert_ids.count(const_id)) diff --git a/recipes/spirv-cross/config.yml b/recipes/spirv-cross/config.yml index 9a1052e813471c..efd74cc767f9fe 100644 --- a/recipes/spirv-cross/config.yml +++ b/recipes/spirv-cross/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.236.0": + folder: all "1.3.231.1": folder: all "1.3.224.0": diff --git a/recipes/spirv-headers/all/conandata.yml b/recipes/spirv-headers/all/conandata.yml index 1e912330b179a3..d22eade00a524d 100644 --- a/recipes/spirv-headers/all/conandata.yml +++ b/recipes/spirv-headers/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.236.0": + url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/sdk-1.3.236.0.tar.gz" + sha256: "4d74c685fdd74469eba7c224dd671a0cb27df45fc9aa43cdd90e53bd4f2b2b78" "1.3.231.1": url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/sdk-1.3.231.1.tar.gz" sha256: "fc340700b005e9a2adc98475b5afbbabd1bc931f789a2afd02d54ebc22522af3" diff --git a/recipes/spirv-headers/config.yml b/recipes/spirv-headers/config.yml index 9b0f71c9afc69a..a72817462daf86 100644 --- a/recipes/spirv-headers/config.yml +++ b/recipes/spirv-headers/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.236.0": + folder: all "1.3.231.1": folder: all "1.3.224.0": diff --git a/recipes/spirv-tools/all/conandata.yml b/recipes/spirv-tools/all/conandata.yml index 444cdf7f3b2fb7..53ccca3d5fe720 100644 --- a/recipes/spirv-tools/all/conandata.yml +++ b/recipes/spirv-tools/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.236.0": + url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/sdk-1.3.236.0.tar.gz" + sha256: "6789c782a8ba8fa127c3d579f9362f0cdde7a9ccc2e8513cdf217bba579dfda9" "1.3.231.1": url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/sdk-1.3.231.1.tar.gz" sha256: "b97df7fdac617878668762ab452ae2ae425a0f36e29711b4cc6c4ae216e32309" diff --git a/recipes/spirv-tools/all/dependencies/dependencies-1.3.236.0.yml b/recipes/spirv-tools/all/dependencies/dependencies-1.3.236.0.yml new file mode 100644 index 00000000000000..f9007ad197d246 --- /dev/null +++ b/recipes/spirv-tools/all/dependencies/dependencies-1.3.236.0.yml @@ -0,0 +1 @@ +spirv-headers: "1.3.236.0" diff --git a/recipes/spirv-tools/config.yml b/recipes/spirv-tools/config.yml index 5ec3ee7c46e2a1..3b316bc9467610 100644 --- a/recipes/spirv-tools/config.yml +++ b/recipes/spirv-tools/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.236.0": + folder: all "1.3.231.1": folder: all "1.3.224.0": diff --git a/recipes/sqlite3/all/conandata.yml b/recipes/sqlite3/all/conandata.yml index 62074c59a652e7..b155ef964565f5 100644 --- a/recipes/sqlite3/all/conandata.yml +++ b/recipes/sqlite3/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.40.1": + url: "https://sqlite.org/2022/sqlite-amalgamation-3400100.zip" + sha256: "49112cc7328392aa4e3e5dae0b2f6736d0153430143d21f69327788ff4efe734" "3.40.0": url: "https://sqlite.org/2022/sqlite-amalgamation-3400000.zip" sha256: "7c23eb51409315738c930a222cf7cd41518ae5823c41e60a81b93a07070ef22a" diff --git a/recipes/sqlite3/config.yml b/recipes/sqlite3/config.yml index 971a8b973abfda..db730ea2013eaf 100644 --- a/recipes/sqlite3/config.yml +++ b/recipes/sqlite3/config.yml @@ -1,4 +1,6 @@ versions: + "3.40.1": + folder: all "3.40.0": folder: all "3.39.4": diff --git a/recipes/sqlite_orm/all/conandata.yml b/recipes/sqlite_orm/all/conandata.yml index b36624badba2f1..2ec409a66f2123 100644 --- a/recipes/sqlite_orm/all/conandata.yml +++ b/recipes/sqlite_orm/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.8": + url: "https://github.com/fnc12/sqlite_orm/archive/v1.8.tar.gz" + sha256: "90893bb0035daf9803ad9e6d45b3e67f48b5515e69ed3a7577feffed7a9f3309" "1.7.1": url: "https://github.com/fnc12/sqlite_orm/archive/refs/tags/v1.7.1.tar.gz" sha256: "dbf58c2d3c5b1efe295d592799edaa1a5dbe9d591a0bfb1abd22a2843a5123e0" diff --git a/recipes/sqlite_orm/config.yml b/recipes/sqlite_orm/config.yml index 5c7010078dd99a..f4a2bdf415db38 100644 --- a/recipes/sqlite_orm/config.yml +++ b/recipes/sqlite_orm/config.yml @@ -1,4 +1,6 @@ versions: + "1.8": + folder: all "1.7.1": folder: all "1.7": diff --git a/recipes/sqlitecpp/all/conandata.yml b/recipes/sqlitecpp/all/conandata.yml index 502fd61cfa7395..ee0a68eaa6f16f 100644 --- a/recipes/sqlitecpp/all/conandata.yml +++ b/recipes/sqlitecpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.2.1": + url: "https://github.com/SRombauts/SQLiteCpp/archive/3.2.1.tar.gz" + sha256: "70c67d5680c47460f82a7abf8e6b0329bf2fb10795a982a6d8abc06adb42d693" "3.2.0": url: "https://github.com/SRombauts/SQLiteCpp/archive/3.2.0.tar.gz" sha256: "57f91ed44ef205fe97b8c6586002fe6031cd02771d1c5d8415d9c515ad1532d1" diff --git a/recipes/sqlitecpp/config.yml b/recipes/sqlitecpp/config.yml index c2f231edab5698..e29442357e51de 100644 --- a/recipes/sqlitecpp/config.yml +++ b/recipes/sqlitecpp/config.yml @@ -1,4 +1,6 @@ versions: + "3.2.1": + folder: all "3.2.0": folder: all "3.1.1": diff --git a/recipes/squirrel/all/CMakeLists.txt b/recipes/squirrel/all/CMakeLists.txt deleted file mode 100644 index 8977c3f43d6f8d..00000000000000 --- a/recipes/squirrel/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/squirrel/all/conandata.yml b/recipes/squirrel/all/conandata.yml index c8c6b8b3282932..05364b18d9da38 100644 --- a/recipes/squirrel/all/conandata.yml +++ b/recipes/squirrel/all/conandata.yml @@ -1,8 +1,16 @@ sources: + "3.2": + url: "https://github.com/albertodemichelis/squirrel/archive/v3.2.tar.gz" + sha256: "02805414cfadd5bbb921891d3599b83375a40650abd6404a8ab407dc5e86a996" "3.1": url: "https://github.com/albertodemichelis/squirrel/archive/v3.1.tar.gz" sha256: "51942b8638a97b673e34ecf3ca50304996fa99bbdbfa7fe93d9744e6769b2f95" patches: + "3.2": + - patch_file: "patches/3.2-fix-cmake-static-build.patch" + patch_description: "fix static build issue" + patch_type: "portability" "3.1": - - patch_file: "patches/fix-cmake-static-shared.patch" - base_path: "source_subfolder" + - patch_file: "patches/3.1-fix-cmake-static-shared.patch" + patch_description: "add flag to switch static/shared builds" + patch_type: "conan" diff --git a/recipes/squirrel/all/conanfile.py b/recipes/squirrel/all/conanfile.py index f7561951403deb..ea393f79ca89fb 100644 --- a/recipes/squirrel/all/conanfile.py +++ b/recipes/squirrel/all/conanfile.py @@ -1,10 +1,12 @@ -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.53.0" class SquirrelConan(ConanFile): name = "squirrel" @@ -12,11 +14,10 @@ class SquirrelConan(ConanFile): "language, designed to be a light-weight scripting language that " \ "fits in the size, memory bandwidth, and real-time requirements " \ "of applications like video games." + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "http://www.squirrel-lang.org/" - license = "MIT" - topics = ("squirrel", "programming-language", "object-oriented", "scripting") - + topics = ("programming-language", "object-oriented", "scripting") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -27,16 +28,8 @@ class SquirrelConan(ConanFile): "fPIC": True, } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -44,42 +37,51 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if tools.Version(self.version) <= "3.1": - if self.settings.os == "Macos": - raise ConanInvalidConfiguration("squirrel 3.1 and earlier does not support Macos") + if Version(self.version) <= "3.1": + if is_apple_os(self): + raise ConanInvalidConfiguration(f"{self.ref} and earlier does not support Macos") if self.settings.compiler == "clang": - compiler_version = tools.Version(self.settings.compiler.version) + compiler_version = Version(self.settings.compiler.version) if compiler_version < "9" or compiler_version >= "11": raise ConanInvalidConfiguration( - f"squirrel 3.1 and earlier does not support Clang {compiler_version}" + f"{self.ref} and earlier does not support Clang {compiler_version}" + ) + if self.settings.compiler == "gcc": + compiler_version = Version(self.settings.compiler.version) + if compiler_version >= "12": + raise ConanInvalidConfiguration( + f"{self.ref} and earlier does not support gcc {compiler_version}" ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["DISABLE_DYNAMIC"] = not self.options.shared - cmake.definitions["DISABLE_STATIC"] = self.options.shared - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["DISABLE_DYNAMIC"] = not self.options.shared + tc.variables["DISABLE_STATIC"] = self.options.shared + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYRIGHT", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="COPYRIGHT", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + def package_info(self): self.cpp_info.set_property("cmake_file_name", "squirrel") # CMakeDeps generator uses the global target if a downstream recipe depends on squirrel globally, @@ -90,20 +92,22 @@ def package_info(self): suffix = "" if self.options.shared else "_static" # squirrel - self.cpp_info.components["libsquirrel"].set_property("cmake_target_name", "squirrel::squirrel{}".format(suffix)) - self.cpp_info.components["libsquirrel"].libs = ["squirrel{}".format(suffix)] + self.cpp_info.components["libsquirrel"].set_property("cmake_target_name", f"squirrel::squirrel{suffix}") + self.cpp_info.components["libsquirrel"].libs = [f"squirrel{suffix}"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["libsquirrel"].system_libs.append("m") # sqstdlib - self.cpp_info.components["sqstdlib"].set_property("cmake_target_name", "squirrel::sqstdlib{}".format(suffix)) - self.cpp_info.components["sqstdlib"].libs = ["sqstdlib{}".format(suffix)] + self.cpp_info.components["sqstdlib"].set_property("cmake_target_name", f"squirrel::sqstdlib{suffix}") + self.cpp_info.components["sqstdlib"].libs = [f"sqstdlib{suffix}"] self.cpp_info.components["sqstdlib"].requires = ["libsquirrel"] binpath = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH env var : {}".format(binpath)) + self.output.info(f"Appending PATH env var : {binpath}") self.env_info.PATH.append(binpath) # TODO: to remove in conan v2 once cmake_find_package_* generators removed - self.cpp_info.components["libsquirrel"].names["cmake_find_package"] = "squirrel{}".format(suffix) - self.cpp_info.components["libsquirrel"].names["cmake_find_package_multi"] = "squirrel{}".format(suffix) - self.cpp_info.components["sqstdlib"].names["cmake_find_package"] = "sqstdlib{}".format(suffix) - self.cpp_info.components["sqstdlib"].names["cmake_find_package_multi"] = "sqstdlib{}".format(suffix) + self.cpp_info.components["libsquirrel"].names["cmake_find_package"] = f"squirrel{suffix}" + self.cpp_info.components["libsquirrel"].names["cmake_find_package_multi"] = f"squirrel{suffix}" + self.cpp_info.components["sqstdlib"].names["cmake_find_package"] = f"sqstdlib{suffix}" + self.cpp_info.components["sqstdlib"].names["cmake_find_package_multi"] = f"sqstdlib{suffix}" diff --git a/recipes/squirrel/all/patches/fix-cmake-static-shared.patch b/recipes/squirrel/all/patches/3.1-fix-cmake-static-shared.patch similarity index 100% rename from recipes/squirrel/all/patches/fix-cmake-static-shared.patch rename to recipes/squirrel/all/patches/3.1-fix-cmake-static-shared.patch diff --git a/recipes/squirrel/all/patches/3.2-fix-cmake-static-build.patch b/recipes/squirrel/all/patches/3.2-fix-cmake-static-build.patch new file mode 100644 index 00000000000000..95706b31330730 --- /dev/null +++ b/recipes/squirrel/all/patches/3.2-fix-cmake-static-build.patch @@ -0,0 +1,13 @@ +diff --git a/sq/CMakeLists.txt b/sq/CMakeLists.txt +index bdea07d..f7629a3 100644 +--- a/sq/CMakeLists.txt ++++ b/sq/CMakeLists.txt +@@ -15,7 +15,7 @@ endif() + + if(NOT DISABLE_STATIC) + add_executable(sq_static sq.c) +- add_executable(squirrel::interpreter_static ALIAS sq) ++ add_executable(squirrel::interpreter_static ALIAS sq_static) + set_target_properties(sq_static PROPERTIES LINKER_LANGUAGE C EXPORT_NAME interpreter_static) + target_link_libraries(sq_static squirrel_static sqstdlib_static) + if(NOT SQ_DISABLE_INSTALLER) diff --git a/recipes/squirrel/all/test_package/CMakeLists.txt b/recipes/squirrel/all/test_package/CMakeLists.txt index 503b882c67cec4..13a7e10ca59c7b 100644 --- a/recipes/squirrel/all/test_package/CMakeLists.txt +++ b/recipes/squirrel/all/test_package/CMakeLists.txt @@ -1,15 +1,12 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(squirrel REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) if(TARGET squirrel::squirrel_static) - target_link_libraries(${PROJECT_NAME} squirrel::squirrel_static squirrel::sqstdlib_static) + target_link_libraries(${PROJECT_NAME} PRIVATE squirrel::squirrel_static squirrel::sqstdlib_static) else() - target_link_libraries(${PROJECT_NAME} squirrel::squirrel squirrel::sqstdlib) + target_link_libraries(${PROJECT_NAME} PRIVATE squirrel::squirrel squirrel::sqstdlib) endif() diff --git a/recipes/squirrel/all/test_package/conanfile.py b/recipes/squirrel/all/test_package/conanfile.py index 38f4483872d47f..a9fb96656f2039 100644 --- a/recipes/squirrel/all/test_package/conanfile.py +++ b/recipes/squirrel/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/squirrel/all/test_v1_package/CMakeLists.txt b/recipes/squirrel/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/squirrel/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/squirrel/all/test_v1_package/conanfile.py b/recipes/squirrel/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/squirrel/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/squirrel/config.yml b/recipes/squirrel/config.yml index 992d10eb37c116..02e8efce1632dc 100644 --- a/recipes/squirrel/config.yml +++ b/recipes/squirrel/config.yml @@ -1,3 +1,5 @@ versions: + "3.2": + folder: all "3.1": folder: all diff --git a/recipes/stduuid/all/conanfile.py b/recipes/stduuid/all/conanfile.py index 7e795945780f3c..395e1f628efd79 100644 --- a/recipes/stduuid/all/conanfile.py +++ b/recipes/stduuid/all/conanfile.py @@ -1,9 +1,13 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration -from conans.tools import Version +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.50.0" + class StduuidConan(ConanFile): name = "stduuid" @@ -12,7 +16,7 @@ class StduuidConan(ConanFile): license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/mariusbancila/stduuid" - settings = "os", "compiler" + settings = "os", "arch", "compiler", "build_type" options = { "with_cxx20_span": [True, False], } @@ -22,43 +26,54 @@ class StduuidConan(ConanFile): no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "20" if self.options.with_cxx20_span else "17" + + @property + def _compilers_minimum_version(self): + return { + "apple-clang": "10", + "clang": "5", + "gcc": "7", + "msvc": "191", + "Visual Studio": "15", + } + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if not self.options.with_cxx20_span: - self.requires("ms-gsl/2.0.0") - if self.settings.os == "Linux" and tools.Version(self.version) <= "1.0": - self.requires("libuuid/1.0.3") + self.requires("ms-gsl/3.1.0", transitive_headers=True) + if self.settings.os == "Linux" and Version(self.version) <= "1.0": + self.requires("libuuid/1.0.3", transitive_headers=True, transitive_libs=True) def package_id(self): - self.info.header_only() + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppsd"): + check_min_cppstd(self, self._min_cppstd) + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def validate(self): - version = Version(self.settings.compiler.version) - compiler = self.settings.compiler - if self.settings.compiler.cppstd and \ - not any([str(self.settings.compiler.cppstd) == std for std in ["17", "20", "gnu17", "gnu20"]]): - raise ConanInvalidConfiguration("stduuid requires at least c++17") - elif compiler == "Visual Studio"and version < "15": - raise ConanInvalidConfiguration("stduuid requires at least Visual Studio version 15") - else: - if ( compiler == "gcc" and version < "7" ) or ( compiler == "clang" and version < "5" ): - raise ConanInvalidConfiguration("stduuid requires a compiler that supports at least C++17") - elif compiler == "apple-clang"and version < "10": - raise ConanInvalidConfiguration("stduuid requires a compiler that supports at least C++17") + def build(self): + pass def package(self): - root_dir = self._source_subfolder - include_dir = os.path.join(root_dir, "include") - self.copy(pattern="LICENSE", dst="licenses", src=root_dir) - self.copy(pattern="uuid.h", dst="include", src=include_dir) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "uuid.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] if not self.options.with_cxx20_span: - self.cpp_info.includedirs.append(os.path.join(self.deps_cpp_info["ms-gsl"].include_paths[0], "gsl")) - + self.cpp_info.includedirs.append(os.path.join(self.dependencies["ms-gsl"].cpp_info.includedirs[0], "gsl")) diff --git a/recipes/stduuid/all/test_package/CMakeLists.txt b/recipes/stduuid/all/test_package/CMakeLists.txt index 74fdb7fc706352..f8d4ca0bfacfce 100644 --- a/recipes/stduuid/all/test_package/CMakeLists.txt +++ b/recipes/stduuid/all/test_package/CMakeLists.txt @@ -1,11 +1,11 @@ -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(stduuid REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} stduuid::stduuid) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) +target_link_libraries(${PROJECT_NAME} PRIVATE stduuid::stduuid) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +if(stduuid_VERSION VERSION_LESS "1.1") + target_compile_definitions(${PROJECT_NAME} PRIVATE STDUUID_LT_1_1) +endif() diff --git a/recipes/stduuid/all/test_package/conanfile.py b/recipes/stduuid/all/test_package/conanfile.py index 28dd8e80613678..98ab55852ad565 100644 --- a/recipes/stduuid/all/test_package/conanfile.py +++ b/recipes/stduuid/all/test_package/conanfile.py @@ -1,9 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os + class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.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/stduuid/all/test_package/test_package.cpp b/recipes/stduuid/all/test_package/test_package.cpp index 91cbc9798c5e33..160cf9b5db82a4 100644 --- a/recipes/stduuid/all/test_package/test_package.cpp +++ b/recipes/stduuid/all/test_package/test_package.cpp @@ -1,15 +1,20 @@ -#include -#include - -#include "uuid.h" +#include -using namespace std::string_literals; +#include +#include +#include +#include +#include int main() { { - auto str = "47183823-2574-4bfd-b411-99ed177d3e43"s; + auto str = "47183823-2574-4bfd-b411-99ed177d3e43"; auto guid = uuids::uuid::from_string(str); +#ifdef STDUUID_LT_1_1 assert(uuids::to_string(guid) == str); +#else + assert(uuids::to_string(guid.value()) == str); +#endif } { @@ -21,7 +26,11 @@ int main() { uuids::uuid const guid = uuids::uuid_random_generator{generator}(); assert(!guid.is_nil()); +#ifdef STDUUID_LT_1_1 assert(guid.size() == 16); +#else + assert(guid.as_bytes().size() == 16); +#endif assert(guid.version() == uuids::uuid_version::random_number_based); assert(guid.variant() == uuids::uuid_variant::rfc); } diff --git a/recipes/stduuid/all/test_v1_package/CMakeLists.txt b/recipes/stduuid/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/stduuid/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/stduuid/all/test_v1_package/conanfile.py b/recipes/stduuid/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/stduuid/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/strong_type/all/conandata.yml b/recipes/strong_type/all/conandata.yml new file mode 100644 index 00000000000000..dc0617a7a142bc --- /dev/null +++ b/recipes/strong_type/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "v7": + url: https://github.com/rollbear/strong_type/archive/refs/tags/v7.tar.gz + sha256: 854365b28dfaaee5c2047dd4d2e746c809b76035191b22a4ce24f4cac49d0891 + "v8": + url: https://github.com/rollbear/strong_type/archive/refs/tags/v8.tar.gz + sha256: 31ee68e097fec2ce65dbf2ed683911c5ee6a7a37808b28d84479ef7e17990fad diff --git a/recipes/strong_type/all/conanfile.py b/recipes/strong_type/all/conanfile.py new file mode 100644 index 00000000000000..70093f14d533d3 --- /dev/null +++ b/recipes/strong_type/all/conanfile.py @@ -0,0 +1,60 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.50.0" + + +class StrongTypeConan(ConanFile): + name = "strong_type" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/rollbear/strong_type" + description = "An additive strong typedef library for C++14/17/20" + topics = ("cpp14", "cpp17", "strong_type") + license = "BSL-1.0" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 14) + + def layout(self): + basic_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass + + def package(self): + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "strong_type") + self.cpp_info.set_property("cmake_target_name", "rollbear::strong_type") + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + + # TODO: to remove in conan v2 once cmake_find_package* generators removed + self.cpp_info.filenames["cmake_find_package"] = "strong_type" + self.cpp_info.filenames["cmake_find_package_multi"] = "strong_type" + self.cpp_info.names["cmake_find_package"] = "rollbear" + self.cpp_info.names["cmake_find_package_multi"] = "rollbear" + self.cpp_info.components["strong_type"].names["cmake_find_package"] = "strong_type" + self.cpp_info.components["strong_type"].names["cmake_find_package_multi"] = "strong_type" + self.cpp_info.components["strong_type"].set_property("cmake_target_name", "rollbear::strong_type") + self.cpp_info.components["strong_type"].bindirs = [] + self.cpp_info.components["strong_type"].frameworkdirs = [] + self.cpp_info.components["strong_type"].libdirs = [] + self.cpp_info.components["strong_type"].resdirs = [] diff --git a/recipes/strong_type/all/test_package/CMakeLists.txt b/recipes/strong_type/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..d668b94ccc7767 --- /dev/null +++ b/recipes/strong_type/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(strong_type REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE rollbear::strong_type) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/strong_type/all/test_package/conanfile.py b/recipes/strong_type/all/test_package/conanfile.py new file mode 100644 index 00000000000000..d120a992c06a69 --- /dev/null +++ b/recipes/strong_type/all/test_package/conanfile.py @@ -0,0 +1,25 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/strong_type/all/test_package/test_package.cpp b/recipes/strong_type/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..b48e03ab7f9a51 --- /dev/null +++ b/recipes/strong_type/all/test_package/test_package.cpp @@ -0,0 +1,11 @@ +#include + + +int main() { + using myint = strong::type; + + if (value_of(myint{3}) == 3) + return 0; + + return 1; +} diff --git a/recipes/strong_type/all/test_v1_package/CMakeLists.txt b/recipes/strong_type/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..16903060128893 --- /dev/null +++ b/recipes/strong_type/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(strong_type REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE rollbear::strong_type) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/strong_type/all/test_v1_package/conanfile.py b/recipes/strong_type/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..a500b98343c743 --- /dev/null +++ b/recipes/strong_type/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +from conans import ConanFile, CMake, tools +import os + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/strong_type/config.yml b/recipes/strong_type/config.yml new file mode 100644 index 00000000000000..24ded6bddb75a9 --- /dev/null +++ b/recipes/strong_type/config.yml @@ -0,0 +1,5 @@ +versions: + "v7": + folder: all + "v8": + folder: all diff --git a/recipes/taglib/all/conandata.yml b/recipes/taglib/all/conandata.yml index fff234108d27d7..af90af9573848d 100644 --- a/recipes/taglib/all/conandata.yml +++ b/recipes/taglib/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.13": + url: "https://taglib.org/releases/taglib-1.13.tar.gz" + sha256: "58f08b4db3dc31ed152c04896ee9172d22052bc7ef12888028c01d8b1d60ade0" "1.12": url: "https://taglib.org/releases/taglib-1.12.tar.gz" sha256: "7fccd07669a523b07a15bd24c8da1bbb92206cb19e9366c3692af3d79253b703" diff --git a/recipes/taglib/all/conanfile.py b/recipes/taglib/all/conanfile.py index bcd918cd048cbc..f0f89efb0ca060 100644 --- a/recipes/taglib/all/conanfile.py +++ b/recipes/taglib/all/conanfile.py @@ -1,6 +1,7 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.scm import Version from conans import tools as tools_legacy import os @@ -68,7 +69,10 @@ def _patch_sources(self): os.path.join(self.source_folder, "taglib", "CMakeLists.txt"), os.path.join(self.source_folder, "bindings", "c", "CMakeLists.txt"), ]: - replace_in_file(self, cmakelists, "INSTALL_NAME_DIR ${LIB_INSTALL_DIR}", "") + if Version(self.version) >= "1.13": + replace_in_file(self, cmakelists, "INSTALL_NAME_DIR ${CMAKE_INSTALL_LIBDIR}", "") + else: + replace_in_file(self, cmakelists, "INSTALL_NAME_DIR ${LIB_INSTALL_DIR}", "") def build(self): self._patch_sources() diff --git a/recipes/taglib/config.yml b/recipes/taglib/config.yml index d99e3416a26b31..c171123076114d 100644 --- a/recipes/taglib/config.yml +++ b/recipes/taglib/config.yml @@ -1,3 +1,5 @@ versions: + "1.13": + folder: all "1.12": folder: all diff --git a/recipes/taskflow/all/conandata.yml b/recipes/taskflow/all/conandata.yml index f71b5ca0498029..8b83234e329cad 100644 --- a/recipes/taskflow/all/conandata.yml +++ b/recipes/taskflow/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.5.0": + url: "https://github.com/taskflow/taskflow/archive/v3.5.0.tar.gz" + sha256: "33c44e0da7dfda694d2b431724d6c8fd25a889ad0afbb4a32e8da82e2e9c2a92" "3.4.0": url: "https://github.com/taskflow/taskflow/archive/v3.4.0.tar.gz" sha256: "8f449137d3f642b43e905aeacdf1d7c5365037d5e1586103ed4f459f87cecf89" @@ -25,5 +28,6 @@ sources: sha256: "B7016EE3486458AE401D521EA6BC0403DDE975828038B9734621A6A325ACAC1A" patches: "3.3.0": - - base_path: "source_subfolder" - patch_file: "patches/3.3.0-immintrin-guard.patch" + - patch_file: "patches/3.3.0-immintrin-guard.patch" + patch_description: "add condition to check IA architecture" + patch_type: "portability" diff --git a/recipes/taskflow/all/conanfile.py b/recipes/taskflow/all/conanfile.py index 22d7e5ff5dc15a..ec7156468a8946 100644 --- a/recipes/taskflow/all/conanfile.py +++ b/recipes/taskflow/all/conanfile.py @@ -1,9 +1,14 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +from conan.tools.layout import basic_layout from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" + class TaskflowConan(ConanFile): name = "taskflow" @@ -14,69 +19,70 @@ class TaskflowConan(ConanFile): license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/taskflow/taskflow" - topics = ("taskflow", "tasking", "parallelism") + topics = ("tasking", "parallelism") settings = "os", "arch", "compiler", "build_type" short_paths = True - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _min_cppstd(self): - if tools.Version(self.version) >= "3.0.0": + if Version(self.version) >= "3.0.0": return "17" return "14" @property - def _minimum_compiler_version(self): + def _compilers_minimum_version(self): return { "17": { "Visual Studio": "16", "gcc": "7.3", "clang": "6.0", - "apple-clang": "10.0" + "apple-clang": "10.0", }, "14": { "Visual Studio": "15", "gcc": "5", "clang": "4.0", - "apple-clang": "8.0" + "apple-clang": "8.0", }, }[self._min_cppstd] def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() 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) + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] - min_version = self._minimum_compiler_version.get(str(self.settings.compiler)) - if min_version and tools.Version(self.settings.compiler.version) < min_version: + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): raise ConanInvalidConfiguration( - "{} requires a compiler that supports at least C++{}".format( - self.name, self._min_cppstd, - ) + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", ) - def package_id(self): - self.info.header_only() - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*", - dst=os.path.join("include", "taskflow"), - src=os.path.join(self._source_subfolder, "taskflow")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", + src=os.path.join(self.source_folder, "taskflow"), + dst=os.path.join(self.package_folder, "include", "taskflow")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "Taskflow") diff --git a/recipes/taskflow/all/test_package/CMakeLists.txt b/recipes/taskflow/all/test_package/CMakeLists.txt index 8d676c82745c67..1f7019bf5d65ad 100644 --- a/recipes/taskflow/all/test_package/CMakeLists.txt +++ b/recipes/taskflow/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(Taskflow REQUIRED CONFIG) @@ -13,4 +10,4 @@ endif() add_executable(${PROJECT_NAME} test_package.cpp) target_compile_features(${PROJECT_NAME} PRIVATE ${_CXX_STANDARD}) -target_link_libraries(${PROJECT_NAME} Taskflow::Taskflow) +target_link_libraries(${PROJECT_NAME} PRIVATE Taskflow::Taskflow) diff --git a/recipes/taskflow/all/test_package/conanfile.py b/recipes/taskflow/all/test_package/conanfile.py index a1e008e568f839..e845ae751a3017 100644 --- a/recipes/taskflow/all/test_package/conanfile.py +++ b/recipes/taskflow/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, tools, CMake - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/taskflow/all/test_v1_package/CMakeLists.txt b/recipes/taskflow/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/taskflow/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/taskflow/all/test_v1_package/conanfile.py b/recipes/taskflow/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..94b8dc83beff46 --- /dev/null +++ b/recipes/taskflow/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, tools, 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.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/taskflow/config.yml b/recipes/taskflow/config.yml index 943da98e3a4e48..bd7fbbad854e3f 100644 --- a/recipes/taskflow/config.yml +++ b/recipes/taskflow/config.yml @@ -1,4 +1,6 @@ versions: + "3.5.0": + folder: all "3.4.0": folder: all "3.3.0": diff --git a/recipes/taywee-args/all/conandata.yml b/recipes/taywee-args/all/conandata.yml index 50dde225215bef..0a92d5f6ec7c08 100644 --- a/recipes/taywee-args/all/conandata.yml +++ b/recipes/taywee-args/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "6.4.4": + url: "https://github.com/Taywee/args/archive/6.4.4.tar.gz" + sha256: "7dca5e33148984cf701580324846c6557990a826bd1ab7a97ccdd6d0e486302f" "6.4.2": url: "https://github.com/Taywee/args/archive/6.4.2.tar.gz" sha256: "882adaf179471edf0ac468bab67a0ee53979e4efe91fe4992d5b38422067dd85" diff --git a/recipes/taywee-args/config.yml b/recipes/taywee-args/config.yml index 9c5be1f93b4292..9525359795e196 100644 --- a/recipes/taywee-args/config.yml +++ b/recipes/taywee-args/config.yml @@ -1,4 +1,6 @@ versions: + "6.4.4": + folder: all "6.4.2": folder: all "6.4.1": diff --git a/recipes/tgbot/all/conandata.yml b/recipes/tgbot/all/conandata.yml index 2d22eb0d1c3137..054b04f19ea354 100644 --- a/recipes/tgbot/all/conandata.yml +++ b/recipes/tgbot/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.5": + url: "https://github.com/reo7sp/tgbot-cpp/archive/v1.5.tar.gz" + sha256: "ecd5a21ea45b890828aba1639ac49401cfdd5b30f791322cb1ba84c9ac77647c" "1.3": url: "https://github.com/reo7sp/tgbot-cpp/archive/v1.3.tar.gz" sha256: "85b9aef49c595d39fc9dc330b1b83625bea9509966dc623f7b4c1ee7309679c9" diff --git a/recipes/tgbot/config.yml b/recipes/tgbot/config.yml index c7e8d9bb1b5d20..220c83c443cebe 100644 --- a/recipes/tgbot/config.yml +++ b/recipes/tgbot/config.yml @@ -1,4 +1,6 @@ versions: + "1.5": + folder: all "1.3": folder: all "1.2.1": diff --git a/recipes/threadpool/all/conandata.yml b/recipes/threadpool/all/conandata.yml index 1166e9a506472c..7e760f1f742837 100644 --- a/recipes/threadpool/all/conandata.yml +++ b/recipes/threadpool/all/conandata.yml @@ -1,4 +1,4 @@ sources: "20140926": - url: "https://github.com/progschj/ThreadPool/archive/9a42ec1.zip" - sha256: "18854bb7ecc1fc9d7dda9c798a1ef0c81c2dd331d730c76c75f648189fa0c20f" + url: "https://github.com/progschj/ThreadPool/archive/9a42ec1329f259a5f4881a291db1dcb8f2ad9040.tar.gz" + sha256: "954e0ecdac1aa0da1e0fa78577ff0d352e53094df43762fbc1884f76a7e1dcd2" diff --git a/recipes/threadpool/all/conanfile.py b/recipes/threadpool/all/conanfile.py index a0dde5830cc286..ad1dad9d756888 100644 --- a/recipes/threadpool/all/conanfile.py +++ b/recipes/threadpool/all/conanfile.py @@ -1,35 +1,50 @@ +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 -from conans import ConanFile, tools -class threadpoolConan(ConanFile): +required_conan_version = ">=1.50.0" + + +class ThreadpoolConan(ConanFile): name = "threadpool" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/progschj/ThreadPool" description = "A simple C++11 Thread Pool implementation." license = "Zlib" - topics = ("C++11", "Thread", "Pool", "threadpool", "conan") - settings = "os", "compiler" + topics = ("c++11", "thread", "pool") + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - listdir = os.listdir() - extracted_dir = [i for i in listdir if "ThreadPool" in i][0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def package(self): - self.copy(pattern="COPYING", src=self._source_subfolder, dst="licenses", ) - self.copy(pattern="*.h", src=self._source_subfolder, dst=os.path.join("include", "ThreadPool")) + def build(self): + pass - def package_id(self): - self.info.header_only() + def package(self): + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include", "ThreadPool")) def package_info(self): - if self.settings.os == "Linux": + self.cpp_info.bindirs = [] + self.cpp_info.includedirs.append(os.path.join("include", "ThreadPool")) + self.cpp_info.libdirs = [] + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread"] + + # TODO: to remove in conan v2 (and do not port to CMakeDeps, it was a mistake) self.cpp_info.names["cmake_find_package"] = "ThreadPool" self.cpp_info.names["cmake_find_package_multi"] = "ThreadPool" diff --git a/recipes/threadpool/all/test_package/CMakeLists.txt b/recipes/threadpool/all/test_package/CMakeLists.txt index 829b5ca81b9ceb..700241bb74acba 100644 --- a/recipes/threadpool/all/test_package/CMakeLists.txt +++ b/recipes/threadpool/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(threadpool REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE threadpool::threadpool) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/threadpool/all/test_package/conanfile.py b/recipes/threadpool/all/test_package/conanfile.py index 4903f1a7e8fa0f..98ab55852ad565 100644 --- a/recipes/threadpool/all/test_package/conanfile.py +++ b/recipes/threadpool/all/test_package/conanfile.py @@ -1,9 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/threadpool/all/test_package/test_package.cpp b/recipes/threadpool/all/test_package/test_package.cpp index 87d978d5128099..02e175532d6cef 100644 --- a/recipes/threadpool/all/test_package/test_package.cpp +++ b/recipes/threadpool/all/test_package/test_package.cpp @@ -1,5 +1,5 @@ #include -#include +#include int main(void) { diff --git a/recipes/threadpool/all/test_v1_package/CMakeLists.txt b/recipes/threadpool/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..338ffbb0c05f33 --- /dev/null +++ b/recipes/threadpool/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(ThreadPool REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE ThreadPool::ThreadPool) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/threadpool/all/test_v1_package/conanfile.py b/recipes/threadpool/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/threadpool/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/threadpool/config.yml b/recipes/threadpool/config.yml index 123172e94fde9f..3722466e546d50 100644 --- a/recipes/threadpool/config.yml +++ b/recipes/threadpool/config.yml @@ -1,3 +1,3 @@ versions: - "20140926": - folder: all + "20140926": + folder: all diff --git a/recipes/tinygltf/all/conandata.yml b/recipes/tinygltf/all/conandata.yml index 4dccec0d384aa6..0e07d04c2de591 100644 --- a/recipes/tinygltf/all/conandata.yml +++ b/recipes/tinygltf/all/conandata.yml @@ -1,10 +1,10 @@ sources: - "2.2.0": - url: "https://github.com/syoyo/tinygltf/archive/v2.2.0.tar.gz" - sha256: "2d6950c76eba11214bf068b2a569d69c84ae35860a42fcde1aa1c8ad143f351d" - "2.4.0": - url: "https://github.com/syoyo/tinygltf/archive/v2.4.0.tar.gz" - sha256: "8c4d9efac544c5471d672dfd52842cb93df45b1a4c8f91e38487db4a0e500d70" "2.5.0": url: "https://github.com/syoyo/tinygltf/archive/v2.5.0.tar.gz" sha256: "5d85bd556b60b1b69527189293cfa4902957d67fabb8582b6532f23a5ef27ec1" + "2.4.0": + url: "https://github.com/syoyo/tinygltf/archive/v2.4.0.tar.gz" + sha256: "8c4d9efac544c5471d672dfd52842cb93df45b1a4c8f91e38487db4a0e500d70" + "2.2.0": + url: "https://github.com/syoyo/tinygltf/archive/v2.2.0.tar.gz" + sha256: "2d6950c76eba11214bf068b2a569d69c84ae35860a42fcde1aa1c8ad143f351d" diff --git a/recipes/tinygltf/all/conanfile.py b/recipes/tinygltf/all/conanfile.py index a85c90f80392a5..1d6e2279c26804 100644 --- a/recipes/tinygltf/all/conanfile.py +++ b/recipes/tinygltf/all/conanfile.py @@ -1,16 +1,21 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get, replace_in_file +from conan.tools.layout import basic_layout import os -from conans import ConanFile, tools +required_conan_version = ">=1.51.1" + class TinygltfConan(ConanFile): name = "tinygltf" description = "Header only C++11 tiny glTF 2.0 library." license = "MIT" - topics = ("conan", "tinygltf", "gltf") + topics = ("gltf") homepage = "https://github.com/syoyo/tinygltf" url = "https://github.com/conan-io/conan-center-index" - settings = "compiler" - no_copy_source = True + + settings = "os", "arch", "compiler", "build_type" options = { "draco": [True, False], "stb_image": [True, False], @@ -19,44 +24,51 @@ class TinygltfConan(ConanFile): default_options = { "draco": False, "stb_image": True, - "stb_image_write": True + "stb_image_write": True, } - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") - def configure(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + def package_id(self): + self.info.clear() def requirements(self): - self.requires("nlohmann_json/3.9.1") + self.requires("nlohmann_json/3.11.2") if self.options.draco: - self.requires("draco/1.3.6") + self.requires("draco/1.5.5") if self.options.stb_image or self.options.stb_image_write: - self.requires("stb/20200203") + self.requires("stb/cci.20210910") - def package_id(self): - self.info.header_only() + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename(self.name + "-" + self.version, self._source_subfolder) - tools.replace_in_file(os.path.join(self._source_subfolder, "tiny_gltf.h"), + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + replace_in_file(self, os.path.join(self.source_folder, "tiny_gltf.h"), "#include \"json.hpp\"", "#include ") def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("tiny_gltf.h", dst="include", src=os.path.join(self.source_folder, self._source_subfolder)) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "tiny_gltf.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "TinyGLTF" - self.cpp_info.names["cmake_find_package_multi"] = "TinyGLTF" + self.cpp_info.set_property("cmake_file_name", "TinyGLTF") + self.cpp_info.set_property("cmake_target_name", "TinyGLTF::TinyGLTF") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] if self.options.draco: self.cpp_info.defines.append("TINYGLTF_ENABLE_DRACO") if not self.options.stb_image: self.cpp_info.defines.append("TINYGLTF_NO_STB_IMAGE") if not self.options.stb_image_write: self.cpp_info.defines.append("TINYGLTF_NO_STB_IMAGE_WRITE") + + # TODO: to remove in conan v2 + self.cpp_info.names["cmake_find_package"] = "TinyGLTF" + self.cpp_info.names["cmake_find_package_multi"] = "TinyGLTF" diff --git a/recipes/tinygltf/all/test_package/CMakeLists.txt b/recipes/tinygltf/all/test_package/CMakeLists.txt index 33ae887aa6aea3..687cf3cb6de806 100644 --- a/recipes/tinygltf/all/test_package/CMakeLists.txt +++ b/recipes/tinygltf/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(TinyGLTF 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 TinyGLTF::TinyGLTF) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/tinygltf/all/test_package/conanfile.py b/recipes/tinygltf/all/test_package/conanfile.py index 606ee08407413b..0708ee77c38508 100644 --- a/recipes/tinygltf/all/test_package/conanfile.py +++ b/recipes/tinygltf/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") glb_path = os.path.join(self.source_folder, "box01.glb") - bin_path = os.path.join("bin", "test_package") - self.run("{0} {1}".format(bin_path, glb_path), run_environment=True) + self.run(f"{bin_path} {glb_path}", env="conanrun") diff --git a/recipes/tinygltf/all/test_v1_package/CMakeLists.txt b/recipes/tinygltf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/tinygltf/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/tinygltf/all/test_v1_package/conanfile.py b/recipes/tinygltf/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..6d85d0b397c56c --- /dev/null +++ b/recipes/tinygltf/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + glb_path = os.path.join(self.source_folder, os.pardir, "test_package", "box01.glb") + self.run(f"{bin_path} {glb_path}", run_environment=True) diff --git a/recipes/tinygltf/config.yml b/recipes/tinygltf/config.yml index a11de5107db48b..a23d2b23eb4395 100644 --- a/recipes/tinygltf/config.yml +++ b/recipes/tinygltf/config.yml @@ -1,7 +1,7 @@ versions: - "2.2.0": + "2.5.0": folder: all "2.4.0": folder: all - "2.5.0": + "2.2.0": folder: all diff --git a/recipes/tsl-ordered-map/all/conandata.yml b/recipes/tsl-ordered-map/all/conandata.yml index 85051743065ccd..50a0714a45e066 100644 --- a/recipes/tsl-ordered-map/all/conandata.yml +++ b/recipes/tsl-ordered-map/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.1.0": + url: "https://github.com/Tessil/ordered-map/archive/v1.1.0.tar.gz" + sha256: "d6070502351646d68f2bbe6078c0da361bc1db733ee8a392e33cfb8b31183e28" "1.0.0": url: "https://github.com/Tessil/ordered-map/archive/v1.0.0.tar.gz" sha256: "49cd436b8bdacb01d5f4afd7aab0c0d6fa57433dfc29d65f08a5f1ed1e2af26b" diff --git a/recipes/tsl-ordered-map/all/test_v1_package/CMakeLists.txt b/recipes/tsl-ordered-map/all/test_v1_package/CMakeLists.txt index 843a031b132e48..be00a8c7f57c71 100644 --- a/recipes/tsl-ordered-map/all/test_v1_package/CMakeLists.txt +++ b/recipes/tsl-ordered-map/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(tsl-ordered-map REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE tsl::ordered_map) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/tsl-ordered-map/config.yml b/recipes/tsl-ordered-map/config.yml index 40341aa3db6cd3..73c245662b08d6 100644 --- a/recipes/tsl-ordered-map/config.yml +++ b/recipes/tsl-ordered-map/config.yml @@ -1,3 +1,5 @@ versions: + "1.1.0": + folder: all "1.0.0": folder: all diff --git a/recipes/tsl-robin-map/all/conandata.yml b/recipes/tsl-robin-map/all/conandata.yml index c223869bef2e46..89211be8fec7bf 100644 --- a/recipes/tsl-robin-map/all/conandata.yml +++ b/recipes/tsl-robin-map/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.2.1": + url: "https://github.com/Tessil/robin-map/archive/v1.2.1.tar.gz" + sha256: "2b54d2c1de2f73bea5c51d5dcbd64813a08caf1bfddcfdeee40ab74e9599e8e3" "1.0.1": url: "https://github.com/Tessil/robin-map/archive/v1.0.1.tar.gz" sha256: "b2ffdb623727cea852a66bddcb7fa6d938538a82b40e48294bb581fe086ef005" diff --git a/recipes/tsl-robin-map/all/test_v1_package/CMakeLists.txt b/recipes/tsl-robin-map/all/test_v1_package/CMakeLists.txt index 1fde03f4de7cd9..be00a8c7f57c71 100644 --- a/recipes/tsl-robin-map/all/test_v1_package/CMakeLists.txt +++ b/recipes/tsl-robin-map/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(tsl-robin-map REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE tsl::robin_map) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/tsl-robin-map/config.yml b/recipes/tsl-robin-map/config.yml index bfce952bf842d6..7a3b316dace84a 100644 --- a/recipes/tsl-robin-map/config.yml +++ b/recipes/tsl-robin-map/config.yml @@ -1,4 +1,6 @@ versions: + "1.2.1": + folder: all "1.0.1": folder: all "0.6.3": diff --git a/recipes/tuplet/all/conandata.yml b/recipes/tuplet/all/conandata.yml index 17959ac3b2cd73..98eee37c105c5f 100644 --- a/recipes/tuplet/all/conandata.yml +++ b/recipes/tuplet/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.1.0": + url: "https://github.com/codeinred/tuplet/archive/v2.1.0.tar.gz" + sha256: "e77503b81259c4d67d1b16b887b9ab778422e2ffc031d2171b5117d2fddb237c" + "2.0.0": + url: "https://github.com/codeinred/tuplet/archive/refs/tags/v2.0.0.tar.gz" + sha256: "cb754d119ca9d0a17ef165624d2c856b86eed9451bc8bc5c17b41410177a8d9f" "1.2.2": url: "https://github.com/codeinred/tuplet/archive/refs/tags/v1.2.2.tar.gz" sha256: "8605abf16f3ffcf87b0a5d81bc30f75b1fb478a5d747749fca31397e8705f8bc" diff --git a/recipes/tuplet/all/conanfile.py b/recipes/tuplet/all/conanfile.py index 64a8041e609cb7..4e591fd1ac8d19 100644 --- a/recipes/tuplet/all/conanfile.py +++ b/recipes/tuplet/all/conanfile.py @@ -72,6 +72,4 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "tuplet") self.cpp_info.set_property("cmake_target_name", "tuplet::tuplet") self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] diff --git a/recipes/tuplet/all/test_v1_package/CMakeLists.txt b/recipes/tuplet/all/test_v1_package/CMakeLists.txt index 61c92c0f66ed60..925ecbe19e448d 100644 --- a/recipes/tuplet/all/test_v1_package/CMakeLists.txt +++ b/recipes/tuplet/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.12) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(tuplet REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE tuplet::tuplet) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/tuplet/all/test_v1_package/conanfile.py b/recipes/tuplet/all/test_v1_package/conanfile.py index 75c0cd81d2d2f3..38f4483872d47f 100644 --- a/recipes/tuplet/all/test_v1_package/conanfile.py +++ b/recipes/tuplet/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/tuplet/config.yml b/recipes/tuplet/config.yml index af40d9653a3783..dab8b51866d730 100644 --- a/recipes/tuplet/config.yml +++ b/recipes/tuplet/config.yml @@ -1,3 +1,7 @@ versions: + "2.1.0": + folder: all + "2.0.0": + folder: all "1.2.2": folder: all diff --git a/recipes/unicorn/all/CMakeLists.txt b/recipes/unicorn/all/CMakeLists.txt deleted file mode 100644 index a69305eb3971f9..00000000000000 --- a/recipes/unicorn/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/unicorn/all/conandata.yml b/recipes/unicorn/all/conandata.yml index b55a1cc0580871..8687bbd470670d 100644 --- a/recipes/unicorn/all/conandata.yml +++ b/recipes/unicorn/all/conandata.yml @@ -1,14 +1,19 @@ sources: - "1.0.3": - url: "https://github.com/unicorn-engine/unicorn/archive/refs/tags/1.0.3.tar.gz" - sha256: "64fba177dec64baf3f11c046fbb70e91483e029793ec6a3e43b028ef14dc0d65" + "2.0.1": + url: "https://github.com/unicorn-engine/unicorn/archive/refs/tags/2.0.1.tar.gz" + sha256: "0c1586f6b079e705d760403141db0ea65d0e22791cf0f43f38172d49497923fd" "2.0.0": url: "https://github.com/unicorn-engine/unicorn/archive/refs/tags/2.0.0.tar.gz" sha256: "67b445c760e2bbac663e8c8bc410e43311c7fc92df4dfa8d90e06a021d07f634" -patches: "1.0.3": - - patch_file: "patches/1.0.3-0001-cmake-crossbuild-support.patch" - base_path: "source_subfolder" + url: "https://github.com/unicorn-engine/unicorn/archive/refs/tags/1.0.3.tar.gz" + sha256: "64fba177dec64baf3f11c046fbb70e91483e029793ec6a3e43b028ef14dc0d65" +patches: + "2.0.1": + - patch_file: "patches/2.0.1-0001-cmake-msvc-support.patch" + - patch_file: "patches/2.0.1-0002-cmake-msvc-runtime.patch" "2.0.0": - patch_file: "patches/2.0.0-0001-cmake-msvc-support.patch" - base_path: "source_subfolder" + - patch_file: "patches/2.0.0-0002-cmake-msvc-runtime.patch" + "1.0.3": + - patch_file: "patches/1.0.3-0001-cmake-crossbuild-support.patch" diff --git a/recipes/unicorn/all/conanfile.py b/recipes/unicorn/all/conanfile.py index 683f2d61f04c31..a304c26bd15555 100644 --- a/recipes/unicorn/all/conanfile.py +++ b/recipes/unicorn/all/conanfile.py @@ -1,11 +1,13 @@ -from conans import CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout, CMakeDeps +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy, rmdir, save, export_conandata_patches, apply_conandata_patches +from conan.tools.microsoft import is_msvc import os import stat import textwrap -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class UnicornConan(ConanFile): @@ -19,21 +21,14 @@ class UnicornConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], - "supported_archs": "ANY", # comma-separated list of archs + "supported_archs": ["ANY"], # comma-separated list of archs } default_options = { "shared": False, "fPIC": True, - "supported_archs": "", # defaults to all archs supported by the current version. See `config_options`. + "supported_archs": ["ANY"], # defaults to all archs supported by the current version. See `config_options`. } - exports_sources = "CMakeLists.txt", "patches/*" - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _all_supported_archs(self): """ @@ -64,11 +59,21 @@ def configure(self): @property def _needs_jwasm(self): - return self.settings.os == "Windows" and self.settings.compiler != "Visual Studio" + return self.settings.os == "Windows" and not is_msvc(self) + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + cmake_layout(self, src_folder="src") def build_requirements(self): if self._needs_jwasm: - self.build_requires("jwasm/2.13") + self.tool_requires("jwasm/2.13") + + def package_id(self): + # normalize the supported_archs option (sorted+comma separated) + self.info.options.supported_archs = ",".join(self._supported_archs) def validate(self): unsupported_archs = [arch for arch in self._supported_archs if arch not in self._all_supported_archs] @@ -79,39 +84,17 @@ def validate(self): # FIXME: will/should be fixed with unicorn 2 (https://github.com/unicorn-engine/unicorn/issues/1379) raise ConanInvalidConfiguration("arm builds of unicorn are currently unsupported") - def package_id(self): - # normalize the supported_archs option (sorted+comma separated) - self.info.options.supported_archs = ",".join(self._supported_archs) - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) @property def _jwasm_wrapper(self): return os.path.join(self.build_folder, "jwasm_wrapper.py") - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["UNICORN_INSTALL"] = True - cmake.definitions["UNICORN_BUILD_SAMPLES"] = False - cmake.definitions["UNICORN_ARCH"] = " ".join(self._supported_archs) - if self._needs_jwasm: - cmake.definitions["CMAKE_ASM_MASM_COMPILER"] = self._jwasm_wrapper - if self.settings.arch == "x86_64": - cmake.definitions["CMAKE_ASM_MASM_FLAGS"] = { - "x86_64": "-win64", - "x86": "-coff", - }[str(self.settings.arch)] - cmake.configure() - return cmake - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) if self._needs_jwasm: - tools.save(self._jwasm_wrapper, textwrap.dedent("""\ + save(self, self._jwasm_wrapper, textwrap.dedent("""\ #!/usr/bin/env python import os import sys @@ -132,22 +115,43 @@ def _patch_sources(self): """)) os.chmod(self._jwasm_wrapper, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH) + def generate(self): + tc = CMakeToolchain(self) + tc.variables["UNICORN_INSTALL"] = True + tc.variables["UNICORN_BUILD_SAMPLES"] = False + tc.cache_variables["UNICORN_ARCH"] = ";".join(self._supported_archs) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + + if self._needs_jwasm: + tc.variables["CMAKE_ASM_MASM_COMPILER"] = self._jwasm_wrapper + if self.settings.arch == "x86_64": + tc.variables["CMAKE_ASM_MASM_FLAGS"] = { + "x86_64": "-win64", + "x86": "-coff", + }[str(self.settings.arch)] + + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + def build(self): + apply_conandata_patches(self) self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - self.copy("COPYING.LGPL2", src=self._source_subfolder, dst="licenses") - self.copy("COPYING_GLIB", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + for lic in ("COPYING", "COPYING.LGPL2", "COPYING_GLIB"): + copy(self, lic, src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.libs = ["unicorn"] - self.cpp_info.names["pkg_config"] = "unicorn" + self.cpp_info.set_property("pkg_config_name", "unicorn") if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.system_libs = ["m", "pthread"] diff --git a/recipes/unicorn/all/patches/2.0.0-0002-cmake-msvc-runtime.patch b/recipes/unicorn/all/patches/2.0.0-0002-cmake-msvc-runtime.patch new file mode 100644 index 00000000000000..b28165288cd1f4 --- /dev/null +++ b/recipes/unicorn/all/patches/2.0.0-0002-cmake-msvc-runtime.patch @@ -0,0 +1,11 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -100,7 +100,7 @@ + add_compile_options($<$:/wd4267>) + + # handle msvcrt setting being passed in CMAKE_C_FLAGS +- if(DEFINED CMAKE_MSVC_RUNTIME_LIBRARY) ++ if(FALSE) + # do not support other methods of setting this (it would be more conformant, tho) + message(FATAL_ERROR "please set msvcrt via CMAKE_C_FLAGS") + endif() diff --git a/recipes/unicorn/all/patches/2.0.1-0001-cmake-msvc-support.patch b/recipes/unicorn/all/patches/2.0.1-0001-cmake-msvc-support.patch new file mode 100644 index 00000000000000..93cdf2304d9ee0 --- /dev/null +++ b/recipes/unicorn/all/patches/2.0.1-0001-cmake-msvc-support.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 85597f46..3161d714 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1431,7 +1431,7 @@ if(UNICORN_BUILD_TESTS) + endif() + + +-if(UNICORN_INSTALL AND NOT MSVC) ++if(UNICORN_INSTALL) + include("GNUInstallDirs") + file(GLOB UNICORN_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/unicorn/*.h) + if (BUILD_SHARED_LIBS) diff --git a/recipes/unicorn/all/patches/2.0.1-0002-cmake-msvc-runtime.patch b/recipes/unicorn/all/patches/2.0.1-0002-cmake-msvc-runtime.patch new file mode 100644 index 00000000000000..0d1c0d94f4fa4d --- /dev/null +++ b/recipes/unicorn/all/patches/2.0.1-0002-cmake-msvc-runtime.patch @@ -0,0 +1,16 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 85597f46..1467bc55 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -108,8 +108,10 @@ if(MSVC) + add_compile_options($<$:/wd4244>) + add_compile_options($<$:/wd4267>) + ++ message(OUTPUT "CMAKE_MSVC_RUNTIME_LIBRARY ${CMAKE_MSVC_RUNTIME_LIBRARY} CMAKE_C_FLAGS ${CMAKE_C_FLAGS}") ++ + # handle msvcrt setting being passed in CMAKE_C_FLAGS +- if(DEFINED CMAKE_MSVC_RUNTIME_LIBRARY) ++ if(FALSE) + # do not support other methods of setting this (it would be more conformant, tho) + message(FATAL_ERROR "please set msvcrt via CMAKE_C_FLAGS") + endif() diff --git a/recipes/unicorn/all/test_package/CMakeLists.txt b/recipes/unicorn/all/test_package/CMakeLists.txt index 77c8819fd7ca99..6c6411fee68ac5 100644 --- a/recipes/unicorn/all/test_package/CMakeLists.txt +++ b/recipes/unicorn/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(unicorn REQUIRED) +find_package(unicorn REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} PRIVATE unicorn::unicorn) diff --git a/recipes/unicorn/all/test_package/conanfile.py b/recipes/unicorn/all/test_package/conanfile.py index 3da371b660e0a3..3a8c6c5442b33b 100644 --- a/recipes/unicorn/all/test_package/conanfile.py +++ b/recipes/unicorn/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if not cross_building(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/unicorn/all/test_v1_package/CMakeLists.txt b/recipes/unicorn/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..2318e761b04879 --- /dev/null +++ b/recipes/unicorn/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(unicorn REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE unicorn::unicorn) diff --git a/recipes/unicorn/all/test_v1_package/conanfile.py b/recipes/unicorn/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..49a3a66ea5bad4 --- /dev/null +++ b/recipes/unicorn/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/unicorn/config.yml b/recipes/unicorn/config.yml index 4e8846be88f827..7daf28aace3620 100644 --- a/recipes/unicorn/config.yml +++ b/recipes/unicorn/config.yml @@ -1,5 +1,7 @@ versions: - "1.0.3": + "2.0.1": folder: "all" "2.0.0": folder: "all" + "1.0.3": + folder: "all" diff --git a/recipes/unordered_dense/all/conandata.yml b/recipes/unordered_dense/all/conandata.yml index 1ce7f4cb59db99..6869314546f18f 100644 --- a/recipes/unordered_dense/all/conandata.yml +++ b/recipes/unordered_dense/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "3.0.2": + url: "https://github.com/martinus/unordered_dense/archive/v3.0.2.tar.gz" + sha256: "0c0b874e9682cce3c75a1152308bfbb108538aaf1e90824d7789e2b64122520b" + "3.0.0": + url: "https://github.com/martinus/unordered_dense/archive/v3.0.0.tar.gz" + sha256: "e73452d7c1e274b4a15b553c0904f1de4bcfa61b00514acd1eaad7deac805ef0" "2.0.1": url: "https://github.com/martinus/unordered_dense/archive/v2.0.1.tar.gz" sha256: "450d53bd8709f9476702a3c4975bf6e40d66059b25b125e480534228d7f5616d" diff --git a/recipes/unordered_dense/all/conanfile.py b/recipes/unordered_dense/all/conanfile.py index a863fac03d459a..574ac33f1668f4 100644 --- a/recipes/unordered_dense/all/conanfile.py +++ b/recipes/unordered_dense/all/conanfile.py @@ -28,16 +28,12 @@ def _minimum_cpp_standard(self): def _compilers_minimum_version(self): return { "Visual Studio": "15.7", - "msvc": "1914", + "msvc": "191", "gcc": "7", "clang": "7", "apple-clang": "11", } - 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 layout(self): basic_layout(self, src_folder="src") @@ -64,13 +60,10 @@ def package(self): def package_info(self): self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] self.cpp_info.set_property("cmake_file_name", "unordered_dense") self.cpp_info.set_property("cmake_target_name", "unordered_dense::unordered_dense") - self.cpp_info.set_property("pkg_config_name", "package") # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "unordered_dense" diff --git a/recipes/unordered_dense/all/test_package/CMakeLists.txt b/recipes/unordered_dense/all/test_package/CMakeLists.txt index 79fa0b1ed9ebb8..b9de8205fed9d1 100644 --- a/recipes/unordered_dense/all/test_package/CMakeLists.txt +++ b/recipes/unordered_dense/all/test_package/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package LANGUAGES CXX) find_package(unordered_dense REQUIRED CONFIG) diff --git a/recipes/unordered_dense/all/test_v1_package/CMakeLists.txt b/recipes/unordered_dense/all/test_v1_package/CMakeLists.txt index 49319758419886..2a9b48732268c7 100644 --- a/recipes/unordered_dense/all/test_v1_package/CMakeLists.txt +++ b/recipes/unordered_dense/all/test_v1_package/CMakeLists.txt @@ -1,12 +1,9 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(unordered_dense REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE unordered_dense::unordered_dense) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/unordered_dense/config.yml b/recipes/unordered_dense/config.yml index bec499eee421ed..4443921a008618 100644 --- a/recipes/unordered_dense/config.yml +++ b/recipes/unordered_dense/config.yml @@ -1,4 +1,8 @@ versions: + "3.0.2": + folder: all + "3.0.0": + folder: all "2.0.1": folder: all "2.0.0": diff --git a/recipes/usockets/all/conandata.yml b/recipes/usockets/all/conandata.yml index c851ea9d76dea5..5b4a41335be2a9 100644 --- a/recipes/usockets/all/conandata.yml +++ b/recipes/usockets/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.8.5": + url: "https://github.com/uNetworking/uSockets/archive/v0.8.5.tar.gz" + sha256: "c52c98b7ff2c24534c17ad97d5fea8ca0cb7ff38cc933b8d08bac6e498a2ea6b" + "0.8.3": + url: "https://github.com/uNetworking/uSockets/archive/v0.8.3.tar.gz" + sha256: "2f96a26365b87badbea2360a82521a382c0c3ee2dcf4f32c79b11d0cb1989a53" "0.8.2": url: "https://github.com/uNetworking/uSockets/archive/v0.8.2.tar.gz" sha256: "c17fc99773a30552cdd7741ff98af177eeecb26b89fc38011b430956b3b2eca5" @@ -15,6 +21,16 @@ sources: url: "https://github.com/uNetworking/uSockets/archive/v0.4.0.tar.gz" sha256: "f9f15b395def578cc79a5b32abc64fa9cff5dac873062911f515b984b90f7cc2" patches: + "0.8.5": + - patch_file: "patches/0001-makefile_0.8.3.patch" + base_path: "source_subfolder" + patch_description: "remove lto options" + patch_type: "portability" + "0.8.3": + - patch_file: "patches/0001-makefile_0.8.3.patch" + base_path: "source_subfolder" + patch_description: "remove lto options" + patch_type: "portability" "0.8.2": - patch_file: "patches/0001-makefile_0.8.2.patch" base_path: "source_subfolder" diff --git a/recipes/usockets/all/conanfile.py b/recipes/usockets/all/conanfile.py index 265bb2485b4dc8..09208942cd97ef 100644 --- a/recipes/usockets/all/conanfile.py +++ b/recipes/usockets/all/conanfile.py @@ -2,10 +2,13 @@ from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, chdir from conan.tools.build import check_min_cppstd from conan.tools.scm import Version +from conan.tools.microsoft import is_msvc from conan.errors import ConanInvalidConfiguration from conans import MSBuild, AutoToolsBuildEnvironment +from conans.tools import vcvars, environment_append, unix_path, get_env import os +import contextlib required_conan_version = ">=1.52.0" @@ -61,6 +64,10 @@ def _minimum_compilers_version(self, cppstd): def _source_subfolder(self): return "source_subfolder" + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + def export_sources(self): export_conandata_patches(self) @@ -114,14 +121,20 @@ def requirements(self): if self.options.with_ssl == "openssl": self.requires("openssl/1.1.1s") elif self.options.with_ssl == "wolfssl": - self.requires("wolfssl/5.3.0") + self.requires("wolfssl/5.5.1") if self.options.eventloop == "libuv": self.requires("libuv/1.44.2") elif self.options.eventloop == "gcd": self.requires("libdispatch/5.3.2") elif self.options.eventloop == "boost": - self.requires("boost/1.80.0") + self.requires("boost/1.81.0") + + def build_requirements(self): + if self._settings_build.os == "Windows" and not get_env("CONAN_BASH_PATH"): + self.build_requires("msys2/cci.latest") + if self.settings.compiler == "Visual Studio": + self.build_requires("automake/1.16.5") def source(self): get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) @@ -134,11 +147,34 @@ def _build_msvc(self): msbuild = MSBuild(self) msbuild.build(project_file="uSockets.vcxproj", platforms={"x86": "Win32"}) + @contextlib.contextmanager + def _build_context(self): + if is_msvc(self): + with vcvars(self): + env = { + "CC": "{} cl -nologo".format(unix_path(self.deps_user_info["automake"].compile)), + "CXX": "{} cl -nologo".format(unix_path(self.deps_user_info["automake"].compile)), + "CFLAGS": "-{}".format(self.settings.compiler.runtime), + "LD": "link", + "NM": "dumpbin -symbols", + "STRIP": ":", + "AR": "{} lib".format(unix_path(self.deps_user_info["automake"].ar_lib)), + "RANLIB": ":", + } + + if self.options.eventloop == "libuv": + env["CPPFLAGS"] = "-I" + unix_path(self.deps_cpp_info["libuv"].include_paths[0]) + " " + + with environment_append(env): + yield + else: + yield + def _build_configure(self): autotools = AutoToolsBuildEnvironment(self) autotools.fpic = self.options.get_safe("fPIC", False) with chdir(self, self._source_subfolder): - args = [] + args = ["WITH_LTO=0"] if self.options.with_ssl == "openssl": args.append("WITH_OPENSSL=1") elif self.options.with_ssl == "wolfssl": @@ -156,16 +192,17 @@ def _build_configure(self): def build(self): self._patch_sources() - if self.settings.compiler == "Visual Studio": + if Version(self.version) < "0.8.3" and is_msvc(self): self._build_msvc() else: - self._build_configure() + with self._build_context(): + self._build_configure() def package(self): copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self._source_subfolder) copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self._source_subfolder, "src"), keep_path=True) - copy(self, pattern="*.a", dst=os.path.join(self.package_folder, "lib"), src=self._source_subfolder, keep_path=False) - copy(self, pattern="*.lib", dst=os.path.join(self.package_folder, "lib"), src=self._source_subfolder, keep_path=False) + copy(self, pattern="*.a", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) + copy(self, pattern="*.lib", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) # drop internal headers rmdir(self, os.path.join(self.package_folder, "include", "internal")) diff --git a/recipes/usockets/all/patches/0001-makefile_0.8.3.patch b/recipes/usockets/all/patches/0001-makefile_0.8.3.patch new file mode 100644 index 00000000000000..5ea7628ad348dd --- /dev/null +++ b/recipes/usockets/all/patches/0001-makefile_0.8.3.patch @@ -0,0 +1,40 @@ +diff --git a/Makefile b/Makefile +index f6e2c6b..087d021 100644 +--- a/Makefile ++++ b/Makefile +@@ -63,21 +63,21 @@ endif + # By default we build the uSockets.a static library + default: + rm -f *.o +- $(CC) $(CFLAGS) -O3 -c src/*.c src/eventing/*.c src/crypto/*.c ++ $(CC) $(CFLAGS) $(CPPFLAGS) -O3 -c src/*.c src/eventing/*.c src/crypto/*.c + # Also link in Boost Asio support + ifeq ($(WITH_ASIO),1) +- $(CXX) $(CXXFLAGS) -Isrc -std=c++14 -flto -O3 -c src/eventing/asio.cpp ++ $(CXX) $(CXXFLAGS) -Isrc -std=c++14 $(CPPFLAGS) -O3 -c src/eventing/asio.cpp + endif + + # For now we do rely on C++17 for OpenSSL support but we will be porting this work to C11 + ifeq ($(WITH_OPENSSL),1) +- $(CXX) $(CXXFLAGS) -std=c++17 -flto -O3 -c src/crypto/*.cpp ++ $(CXX) $(CXXFLAGS) -std=c++17 $(CPPFLAGS) -O3 -c src/crypto/*.cpp + endif + ifeq ($(WITH_BORINGSSL),1) +- $(CXX) $(CXXFLAGS) -std=c++17 -flto -O3 -c src/crypto/*.cpp ++ $(CXX) $(CXXFLAGS) -std=c++17 $(CPPFLAGS) -O3 -c src/crypto/*.cpp + endif + # Create a static library (try windows, then unix) +- lib.exe /out:uSockets.a *.o || $(AR) rvs uSockets.a *.o ++ lib.exe /out:uSockets.lib *.obj || $(AR) rvs libuSockets.a *.o + + # BoringSSL needs cmake and golang + .PHONY: boringssl +@@ -87,7 +87,7 @@ boringssl: + # Builds all examples + .PHONY: examples + examples: default +- for f in examples/*.c; do $(CC) -O3 $(CFLAGS) -o $$(basename "$$f" ".c")$(EXEC_SUFFIX) "$$f" $(LDFLAGS); done ++ for f in examples/*.c; do $(CC) $(CPPFLAGS) -O3 $(CFLAGS) -o $$(basename "$$f" ".c")$(EXEC_SUFFIX) "$$f" $(LDFLAGS); done + + swift_examples: + swiftc -O -I . examples/swift_http_server/main.swift uSockets.a -o swift_http_server diff --git a/recipes/usockets/config.yml b/recipes/usockets/config.yml index 76b81d9ebd6902..c4f53d0a2aff05 100644 --- a/recipes/usockets/config.yml +++ b/recipes/usockets/config.yml @@ -1,4 +1,8 @@ versions: + "0.8.5": + folder: all + "0.8.3": + folder: all "0.8.2": folder: all "0.8.1": diff --git a/recipes/utfcpp/all/conandata.yml b/recipes/utfcpp/all/conandata.yml index 42cbfd5cf50185..f435f56f7acf1c 100644 --- a/recipes/utfcpp/all/conandata.yml +++ b/recipes/utfcpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.2.3": + url: "https://github.com/nemtrif/utfcpp/archive/v3.2.3.tar.gz" + sha256: "3ba9b0dbbff08767bdffe8f03b10e596ca351228862722e4c9d4d126d2865250" "3.2.2": url: "https://github.com/nemtrif/utfcpp/archive/v3.2.2.tar.gz" sha256: "6f81e7cb2be2a6a9109a8a0cb7dc39ec947f1bcdb5dfa4a660e11a23face19f5" diff --git a/recipes/utfcpp/all/conanfile.py b/recipes/utfcpp/all/conanfile.py index 63d01a72ddc947..2d5820625e1764 100644 --- a/recipes/utfcpp/all/conanfile.py +++ b/recipes/utfcpp/all/conanfile.py @@ -61,9 +61,7 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "utf8cpp") self.cpp_info.includedirs.append(os.path.join("include", "utf8cpp")) self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "utf8cpp" diff --git a/recipes/utfcpp/all/test_v1_package/CMakeLists.txt b/recipes/utfcpp/all/test_v1_package/CMakeLists.txt index d476d50d29d2f9..be00a8c7f57c71 100644 --- a/recipes/utfcpp/all/test_v1_package/CMakeLists.txt +++ b/recipes/utfcpp/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(utf8cpp REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE utf8cpp) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/utfcpp/config.yml b/recipes/utfcpp/config.yml index 6d247e5ee81476..00df0fb881cb8a 100644 --- a/recipes/utfcpp/config.yml +++ b/recipes/utfcpp/config.yml @@ -1,4 +1,6 @@ versions: + "3.2.3": + folder: all "3.2.2": folder: all "3.2.1": diff --git a/recipes/verilator/all/conanfile.py b/recipes/verilator/all/conanfile.py index 1caac1166ce332..dae6d10f3a17cc 100644 --- a/recipes/verilator/all/conanfile.py +++ b/recipes/verilator/all/conanfile.py @@ -1,14 +1,14 @@ from conan import ConanFile -from conan.tools.files import get -from conan.tools.files import rmdir +from conan.tools.files import get, rmdir, patch, replace_in_file, rename from conan.tools.build import cross_building +from conan.tools.scm import Version from conans import AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration +from conan.errors import ConanInvalidConfiguration from contextlib import contextmanager import os import shutil -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.47.0" class VerilatorConan(ConanFile): name = "verilator" @@ -36,7 +36,7 @@ def export_sources(self): @property def _needs_old_bison(self): - return tools.Version(self.version) < "4.100" + return Version(self.version) < "4.100" def build_requirements(self): if self._settings_build.os == "Windows" and "CONAN_BASH_PATH" not in os.environ: @@ -58,7 +58,7 @@ def build_requirements(self): self.build_requires("bison/3.5.3") else: self.build_requires("bison/3.7.6") - if tools.Version(self.version) >= "4.224": + if Version(self.version) >= "4.224": self.build_requires("autoconf/2.71") @@ -76,10 +76,10 @@ def validate(self): if hasattr(self, "settings_build") and cross_building(self): raise ConanInvalidConfiguration("Cross building is not yet supported. Contributions are welcome") - if tools.Version(self.version) >= "4.200" and self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "7": + if Version(self.version) >= "4.200" and self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "7": raise ConanInvalidConfiguration("GCC < version 7 is not supported") - if self.settings.os == "Windows" and tools.Version(self.version) >= "4.200": + if self.settings.os == "Windows" and Version(self.version) >= "4.200": raise ConanInvalidConfiguration("Windows build is not yet supported. Contributions are welcome") @contextmanager def _build_context(self): @@ -115,7 +115,7 @@ def _configure_autotools(self): if yacc.endswith(" -y"): yacc = yacc[:-3] with tools.environment_append({"YACC": yacc}): - if tools.Version(self.version) >= "4.224": + if Version(self.version) >= "4.224": with tools.chdir(self._source_subfolder): self.run("autoconf", win_bash=tools.os_info.is_windows, run_environment=True) self._autotools.configure(args=conf_args, configure_dir=os.path.join(self.build_folder, self._source_subfolder)) @@ -135,17 +135,16 @@ def _make_args(self): return args def _patch_sources(self): - if tools.Version(self.version) < "4.200": - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) - + if Version(self.version) < "4.200": + for patch_file in self.conan_data.get("patches", {}).get(self.version, []): + patch(self, **patch_file) try: os.unlink(os.path.join(self._source_subfolder, "src", "config_build.h")) except FileNotFoundError: pass if self.settings.compiler == "Visual Studio": - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Makefile_obj.in"), + replace_in_file(self, os.path.join(self._source_subfolder, "src", "Makefile_obj.in"), "${LINK}", "${PROGLINK}") def build(self): @@ -164,18 +163,24 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "bin", "share", "pkgconfig")) rmdir(self, os.path.join(self.package_folder, "bin", "share", "verilator", "examples")) os.unlink(os.path.join(self.package_folder, "bin", "share", "verilator", "verilator-config-version.cmake")) - tools.rename(os.path.join(self.package_folder, "bin", "share", "verilator", "verilator-config.cmake"), + rename(self, os.path.join(self.package_folder, "bin", "share", "verilator", "verilator-config.cmake"), os.path.join(self.package_folder, "bin", "share", "verilator", "verilator-tools.cmake")) - tools.replace_in_file(os.path.join(self.package_folder, "bin", "share", "verilator", "verilator-tools.cmake"), + replace_in_file(self, os.path.join(self.package_folder, "bin", "share", "verilator", "verilator-tools.cmake"), "${CMAKE_CURRENT_LIST_DIR}", "${CMAKE_CURRENT_LIST_DIR}/../../..") if self.settings.build_type == "Debug": - tools.replace_in_file(os.path.join(self.package_folder, "bin", "share", "verilator", "verilator-tools.cmake"), + replace_in_file(self, os.path.join(self.package_folder, "bin", "share", "verilator", "verilator-tools.cmake"), "verilator_bin", "verilator_bin_dbg") shutil.move(os.path.join(self.package_folder, "bin", "share", "verilator", "include"), os.path.join(self.package_folder)) - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin", "share", "verilator", "bin"), "*") + if Version(self.version) >= "4.224": + shutil.move(os.path.join(self.package_folder, "bin", "share", "verilator", "bin", "verilator_ccache_report"), + os.path.join(self.package_folder, "bin", "verilator_ccache_report")) + + shutil.move(os.path.join(self.package_folder, "bin", "share", "verilator", "bin", "verilator_includer"), + os.path.join(self.package_folder, "bin", "verilator_includer")) + rmdir(self, os.path.join(self.package_folder, "bin", "share", "verilator", "bin")) def package_id(self): diff --git a/recipes/volk/all/conandata.yml b/recipes/volk/all/conandata.yml index f9c865549057e7..f99a39c6442220 100644 --- a/recipes/volk/all/conandata.yml +++ b/recipes/volk/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.236.0": + url: "https://github.com/zeux/volk/archive/refs/tags/sdk-1.3.236.0.tar.gz" + sha256: "fba21aeccd8df4ce49fd0cce54cc9b1808e24e4283cad733f65fdd52f1729f16" "1.3.231.1": url: "https://github.com/zeux/volk/archive/refs/tags/sdk-1.3.231.1.tar.gz" sha256: "fac8d3d295e88bcc6bfb2b729d2c4babb2ea04ccb39fd918a3471b2d756789b9" diff --git a/recipes/volk/config.yml b/recipes/volk/config.yml index fb5ab123c3994e..863bb85e7f8b22 100644 --- a/recipes/volk/config.yml +++ b/recipes/volk/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.236.0": + folder: "all" "1.3.231.1": folder: "all" "1.3.224.1": diff --git a/recipes/vorbis/all/conanfile.py b/recipes/vorbis/all/conanfile.py index 007a900f3ab52b..4e074b9f2cd877 100644 --- a/recipes/vorbis/all/conanfile.py +++ b/recipes/vorbis/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import apply_conandata_patches, copy, get, rmdir import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class VorbisConan(ConanFile): @@ -34,7 +34,7 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") try: del self.settings.compiler.libcxx except Exception: @@ -45,7 +45,7 @@ def configure(self): pass def requirements(self): - self.requires("ogg/1.3.5") + self.requires("ogg/1.3.5", transitive_headers=True) def layout(self): cmake_layout(self, src_folder="src") diff --git a/recipes/vulkan-headers/all/conandata.yml b/recipes/vulkan-headers/all/conandata.yml index 51438000285135..6124eeccffa973 100644 --- a/recipes/vulkan-headers/all/conandata.yml +++ b/recipes/vulkan-headers/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.236.0": + url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.3.236.0.tar.gz" + sha256: "2df85b3daa78ced7f910db870ea2aed10f718c703e18076b4549ca4005c9c451" "1.3.231.1": url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.3.231.1.tar.gz" sha256: "6e16051ccb28821b907a08025eedb82cc73e1056924b32f75880ecae2499f7f6" diff --git a/recipes/vulkan-headers/config.yml b/recipes/vulkan-headers/config.yml index e869bb8c10f234..d0d206b7e299f3 100644 --- a/recipes/vulkan-headers/config.yml +++ b/recipes/vulkan-headers/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.236.0": + folder: all "1.3.231.1": folder: all "1.3.231.0": diff --git a/recipes/vulkan-loader/all/conandata.yml b/recipes/vulkan-loader/all/conandata.yml index d804f7c0e91a69..423603885003db 100644 --- a/recipes/vulkan-loader/all/conandata.yml +++ b/recipes/vulkan-loader/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.236.0": + url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/sdk-1.3.236.0.tar.gz" + sha256: "157d2230b50bb5be3ef9b9467aa90d1c109d5f188a49b11f741246d7ca583bf3" "1.3.231.1": url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/sdk-1.3.231.1.tar.gz" sha256: "5226fbc6a90e4405200c8cfdd5733d5e0c6a64e64dcc614c485ea06e03d66578" @@ -48,17 +51,20 @@ sources: url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/sdk-1.2.154.0.tar.gz" sha256: "418017d7bab907e72291476df231dd0e7dc7fe20b97e55389c975bcfc48d6433" patches: + "1.3.236.0": + - patch_file: "patches/1.3.236.0-0001-cmake-minimum-required-3.10.patch" + patch_description: "Do not use features of CMake 3.16, back to 3.10 as min version" + patch_type: "portability" + patch_source: "https://github.com/KhronosGroup/Vulkan-Loader/pull/1102" "1.3.231.1": - patch_file: "patches/1.3.231.1-0001-no-find-package-wayland.patch" patch_description: "CMake: remove attempt to find Wayland" patch_type: "portability" patch_source: "https://github.com/KhronosGroup/Vulkan-Loader/pull/1020" - sha256: "f08b35f57884624fea618405affff17215cd747740bbce11af53a69911b48452" "1.2.182": - patch_file: "patches/1.2.182-0001-fix-mingw.patch" patch_description: "Fix MinGW" patch_type: "portability" - sha256: "a05375c60b7f4a91f48df2278518be27e578e38190034bfcc887e5ceaa289c25" "1.2.154.0": - patch_file: "patches/1.2.154.0-0001-fix-mingw.patch" patch_description: "Fix MinGW" @@ -67,4 +73,3 @@ patches: - "https://github.com/KhronosGroup/Vulkan-Loader/pull/475" - "https://github.com/KhronosGroup/Vulkan-Loader/pull/495" - "https://github.com/KhronosGroup/Vulkan-Loader/pull/523" - sha256: "034e4252276fde22f14630d36404338dc3fa08ebf8fe7d5affe9065e0239f165" diff --git a/recipes/vulkan-loader/all/conanfile.py b/recipes/vulkan-loader/all/conanfile.py index ec8208aa8c4409..e1a6db65c0bf0e 100644 --- a/recipes/vulkan-loader/all/conanfile.py +++ b/recipes/vulkan-loader/all/conanfile.py @@ -75,12 +75,12 @@ def requirements(self): self.requires("wayland/1.21.0") def validate(self): - if self.info.options.get_safe("with_wsi_directfb"): + if self.options.get_safe("with_wsi_directfb"): # TODO: directfb package raise ConanInvalidConfiguration("Conan recipe for DirectFB is not available yet.") - if not is_apple_os(self) and not self.info.options.shared: + if not is_apple_os(self) and not self.options.shared: raise ConanInvalidConfiguration(f"Static builds are not supported on {self.settings.os}") - if self.info.settings.compiler == "Visual Studio" and Version(self.info.settings.compiler.version) < 15: + if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) < 15: # FIXME: It should build but Visual Studio 2015 container in CI of CCI seems to lack some Win SDK headers raise ConanInvalidConfiguration("Visual Studio < 2017 not yet supported in this recipe") # TODO: to replace by some version range check @@ -134,9 +134,10 @@ def generate(self): def _patch_sources(self): apply_conandata_patches(self) - replace_in_file(self, os.path.join(self.source_folder, "cmake", "FindVulkanHeaders.cmake"), - "HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry", - "HINTS ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry") + if Version(self.version) < "1.3.234": + replace_in_file(self, os.path.join(self.source_folder, "cmake", "FindVulkanHeaders.cmake"), + "HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry", + "HINTS ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry") # Honor settings.compiler.runtime replace_in_file(self, os.path.join(self.source_folder, "loader", "CMakeLists.txt"), "if(${configuration} MATCHES \"/MD\")", diff --git a/recipes/vulkan-loader/all/patches/1.3.236.0-0001-cmake-minimum-required-3.10.patch b/recipes/vulkan-loader/all/patches/1.3.236.0-0001-cmake-minimum-required-3.10.patch new file mode 100644 index 00000000000000..fe88588420cd9f --- /dev/null +++ b/recipes/vulkan-loader/all/patches/1.3.236.0-0001-cmake-minimum-required-3.10.patch @@ -0,0 +1,24 @@ +--- a/loader/CMakeLists.txt ++++ b/loader/CMakeLists.txt +@@ -160,9 +160,7 @@ if(WIN32) + target_link_libraries(asm_offset PRIVATE loader_specific_options) + # If not cross compiling, run asm_offset to generage gen_defines.asm + if (NOT CMAKE_CROSSCOMPILING) +- add_custom_command(TARGET asm_offset POST_BUILD +- COMMAND asm_offset MASM +- BYPRODUCTS gen_defines.asm) ++ add_custom_command(OUTPUT gen_defines.asm DEPENDS asm_offset COMMAND asm_offset MASM) + else() + # Forces compiler to write the intermediate asm file, needed so that we can get sizeof/offset of info out of it. + target_compile_options(asm_offset PRIVATE "/Fa$/asm_offset.asm" /FA) +@@ -236,9 +234,7 @@ else() # i.e.: Linux + target_link_libraries(asm_offset loader_specific_options) + # If not cross compiling, run asm_offset to generage gen_defines.asm + if (NOT CMAKE_CROSSCOMPILING) +- add_custom_command(TARGET asm_offset POST_BUILD +- COMMAND asm_offset GAS +- BYPRODUCTS gen_defines.asm) ++ add_custom_command(OUTPUT gen_defines.asm DEPENDS asm_offset COMMAND asm_offset GAS) + else() + # Forces compiler to write the intermediate asm file, needed so that we can get sizeof/offset of info out of it. + target_compile_options(asm_offset PRIVATE -save-temps=obj) diff --git a/recipes/vulkan-loader/config.yml b/recipes/vulkan-loader/config.yml index 9392c7d1f760b1..14679d8e7f0e5a 100644 --- a/recipes/vulkan-loader/config.yml +++ b/recipes/vulkan-loader/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.236.0": + folder: all "1.3.231.1": folder: all "1.3.231": diff --git a/recipes/vulkan-memory-allocator/all/conanfile.py b/recipes/vulkan-memory-allocator/all/conanfile.py index 39e07acab27929..5920e7735e9041 100644 --- a/recipes/vulkan-memory-allocator/all/conanfile.py +++ b/recipes/vulkan-memory-allocator/all/conanfile.py @@ -1,11 +1,11 @@ from conan import ConanFile from conan.tools.build import check_min_cppstd -from conan.tools.files import apply_conandata_patches, copy, get +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get from conan.tools.layout import basic_layout from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class VulkanMemoryAllocatorConan(ConanFile): @@ -22,11 +22,13 @@ def _min_cppstd(self): return "11" if Version(self.version) < "3.0.0" else "14" def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("vulkan-headers/1.3.224.0") + self.requires("vulkan-headers/1.3.236.0") def package_id(self): self.info.clear() @@ -35,9 +37,6 @@ def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._min_cppstd) - def layout(self): - basic_layout(self, src_folder="src") - def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -55,6 +54,4 @@ def package(self): def package_info(self): self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] diff --git a/recipes/vulkan-memory-allocator/all/test_package/conanfile.py b/recipes/vulkan-memory-allocator/all/test_package/conanfile.py index d120a992c06a69..0a6bc68712d901 100644 --- a/recipes/vulkan-memory-allocator/all/test_package/conanfile.py +++ b/recipes/vulkan-memory-allocator/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/vulkan-memory-allocator/all/test_v1_package/CMakeLists.txt b/recipes/vulkan-memory-allocator/all/test_v1_package/CMakeLists.txt index ead56f86c0f5a6..925ecbe19e448d 100644 --- a/recipes/vulkan-memory-allocator/all/test_v1_package/CMakeLists.txt +++ b/recipes/vulkan-memory-allocator/all/test_v1_package/CMakeLists.txt @@ -1,15 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(vulkan-memory-allocator REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE vulkan-memory-allocator::vulkan-memory-allocator) -if(vulkan-memory-allocator_VERSION VERSION_LESS "3.0.0") - target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) -else() - target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/vulkan-validationlayers/all/CMakeLists.txt b/recipes/vulkan-validationlayers/all/CMakeLists.txt deleted file mode 100644 index 3206840c13b9fd..00000000000000 --- a/recipes/vulkan-validationlayers/all/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -if(NOT TARGET glslang) - add_library(glslang INTERFACE) # fake target for upstream CMakeLists (glslang required by tests only) -endif() - -find_package(SPIRV-Tools REQUIRED CONFIG) - -add_subdirectory(src) diff --git a/recipes/vulkan-validationlayers/all/conandata.yml b/recipes/vulkan-validationlayers/all/conandata.yml index 9df896ac76970a..f251df5a89323f 100644 --- a/recipes/vulkan-validationlayers/all/conandata.yml +++ b/recipes/vulkan-validationlayers/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.236.0": + url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/refs/tags/sdk-1.3.236.0.tar.gz" + sha256: "68f2cf70b1960f85e931ef56935e6ceda1beeb214f8fa319e6b95128b02b485a" "1.3.231.1": url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/refs/tags/sdk-1.3.231.1.tar.gz" sha256: "ea40af0f499e7e97a86ee54410c5c78e7f7bac40f65ae09a1549773b6501bf4d" @@ -23,23 +26,43 @@ sources: "1.2.182": url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/v1.2.182.tar.gz" sha256: "5a1f7027c06a8e5ae777d9053b5ce46f10ca623806a43332eb2da06fe46476d4" - "1.2.154.0": - url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/sdk-1.2.154.0.tar.gz" - sha256: "8898ab05d0d8dec04fbba03d0ed2e79a1eb5c0382e5c89d4c737b45a6648f7f9" patches: + "1.3.236.0": + - patch_file: "patches/1.3.236.0-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" "1.3.231.1": - - patch_file: "patches/1.3.231.1-cmake-no-werror.patch" + - patch_file: "patches/1.3.231.1-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" + - patch_file: "patches/1.3.231.1-0002-cmake-no-werror.patch" patch_description: "Allow to disable Werror for old gcc/clang versions" patch_type: "portability" - sha256: "14678800b649c54dee25ee06d8c379f7abca2ae8a580a7fa64d4eb06b5080ecd" + "1.3.224.1": + - patch_file: "patches/1.3.224.1-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" + "1.3.216.0": + - patch_file: "patches/1.3.204.1-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" + "1.3.211.0": + - patch_file: "patches/1.3.204.1-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" + "1.3.204.1": + - patch_file: "patches/1.3.204.1-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" "1.2.198.0": - - patch_file: "patches/0005-fix-cmake-1.2.198.0.patch" + - patch_file: "patches/1.2.198.0-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" "1.2.189.2": - - patch_file: "patches/0005-fix-cmake-1.2.189.2.patch" + - patch_file: "patches/1.2.189.2-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" "1.2.182": - - patch_file: "patches/0005-fix-cmake-1.2.182.patch" - "1.2.154.0": - - patch_file: "patches/0001-duplicated-declaration.patch" - - patch_file: "patches/0002-fix-mingw.patch" - - patch_file: "patches/0003-disable-nortti-and-warnings-as-errors.patch" - - patch_file: "patches/0004-fix-installation.patch" + - patch_file: "patches/1.2.182-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" diff --git a/recipes/vulkan-validationlayers/all/conanfile.py b/recipes/vulkan-validationlayers/all/conanfile.py index cf06f5e8ad1355..aac6abc4171510 100644 --- a/recipes/vulkan-validationlayers/all/conanfile.py +++ b/recipes/vulkan-validationlayers/all/conanfile.py @@ -60,11 +60,29 @@ def _needs_pkg_config(self): self.options.get_safe("with_wsi_xlib") or \ self._needs_wayland_for_build + @property + def _min_cppstd(self): + if Version(self.version) >= "1.3.235": + return "17" + return "11" + + @property + def _compilers_minimum_version(self): + return { + "11": {}, + "17": { + "apple-clang": "9", + "clang": "6", + "gcc": "7", + "msvc": "191", + "Visual Studio": "15.7", + }, + }[self._min_cppstd] + def export(self): copy(self, f"dependencies/{self._dependencies_filename}", self.recipe_folder, self.export_folder) def export_sources(self): - copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) export_conandata_patches(self) def config_options(self): @@ -77,12 +95,10 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): + self.requires("robin-hood-hashing/3.11.5") # TODO: set private=True, once the issue is resolved https://github.com/conan-io/conan/issues/9390 self.requires(self._require("spirv-tools"), private=not hasattr(self, "settings_build")) self.requires(self._require("vulkan-headers")) - # TODO: use Version comparison once https://github.com/conan-io/conan/issues/10000 is fixed - if Version(self.version) >= "1.2.173": - self.requires("robin-hood-hashing/3.11.5") if self.options.get_safe("with_wsi_xcb") or self.options.get_safe("with_wsi_xlib"): self.requires("xorg/system") if self._needs_wayland_for_build: @@ -94,13 +110,25 @@ def _require(self, recipe_name): return f"{recipe_name}/{self._dependencies_versions[recipe_name]}" def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, 11) + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.info.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) if self.dependencies["spirv-tools"].options.shared: raise ConanInvalidConfiguration("vulkan-validationlayers can't depend on shared spirv-tools") - if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "5": + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "5": raise ConanInvalidConfiguration("gcc < 5 is not supported") def build_requirements(self): @@ -116,7 +144,8 @@ def generate(self): env.generate() tc = CMakeToolchain(self) - tc.variables["VULKAN_HEADERS_INSTALL_DIR"] = self.dependencies["vulkan-headers"].package_folder.replace("\\", "/") + if Version(self.version) < "1.3.234": + tc.variables["VULKAN_HEADERS_INSTALL_DIR"] = self.dependencies["vulkan-headers"].package_folder.replace("\\", "/") tc.variables["USE_CCACHE"] = False if self.settings.os in ["Linux", "FreeBSD"]: tc.variables["BUILD_WSI_XCB_SUPPORT"] = self.options.with_wsi_xcb @@ -142,22 +171,17 @@ def generate(self): def _patch_sources(self): apply_conandata_patches(self) - cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") - # Unusual but prefer custom FindVulkanHeaders.cmake from upstream instead of config file of conan - replace_in_file(self, cmakelists, - "find_package(VulkanHeaders REQUIRED)", - "find_package(VulkanHeaders REQUIRED MODULE)") - replace_in_file(self, os.path.join(self.source_folder, "cmake", "FindVulkanHeaders.cmake"), - "HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry", - "HINTS ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry") - # Ensure to use upstream FindWayland.cmake - if self._needs_wayland_for_build: - replace_in_file(self, cmakelists, - "find_package(Wayland REQUIRED)", - "find_package(Wayland REQUIRED MODULE)") - # Useless and may fail - if Version(self.version) >= "1.3.231": - replace_in_file(self, cmakelists, "include(VVLGenerateSourceCode)", "") + # Vulkan-ValidationLayers relies on Vulkan-Headers version from CMake config file + # to set api_version in its manifest file, but this value MUST have format x.y.z (no extra number). + # FIXME: find a way to force correct version in CMakeDeps of vulkan-headers recipe? + if Version(self.version) >= "1.3.235": + vk_version = Version(self.dependencies["vulkan-headers"].ref.version) + sanitized_vk_version = f"{vk_version.major}.{vk_version.minor}.{vk_version.patch}" + replace_in_file( + self, os.path.join(self.source_folder, "layers", "CMakeLists.txt"), + "set(JSON_API_VERSION ${VulkanHeaders_VERSION})", + f"set(JSON_API_VERSION \"{sanitized_vk_version}\")", + ) # FIXME: two CMake module/config files should be generated (SPIRV-ToolsConfig.cmake and SPIRV-Tools-optConfig.cmake), # but it can't be modeled right now in spirv-tools recipe if not os.path.exists(os.path.join(self.generators_folder, "SPIRV-Tools-optConfig.cmake")): @@ -169,13 +193,14 @@ def _patch_sources(self): def build(self): self._patch_sources() cmake = CMake(self) - cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + cmake.configure() cmake.build() def package(self): copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) cmake = CMake(self) cmake.install() + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) if self.settings.os == "Windows": # import lib is useless, validation layers are loaded at runtime lib_dir = os.path.join(self.package_folder, "lib") diff --git a/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.2.154.0.yml b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.2.154.0.yml deleted file mode 100644 index 89220f11bfbe08..00000000000000 --- a/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.2.154.0.yml +++ /dev/null @@ -1,2 +0,0 @@ -spirv-tools: "2020.5" -vulkan-headers: "1.2.154.0" diff --git a/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.236.0.yml b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.236.0.yml new file mode 100644 index 00000000000000..830bb842e9002f --- /dev/null +++ b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.236.0.yml @@ -0,0 +1,2 @@ +spirv-tools: "1.3.236.0" +vulkan-headers: "1.3.236.0" diff --git a/recipes/vulkan-validationlayers/all/patches/0001-duplicated-declaration.patch b/recipes/vulkan-validationlayers/all/patches/0001-duplicated-declaration.patch deleted file mode 100644 index ef1e6f9cb33eac..00000000000000 --- a/recipes/vulkan-validationlayers/all/patches/0001-duplicated-declaration.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/layers/range_vector.h -+++ b/layers/range_vector.h -@@ -141,8 +141,6 @@ class range_view { - const Range &range_; - }; - --template --using const_correct_iterator = decltype(std::declval().begin()); - - // Type parameters for the range_map(s) - struct insert_range_no_split_bounds { diff --git a/recipes/vulkan-validationlayers/all/patches/0002-fix-mingw.patch b/recipes/vulkan-validationlayers/all/patches/0002-fix-mingw.patch deleted file mode 100644 index 8a5be818754e98..00000000000000 --- a/recipes/vulkan-validationlayers/all/patches/0002-fix-mingw.patch +++ /dev/null @@ -1,34 +0,0 @@ -see https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/2549 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -287,6 +287,9 @@ add_library(VkLayer_utils - target_link_libraries(VkLayer_utils PUBLIC Vulkan::Headers) - if(WIN32) - target_compile_definitions(VkLayer_utils PUBLIC _CRT_SECURE_NO_WARNINGS) -+ if(MINGW) -+ target_compile_definitions(VkLayer_utils PUBLIC "_WIN32_WINNT=0x0600") -+ endif() - endif() - install(TARGETS VkLayer_utils DESTINATION ${CMAKE_INSTALL_LIBDIR}) - set_target_properties(VkLayer_utils PROPERTIES LINKER_LANGUAGE CXX) ---- a/layers/CMakeLists.txt -+++ b/layers/CMakeLists.txt -@@ -139,7 +139,7 @@ endif() - - include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/generated ${VulkanHeaders_INCLUDE_DIR}) - --if(WIN32) -+if(MSVC) - # Applies to all configurations - add_definitions(-D_CRT_SECURE_NO_WARNINGS -DNOMINMAX) - # Avoid: fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj -@@ -150,6 +150,9 @@ if(WIN32) - # that constructor initializers are now fixed to clear the struct members. - add_compile_options("$<$,$,19>>:/wd4351>") - else() -+ if(MINGW) -+ add_compile_options("-Wa,-mbig-obj") -+ endif() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpointer-arith -Wno-unused-function -Wno-sign-compare") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith -Wno-unused-function -Wno-sign-compare") - endif() diff --git a/recipes/vulkan-validationlayers/all/patches/0003-disable-nortti-and-warnings-as-errors.patch b/recipes/vulkan-validationlayers/all/patches/0003-disable-nortti-and-warnings-as-errors.patch deleted file mode 100644 index d9c8bd409372ff..00000000000000 --- a/recipes/vulkan-validationlayers/all/patches/0003-disable-nortti-and-warnings-as-errors.patch +++ /dev/null @@ -1,34 +0,0 @@ -rtti enabled: -https://github.com/KhronosGroup/Vulkan-ValidationLayers/commit/3a0631bd11f25113d28c65d9984d3f3b486026b4 -no warnings as errors submitted to upstream project: -https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/2300 -https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/2552 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -118,12 +118,14 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") - -fvisibility=hidden) - - # Treat warnings as errors for versions of GCC and c++11-compliant Clang versions that are shipped on Ubuntu 18.04 or older. -+ if(BUILD_WERROR) - if((CMAKE_COMPILER_IS_GNUCXX AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.3.0)) OR - (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") AND - (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0.0) AND - (CMAKE_CXX_COMPILER_VERSION VERSION_LESS_EQUAL 7.0.0))) - add_compile_options(-Werror) - endif() -+ endif() - - set(CMAKE_C_STANDARD 99) - set(CMAKE_CXX_STANDARD 11) -@@ -136,9 +138,9 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") - endif() - elseif(MSVC) - # Treat warnings as errors -+ if(BUILD_WERROR) - add_compile_options("/WX") -- # Disable RTTI -- add_compile_options("/GR-") -+ endif() - # Warn about nested declarations - add_compile_options("/w34456") - # Warn about potentially uninitialized variables diff --git a/recipes/vulkan-validationlayers/all/patches/0004-fix-installation.patch b/recipes/vulkan-validationlayers/all/patches/0004-fix-installation.patch deleted file mode 100644 index 2fe7804510f4bd..00000000000000 --- a/recipes/vulkan-validationlayers/all/patches/0004-fix-installation.patch +++ /dev/null @@ -1,37 +0,0 @@ -see: -https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/2307 -https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/2551 ---- a/layers/CMakeLists.txt -+++ b/layers/CMakeLists.txt -@@ -72,7 +72,7 @@ if(BUILD_LAYER_SUPPORT_FILES) - generated/vk_object_types.h - generated/vk_extension_helper.h - generated/vk_typemap_helper.h) -- install(FILES ${LAYER_UTIL_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -+ install(FILES ${LAYER_UTIL_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/vulkan) - endif() - - set(TARGET_NAMES -@@ -83,11 +83,11 @@ if(BUILD_LAYERS) - if(WIN32) - if(CMAKE_GENERATOR MATCHES "^Visual Studio.*") - foreach(TARGET_NAME ${TARGET_NAMES}) -- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$/${TARGET_NAME}.json DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+ install(FILES $/${TARGET_NAME}.json DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endforeach() - else() - foreach(TARGET_NAME ${TARGET_NAMES}) -- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.json DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+ install(FILES $/${TARGET_NAME}.json DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endforeach() - endif() - elseif(UNIX) # UNIX includes APPLE -@@ -124,7 +127,7 @@ elseif(APPLE) - "-Wl" - INSTALL_RPATH - "@loader_path/") -- install(TARGETS VkLayer_${target} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -+ install(TARGETS VkLayer_${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endmacro() - else(UNIX AND NOT APPLE) # i.e.: Linux - macro(AddVkLayer target LAYER_COMPILE_DEFINITIONS) diff --git a/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.182.patch b/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.182.patch deleted file mode 100644 index 23f54090508e93..00000000000000 --- a/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.182.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -237,10 +237,7 @@ option(BUILD_LAYERS "Build layers" ON) - option(BUILD_LAYER_SUPPORT_FILES "Generate layer files" OFF) # For generating files when not building layers - option(USE_ROBIN_HOOD_HASHING "Use robin-hood-hashing" ON) - if (USE_ROBIN_HOOD_HASHING) -- if(NOT ROBIN_HOOD_HASHING_INSTALL_DIR) -- set(ROBIN_HOOD_HASHING_INSTALL_DIR $ENV{ROBIN_HOOD_HASHING_INSTALL_DIR} PATH "Path to robin-hood-hashing repository") -- endif() -- set(ROBIN_HOOD_HASHING_INCLUDE_DIR "${ROBIN_HOOD_HASHING_INSTALL_DIR}/src/include" PATH "Path to robin-hood-hashing/src/include") -+ find_package(robin_hood REQUIRED CONFIG) - endif() - - if(BUILD_TESTS OR BUILD_LAYERS) -@@ -389,7 +386,7 @@ target_include_directories(VkLayer_utils - ${VulkanHeaders_INCLUDE_DIR}) - - if (USE_ROBIN_HOOD_HASHING) -- target_include_directories(VkLayer_utils PUBLIC ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) -+ target_link_libraries(VkLayer_utils PUBLIC robin_hood::robin_hood) - target_compile_definitions(VkLayer_utils PUBLIC USE_ROBIN_HOOD_HASHING) - endif() - ---- a/layers/CMakeLists.txt -+++ b/layers/CMakeLists.txt -@@ -291,9 +291,6 @@ if(BUILD_LAYERS) - if(INSTRUMENT_OPTICK) - target_include_directories(VkLayer_khronos_validation PRIVATE ${OPTICK_SOURCE_DIR}) - endif() -- if (USE_ROBIN_HOOD_HASHING) -- target_include_directories(VkLayer_khronos_validation PRIVATE ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) -- endif() - target_link_libraries(VkLayer_khronos_validation PRIVATE ${SPIRV_TOOLS_LIBRARIES}) - - # The output file needs Unix "/" separators or Windows "\" separators On top of that, Windows separators actually need to be doubled diff --git a/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.189.2.patch b/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.189.2.patch deleted file mode 100644 index 3f250cc259e56c..00000000000000 --- a/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.189.2.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -240,10 +240,7 @@ option(BUILD_LAYERS "Build layers" ON) - option(BUILD_LAYER_SUPPORT_FILES "Generate layer files" OFF) # For generating files when not building layers - option(USE_ROBIN_HOOD_HASHING "Use robin-hood-hashing" ON) - if (USE_ROBIN_HOOD_HASHING) -- if(NOT ROBIN_HOOD_HASHING_INSTALL_DIR) -- set(ROBIN_HOOD_HASHING_INSTALL_DIR $ENV{ROBIN_HOOD_HASHING_INSTALL_DIR} PATH "Path to robin-hood-hashing repository") -- endif() -- set(ROBIN_HOOD_HASHING_INCLUDE_DIR "${ROBIN_HOOD_HASHING_INSTALL_DIR}/src/include" PATH "Path to robin-hood-hashing/src/include") -+ find_package(robin_hood REQUIRED CONFIG) - endif() - - if(BUILD_TESTS) -@@ -375,7 +372,7 @@ target_include_directories(VkLayer_utils - ${VulkanHeaders_INCLUDE_DIR}) - - if (USE_ROBIN_HOOD_HASHING) -- target_include_directories(VkLayer_utils PUBLIC ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) -+ target_link_libraries(VkLayer_utils PUBLIC robin_hood::robin_hood) - target_compile_definitions(VkLayer_utils PUBLIC USE_ROBIN_HOOD_HASHING) - endif() - ---- a/layers/CMakeLists.txt -+++ b/layers/CMakeLists.txt -@@ -297,9 +297,6 @@ if(BUILD_LAYERS) - if(INSTRUMENT_OPTICK) - target_include_directories(VkLayer_khronos_validation PRIVATE ${OPTICK_SOURCE_DIR}) - endif() -- if (USE_ROBIN_HOOD_HASHING) -- target_include_directories(VkLayer_khronos_validation PRIVATE ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) -- endif() - target_link_libraries(VkLayer_khronos_validation PRIVATE ${SPIRV_TOOLS_LIBRARIES}) - - # The output file needs Unix "/" separators or Windows "\" separators On top of that, Windows separators actually need to be doubled diff --git a/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.198.0.patch b/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.198.0.patch deleted file mode 100644 index 00e8fb562f304e..00000000000000 --- a/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.198.0.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -237,10 +237,7 @@ option(BUILD_LAYERS "Build layers" ON) - option(BUILD_LAYER_SUPPORT_FILES "Generate layer files" OFF) # For generating files when not building layers - option(USE_ROBIN_HOOD_HASHING "Use robin-hood-hashing" ON) - if (USE_ROBIN_HOOD_HASHING) -- if(NOT ROBIN_HOOD_HASHING_INSTALL_DIR) -- set(ROBIN_HOOD_HASHING_INSTALL_DIR $ENV{ROBIN_HOOD_HASHING_INSTALL_DIR} PATH "Path to robin-hood-hashing repository") -- endif() -- set(ROBIN_HOOD_HASHING_INCLUDE_DIR "${ROBIN_HOOD_HASHING_INSTALL_DIR}/src/include" PATH "Path to robin-hood-hashing/src/include") -+ find_package(robin_hood REQUIRED CONFIG) - endif() - - if(BUILD_TESTS) -@@ -372,7 +369,7 @@ target_include_directories(VkLayer_utils - ${VulkanHeaders_INCLUDE_DIR}) - - if (USE_ROBIN_HOOD_HASHING) -- target_include_directories(VkLayer_utils PUBLIC ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) -+ target_link_libraries(VkLayer_utils PUBLIC robin_hood::robin_hood) - target_compile_definitions(VkLayer_utils PUBLIC USE_ROBIN_HOOD_HASHING) - endif() - ---- a/layers/CMakeLists.txt -+++ b/layers/CMakeLists.txt -@@ -301,9 +301,6 @@ if(BUILD_LAYERS) - if(INSTRUMENT_OPTICK) - target_include_directories(VkLayer_khronos_validation PRIVATE ${OPTICK_SOURCE_DIR}) - endif() -- if (USE_ROBIN_HOOD_HASHING) -- target_include_directories(VkLayer_khronos_validation PRIVATE ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) -- endif() - target_link_libraries(VkLayer_khronos_validation PRIVATE ${SPIRV_TOOLS_LIBRARIES}) - - # The output file needs Unix "/" separators or Windows "\" separators On top of that, Windows separators actually need to be doubled diff --git a/recipes/vulkan-validationlayers/all/patches/1.2.182-0001-fix-cmake.patch b/recipes/vulkan-validationlayers/all/patches/1.2.182-0001-fix-cmake.patch new file mode 100644 index 00000000000000..1df1151c343670 --- /dev/null +++ b/recipes/vulkan-validationlayers/all/patches/1.2.182-0001-fix-cmake.patch @@ -0,0 +1,83 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -102,7 +102,7 @@ if (TARGET Vulkan::Headers) + get_target_property(VulkanHeaders_INCLUDE_DIRS Vulkan::Headers INTERFACE_INCLUDE_DIRECTORIES) + get_target_property(VulkanRegistry_DIR Vulkan::Registry INTERFACE_INCLUDE_DIRECTORIES) + else() +- find_package(VulkanHeaders REQUIRED) ++ find_package(VulkanHeaders REQUIRED MODULE) + + # xxxnsubtil: this should eventually be replaced by exported targets + add_library(Vulkan-Headers INTERFACE) +@@ -154,7 +154,7 @@ if(UNIX AND NOT APPLE) # i.e. Linux + endif() + + if(BUILD_WSI_WAYLAND_SUPPORT) +- find_package(Wayland REQUIRED) ++ find_package(Wayland REQUIRED MODULE) + include_directories(${WAYLAND_CLIENT_INCLUDE_DIR}) + endif() + endif() +@@ -237,13 +237,10 @@ option(BUILD_LAYERS "Build layers" ON) + option(BUILD_LAYER_SUPPORT_FILES "Generate layer files" OFF) # For generating files when not building layers + option(USE_ROBIN_HOOD_HASHING "Use robin-hood-hashing" ON) + if (USE_ROBIN_HOOD_HASHING) +- if(NOT ROBIN_HOOD_HASHING_INSTALL_DIR) +- set(ROBIN_HOOD_HASHING_INSTALL_DIR $ENV{ROBIN_HOOD_HASHING_INSTALL_DIR} PATH "Path to robin-hood-hashing repository") +- endif() +- set(ROBIN_HOOD_HASHING_INCLUDE_DIR "${ROBIN_HOOD_HASHING_INSTALL_DIR}/src/include" PATH "Path to robin-hood-hashing/src/include") ++ find_package(robin_hood REQUIRED CONFIG) + endif() + +-if(BUILD_TESTS OR BUILD_LAYERS) ++if(BUILD_TESTS) + + set(GLSLANG_INSTALL_DIR "GLSLANG-NOTFOUND" CACHE PATH "Absolute path to a glslang install directory") + if(NOT GLSLANG_INSTALL_DIR AND NOT DEFINED ENV{GLSLANG_INSTALL_DIR} AND NOT TARGET glslang) +@@ -302,8 +299,14 @@ if(BUILD_TESTS OR BUILD_LAYERS) + set(GLSLANG_SPIRV_INCLUDE_DIR "${glslang_SOURCE_DIR}" CACHE PATH "Path to glslang spirv headers") + set(GLSLANG_LIBRARIES glslang SPIRV SPVRemapper) + endif() ++endif() + ++if(BUILD_TESTS OR BUILD_LAYERS) + # spirv-tools ++ find_package(SPIRV-Tools REQUIRED CONFIG) ++ if(NOT TARGET SPIRV-Tools-opt) ++ find_package(SPIRV-Tools-opt REQUIRED CONFIG) ++ endif() + if (NOT TARGET SPIRV-Tools) + if(NOT SPIRV_TOOLS_INSTALL_DIR) + set(SPIRV_TOOLS_INSTALL_DIR "${GLSLANG_INSTALL_DIR}") +@@ -389,7 +392,7 @@ target_include_directories(VkLayer_utils + ${VulkanHeaders_INCLUDE_DIR}) + + if (USE_ROBIN_HOOD_HASHING) +- target_include_directories(VkLayer_utils PUBLIC ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) ++ target_link_libraries(VkLayer_utils PUBLIC robin_hood::robin_hood) + target_compile_definitions(VkLayer_utils PUBLIC USE_ROBIN_HOOD_HASHING) + endif() + +--- a/cmake/FindVulkanHeaders.cmake ++++ b/cmake/FindVulkanHeaders.cmake +@@ -62,7 +62,7 @@ if(DEFINED VULKAN_HEADERS_INSTALL_DIR) + NO_CMAKE_FIND_ROOT_PATH) + find_path(VulkanRegistry_DIR + NAMES vk.xml +- HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ++ HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry + NO_CMAKE_FIND_ROOT_PATH) + else() + # If VULKAN_HEADERS_INSTALL_DIR, or one of its variants was not specified, +--- a/layers/CMakeLists.txt ++++ b/layers/CMakeLists.txt +@@ -291,9 +291,6 @@ if(BUILD_LAYERS) + if(INSTRUMENT_OPTICK) + target_include_directories(VkLayer_khronos_validation PRIVATE ${OPTICK_SOURCE_DIR}) + endif() +- if (USE_ROBIN_HOOD_HASHING) +- target_include_directories(VkLayer_khronos_validation PRIVATE ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) +- endif() + target_link_libraries(VkLayer_khronos_validation PRIVATE ${SPIRV_TOOLS_LIBRARIES}) + + # The output file needs Unix "/" separators or Windows "\" separators On top of that, Windows separators actually need to be doubled diff --git a/recipes/vulkan-validationlayers/all/patches/1.2.189.2-0001-fix-cmake.patch b/recipes/vulkan-validationlayers/all/patches/1.2.189.2-0001-fix-cmake.patch new file mode 100644 index 00000000000000..a5cb883c9cc3ae --- /dev/null +++ b/recipes/vulkan-validationlayers/all/patches/1.2.189.2-0001-fix-cmake.patch @@ -0,0 +1,75 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -111,7 +111,7 @@ if (TARGET Vulkan::Headers) + get_target_property(VulkanHeaders_INCLUDE_DIRS Vulkan::Headers INTERFACE_INCLUDE_DIRECTORIES) + get_target_property(VulkanRegistry_DIR Vulkan::Registry INTERFACE_INCLUDE_DIRECTORIES) + else() +- find_package(VulkanHeaders REQUIRED) ++ find_package(VulkanHeaders REQUIRED MODULE) + + # xxxnsubtil: this should eventually be replaced by exported targets + add_library(Vulkan-Headers INTERFACE) +@@ -163,7 +163,7 @@ if(UNIX AND NOT APPLE) # i.e. Linux + endif() + + if(BUILD_WSI_WAYLAND_SUPPORT) +- find_package(Wayland REQUIRED) ++ find_package(Wayland REQUIRED MODULE) + include_directories(${WAYLAND_CLIENT_INCLUDE_DIR}) + endif() + endif() +@@ -240,10 +240,7 @@ option(BUILD_LAYERS "Build layers" ON) + option(BUILD_LAYER_SUPPORT_FILES "Generate layer files" OFF) # For generating files when not building layers + option(USE_ROBIN_HOOD_HASHING "Use robin-hood-hashing" ON) + if (USE_ROBIN_HOOD_HASHING) +- if(NOT ROBIN_HOOD_HASHING_INSTALL_DIR) +- set(ROBIN_HOOD_HASHING_INSTALL_DIR $ENV{ROBIN_HOOD_HASHING_INSTALL_DIR} PATH "Path to robin-hood-hashing repository") +- endif() +- set(ROBIN_HOOD_HASHING_INCLUDE_DIR "${ROBIN_HOOD_HASHING_INSTALL_DIR}/src/include" PATH "Path to robin-hood-hashing/src/include") ++ find_package(robin_hood REQUIRED CONFIG) + endif() + + if(BUILD_TESTS) +@@ -307,6 +304,10 @@ endif() + + if(BUILD_TESTS OR BUILD_LAYERS) + # spirv-tools ++ find_package(SPIRV-Tools REQUIRED CONFIG) ++ if(NOT TARGET SPIRV-Tools-opt) ++ find_package(SPIRV-Tools-opt REQUIRED CONFIG) ++ endif() + if (NOT TARGET SPIRV-Tools) + if(NOT SPIRV_TOOLS_INSTALL_DIR) + set(SPIRV_TOOLS_INSTALL_DIR "${GLSLANG_INSTALL_DIR}") +@@ -375,7 +376,7 @@ target_include_directories(VkLayer_utils + ${VulkanHeaders_INCLUDE_DIR}) + + if (USE_ROBIN_HOOD_HASHING) +- target_include_directories(VkLayer_utils PUBLIC ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) ++ target_link_libraries(VkLayer_utils PUBLIC robin_hood::robin_hood) + target_compile_definitions(VkLayer_utils PUBLIC USE_ROBIN_HOOD_HASHING) + endif() + +--- a/cmake/FindVulkanHeaders.cmake ++++ b/cmake/FindVulkanHeaders.cmake +@@ -62,7 +62,7 @@ if(DEFINED VULKAN_HEADERS_INSTALL_DIR) + NO_CMAKE_FIND_ROOT_PATH) + find_path(VulkanRegistry_DIR + NAMES vk.xml +- HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ++ HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry + NO_CMAKE_FIND_ROOT_PATH) + else() + # If VULKAN_HEADERS_INSTALL_DIR, or one of its variants was not specified, +--- a/layers/CMakeLists.txt ++++ b/layers/CMakeLists.txt +@@ -297,9 +297,6 @@ if(BUILD_LAYERS) + if(INSTRUMENT_OPTICK) + target_include_directories(VkLayer_khronos_validation PRIVATE ${OPTICK_SOURCE_DIR}) + endif() +- if (USE_ROBIN_HOOD_HASHING) +- target_include_directories(VkLayer_khronos_validation PRIVATE ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) +- endif() + target_link_libraries(VkLayer_khronos_validation PRIVATE ${SPIRV_TOOLS_LIBRARIES}) + + # The output file needs Unix "/" separators or Windows "\" separators On top of that, Windows separators actually need to be doubled diff --git a/recipes/vulkan-validationlayers/all/patches/1.2.198.0-0001-fix-cmake.patch b/recipes/vulkan-validationlayers/all/patches/1.2.198.0-0001-fix-cmake.patch new file mode 100644 index 00000000000000..e482c6be482cfa --- /dev/null +++ b/recipes/vulkan-validationlayers/all/patches/1.2.198.0-0001-fix-cmake.patch @@ -0,0 +1,75 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -108,7 +108,7 @@ if (TARGET Vulkan::Headers) + get_target_property(VulkanHeaders_INCLUDE_DIRS Vulkan::Headers INTERFACE_INCLUDE_DIRECTORIES) + get_target_property(VulkanRegistry_DIR Vulkan::Registry INTERFACE_INCLUDE_DIRECTORIES) + else() +- find_package(VulkanHeaders REQUIRED) ++ find_package(VulkanHeaders REQUIRED MODULE) + + # xxxnsubtil: this should eventually be replaced by exported targets + add_library(Vulkan-Headers INTERFACE) +@@ -160,7 +160,7 @@ if(UNIX AND NOT APPLE) # i.e. Linux + endif() + + if(BUILD_WSI_WAYLAND_SUPPORT) +- find_package(Wayland REQUIRED) ++ find_package(Wayland REQUIRED MODULE) + include_directories(${WAYLAND_CLIENT_INCLUDE_DIR}) + endif() + endif() +@@ -237,10 +237,7 @@ option(BUILD_LAYERS "Build layers" ON) + option(BUILD_LAYER_SUPPORT_FILES "Generate layer files" OFF) # For generating files when not building layers + option(USE_ROBIN_HOOD_HASHING "Use robin-hood-hashing" ON) + if (USE_ROBIN_HOOD_HASHING) +- if(NOT ROBIN_HOOD_HASHING_INSTALL_DIR) +- set(ROBIN_HOOD_HASHING_INSTALL_DIR $ENV{ROBIN_HOOD_HASHING_INSTALL_DIR} PATH "Path to robin-hood-hashing repository") +- endif() +- set(ROBIN_HOOD_HASHING_INCLUDE_DIR "${ROBIN_HOOD_HASHING_INSTALL_DIR}/src/include" PATH "Path to robin-hood-hashing/src/include") ++ find_package(robin_hood REQUIRED CONFIG) + endif() + + if(BUILD_TESTS) +@@ -304,6 +301,10 @@ endif() + + if(BUILD_TESTS OR BUILD_LAYERS) + # spirv-tools ++ find_package(SPIRV-Tools REQUIRED CONFIG) ++ if(NOT TARGET SPIRV-Tools-opt) ++ find_package(SPIRV-Tools-opt REQUIRED CONFIG) ++ endif() + if (NOT TARGET SPIRV-Tools) + if(NOT SPIRV_TOOLS_INSTALL_DIR) + set(SPIRV_TOOLS_INSTALL_DIR "${GLSLANG_INSTALL_DIR}") +@@ -372,7 +373,7 @@ target_include_directories(VkLayer_utils + ${VulkanHeaders_INCLUDE_DIR}) + + if (USE_ROBIN_HOOD_HASHING) +- target_include_directories(VkLayer_utils PUBLIC ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) ++ target_link_libraries(VkLayer_utils PUBLIC robin_hood::robin_hood) + target_compile_definitions(VkLayer_utils PUBLIC USE_ROBIN_HOOD_HASHING) + endif() + +--- a/cmake/FindVulkanHeaders.cmake ++++ b/cmake/FindVulkanHeaders.cmake +@@ -62,7 +62,7 @@ if(DEFINED VULKAN_HEADERS_INSTALL_DIR) + NO_CMAKE_FIND_ROOT_PATH) + find_path(VulkanRegistry_DIR + NAMES vk.xml +- HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ++ HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry + NO_CMAKE_FIND_ROOT_PATH) + else() + # If VULKAN_HEADERS_INSTALL_DIR, or one of its variants was not specified, +--- a/layers/CMakeLists.txt ++++ b/layers/CMakeLists.txt +@@ -301,9 +301,6 @@ if(BUILD_LAYERS) + if(INSTRUMENT_OPTICK) + target_include_directories(VkLayer_khronos_validation PRIVATE ${OPTICK_SOURCE_DIR}) + endif() +- if (USE_ROBIN_HOOD_HASHING) +- target_include_directories(VkLayer_khronos_validation PRIVATE ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) +- endif() + target_link_libraries(VkLayer_khronos_validation PRIVATE ${SPIRV_TOOLS_LIBRARIES}) + + # The output file needs Unix "/" separators or Windows "\" separators On top of that, Windows separators actually need to be doubled diff --git a/recipes/vulkan-validationlayers/all/patches/1.3.204.1-0001-fix-cmake.patch b/recipes/vulkan-validationlayers/all/patches/1.3.204.1-0001-fix-cmake.patch new file mode 100644 index 00000000000000..319efad89dcde6 --- /dev/null +++ b/recipes/vulkan-validationlayers/all/patches/1.3.204.1-0001-fix-cmake.patch @@ -0,0 +1,31 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -122,7 +122,7 @@ if (TARGET Vulkan::Headers) + get_target_property(VulkanHeaders_INCLUDE_DIRS Vulkan::Headers INTERFACE_INCLUDE_DIRECTORIES) + get_target_property(VulkanRegistry_DIR Vulkan::Registry INTERFACE_INCLUDE_DIRECTORIES) + else() +- find_package(VulkanHeaders REQUIRED) ++ find_package(VulkanHeaders REQUIRED MODULE) + + # xxxnsubtil: this should eventually be replaced by exported targets + add_library(Vulkan-Headers INTERFACE) +@@ -174,7 +174,7 @@ if(UNIX AND NOT APPLE) # i.e. Linux + endif() + + if(BUILD_WSI_WAYLAND_SUPPORT) +- find_package(Wayland REQUIRED) ++ find_package(Wayland REQUIRED MODULE) + include_directories(${WAYLAND_CLIENT_INCLUDE_DIR}) + endif() + endif() +--- a/cmake/FindVulkanHeaders.cmake ++++ b/cmake/FindVulkanHeaders.cmake +@@ -62,7 +62,7 @@ if(DEFINED VULKAN_HEADERS_INSTALL_DIR) + NO_CMAKE_FIND_ROOT_PATH) + find_path(VulkanRegistry_DIR + NAMES vk.xml +- HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ++ HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry + NO_CMAKE_FIND_ROOT_PATH) + else() + # If VULKAN_HEADERS_INSTALL_DIR, or one of its variants was not specified, diff --git a/recipes/vulkan-validationlayers/all/patches/1.3.224.1-0001-fix-cmake.patch b/recipes/vulkan-validationlayers/all/patches/1.3.224.1-0001-fix-cmake.patch new file mode 100644 index 00000000000000..76ce4f2ef3df39 --- /dev/null +++ b/recipes/vulkan-validationlayers/all/patches/1.3.224.1-0001-fix-cmake.patch @@ -0,0 +1,31 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -122,7 +122,7 @@ if (TARGET Vulkan::Headers) + get_target_property(VulkanHeaders_INCLUDE_DIRS Vulkan::Headers INTERFACE_INCLUDE_DIRECTORIES) + get_target_property(VulkanRegistry_DIR Vulkan::Registry INTERFACE_INCLUDE_DIRECTORIES) + else() +- find_package(VulkanHeaders REQUIRED) ++ find_package(VulkanHeaders REQUIRED MODULE) + + # xxxnsubtil: this should eventually be replaced by exported targets + add_library(Vulkan-Headers INTERFACE) +@@ -174,7 +174,7 @@ if(UNIX AND NOT APPLE) # i.e. Linux + endif() + + if(BUILD_WSI_WAYLAND_SUPPORT) +- find_package(Wayland REQUIRED) ++ find_package(Wayland REQUIRED MODULE) + include_directories(${WAYLAND_CLIENT_INCLUDE_DIR}) + endif() + endif() +--- a/cmake/FindVulkanHeaders.cmake ++++ b/cmake/FindVulkanHeaders.cmake +@@ -63,7 +63,7 @@ if(DEFINED VULKAN_HEADERS_INSTALL_DIR) + NO_DEFAULT_PATH) + find_path(VulkanRegistry_DIR + NAMES vk.xml +- HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ++ HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry + NO_CMAKE_FIND_ROOT_PATH + NO_DEFAULT_PATH) + else() diff --git a/recipes/vulkan-validationlayers/all/patches/1.3.231.1-0001-fix-cmake.patch b/recipes/vulkan-validationlayers/all/patches/1.3.231.1-0001-fix-cmake.patch new file mode 100644 index 00000000000000..dc7286044497fb --- /dev/null +++ b/recipes/vulkan-validationlayers/all/patches/1.3.231.1-0001-fix-cmake.patch @@ -0,0 +1,30 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -103,7 +103,7 @@ if (GOOGLETEST_INSTALL_DIR) + list(APPEND CMAKE_PREFIX_PATH ${GOOGLETEST_INSTALL_DIR}) + endif() + +-find_package(VulkanHeaders REQUIRED) ++find_package(VulkanHeaders REQUIRED MODULE) + add_library(Vulkan-Headers INTERFACE) + target_include_directories(Vulkan-Headers INTERFACE ${VulkanHeaders_INCLUDE_DIRS}) + add_library(Vulkan::Headers ALIAS Vulkan-Headers) +@@ -229,7 +229,6 @@ if(BUILD_LAYERS OR BUILD_TESTS) + endif() + + # VVLGenerateSourceCode depends on spirv/unified1 +- include(VVLGenerateSourceCode) + + if (NOT TARGET SPIRV-Tools-opt) + find_package(SPIRV-Tools-opt REQUIRED CONFIG) +--- a/cmake/FindVulkanHeaders.cmake ++++ b/cmake/FindVulkanHeaders.cmake +@@ -63,7 +63,7 @@ if(DEFINED VULKAN_HEADERS_INSTALL_DIR) + NO_DEFAULT_PATH) + find_path(VulkanRegistry_DIR + NAMES vk.xml +- HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ++ HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry + NO_CMAKE_FIND_ROOT_PATH + NO_DEFAULT_PATH) + else() diff --git a/recipes/vulkan-validationlayers/all/patches/1.3.231.1-cmake-no-werror.patch b/recipes/vulkan-validationlayers/all/patches/1.3.231.1-0002-cmake-no-werror.patch similarity index 100% rename from recipes/vulkan-validationlayers/all/patches/1.3.231.1-cmake-no-werror.patch rename to recipes/vulkan-validationlayers/all/patches/1.3.231.1-0002-cmake-no-werror.patch diff --git a/recipes/vulkan-validationlayers/all/patches/1.3.236.0-0001-fix-cmake.patch b/recipes/vulkan-validationlayers/all/patches/1.3.236.0-0001-fix-cmake.patch new file mode 100644 index 00000000000000..f63003f30dac55 --- /dev/null +++ b/recipes/vulkan-validationlayers/all/patches/1.3.236.0-0001-fix-cmake.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -230,7 +230,6 @@ endif() + if(BUILD_LAYERS OR BUILD_TESTS) + find_package(SPIRV-Headers REQUIRED CONFIG QUIET) + +- include(VVLGenerateSourceCode) + + find_package(SPIRV-Tools-opt REQUIRED CONFIG QUIET) + diff --git a/recipes/vulkan-validationlayers/all/test_package/CMakeLists.txt b/recipes/vulkan-validationlayers/all/test_package/CMakeLists.txt index 29405b4177fbec..f968d5c77f9777 100644 --- a/recipes/vulkan-validationlayers/all/test_package/CMakeLists.txt +++ b/recipes/vulkan-validationlayers/all/test_package/CMakeLists.txt @@ -5,4 +5,8 @@ find_package(vulkan-validationlayers REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE vulkan-validationlayers::vulkan-validationlayers) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +if(vulkan-validationlayers_VERSION VERSION_GREATER_EQUAL "1.3.235") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +endif() diff --git a/recipes/vulkan-validationlayers/config.yml b/recipes/vulkan-validationlayers/config.yml index cc5317034e1207..8da325f5c1293b 100644 --- a/recipes/vulkan-validationlayers/config.yml +++ b/recipes/vulkan-validationlayers/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.236.0": + folder: all "1.3.231.1": folder: all "1.3.224.1": @@ -15,5 +17,3 @@ versions: folder: all "1.2.182": folder: all - "1.2.154.0": - folder: all diff --git a/recipes/wasmedge/all/conandata.yml b/recipes/wasmedge/all/conandata.yml index c52eb9e32d6e42..363797364db789 100644 --- a/recipes/wasmedge/all/conandata.yml +++ b/recipes/wasmedge/all/conandata.yml @@ -1,4 +1,45 @@ sources: + "0.11.2": + Windows: + "x86_64": + Visual Studio: + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.11.2/WasmEdge-0.11.2-windows.zip" + sha256: "ca49b98c0cf5f187e08c3ba71afc8d71365fde696f10b4219379a4a4d1a91e6d" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.11.2/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + Linux: + "x86_64": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.11.2/WasmEdge-0.11.2-manylinux2014_x86_64.tar.gz" + sha256: "784bf1eb25928e2cf02aa88e9372388fad682b4a188485da3cd9162caeedf143" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.11.2/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + "armv8": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.11.2/WasmEdge-0.11.2-manylinux2014_aarch64.tar.gz" + sha256: "a2766a4c1edbaea298a30e5431a4e795003a10d8398a933d923f23d4eb4fa5d1" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.11.1/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + Macos: + "x86_64": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.11.2/WasmEdge-0.11.2-darwin_x86_64.tar.gz" + sha256: "aedec53f29b1e0b657e46e67dba3e2f32a2924f4d9136e60073ea1aba3073e70" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.11.2/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + "armv8": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.11.2/WasmEdge-0.11.2-darwin_arm64.tar.gz" + sha256: "fe391df90e1eee69cf1e976f5ddf60c20f29b651710aaa4fc03e2ab4fe52c0d3" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.11.2/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + Android: + "armv8": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.11.2/WasmEdge-0.11.2-android_aarch64.tar.gz" + sha256: "69e308f5927c753b2bb5639569d10219b60598174d8b304bdf310093fd7b2464" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.11.2/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" "0.11.1": Windows: "x86_64": @@ -20,6 +61,26 @@ sources: sha256: "cb9ea32932360463991cfda80e09879b2cf6c69737f12f3f2b371cd0af4e9ce8" - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.11.1/LICENSE" sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + Macos: + "x86_64": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.11.1/WasmEdge-0.11.1-darwin_x86_64.tar.gz" + sha256: "56df2b00669c25b8143ea2c17370256cd6a33f3b316d3b47857dd38d603cb69a" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.11.1/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + "armv8": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.11.1/WasmEdge-0.11.1-darwin_arm64.tar.gz" + sha256: "82f7da1a7a36ec1923fb045193784dd090a03109e84da042af97297205a71f08" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.11.1/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + Android: + "armv8": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.11.1/WasmEdge-0.11.1-android_aarch64.tar.gz" + sha256: "af8694e93bf72ac5506450d4caebccc340fbba254dca3d58ec0712e96ec9dedd" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.11.1/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" "0.10.0": Windows: "x86_64": diff --git a/recipes/wasmedge/all/conanfile.py b/recipes/wasmedge/all/conanfile.py index 7b10dc7e45e9a1..22d9509121432f 100644 --- a/recipes/wasmedge/all/conanfile.py +++ b/recipes/wasmedge/all/conanfile.py @@ -1,25 +1,22 @@ from conan import ConanFile -from conan.tools.files import get, download +from conan.tools.files import get, copy, download from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration + import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.47.0" class WasmedgeConan(ConanFile): name = "wasmedge" description = ("WasmEdge is a lightweight, high-performance, and extensible WebAssembly runtime" "for cloud native, edge, and decentralized applications." "It powers serverless apps, embedded functions, microservices, smart contracts, and IoT devices.") - topics = ("webassembly", "wasm", "wasi", "emscripten") license = "Apache-2.0" - homepage = "https://github.com/WasmEdge/WasmEdge/" url = "https://github.com/conan-io/conan-center-index" - settings = "os", "arch", "compiler", - - @property - def _source_subfolder(self): - return "source_subfolder" + homepage = "https://github.com/WasmEdge/WasmEdge/" + topics = ("webassembly", "wasm", "wasi", "emscripten") + settings = "os", "arch", "compiler", "build_type" @property def _compiler_alias(self): @@ -43,31 +40,33 @@ def package_id(self): self.info.settings.compiler = self._compiler_alias def source(self): + # This is packaging binaries so the download needs to be in build get(self, **self.conan_data["sources"][self.version][str(self.settings.os)][str(self.settings.arch)][self._compiler_alias][0], - destination=self._source_subfolder, strip_root=True) + destination=self.source_folder, strip_root=True) download(self, filename="LICENSE", - **self.conan_data["sources"][self.version][str(self.settings.os)][str(self.settings.arch)][self._compiler_alias][1]) # noqa: E128 + **self.conan_data["sources"][self.version][str(self.settings.os)][str(self.settings.arch)][self._compiler_alias][1]) def package(self): - self.copy("*.h", src=os.path.join(self._source_subfolder, "include"), dst="include", keep_path=True) - self.copy("*.inc", src=os.path.join(self._source_subfolder, "include"), dst="include", keep_path=True) + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include"), keep_path=True) + copy(self, pattern="*.inc", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include"), keep_path=True) - srclibdir = os.path.join(self._source_subfolder, "lib64" if self.settings.os == "Linux" else "lib") - srcbindir = os.path.join(self._source_subfolder, "bin") + srclibdir = os.path.join(self.source_folder, "lib64" if self.settings.os == "Linux" else "lib") + srcbindir = os.path.join(self.source_folder, "bin") + dstlibdir = os.path.join(self.package_folder, "lib") + dstbindir = os.path.join(self.package_folder, "bin") if Version(self.version) >= "0.11.1": - self.copy("wasmedge.lib", src=srclibdir, dst="lib", keep_path=False) - self.copy("wasmedge.dll", src=srcbindir, dst="bin", keep_path=False) - self.copy("libwasmedge.so*", src=srclibdir, dst="lib", keep_path=False) - self.copy("libwasmedge.dylib", src=srclibdir, dst="lib", keep_path=False) + copy(self, pattern="wasmedge.lib", src=srclibdir, dst=dstlibdir, keep_path=False) + copy(self, pattern="wasmedge.dll", src=srcbindir, dst=dstbindir, keep_path=False) + copy(self, pattern="libwasmedge.so*", src=srclibdir, dst=dstlibdir, keep_path=False) + copy(self, pattern="libwasmedge*.dylib", src=srclibdir, dst=dstlibdir, keep_path=False) else: - self.copy("wasmedge_c.lib", src=srclibdir, dst="lib", keep_path=False) - self.copy("wasmedge_c.dll", src=srcbindir, dst="bin", keep_path=False) - self.copy("libwasmedge_c.so*", src=srclibdir, dst="lib", keep_path=False) - self.copy("libwasmedge_c.dylib", src=srclibdir, dst="lib", keep_path=False) - - self.copy("wasmedge*", src=srcbindir, dst="bin", keep_path=False) + copy(self, pattern="wasmedge_c.lib", src=srclibdir, dst=dstlibdir, keep_path=False) + copy(self, pattern="wasmedge_c.dll", src=srcbindir, dst=dstbindir, keep_path=False) + copy(self, pattern="libwasmedge_c.so*", src=srclibdir, dst=dstlibdir, keep_path=False) + copy(self, pattern="libwasmedge_c*.dylib", src=srclibdir, dst=dstlibdir, keep_path=False) - self.copy("LICENSE", dst="licenses", keep_path=False) + copy(self, pattern="wasmedge*", src=srcbindir, dst=dstbindir, keep_path=False) + copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"), keep_path=False) def package_info(self): if Version(self.version) >= "0.11.1": @@ -78,3 +77,14 @@ def package_info(self): bindir = os.path.join(self.package_folder, "bin") self.output.info("Appending PATH environment variable: {}".format(bindir)) self.env_info.PATH.append(bindir) + + if self.settings.os == "Windows": + self.cpp_info.system_libs.append("ws2_32") + self.cpp_info.system_libs.append("wsock32") + self.cpp_info.system_libs.append("shlwapi") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.system_libs.append("dl") + self.cpp_info.system_libs.append("rt") + self.cpp_info.system_libs.append("pthread") diff --git a/recipes/wasmedge/all/test_package/CMakeLists.txt b/recipes/wasmedge/all/test_package/CMakeLists.txt index 537356e17d0896..a433b073bf6ead 100644 --- a/recipes/wasmedge/all/test_package/CMakeLists.txt +++ b/recipes/wasmedge/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.8) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(wasmedge REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/wasmedge/all/test_package/conanfile.py b/recipes/wasmedge/all/test_package/conanfile.py index 194e60765d566f..a9fb96656f2039 100644 --- a/recipes/wasmedge/all/test_package/conanfile.py +++ b/recipes/wasmedge/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.20.1") + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -21,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/wasmedge/all/test_v1_package/CMakeLists.txt b/recipes/wasmedge/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/wasmedge/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/wasmedge/all/test_v1_package/conanfile.py b/recipes/wasmedge/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/wasmedge/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/wasmedge/config.yml b/recipes/wasmedge/config.yml index 43f005e3eef73d..26c6ed136a298a 100644 --- a/recipes/wasmedge/config.yml +++ b/recipes/wasmedge/config.yml @@ -1,4 +1,6 @@ versions: + "0.11.2": + folder: "all" "0.11.1": folder: "all" "0.10.0": diff --git a/recipes/wasmer/all/conandata.yml b/recipes/wasmer/all/conandata.yml index 01856a9a19dff2..7b9c9649cb8d80 100644 --- a/recipes/wasmer/all/conandata.yml +++ b/recipes/wasmer/all/conandata.yml @@ -1,4 +1,31 @@ sources: + "3.1.0": + Windows: + "x86_64": + "Visual Studio": + url: "https://github.com/wasmerio/wasmer/releases/download/v3.1.0/wasmer-windows-amd64.tar.gz" + sha256: "6f49be0023571f9d4edab36c4acdd449c3a03da483c1f4412fbfcc98fe455dce" + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v3.1.0/wasmer-windows-gnu64.tar.gz" + sha256: "6dec33b2dbadde24b2ec1219f8e65588020dfc79de48a0e3f1ab130be6883760" + Linux: + "x86_64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v3.1.0/wasmer-linux-amd64.tar.gz" + sha256: "c22116e42a51bf0646c55c43337a137b3edd0da2f23a8b7eeba8f4acbae9a1c4" + "armv8": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v3.1.0/wasmer-linux-aarch64.tar.gz" + sha256: "37af1383f19c0470a2454f8e3901eab91ea8439a81d8af4eb2ba81966130b4dd" + Macos: + "x86_64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v3.1.0/wasmer-darwin-amd64.tar.gz" + sha256: "a8415fadf7de329a6444879e02f746c1ce793cbfbbc77907b447a00aacc35d34" + "armv8": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v3.1.0/wasmer-darwin-arm64.tar.gz" + sha256: "737877b59d702b853a3f70632ea90d884dc8e616c2076492337c6ef81e1d3026" "3.0.2": Windows: "x86_64": diff --git a/recipes/wasmer/config.yml b/recipes/wasmer/config.yml index b906f1a81196dd..e0d445f36bd335 100644 --- a/recipes/wasmer/config.yml +++ b/recipes/wasmer/config.yml @@ -1,4 +1,6 @@ versions: + "3.1.0": + folder: "all" "3.0.2": folder: "all" "2.3.0": diff --git a/recipes/wasmtime/all/conandata.yml b/recipes/wasmtime/all/conandata.yml index a30b87d1de7eb5..ebf6258c632da3 100644 --- a/recipes/wasmtime/all/conandata.yml +++ b/recipes/wasmtime/all/conandata.yml @@ -1,4 +1,34 @@ sources: + "4.0.0": + Windows: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v4.0.0/wasmtime-v4.0.0-x86_64-windows-c-api.zip" + sha256: "b2874ab0e2f7588dacef433bd1f9c4cd958243ef4cbbc5886b328cd14eab5d48" + MinGW: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v4.0.0/wasmtime-v4.0.0-x86_64-mingw-c-api.zip" + sha256: "68c0a5fccdd875c0d653110af94bceb2d8e35b0d836f8784bccea2d5b5b88108" + Linux: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v4.0.0/wasmtime-v4.0.0-x86_64-linux-c-api.tar.xz" + sha256: "174166c8c2294d66844fe9736543e9edc8a28ff8db18b26e8b74f5a27024f8c5" + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v4.0.0/wasmtime-v4.0.0-aarch64-linux-c-api.tar.xz" + sha256: "f3017e9272068a264234efec5df822b619299e138bd2fdab2eca43c73d8e7d26" + "s390x": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v4.0.0/wasmtime-v4.0.0-s390x-linux-c-api.tar.xz" + sha256: "9243404037187900ed85188744d28501c786abba1098a933a8c80363d3763350" + Macos: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v4.0.0/wasmtime-v4.0.0-x86_64-macos-c-api.tar.xz" + sha256: "41d0d2fd9c9942f0b00eac3da6ddfaca5a660a61c6220bc608d2e15d5adfbdd4" + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v4.0.0/wasmtime-v4.0.0-aarch64-macos-c-api.tar.xz" + sha256: "2761ee87f265e520a2ed1d82188c958f5dc244ad6fed94a80f6af33f705a320d" + Android: + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v4.0.0/wasmtime-v4.0.0-aarch64-linux-c-api.tar.xz" + sha256: "f3017e9272068a264234efec5df822b619299e138bd2fdab2eca43c73d8e7d26" "3.0.0": Windows: "x86_64": diff --git a/recipes/wasmtime/config.yml b/recipes/wasmtime/config.yml index 30c740d2e0859f..77c35aceade8ed 100644 --- a/recipes/wasmtime/config.yml +++ b/recipes/wasmtime/config.yml @@ -1,4 +1,6 @@ versions: + "4.0.0": + folder: all "3.0.0": folder: all "2.0.0": diff --git a/recipes/watcher/all/conandata.yml b/recipes/watcher/all/conandata.yml index 50a4532cdfc906..5edbc5be3e8cd8 100644 --- a/recipes/watcher/all/conandata.yml +++ b/recipes/watcher/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "0.5.5": + url: "https://github.com/e-dant/watcher/archive/release/0.5.4.tar.gz" + sha256: "0dac1d89886252bb0b999c2dad85aff283022a2b4393922a993459b180b8c663" + "0.5.4": + url: "https://github.com/e-dant/watcher/archive/release/0.5.4.tar.gz" + sha256: "0dac1d89886252bb0b999c2dad85aff283022a2b4393922a993459b180b8c663" + "0.5.2": + url: "https://github.com/e-dant/watcher/archive/release/0.5.2.tar.gz" + sha256: "e18e663f9a72a59fca3e7a9e125ca77823b03a3388aa569398965777c5671173" "0.4.3": url: "https://github.com/e-dant/watcher/archive/release/0.4.3.tar.gz" sha256: "8603b45edfa5023752d9e2fdd731efe5a556a542aaf03f6be0e69c68f552b25a" diff --git a/recipes/watcher/all/conanfile.py b/recipes/watcher/all/conanfile.py index 583d57f7ba78b5..2aa7718f44b002 100644 --- a/recipes/watcher/all/conanfile.py +++ b/recipes/watcher/all/conanfile.py @@ -3,7 +3,6 @@ from conan.tools.files import export_conandata_patches, apply_conandata_patches, get, copy from conan.tools.build import check_min_cppstd from conan.tools.apple import is_apple_os -from conan.tools.microsoft import check_min_vs from conan.tools.layout import basic_layout import os @@ -28,6 +27,8 @@ def _compilers_minimum_version(self): "gcc": "11", "clang": "13", "apple-clang": "13.1", + "Visual Studio": "16", + "msvc": "192", } def export_sources(self): @@ -42,7 +43,6 @@ def package_id(self): def validate(self): if self.settings.get_safe("compiler.cppstd"): check_min_cppstd(self, self._minimum_cpp_standard) - check_min_vs(self, 192) def loose_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] diff --git a/recipes/watcher/all/test_package/CMakeLists.txt b/recipes/watcher/all/test_package/CMakeLists.txt index 0e1dcc800be93c..237b645236ec47 100644 --- a/recipes/watcher/all/test_package/CMakeLists.txt +++ b/recipes/watcher/all/test_package/CMakeLists.txt @@ -13,3 +13,7 @@ if(watcher_VERSION VERSION_LESS "0.4.0") else() target_compile_definitions(${PROJECT_NAME} PRIVATE WATCHER_NAMESPACE=wtr) endif() + +if(watcher_VERSION VERSION_GREATER_EQUAL "0.5.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE WATCHER_DIE_WITH_PATH) +endif() diff --git a/recipes/watcher/all/test_package/test_package.cpp b/recipes/watcher/all/test_package/test_package.cpp index fc969e958b4a44..787ba072e84c5d 100644 --- a/recipes/watcher/all/test_package/test_package.cpp +++ b/recipes/watcher/all/test_package/test_package.cpp @@ -20,7 +20,11 @@ int main(int argc, char** argv) { std::thread([&]() { WATCHER_NAMESPACE::watcher::watch(".", show_event_json); }).detach(); auto const time_until_death = std::chrono::seconds(3); std::this_thread::sleep_for(time_until_death); +#ifdef WATCHER_DIE_WITH_PATH + auto const is_watch_dead = WATCHER_NAMESPACE::watcher::die(".", show_event_json); +#else auto const is_watch_dead = WATCHER_NAMESPACE::watcher::die(show_event_json); +#endif std::cout << " },\n" << R"( "milliseconds":)" << time_until_death.count() << "," << std::endl diff --git a/recipes/watcher/config.yml b/recipes/watcher/config.yml index b8649fdf1b640a..363df7be271c25 100644 --- a/recipes/watcher/config.yml +++ b/recipes/watcher/config.yml @@ -1,4 +1,10 @@ versions: + "0.5.5": + folder: all + "0.5.4": + folder: all + "0.5.2": + folder: all "0.4.3": folder: all "0.3.3": diff --git a/recipes/wavelet_buffer/all/conandata.yml b/recipes/wavelet_buffer/all/conandata.yml new file mode 100644 index 00000000000000..fbf3768205fccf --- /dev/null +++ b/recipes/wavelet_buffer/all/conandata.yml @@ -0,0 +1,24 @@ +sources: + "0.5.0": + url: "https://github.com/panda-official/WaveletBuffer/archive/refs/tags/v0.5.0.tar.gz" + sha256: "2b1fa552f9a6e032dfd9f59bd05c049bf0cac46aced7cd42f49ff0d020cfdb50" + "0.4.0": + url: "https://github.com/panda-official/WaveletBuffer/archive/refs/tags/v0.4.0.tar.gz" + sha256: "0a30080a6d1e9e7f8947ae0c3395d3c86888900c7ae09730f8dd0ed5138daab2" +patches: + "0.5.0": + - patch_file: "patches/0001-0.4.0-cmake-no-openblas.patch" + patch_description: "Fix CMakeLists: OpenBLAS is not a dependency" + patch_type: "conan" + patch_source: "https://github.com/panda-official/WaveletBuffer/pull/49" + - patch_file: "patches/0002-0.4.0-cmake-find-jpeblib.patch" + patch_description: "Fix CMakeLists: link to jpeg lib only" + patch_type: "conan" + "0.4.0": + - patch_file: "patches/0001-0.4.0-cmake-no-openblas.patch" + patch_description: "Fix CMakeLists: OpenBLAS is not a dependency" + patch_type: "conan" + patch_source: "https://github.com/panda-official/WaveletBuffer/pull/49" + - patch_file: "patches/0002-0.4.0-cmake-find-jpeblib.patch" + patch_description: "Fix CMakeLists: link to jpeg lib only" + patch_type: "conan" diff --git a/recipes/wavelet_buffer/all/conanfile.py b/recipes/wavelet_buffer/all/conanfile.py new file mode 100644 index 00000000000000..d2fc690c180b0a --- /dev/null +++ b/recipes/wavelet_buffer/all/conanfile.py @@ -0,0 +1,130 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.53.0" + + +class WaveletBufferConan(ConanFile): + name = "wavelet_buffer" + license = "MPL-2.0" + description = "An universal C++ compression library based on wavelet transformation" + topics = ("compression", "signal-processing", "wavelet") + homepage = "https://github.com/panda-official/WaveletBuffer" + url = "https://github.com/conan-io/conan-center-index" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "jpeg": ["libjpeg-turbo", "libjpeg"], + } + default_options = { + "shared": False, + "fPIC": True, + "jpeg": "libjpeg-turbo", + } + + @property + def _min_cppstd(self): + return 20 + + @property + def _minimum_compilers_version(self): + return { + "gcc": "8", + "clang": "12", + "apple-clang": "12", + "Visual Studio": "16", + "msvc": "192", + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("blaze/3.8", transitive_headers=True) + self.requires("cimg/3.0.2") + if self.options.jpeg == "libjpeg-turbo": + self.requires("libjpeg-turbo/2.1.4") + else: + self.requires("libjpeg/9e") + # FIXME: unvendor SfCompressor which is currently downloaded at build time :s + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler)) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared with Visual Studio.") + + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output=output) + m = re.search(r'cmake version (\d+\.\d+\.\d+)', output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False + + def build_requirements(self): + if not self._cmake_new_enough("3.16"): + self.tool_requires("cmake/3.25.0") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CONAN_EXPORTED"] = True + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "wavelet_buffer") + self.cpp_info.set_property("cmake_target_name", "wavelet_buffer::wavelet_buffer") + self.cpp_info.libs = ["wavelet_buffer", "sf_compressor"] + self.cpp_info.requires = ["blaze::blaze", "cimg::cimg"] + if self.options.jpeg == "libjpeg-turbo": + self.cpp_info.requires.append("libjpeg-turbo::jpeg") + else: + self.cpp_info.requires.append("libjpeg::libjpeg") diff --git a/recipes/wavelet_buffer/all/patches/0001-0.4.0-cmake-no-openblas.patch b/recipes/wavelet_buffer/all/patches/0001-0.4.0-cmake-no-openblas.patch new file mode 100644 index 00000000000000..3245b71894066f --- /dev/null +++ b/recipes/wavelet_buffer/all/patches/0001-0.4.0-cmake-no-openblas.patch @@ -0,0 +1,18 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -58,7 +58,6 @@ else() + endif() + + find_package(blaze REQUIRED) +-find_package(OpenBLAS REQUIRED) + find_package(libjpeg-turbo REQUIRED) + find_package(cimg REQUIRED) + +@@ -122,7 +121,6 @@ target_include_directories( + # Link dependencies + target_link_libraries(${WB_TARGET_NAME} sf_compressor) + target_link_libraries(${WB_TARGET_NAME} blaze::blaze) +-target_link_libraries(${WB_TARGET_NAME} OpenBLAS::OpenBLAS) + target_link_libraries(${WB_TARGET_NAME} libjpeg-turbo::libjpeg-turbo) + target_link_libraries(${WB_TARGET_NAME} cimg::cimg) + diff --git a/recipes/wavelet_buffer/all/patches/0002-0.4.0-cmake-find-jpeblib.patch b/recipes/wavelet_buffer/all/patches/0002-0.4.0-cmake-find-jpeblib.patch new file mode 100644 index 00000000000000..4a17b7079fb2e4 --- /dev/null +++ b/recipes/wavelet_buffer/all/patches/0002-0.4.0-cmake-find-jpeblib.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -58,7 +58,7 @@ else() + endif() + + find_package(blaze REQUIRED) +-find_package(libjpeg-turbo REQUIRED) ++find_package(JPEG REQUIRED MODULE) + find_package(cimg REQUIRED) + + # Dependencies +@@ -121,7 +121,7 @@ target_include_directories( + # Link dependencies + target_link_libraries(${WB_TARGET_NAME} sf_compressor) + target_link_libraries(${WB_TARGET_NAME} blaze::blaze) +-target_link_libraries(${WB_TARGET_NAME} libjpeg-turbo::libjpeg-turbo) ++target_link_libraries(${WB_TARGET_NAME} JPEG::JPEG) + target_link_libraries(${WB_TARGET_NAME} cimg::cimg) + + # Catch2 installation diff --git a/recipes/wavelet_buffer/all/test_package/CMakeLists.txt b/recipes/wavelet_buffer/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..07b3926a7394a1 --- /dev/null +++ b/recipes/wavelet_buffer/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.12) +project(WaveletBufferTest LANGUAGES CXX) + +find_package(wavelet_buffer CONFIG REQUIRED) + +add_executable(test_package test_package.cpp) +target_compile_features(test_package PRIVATE cxx_std_20) +target_link_libraries(test_package PRIVATE wavelet_buffer::wavelet_buffer) diff --git a/recipes/wavelet_buffer/all/test_package/conanfile.py b/recipes/wavelet_buffer/all/test_package/conanfile.py new file mode 100644 index 00000000000000..0f34761d1525cd --- /dev/null +++ b/recipes/wavelet_buffer/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + cmd = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(cmd, env="conanrun") diff --git a/recipes/wavelet_buffer/all/test_package/test_package.cpp b/recipes/wavelet_buffer/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..c37d44129cc081 --- /dev/null +++ b/recipes/wavelet_buffer/all/test_package/test_package.cpp @@ -0,0 +1,47 @@ +#include + +#include + +using drift::Signal1D; +using drift::WaveletBuffer; +using drift::WaveletParameters; +using drift::WaveletTypes; +using DenoiseAlgo = drift::ThresholdAbsDenoiseAlgorithm; + +int main() { + Signal1D original = blaze::generate( + 1000, [](auto index) { return static_cast(index % 100); }); + + std::cout << "Original size: " << original.size() * 4 << std::endl; + WaveletBuffer buffer(WaveletParameters{ + .signal_shape = {original.size()}, + .signal_number = 1, + .decomposition_steps = 3, + .wavelet_type = WaveletTypes::kDB1, + }); + + // Wavelet decomposition of the signal and denoising + buffer.Decompose(original, DenoiseAlgo(0, 0.3)); + + // Compress the buffer + std::string arch; + if (buffer.Serialize(&arch, 16)) { + std::cout << "Compressed size: " << arch.size() << std::endl; + } else { + std::cerr << "Serialization error" << std::endl; + return EXIT_FAILURE; + } + + // Decompress the buffer + auto restored_buffer = WaveletBuffer::Parse(arch); + Signal1D output_signal; + + // Restore the signal from wavelet decomposition + restored_buffer->Compose(&output_signal); + + std::cout << "Distance between original and restored signal: " + << blaze::norm(original - output_signal) / original.size() + << std::endl; + std::cout << "Compression rate: " << original.size() * 4. / arch.size() * 100 + << "%" << std::endl; +} diff --git a/recipes/wavelet_buffer/all/test_v1_package/CMakeLists.txt b/recipes/wavelet_buffer/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/wavelet_buffer/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/wavelet_buffer/all/test_v1_package/conanfile.py b/recipes/wavelet_buffer/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/wavelet_buffer/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/wavelet_buffer/config.yml b/recipes/wavelet_buffer/config.yml new file mode 100644 index 00000000000000..d13fcfd021b7b0 --- /dev/null +++ b/recipes/wavelet_buffer/config.yml @@ -0,0 +1,5 @@ +versions: + "0.5.0": + folder: all + "0.4.0": + folder: all diff --git a/recipes/wayland-protocols/all/conandata.yml b/recipes/wayland-protocols/all/conandata.yml index 57bce2d3e5da6a..1caa67f91c85d5 100644 --- a/recipes/wayland-protocols/all/conandata.yml +++ b/recipes/wayland-protocols/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.31": + url: "https://github.com/wayland-project/wayland-protocols/archive/1.31.tar.gz" + sha256: "04d3f66eca99d638ec8dbfdfdf79334290e22028f7d0b04c7034d9ef18a3248a" "1.27": url: "https://github.com/wayland-project/wayland-protocols/archive/1.27.tar.gz" sha256: "6dd6ee86478adf4347f3b8b4f3da62dbe9e44912c9cef21cf99abfe692313df4" diff --git a/recipes/wayland-protocols/all/conanfile.py b/recipes/wayland-protocols/all/conanfile.py index 9d4353094f0199..d2ce51903263dd 100644 --- a/recipes/wayland-protocols/all/conanfile.py +++ b/recipes/wayland-protocols/all/conanfile.py @@ -13,7 +13,7 @@ class WaylandProtocolsConan(ConanFile): name = "wayland-protocols" description = "Wayland is a project to define a protocol for a compositor to talk to its clients as well as a library implementation of the protocol" - topics = ("wayland") + topics = "wayland" url = "https://github.com/conan-io/conan-center-index" homepage = "https://gitlab.freedesktop.org/wayland/wayland-protocols" license = "MIT" @@ -27,7 +27,7 @@ def validate(self): raise ConanInvalidConfiguration(f"{self.ref} only supports Linux") def build_requirements(self): - self.tool_requires("meson/0.63.3") + self.tool_requires("meson/1.0.0") def layout(self): basic_layout(self, src_folder="src") diff --git a/recipes/wayland-protocols/all/test_package/conanfile.py b/recipes/wayland-protocols/all/test_package/conanfile.py index 1466d1f78d85d6..19d2d810117117 100644 --- a/recipes/wayland-protocols/all/test_package/conanfile.py +++ b/recipes/wayland-protocols/all/test_package/conanfile.py @@ -20,7 +20,7 @@ def requirements(self): self.requires("wayland/1.21.0") def build_requirements(self): - self.tool_requires("meson/0.63.3") + self.tool_requires("meson/1.0.0") if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): self.tool_requires("pkgconf/1.9.3") self.tool_requires("wayland/1.21.0") diff --git a/recipes/wayland-protocols/all/test_v1_package/conanfile.py b/recipes/wayland-protocols/all/test_v1_package/conanfile.py index 58abdcba1c74d4..37376c21380771 100644 --- a/recipes/wayland-protocols/all/test_v1_package/conanfile.py +++ b/recipes/wayland-protocols/all/test_v1_package/conanfile.py @@ -10,7 +10,7 @@ class TestPackageConan(ConanFile): def build_requirements(self): self.build_requires("wayland/1.21.0") - self.build_requires("meson/0.63.3") + self.build_requires("meson/1.0.0") def requirements(self): self.requires("wayland/1.21.0") diff --git a/recipes/wayland-protocols/config.yml b/recipes/wayland-protocols/config.yml index 5a8aa4a9bbac3b..81aded41c98221 100644 --- a/recipes/wayland-protocols/config.yml +++ b/recipes/wayland-protocols/config.yml @@ -1,4 +1,6 @@ versions: + "1.31": + folder: all "1.27": folder: all "1.26": diff --git a/recipes/wayland/all/conanfile.py b/recipes/wayland/all/conanfile.py index 74e79c48d81a9d..ded4c6dd57c883 100644 --- a/recipes/wayland/all/conanfile.py +++ b/recipes/wayland/all/conanfile.py @@ -9,7 +9,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class WaylandConan(ConanFile): @@ -18,7 +18,7 @@ class WaylandConan(ConanFile): "Wayland is a project to define a protocol for a compositor to talk to " "its clients as well as a library implementation of the protocol" ) - topics = ("protocol", "compositor", "display") + topics = "protocol", "compositor", "display" url = "https://github.com/conan-io/conan-center-index" homepage = "https://wayland.freedesktop.org" license = "MIT" @@ -38,18 +38,9 @@ class WaylandConan(ConanFile): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def requirements(self): if self.options.enable_libraries: @@ -63,7 +54,7 @@ def validate(self): raise ConanInvalidConfiguration(f"{self.ref} only supports Linux") def build_requirements(self): - self.tool_requires("meson/0.63.3") + self.tool_requires("meson/1.0.0") if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): self.tool_requires("pkgconf/1.9.3") if cross_building(self): diff --git a/recipes/wayland/all/test_package/CMakeLists.txt b/recipes/wayland/all/test_package/CMakeLists.txt index b2f10074839148..fa5ae025fbfc72 100644 --- a/recipes/wayland/all/test_package/CMakeLists.txt +++ b/recipes/wayland/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 3.15) -project(test_package C) +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) find_package(wayland COMPONENTS wayland-client REQUIRED) diff --git a/recipes/wayland/all/test_package/conanfile.py b/recipes/wayland/all/test_package/conanfile.py index 63204720ff6f0d..c201ad68aff345 100644 --- a/recipes/wayland/all/test_package/conanfile.py +++ b/recipes/wayland/all/test_package/conanfile.py @@ -2,10 +2,9 @@ from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain +from conan.tools.cmake import CMake, cmake_layout, CMakeDeps, CMakeToolchain from conan.tools.env import VirtualBuildEnv from conan.tools.gnu import PkgConfig, PkgConfigDeps -from conan.tools.layout import cmake_layout class TestPackageConan(ConanFile): diff --git a/recipes/wayland/all/test_v1_package/CMakeLists.txt b/recipes/wayland/all/test_v1_package/CMakeLists.txt index 8388973d3de1ec..925ecbe19e448d 100644 --- a/recipes/wayland/all/test_v1_package/CMakeLists.txt +++ b/recipes/wayland/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.15) -project(test_package C) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(wayland REQUIRED CONFIG) - -add_executable(test_package ../test_package/test_package.c) -target_link_libraries(test_package PRIVATE wayland::wayland-client) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/websocketpp/all/conanfile.py b/recipes/websocketpp/all/conanfile.py index eb1f177f451d66..11bf8a92665fca 100644 --- a/recipes/websocketpp/all/conanfile.py +++ b/recipes/websocketpp/all/conanfile.py @@ -1,5 +1,6 @@ from conan import ConanFile -from conan.tools import files +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +from conan.tools.layout import basic_layout import os required_conan_version = ">=1.52.0" @@ -26,37 +27,49 @@ class WebsocketPPConan(ConanFile): } def export_sources(self): - files.export_conandata_patches(self) + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.with_openssl: - self.requires("openssl/1.1.1s") + self.requires("openssl/1.1.1s", transitive_headers=True, transitive_libs=True) if self.options.with_zlib: - self.requires("zlib/1.2.13") + self.requires("zlib/1.2.13", transitive_headers=True, transitive_libs=True) if self.options.asio == "standalone": - self.requires("asio/1.24.0") + self.requires("asio/1.24.0", transitive_headers=True) elif self.options.asio == "boost": - self.requires("boost/1.80.0") + self.requires("boost/1.80.0", transitive_headers=True) def package_id(self): - self.info.header_only() + self.info.clear() def source(self): - files.get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def build(self): - files.apply_conandata_patches(self) + apply_conandata_patches(self) def package(self): - files.copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - # We have to copy the headers manually, since the upstream cmake.install() step doesn't do so. - files.copy(self, pattern=os.path.join("websocketpp","*.hpp"), dst=os.path.join(self.package_folder, "include"), src=self.source_folder) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, os.path.join("websocketpp","*.hpp"), src=self.source_folder, dst=os.path.join(self.package_folder, "include")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "websocketpp") self.cpp_info.set_property("cmake_target_name", "websocketpp::websocketpp") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.requires = [] + if self.options.with_openssl: + self.cpp_info.requires.append("openssl::openssl") + if self.options.with_zlib: + self.cpp_info.requires.append("zlib::zlib") if self.options.asio == "standalone": self.cpp_info.defines.extend(["ASIO_STANDALONE", "_WEBSOCKETPP_CPP11_STL_"]) + self.cpp_info.requires.append("asio::asio") + elif self.options.asio == "boost": + self.cpp_info.requires.append("boost::headers") diff --git a/recipes/websocketpp/all/test_package/CMakeLists.txt b/recipes/websocketpp/all/test_package/CMakeLists.txt index b3137983a6e5ff..d6d230796653e5 100644 --- a/recipes/websocketpp/all/test_package/CMakeLists.txt +++ b/recipes/websocketpp/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(websocketpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} websocketpp::websocketpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE websocketpp::websocketpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/websocketpp/all/test_v1_package/CMakeLists.txt b/recipes/websocketpp/all/test_v1_package/CMakeLists.txt index 0b7c0d7ebeb5f8..0d20897301b68b 100644 --- a/recipes/websocketpp/all/test_v1_package/CMakeLists.txt +++ b/recipes/websocketpp/all/test_v1_package/CMakeLists.txt @@ -4,8 +4,5 @@ project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(websocketpp REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} websocketpp::websocketpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/winflexbison/all/conanfile.py b/recipes/winflexbison/all/conanfile.py index 5bec8a823d53f5..96dfb9c1906e92 100644 --- a/recipes/winflexbison/all/conanfile.py +++ b/recipes/winflexbison/all/conanfile.py @@ -1,10 +1,10 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rename, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, save import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.52.0" class WinflexbisonConan(ConanFile): @@ -17,19 +17,20 @@ class WinflexbisonConan(ConanFile): settings = "os", "arch", "compiler", "build_type" def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) - - def validate(self): - if self.info.settings.os != "Windows": - raise ConanInvalidConfiguration("winflexbison is only supported on Windows.") + export_conandata_patches(self) def layout(self): cmake_layout(self, src_folder="src") + def package_id(self): + del self.info.settings.compiler + + def validate(self): + if self.settings.os != "Windows": + raise ConanInvalidConfiguration("winflexbison is only supported on Windows.") + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -84,8 +85,6 @@ def package_info(self): self.buildenv_info.define_path("YACC", yacc_path) # TODO: to remove in conan v2 - bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) - self.env_info.PATH.append(bindir) + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) self.env_info.LEX = lex_path self.env_info.YACC = yacc_path diff --git a/recipes/winflexbison/all/test_package/conanfile.py b/recipes/winflexbison/all/test_package/conanfile.py index be1250f9b3a7bb..30f93d42368f95 100644 --- a/recipes/winflexbison/all/test_package/conanfile.py +++ b/recipes/winflexbison/all/test_package/conanfile.py @@ -7,23 +7,23 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualBuildEnv", "VirtualRunEnv" - - def build_requirements(self): - self.tool_requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): + self.run("win_flex --version") + self.run("win_bison --version") if not cross_building(self): - self.run("win_flex --version", env="conanbuild") - self.run("win_bison --version", env="conanbuild") - bison_test = os.path.join(self.cpp.build.bindirs[0], "bison_test_package") self.run(bison_test, env="conanrun") flex_test = os.path.join(self.cpp.build.bindirs[0], "flex_test_package") diff --git a/recipes/winflexbison/all/test_v1_package/CMakeLists.txt b/recipes/winflexbison/all/test_v1_package/CMakeLists.txt index 94d419f8a1bddd..0d20897301b68b 100644 --- a/recipes/winflexbison/all/test_v1_package/CMakeLists.txt +++ b/recipes/winflexbison/all/test_v1_package/CMakeLists.txt @@ -1,54 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES C CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -# Flex - -set(FLEX_TARGET_COMPILE_FLAGS "") -if(MSVC) - set(FLEX_TARGET_COMPILE_FLAGS "--wincompat") -endif() - -find_package(FLEX REQUIRED) -set(FLEX_VARS - FLEX_FOUND - FLEX_EXECUTABLE - FLEX_LIBRARIES - FLEX_INCLUDE_DIRS -) - -foreach(FLEX_VAR ${FLEX_VARS}) - message("${FLEX_VAR}: ${${FLEX_VAR}}") - if(NOT ${FLEX_VAR}) - message(WARNING "${FLEX_VAR} NOT FOUND") - endif() -endforeach() - -FLEX_TARGET(TestParser ../test_package/basic_nr.l "${CMAKE_CURRENT_BINARY_DIR}/lexer.cpp" COMPILE_FLAGS "${FLEX_TARGET_COMPILE_FLAGS}") -add_executable(flex_test_package ${FLEX_TestParser_OUTPUTS}) -target_compile_features(flex_test_package PRIVATE cxx_std_11) - -# Bison - -find_package(BISON) - -set(BISON_VARS - BISON_FOUND - BISON_EXECUTABLE - BISON_VERSION -) - -foreach(BISON_VAR ${BISON_VARS}) - message("${BISON_VAR}: ${${BISON_VAR}}") - if(NOT ${BISON_VAR}) - message(WARNING "${BISON_VAR} NOT FOUND") - endif() -endforeach() - -bison_target(bison_parser_target ../test_package/mc_parser.yy "${CMAKE_CURRENT_BINARY_DIR}/mc_parser.cpp") - -add_executable(bison_test_package "${CMAKE_CURRENT_BINARY_DIR}/mc_parser.cpp" ../test_package/dummy_lex.c) -target_compile_features(bison_test_package PRIVATE cxx_std_11) -target_include_directories(bison_test_package PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/winflexbison/all/test_v1_package/conanfile.py b/recipes/winflexbison/all/test_v1_package/conanfile.py index 41351eeed660f8..744b30cd87048c 100644 --- a/recipes/winflexbison/all/test_v1_package/conanfile.py +++ b/recipes/winflexbison/all/test_v1_package/conanfile.py @@ -5,19 +5,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "cmake" + test_type = "explicit" + + def build_requirements(self): + self.build_requires(self.tested_reference_str) def build(self): - if not tools.cross_building(self, skip_x64_x86=True): - with tools.run_environment(self): - cmake = CMake(self) - cmake.configure() - cmake.build() + cmake = CMake(self) + cmake.configure() + cmake.build() def test(self): + self.run("win_flex --version") + self.run("win_bison --version") if not tools.cross_building(self, skip_x64_x86=True): - self.run("win_flex --version", run_environment=True) - self.run("win_bison --version", run_environment=True) - bison_test = os.path.join("bin", "bison_test_package") self.run(bison_test, run_environment=True) flex_test = os.path.join("bin", "flex_test_package") diff --git a/recipes/xkbcommon/all/conandata.yml b/recipes/xkbcommon/all/conandata.yml index eb163931d34012..dcff369379c64c 100644 --- a/recipes/xkbcommon/all/conandata.yml +++ b/recipes/xkbcommon/all/conandata.yml @@ -1,16 +1,13 @@ sources: + "1.5.0": + url: "https://xkbcommon.org/download/libxkbcommon-1.5.0.tar.xz" + sha256: "560f11c4bbbca10f495f3ef7d3a6aa4ca62b4f8fb0b52e7d459d18a26e46e017" "1.4.1": url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-1.4.1.tar.gz" sha256: "3b86670dd91441708dedc32bc7f684a034232fd4a9bb209f53276c9783e9d40e" - "1.4.0": - url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-1.4.0.tar.gz" - sha256: "51b5a732d6d6976da9d52b8f136850c193c68a31a9bdf28965a81cf8e62e919e" "1.3.1": url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-1.3.1.tar.gz" sha256: "8eda6782c6ed4b83296521f2f7e6bea88aba76d49c39fb4fce0f8d355a9181ce" - "1.3.0": - url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-1.3.0.tar.gz" - sha256: "e1b79838256549d72f42c824f720b4f14603374cfbe5587942e35a0cbb13ff9e" "1.2.1": url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-1.2.1.tar.gz" sha256: "50684541c11686203650f6ac8fe9b4b0343158fb7c54fbb0c86147f1ff5a5dbc" @@ -20,9 +17,6 @@ sources: "1.0.3": url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-1.0.3.tar.gz" sha256: "5d10a57ab65daad7d975926166770eca1d2c899131ab96c23845df1c42da5c31" - "1.0.1": - url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-1.0.1.tar.gz" - sha256: "270e2ad4ce5699f633e49042114cb68a5697fa1ed45b65c1d96a833cfac20954" "0.10.0": url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-0.10.0.tar.gz" sha256: "9b4635cf5d9fc0fb9611ceec1780aafc0944299e9a29ab09c18ec2633923b9c3" diff --git a/recipes/xkbcommon/all/conanfile.py b/recipes/xkbcommon/all/conanfile.py index 7b84051dc4c69d..496e5461699444 100644 --- a/recipes/xkbcommon/all/conanfile.py +++ b/recipes/xkbcommon/all/conanfile.py @@ -10,7 +10,7 @@ from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class XkbcommonConan(ConanFile): @@ -52,18 +52,9 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def requirements(self): self.requires("xkeyboard-config/system") @@ -81,7 +72,7 @@ def validate(self): raise ConanInvalidConfiguration(f"{self.ref} is only compatible with Linux and FreeBSD") def build_requirements(self): - self.tool_requires("meson/0.64.1") + self.tool_requires("meson/1.0.0") self.tool_requires("bison/3.8.2") if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): self.tool_requires("pkgconf/1.9.3") @@ -120,6 +111,12 @@ def build(self): if self.options.get_safe("with_wayland"): meson_build_file = os.path.join(self.source_folder, "meson.build") # Patch the build system to use the pkg-config files generated for the build context. + + if Version(self.version) >= "1.5.0": + get_pkg_config_var = "get_variable(pkgconfig: " + else: + get_pkg_config_var = "get_pkgconfig_variable(" + if self._has_build_profile: replace_in_file(self, meson_build_file, "wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)", @@ -137,7 +134,7 @@ def build(self): "if not wayland_client_dep.found() or not wayland_protocols_dep.found()") replace_in_file(self, meson_build_file, - "wayland_scanner = find_program(wayland_scanner_dep.get_pkgconfig_variable('wayland_scanner'))", + f"wayland_scanner = find_program(wayland_scanner_dep.{get_pkg_config_var}'wayland_scanner'))", "wayland_scanner = find_program('wayland-scanner')") meson = Meson(self) diff --git a/recipes/xkbcommon/all/test_package/CMakeLists.txt b/recipes/xkbcommon/all/test_package/CMakeLists.txt index 0b0b6cb9fe82d0..713779fc019238 100644 --- a/recipes/xkbcommon/all/test_package/CMakeLists.txt +++ b/recipes/xkbcommon/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.15) +cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES CXX) find_package(xkbcommon REQUIRED COMPONENTS libxkbcommon) diff --git a/recipes/xkbcommon/all/test_package/conanfile.py b/recipes/xkbcommon/all/test_package/conanfile.py index b521c572cd6837..0bd86fa64260a5 100644 --- a/recipes/xkbcommon/all/test_package/conanfile.py +++ b/recipes/xkbcommon/all/test_package/conanfile.py @@ -2,8 +2,7 @@ from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import CMake -from conan.tools.layout import cmake_layout +from conan.tools.cmake import CMake, cmake_layout class TestPackageConan(ConanFile): diff --git a/recipes/xkbcommon/all/test_v1_package/CMakeLists.txt b/recipes/xkbcommon/all/test_v1_package/CMakeLists.txt index 578486105d7d3b..925ecbe19e448d 100644 --- a/recipes/xkbcommon/all/test_v1_package/CMakeLists.txt +++ b/recipes/xkbcommon/all/test_v1_package/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +conan_basic_setup(TARGETS) -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/xkbcommon/all/test_v1_package/conanfile.py b/recipes/xkbcommon/all/test_v1_package/conanfile.py index e49d2fb75e7048..e9bf8aa5f82dd0 100644 --- a/recipes/xkbcommon/all/test_v1_package/conanfile.py +++ b/recipes/xkbcommon/all/test_v1_package/conanfile.py @@ -6,7 +6,7 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "cmake", "cmake_find_package_multi" def build(self): cmake = CMake(self) diff --git a/recipes/xkbcommon/config.yml b/recipes/xkbcommon/config.yml index b1ae06a7c3ea80..aa62b1dc6f7812 100644 --- a/recipes/xkbcommon/config.yml +++ b/recipes/xkbcommon/config.yml @@ -1,19 +1,15 @@ versions: - "1.4.1": + "1.5.0": folder: all - "1.4.0": + "1.4.1": folder: all "1.3.1": folder: all - "1.3.0": - folder: all "1.2.1": folder: all "1.1.0": folder: all "1.0.3": folder: all - "1.0.1": - folder: all "0.10.0": folder: all diff --git a/recipes/xkeyboard-config/all/conanfile.py b/recipes/xkeyboard-config/all/conanfile.py index a9f2fc053956cc..ec1b8c4a6f2edc 100644 --- a/recipes/xkeyboard-config/all/conanfile.py +++ b/recipes/xkeyboard-config/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.system import package_manager from conan.errors import ConanInvalidConfiguration -required_conan_version = ">=1.47" +required_conan_version = ">=1.50.0" class XkeyboardConfigConan(ConanFile): @@ -20,7 +20,7 @@ def validate(self): raise ConanInvalidConfiguration("This recipe supports only Linux and FreeBSD") def package_id(self): - self.info.header_only() + self.info.clear() def system_requirements(self): apt = package_manager.Apt(self) diff --git a/recipes/xorg/all/conanfile.py b/recipes/xorg/all/conanfile.py index 6182a830106182..f4ca0dad278fac 100644 --- a/recipes/xorg/all/conanfile.py +++ b/recipes/xorg/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.system import package_manager from conan.errors import ConanInvalidConfiguration -required_conan_version = ">=1.47" +required_conan_version = ">=1.50.0" class XorgConan(ConanFile): @@ -20,7 +20,7 @@ def validate(self): raise ConanInvalidConfiguration("This recipe supports only Linux and FreeBSD") def package_id(self): - self.info.header_only() + self.info.clear() def system_requirements(self): apt = package_manager.Apt(self) diff --git a/recipes/xorg/all/test_package/conanfile.py b/recipes/xorg/all/test_package/conanfile.py index 603eba58719ec2..f414ecd075ee74 100644 --- a/recipes/xorg/all/test_package/conanfile.py +++ b/recipes/xorg/all/test_package/conanfile.py @@ -2,9 +2,8 @@ from conan import ConanFile from conan.tools.build import cross_building -from conan.tools.cmake import CMake +from conan.tools.cmake import CMake, cmake_layout from conan.tools.gnu import PkgConfigDeps -from conan.tools.layout import cmake_layout class TestPackageConan(ConanFile): diff --git a/recipes/xtensor/all/conanfile.py b/recipes/xtensor/all/conanfile.py index 52e5e886788308..8d9d0a5f992157 100644 --- a/recipes/xtensor/all/conanfile.py +++ b/recipes/xtensor/all/conanfile.py @@ -56,7 +56,7 @@ def requirements(self): if Version(self.version) < "0.24.0": self.requires("xsimd/7.5.0") else: - self.requires("xsimd/9.0.1") + self.requires("xsimd/10.0.0") if self.options.tbb: self.requires("onetbb/2021.7.0") diff --git a/recipes/xxhash/all/conandata.yml b/recipes/xxhash/all/conandata.yml index e7a7396a165a66..a0b4d68deb6b49 100644 --- a/recipes/xxhash/all/conandata.yml +++ b/recipes/xxhash/all/conandata.yml @@ -8,3 +8,10 @@ sources: patches: "0.8.1": - patch_file: "patches/0.8.1-fix-cmakelists.patch" + patch_description: "Update CMakeLists.txt to properly install manuals" + patch_type: conan + + - patch_file: "patches/0.8.1-fix-static-assert-link-error.patch" + patch_source: "https://github.com/Cyan4973/xxHash/commit/6189ecd3d44a693460f86280ccf49d33cb4b18e1" + patch_description: "Backport fix for link error" + patch_type: bugfix diff --git a/recipes/xxhash/all/patches/0.8.1-fix-static-assert-link-error.patch b/recipes/xxhash/all/patches/0.8.1-fix-static-assert-link-error.patch new file mode 100644 index 00000000000000..82773a37fe366f --- /dev/null +++ b/recipes/xxhash/all/patches/0.8.1-fix-static-assert-link-error.patch @@ -0,0 +1,14 @@ +diff --git a/xxhash.h b/xxhash.h +index 08ab794..511c4d1 100644 +--- a/xxhash.h ++++ b/xxhash.h +@@ -1546,8 +1546,7 @@ static void* XXH_memcpy(void* dest, const void* src, size_t size) + /* note: use after variable declarations */ + #ifndef XXH_STATIC_ASSERT + # if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */ +-# include +-# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0) ++# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { _Static_assert((c),m); } while(0) + # elif defined(__cplusplus) && (__cplusplus >= 201103L) /* C++11 */ + # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0) + # else diff --git a/recipes/xz_utils/all/conandata.yml b/recipes/xz_utils/all/conandata.yml index c91700d02c91bc..ef364b8d899803 100644 --- a/recipes/xz_utils/all/conandata.yml +++ b/recipes/xz_utils/all/conandata.yml @@ -1,7 +1,18 @@ sources: + "5.4.0": + url: "https://tukaani.org/xz/xz-5.4.0.tar.gz" + sha256: "7471ef5991f690268a8f2be019acec2e0564b7b233ca40035f339fe9a07f830b" + "5.2.10": + url: "https://tukaani.org/xz/xz-5.2.10.tar.gz" + sha256: "eb7a3b2623c9d0135da70ca12808a214be9c019132baaa61c9e1d198d1d9ded3" "5.2.5": url: "https://tukaani.org/xz/xz-5.2.5.tar.gz" sha256: "f6f4910fd033078738bd82bfba4f49219d03b17eb0794eb91efbae419f4aba10" "5.2.4": url: "https://tukaani.org/xz/xz-5.2.4.tar.gz" sha256: "b512f3b726d3b37b6dc4c8570e137b9311e7552e8ccbab4d39d47ce5f4177145" +patches: + "5.2.4": + - patch_file: "patches/0001-relax_windows-sdk-restriction.patch" + patch_description: "Relax Windows SDK restriction" + patch_type: "conan" diff --git a/recipes/xz_utils/all/conanfile.py b/recipes/xz_utils/all/conanfile.py index 6c9f4438989260..fe3bbefd8b9d09 100644 --- a/recipes/xz_utils/all/conanfile.py +++ b/recipes/xz_utils/all/conanfile.py @@ -1,19 +1,18 @@ from conan import ConanFile -from conan.errors import ConanException from conan.tools.apple import fix_apple_shared_install_name from conan.tools.env import VirtualBuildEnv -from conan.tools.files import collect_libs, copy, get, rename, replace_in_file, rm, rmdir, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, replace_in_file, rm, rmdir, save from conan.tools.gnu import Autotools, AutotoolsToolchain from conan.tools.layout import basic_layout -from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, MSBuild, MSBuildToolchain, unix_path +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, MSBuild, MSBuildToolchain from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.54.0" -class XZUtils(ConanFile): +class XZUtilsConan(ConanFile): name = "xz_utils" description = ( "XZ Utils is free general-purpose data compression software with a high " @@ -48,30 +47,31 @@ def _effective_msbuild_type(self): "MT" if is_msvc_static_runtime(self) and self.settings.build_type != "Debug" else "", ) + @property + def _msbuild_target(self): + return "liblzma_dll" if self.options.shared else "liblzma" + + def export_sources(self): + export_conandata_patches(self) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): basic_layout(self, src_folder="src") def build_requirements(self): if self._settings_build.os == "Windows" and not is_msvc(self): - if not self.conf.get("tools.microsoft.bash:path", default=False, check_type=bool): - self.tool_requires("msys2/cci.latest") self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): get(self, **self.conan_data["sources"][self.version], @@ -80,92 +80,60 @@ def source(self): def generate(self): if is_msvc(self): tc = MSBuildToolchain(self) + tc.configuration = self._effective_msbuild_type tc.generate() else: + env = VirtualBuildEnv(self) + env.generate() tc = AutotoolsToolchain(self) tc.configure_args.append("--disable-doc") if self.settings.build_type == "Debug": tc.configure_args.append("--enable-debug") tc.generate() - env = VirtualBuildEnv(self) - env.generate() - def _fix_msvc_platform_toolset(self, vcxproj_file, old_toolset): - platform_toolset = { - "Visual Studio": { - "8": "v80", - "9": "v90", - "10": "v100", - "11": "v110", - "12": "v120", - "14": "v140", - "15": "v141", - "16": "v142", - "17": "v143", - }, - "msvc": { - "170": "v110", - "180": "v120", - "190": "v140", - "191": "v141", - "192": "v142", - "193": "v143", - } - }.get(str(self.settings.compiler), {}).get(str(self.settings.compiler.version)) - if not platform_toolset: - raise ConanException( - f"Unkown platform toolset for {self.settings.compiler} {self.settings.compiler.version}", - ) - replace_in_file( - self, - vcxproj_file, - f"{old_toolset}", - f"{platform_toolset}", - ) + @property + def _msvc_sln_folder(self): + if (str(self.settings.compiler) == "Visual Studio" and Version(self.settings.compiler) >= "15") or \ + (str(self.settings.compiler) == "msvc" and Version(self.settings.compiler) >= "191"): + return "vs2017" + return "vs2013" def _build_msvc(self): - if Version(self.version) == "5.2.4": - # Relax Windows SDK restriction - # Workaround is required only for 5.2.4 because since 5.2.5 WindowsTargetPlatformVersion is dropped from vcproj file - # https://developercommunity.visualstudio.com/content/problem/140294/windowstargetplatformversion-makes-it-impossible-t.html - windows_target_platform_version_old = "10.0.15063.0" - replace_in_file(self, os.path.join(self.source_folder, "windows", "vs2017", "liblzma.vcxproj"), - windows_target_platform_version_old, "") - replace_in_file(self, os.path.join(self.source_folder, "windows", "vs2017", "liblzma_dll.vcxproj"), - windows_target_platform_version_old, "") - - # TODO: Find a way to inject conantoolchain.props content from MSBuildToolchain - # For the moment all the logic below is a big trick & doesn't honor custom cflags, cxxflags & ldflags from profile - # and arch different than x86 & x86_64 - - # windows\INSTALL-MSVC.txt - if (self.settings.compiler == "Visual Studio" and Version(self.settings.compiler) >= "15") or \ - (self.settings.compiler == "msvc" and Version(self.settings.compiler) >= "191"): - msvc_version = "vs2017" + build_script_folder = os.path.join(self.source_folder, "windows", self._msvc_sln_folder) + + #============================== + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client. + vcxproj_files = [ + os.path.join(build_script_folder, "liblzma.vcxproj"), + os.path.join(build_script_folder, "liblzma_dll.vcxproj"), + ] + if (str(self.settings.compiler) == "Visual Studio" and Version(self.settings.compiler) >= "15") or \ + (str(self.settings.compiler) == "msvc" and Version(self.settings.compiler) >= "191"): old_toolset = "v141" else: - msvc_version = "vs2013" old_toolset = "v120" - build_script_folder = os.path.join(self.source_folder, "windows", msvc_version) - - # TODO: replace by some conan helper function (https://github.com/conan-io/conan/issues/12155)? - liblzma_vcxproj = os.path.join(build_script_folder, "liblzma.vcxproj") - liblzma_dll_vcxproj = os.path.join(build_script_folder, "liblzma_dll.vcxproj") - self._fix_msvc_platform_toolset(liblzma_vcxproj, old_toolset) - self._fix_msvc_platform_toolset(liblzma_dll_vcxproj, old_toolset) - - # Patch Debug configuration if runtime is MT since there is no DebugMT configuration in upstream vcxproj - if self.settings.build_type == "Debug" and is_msvc_static_runtime(self): - replace_in_file(self, liblzma_vcxproj, "MultiThreadedDebugDLL", "MultiThreadedDebug") - replace_in_file(self, liblzma_dll_vcxproj, "MultiThreadedDebugDLL", "MultiThreadedDebug") + new_toolset = MSBuildToolchain(self).toolset + conantoolchain_props = os.path.join(self.generators_folder, MSBuildToolchain.filename) + for vcxproj_file in vcxproj_files: + replace_in_file( + self, vcxproj_file, + f"{old_toolset}", + f"{new_toolset}", + ) + replace_in_file( + self, vcxproj_file, + "", + f"", + ) + #============================== - target = "liblzma_dll" if self.options.shared else "liblzma" msbuild = MSBuild(self) msbuild.build_type = self._effective_msbuild_type msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform - msbuild.build(os.path.join(build_script_folder, "xz_win.sln"), targets=[target]) + msbuild.build(os.path.join(build_script_folder, "xz_win.sln"), targets=[self._msbuild_target]) def build(self): + apply_conandata_patches(self) if is_msvc(self): self._build_msvc() else: @@ -177,25 +145,15 @@ def package(self): copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) if is_msvc(self): inc_dir = os.path.join(self.source_folder, "src", "liblzma", "api") - copy(self, "*.h", src=inc_dir, dst=os.path.join(self.package_folder, "include"), keep_path=True) - arch = {"x86": "Win32", "x86_64": "x64"}.get(str(self.settings.arch)) - target = "liblzma_dll" if self.options.shared else "liblzma" - if (self.settings.compiler == "Visual Studio" and Version(self.settings.compiler) >= "15") or \ - (self.settings.compiler == "msvc" and Version(self.settings.compiler) >= "191"): - msvc_version = "vs2017" - else: - msvc_version = "vs2013" - bin_dir = os.path.join(self.source_folder, "windows", msvc_version, - self._effective_msbuild_type, arch, target) - copy(self, "*.lib", src=bin_dir, dst=os.path.join(self.package_folder, "lib"), keep_path=False) - if self.options.shared: - copy(self, "*.dll", src=bin_dir, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "*.h", src=inc_dir, dst=os.path.join(self.package_folder, "include")) + output_dir = os.path.join(self.source_folder, "windows") + copy(self, "*.lib", src=output_dir, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dll", src=output_dir, dst=os.path.join(self.package_folder, "bin"), keep_path=False) rename(self, os.path.join(self.package_folder, "lib", "liblzma.lib"), os.path.join(self.package_folder, "lib", "lzma.lib")) else: autotools = Autotools(self) - # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed - autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + autotools.install() rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rmdir(self, os.path.join(self.package_folder, "share")) rm(self, "*.la", os.path.join(self.package_folder, "lib")) @@ -232,14 +190,13 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "LibLZMA::LibLZMA") self.cpp_info.set_property("cmake_build_modules", [self._module_file_rel_path]) self.cpp_info.set_property("pkg_config_name", "liblzma") + self.cpp_info.libs = ["lzma"] if not self.options.shared: self.cpp_info.defines.append("LZMA_API_STATIC") if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("pthread") - self.cpp_info.libs = collect_libs(self) # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self.cpp_info.names["cmake_find_package"] = "LibLZMA" self.cpp_info.names["cmake_find_package_multi"] = "LibLZMA" self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] - self.cpp_info.names["pkg_config"] = "liblzma" diff --git a/recipes/xz_utils/all/patches/0001-relax_windows-sdk-restriction.patch b/recipes/xz_utils/all/patches/0001-relax_windows-sdk-restriction.patch new file mode 100644 index 00000000000000..d9680984def658 --- /dev/null +++ b/recipes/xz_utils/all/patches/0001-relax_windows-sdk-restriction.patch @@ -0,0 +1,20 @@ +--- a/windows/vs2017/liblzma.vcxproj ++++ b/windows/vs2017/liblzma.vcxproj +@@ -29,7 +29,6 @@ + + {12728250-16EC-4DC6-94D7-E21DD88947F8} + Win32Proj +- 10.0.15063.0 + + + +--- a/windows/vs2017/liblzma_dll.vcxproj ++++ b/windows/vs2017/liblzma_dll.vcxproj +@@ -29,7 +29,6 @@ + + {E0F247DB-EF12-4755-8DF9-F74BCD1348F7} + Win32Proj +- 10.0.15063.0 + + + diff --git a/recipes/xz_utils/all/test_v1_package/CMakeLists.txt b/recipes/xz_utils/all/test_v1_package/CMakeLists.txt index 971f2caf78d9a1..0d20897301b68b 100644 --- a/recipes/xz_utils/all/test_v1_package/CMakeLists.txt +++ b/recipes/xz_utils/all/test_v1_package/CMakeLists.txt @@ -1,29 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(LibLZMA REQUIRED) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE LibLZMA::LibLZMA) - -# Test whether variables from https://cmake.org/cmake/help/latest/module/FindLibLZMA.html -# are properly defined in conan generators -set(_custom_vars - LIBLZMA_FOUND - LIBLZMA_INCLUDE_DIRS - LIBLZMA_LIBRARIES - LIBLZMA_VERSION_MAJOR - LIBLZMA_VERSION_MINOR - LIBLZMA_VERSION_PATCH - LIBLZMA_VERSION_STRING -) -foreach(_custom_var ${_custom_vars}) - if(DEFINED _custom_var) - message(STATUS "${_custom_var}: ${${_custom_var}}") - else() - message(FATAL_ERROR "${_custom_var} not defined") - endif() -endforeach() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/xz_utils/config.yml b/recipes/xz_utils/config.yml index 4afb08d7749cba..908e8205eebe4e 100644 --- a/recipes/xz_utils/config.yml +++ b/recipes/xz_utils/config.yml @@ -1,4 +1,8 @@ versions: + "5.4.0": + folder: all + "5.2.10": + folder: all "5.2.5": folder: all "5.2.4": diff --git a/recipes/yaclib/all/conandata.yml b/recipes/yaclib/all/conandata.yml new file mode 100644 index 00000000000000..4a51c82916ec82 --- /dev/null +++ b/recipes/yaclib/all/conandata.yml @@ -0,0 +1,12 @@ +sources: + '2022.10.31': + url: 'https://github.com/YACLib/YACLib/archive/refs/tags/v2022.10.31.tar.gz' + sha256: '81761b1c8e53e6eaeb36fa00183cae66068b85d24c910c0584d0b29b371e143c' +patches: + '2022.10.31': + - patch_file: 'patches/0001-Set-17-as-default-or-20-if-CORO-specified.patch' + patch_description: 'Set 17 standard if not stated otherwise' + patch_type: 'conan' + - patch_file: 'patches/0002-Add-install-commands.patch' + patch_description: 'Add install commands' + patch_type: 'conan' diff --git a/recipes/yaclib/all/conanfile.py b/recipes/yaclib/all/conanfile.py new file mode 100644 index 00000000000000..9c4ce332ffd74a --- /dev/null +++ b/recipes/yaclib/all/conanfile.py @@ -0,0 +1,114 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain +from conan.tools.scm import Version +from conan.tools.files import copy, get, export_conandata_patches, apply_conandata_patches +from conan.tools.layout import cmake_layout +from conan.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.53.0" + + +class YACLibConan(ConanFile): + name = "yaclib" + description = "lightweight C++ library for concurrent and parallel task execution" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/YACLib/YACLib" + license = "MIT" + topics = ("async", "parallel", "concurrency") + settings = "os", "arch", "compiler", "build_type" + + _yaclib_flags = { + "warn": [True, False], + "coro": [True, False], + "disable_futex": [True, False], + "disable_unsafe_futex": [True, False], + "disable_symmetric_transfer": [True, False], + "disable_final_suspend_transfer": [True, False], + } + + options = { + "fPIC": [True, False], + **_yaclib_flags, + } + + default_options = { + "fPIC": True, + **{k: False for k in _yaclib_flags}, + } + + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "Visual Studio": "14.20", + "msvc": "192", + "clang": "8", + "apple-clang": "12", + } + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables['YACLIB_INSTALL'] = True + if self.settings.compiler.get_safe("cppstd"): + tc.variables["YACLIB_CXX_STANDARD"] = self.settings.compiler.cppstd + + flags = [] + for flag in self._yaclib_flags: + if self.options.get_safe(flag): + flags.append(flag.upper()) + + if flags: + tc.variables["YACLIB_FLAGS"] = ";".join(flags) + + tc.generate() + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def validate(self): + required_cpp_standard = 20 if self.options.coro else 17 + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, required_cpp_standard) + else: + if self._compilers_minimum_version.get(str(self.settings.compiler)): + if Version(self.settings.compiler.version) < self._compilers_minimum_version.get(str(self.settings.compiler)): + raise ConanInvalidConfiguration( + f"yaclib requires a compiler supporting c++{required_cpp_standard}") + else: + self.output.warn( + f"yaclib recipe does not recognize the compiler. yaclib requires a compiler supporting c++{required_cpp_standard}. Assuming it does.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "yaclib") + self.cpp_info.set_property("cmake_target_name", "yaclib") + self.cpp_info.set_property("pkg_config_name", "yaclib") + self.cpp_info.libs = ["yaclib"] + if self.options.get_safe("coro"): + if self.settings.compiler.libcxx == "libstdc++11": + self.cpp_info.cxxflags.append("-fcoroutines") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["pthread"] diff --git a/recipes/yaclib/all/patches/0001-Set-17-as-default-or-20-if-CORO-specified.patch b/recipes/yaclib/all/patches/0001-Set-17-as-default-or-20-if-CORO-specified.patch new file mode 100644 index 00000000000000..4bdeb1041a9287 --- /dev/null +++ b/recipes/yaclib/all/patches/0001-Set-17-as-default-or-20-if-CORO-specified.patch @@ -0,0 +1,17 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 13c28b2..53cbb9b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -14,6 +14,12 @@ endif () + + if (YACLIB_CXX_STANDARD) + set(CMAKE_CXX_STANDARD ${YACLIB_CXX_STANDARD}) ++elseif (NOT CORO IN_LIST YACLIB_FLAGS) ++ message("Set default standard to c++17") ++ set(CMAKE_CXX_STANDARD 17) ++else () ++message("Set default standard to c++20") ++ set(CMAKE_CXX_STANDARD 20) + endif () + + set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/recipes/yaclib/all/patches/0002-Add-install-commands.patch b/recipes/yaclib/all/patches/0002-Add-install-commands.patch new file mode 100644 index 00000000000000..8e97ed67b0c962 --- /dev/null +++ b/recipes/yaclib/all/patches/0002-Add-install-commands.patch @@ -0,0 +1,30 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 53cbb9b..ca46fe1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -32,6 +32,13 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + list(APPEND CMAKE_MODULE_PATH "${YACLIB_SOURCE_DIR}/cmake") + include(yaclib_flags) + ++if (YACLIB_INSTALL) ++ include(GNUInstallDirs) ++ install(DIRECTORY ${YACLIB_SOURCE_DIR}/include/yaclib TYPE INCLUDE) ++ install(DIRECTORY ${YACLIB_SOURCE_DIR}/include/yaclib_std TYPE INCLUDE) ++ install(DIRECTORY ${YACLIB_BINARY_DIR}/include/yaclib TYPE INCLUDE) ++endif() ++ + add_subdirectory(src) # Create static library + + if (YACLIB_TEST) +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index c3d624f..80715cb 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -56,3 +56,7 @@ target_include_directories(yaclib + PUBLIC ${YACLIB_BINARY_DIR}/include # for config.hpp + PRIVATE ${YACLIB_SOURCE_DIR}/src + ) ++ ++if (YACLIB_INSTALL) ++ install(TARGETS yaclib) ++endif () diff --git a/recipes/yaclib/all/test_package/CMakeLists.txt b/recipes/yaclib/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..219058ab228202 --- /dev/null +++ b/recipes/yaclib/all/test_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.15) + +project(TestPackage LANGUAGES CXX) + +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(CMAKE_CXX_STANDARD 20) + +find_package(yaclib REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} main.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE yaclib) diff --git a/recipes/yaclib/all/test_package/conanfile.py b/recipes/yaclib/all/test_package/conanfile.py new file mode 100644 index 00000000000000..6fa6864719164c --- /dev/null +++ b/recipes/yaclib/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + test_type = 'explicit' + generators = 'CMakeDeps', 'CMakeToolchain', 'VirtualRunEnv' + settings = 'os', 'arch', 'compiler', 'build_type' + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], 'TestPackage') + self.run(bin_path, env="conanrun") diff --git a/recipes/yaclib/all/test_package/main.cpp b/recipes/yaclib/all/test_package/main.cpp new file mode 100644 index 00000000000000..d834e92b5b3cf6 --- /dev/null +++ b/recipes/yaclib/all/test_package/main.cpp @@ -0,0 +1,25 @@ +#include + +#include "yaclib/async/contract.hpp" +#include "yaclib/util/result.hpp" + +int main() +{ + auto [f, p] = yaclib::MakeContract(); + + std::move(p).Set(42); + + if (!f.Ready()) + { + return EXIT_FAILURE; + } + + yaclib::Result result = std::move(f).Get(); + + if (std::move(result).Ok() != 42) + { + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/recipes/yaclib/all/test_v1_package/CMakeLists.txt b/recipes/yaclib/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..219058ab228202 --- /dev/null +++ b/recipes/yaclib/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.15) + +project(TestPackage LANGUAGES CXX) + +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(CMAKE_CXX_STANDARD 20) + +find_package(yaclib REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} main.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE yaclib) diff --git a/recipes/yaclib/all/test_v1_package/conanfile.py b/recipes/yaclib/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..6fa6864719164c --- /dev/null +++ b/recipes/yaclib/all/test_v1_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + test_type = 'explicit' + generators = 'CMakeDeps', 'CMakeToolchain', 'VirtualRunEnv' + settings = 'os', 'arch', 'compiler', 'build_type' + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], 'TestPackage') + self.run(bin_path, env="conanrun") diff --git a/recipes/yaclib/all/test_v1_package/main.cpp b/recipes/yaclib/all/test_v1_package/main.cpp new file mode 100644 index 00000000000000..d834e92b5b3cf6 --- /dev/null +++ b/recipes/yaclib/all/test_v1_package/main.cpp @@ -0,0 +1,25 @@ +#include + +#include "yaclib/async/contract.hpp" +#include "yaclib/util/result.hpp" + +int main() +{ + auto [f, p] = yaclib::MakeContract(); + + std::move(p).Set(42); + + if (!f.Ready()) + { + return EXIT_FAILURE; + } + + yaclib::Result result = std::move(f).Get(); + + if (std::move(result).Ok() != 42) + { + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/recipes/yaclib/config.yml b/recipes/yaclib/config.yml new file mode 100644 index 00000000000000..4a9e1f685c4e37 --- /dev/null +++ b/recipes/yaclib/config.yml @@ -0,0 +1,3 @@ +versions: + "2022.10.31": + folder: all diff --git a/recipes/yaml-cpp/all/conanfile.py b/recipes/yaml-cpp/all/conanfile.py index 7e5bbdd96dbd37..50438ad9166b4f 100644 --- a/recipes/yaml-cpp/all/conanfile.py +++ b/recipes/yaml-cpp/all/conanfile.py @@ -7,7 +7,7 @@ import os import textwrap -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class YamlCppConan(ConanFile): @@ -36,10 +36,7 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def validate(self): if self.info.settings.compiler.cppstd: diff --git a/recipes/yyjson/all/conandata.yml b/recipes/yyjson/all/conandata.yml index c6b67c28471fec..683231e89f238e 100644 --- a/recipes/yyjson/all/conandata.yml +++ b/recipes/yyjson/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.6.0": + url: "https://github.com/ibireme/yyjson/archive/refs/tags/0.6.0.tar.gz" + sha256: "75aa65d2944b3f64ce5918aa3da00f738dc695a0e8e0662de0063aafe1a8662f" "0.5.1": url: "https://github.com/ibireme/yyjson/archive/refs/tags/0.5.1.tar.gz" sha256: "b484d40b4e20cc3174a6fdc160d0f20f961417f9cb3f6dc1cf6555fffa8359f3" diff --git a/recipes/yyjson/all/conanfile.py b/recipes/yyjson/all/conanfile.py index 183c1889a57b56..5fd04cf964be20 100644 --- a/recipes/yyjson/all/conanfile.py +++ b/recipes/yyjson/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import copy, get, rmdir import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class YyjsonConan(ConanFile): @@ -30,15 +30,9 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def layout(self): cmake_layout(self, src_folder="src") diff --git a/recipes/yyjson/all/test_v1_package/CMakeLists.txt b/recipes/yyjson/all/test_v1_package/CMakeLists.txt index cb1df2a6ebd488..925ecbe19e448d 100644 --- a/recipes/yyjson/all/test_v1_package/CMakeLists.txt +++ b/recipes/yyjson/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(yyjson REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE yyjson::yyjson) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/yyjson/all/test_v1_package/conanfile.py b/recipes/yyjson/all/test_v1_package/conanfile.py index 75c0cd81d2d2f3..38f4483872d47f 100644 --- a/recipes/yyjson/all/test_v1_package/conanfile.py +++ b/recipes/yyjson/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/yyjson/config.yml b/recipes/yyjson/config.yml index 6f86c15c188beb..c1abc92e2b1b88 100644 --- a/recipes/yyjson/config.yml +++ b/recipes/yyjson/config.yml @@ -1,4 +1,6 @@ versions: + "0.6.0": + folder: all "0.5.1": folder: all "0.5.0": diff --git a/recipes/zimg/all/conandata.yml b/recipes/zimg/all/conandata.yml index 401a58d84be23c..6f58da26deae39 100644 --- a/recipes/zimg/all/conandata.yml +++ b/recipes/zimg/all/conandata.yml @@ -9,46 +9,25 @@ sources: url: "https://github.com/sekrit-twc/zimg/archive/release-3.0.2.tar.gz" sha256: "b9eadf1df12ae8395ba781f2468965d411b21abbebbebeae3651d492227d4633" "3.0.1": - sha256: "c50a0922f4adac4efad77427d13520ed89b8366eef0ef2fa379572951afcc73f" url: "https://github.com/sekrit-twc/zimg/archive/release-3.0.1.tar.gz" + sha256: "c50a0922f4adac4efad77427d13520ed89b8366eef0ef2fa379572951afcc73f" "2.9.3": - sha256: "a15c0483fbe945ffe695a1a989bc43b3381c8bf33e2d1760464ec21d32cdf30b" url: "https://github.com/sekrit-twc/zimg/archive/release-2.9.3.tar.gz" + sha256: "a15c0483fbe945ffe695a1a989bc43b3381c8bf33e2d1760464ec21d32cdf30b" patches: "3.0.4": - - patch_file: "patches/0001-msvc-remove-toolset-common.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-msvc-remove-windows-target-platform.patch" - patch_file: "patches/0002-msvc-solution.patch" - base_path: "source_subfolder" - - patch_file: "patches/0005-msvc-remove-toolset-3.0.1.patch" - base_path: "source_subfolder" "3.0.3": - - patch_file: "patches/0001-msvc-remove-toolset-common.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-msvc-remove-windows-target-platform.patch" - patch_file: "patches/0002-msvc-solution.patch" - base_path: "source_subfolder" - - patch_file: "patches/0005-msvc-remove-toolset-3.0.1.patch" - base_path: "source_subfolder" "3.0.2": - - patch_file: "patches/0001-msvc-remove-toolset-common.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-msvc-remove-windows-target-platform.patch" - patch_file: "patches/0002-msvc-solution.patch" - base_path: "source_subfolder" - - patch_file: "patches/0005-msvc-remove-toolset-3.0.1.patch" - base_path: "source_subfolder" "3.0.1": - - patch_file: "patches/0001-msvc-remove-toolset-common.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-msvc-remove-windows-target-platform.patch" - patch_file: "patches/0002-msvc-solution.patch" - base_path: "source_subfolder" - - patch_file: "patches/0005-msvc-remove-toolset-3.0.1.patch" - base_path: "source_subfolder" "2.9.3": - - patch_file: "patches/0001-msvc-remove-toolset-common.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-msvc-remove-windows-target-platform.patch" - patch_file: "patches/0002-msvc-solution.patch" - base_path: "source_subfolder" - patch_file: "patches/0003-include-stddef.patch" - base_path: "source_subfolder" - - patch_file: "patches/0004-msvc-remove-toolset-2.9.3.patch" - base_path: "source_subfolder" diff --git a/recipes/zimg/all/conanfile.py b/recipes/zimg/all/conanfile.py index 21a47de5a95932..6332a7e16ebe2e 100644 --- a/recipes/zimg/all/conanfile.py +++ b/recipes/zimg/all/conanfile.py @@ -1,17 +1,20 @@ -from conan.tools.files import rename -from conan.tools.microsoft import is_msvc -from conans import ConanFile, AutoToolsBuildEnvironment, MSBuild, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import stdcpp_library +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import check_min_vs, is_msvc, MSBuild, MSBuildToolchain import os -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.54.0" class ZimgConan(ConanFile): name = "zimg" description = "Scaling, colorspace conversion, and dithering library" - topics = ("zimg", "image", "manipulation") + topics = ("image", "manipulation") homepage = "https://github.com/sekrit-twc/zimg" url = "https://github.com/conan-io/conan-center-index" license = "WTFPL" @@ -26,17 +29,16 @@ class ZimgConan(ConanFile): "fPIC": True, } - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + @property + def _msbuild_configuration(self): + return "Debug" if self.settings.build_type == "Debug" else "Release" + def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -44,106 +46,103 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + basic_layout(self, src_folder="src") def validate(self): - if self.settings.build_type not in ("Release", "Debug"): - raise ConanInvalidConfiguration("zimg does not support the build type '{}'.".format(self.settings.build_type)) - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) < "15": - raise ConanInvalidConfiguration("zimg requires at least Visual Studio 15 2017") + check_min_vs(self, 191) def build_requirements(self): if not is_msvc(self): - self.build_requires("libtool/2.4.6") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @functools.lru_cache(1) - def _configure_autools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - yes_no = lambda v: "yes" if v else "no" - conf_args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - ] - autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return autotools - - def _build_autotools(self): - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) - # relocatable shared lib on macOS - tools.replace_in_file("configure", "-install_name \\$rpath/", "-install_name @rpath/") - autotools = self._configure_autools() - autotools.make() - - _sln_platforms = { - "x86": "Win32", - "x86_64": "x64", - "armv6": "ARM", - "armv7": "ARM", - "armv7hf": "ARM", - "armv7s": "ARM", - "armv7k": "ARM", - "armv8_32": "ARM", - "armv8": "ARM64", - "armv8.3": "ARM64", - } - - def _build_msvc(self): - msbuild = MSBuild(self) - msbuild.build(os.path.join(self._source_subfolder, "_msvc", "zimg.sln"), - targets=["dll" if self.options.shared else "zimg"], - platforms=self._sln_platforms) - - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + def generate(self): if is_msvc(self): - self._build_msvc() + tc = MSBuildToolchain(self) + tc.configuration = self._msbuild_configuration + tc.properties["WholeProgramOptimization"] = "false" + tc.generate() else: - self._build_autotools() - - def _package_autotools(self): - autotools = self._configure_autools() - autotools.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - - def _package_msvc(self): - self.copy("zimg.h", src=os.path.join(self._source_subfolder, "src", "zimg", "api"), dst="include") - self.copy("zimg++.hpp", src=os.path.join(self._source_subfolder, "src", "zimg", "api"), dst="include") + VirtualBuildEnv(self).generate() + tc = AutotoolsToolchain(self) + tc.generate() - sln_dir = os.path.join(self._source_subfolder, "_msvc", self._sln_platforms[str(self.settings.arch)], str(self.settings.build_type)) - if self.options.shared: - self.copy("z_imp.lib", src=sln_dir, dst="lib") - self.copy("z.dll", src=sln_dir, dst="bin") - rename(self, os.path.join(self.package_folder, "lib", "z_imp.lib"), - os.path.join(self.package_folder, "lib", "zimg.lib")) + def build(self): + apply_conandata_patches(self) + if is_msvc(self): + #========================== + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + vcxproj_files = [ + os.path.join(self.source_folder, "_msvc", "zimg", "zimg.vcxproj"), + os.path.join(self.source_folder, "_msvc", "dll", "dll.vcxproj"), + ] + for vcxproj_file in vcxproj_files: + replace_in_file( + self, vcxproj_file, + "true", + "" + ) + platform_toolset = MSBuildToolchain(self).toolset + conantoolchain_props = os.path.join(self.generators_folder, MSBuildToolchain.filename) + for vcxproj_file in vcxproj_files: + replace_in_file( + self, vcxproj_file, + "v142", + f"{platform_toolset}", + ) + replace_in_file( + self, vcxproj_file, + "", + f"", + ) + #========================== + + msbuild = MSBuild(self) + msbuild.build_type = self._msbuild_configuration + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + msbuild.build(os.path.join(self.source_folder, "_msvc", "zimg.sln"), + targets=["dll" if self.options.shared else "zimg"]) else: - self.copy("z.lib", src=sln_dir, dst="lib") - rename(self, os.path.join(self.package_folder, "lib", "z.lib"), - os.path.join(self.package_folder, "lib", "zimg.lib")) + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) if is_msvc(self): - self._package_msvc() + src_include_dir = os.path.join(self.source_folder, "src", "zimg", "api") + copy(self, "zimg.h", src=src_include_dir, dst=os.path.join(self.package_folder, "include")) + copy(self, "zimg++.hpp", src=src_include_dir, dst=os.path.join(self.package_folder, "include")) + output_dir = os.path.join(self.source_folder, "_msvc") + copy(self, "*.lib", src=output_dir, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dll", src=output_dir, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + old_lib = "z_imp.lib" if self.options.shared else "z.lib" + rename(self, os.path.join(self.package_folder, "lib", old_lib), + os.path.join(self.package_folder, "lib", "zimg.lib")) else: - self._package_autotools() + autotools = Autotools(self) + autotools.install() + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.set_property("pkg_config_name", "zimg") self.cpp_info.libs = ["zimg"] if not self.options.shared: if self.settings.os in ("FreeBSD", "Linux"): - self.cpp_info.system_libs = ["m"] - stdcpp = tools.stdcpp_library(self) - if stdcpp: - self.cpp_info.system_libs.append(stdcpp) + self.cpp_info.system_libs.append("m") + libcxx = stdcpp_library(self) + if libcxx: + self.cpp_info.system_libs.append(libcxx) diff --git a/recipes/zimg/all/patches/0001-msvc-remove-toolset-common.patch b/recipes/zimg/all/patches/0001-msvc-remove-toolset-common.patch deleted file mode 100644 index 4379125fd4c4a4..00000000000000 --- a/recipes/zimg/all/patches/0001-msvc-remove-toolset-common.patch +++ /dev/null @@ -1,630 +0,0 @@ ---- _msvc/_example_api/_example_api.vcxproj -+++ _msvc/_example_api/_example_api.vcxproj 2020-08-03 17:07:28.593014100 +0200 -@@ -40,58 +40,58 @@ - - {66EEC0BD-2C32-4B40-A180-B4C25B484D23} - _example_api -- 10.0 -+ - - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - ---- _msvc/_example_api_c/_example_api_c.vcxproj -+++ _msvc/_example_api_c/_example_api_c.vcxproj 2020-08-03 17:07:28.608645400 +0200 -@@ -40,58 +40,58 @@ - - {A8C79983-2F34-4E94-A86C-C44130FAB928} - _example_api_c -- 10.0 -+ - - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - ---- _msvc/_example_hdr/_example_hdr.vcxproj -+++ _msvc/_example_hdr/_example_hdr.vcxproj 2020-08-03 17:07:28.624263600 +0200 -@@ -37,58 +37,58 @@ - - {613FBE86-C438-4F7C-AB69-4C024C5305D5} - _example_hdr -- 10.0 -+ - - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - ---- _msvc/_example_interlace/_example_interlace.vcxproj -+++ _msvc/_example_interlace/_example_interlace.vcxproj 2020-08-03 17:07:28.646395600 +0200 -@@ -40,58 +40,58 @@ - - {6D8D14B2-6D32-45E3-A205-AA74DE2FBE7F} - _example_interlace -- 10.0 -+ - - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - ---- _msvc/_example_tile/_example_tile.vcxproj -+++ _msvc/_example_tile/_example_tile.vcxproj 2020-08-03 17:07:28.662027800 +0200 -@@ -38,58 +38,58 @@ - 15.0 - {53972BF2-7BFE-4A09-81E0-DC6EAF065D94} - exampletile -- 10.0 -+ - - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - ---- _msvc/dll/dll.vcxproj -+++ _msvc/dll/dll.vcxproj 2020-08-03 17:07:28.508393400 +0200 -@@ -43,58 +43,58 @@ - - {96822C64-B0B6-49F3-A24C-F9C5FDB02DD3} - dll -- 10.0 -+ - - - - DynamicLibrary - true -- v142 -+ - Unicode - - - DynamicLibrary - true -- v142 -+ - Unicode - - - DynamicLibrary - true -- v142 -+ - Unicode - - - DynamicLibrary - false -- v142 -+ - true - Unicode - - - DynamicLibrary - false -- v142 -+ - true - Unicode - - - DynamicLibrary - false -- v142 -+ - true - Unicode - - - DynamicLibrary - true -- v142 -+ - Unicode - - - DynamicLibrary - false -- v142 -+ - true - Unicode - ---- _msvc/testapp/testapp.vcxproj -+++ _msvc/testapp/testapp.vcxproj 2020-08-03 17:07:28.524017800 +0200 -@@ -57,58 +57,58 @@ - - {B85E6CC0-ED80-487D-805A-DA3597A15CE6} - TestApp -- 10.0 -+ - - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - ---- _msvc/testcommon/testcommon.vcxproj -+++ _msvc/testcommon/testcommon.vcxproj 2020-08-03 17:07:28.546136800 +0200 -@@ -37,58 +37,58 @@ - - {3849AF96-797C-4322-AD39-810D8367684D} - TestCommon -- 10.0 -+ - - - - StaticLibrary - true -- v142 -+ - Unicode - - - StaticLibrary - true -- v142 -+ - Unicode - - - StaticLibrary - true -- v142 -+ - Unicode - - - StaticLibrary - false -- v142 -+ - true - Unicode - - - StaticLibrary - false -- v142 -+ - true - Unicode - - - StaticLibrary - false -- v142 -+ - true - Unicode - - - StaticLibrary - true -- v142 -+ - Unicode - - - StaticLibrary - false -- v142 -+ - true - Unicode - ---- _msvc/zimg/zimg.vcxproj -+++ _msvc/zimg/zimg.vcxproj 2020-08-03 17:07:28.577392500 +0200 -@@ -37,58 +37,58 @@ - - {C8629E57-4D6F-40FA-82FC-B39824195932} - zimg -- 10.0 -+ - - - - StaticLibrary - true -- v142 -+ - Unicode - - - StaticLibrary - true -- v142 -+ - Unicode - - - StaticLibrary - true -- v142 -+ - Unicode - - - StaticLibrary - false -- v142 -+ - true - Unicode - - - StaticLibrary - false -- v142 -+ - true - Unicode - - - StaticLibrary - false -- v142 -+ - true - Unicode - - - StaticLibrary - true -- v142 -+ - Unicode - - - StaticLibrary - false -- v142 -+ - true - Unicode - diff --git a/recipes/zimg/all/patches/0001-msvc-remove-windows-target-platform.patch b/recipes/zimg/all/patches/0001-msvc-remove-windows-target-platform.patch new file mode 100644 index 00000000000000..f445b3e2da987f --- /dev/null +++ b/recipes/zimg/all/patches/0001-msvc-remove-windows-target-platform.patch @@ -0,0 +1,22 @@ +--- a/_msvc/dll/dll.vcxproj ++++ b/_msvc/dll/dll.vcxproj +@@ -43,7 +43,7 @@ + + {96822C64-B0B6-49F3-A24C-F9C5FDB02DD3} + dll +- 10.0 ++ + + + +--- a/_msvc/zimg/zimg.vcxproj ++++ b/_msvc/zimg/zimg.vcxproj +@@ -37,7 +37,7 @@ + + {C8629E57-4D6F-40FA-82FC-B39824195932} + zimg +- 10.0 ++ + + + diff --git a/recipes/zimg/all/patches/0004-msvc-remove-toolset-2.9.3.patch b/recipes/zimg/all/patches/0004-msvc-remove-toolset-2.9.3.patch deleted file mode 100644 index 7f3bd48e5a6a5d..00000000000000 --- a/recipes/zimg/all/patches/0004-msvc-remove-toolset-2.9.3.patch +++ /dev/null @@ -1,110 +0,0 @@ ---- _msvc/_example_alpha/_example_alpha.vcxproj -+++ _msvc/_example_alpha/_example_alpha.vcxproj 2020-08-03 17:07:28.593014100 +0200 -@@ -37,58 +37,58 @@ - - {3C822249-7551-4086-AF0B-F43871F36191} - _example_alpha -- 10.0 -+ - - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - ---- _msvc/unit_test/unit_test.vcxproj -+++ _msvc/unit_test/unit_test.vcxproj 2020-08-03 17:07:28.561767900 +0200 -@@ -108,32 +108,32 @@ - - {DDD98DB2-2ABE-4550-9F8C-0E4E4E991D73} - _unit_test -- 10.0 -+ - - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - diff --git a/recipes/zimg/all/patches/0005-msvc-remove-toolset-3.0.1.patch b/recipes/zimg/all/patches/0005-msvc-remove-toolset-3.0.1.patch deleted file mode 100644 index c0335fb34d0f83..00000000000000 --- a/recipes/zimg/all/patches/0005-msvc-remove-toolset-3.0.1.patch +++ /dev/null @@ -1,61 +0,0 @@ ---- a/_msvc/unit_test/unit_test.vcxproj -+++ b/_msvc/unit_test/unit_test.vcxproj -@@ -183,58 +183,49 @@ - - {DDD98DB2-2ABE-4550-9F8C-0E4E4E991D73} - _unit_test -- 10.0 - - - - Application - true -- v142 - Unicode - - - Application - true -- v142 - Unicode - - - Application - false -- v142 - true - Unicode - - - Application - false -- v142 - true - Unicode - - - Application - true -- v142 - Unicode - - - Application - true -- v142 - Unicode - - - Application - false -- v142 - true - Unicode - - - Application - false -- v142 - true - Unicode - diff --git a/recipes/zimg/all/test_package/CMakeLists.txt b/recipes/zimg/all/test_package/CMakeLists.txt index 1141754d91b5ed..0b744ea607a1f4 100644 --- a/recipes/zimg/all/test_package/CMakeLists.txt +++ b/recipes/zimg/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(zimg REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} zimg::zimg) +target_link_libraries(${PROJECT_NAME} PRIVATE zimg::zimg) diff --git a/recipes/zimg/all/test_package/conanfile.py b/recipes/zimg/all/test_package/conanfile.py index 38f4483872d47f..98ab55852ad565 100644 --- a/recipes/zimg/all/test_package/conanfile.py +++ b/recipes/zimg/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/zimg/all/test_v1_package/CMakeLists.txt b/recipes/zimg/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/zimg/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/zimg/all/test_v1_package/conanfile.py b/recipes/zimg/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/zimg/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/zpp_bits/all/conandata.yml b/recipes/zpp_bits/all/conandata.yml new file mode 100644 index 00000000000000..171e8ff0c9789b --- /dev/null +++ b/recipes/zpp_bits/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "4.4.12": + url: "https://github.com/eyalz800/zpp_bits/archive/v4.4.12.tar.gz" + sha256: "0060c36d394ab1fb340120a7d14e45657a72419fd1745426e75d820980fa095a" + "4.1.2": + url: "https://github.com/eyalz800/zpp_bits/archive/refs/tags/v4.4.12.tar.gz" + sha256: "0060c36d394ab1fb340120a7d14e45657a72419fd1745426e75d820980fa095a" diff --git a/recipes/zpp_bits/all/conanfile.py b/recipes/zpp_bits/all/conanfile.py new file mode 100644 index 00000000000000..56f8124709c3c1 --- /dev/null +++ b/recipes/zpp_bits/all/conanfile.py @@ -0,0 +1,72 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, check_min_vs +import os + + +required_conan_version = ">=1.52.0" + + +class ZppBitsConan(ConanFile): + name = "zpp_bits" + description = "A lightweight C++20 serialization and RPC library" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/eyalz800/zpp_bits" + topics = ("serialization", "rpc", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 20 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "11", + "clang": "12", + "apple-clang": "13.1", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 193) + if not is_msvc(self): + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.name} {self.version} requires C++{self._min_cppstd}, which your compiler does not support.", + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="zpp_bits.h", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder, + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/zpp_bits/all/test_package/CMakeLists.txt b/recipes/zpp_bits/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..73137c5e1e473f --- /dev/null +++ b/recipes/zpp_bits/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) + +find_package(zpp_bits REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE zpp_bits::zpp_bits) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/zpp_bits/all/test_package/conanfile.py b/recipes/zpp_bits/all/test_package/conanfile.py new file mode 100644 index 00000000000000..e845ae751a3017 --- /dev/null +++ b/recipes/zpp_bits/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/zpp_bits/all/test_package/test_package.cpp b/recipes/zpp_bits/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..d533c36161edc0 --- /dev/null +++ b/recipes/zpp_bits/all/test_package/test_package.cpp @@ -0,0 +1,24 @@ +#include +#include + +#include "zpp_bits.h" + +struct person { + std::string name; + int age{}; +}; + +int main(void) { + auto [data, in, out] = zpp::bits::data_in_out(); + + out(person{"Person1", 25}, person{"Person2", 35}); + + person p1, p2; + + in(p1, p2); + + std::cout << p1.name << " : " << p1.age << "\n"; + std::cout << p2.name << " : " << p2.age << "\n"; + + return 0; +} diff --git a/recipes/zpp_bits/all/test_v1_package/CMakeLists.txt b/recipes/zpp_bits/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/zpp_bits/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/zpp_bits/all/test_v1_package/conanfile.py b/recipes/zpp_bits/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/zpp_bits/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/zpp_bits/config.yml b/recipes/zpp_bits/config.yml new file mode 100644 index 00000000000000..ba6154274881b6 --- /dev/null +++ b/recipes/zpp_bits/config.yml @@ -0,0 +1,5 @@ +versions: + "4.4.12": + folder: all + "4.1.2": + folder: all diff --git a/recipes/zpp_throwing/all/conandata.yml b/recipes/zpp_throwing/all/conandata.yml new file mode 100644 index 00000000000000..063b5be845f319 --- /dev/null +++ b/recipes/zpp_throwing/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0": + url: "https://github.com/eyalz800/zpp_throwing/archive/refs/tags/v1.0.tar.gz" + sha256: "e02ef0e028e436ed4382b14796550f48c1d2b5ae02910f10b5b9fe097981ea2f" diff --git a/recipes/zpp_throwing/all/conanfile.py b/recipes/zpp_throwing/all/conanfile.py new file mode 100644 index 00000000000000..6cfaa18e3dd020 --- /dev/null +++ b/recipes/zpp_throwing/all/conanfile.py @@ -0,0 +1,87 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +from conan.tools.microsoft import is_msvc +import os + +required_conan_version = ">=1.52.0" + +class ZppThrowingConan(ConanFile): + name = "zpp_throwing" + description = "Using coroutines to implement C++ exceptions for freestanding environments" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/eyalz800/zpp_throwing" + topics = ("coroutines", "exceptions", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 20 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "17", + "msvc": "193", + "gcc": "11", + "clang": "12", + "apple-clang": "13.1", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + # TODO: currently msvc isn't suppported + # see https://github.com/eyalz800/zpp_throwing/issues/7 + if is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} doesn't support MSVC (yet). See https://github.com/eyalz800/zpp_throwing/issues/7") + + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + compiler = str(self.settings.compiler) + version = str(self.settings.compiler.version) + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler ({compiler}-{version}) does not support.", + ) + + if self.settings.compiler == "clang" and Version(self.settings.compiler.version) < "14" and self.settings.compiler.get_safe("libcxx") != "libc++": + raise ConanInvalidConfiguration(f"{self.ref} requires libc++ with 'coroutines' supported on your compiler.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder, + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + if self.settings.compiler == "clang" and self.settings.compiler.get_safe("libcxx") == "libc++": + self.cpp_info.cxxflags.append("-fcoroutines-ts") + diff --git a/recipes/zpp_throwing/all/test_package/CMakeLists.txt b/recipes/zpp_throwing/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d33f96e054b55 --- /dev/null +++ b/recipes/zpp_throwing/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) + +find_package(zpp_throwing REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE zpp_throwing::zpp_throwing) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/zpp_throwing/all/test_package/conanfile.py b/recipes/zpp_throwing/all/test_package/conanfile.py new file mode 100644 index 00000000000000..e845ae751a3017 --- /dev/null +++ b/recipes/zpp_throwing/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/zpp_throwing/all/test_package/test_package.cpp b/recipes/zpp_throwing/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..c723a245f1637c --- /dev/null +++ b/recipes/zpp_throwing/all/test_package/test_package.cpp @@ -0,0 +1,28 @@ +#include +#include + +#include "zpp_throwing.h" + +zpp::throwing foo(bool success) { + if (!success) { + // Throws an exception. + co_yield std::runtime_error("My runtime error"); + } + + // Returns a value. + co_return 1337; +} + +int main() { + return zpp::try_catch([]() -> zpp::throwing { + std::cout << "Hello World\n"; + std::cout << co_await foo(false) << '\n';; + co_return 0; + }, [&](const std::exception & error) { + std::cout << "std exception caught: " << error.what() << '\n'; + return 0; + }, [&]() { + std::cout << "Unknown exception\n"; + return 0; + }); +} diff --git a/recipes/zpp_throwing/all/test_v1_package/CMakeLists.txt b/recipes/zpp_throwing/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..be00a8c7f57c71 --- /dev/null +++ b/recipes/zpp_throwing/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/zpp_throwing/all/test_v1_package/conanfile.py b/recipes/zpp_throwing/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..0f735b51a26422 --- /dev/null +++ b/recipes/zpp_throwing/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/zpp_throwing/config.yml b/recipes/zpp_throwing/config.yml new file mode 100644 index 00000000000000..edab1ee152d366 --- /dev/null +++ b/recipes/zpp_throwing/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0": + folder: all diff --git a/recipes/zstr/all/conandata.yml b/recipes/zstr/all/conandata.yml index f563402cf65a8d..d912b849c0a5fd 100644 --- a/recipes/zstr/all/conandata.yml +++ b/recipes/zstr/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.0.7": + url: "https://github.com/mateidavid/zstr/archive/refs/tags/v1.0.7.tar.gz" + sha256: "8d2ddae68ff7bd0a6fce6150a8f52ad9ce1bed2c4056c8846f4dec4f2dc60819" "1.0.6": url: "https://github.com/mateidavid/zstr/archive/refs/tags/v1.0.6.tar.gz" sha256: "548f3fed81029defc3567d1902f7306eb0aa19f205ce9e06075b7349a3875f32" diff --git a/recipes/zstr/all/test_v1_package/CMakeLists.txt b/recipes/zstr/all/test_v1_package/CMakeLists.txt index 629a41f38d6f89..9d54a092e0a67e 100644 --- a/recipes/zstr/all/test_v1_package/CMakeLists.txt +++ b/recipes/zstr/all/test_v1_package/CMakeLists.txt @@ -4,8 +4,5 @@ project(test_package LANGUAGES CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(zstr REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE zstr::zstr) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/zstr/config.yml b/recipes/zstr/config.yml index c32b2b7161197a..86728f7f3bec41 100644 --- a/recipes/zstr/config.yml +++ b/recipes/zstr/config.yml @@ -1,4 +1,6 @@ versions: + "1.0.7": + folder: all "1.0.6": folder: all "1.0.5": diff --git a/recipes/zulu-openjdk/all/conandata.yml b/recipes/zulu-openjdk/all/conandata.yml index 5243fbdebc8c0e..516a7ae7f4098c 100644 --- a/recipes/zulu-openjdk/all/conandata.yml +++ b/recipes/zulu-openjdk/all/conandata.yml @@ -1,64 +1,40 @@ sources: - "11.0.8": - "Windows": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.41.23-ca-jdk11.0.8-win_x64.zip", - "sha256": "3602ed7bae52898c540c2d3ae3230c081cf061b219d14fb9ac15a47f4226d307", - } - "Linux": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.41.23-ca-jdk11.0.8-linux_x64.tar.gz", - "sha256": "f8aee4ab30ca11ab3c8f401477df0e455a9d6b06f2710b2d1b1ddcf06067bc79", - } - "Macos": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.41.23-ca-jdk11.0.8-macosx_x64.tar.gz", - "sha256": "1ed070ea9a27030bcca4d7c074dec1d205d3f3506166d36faf4d1b9e083ab365", - } - "11.0.12": "Windows": - "x86_64": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.50.19-ca-jdk11.0.12-win_x64.zip", - "sha256": "42ae65e75d615a3f06a674978e1fa85fdf078cad94e553fee3e779b2b42bb015", - } + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu11.50.19-ca-jdk11.0.12-win_x64.zip" + sha256: "42ae65e75d615a3f06a674978e1fa85fdf078cad94e553fee3e779b2b42bb015" "Linux": - "x86_64": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.50.19-ca-jdk11.0.12-linux_x64.tar.gz", - "sha256": "b8e8a63b79bc312aa90f3558edbea59e71495ef1a9c340e38900dd28a1c579f3", - } - "armv8": { - "url": "https://cdn.azul.com/zulu-embedded/bin/zulu11.50.19-ca-jdk11.0.12-linux_aarch64.tar.gz", - "sha256": "61254688067454d3ccf0ef25993b5dcab7b56c8129e53b73566c28a8dd4d48fb", - } + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu11.50.19-ca-jdk11.0.12-linux_x64.tar.gz" + sha256: "b8e8a63b79bc312aa90f3558edbea59e71495ef1a9c340e38900dd28a1c579f3" + "armv8": + url: "https://cdn.azul.com/zulu-embedded/bin/zulu11.50.19-ca-jdk11.0.12-linux_aarch64.tar.gz" + sha256: "61254688067454d3ccf0ef25993b5dcab7b56c8129e53b73566c28a8dd4d48fb" "Macos": - "x86_64": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.50.19-ca-jdk11.0.12-macosx_x64.tar.gz", - "sha256": "0b8c8b7cf89c7c55b7e2239b47201d704e8d2170884875b00f3103cf0662d6d7", - } - "armv8" : { - "url": "https://cdn.azul.com/zulu/bin/zulu11.50.19-ca-jdk11.0.12-macosx_aarch64.tar.gz", - "sha256": "e908a0b4c0da08d41c3e19230f819b364ff2e5f1dafd62d2cf991a85a34d3a17", - } + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu11.50.19-ca-jdk11.0.12-macosx_x64.tar.gz" + sha256: "0b8c8b7cf89c7c55b7e2239b47201d704e8d2170884875b00f3103cf0662d6d7" + "armv8": + url: "https://cdn.azul.com/zulu/bin/zulu11.50.19-ca-jdk11.0.12-macosx_aarch64.tar.gz" + sha256: "e908a0b4c0da08d41c3e19230f819b364ff2e5f1dafd62d2cf991a85a34d3a17" "11.0.15": "Windows": - "x86_64": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-win_x64.zip", - "sha256": "a106c77389a63b6bd963a087d5f01171bd32aa3ee7377ecef87531390dcb9050", - } + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-win_x64.zip" + sha256: "a106c77389a63b6bd963a087d5f01171bd32aa3ee7377ecef87531390dcb9050" "Linux": - "x86_64": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-linux_x64.tar.gz", - "sha256": "e064b61d93304012351242bf0823c6a2e41d9e28add7ea7f05378b7243d34247", - } - "armv8": { - "url": "https://cdn.azul.com/zulu-embedded/bin/zulu11.56.19-ca-jdk11.0.15-linux_aarch64.tar.gz", - "sha256": "fc7c41a0005180d4ca471c90d01e049469e0614cf774566d4cf383caa29d1a97", - } + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-linux_x64.tar.gz" + sha256: "e064b61d93304012351242bf0823c6a2e41d9e28add7ea7f05378b7243d34247" + "armv8": + url: "https://cdn.azul.com/zulu-embedded/bin/zulu11.56.19-ca-jdk11.0.15-linux_aarch64.tar.gz" + sha256: "fc7c41a0005180d4ca471c90d01e049469e0614cf774566d4cf383caa29d1a97" "Macos": - "x86_64": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-macosx_x64.tar.gz", - "sha256": "2614e5c5de8e989d4d81759de4c333aa5b867b17ab9ee78754309ba65c7f6f55", - } - "armv8" : { - "url": "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64.tar.gz", - "sha256": "6bb0d2c6e8a29dcd9c577bbb2986352ba12481a9549ac2c0bcfd00ed60e538d2", - } + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-macosx_x64.tar.gz" + sha256: "2614e5c5de8e989d4d81759de4c333aa5b867b17ab9ee78754309ba65c7f6f55" + "armv8": + url: "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64.tar.gz" + sha256: "6bb0d2c6e8a29dcd9c577bbb2986352ba12481a9549ac2c0bcfd00ed60e538d2" diff --git a/recipes/zulu-openjdk/all/conanfile.py b/recipes/zulu-openjdk/all/conanfile.py index df269044c419f6..05d28945d8c9ab 100644 --- a/recipes/zulu-openjdk/all/conanfile.py +++ b/recipes/zulu-openjdk/all/conanfile.py @@ -1,7 +1,8 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration -from conans.tools import Version -import os, glob +import os + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy class ZuluOpenJDK(ConanFile): @@ -11,11 +12,8 @@ class ZuluOpenJDK(ConanFile): homepage = "https://www.azul.com" license = "https://www.azul.com/products/zulu-and-zulu-enterprise/zulu-terms-of-use/" topics = ("java", "jdk", "openjdk") - settings = "os", "arch", "build_type", "compiler" - - @property - def _source_subfolder(self): - return "source_subfolder" + settings = "os", "arch" + package_type = "application" @property def _settings_build(self): @@ -26,42 +24,39 @@ def _jni_folder(self): folder = {"Linux": "linux", "Macos": "darwin", "Windows": "win32"}.get(str(self._settings_build.os)) return os.path.join("include", folder) - def package_id(self): - del self.info.settings.build_type - del self.info.settings.compiler def validate(self): - if Version(self.version) < Version("11.0.12"): - supported_archs = ["x86_64"] - if self._settings_build.arch not in supported_archs: - raise ConanInvalidConfiguration(f"Unsupported Architecture ({self._settings_build.arch}). The version {self.version} currently only supports {supported_archs}.") - elif Version(self.version) >= Version("11.0.12"): - supported_archs = ["x86_64", "armv8"] - if self._settings_build.arch not in supported_archs: - raise ConanInvalidConfiguration(f"Unsupported Architecture ({self._settings_build.arch}). This version {self.version} currently only supports {supported_archs}.") + supported_archs = ["x86_64", "armv8"] + if self._settings_build.arch not in supported_archs: + raise ConanInvalidConfiguration(f"Unsupported Architecture ({self._settings_build.arch}). " + "This version {self.version} currently only supports {supported_archs}.") supported_os = ["Windows", "Macos", "Linux"] if self._settings_build.os not in supported_os: - raise ConanInvalidConfiguration(f"Unsupported os ({self._settings_build.os}). This package currently only support {supported_os}.") + raise ConanInvalidConfiguration(f"Unsupported os ({self._settings_build.os}). " + "This package currently only support {supported_os}.") def build(self): - if Version(self.version) < Version("11.0.12"): - tools.get(**self.conan_data["sources"][self.version][str(self._settings_build.os)], - destination=self._source_subfolder, strip_root=True) - else: - tools.get(**self.conan_data["sources"][self.version][str(self._settings_build.os)][str(self._settings_build.arch)], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version][str(self._settings_build.os)][str(self._settings_build.arch)], strip_root=True) def package(self): - self.copy(pattern="*", dst="bin", src=os.path.join(self._source_subfolder, "bin"), excludes=("msvcp140.dll", "vcruntime140.dll")) - self.copy(pattern="*", dst="include", src=os.path.join(self._source_subfolder, "include")) - self.copy(pattern="*", dst="lib", src=os.path.join(self._source_subfolder, "lib")) - self.copy(pattern="*", dst="res", src=os.path.join(self._source_subfolder, "conf")) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "bin"), + src=os.path.join(self.source_folder, "bin"), + excludes=("msvcp140.dll", "vcruntime140.dll")) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include")) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "lib"), + src=os.path.join(self.source_folder, "lib")) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "res"), + src=os.path.join(self.source_folder, "conf")) # conf folder is required for security settings, to avoid # java.lang.SecurityException: Can't read cryptographic policy directory: unlimited # https://github.com/conan-io/conan-center-index/pull/4491#issuecomment-774555069 - self.copy(pattern="*", dst="conf", src=os.path.join(self._source_subfolder, "conf")) - self.copy(pattern="*", dst="licenses", src=os.path.join(self._source_subfolder, "legal")) - self.copy(pattern="*", dst=os.path.join("lib", "jmods"), src=os.path.join(self._source_subfolder, "jmods")) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "conf"), + src=os.path.join(self.source_folder, "conf")) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "licenses"), + src=os.path.join(self.source_folder, "legal")) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "lib", "jmods"), + src=os.path.join(self.source_folder, "jmods")) def package_info(self): self.cpp_info.includedirs.append(self._jni_folder) @@ -72,6 +67,8 @@ def package_info(self): self.output.info("Creating JAVA_HOME environment variable with : {0}".format(java_home)) self.env_info.JAVA_HOME = java_home + self.buildenv_info.define_path("JAVA_HOME", java_home) + self.runenv_info.define_path("JAVA_HOME", java_home) self.output.info("Appending PATH environment variable with : {0}".format(bin_path)) self.env_info.PATH.append(bin_path) diff --git a/recipes/zulu-openjdk/all/test_package/conanfile.py b/recipes/zulu-openjdk/all/test_package/conanfile.py index 59867bd3e396dd..e80eb25a7acac0 100644 --- a/recipes/zulu-openjdk/all/test_package/conanfile.py +++ b/recipes/zulu-openjdk/all/test_package/conanfile.py @@ -1,26 +1,29 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import cross_building from io import StringIO class TestPackage(ConanFile): settings = "os", "arch" + test_type = "explicit" + generators = "VirtualRunEnv" + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): pass # nothing to build, but tests should not warn def test(self): - if tools.cross_building(self): + if cross_building(self): return # OK, this needs some explanation # You basically do not crosscompile that package, never # But C3I does, Macos x86_64 to M1, # and this is why there is some cross compilation going on # The test will not work in that environment, so .... don't test - test_cmd = ['java', '--version'] output = StringIO() - self.run(test_cmd, output=output, run_environment=True) + self.run("java --version", output, env="conanrun") version_info = output.getvalue() - if "Zulu" in version_info: - pass - else: + if "Zulu" not in version_info: raise Exception("java call seems not use the Zulu bin") diff --git a/recipes/zulu-openjdk/all/test_v1_package/conanfile.py b/recipes/zulu-openjdk/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..e80eb25a7acac0 --- /dev/null +++ b/recipes/zulu-openjdk/all/test_v1_package/conanfile.py @@ -0,0 +1,29 @@ +from conan import ConanFile +from conan.tools.build import cross_building +from io import StringIO + + +class TestPackage(ConanFile): + settings = "os", "arch" + test_type = "explicit" + generators = "VirtualRunEnv" + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + pass # nothing to build, but tests should not warn + + def test(self): + if cross_building(self): + return + # OK, this needs some explanation + # You basically do not crosscompile that package, never + # But C3I does, Macos x86_64 to M1, + # and this is why there is some cross compilation going on + # The test will not work in that environment, so .... don't test + output = StringIO() + self.run("java --version", output, env="conanrun") + version_info = output.getvalue() + if "Zulu" not in version_info: + raise Exception("java call seems not use the Zulu bin") diff --git a/recipes/zulu-openjdk/config.yml b/recipes/zulu-openjdk/config.yml index aeba9022820bca..41d345875e1e8b 100644 --- a/recipes/zulu-openjdk/config.yml +++ b/recipes/zulu-openjdk/config.yml @@ -1,6 +1,4 @@ versions: - "11.0.8": - folder: all "11.0.12": folder: all "11.0.15": diff --git a/recipes/zxing-cpp/all/CMakeLists.txt b/recipes/zxing-cpp/all/CMakeLists.txt deleted file mode 100644 index a465612005359a..00000000000000 --- a/recipes/zxing-cpp/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -if(WIN32 AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif() - -add_subdirectory(source_subfolder) diff --git a/recipes/zxing-cpp/all/conandata.yml b/recipes/zxing-cpp/all/conandata.yml index 69d8a5f6261801..061a1e5e1b6467 100644 --- a/recipes/zxing-cpp/all/conandata.yml +++ b/recipes/zxing-cpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.0.0": + url: "https://github.com/nu-book/zxing-cpp/archive/v1.4.0.tar.gz" + sha256: "126767bb56f8a1f25ae84d233db2e9b9be50d71f5776092d0e170ca0f0ed1862" "1.4.0": url: "https://github.com/nu-book/zxing-cpp/archive/v1.4.0.tar.gz" sha256: "126767bb56f8a1f25ae84d233db2e9b9be50d71f5776092d0e170ca0f0ed1862" @@ -13,13 +16,18 @@ patches: # core/ByteArray checks `__cpp_lib_string_view` for using string_view. # But some compilers(ex. gcc 7.2) don't support `__cpp_lib_string_view` but support string_view. - patch_file: "patches/1.4.0-0001-fix-string-view.patch" - base_path: "source_subfolder" + patch_description: "fix compilation error for string_view on several compilers" + patch_type: "portability" "1.0.8": - patch_file: "patches/1.0.8-0001-Fix-C2327-for-MSVC-2015.patch" - base_path: "source_subfolder" + patch_description: "fix compilation error C2327 on MSVC 2015" + patch_type: "portability" - patch_file: "patches/1.0.8-0002-include-limits.patch" - base_path: "source_subfolder" + patch_description: "include limits" + patch_type: "portability" - patch_file: "patches/1.0.8-0003-include-stdexcept.patch" - base_path: "source_subfolder" + patch_description: "include stdexcept" + patch_type: "portability" - patch_file: "patches/1.0.8-0004-include-cstddef.patch" - base_path: "source_subfolder" + patch_description: "include cstddef" + patch_type: "portability" diff --git a/recipes/zxing-cpp/all/conanfile.py b/recipes/zxing-cpp/all/conanfile.py index b5e0b276dbb875..aef63f3e7475fb 100644 --- a/recipes/zxing-cpp/all/conanfile.py +++ b/recipes/zxing-cpp/all/conanfile.py @@ -1,11 +1,13 @@ -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration -from conan.tools.microsoft import is_msvc, is_msvc_static_runtime -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import is_msvc_static_runtime, is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.53.0" class ZXingCppConan(ConanFile): name = "zxing-cpp" @@ -29,37 +31,27 @@ class ZXingCppConan(ConanFile): "enable_decoders": True, } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - @property def _compiler_cpp_support(self): return { "14" : { "gcc": "5", "Visual Studio": "14", + "msvc": "190", "clang": "3.4", "apple-clang": "3.4", }, "17" : { - "gcc": "7", + "gcc": "7" if Version(self.version) < "2.0.0" else "8", "Visual Studio": "16", - "clang": "5", - "apple-clang": "5", + "msvc": "192", + "clang": "5" if Version(self.version) < "2.0.0" else "7", + "apple-clang": "5" if Version(self.version) < "2.0.0" else "12", } } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -67,62 +59,61 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - cpp_version = 17 if tools.Version(self.version) >= "1.2.0" else 14 + cpp_version = 17 if Version(self.version) >= "1.2.0" else 14 if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, cpp_version) + check_min_cppstd(self, cpp_version) min_version = self._compiler_cpp_support.get(str(cpp_version)).get(str(self.settings.compiler)) - - if min_version and tools.Version(self.settings.compiler.version) < min_version: - raise ConanInvalidConfiguration( - "This compiler is too old. {} needs a compiler with c++{} support".format(self.name, cpp_version) - ) + if min_version and Version(self.settings.compiler.version) < min_version: + raise ConanInvalidConfiguration(f"This compiler is too old. {self.ref} needs a compiler with c++{cpp_version} support") # FIXME: This is a workaround for "The system cannot execute the specified program." - if tools.Version(self.version) >= "1.3.0" and is_msvc_static_runtime(self) and self.settings.build_type == "Debug": - raise ConanInvalidConfiguration("{}/{} doesn't support MT + Debug.".format(self.name, self.version)) + if Version(self.version) >= "1.3.0" and is_msvc_static_runtime(self) and self.settings.build_type == "Debug": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support MT + Debug.") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - if tools.Version(self.version) < "1.1": - cmake.definitions["ENABLE_ENCODERS"] = self.options.enable_encoders - cmake.definitions["ENABLE_DECODERS"] = self.options.enable_decoders + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + if Version(self.version) < "1.1": + tc.variables["ENABLE_ENCODERS"] = self.options.enable_encoders + tc.variables["ENABLE_DECODERS"] = self.options.enable_decoders + tc.variables["BUILD_SHARED_LIBRARY"] = self.options.shared else: - cmake.definitions["BUILD_WRITERS"] = self.options.enable_encoders - cmake.definitions["BUILD_READERS"] = self.options.enable_decoders - cmake.definitions["BUILD_EXAMPLES"] = False - cmake.definitions["BUILD_BLACKBOX_TESTS"] = False + tc.variables["BUILD_WRITERS"] = self.options.enable_encoders + tc.variables["BUILD_READERS"] = self.options.enable_decoders + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_BLACKBOX_TESTS"] = False if is_msvc(self): - cmake.definitions["LINK_CPP_STATICALLY"] = "MT" in str(self.settings.compiler.runtime) - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.variables["LINK_CPP_STATICALLY"] = is_msvc_static_runtime(self) + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE*", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "ZXing") self.cpp_info.set_property("cmake_target_name", "ZXing::ZXing") self.cpp_info.set_property("pkg_config_name", "zxing") - self.cpp_info.libs = ["ZXingCore" if tools.Version(self.version) < "1.1" else "ZXing"] + self.cpp_info.libs = ["ZXingCore" if Version(self.version) < "1.1" else "ZXing"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread", "m"] diff --git a/recipes/zxing-cpp/all/test_package/CMakeLists.txt b/recipes/zxing-cpp/all/test_package/CMakeLists.txt index 45f25b99a6fd5f..8e4b0111b8b7e0 100644 --- a/recipes/zxing-cpp/all/test_package/CMakeLists.txt +++ b/recipes/zxing-cpp/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) - -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(ZXing REQUIRED CONFIG) find_package(stb REQUIRED CONFIG) @@ -12,5 +9,5 @@ if (ZXing_VERSION VERSION_LESS "1.1.0") else() add_executable(${PROJECT_NAME} test_package_1.1.cpp) endif() -target_link_libraries(${PROJECT_NAME} ZXing::ZXing stb::stb) +target_link_libraries(${PROJECT_NAME} PRIVATE ZXing::ZXing stb::stb) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/zxing-cpp/all/test_package/conanfile.py b/recipes/zxing-cpp/all/test_package/conanfile.py index 617b69931fb4c1..9ba1684044ebff 100644 --- a/recipes/zxing-cpp/all/test_package/conanfile.py +++ b/recipes/zxing-cpp/all/test_package/conanfile.py @@ -1,13 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" def requirements(self): - self.requires("stb/cci.20210910") + self.requires("stb/cci.20220909") + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -15,12 +21,12 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): + if can_run(self): try: os.unlink("output.png") except FileNotFoundError: pass - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") assert os.path.isfile("output.png") diff --git a/recipes/zxing-cpp/all/test_v1_package/CMakeLists.txt b/recipes/zxing-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..be00a8c7f57c71 --- /dev/null +++ b/recipes/zxing-cpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/zxing-cpp/all/test_v1_package/conanfile.py b/recipes/zxing-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..030ecca50ee45f --- /dev/null +++ b/recipes/zxing-cpp/all/test_v1_package/conanfile.py @@ -0,0 +1,27 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def requirements(self): + self.requires("stb/cci.20220909") + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + try: + os.unlink("output.png") + except FileNotFoundError: + pass + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + + assert os.path.isfile("output.png") diff --git a/recipes/zxing-cpp/config.yml b/recipes/zxing-cpp/config.yml index 778dac07cb8fa6..a4e6ca74f0f314 100644 --- a/recipes/zxing-cpp/config.yml +++ b/recipes/zxing-cpp/config.yml @@ -1,4 +1,6 @@ versions: + "2.0.0": + folder: all "1.4.0": folder: all "1.3.0":