What changed, and why it matters
This commit simply deletes an unused third-party Rust crate (cmake) from the project's vendored dependencies. It is a cleanup change with no functional code modifications and no apparent security relevance.
No security action required. Verify that no remaining Cargo.toml or build script still references the cmake crate, though the commit message indicates it was unused.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit removes the entire external/vendor/cmake directory, which contained the vendored cmake-rs crate (version 0.1.54) including its source, Cargo metadata, licenses, and CI files. The commit title and message explicitly state this is a cleanup to remove an unused crate. No firmware code, build scripts, or dependency manifests outside this directory are modified.
Changed components
external/vendor/cmake (removed)Inspect captured patch +0 / −1739
diff --git a/external/vendor/cmake/.cargo-checksum.json b/external/vendor/cmake/.cargo-checksum.json
deleted file mode 100644
index c3f7e70..0000000
--- a/external/vendor/cmake/.cargo-checksum.json
+++ /dev/null
@@ -1 +0,0 @@
-{"files":{".cargo_vcs_info.json":"df350497fbe889272d120e403f3be3d1dd8b69d84827e7a4e539ab2f4dd1f544",".github/dependabot.yml":"d04c9b0253b2bbae886b59a11399ea260397b460cd9f5712d692d1c85f8ec090",".github/workflows/main.yml":"46ce9367bb4cdeec903b2274b32339d5e8399ed3afa5f6dacd5ae55d7afa8443",".github/workflows/publish.yml":"7125d7f9471bfb8c4e3768cdb94f8e046914a6dc74b4f60ed42c8a0dc950739f",".release-plz.toml":"2a4f7567c3f1fc47377888514276612130b6998f4a30a165891e6a8d2f57b6c3","CHANGELOG.md":"bdaa1449bc2298828849d2faa6e459f28fe5eaa3838c77412bf5abd9b45f7bdd","Cargo.lock":"5d6509cdd18c0011e0a3230e30654b2f67baf4e85706775478e3f44bd387d2a0","Cargo.toml":"a7a284f3f7a1613137b4103b5866d5ac0dc29aac58ef2ad8528f5a65405601fd","Cargo.toml.orig":"44cce6aaf504ce10a5c8bc0e3326a021ac2c1650d5ac45588b3c046b489cfc0c","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"7bdc22c92fda3b54f01aab154e4897e441816ff7473127ab5ddeb203f870aa7a","src/lib.rs":"e7bd0089c62b73fa193b2843005c2ee9787dad2c88f9ed87ebf9e8554cae84dc"},"package":"e7caa3f9de89ddbe2c607f4101924c5abec803763ae9534e4f4d7d8f84aa81f0"}
\ No newline at end of file
diff --git a/external/vendor/cmake/.cargo_vcs_info.json b/external/vendor/cmake/.cargo_vcs_info.json
deleted file mode 100644
index 514d63e..0000000
--- a/external/vendor/cmake/.cargo_vcs_info.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "git": {
- "sha1": "fd56c5a6b4ecda8815c863eb5b12d7b3f0391197"
- },
- "path_in_vcs": ""
-}
\ No newline at end of file
diff --git a/external/vendor/cmake/.github/dependabot.yml b/external/vendor/cmake/.github/dependabot.yml
deleted file mode 100644
index 7377d37..0000000
--- a/external/vendor/cmake/.github/dependabot.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-version: 2
-updates:
-- package-ecosystem: cargo
- directory: "/"
- schedule:
- interval: daily
- time: "08:00"
- open-pull-requests-limit: 10
diff --git a/external/vendor/cmake/.github/workflows/main.yml b/external/vendor/cmake/.github/workflows/main.yml
deleted file mode 100644
index 67ff451..0000000
--- a/external/vendor/cmake/.github/workflows/main.yml
+++ /dev/null
@@ -1,156 +0,0 @@
-name: CI
-on: [push, pull_request]
-
-env:
- RUSTDOCFLAGS: -D warnings
- RUSTFLAGS: -D warnings
-
-jobs:
- clippy:
- name: clippy
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - name: Install Rust
- run: |
- rustup update beta --no-self-update
- rustup default beta
- rustup component add clippy
- - uses: Swatinem/rust-cache@v2
- - run: cargo clippy --all-features --all-targets -- -D warnings
-
- test:
- name: Test
- runs-on: ${{ matrix.os }}
- strategy:
- matrix:
- os: [ubuntu-latest, macos-latest, windows-latest]
- rust: ["1.70", stable, beta, nightly]
- steps:
- - uses: actions/checkout@v4
- - name: Install Rust
- run: |
- rustup update ${{ matrix.rust }} --no-self-update
- rustup default ${{ matrix.rust }}
- - uses: Swatinem/rust-cache@v2
- - run: cargo test
- - name: Integration test
- run: cargo test --manifest-path test-crate/Cargo.toml
-
- cross_compile_test:
- name: Test Cross Compile - ${{ matrix.platform.target }}
- needs: [ test ]
- runs-on: ubuntu-latest
- strategy:
- fail-fast: false
- matrix:
- platform:
- # Testable
- - target: aarch64-unknown-linux-gnu
- test: true
- - target: arm-unknown-linux-gnueabihf
- test: true
- - target: powerpc-unknown-linux-gnu
- test: true
- - target: s390x-unknown-linux-gnu
- test: true
- - target: x86_64-unknown-linux-musl
- test: true
- - target: aarch64-unknown-linux-musl
- test: true
- # Build only
- - target: x86_64-pc-solaris
- test: false
- - target: x86_64-pc-windows-gnu
- test: false
- # FIXME: build fails, see <https://github.com/rust-lang/cmake-rs/issues/211>
- # - target: x86_64-unknown-freebsd
- # test: false
- - target: x86_64-unknown-netbsd
- test: false
- - target: x86_64-unknown-illumos
- test: false
- steps:
- - uses: actions/checkout@master
- - name: Install Rust
- run: |
- rustup update stable --no-self-update
- rustup default stable
- rustup target add ${{ matrix.platform.target }}
- - uses: taiki-e/install-action@v2
- with:
- tool: cross
- - uses: Swatinem/rust-cache@v2
- - name: cross test
- run: cross test -vv --target ${{ matrix.platform.target }}
- working-directory: test-crate
- if: ${{ matrix.platform.test }}
- - name: cross build
- run: cross build -vv --target ${{ matrix.platform.target }}
- working-directory: test-crate
- if: ${{ !matrix.platform.test }}
-
- ios_cross_compile_test:
- name: Test Cross Compile - ${{ matrix.platform.target }}
- needs: [ test ]
- runs-on: macos-latest
- strategy:
- fail-fast: false
- matrix:
- platform:
- - target: aarch64-apple-ios
- steps:
- - uses: actions/checkout@v4
- - name: Install Rust
- run: |
- rustup update stable --no-self-update
- rustup default stable
- rustup target add ${{ matrix.platform.target }}
- - uses: Swatinem/rust-cache@v2
- - name: build
- run: cargo build -vv --target ${{ matrix.platform.target }}
- working-directory: test-crate
- env:
- # If this isn't specified the default is iOS 7, for which zlib-ng will not compile due to the lack of thread-local storage.
- IPHONEOS_DEPLOYMENT_TARGET: 16
-
- rustfmt:
- name: Rustfmt
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@master
- - name: Install Rust
- run: |
- rustup update stable --no-self-update
- rustup default stable
- rustup component add rustfmt
- - run: cargo fmt --all -- --check
-
- doc:
- name: docs
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - run: |
- rustup update nightly --no-self-update
- rustup default nightly
- - uses: Swatinem/rust-cache@v2
- - run: cargo doc
-
- success:
- needs:
- - clippy
- - test
- - cross_compile_test
- - ios_cross_compile_test
- - rustfmt
- - doc
- runs-on: ubuntu-latest
- # GitHub branch protection is exceedingly silly and treats "jobs skipped because a dependency
- # failed" as success. So we have to do some contortions to ensure the job fails if any of its
- # dependencies fails.
- if: always() # make sure this is never "skipped"
- steps:
- # Manually check the status of all dependencies. `if: failure()` does not work.
- - name: check if any dependency failed
- run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
diff --git a/external/vendor/cmake/.github/workflows/publish.yml b/external/vendor/cmake/.github/workflows/publish.yml
deleted file mode 100644
index c492e66..0000000
--- a/external/vendor/cmake/.github/workflows/publish.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-name: Release-plz
-
-permissions:
- pull-requests: write
- contents: write
-
-on:
- push:
- branches:
- - master
-
-jobs:
- release-plz:
- name: Release-plz
- runs-on: ubuntu-latest
- steps:
- - name: Checkout repository
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
- - name: Install Rust (rustup)
- run: rustup update stable --no-self-update && rustup default stable
- - name: Run release-plz
- uses: MarcoIeni/release-plz-action@v0.5
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
diff --git a/external/vendor/cmake/.release-plz.toml b/external/vendor/cmake/.release-plz.toml
deleted file mode 100644
index 8868315..0000000
--- a/external/vendor/cmake/.release-plz.toml
+++ /dev/null
@@ -1,2 +0,0 @@
-[workspace]
-git_tag_name = "v{{ version }}"
diff --git a/external/vendor/cmake/CHANGELOG.md b/external/vendor/cmake/CHANGELOG.md
deleted file mode 100644
index 59d78bc..0000000
--- a/external/vendor/cmake/CHANGELOG.md
+++ /dev/null
@@ -1,39 +0,0 @@
-# Changelog
-
-## [Unreleased]
-
-## [0.1.54](https://github.com/rust-lang/cmake-rs/compare/v0.1.53...v0.1.54) - 2025-02-10
-
-### Other
-
-- Remove workaround for broken `cc-rs` versions ([#235](https://github.com/rust-lang/cmake-rs/pull/235))
-- Be more precise in the description of `register_dep` ([#238](https://github.com/rust-lang/cmake-rs/pull/238))
-
-## [0.1.53](https://github.com/rust-lang/cmake-rs/compare/v0.1.52...v0.1.53) - 2025-01-27
-
-### Other
-
-- Disable broken Make jobserver support on OSX to fix parallel builds ([#229](https://github.com/rust-lang/cmake-rs/pull/229))
-
-## [0.1.52](https://github.com/rust-lang/cmake-rs/compare/v0.1.51...v0.1.52) - 2024-11-25
-
-### Other
-
-- Expose cc-rs no_default_flags for hassle-free cross-compilation ([#225](https://github.com/rust-lang/cmake-rs/pull/225))
-- Add a `success` job to CI
-- Change `--build` to use an absolute path
-- Merge pull request [#195](https://github.com/rust-lang/cmake-rs/pull/195) from meowtec/feat/improve-fail-hint
-- Improve hint for cmake not installed in Linux (code 127)
-
-## [0.1.51](https://github.com/rust-lang/cmake-rs/compare/v0.1.50...v0.1.51) - 2024-08-15
-
-### Added
-
-- Add JOM generator support ([#183](https://github.com/rust-lang/cmake-rs/pull/183))
-- Improve visionOS support ([#209](https://github.com/rust-lang/cmake-rs/pull/209))
-- Use `Generic` for bare-metal systems ([#187](https://github.com/rust-lang/cmake-rs/pull/187))
-
-### Fixed
-
-- Fix cross compilation on android armv7 and x86 ([#186](https://github.com/rust-lang/cmake-rs/pull/186))
-
diff --git a/external/vendor/cmake/Cargo.lock b/external/vendor/cmake/Cargo.lock
deleted file mode 100644
index 03f6392..0000000
--- a/external/vendor/cmake/Cargo.lock
+++ /dev/null
@@ -1,25 +0,0 @@
-# This file is automatically @generated by Cargo.
-# It is not intended for manual editing.
-version = 4
-
-[[package]]
-name = "cc"
-version = "1.2.13"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c7777341816418c02e033934a09f20dc0ccaf65a5201ef8a450ae0105a573fda"
-dependencies = [
- "shlex",
-]
-
-[[package]]
-name = "cmake"
-version = "0.1.54"
-dependencies = [
- "cc",
-]
-
-[[package]]
-name = "shlex"
-version = "1.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
diff --git a/external/vendor/cmake/Cargo.toml b/external/vendor/cmake/Cargo.toml
deleted file mode 100644
index 16b9604..0000000
--- a/external/vendor/cmake/Cargo.toml
+++ /dev/null
@@ -1,39 +0,0 @@
-# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
-#
-# When uploading crates to the registry Cargo will automatically
-# "normalize" Cargo.toml files for maximal compatibility
-# with all versions of Cargo and also rewrite `path` dependencies
-# to registry (e.g., crates.io) dependencies.
-#
-# If you are reading this file be aware that the original Cargo.toml
-# will likely look very different (and much more reasonable).
-# See Cargo.toml.orig for the original contents.
-
-[package]
-edition = "2021"
-name = "cmake"
-version = "0.1.54"
-authors = ["Alex Crichton <alex@alexcrichton.com>"]
-build = false
-autolib = false
-autobins = false
-autoexamples = false
-autotests = false
-autobenches = false
-description = """
-A build dependency for running `cmake` to build a native library
-"""
-homepage = "https://github.com/rust-lang/cmake-rs"
-documentation = "https://docs.rs/cmake"
-readme = "README.md"
-keywords = ["build-dependencies"]
-categories = ["development-tools::build-utils"]
-license = "MIT OR Apache-2.0"
-repository = "https://github.com/rust-lang/cmake-rs"
-
-[lib]
-name = "cmake"
-path = "src/lib.rs"
-
-[dependencies.cc]
-version = "1.1.0"
diff --git a/external/vendor/cmake/Cargo.toml.orig b/external/vendor/cmake/Cargo.toml.orig
deleted file mode 100644
index 7d4d9fc..0000000
--- a/external/vendor/cmake/Cargo.toml.orig
+++ /dev/null
@@ -1,18 +0,0 @@
-[package]
-name = "cmake"
-version = "0.1.54"
-authors = ["Alex Crichton <alex@alexcrichton.com>"]
-license = "MIT OR Apache-2.0"
-readme = "README.md"
-keywords = ["build-dependencies"]
-repository = "https://github.com/rust-lang/cmake-rs"
-homepage = "https://github.com/rust-lang/cmake-rs"
-documentation = "https://docs.rs/cmake"
-description = """
-A build dependency for running `cmake` to build a native library
-"""
-categories = ["development-tools::build-utils"]
-edition = "2021"
-
-[dependencies]
-cc = "1.1.0"
diff --git a/external/vendor/cmake/LICENSE-APACHE b/external/vendor/cmake/LICENSE-APACHE
deleted file mode 100644
index 16fe87b..0000000
--- a/external/vendor/cmake/LICENSE-APACHE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
-2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
-3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
-4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
-5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
-6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
-8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
-END OF TERMS AND CONDITIONS
-
-APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
-Copyright [yyyy] [name of copyright owner]
-
-Licensed 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.
diff --git a/external/vendor/cmake/LICENSE-MIT b/external/vendor/cmake/LICENSE-MIT
deleted file mode 100644
index 39e0ed6..0000000
--- a/external/vendor/cmake/LICENSE-MIT
+++ /dev/null
@@ -1,25 +0,0 @@
-Copyright (c) 2014 Alex Crichton
-
-Permission is hereby granted, free of charge, to any
-person obtaining a copy of this software and associated
-documentation files (the "Software"), to deal in the
-Software without restriction, including without
-limitation the rights to use, copy, modify, merge,
-publish, distribute, sublicense, and/or sell copies of
-the Software, and to permit persons to whom the Software
-is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice
-shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
-ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
-TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
-IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
diff --git a/external/vendor/cmake/README.md b/external/vendor/cmake/README.md
deleted file mode 100644
index fd51bee..0000000
--- a/external/vendor/cmake/README.md
+++ /dev/null
@@ -1,32 +0,0 @@
-# cmake
-
-[Documentation](https://docs.rs/cmake)
-
-A build dependency for running the `cmake` build tool to compile a native
-library.
-
-```toml
-# Cargo.toml
-[build-dependencies]
-cmake = "0.1"
-```
-
-The CMake executable is assumed to be `cmake` unless the `CMAKE`
-environmental variable is set.
-
-# License
-
-This project is licensed under either of
-
- * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
- https://www.apache.org/licenses/LICENSE-2.0)
- * MIT license ([LICENSE-MIT](LICENSE-MIT) or
- https://opensource.org/licenses/MIT)
-
-at your option.
-
-### Contribution
-
-Unless you explicitly state otherwise, any contribution intentionally submitted
-for inclusion in cmake by you, as defined in the Apache-2.0 license, shall be
-dual licensed as above, without any additional terms or conditions.
diff --git a/external/vendor/cmake/src/lib.rs b/external/vendor/cmake/src/lib.rs
deleted file mode 100644
index 57d4a43..0000000
--- a/external/vendor/cmake/src/lib.rs
+++ /dev/null
@@ -1,1160 +0,0 @@
-//! A build dependency for running `cmake` to build a native library
-//!
-//! This crate provides some necessary boilerplate and shim support for running
-//! the system `cmake` command to build a native library. It will add
-//! appropriate cflags for building code to link into Rust, handle cross
-//! compilation, and use the necessary generator for the platform being
-//! targeted.
-//!
-//! The builder-style configuration allows for various variables and such to be
-//! passed down into the build as well.
-//!
-//! ## Installation
-//!
-//! Add this to your `Cargo.toml`:
-//!
-//! ```toml
-//! [build-dependencies]
-//! cmake = "0.1"
-//! ```
-//!
-//! ## Examples
-//!
-//! ```no_run
-//! use cmake;
-//!
-//! // Builds the project in the directory located in `libfoo`, installing it
-//! // into $OUT_DIR
-//! let dst = cmake::build("libfoo");
-//!
-//! println!("cargo:rustc-link-search=native={}", dst.display());
-//! println!("cargo:rustc-link-lib=static=foo");
-//! ```
-//!
-//! ```no_run
-//! use cmake::Config;
-//!
-//! let dst = Config::new("libfoo")
-//! .define("FOO", "BAR")
-//! .cflag("-foo")
-//! .build();
-//! println!("cargo:rustc-link-search=native={}", dst.display());
-//! println!("cargo:rustc-link-lib=static=foo");
-//! ```
-
-#![deny(missing_docs)]
-
-extern crate cc;
-
-use std::collections::HashMap;
-use std::env;
-use std::ffi::{OsStr, OsString};
-use std::fs::{self, File};
-use std::io::prelude::*;
-use std::io::ErrorKind;
-use std::path::{Path, PathBuf};
-use std::process::Command;
-
-/// Builder style configuration for a pending CMake build.
-pub struct Config {
- path: PathBuf,
- generator: Option<OsString>,
- generator_toolset: Option<OsString>,
- cflags: OsString,
- cxxflags: OsString,
- asmflags: OsString,
- defines: Vec<(OsString, OsString)>,
- deps: Vec<String>,
- target: Option<String>,
- host: Option<String>,
- out_dir: Option<PathBuf>,
- profile: Option<String>,
- configure_args: Vec<OsString>,
- build_args: Vec<OsString>,
- cmake_target: Option<String>,
- env: Vec<(OsString, OsString)>,
- static_crt: Option<bool>,
- uses_cxx11: bool,
- always_configure: bool,
- no_build_target: bool,
- no_default_flags: bool,
- verbose_cmake: bool,
- verbose_make: bool,
- pic: Option<bool>,
- c_cfg: Option<cc::Build>,
- cxx_cfg: Option<cc::Build>,
- env_cache: HashMap<String, Option<OsString>>,
-}
-
-/// Builds the native library rooted at `path` with the default cmake options.
-/// This will return the directory in which the library was installed.
-///
-/// # Examples
-///
-/// ```no_run
-/// use cmake;
-///
-/// // Builds the project in the directory located in `libfoo`, installing it
-/// // into $OUT_DIR
-/// let dst = cmake::build("libfoo");
-///
-/// println!("cargo:rustc-link-search=native={}", dst.display());
-/// println!("cargo:rustc-link-lib=static=foo");
-/// ```
-///
-pub fn build<P: AsRef<Path>>(path: P) -> PathBuf {
- Config::new(path.as_ref()).build()
-}
-
-impl Config {
- /// Return explicitly set profile or infer `CMAKE_BUILD_TYPE` from Rust's compilation profile.
- ///
- /// * if `opt-level=0` then `CMAKE_BUILD_TYPE=Debug`,
- /// * if `opt-level={1,2,3}` and:
- /// * `debug=false` then `CMAKE_BUILD_TYPE=Release`
- /// * otherwise `CMAKE_BUILD_TYPE=RelWithDebInfo`
- /// * if `opt-level={s,z}` then `CMAKE_BUILD_TYPE=MinSizeRel`
- pub fn get_profile(&self) -> &str {
- if let Some(profile) = self.profile.as_ref() {
- profile
- } else {
- // Determine Rust's profile, optimization level, and debug info:
- #[derive(PartialEq)]
- enum RustProfile {
- Debug,
- Release,
- }
- #[derive(PartialEq, Debug)]
- enum OptLevel {
- Debug,
- Release,
- Size,
- }
-
- let rust_profile = match &getenv_unwrap("PROFILE")[..] {
- "debug" => RustProfile::Debug,
- "release" | "bench" => RustProfile::Release,
- unknown => {
- eprintln!(
- "Warning: unknown Rust profile={}; defaulting to a release build.",
- unknown
- );
- RustProfile::Release
- }
- };
-
- let opt_level = match &getenv_unwrap("OPT_LEVEL")[..] {
- "0" => OptLevel::Debug,
- "1" | "2" | "3" => OptLevel::Release,
- "s" | "z" => OptLevel::Size,
- unknown => {
- let default_opt_level = match rust_profile {
- RustProfile::Debug => OptLevel::Debug,
- RustProfile::Release => OptLevel::Release,
- };
- eprintln!(
- "Warning: unknown opt-level={}; defaulting to a {:?} build.",
- unknown, default_opt_level
- );
- default_opt_level
- }
- };
-
- let debug_info: bool = match &getenv_unwrap("DEBUG")[..] {
- "false" => false,
- "true" => true,
- unknown => {
- eprintln!("Warning: unknown debug={}; defaulting to `true`.", unknown);
- true
- }
- };
-
- match (opt_level, debug_info) {
- (OptLevel::Debug, _) => "Debug",
- (OptLevel::Release, false) => "Release",
- (OptLevel::Release, true) => "RelWithDebInfo",
- (OptLevel::Size, _) => "MinSizeRel",
- }
- }
- }
-
- /// Creates a new blank set of configuration to build the project specified
- /// at the path `path`.
- pub fn new<P: AsRef<Path>>(path: P) -> Config {
- Config {
- path: env::current_dir().unwrap().join(path),
- generator: None,
- generator_toolset: None,
- no_default_flags: false,
- cflags: OsString::new(),
- cxxflags: OsString::new(),
- asmflags: OsString::new(),
- defines: Vec::new(),
- deps: Vec::new(),
- profile: None,
- out_dir: None,
- target: None,
- host: None,
- configure_args: Vec::new(),
- build_args: Vec::new(),
- cmake_target: None,
- env: Vec::new(),
- static_crt: None,
- uses_cxx11: false,
- always_configure: true,
- no_build_target: false,
- verbose_cmake: false,
- verbose_make: false,
- pic: None,
- c_cfg: None,
- cxx_cfg: None,
- env_cache: HashMap::new(),
- }
- }
-
- /// Sets flag for PIC. Otherwise use cc::Build platform default
- pub fn pic(&mut self, explicit_flag: bool) -> &mut Config {
- self.pic = Some(explicit_flag);
- self
- }
-
- /// Sets the build-tool generator (`-G`) for this compilation.
- ///
- /// If unset, this crate will use the `CMAKE_GENERATOR` environment variable
- /// if set. Otherwise, it will guess the best generator to use based on the
- /// build target.
- pub fn generator<T: AsRef<OsStr>>(&mut self, generator: T) -> &mut Config {
- self.generator = Some(generator.as_ref().to_owned());
- self
- }
-
- /// Sets the toolset name (-T) if supported by generator.
- /// Can be used to compile with Clang/LLVM instead of msvc when Visual Studio generator is selected.
- ///
- /// If unset, will use the default toolset of the selected generator.
- pub fn generator_toolset<T: AsRef<OsStr>>(&mut self, toolset_name: T) -> &mut Config {
- self.generator_toolset = Some(toolset_name.as_ref().to_owned());
- self
- }
-
- /// Adds a custom flag to pass down to the C compiler, supplementing those
- /// that this library already passes.
- pub fn cflag<P: AsRef<OsStr>>(&mut self, flag: P) -> &mut Config {
- self.cflags.push(" ");
- self.cflags.push(flag.as_ref());
- self
- }
-
- /// Adds a custom flag to pass down to the C++ compiler, supplementing those
- /// that this library already passes.
- pub fn cxxflag<P: AsRef<OsStr>>(&mut self, flag: P) -> &mut Config {
- self.cxxflags.push(" ");
- self.cxxflags.push(flag.as_ref());
- self
- }
-
- /// Adds a custom flag to pass down to the ASM compiler, supplementing those
- /// that this library already passes.
- pub fn asmflag<P: AsRef<OsStr>>(&mut self, flag: P) -> &mut Config {
- self.asmflags.push(" ");
- self.asmflags.push(flag.as_ref());
- self
- }
-
- /// Adds a new `-D` flag to pass to cmake during the generation step.
- pub fn define<K, V>(&mut self, k: K, v: V) -> &mut Config
- where
- K: AsRef<OsStr>,
- V: AsRef<OsStr>,
- {
- self.defines
- .push((k.as_ref().to_owned(), v.as_ref().to_owned()));
- self
- }
-
- /// Registers a dependency for this compilation on the native library built
- /// by Cargo previously.
- ///
- /// This registration will update the `CMAKE_PREFIX_PATH` environment
- /// variable for the [`build`][Self::build] system generation step. The
- /// path will be updated to include the content of the environment
- /// variable `DEP_XXX_ROOT`, where `XXX` is replaced with the uppercased
- /// value of `dep` (if that variable exists).
- pub fn register_dep(&mut self, dep: &str) -> &mut Config {
- self.deps.push(dep.to_string());
- self
- }
-
- /// Sets the target triple for this compilation.
- ///
- /// This is automatically scraped from `$TARGET` which is set for Cargo
- /// build scripts so it's not necessary to call this from a build script.
- pub fn target(&mut self, target: &str) -> &mut Config {
- self.target = Some(target.to_string());
- self
- }
-
- /// Disables the cmake target option for this compilation.
- ///
- /// Note that this isn't related to the target triple passed to the compiler!
- pub fn no_build_target(&mut self, no_build_target: bool) -> &mut Config {
- self.no_build_target = no_build_target;
- self
- }
-
- /// Disables the generation of default compiler flags. The default compiler
- /// flags may cause conflicts in some cross compiling scenarios.
- pub fn no_default_flags(&mut self, no_default_flags: bool) -> &mut Config {
- self.no_default_flags = no_default_flags;
- self
- }
-
- /// Sets the host triple for this compilation.
- ///
- /// This is automatically scraped from `$HOST` which is set for Cargo
- /// build scripts so it's not necessary to call this from a build script.
- pub fn host(&mut self, host: &str) -> &mut Config {
- self.host = Some(host.to_string());
- self
- }
-
- /// Sets the output directory for this compilation.
- ///
- /// This is automatically scraped from `$OUT_DIR` which is set for Cargo
- /// build scripts so it's not necessary to call this from a build script.
- pub fn out_dir<P: AsRef<Path>>(&mut self, out: P) -> &mut Config {
- self.out_dir = Some(out.as_ref().to_path_buf());
- self
- }
-
- /// Sets the `CMAKE_BUILD_TYPE=build_type` variable.
- ///
- /// By default, this value is automatically inferred from Rust's compilation
- /// profile as follows:
- ///
- /// * if `opt-level=0` then `CMAKE_BUILD_TYPE=Debug`,
- /// * if `opt-level={1,2,3}` and:
- /// * `debug=false` then `CMAKE_BUILD_TYPE=Release`
- /// * otherwise `CMAKE_BUILD_TYPE=RelWithDebInfo`
- /// * if `opt-level={s,z}` then `CMAKE_BUILD_TYPE=MinSizeRel`
- pub fn profile(&mut self, profile: &str) -> &mut Config {
- self.profile = Some(profile.to_string());
- self
- }
-
- /// Configures whether the /MT flag or the /MD flag will be passed to msvc build tools.
- ///
- /// This option defaults to `false`, and affect only msvc targets.
- pub fn static_crt(&mut self, static_crt: bool) -> &mut Config {
- self.static_crt = Some(static_crt);
- self
- }
-
- /// Add an argument to the `cmake` configure step
- pub fn configure_arg<A: AsRef<OsStr>>(&mut self, arg: A) -> &mut Config {
- self.configure_args.push(arg.as_ref().to_owned());
- self
- }
-
- /// Add an argument to the final `cmake` build step
- pub fn build_arg<A: AsRef<OsStr>>(&mut self, arg: A) -> &mut Config {
- self.build_args.push(arg.as_ref().to_owned());
- self
- }
-
- /// Configure an environment variable for the `cmake` processes spawned by
- /// this crate in the `build` step.
- pub fn env<K, V>(&mut self, key: K, value: V) -> &mut Config
- where
- K: AsRef<OsStr>,
- V: AsRef<OsStr>,
- {
- self.env
- .push((key.as_ref().to_owned(), value.as_ref().to_owned()));
- self
- }
-
- /// Sets the build target for the final `cmake` build step, this will
- /// default to "install" if not specified.
- pub fn build_target(&mut self, target: &str) -> &mut Config {
- self.cmake_target = Some(target.to_string());
- self
- }
-
- /// Alters the default target triple on OSX to ensure that c++11 is
- /// available. Does not change the target triple if it is explicitly
- /// specified.
- ///
- /// This does not otherwise affect any CXX flags, i.e. it does not set
- /// -std=c++11 or -stdlib=libc++.
- #[deprecated = "no longer does anything, C++ is determined based on `cc::Build`, and the macOS issue has been fixed upstream"]
- pub fn uses_cxx11(&mut self) -> &mut Config {
- self.uses_cxx11 = true;
- self
- }
-
- /// Forces CMake to always run before building the custom target.
- ///
- /// In some cases, when you have a big project, you can disable
- /// subsequents runs of cmake to make `cargo build` faster.
- pub fn always_configure(&mut self, always_configure: bool) -> &mut Config {
- self.always_configure = always_configure;
- self
- }
-
- /// Sets very verbose output.
- pub fn very_verbose(&mut self, value: bool) -> &mut Config {
- self.verbose_cmake = value;
- self.verbose_make = value;
- self
- }
-
- // Simple heuristic to determine if we're cross-compiling using the Android
- // NDK toolchain file.
- fn uses_android_ndk(&self) -> bool {
- // `ANDROID_ABI` is the only required flag:
- // https://developer.android.com/ndk/guides/cmake#android_abi
- self.defined("ANDROID_ABI")
- && self.defines.iter().any(|(flag, value)| {
- flag == "CMAKE_TOOLCHAIN_FILE"
- && Path::new(value).file_name() == Some("android.toolchain.cmake".as_ref())
- })
- }
-
- /// Initializes the C build configuration.
- pub fn init_c_cfg(&mut self, c_cfg: cc::Build) -> &mut Config {
- self.c_cfg = Some(c_cfg);
- self
- }
-
- /// Initializes the C++ build configuration.
- pub fn init_cxx_cfg(&mut self, cxx_cfg: cc::Build) -> &mut Config {
- self.cxx_cfg = Some(cxx_cfg);
- self
- }
-
- /// Run this configuration, compiling the library with all the configured
- /// options.
- ///
- /// This will run both the build system generator command as well as the
- /// command to build the library.
- pub fn build(&mut self) -> PathBuf {
- let target = match self.target.clone() {
- Some(t) => t,
- None => getenv_unwrap("TARGET"),
- };
- let host = self.host.clone().unwrap_or_else(|| getenv_unwrap("HOST"));
-
- // Some decisions later on are made if CMAKE_TOOLCHAIN_FILE is defined,
- // so we need to read it from the environment variables from the beginning.
- if !self.defined("CMAKE_TOOLCHAIN_FILE") {
- if let Some(s) = self.getenv_target_os("CMAKE_TOOLCHAIN_FILE") {
- self.define("CMAKE_TOOLCHAIN_FILE", s);
- } else if target.contains("redox") {
- if !self.defined("CMAKE_SYSTEM_NAME") {
- self.define("CMAKE_SYSTEM_NAME", "Generic");
- }
- } else if target != host && !self.defined("CMAKE_SYSTEM_NAME") {
- // Set CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_PROCESSOR when cross compiling
- let os = getenv_unwrap("CARGO_CFG_TARGET_OS");
- let arch = getenv_unwrap("CARGO_CFG_TARGET_ARCH");
- // CMAKE_SYSTEM_NAME list
- // https://gitlab.kitware.com/cmake/cmake/-/issues/21489#note_1077167
- //
- // CMAKE_SYSTEM_PROCESSOR
- // some of the values come from https://en.wikipedia.org/wiki/Uname
- let (system_name, system_processor) = match (os.as_str(), arch.as_str()) {
- ("android", "arm") => ("Android", "armv7-a"),
- ("android", "x86") => ("Android", "i686"),
- ("android", arch) => ("Android", arch),
- ("dragonfly", arch) => ("DragonFly", arch),
- ("macos", "aarch64") => ("Darwin", "arm64"),
- ("macos", arch) => ("Darwin", arch),
- ("freebsd", "x86_64") => ("FreeBSD", "amd64"),
- ("freebsd", arch) => ("FreeBSD", arch),
- ("fuchsia", arch) => ("Fuchsia", arch),
- ("haiku", arch) => ("Haiku", arch),
- ("ios", "aarch64") => ("iOS", "arm64"),
- ("ios", arch) => ("iOS", arch),
- ("linux", arch) => {
- let name = "Linux";
- match arch {
- "powerpc" => (name, "ppc"),
- "powerpc64" => (name, "ppc64"),
- "powerpc64le" => (name, "ppc64le"),
- _ => (name, arch),
- }
- }
- ("netbsd", arch) => ("NetBSD", arch),
- ("openbsd", "x86_64") => ("OpenBSD", "amd64"),
- ("openbsd", arch) => ("OpenBSD", arch),
- ("solaris", arch) => ("SunOS", arch),
- ("tvos", "aarch64") => ("tvOS", "arm64"),
- ("tvos", arch) => ("tvOS", arch),
- ("visionos", "aarch64") => ("visionOS", "arm64"),
- ("visionos", arch) => ("visionOS", arch),
- ("watchos", "aarch64") => ("watchOS", "arm64"),
- ("watchos", arch) => ("watchOS", arch),
- ("windows", "x86_64") => ("Windows", "AMD64"),
- ("windows", "x86") => ("Windows", "X86"),
- ("windows", "aarch64") => ("Windows", "ARM64"),
- ("none", arch) => ("Generic", arch),
- // Others
- (os, arch) => (os, arch),
- };
- self.define("CMAKE_SYSTEM_NAME", system_name);
- self.define("CMAKE_SYSTEM_PROCESSOR", system_processor);
- }
- }
-
- let generator = self
- .generator
- .clone()
- .or_else(|| self.getenv_target_os("CMAKE_GENERATOR"));
-
- let msvc = target.contains("msvc");
- let ndk = self.uses_android_ndk();
- let mut c_cfg = self.c_cfg.clone().unwrap_or_default();
- c_cfg
- .cargo_metadata(false)
- .cpp(false)
- .opt_level(0)
- .debug(false)
- .warnings(false)
- .host(&host)
- .no_default_flags(ndk || self.no_default_flags);
- if !ndk {
- c_cfg.target(&target);
- }
- let mut cxx_cfg = self.cxx_cfg.clone().unwrap_or_default();
- cxx_cfg
- .cargo_metadata(false)
- .cpp(true)
- .opt_level(0)
- .debug(false)
- .warnings(false)
- .host(&host)
- .no_default_flags(ndk || self.no_default_flags);
- if !ndk {
- cxx_cfg.target(&target);
- }
- if let Some(static_crt) = self.static_crt {
- c_cfg.static_crt(static_crt);
- cxx_cfg.static_crt(static_crt);
- }
- if let Some(explicit_flag) = self.pic {
- c_cfg.pic(explicit_flag);
- cxx_cfg.pic(explicit_flag);
- }
- let c_compiler = c_cfg.get_compiler();
- let cxx_compiler = cxx_cfg.get_compiler();
- let asm_compiler = c_cfg.get_compiler();
-
- let dst = self
- .out_dir
- .clone()
- .unwrap_or_else(|| PathBuf::from(getenv_unwrap("OUT_DIR")));
- let build = dst.join("build");
- self.maybe_clear(&build);
- let _ = fs::create_dir_all(&build);
-
- // Add all our dependencies to our cmake paths
- let mut cmake_prefix_path = Vec::new();
- for dep in &self.deps {
- let dep = dep.to_uppercase().replace('-', "_");
- if let Some(root) = env::var_os(format!("DEP_{}_ROOT", dep)) {
- cmake_prefix_path.push(PathBuf::from(root));
- }
- }
- let system_prefix = self
- .getenv_target_os("CMAKE_PREFIX_PATH")
- .unwrap_or_default();
- cmake_prefix_path.extend(env::split_paths(&system_prefix));
- let cmake_prefix_path = env::join_paths(&cmake_prefix_path).unwrap();
-
- // Build up the first cmake command to build the build system.
- let mut cmd = self.cmake_configure_command(&target);
-
- let version = Version::from_command(cmd.get_program()).unwrap_or_default();
-
- if self.verbose_cmake {
- cmd.arg("-Wdev");
- cmd.arg("--debug-output");
- }
-
- cmd.arg(&self.path).current_dir(&build);
- let mut is_ninja = false;
- if let Some(ref generator) = generator {
- is_ninja = generator.to_string_lossy().contains("Ninja");
- }
- if target.contains("windows-gnu") {
- if host.contains("windows") {
- // On MinGW we need to coerce cmake to not generate a visual
- // studio build system but instead use makefiles that MinGW can
- // use to build.
- if generator.is_none() {
- // If make.exe isn't found, that means we may be using a MinGW
- // toolchain instead of a MSYS2 toolchain. If neither is found,
- // the build cannot continue.
- let has_msys2 = Command::new("make")
- .arg("--version")
- .output()
- .err()
- .map(|e| e.kind() != ErrorKind::NotFound)
- .unwrap_or(true);
- let has_mingw32 = Command::new("mingw32-make")
- .arg("--version")
- .output()
- .err()
- .map(|e| e.kind() != ErrorKind::NotFound)
- .unwrap_or(true);
-
- let generator = match (has_msys2, has_mingw32) {
- (true, _) => "MSYS Makefiles",
- (false, true) => "MinGW Makefiles",
- (false, false) => fail("no valid generator found for GNU toolchain; MSYS or MinGW must be installed")
- };
-
- cmd.arg("-G").arg(generator);
- }
- } else {
- // If we're cross compiling onto windows, then set some
- // variables which will hopefully get things to succeed. Some
- // systems may need the `windres` or `dlltool` variables set, so
- // set them if possible.
- if !self.defined("CMAKE_RC_COMPILER") {
- let exe = find_exe(c_compiler.path());
- if let Some(name) = exe.file_name().unwrap().to_str() {
- let name = name.replace("gcc", "windres");
- let windres = exe.with_file_name(name);
- if windres.is_file() {
- let mut arg = OsString::from("-DCMAKE_RC_COMPILER=");
- arg.push(&windres);
- cmd.arg(arg);
- }
- }
- }
- }
- } else if msvc {
- // If we're on MSVC we need to be sure to use the right generator or
- // otherwise we won't get 32/64 bit correct automatically.
- // This also guarantees that NMake generator isn't chosen implicitly.
- let using_nmake_generator = if let Some(g) = &generator {
- g == "NMake Makefiles" || g == "NMake Makefiles JOM"
- } else {
- cmd.arg("-G").arg(self.visual_studio_generator(&target));
- false
- };
- if !is_ninja && !using_nmake_generator {
- if target.contains("x86_64") {
- if self.generator_toolset.is_none() {
- cmd.arg("-Thost=x64");
- }
- cmd.arg("-Ax64");
- } else if target.contains("thumbv7a") {
- if self.generator_toolset.is_none() {
- cmd.arg("-Thost=x64");
- }
- cmd.arg("-Aarm");
- } else if target.contains("aarch64") {
- if self.generator_toolset.is_none() {
- cmd.arg("-Thost=x64");
- }
- cmd.arg("-AARM64");
- } else if target.contains("i686") {
- if self.generator_toolset.is_none() {
- cmd.arg("-Thost=x86");
- }
- cmd.arg("-AWin32");
- } else {
- panic!("unsupported msvc target: {}", target);
- }
- }
- } else if target.contains("darwin") && !self.defined("CMAKE_OSX_ARCHITECTURES") {
- if target.contains("x86_64") {
- cmd.arg("-DCMAKE_OSX_ARCHITECTURES=x86_64");
- } else if target.contains("aarch64") {
- cmd.arg("-DCMAKE_OSX_ARCHITECTURES=arm64");
- } else {
- panic!("unsupported darwin target: {}", target);
- }
- }
- if let Some(ref generator) = generator {
- cmd.arg("-G").arg(generator);
- }
- if let Some(ref generator_toolset) = self.generator_toolset {
- cmd.arg("-T").arg(generator_toolset);
- }
- let profile = self.get_profile().to_string();
- for (k, v) in &self.defines {
- let mut os = OsString::from("-D");
- os.push(k);
- os.push("=");
- os.push(v);
- cmd.arg(os);
- }
-
- if !self.defined("CMAKE_INSTALL_PREFIX") {
- let mut dstflag = OsString::from("-DCMAKE_INSTALL_PREFIX=");
- dstflag.push(&dst);
- cmd.arg(dstflag);
- }
-
- let build_type = self
- .defines
- .iter()
- .find(|&(a, _)| a == "CMAKE_BUILD_TYPE")
- .map(|x| x.1.to_str().unwrap())
- .unwrap_or(&profile);
- let build_type_upcase = build_type
- .chars()
- .flat_map(|c| c.to_uppercase())
- .collect::<String>();
-
- {
- // let cmake deal with optimization/debuginfo
- let skip_arg = |arg: &OsStr| match arg.to_str() {
- Some(s) => s.starts_with("-O") || s.starts_with("/O") || s == "-g",
- None => false,
- };
- let mut set_compiler = |kind: &str, compiler: &cc::Tool, extra: &OsString| {
- let flag_var = format!("CMAKE_{}_FLAGS", kind);
- let tool_var = format!("CMAKE_{}_COMPILER", kind);
- if !self.defined(&flag_var) {
- let mut flagsflag = OsString::from("-D");
- flagsflag.push(&flag_var);
- flagsflag.push("=");
- flagsflag.push(extra);
- for arg in compiler.args() {
- if skip_arg(arg) {
- continue;
- }
- flagsflag.push(" ");
- flagsflag.push(arg);
- }
- cmd.arg(flagsflag);
- }
-
- // The visual studio generator apparently doesn't respect
- // `CMAKE_C_FLAGS` but does respect `CMAKE_C_FLAGS_RELEASE` and
- // such. We need to communicate /MD vs /MT, so set those vars
- // here.
- //
- // Note that for other generators, though, this *overrides*
- // things like the optimization flags, which is bad.
- if generator.is_none() && msvc {
- let flag_var_alt = format!("CMAKE_{}_FLAGS_{}", kind, build_type_upcase);
- if !self.defined(&flag_var_alt) {
- let mut flagsflag = OsString::from("-D");
- flagsflag.push(&flag_var_alt);
- flagsflag.push("=");
- flagsflag.push(extra);
- for arg in compiler.args() {
- if skip_arg(arg) {
- continue;
- }
- flagsflag.push(" ");
- flagsflag.push(arg);
- }
- cmd.arg(flagsflag);
- }
- }
-
- // Apparently cmake likes to have an absolute path to the
- // compiler as otherwise it sometimes thinks that this variable
- // changed as it thinks the found compiler, /usr/bin/cc,
- // differs from the specified compiler, cc. Not entirely sure
- // what's up, but at least this means cmake doesn't get
- // confused?
- //
- // Also specify this on Windows only if we use MSVC with Ninja,
- // as it's not needed for MSVC with Visual Studio generators and
- // for MinGW it doesn't really vary.
- if !self.defined("CMAKE_TOOLCHAIN_FILE")
- && !self.defined(&tool_var)
- && (env::consts::FAMILY != "windows" || (msvc && is_ninja))
- {
- let mut ccompiler = OsString::from("-D");
- ccompiler.push(&tool_var);
- ccompiler.push("=");
- ccompiler.push(find_exe(compiler.path()));
- #[cfg(windows)]
- {
- // CMake doesn't like unescaped `\`s in compiler paths
- // so we either have to escape them or replace with `/`s.
- use std::os::windows::ffi::{OsStrExt, OsStringExt};
- let wchars = ccompiler
- .encode_wide()
- .map(|wchar| {
- if wchar == b'\\' as u16 {
- '/' as u16
- } else {
- wchar
- }
- })
- .collect::<Vec<_>>();
- ccompiler = OsString::from_wide(&wchars);
- }
- cmd.arg(ccompiler);
- }
- };
-
- set_compiler("C", &c_compiler, &self.cflags);
- set_compiler("CXX", &cxx_compiler, &self.cxxflags);
- set_compiler("ASM", &asm_compiler, &self.asmflags);
- }
-
- if !self.defined("CMAKE_BUILD_TYPE") {
- cmd.arg(format!("-DCMAKE_BUILD_TYPE={}", profile));
- }
-
- if self.verbose_make {
- cmd.arg("-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON");
- }
-
- for (k, v) in c_compiler.env().iter().chain(&self.env) {
- cmd.env(k, v);
- }
-
- if self.always_configure || !build.join("CMakeCache.txt").exists() {
- cmd.args(&self.configure_args);
- run(cmd.env("CMAKE_PREFIX_PATH", cmake_prefix_path), "cmake");
- } else {
- println!("CMake project was already configured. Skipping configuration step.");
- }
-
- // And build!
- let mut cmd = self.cmake_build_command(&target);
- cmd.current_dir(&build);
-
- for (k, v) in c_compiler.env().iter().chain(&self.env) {
- cmd.env(k, v);
- }
-
- // If the generated project is Makefile based we should carefully transfer corresponding CARGO_MAKEFLAGS
- let mut use_jobserver = false;
- if fs::metadata(build.join("Makefile")).is_ok() {
- match env::var_os("CARGO_MAKEFLAGS") {
- // Only do this on non-windows, non-bsd, and non-macos (unless a named pipe
- // jobserver is available)
- // * On Windows, we could be invoking make instead of
- // mingw32-make which doesn't work with our jobserver
- // * bsdmake also does not work with our job server
- // * On macOS, CMake blocks propagation of the jobserver's file descriptors to make
- // However, if the jobserver is based on a named pipe, this will be available to
- // the build.
- Some(ref makeflags)
- if !(cfg!(windows)
- || cfg!(target_os = "openbsd")
- || cfg!(target_os = "netbsd")
- || cfg!(target_os = "freebsd")
- || cfg!(target_os = "dragonfly")
- || (cfg!(target_os = "macos")
- && !uses_named_pipe_jobserver(makeflags))) =>
- {
- use_jobserver = true;
- cmd.env("MAKEFLAGS", makeflags);
- }
- _ => {}
- }
- }
-
- cmd.arg("--build").arg(&build);
-
- if !self.no_build_target {
- let target = self
- .cmake_target
- .clone()
- .unwrap_or_else(|| "install".to_string());
- cmd.arg("--target").arg(target);
- }
-
- cmd.arg("--config").arg(&profile);
-
- // --parallel requires CMake 3.12:
- // https://cmake.org/cmake/help/latest/release/3.12.html#command-line
- if version >= Version::new(3, 12) && !use_jobserver {
- if let Ok(s) = env::var("NUM_JOBS") {
- // See https://cmake.org/cmake/help/v3.12/manual/cmake.1.html#build-tool-mode
- cmd.arg("--parallel").arg(s);
- }
- }
-
- if !&self.build_args.is_empty() {
- cmd.arg("--").args(&self.build_args);
- }
-
- run(&mut cmd, "cmake");
-
- println!("cargo:root={}", dst.display());
- dst
- }
-
- fn cmake_executable(&mut self) -> OsString {
- self.getenv_target_os("CMAKE")
- .unwrap_or_else(|| OsString::from("cmake"))
- }
-
- // If we are building for Emscripten, wrap the calls to CMake
- // as "emcmake cmake ..." and "emmake cmake --build ...".
- // https://emscripten.org/docs/compiling/Building-Projects.html
-
- fn cmake_configure_command(&mut self, target: &str) -> Command {
- if target.contains("emscripten") {
- let emcmake = self
- .getenv_target_os("EMCMAKE")
- .unwrap_or_else(|| OsString::from("emcmake"));
- let mut cmd = Command::new(emcmake);
- cmd.arg(self.cmake_executable());
- cmd
- } else {
- Command::new(self.cmake_executable())
- }
- }
-
- fn cmake_build_command(&mut self, target: &str) -> Command {
- if target.contains("emscripten") {
- let emmake = self
- .getenv_target_os("EMMAKE")
- .unwrap_or_else(|| OsString::from("emmake"));
- let mut cmd = Command::new(emmake);
- cmd.arg(self.cmake_executable());
- cmd
- } else {
- Command::new(self.cmake_executable())
- }
- }
-
- fn getenv_os(&mut self, v: &str) -> Option<OsString> {
- if let Some(val) = self.env_cache.get(v) {
- return val.clone();
- }
- let r = env::var_os(v);
- println!("{} = {:?}", v, r);
- self.env_cache.insert(v.to_string(), r.clone());
- r
- }
-
- /// Gets a target-specific environment variable.
- fn getenv_target_os(&mut self, var_base: &str) -> Option<OsString> {
- let host = self.host.clone().unwrap_or_else(|| getenv_unwrap("HOST"));
- let target = self
- .target
- .clone()
- .unwrap_or_else(|| getenv_unwrap("TARGET"));
-
- let kind = if host == target { "HOST" } else { "TARGET" };
- let target_u = target.replace('-', "_");
- self.getenv_os(&format!("{}_{}", var_base, target))
- .or_else(|| self.getenv_os(&format!("{}_{}", var_base, target_u)))
- .or_else(|| self.getenv_os(&format!("{}_{}", kind, var_base)))
- .or_else(|| self.getenv_os(var_base))
- }
-
- fn visual_studio_generator(&self, target: &str) -> String {
- use cc::windows_registry::{find_vs_version, VsVers};
-
- let base = match find_vs_version() {
- Ok(VsVers::Vs17) => "Visual Studio 17 2022",
- Ok(VsVers::Vs16) => "Visual Studio 16 2019",
- Ok(VsVers::Vs15) => "Visual Studio 15 2017",
- Ok(VsVers::Vs14) => "Visual Studio 14 2015",
- // This was deprecated recently (2024-07). Ignore the warning for now.
- #[allow(deprecated)]
- Ok(VsVers::Vs12) => "Visual Studio 12 2013",
- Ok(_) => panic!(
- "Visual studio version detected but this crate \
- doesn't know how to generate cmake files for it, \
- can the `cmake` crate be updated?"
- ),
- Err(msg) => panic!("{}", msg),
- };
- if ["i686", "x86_64", "thumbv7a", "aarch64"]
- .iter()
- .any(|t| target.contains(t))
- {
- base.to_string()
- } else {
- panic!("unsupported msvc target: {}", target);
- }
- }
-
- fn defined(&self, var: &str) -> bool {
- self.defines.iter().any(|(a, _)| a == var)
- }
-
- // If a cmake project has previously been built (e.g. CMakeCache.txt already
- // exists), then cmake will choke if the source directory for the original
- // project being built has changed. Detect this situation through the
- // `CMAKE_HOME_DIRECTORY` variable that cmake emits and if it doesn't match
- // we blow away the build directory and start from scratch (the recommended
- // solution apparently [1]).
- //
- // [1]: https://cmake.org/pipermail/cmake/2012-August/051545.html
- fn maybe_clear(&self, dir: &Path) {
- // CMake will apparently store canonicalized paths which normally
- // isn't relevant to us but we canonicalize it here to ensure
- // we're both checking the same thing.
- let path = fs::canonicalize(&self.path).unwrap_or_else(|_| self.path.clone());
- let mut f = match File::open(dir.join("CMakeCache.txt")) {
- Ok(f) => f,
- Err(..) => return,
- };
- let mut u8contents = Vec::new();
- match f.read_to_end(&mut u8contents) {
- Ok(f) => f,
- Err(..) => return,
- };
- let contents = String::from_utf8_lossy(&u8contents);
- drop(f);
- for line in contents.lines() {
- if line.starts_with("CMAKE_HOME_DIRECTORY") {
- let needs_cleanup = match line.split('=').next_back() {
- Some(cmake_home) => fs::canonicalize(cmake_home)
- .ok()
- .map(|cmake_home| cmake_home != path)
- .unwrap_or(true),
- None => true,
- };
- if needs_cleanup {
- println!(
- "detected home dir change, cleaning out entire build \
- directory"
- );
- fs::remove_dir_all(dir).unwrap();
- }
- break;
- }
- }
- }
-}
-
-#[derive(Debug, PartialEq, Eq, PartialOrd, Ord)]
-struct Version {
- major: u32,
- minor: u32,
-}
-
-impl Version {
- fn new(major: u32, minor: u32) -> Self {
- Self { major, minor }
- }
-
- fn parse(s: &str) -> Option<Self> {
- // As of 3.22, the format of the version output is "cmake version <major>.<minor>.<patch>".
- // ```
- // $ cmake --version
- // cmake version 3.22.2
- //
- // CMake suite maintained and supported by Kitware (kitware.com/cmake).
- // ```
- let version = s.lines().next()?.strip_prefix("cmake version ")?;
- let mut digits = version.splitn(3, '.'); // split version string to major minor patch
- let major = digits.next()?.parse::<u32>().ok()?;
- let minor = digits.next()?.parse::<u32>().ok()?;
- // Ignore the patch version because it does not change the API.
- Some(Version::new(major, minor))
- }
-
- fn from_command(executable: &OsStr) -> Option<Self> {
- let output = Command::new(executable).arg("--version").output().ok()?;
- if !output.status.success() {
- return None;
- }
- let stdout = core::str::from_utf8(&output.stdout).ok()?;
- Self::parse(stdout)
- }
-}
-
-impl Default for Version {
- fn default() -> Self {
- // If the version parsing fails, we assume that it is the latest known
- // version. This is because the failure of version parsing may be due to
- // the version output being changed.
- Self::new(3, 22)
- }
-}
-
-fn run(cmd: &mut Command, program: &str) {
- println!("running: {:?}", cmd);
- let status = match cmd.status() {
- Ok(status) => status,
- Err(ref e) if e.kind() == ErrorKind::NotFound => {
- fail(&format!(
- "failed to execute command: {}\nis `{}` not installed?",
- e, program
- ));
- }
- Err(e) => fail(&format!("failed to execute command: {}", e)),
- };
- if !status.success() {
- if status.code() == Some(127) {
- fail(&format!(
- "command did not execute successfully, got: {}, is `{}` not installed?",
- status, program
- ));
- }
- fail(&format!(
- "command did not execute successfully, got: {}",
- status
- ));
- }
-}
-
-fn find_exe(path: &Path) -> PathBuf {
- env::split_paths(&env::var_os("PATH").unwrap_or_default())
- .map(|p| p.join(path))
- .find(|p| fs::metadata(p).is_ok())
- .unwrap_or_else(|| path.to_owned())
-}
-
-fn getenv_unwrap(v: &str) -> String {
- match env::var(v) {
- Ok(s) => s,
- Err(..) => fail(&format!("environment variable `{}` not defined", v)),
- }
-}
-
-fn fail(s: &str) -> ! {
- panic!("\n{}\n\nbuild script failed, must exit now", s)
-}
-
-/// Returns whether the given MAKEFLAGS indicate that there is an available
-/// jobserver that uses a named pipe (fifo)
-fn uses_named_pipe_jobserver(makeflags: &OsStr) -> bool {
- makeflags
- .to_string_lossy()
- // auth option as defined in
- // https://www.gnu.org/software/make/manual/html_node/POSIX-Jobserver.html#POSIX-Jobserver
- .contains("--jobserver-auth=fifo:")
-}
-
-#[cfg(test)]
-mod tests {
- use super::uses_named_pipe_jobserver;
- use super::Version;
-
- #[test]
- fn test_cmake_version() {
- let text = "cmake version 3.22.2
-
-CMake suite maintained and supported by Kitware (kitware.com/cmake).
-";
- let v = Version::parse(text).unwrap();
- assert_eq!(v, Version::new(3, 22));
- assert!(Version::new(3, 22) > Version::new(3, 21));
- assert!(Version::new(3, 22) < Version::new(3, 23));
-
- let _v = Version::from_command("cmake".as_ref()).unwrap();
- }
-
- #[test]
- fn test_uses_fifo_jobserver() {
- assert!(uses_named_pipe_jobserver(
- "-j --jobserver-auth=fifo:/foo".as_ref()
- ));
- assert!(!uses_named_pipe_jobserver(
- "-j --jobserver-auth=8:9".as_ref()
- ));
- }
-}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.