| 1 | //! A build dependency for Cargo libraries to find libraries in a |
| 2 | //! [Vcpkg](https://github.com/Microsoft/vcpkg) tree. From a Vcpkg package name |
| 3 | //! this build helper will emit cargo metadata to link it and it's dependencies |
| 4 | //! (excluding system libraries, which it cannot derive). |
| 5 | //! |
| 6 | //! **Note:** You must set one of `RUSTFLAGS=-Ctarget-feature=+crt-static` or |
| 7 | //! `VCPKGRS_DYNAMIC=1` in your environment or the vcpkg-rs helper |
| 8 | //! will not find any libraries. If `VCPKGRS_DYNAMIC` is set, `cargo install` will |
| 9 | //! generate dynamically linked binaries, in which case you will have to arrange for |
| 10 | //! dlls from your Vcpkg installation to be available in your path. |
| 11 | //! |
| 12 | //! The simplest possible usage looks like this :- |
| 13 | //! |
| 14 | //! ```rust,no_run |
| 15 | //! vcpkg::find_package("libssh2").unwrap(); |
| 16 | //! ``` |
| 17 | //! |
| 18 | //! The cargo metadata that is emitted can be changed like this :- |
| 19 | //! |
| 20 | //! ```rust,no_run |
| 21 | //! vcpkg::Config::new() |
| 22 | //! .emit_includes(true) |
| 23 | //! .find_package("zlib").unwrap(); |
| 24 | //! ``` |
| 25 | //! |
| 26 | //! If the search was successful all appropriate Cargo metadata will be printed |
| 27 | //! to stdout. |
| 28 | //! |
| 29 | //! The decision to choose static variants of libraries is driven by adding |
| 30 | //! `RUSTFLAGS=-Ctarget-feature=+crt-static` to the environment. This requires |
| 31 | //! at least Rust 1.19. |
| 32 | //! |
| 33 | //! A number of environment variables are available to globally configure which |
| 34 | //! libraries are selected. |
| 35 | //! |
| 36 | //! * `VCPKG_ROOT` - Set the directory to look in for a vcpkg installation. If |
| 37 | //! it is not set, vcpkg will use the user-wide installation if one has been |
| 38 | //! set up with `vcpkg integrate install` |
| 39 | //! |
| 40 | //! * `VCPKGRS_NO_FOO` - if set, vcpkg-rs will not attempt to find the |
| 41 | //! library named `foo`. |
| 42 | //! |
| 43 | //! * `VCPKGRS_DISABLE` - if set, vcpkg-rs will not attempt to find any libraries. |
| 44 | //! |
| 45 | //! * `VCPKGRS_DYNAMIC` - if set, vcpkg-rs will link to DLL builds of ports. |
| 46 | //! |
| 47 | //! There is a companion crate `vcpkg_cli` that allows testing of environment |
| 48 | //! and flag combinations. |
| 49 | //! |
| 50 | //! ```Batchfile |
| 51 | //! C:\src> vcpkg_cli probe -l static mysqlclient |
| 52 | //! Found library mysqlclient |
| 53 | //! Include paths: |
| 54 | //! C:\src\[..]\vcpkg\installed\x64-windows-static\include |
| 55 | //! Library paths: |
| 56 | //! C:\src\[..]\vcpkg\installed\x64-windows-static\lib |
| 57 | //! Cargo metadata: |
| 58 | //! cargo:rustc-link-search=native=C:\src\[..]\vcpkg\installed\x64-windows-static\lib |
| 59 | //! cargo:rustc-link-lib=static=mysqlclient |
| 60 | //! ``` |
| 61 | |
| 62 | // The CI will test vcpkg-rs on 1.10 because at this point rust-openssl's |
| 63 | // openssl-sys is backward compatible that far. (Actually, the oldest release |
| 64 | // crate openssl version 0.10 seems to build against is now Rust 1.24.1?) |
| 65 | #![allow(deprecated)] |
| 66 | |
| 67 | #[cfg(test)] |
| 68 | #[macro_use] |
| 69 | extern crate lazy_staticrust-analyzer cargo vcpkg 0.2.8 lazy_static/; |
| 70 | |
| 71 | #[allow(unused_imports)] |
| 72 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::asciirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ascii/::AsciiExtrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ascii/AsciiExt#; |
| 73 | |
| 74 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#; |
| 75 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/; |
| 76 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/; |
| 77 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#; |
| 78 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/; |
| 79 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::{selfrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/, Filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/File#}; |
| 80 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::{BufReadrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/BufRead#, BufReaderrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/BufReader#}; |
| 81 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::{Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#, PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#}; |
| 82 | |
| 83 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 84 | pub struct Configrust-analyzer cargo vcpkg 0.2.8 Config# { |
| 85 | /// should the cargo metadata actually be emitted |
| 86 | cargo_metadatarust-analyzer cargo vcpkg 0.2.8 Config#cargo_metadata.: bool, |
| 87 | |
| 88 | /// should cargo:include= metadata be emitted (defaults to false) |
| 89 | emit_includesrust-analyzer cargo vcpkg 0.2.8 Config#emit_includes.: bool, |
| 90 | |
| 91 | /// .lib/.a files that must be be found for probing to be considered successful |
| 92 | required_libsrust-analyzer cargo vcpkg 0.2.8 Config#required_libs.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 93 | |
| 94 | /// .dlls that must be be found for probing to be considered successful |
| 95 | required_dllsrust-analyzer cargo vcpkg 0.2.8 Config#required_dlls.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 96 | |
| 97 | /// should DLLs be copies to OUT_DIR? |
| 98 | copy_dllsrust-analyzer cargo vcpkg 0.2.8 Config#copy_dlls.: bool, |
| 99 | |
| 100 | /// override VCPKG_ROOT environment variable |
| 101 | vcpkg_rootrust-analyzer cargo vcpkg 0.2.8 Config#vcpkg_root.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#>, |
| 102 | } |
| 103 | |
| 104 | /// Details of a package that was found |
| 105 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 106 | pub struct Libraryrust-analyzer cargo vcpkg 0.2.8 Library# { |
| 107 | /// Paths for the linker to search for static or import libraries |
| 108 | pub link_pathsrust-analyzer cargo vcpkg 0.2.8 Library#link_paths.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#>, |
| 109 | |
| 110 | /// Paths to search at runtme to find DLLs |
| 111 | pub dll_pathsrust-analyzer cargo vcpkg 0.2.8 Library#dll_paths.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#>, |
| 112 | |
| 113 | /// Paths to search for |
| 114 | pub include_pathsrust-analyzer cargo vcpkg 0.2.8 Library#include_paths.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#>, |
| 115 | |
| 116 | /// cargo: metadata lines |
| 117 | pub cargo_metadatarust-analyzer cargo vcpkg 0.2.8 Library#cargo_metadata.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 118 | |
| 119 | /// libraries found are static |
| 120 | pub is_staticrust-analyzer cargo vcpkg 0.2.8 Library#is_static.: bool, |
| 121 | |
| 122 | /// DLLs found |
| 123 | pub found_dllsrust-analyzer cargo vcpkg 0.2.8 Library#found_dlls.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#>, |
| 124 | |
| 125 | /// static libs or import libs found |
| 126 | pub found_libsrust-analyzer cargo vcpkg 0.2.8 Library#found_libs.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#>, |
| 127 | |
| 128 | /// link name of libraries found, this is useful to emit linker commands |
| 129 | pub found_namesrust-analyzer cargo vcpkg 0.2.8 Library#found_names.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 130 | |
| 131 | /// ports that are providing the libraries to link to, in port link order |
| 132 | pub portsrust-analyzer cargo vcpkg 0.2.8 Library#ports.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 133 | } |
| 134 | |
| 135 | enum MSVCTargetrust-analyzer cargo vcpkg 0.2.8 MSVCTarget# { |
| 136 | X86Windowsrust-analyzer cargo vcpkg 0.2.8 MSVCTarget#X86Windows#, |
| 137 | X64Windowsrust-analyzer cargo vcpkg 0.2.8 MSVCTarget#X64Windows#, |
| 138 | X64Linuxrust-analyzer cargo vcpkg 0.2.8 MSVCTarget#X64Linux#, |
| 139 | X64MacOSrust-analyzer cargo vcpkg 0.2.8 MSVCTarget#X64MacOS#, |
| 140 | } |
| 141 | |
| 142 | impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for MSVCTargetrust-analyzer cargo vcpkg 0.2.8 MSVCTarget# { |
| 143 | fn fmtrust-analyzer cargo vcpkg 0.2.8 impl#[MSVCTarget][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 144 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 145 | MSVCTargetrust-analyzer cargo vcpkg 0.2.8 MSVCTarget#::X86Windowsrust-analyzer cargo vcpkg 0.2.8 MSVCTarget#X86Windows# => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "x86-windows"), |
| 146 | MSVCTargetrust-analyzer cargo vcpkg 0.2.8 MSVCTarget#::X64Windowsrust-analyzer cargo vcpkg 0.2.8 MSVCTarget#X64Windows# => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "x64-windows"), |
| 147 | MSVCTargetrust-analyzer cargo vcpkg 0.2.8 MSVCTarget#::X64Linuxrust-analyzer cargo vcpkg 0.2.8 MSVCTarget#X64Linux# => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "x64-linux"), |
| 148 | MSVCTargetrust-analyzer cargo vcpkg 0.2.8 MSVCTarget#::X64MacOSrust-analyzer cargo vcpkg 0.2.8 MSVCTarget#X64MacOS# => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "x64-osx"), |
| 149 | } |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] // need Display? |
| 154 | pub enum Errorrust-analyzer cargo vcpkg 0.2.8 Error# { |
| 155 | /// Aborted because of a `VCPKGRS_NO_*` environment variable. |
| 156 | /// |
| 157 | /// Contains the name of the responsible environment variable. |
| 158 | DisabledByEnvrust-analyzer cargo vcpkg 0.2.8 Error#DisabledByEnv#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 159 | |
| 160 | /// Aborted because a required environment variable was not set. |
| 161 | RequiredEnvMissingrust-analyzer cargo vcpkg 0.2.8 Error#RequiredEnvMissing#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 162 | |
| 163 | /// On Windows, only MSVC ABI is supported |
| 164 | NotMSVCrust-analyzer cargo vcpkg 0.2.8 Error#NotMSVC#, |
| 165 | |
| 166 | /// Can't find a vcpkg tree |
| 167 | VcpkgNotFoundrust-analyzer cargo vcpkg 0.2.8 Error#VcpkgNotFound#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 168 | |
| 169 | /// Library not found in vcpkg tree |
| 170 | LibNotFoundrust-analyzer cargo vcpkg 0.2.8 Error#LibNotFound#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 171 | |
| 172 | /// Could not understand vcpkg installation |
| 173 | VcpkgInstallationrust-analyzer cargo vcpkg 0.2.8 Error#VcpkgInstallation#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 174 | |
| 175 | #[doc(hidden)] |
| 176 | __Nonexhaustiverust-analyzer cargo vcpkg 0.2.8 Error#__Nonexhaustive#, |
| 177 | } |
| 178 | |
| 179 | impl errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# for Errorrust-analyzer cargo vcpkg 0.2.8 Error# { |
| 180 | fn descriptionrust-analyzer cargo vcpkg 0.2.8 impl#[Error][Error]description().(&self) -> &str { |
| 181 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 182 | Errorrust-analyzer cargo vcpkg 0.2.8 Error#::DisabledByEnvrust-analyzer cargo vcpkg 0.2.8 Error#DisabledByEnv#(_) => "vcpkg-rs requested to be aborted", |
| 183 | Errorrust-analyzer cargo vcpkg 0.2.8 Error#::RequiredEnvMissingrust-analyzer cargo vcpkg 0.2.8 Error#RequiredEnvMissing#(_) => "a required env setting is missing", |
| 184 | Errorrust-analyzer cargo vcpkg 0.2.8 Error#::NotMSVCrust-analyzer cargo vcpkg 0.2.8 Error#NotMSVC# => "vcpkg-rs only can only find libraries for MSVC ABI 64 bit builds", |
| 185 | Errorrust-analyzer cargo vcpkg 0.2.8 Error#::VcpkgNotFoundrust-analyzer cargo vcpkg 0.2.8 Error#VcpkgNotFound#(_) => "could not find Vcpkg tree", |
| 186 | Errorrust-analyzer cargo vcpkg 0.2.8 Error#::LibNotFoundrust-analyzer cargo vcpkg 0.2.8 Error#LibNotFound#(_) => "could not find library in Vcpkg tree", |
| 187 | Errorrust-analyzer cargo vcpkg 0.2.8 Error#::VcpkgInstallationrust-analyzer cargo vcpkg 0.2.8 Error#VcpkgInstallation#(_) => "could not look up details of packages in vcpkg tree", |
| 188 | Errorrust-analyzer cargo vcpkg 0.2.8 Error#::__Nonexhaustiverust-analyzer cargo vcpkg 0.2.8 Error#__Nonexhaustive# => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!(), |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | fn causerust-analyzer cargo vcpkg 0.2.8 impl#[Error][Error]cause().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#> { |
| 193 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 194 | // Error::Command { ref cause, .. } => Some(cause), |
| 195 | _ => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 196 | } |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for Errorrust-analyzer cargo vcpkg 0.2.8 Error# { |
| 201 | fn fmtrust-analyzer cargo vcpkg 0.2.8 impl#[Error][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Error#> { |
| 202 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 203 | Errorrust-analyzer cargo vcpkg 0.2.8 Error#::DisabledByEnvrust-analyzer cargo vcpkg 0.2.8 Error#DisabledByEnv#(ref name) => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "Aborted because {} is set", name), |
| 204 | Errorrust-analyzer cargo vcpkg 0.2.8 Error#::RequiredEnvMissingrust-analyzer cargo vcpkg 0.2.8 Error#RequiredEnvMissing#(ref name) => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "Aborted because {} is not set", name), |
| 205 | Errorrust-analyzer cargo vcpkg 0.2.8 Error#::NotMSVCrust-analyzer cargo vcpkg 0.2.8 Error#NotMSVC# => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!( |
| 206 | f, |
| 207 | "the vcpkg-rs Vcpkg build helper can only find libraries built for the MSVC ABI." |
| 208 | ), |
| 209 | Errorrust-analyzer cargo vcpkg 0.2.8 Error#::VcpkgNotFoundrust-analyzer cargo vcpkg 0.2.8 Error#VcpkgNotFound#(ref detail) => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "Could not find Vcpkg tree: {}", detail), |
| 210 | Errorrust-analyzer cargo vcpkg 0.2.8 Error#::LibNotFoundrust-analyzer cargo vcpkg 0.2.8 Error#LibNotFound#(ref detail) => { |
| 211 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "Could not find library in Vcpkg tree {}", detail) |
| 212 | } |
| 213 | Errorrust-analyzer cargo vcpkg 0.2.8 Error#::VcpkgInstallationrust-analyzer cargo vcpkg 0.2.8 Error#VcpkgInstallation#(ref detail) => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!( |
| 214 | f, |
| 215 | "Could not look up details of packages in vcpkg tree {}", |
| 216 | detail |
| 217 | ), |
| 218 | Errorrust-analyzer cargo vcpkg 0.2.8 Error#::__Nonexhaustiverust-analyzer cargo vcpkg 0.2.8 Error#__Nonexhaustive# => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!(), |
| 219 | } |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | /// Deprecated in favor of the find_package function |
| 224 | #[doc(hidden)] |
| 225 | pub fn probe_packagerust-analyzer cargo vcpkg 0.2.8 probe_package().(name: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Libraryrust-analyzer cargo vcpkg 0.2.8 Library#, Errorrust-analyzer cargo vcpkg 0.2.8 Error#> { |
| 226 | Configrust-analyzer cargo vcpkg 0.2.8 Config#::newrust-analyzer cargo vcpkg 0.2.8 impl#[Config]new().().proberust-analyzer cargo vcpkg 0.2.8 impl#[Config]probe().(name) |
| 227 | } |
| 228 | |
| 229 | /// Find the package `package` in a Vcpkg tree. |
| 230 | /// |
| 231 | /// Emits cargo metadata to link to libraries provided by the Vcpkg package/port |
| 232 | /// named, and any (non-system) libraries that they depend on. |
| 233 | /// |
| 234 | /// This will select the architecture and linkage based on environment |
| 235 | /// variables and build flags as described in the module docs. |
| 236 | pub fn find_packagerust-analyzer cargo vcpkg 0.2.8 find_package().(package: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Libraryrust-analyzer cargo vcpkg 0.2.8 Library#, Errorrust-analyzer cargo vcpkg 0.2.8 Error#> { |
| 237 | Configrust-analyzer cargo vcpkg 0.2.8 Config#::newrust-analyzer cargo vcpkg 0.2.8 impl#[Config]new().().find_packagerust-analyzer cargo vcpkg 0.2.8 impl#[Config]find_package().(package) |
| 238 | } |
| 239 | |
| 240 | fn find_vcpkg_rootrust-analyzer cargo vcpkg 0.2.8 find_vcpkg_root().(cfg: &Configrust-analyzer cargo vcpkg 0.2.8 Config#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#, Errorrust-analyzer cargo vcpkg 0.2.8 Error#> { |
| 241 | // prefer the setting from the use if there is one |
| 242 | if let &Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ref path) = &cfg.vcpkg_rootrust-analyzer cargo vcpkg 0.2.8 Config#vcpkg_root. { |
| 243 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(path.clonerust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][Clone]clone().()); |
| 244 | } |
| 245 | |
| 246 | // otherwise, use the setting from the environment |
| 247 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(path) = envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::var_osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var_os().("VCPKG_ROOT") { |
| 248 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<OsString>`]from().(path)); |
| 249 | } |
| 250 | |
| 251 | // see if there is a per-user vcpkg tree that has been integrated into msbuild |
| 252 | // using `vcpkg integrate install` |
| 253 | let local_app_data = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var().("LOCALAPPDATA").map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| Errorrust-analyzer cargo vcpkg 0.2.8 Error#::VcpkgNotFoundrust-analyzer cargo vcpkg 0.2.8 Error#VcpkgNotFound#( |
| 254 | "Failed to read either VCPKG_ROOT or LOCALAPPDATA environment variables".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().() |
| 255 | ))); // not present or can't utf8 |
| 256 | let vcpkg_user_targets_path = Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().(local_app_data.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()) |
| 257 | .joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("vcpkg") |
| 258 | .joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("vcpkg.user.targets"); |
| 259 | |
| 260 | let file = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(Filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/File#::openrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[File]open().(vcpkg_user_targets_path.clonerust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][Clone]clone().()).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| { |
| 261 | Errorrust-analyzer cargo vcpkg 0.2.8 Error#::VcpkgNotFoundrust-analyzer cargo vcpkg 0.2.8 Error#VcpkgNotFound#( |
| 262 | "No vcpkg.user.targets found. Set the VCPKG_ROOT environment \ |
| 263 | variable or run 'vcpkg integrate install'" |
| 264 | .to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), |
| 265 | ) |
| 266 | })); |
| 267 | let file = BufReaderrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/BufReader#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`]new().(&file); |
| 268 | |
| 269 | for line in file.linesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/BufRead#lines().() { |
| 270 | let line = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(line.map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| Errorrust-analyzer cargo vcpkg 0.2.8 Error#::VcpkgNotFoundrust-analyzer cargo vcpkg 0.2.8 Error#VcpkgNotFound#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 271 | "Parsing of {} failed.", |
| 272 | vcpkg_user_targets_path.to_string_lossyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_string_lossy().().to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[T][ToOwned]to_owned().() |
| 273 | )))); |
| 274 | let mut split = line.splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split().("Project=\""); |
| 275 | split.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Split<'a, P>`][Iterator]next().(); // eat anything before Project=" |
| 276 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(found) = split.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Split<'a, P>`][Iterator]next().() { |
| 277 | // " is illegal in a Windows pathname |
| 278 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(found) = found.split_terminatorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split_terminator().('"').nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`SplitTerminator<'a, P>`][Iterator]next().() { |
| 279 | let mut vcpkg_root = PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<&T>`]from().(found); |
| 280 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().(vcpkg_root.poprust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]pop().() && vcpkg_root.poprust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]pop().() && vcpkg_root.poprust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]pop().() && vcpkg_root.poprust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]pop().()) { |
| 281 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo vcpkg 0.2.8 Error#::VcpkgNotFoundrust-analyzer cargo vcpkg 0.2.8 Error#VcpkgNotFound#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 282 | "Could not find vcpkg root above {}", |
| 283 | found |
| 284 | ))); |
| 285 | } |
| 286 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(vcpkg_root); |
| 287 | } |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo vcpkg 0.2.8 Error#::VcpkgNotFoundrust-analyzer cargo vcpkg 0.2.8 Error#VcpkgNotFound#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 292 | "Project location not found parsing {}.", |
| 293 | vcpkg_user_targets_path.to_string_lossyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_string_lossy().().to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[T][ToOwned]to_owned().() |
| 294 | ))) |
| 295 | } |
| 296 | |
| 297 | fn validate_vcpkg_rootrust-analyzer cargo vcpkg 0.2.8 validate_vcpkg_root().(path: &PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo vcpkg 0.2.8 Error#> { |
| 298 | let mut vcpkg_root_path = path.clonerust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][Clone]clone().(); |
| 299 | vcpkg_root_path.pushrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]push().(".vcpkg-root"); |
| 300 | |
| 301 | if vcpkg_root_path.existsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]exists().() { |
| 302 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 303 | } else { |
| 304 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo vcpkg 0.2.8 Error#::VcpkgNotFoundrust-analyzer cargo vcpkg 0.2.8 Error#VcpkgNotFound#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 305 | "Could not find Vcpkg root at {}", |
| 306 | vcpkg_root_path.to_string_lossyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_string_lossy().() |
| 307 | ))) |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | fn find_vcpkg_targetrust-analyzer cargo vcpkg 0.2.8 find_vcpkg_target().(cfg: &Configrust-analyzer cargo vcpkg 0.2.8 Config#, msvc_target: &MSVCTargetrust-analyzer cargo vcpkg 0.2.8 MSVCTarget#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<VcpkgTargetrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#, Errorrust-analyzer cargo vcpkg 0.2.8 Error#> { |
| 312 | let vcpkg_root = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(find_vcpkg_rootrust-analyzer cargo vcpkg 0.2.8 find_vcpkg_root().(&cfg)); |
| 313 | tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(validate_vcpkg_rootrust-analyzer cargo vcpkg 0.2.8 validate_vcpkg_root().(&vcpkg_root)); |
| 314 | |
| 315 | let (static_lib, static_appendage, lib_suffix, strip_lib_prefix) = match msvc_target { |
| 316 | &MSVCTargetrust-analyzer cargo vcpkg 0.2.8 MSVCTarget#::X64Windowsrust-analyzer cargo vcpkg 0.2.8 MSVCTarget#X64Windows# | &MSVCTargetrust-analyzer cargo vcpkg 0.2.8 MSVCTarget#::X86Windowsrust-analyzer cargo vcpkg 0.2.8 MSVCTarget#X86Windows# => { |
| 317 | let static_lib = envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var().("CARGO_CFG_TARGET_FEATURE") |
| 318 | .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().()) // rustc 1.10 |
| 319 | .containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().("crt-static"); |
| 320 | let static_appendage = if static_lib { "-static" } else { "" }; |
| 321 | (static_lib, static_appendage, "lib", false) |
| 322 | } |
| 323 | _ => (true, "", "a", true), |
| 324 | }; |
| 325 | |
| 326 | let mut base = vcpkg_root; |
| 327 | base.pushrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]push().("installed"); |
| 328 | let status_path = base.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("vcpkg"); |
| 329 | |
| 330 | let vcpkg_triple = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}{}", msvc_target.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), static_appendage); |
| 331 | base.pushrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]push().(&vcpkg_triple); |
| 332 | |
| 333 | let lib_path = base.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("lib"); |
| 334 | let bin_path = base.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("bin"); |
| 335 | let include_path = base.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("include"); |
| 336 | |
| 337 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(VcpkgTargetrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget# { |
| 338 | vcpkg_triplerust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#vcpkg_triple.: vcpkg_triple, |
| 339 | lib_pathrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#lib_path.: lib_path, |
| 340 | bin_pathrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#bin_path.: bin_path, |
| 341 | include_pathrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#include_path.: include_path, |
| 342 | is_staticrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#is_static.: static_lib, |
| 343 | status_pathrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#status_path.: status_path, |
| 344 | lib_suffixrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#lib_suffix.: lib_suffix.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), |
| 345 | strip_lib_prefixrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#strip_lib_prefix.: strip_lib_prefix, |
| 346 | }) |
| 347 | } |
| 348 | |
| 349 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 350 | struct Portrust-analyzer cargo vcpkg 0.2.8 Port# { |
| 351 | // dlls if any |
| 352 | dllsrust-analyzer cargo vcpkg 0.2.8 Port#dlls.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 353 | |
| 354 | // libs (static or import) |
| 355 | libsrust-analyzer cargo vcpkg 0.2.8 Port#libs.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 356 | |
| 357 | // ports that this port depends on |
| 358 | depsrust-analyzer cargo vcpkg 0.2.8 Port#deps.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 359 | } |
| 360 | |
| 361 | fn load_port_manifestrust-analyzer cargo vcpkg 0.2.8 load_port_manifest().( |
| 362 | path: &PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#, |
| 363 | port: &str, |
| 364 | version: &str, |
| 365 | vcpkg_target: &VcpkgTargetrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#, |
| 366 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>), Errorrust-analyzer cargo vcpkg 0.2.8 Error#> { |
| 367 | let manifest_file = path.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("info").joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 368 | "{}_{}_{}.list", |
| 369 | port, version, vcpkg_target.vcpkg_triplerust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#vcpkg_triple. |
| 370 | )); |
| 371 | |
| 372 | let mut dlls = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 373 | let mut libs = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 374 | |
| 375 | let f = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!( |
| 376 | Filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/File#::openrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[File]open().(&manifest_file).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| Errorrust-analyzer cargo vcpkg 0.2.8 Error#::VcpkgInstallationrust-analyzer cargo vcpkg 0.2.8 Error#VcpkgInstallation#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 377 | "Could not open port manifest file {}", |
| 378 | manifest_file.displayrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]display().() |
| 379 | ))) |
| 380 | ); |
| 381 | |
| 382 | let file = BufReaderrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/BufReader#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`]new().(&f); |
| 383 | |
| 384 | let dll_prefix = Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().(&vcpkg_target.vcpkg_triplerust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#vcpkg_triple.).joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("bin"); |
| 385 | let lib_prefix = Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().(&vcpkg_target.vcpkg_triplerust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#vcpkg_triple.).joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("lib"); |
| 386 | |
| 387 | for line in file.linesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/BufRead#lines().() { |
| 388 | let line = line.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 389 | |
| 390 | let file_path = Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().(&line); |
| 391 | |
| 392 | if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(dll) = file_path.strip_prefixrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]strip_prefix().(&dll_prefix) { |
| 393 | if dll.extensionrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]extension().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("dll")) |
| 394 | && dll.componentsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]components().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>().lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().1 |
| 395 | { |
| 396 | // match "mylib.dll" but not "debug/mylib.dll" or "manual_link/mylib.dll" |
| 397 | |
| 398 | dll.to_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_str().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|s| dlls.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(s.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().())); |
| 399 | } |
| 400 | } else if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(lib) = file_path.strip_prefixrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]strip_prefix().(&lib_prefix) { |
| 401 | if lib.extensionrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]extension().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().(&vcpkg_target.lib_suffixrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#lib_suffix.)) |
| 402 | && lib.componentsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]components().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>().lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().1 |
| 403 | { |
| 404 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(lib) = vcpkg_target.link_name_for_librust-analyzer cargo vcpkg 0.2.8 impl#[VcpkgTarget]link_name_for_lib().(lib) { |
| 405 | libs.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(lib); |
| 406 | } |
| 407 | } |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((dlls, libs)) |
| 412 | } |
| 413 | |
| 414 | // load ports from the status file or one of the incremental updates |
| 415 | fn load_port_filerust-analyzer cargo vcpkg 0.2.8 load_port_file().( |
| 416 | filename: &PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#, |
| 417 | port_info: &mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>>, |
| 418 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo vcpkg 0.2.8 Error#> { |
| 419 | let f = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!( |
| 420 | Filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/File#::openrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[File]open().(&filename).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| Errorrust-analyzer cargo vcpkg 0.2.8 Error#::VcpkgInstallationrust-analyzer cargo vcpkg 0.2.8 Error#VcpkgInstallation#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 421 | "Could not open status file at {}: {}", |
| 422 | filename.displayrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]display().(), |
| 423 | e |
| 424 | ))) |
| 425 | ); |
| 426 | let file = BufReaderrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/BufReader#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`]new().(&f); |
| 427 | let mut current: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> = BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V>`]new().(); |
| 428 | for line in file.linesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/BufRead#lines().() { |
| 429 | let line = line.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 430 | let parts = line.splitnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]splitn().(2, ": ").clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`SplitN<'a, P>`][Clone]clone().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(); |
| 431 | if parts.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().2 { |
| 432 | // a key: value line |
| 433 | current.insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]insert().(parts[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..trimrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), parts[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..trimrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()); |
| 434 | } else if line.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 { |
| 435 | // end of section |
| 436 | port_info.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(current.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`][Clone]clone().()); |
| 437 | current.clearrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]clear().(); |
| 438 | } else { |
| 439 | // ignore all extension lines of the form |
| 440 | // |
| 441 | // Description: a package with a |
| 442 | // very long description |
| 443 | // |
| 444 | // the description key is not used so this is harmless but |
| 445 | // this will eat extension lines for any multiline key which |
| 446 | // could become an issue in future |
| 447 | } |
| 448 | } |
| 449 | |
| 450 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().current.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]is_empty().() { |
| 451 | port_info.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(current); |
| 452 | } |
| 453 | |
| 454 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 455 | } |
| 456 | |
| 457 | fn load_portsrust-analyzer cargo vcpkg 0.2.8 load_ports().(target: &VcpkgTargetrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Portrust-analyzer cargo vcpkg 0.2.8 Port#>, Errorrust-analyzer cargo vcpkg 0.2.8 Error#> { |
| 458 | let mut ports: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Portrust-analyzer cargo vcpkg 0.2.8 Port#> = BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V>`]new().(); |
| 459 | |
| 460 | let mut port_info: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>> = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 461 | |
| 462 | // load the main status file. It is not an error if this file does not |
| 463 | // exist. If the only command that has been run in a Vcpkg installation |
| 464 | // is a single `vcpkg install package` then there will likely be no |
| 465 | // status file, only incremental updates. This is the typical case when |
| 466 | // running in a CI environment. |
| 467 | let status_filename = target.status_pathrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#status_path..joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("status"); |
| 468 | load_port_filerust-analyzer cargo vcpkg 0.2.8 load_port_file().(&status_filename, &mut port_info).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().(); |
| 469 | |
| 470 | // load updates to the status file that have yet to be normalized |
| 471 | let status_update_dir = target.status_pathrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#status_path..joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("updates"); |
| 472 | |
| 473 | let paths = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!( |
| 474 | fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::read_dirrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/read_dir().(status_update_dir).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| Errorrust-analyzer cargo vcpkg 0.2.8 Error#::VcpkgInstallationrust-analyzer cargo vcpkg 0.2.8 Error#VcpkgInstallation#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 475 | "could not read status file updates dir: {}", |
| 476 | e |
| 477 | ))) |
| 478 | ); |
| 479 | |
| 480 | // get all of the paths of the update files into a Vec<PathBuf> |
| 481 | let mut paths = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(paths |
| 482 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|rde| rde.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|de| de.pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[DirEntry]path().())) // Result<DirEntry, io::Error> -> Result<PathBuf, io::Error> |
| 483 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>, _>>() // collect into Result<Vec<PathBuf>, io::Error> |
| 484 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| { |
| 485 | Errorrust-analyzer cargo vcpkg 0.2.8 Error#::VcpkgInstallationrust-analyzer cargo vcpkg 0.2.8 Error#VcpkgInstallation#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 486 | "could not read status file update filenames: {}", |
| 487 | e |
| 488 | )) |
| 489 | })); |
| 490 | |
| 491 | // Sort the paths and read them. This could be done directly from the iterator if |
| 492 | // read_dir() guarantees that the files will be read in alpha order but that appears |
| 493 | // to be unspecified as the underlying operating system calls used are unspecified |
| 494 | // https://doc.rust-lang.org/nightly/std/fs/fn.read_dir.html#platform-specific-behavior |
| 495 | paths.sortrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]sort().(); |
| 496 | for path in paths { |
| 497 | // println!("Name: {}", path.display()); |
| 498 | tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(load_port_filerust-analyzer cargo vcpkg 0.2.8 load_port_file().(&path, &mut port_info)); |
| 499 | } |
| 500 | //println!("{:#?}", port_info); |
| 501 | |
| 502 | let mut seen_names = BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V>`]new().(); |
| 503 | for current in &port_info { |
| 504 | // store them by name and arch, clobbering older details |
| 505 | match ( |
| 506 | current.getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get().("Package"), |
| 507 | current.getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get().("Architecture"), |
| 508 | current.getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get().("Feature"), |
| 509 | ) { |
| 510 | (Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(pkg), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(arch), feature) => { |
| 511 | seen_names.insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]insert().((pkg, arch, feature), current); |
| 512 | } |
| 513 | _ => {} |
| 514 | } |
| 515 | } |
| 516 | |
| 517 | for (&(name, arch, feature), current) in &seen_names { |
| 518 | if *rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Deref]deref().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().arch rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[str][`PartialEq<String>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[str][`PartialEq<String>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[str][`PartialEq<String>`]eq().target.vcpkg_triplerust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#vcpkg_triple. { |
| 519 | let mut deps = if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(deps) = current.getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get().("Depends") { |
| 520 | deps.splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split().(", ").maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|x| x.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().() |
| 521 | } else { |
| 522 | Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().() |
| 523 | }; |
| 524 | |
| 525 | if current |
| 526 | .getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get().("Status") |
| 527 | .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(&Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().()) |
| 528 | .ends_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]ends_with().(" installed") |
| 529 | { |
| 530 | match (current.getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get().("Version"), feature) { |
| 531 | (Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(version), _) => { |
| 532 | // this failing here and bailing out causes everything to fail |
| 533 | let lib_info = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(load_port_manifestrust-analyzer cargo vcpkg 0.2.8 load_port_manifest().( |
| 534 | &target.status_pathrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#status_path., |
| 535 | &name, |
| 536 | version, |
| 537 | &target |
| 538 | )); |
| 539 | let port = Portrust-analyzer cargo vcpkg 0.2.8 Port# { |
| 540 | dllsrust-analyzer cargo vcpkg 0.2.8 Port#dlls.: lib_info.0, |
| 541 | libsrust-analyzer cargo vcpkg 0.2.8 Port#libs.: lib_info.1, |
| 542 | depsrust-analyzer cargo vcpkg 0.2.8 Port#deps.: deps, |
| 543 | }; |
| 544 | |
| 545 | ports.insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]insert().(name.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), port); |
| 546 | } |
| 547 | (_, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(_feature)) => match ports.get_mutrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get_mut().(name) { |
| 548 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ref mut port) => { |
| 549 | port.depsrust-analyzer cargo vcpkg 0.2.8 Port#deps..appendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]append().(&mut deps); |
| 550 | } |
| 551 | _ => { |
| 552 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("found a feature that had no corresponding port :-"); |
| 553 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("current {:+?}", current); |
| 554 | continue; |
| 555 | } |
| 556 | }, |
| 557 | (_, _) => { |
| 558 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("didn't know how to deal with status file entry :-"); |
| 559 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{:+?}", current); |
| 560 | continue; |
| 561 | } |
| 562 | } |
| 563 | } |
| 564 | } |
| 565 | } |
| 566 | |
| 567 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ports) |
| 568 | } |
| 569 | |
| 570 | /// paths and triple for the chosen target |
| 571 | struct VcpkgTargetrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget# { |
| 572 | vcpkg_triplerust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#vcpkg_triple.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, |
| 573 | lib_pathrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#lib_path.: PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#, |
| 574 | bin_pathrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#bin_path.: PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#, |
| 575 | include_pathrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#include_path.: PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#, |
| 576 | |
| 577 | // directory containing the status file |
| 578 | status_pathrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#status_path.: PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#, |
| 579 | |
| 580 | is_staticrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#is_static.: bool, |
| 581 | lib_suffixrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#lib_suffix.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, |
| 582 | |
| 583 | /// strip 'lib' from library names in linker args? |
| 584 | strip_lib_prefixrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#strip_lib_prefix.: bool, |
| 585 | } |
| 586 | |
| 587 | impl VcpkgTargetrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget# { |
| 588 | fn link_name_for_librust-analyzer cargo vcpkg 0.2.8 impl#[VcpkgTarget]link_name_for_lib().(&self, filename: &stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> { |
| 589 | if self.strip_lib_prefixrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#strip_lib_prefix. { |
| 590 | filename.to_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_str().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|s| s.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()) |
| 591 | // filename |
| 592 | // .to_str() |
| 593 | // .map(|s| s.trim_left_matches("lib").to_owned()) |
| 594 | } else { |
| 595 | filename.to_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_str().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|s| s.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()) |
| 596 | } |
| 597 | } |
| 598 | } |
| 599 | |
| 600 | impl Configrust-analyzer cargo vcpkg 0.2.8 Config# { |
| 601 | pub fn newrust-analyzer cargo vcpkg 0.2.8 impl#[Config]new().() -> Configrust-analyzer cargo vcpkg 0.2.8 Config# { |
| 602 | Configrust-analyzer cargo vcpkg 0.2.8 Config# { |
| 603 | cargo_metadatarust-analyzer cargo vcpkg 0.2.8 Config#cargo_metadata.: true, |
| 604 | copy_dllsrust-analyzer cargo vcpkg 0.2.8 Config#copy_dlls.: true, |
| 605 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo vcpkg 0.2.8 impl#[Config][Default]default().() |
| 606 | // emit_includes: false, |
| 607 | // required_libs: Vec::new(), |
| 608 | } |
| 609 | } |
| 610 | |
| 611 | /// Override the name of the library to look for if it differs from the package name. |
| 612 | /// |
| 613 | /// This may be called more than once if multiple libs are required. |
| 614 | /// All libs must be found for the probe to succeed. `.probe()` must |
| 615 | /// be run with a different configuration to look for libraries under one of several names. |
| 616 | /// `.libname("ssleay32")` will look for ssleay32.lib and also ssleay32.dll if |
| 617 | /// dynamic linking is selected. |
| 618 | pub fn lib_namerust-analyzer cargo vcpkg 0.2.8 impl#[Config]lib_name().(&mut self, lib_stem: &str) -> &mut Configrust-analyzer cargo vcpkg 0.2.8 Config# { |
| 619 | self.required_libsrust-analyzer cargo vcpkg 0.2.8 Config#required_libs..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(lib_stem.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()); |
| 620 | self.required_dllsrust-analyzer cargo vcpkg 0.2.8 Config#required_dlls..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(lib_stem.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()); |
| 621 | self |
| 622 | } |
| 623 | |
| 624 | /// Override the name of the library to look for if it differs from the package name. |
| 625 | /// |
| 626 | /// This may be called more than once if multiple libs are required. |
| 627 | /// All libs must be found for the probe to succeed. `.probe()` must |
| 628 | /// be run with a different configuration to look for libraries under one of several names. |
| 629 | /// `.lib_names("libcurl_imp","curl")` will look for libcurl_imp.lib and also curl.dll if |
| 630 | /// dynamic linking is selected. |
| 631 | pub fn lib_namesrust-analyzer cargo vcpkg 0.2.8 impl#[Config]lib_names().(&mut self, lib_stem: &str, dll_stem: &str) -> &mut Configrust-analyzer cargo vcpkg 0.2.8 Config# { |
| 632 | self.required_libsrust-analyzer cargo vcpkg 0.2.8 Config#required_libs..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(lib_stem.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()); |
| 633 | self.required_dllsrust-analyzer cargo vcpkg 0.2.8 Config#required_dlls..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(dll_stem.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()); |
| 634 | self |
| 635 | } |
| 636 | |
| 637 | /// Define whether metadata should be emitted for cargo allowing it to |
| 638 | /// automatically link the binary. Defaults to `true`. |
| 639 | pub fn cargo_metadatarust-analyzer cargo vcpkg 0.2.8 impl#[Config]cargo_metadata().(&mut self, cargo_metadata: bool) -> &mut Configrust-analyzer cargo vcpkg 0.2.8 Config# { |
| 640 | self.cargo_metadatarust-analyzer cargo vcpkg 0.2.8 Config#cargo_metadata. = cargo_metadata; |
| 641 | self |
| 642 | } |
| 643 | |
| 644 | /// Define cargo:include= metadata should be emitted. Defaults to `false`. |
| 645 | pub fn emit_includesrust-analyzer cargo vcpkg 0.2.8 impl#[Config]emit_includes().(&mut self, emit_includes: bool) -> &mut Configrust-analyzer cargo vcpkg 0.2.8 Config# { |
| 646 | self.emit_includesrust-analyzer cargo vcpkg 0.2.8 Config#emit_includes. = emit_includes; |
| 647 | self |
| 648 | } |
| 649 | |
| 650 | /// Should DLLs be copied to OUT_DIR? |
| 651 | /// Defaults to `true`. |
| 652 | pub fn copy_dllsrust-analyzer cargo vcpkg 0.2.8 impl#[Config]copy_dlls().(&mut self, copy_dlls: bool) -> &mut Configrust-analyzer cargo vcpkg 0.2.8 Config# { |
| 653 | self.copy_dllsrust-analyzer cargo vcpkg 0.2.8 Config#copy_dlls. = copy_dlls; |
| 654 | self |
| 655 | } |
| 656 | |
| 657 | /// Define which path to use as vcpkg root overriding the VCPKG_ROOT environment variable |
| 658 | /// Default to `None`, which means use VCPKG_ROOT or try to find out automatically |
| 659 | pub fn vcpkg_rootrust-analyzer cargo vcpkg 0.2.8 impl#[Config]vcpkg_root().(&mut self, vcpkg_root: PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#) -> &mut Configrust-analyzer cargo vcpkg 0.2.8 Config# { |
| 660 | self.vcpkg_rootrust-analyzer cargo vcpkg 0.2.8 Config#vcpkg_root. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(vcpkg_root); |
| 661 | self |
| 662 | } |
| 663 | |
| 664 | /// Find the library `port_name` in a Vcpkg tree. |
| 665 | /// |
| 666 | /// This will use all configuration previously set to select the |
| 667 | /// architecture and linkage. |
| 668 | /// Deprecated in favor of the find_package function |
| 669 | #[doc(hidden)] |
| 670 | pub fn proberust-analyzer cargo vcpkg 0.2.8 impl#[Config]probe().(&mut self, port_name: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Libraryrust-analyzer cargo vcpkg 0.2.8 Library#, Errorrust-analyzer cargo vcpkg 0.2.8 Error#> { |
| 671 | // determine the target type, bailing out if it is not some |
| 672 | // kind of msvc |
| 673 | let msvc_target = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(msvc_targetrust-analyzer cargo vcpkg 0.2.8 msvc_target().()); |
| 674 | |
| 675 | // bail out if requested to not try at all |
| 676 | if envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::var_osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var_os().("VCPKGRS_DISABLE").is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() { |
| 677 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo vcpkg 0.2.8 Error#::DisabledByEnvrust-analyzer cargo vcpkg 0.2.8 Error#DisabledByEnv#("VCPKGRS_DISABLE".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().())); |
| 678 | } |
| 679 | |
| 680 | // bail out if requested to not try at all (old) |
| 681 | if envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::var_osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var_os().("NO_VCPKG").is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() { |
| 682 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo vcpkg 0.2.8 Error#::DisabledByEnvrust-analyzer cargo vcpkg 0.2.8 Error#DisabledByEnv#("NO_VCPKG".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().())); |
| 683 | } |
| 684 | |
| 685 | // bail out if requested to skip this package |
| 686 | let abort_var_name = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("VCPKGRS_NO_{}", envifyrust-analyzer cargo vcpkg 0.2.8 envify().(port_name)); |
| 687 | if envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::var_osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var_os().(&abort_var_name).is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() { |
| 688 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo vcpkg 0.2.8 Error#::DisabledByEnvrust-analyzer cargo vcpkg 0.2.8 Error#DisabledByEnv#(abort_var_name)); |
| 689 | } |
| 690 | |
| 691 | // bail out if requested to skip this package (old) |
| 692 | let abort_var_name = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}_NO_VCPKG", envifyrust-analyzer cargo vcpkg 0.2.8 envify().(port_name)); |
| 693 | if envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::var_osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var_os().(&abort_var_name).is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() { |
| 694 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo vcpkg 0.2.8 Error#::DisabledByEnvrust-analyzer cargo vcpkg 0.2.8 Error#DisabledByEnv#(abort_var_name)); |
| 695 | } |
| 696 | |
| 697 | // if no overrides have been selected, then the Vcpkg port name |
| 698 | // is the the .lib name and the .dll name |
| 699 | if self.required_libsrust-analyzer cargo vcpkg 0.2.8 Config#required_libs..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 700 | self.required_libsrust-analyzer cargo vcpkg 0.2.8 Config#required_libs..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(port_name.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()); |
| 701 | self.required_dllsrust-analyzer cargo vcpkg 0.2.8 Config#required_dlls..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(port_name.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()); |
| 702 | } |
| 703 | |
| 704 | let vcpkg_target = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(find_vcpkg_targetrust-analyzer cargo vcpkg 0.2.8 find_vcpkg_target().(&self, &msvc_target)); |
| 705 | |
| 706 | // require explicit opt-in before using dynamically linked |
| 707 | // variants, otherwise cargo install of various things will |
| 708 | // stop working if Vcpkg is installed. |
| 709 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().vcpkg_target.is_staticrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#is_static. && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::var_osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var_os().("VCPKGRS_DYNAMIC").is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() { |
| 710 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo vcpkg 0.2.8 Error#::RequiredEnvMissingrust-analyzer cargo vcpkg 0.2.8 Error#RequiredEnvMissing#("VCPKGRS_DYNAMIC".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().())); |
| 711 | } |
| 712 | |
| 713 | let mut lib = Libraryrust-analyzer cargo vcpkg 0.2.8 Library#::newrust-analyzer cargo vcpkg 0.2.8 impl#[Library]new().(vcpkg_target.is_staticrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#is_static.); |
| 714 | |
| 715 | if self.emit_includesrust-analyzer cargo vcpkg 0.2.8 Config#emit_includes. { |
| 716 | lib.cargo_metadatarust-analyzer cargo vcpkg 0.2.8 Library#cargo_metadata..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 717 | "cargo:include={}", |
| 718 | vcpkg_target.include_pathrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#include_path..displayrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]display().() |
| 719 | )); |
| 720 | } |
| 721 | lib.include_pathsrust-analyzer cargo vcpkg 0.2.8 Library#include_paths..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(vcpkg_target.include_pathrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#include_path..clonerust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][Clone]clone().()); |
| 722 | |
| 723 | lib.cargo_metadatarust-analyzer cargo vcpkg 0.2.8 Library#cargo_metadata..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 724 | "cargo:rustc-link-search=native={}", |
| 725 | vcpkg_target |
| 726 | .lib_pathrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#lib_path. |
| 727 | .to_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_str().() |
| 728 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("failed to convert string type") |
| 729 | )); |
| 730 | lib.link_pathsrust-analyzer cargo vcpkg 0.2.8 Library#link_paths..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(vcpkg_target.lib_pathrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#lib_path..clonerust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][Clone]clone().()); |
| 731 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().vcpkg_target.is_staticrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#is_static. { |
| 732 | lib.cargo_metadatarust-analyzer cargo vcpkg 0.2.8 Library#cargo_metadata..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 733 | "cargo:rustc-link-search=native={}", |
| 734 | vcpkg_target |
| 735 | .bin_pathrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#bin_path. |
| 736 | .to_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_str().() |
| 737 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("failed to convert string type") |
| 738 | )); |
| 739 | // this path is dropped by recent versions of cargo hence the copies to OUT_DIR below |
| 740 | lib.dll_pathsrust-analyzer cargo vcpkg 0.2.8 Library#dll_paths..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(vcpkg_target.bin_pathrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#bin_path..clonerust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][Clone]clone().()); |
| 741 | } |
| 742 | |
| 743 | tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(self.emit_libsrust-analyzer cargo vcpkg 0.2.8 impl#[Config]emit_libs().(&mut lib, &vcpkg_target)); |
| 744 | |
| 745 | if self.copy_dllsrust-analyzer cargo vcpkg 0.2.8 Config#copy_dlls. { |
| 746 | tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(self.do_dll_copyrust-analyzer cargo vcpkg 0.2.8 impl#[Config]do_dll_copy().(&mut lib)); |
| 747 | } |
| 748 | |
| 749 | if self.cargo_metadatarust-analyzer cargo vcpkg 0.2.8 Config#cargo_metadata. { |
| 750 | for line in &lib.cargo_metadatarust-analyzer cargo vcpkg 0.2.8 Library#cargo_metadata. { |
| 751 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{}", line); |
| 752 | } |
| 753 | } |
| 754 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(lib) |
| 755 | } |
| 756 | |
| 757 | fn emit_libsrust-analyzer cargo vcpkg 0.2.8 impl#[Config]emit_libs().(&mut self, lib: &mut Libraryrust-analyzer cargo vcpkg 0.2.8 Library#, vcpkg_target: &VcpkgTargetrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo vcpkg 0.2.8 Error#> { |
| 758 | for required_lib in &self.required_libsrust-analyzer cargo vcpkg 0.2.8 Config#required_libs. { |
| 759 | // this could use static-nobundle= for static libraries but it is apparently |
| 760 | // not necessary to make the distinction for windows-msvc. |
| 761 | |
| 762 | let link_name = match vcpkg_target.strip_lib_prefixrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#strip_lib_prefix. { |
| 763 | true => required_lib.trim_left_matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim_left_matches().("lib"), |
| 764 | false => required_lib, |
| 765 | }; |
| 766 | |
| 767 | lib.cargo_metadatarust-analyzer cargo vcpkg 0.2.8 Library#cargo_metadata. |
| 768 | .pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("cargo:rustc-link-lib={}", link_name)); |
| 769 | |
| 770 | lib.found_namesrust-analyzer cargo vcpkg 0.2.8 Library#found_names..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().(link_name)); |
| 771 | |
| 772 | // verify that the library exists |
| 773 | let mut lib_location = vcpkg_target.lib_pathrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#lib_path..clonerust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][Clone]clone().(); |
| 774 | lib_location.pushrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]push().(required_lib.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add()."." rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().&vcpkg_target.lib_suffixrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#lib_suffix.); |
| 775 | |
| 776 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().lib_location.existsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]exists().() { |
| 777 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo vcpkg 0.2.8 Error#::LibNotFoundrust-analyzer cargo vcpkg 0.2.8 Error#LibNotFound#(lib_location.displayrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]display().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())); |
| 778 | } |
| 779 | lib.found_libsrust-analyzer cargo vcpkg 0.2.8 Library#found_libs..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(lib_location); |
| 780 | } |
| 781 | |
| 782 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().vcpkg_target.is_staticrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#is_static. { |
| 783 | for required_dll in &self.required_dllsrust-analyzer cargo vcpkg 0.2.8 Config#required_dlls. { |
| 784 | let mut dll_location = vcpkg_target.bin_pathrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#bin_path..clonerust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][Clone]clone().(); |
| 785 | dll_location.pushrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]push().(required_dll.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().".dll"); |
| 786 | |
| 787 | // verify that the DLL exists |
| 788 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().dll_location.existsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]exists().() { |
| 789 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo vcpkg 0.2.8 Error#::LibNotFoundrust-analyzer cargo vcpkg 0.2.8 Error#LibNotFound#(dll_location.displayrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]display().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())); |
| 790 | } |
| 791 | lib.found_dllsrust-analyzer cargo vcpkg 0.2.8 Library#found_dlls..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(dll_location); |
| 792 | } |
| 793 | } |
| 794 | |
| 795 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 796 | } |
| 797 | |
| 798 | fn do_dll_copyrust-analyzer cargo vcpkg 0.2.8 impl#[Config]do_dll_copy().(&mut self, lib: &mut Libraryrust-analyzer cargo vcpkg 0.2.8 Library#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo vcpkg 0.2.8 Error#> { |
| 799 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(target_dir) = envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::var_osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var_os().("OUT_DIR") { |
| 800 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().lib.found_dllsrust-analyzer cargo vcpkg 0.2.8 Library#found_dlls..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 801 | for file in &lib.found_dllsrust-analyzer cargo vcpkg 0.2.8 Library#found_dlls. { |
| 802 | let mut dest_path = Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().(target_dir.as_os_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsString]as_os_str().()).to_path_bufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_path_buf().(); |
| 803 | dest_path.pushrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]push().(Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().(file.file_namerust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]file_name().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().())); |
| 804 | tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!( |
| 805 | fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::copyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/copy().(file, &dest_path).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| Errorrust-analyzer cargo vcpkg 0.2.8 Error#::LibNotFoundrust-analyzer cargo vcpkg 0.2.8 Error#LibNotFound#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 806 | "Can't copy file {} to {}", |
| 807 | file.to_string_lossyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_string_lossy().(), |
| 808 | dest_path.to_string_lossyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_string_lossy().() |
| 809 | ))) |
| 810 | ); |
| 811 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!( |
| 812 | "vcpkg build helper copied {} to {}", |
| 813 | file.to_string_lossyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_string_lossy().(), |
| 814 | dest_path.to_string_lossyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_string_lossy().() |
| 815 | ); |
| 816 | } |
| 817 | lib.cargo_metadatarust-analyzer cargo vcpkg 0.2.8 Library#cargo_metadata..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 818 | "cargo:rustc-link-search=native={}", |
| 819 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var().("OUT_DIR").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().() |
| 820 | )); |
| 821 | // work around https://github.com/rust-lang/cargo/issues/3957 |
| 822 | lib.cargo_metadatarust-analyzer cargo vcpkg 0.2.8 Library#cargo_metadata..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 823 | "cargo:rustc-link-search={}", |
| 824 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var().("OUT_DIR").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().() |
| 825 | )); |
| 826 | } |
| 827 | } else { |
| 828 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo vcpkg 0.2.8 Error#::LibNotFoundrust-analyzer cargo vcpkg 0.2.8 Error#LibNotFound#("Unable to get OUT_DIR".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().())); |
| 829 | } |
| 830 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 831 | } |
| 832 | |
| 833 | /// Find the package `port_name` in a Vcpkg tree. |
| 834 | /// |
| 835 | /// Emits cargo metadata to link to libraries provided by the Vcpkg package/port |
| 836 | /// named, and any (non-system) libraries that they depend on. |
| 837 | /// |
| 838 | /// This will select the architecture and linkage based on environment |
| 839 | /// variables and build flags as described in the module docs, and any configuration |
| 840 | /// set on the builder. |
| 841 | pub fn find_packagerust-analyzer cargo vcpkg 0.2.8 impl#[Config]find_package().(&mut self, port_name: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Libraryrust-analyzer cargo vcpkg 0.2.8 Library#, Errorrust-analyzer cargo vcpkg 0.2.8 Error#> { |
| 842 | // determine the target type, bailing out if it is not some |
| 843 | // kind of msvc |
| 844 | let msvc_target = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(msvc_targetrust-analyzer cargo vcpkg 0.2.8 msvc_target().()); |
| 845 | |
| 846 | // bail out if requested to not try at all |
| 847 | if envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::var_osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var_os().("VCPKGRS_DISABLE").is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() { |
| 848 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo vcpkg 0.2.8 Error#::DisabledByEnvrust-analyzer cargo vcpkg 0.2.8 Error#DisabledByEnv#("VCPKGRS_DISABLE".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().())); |
| 849 | } |
| 850 | |
| 851 | // bail out if requested to not try at all (old) |
| 852 | if envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::var_osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var_os().("NO_VCPKG").is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() { |
| 853 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo vcpkg 0.2.8 Error#::DisabledByEnvrust-analyzer cargo vcpkg 0.2.8 Error#DisabledByEnv#("NO_VCPKG".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().())); |
| 854 | } |
| 855 | |
| 856 | // bail out if requested to skip this package |
| 857 | let abort_var_name = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("VCPKGRS_NO_{}", envifyrust-analyzer cargo vcpkg 0.2.8 envify().(port_name)); |
| 858 | if envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::var_osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var_os().(&abort_var_name).is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() { |
| 859 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo vcpkg 0.2.8 Error#::DisabledByEnvrust-analyzer cargo vcpkg 0.2.8 Error#DisabledByEnv#(abort_var_name)); |
| 860 | } |
| 861 | |
| 862 | // bail out if requested to skip this package (old) |
| 863 | let abort_var_name = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}_NO_VCPKG", envifyrust-analyzer cargo vcpkg 0.2.8 envify().(port_name)); |
| 864 | if envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::var_osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var_os().(&abort_var_name).is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() { |
| 865 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo vcpkg 0.2.8 Error#::DisabledByEnvrust-analyzer cargo vcpkg 0.2.8 Error#DisabledByEnv#(abort_var_name)); |
| 866 | } |
| 867 | |
| 868 | let vcpkg_target = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(find_vcpkg_targetrust-analyzer cargo vcpkg 0.2.8 find_vcpkg_target().(&self, &msvc_target)); |
| 869 | let mut required_port_order = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 870 | |
| 871 | // if no overrides have been selected, then the Vcpkg port name |
| 872 | // is the the .lib name and the .dll name |
| 873 | if self.required_libsrust-analyzer cargo vcpkg 0.2.8 Config#required_libs..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 874 | let ports = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(load_portsrust-analyzer cargo vcpkg 0.2.8 load_ports().(&vcpkg_target)); |
| 875 | |
| 876 | if ports.getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get().(&port_name.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()).is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() { |
| 877 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo vcpkg 0.2.8 Error#::LibNotFoundrust-analyzer cargo vcpkg 0.2.8 Error#LibNotFound#(port_name.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().())); |
| 878 | } |
| 879 | |
| 880 | // the complete set of ports required |
| 881 | let mut required_ports: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Portrust-analyzer cargo vcpkg 0.2.8 Port#> = BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V>`]new().(); |
| 882 | // working of ports that we need to include |
| 883 | // let mut ports_to_scan: BTreeSet<String> = BTreeSet::new(); |
| 884 | // ports_to_scan.insert(port_name.to_owned()); |
| 885 | let mut ports_to_scan = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![port_name.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()]; //: Vec<String> = BTreeSet::new(); |
| 886 | |
| 887 | while !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().ports_to_scan.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 888 | let port_name = ports_to_scan.poprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]pop().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 889 | |
| 890 | if required_ports.contains_keyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]contains_key().(&port_name) { |
| 891 | continue; |
| 892 | } |
| 893 | |
| 894 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(port) = ports.getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get().(&port_name) { |
| 895 | for dep in &port.depsrust-analyzer cargo vcpkg 0.2.8 Port#deps. { |
| 896 | ports_to_scan.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(dep.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().()); |
| 897 | } |
| 898 | required_ports.insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]insert().(port_name.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().(), (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().port).clonerust-analyzer cargo vcpkg 0.2.8 impl#[Port][Clone]clone().()); |
| 899 | remove_itemrust-analyzer cargo vcpkg 0.2.8 remove_item().(&mut required_port_order, &port_name); |
| 900 | required_port_order.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(port_name); |
| 901 | } else { |
| 902 | // what? |
| 903 | } |
| 904 | } |
| 905 | |
| 906 | // for port in ports { |
| 907 | // println!("port {:?}", port); |
| 908 | // } |
| 909 | // println!("== Looking for port {}", port_name); |
| 910 | // for port in &required_port_order { |
| 911 | // println!("ordered required port {:?}", port); |
| 912 | // } |
| 913 | // println!("============================="); |
| 914 | // for port in &required_ports { |
| 915 | // println!("required port {:?}", port); |
| 916 | // } |
| 917 | |
| 918 | // if no overrides have been selected, then the Vcpkg port name |
| 919 | // is the the .lib name and the .dll name |
| 920 | if self.required_libsrust-analyzer cargo vcpkg 0.2.8 Config#required_libs..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 921 | for port_name in &required_port_order { |
| 922 | let port = required_ports.getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get().(port_name).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 923 | self.required_libsrust-analyzer cargo vcpkg 0.2.8 Config#required_libs..extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(port.libsrust-analyzer cargo vcpkg 0.2.8 Port#libs..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|s| { |
| 924 | Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().(&s) |
| 925 | .file_stemrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]file_stem().() |
| 926 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().() |
| 927 | .to_string_lossyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]to_string_lossy().() |
| 928 | .into_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`]into_owned().() |
| 929 | })); |
| 930 | self.required_dllsrust-analyzer cargo vcpkg 0.2.8 Config#required_dlls. |
| 931 | .extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(port.dllsrust-analyzer cargo vcpkg 0.2.8 Port#dlls..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|s| { |
| 932 | Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().(&s) |
| 933 | .file_stemrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]file_stem().() |
| 934 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().() |
| 935 | .to_string_lossyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]to_string_lossy().() |
| 936 | .into_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`]into_owned().() |
| 937 | })); |
| 938 | } |
| 939 | } |
| 940 | } |
| 941 | // require explicit opt-in before using dynamically linked |
| 942 | // variants, otherwise cargo install of various things will |
| 943 | // stop working if Vcpkg is installed. |
| 944 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().vcpkg_target.is_staticrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#is_static. && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::var_osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var_os().("VCPKGRS_DYNAMIC").is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() { |
| 945 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo vcpkg 0.2.8 Error#::RequiredEnvMissingrust-analyzer cargo vcpkg 0.2.8 Error#RequiredEnvMissing#("VCPKGRS_DYNAMIC".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().())); |
| 946 | } |
| 947 | |
| 948 | let mut lib = Libraryrust-analyzer cargo vcpkg 0.2.8 Library#::newrust-analyzer cargo vcpkg 0.2.8 impl#[Library]new().(vcpkg_target.is_staticrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#is_static.); |
| 949 | |
| 950 | if self.emit_includesrust-analyzer cargo vcpkg 0.2.8 Config#emit_includes. { |
| 951 | lib.cargo_metadatarust-analyzer cargo vcpkg 0.2.8 Library#cargo_metadata..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 952 | "cargo:include={}", |
| 953 | vcpkg_target.include_pathrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#include_path..displayrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]display().() |
| 954 | )); |
| 955 | } |
| 956 | lib.include_pathsrust-analyzer cargo vcpkg 0.2.8 Library#include_paths..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(vcpkg_target.include_pathrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#include_path..clonerust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][Clone]clone().()); |
| 957 | |
| 958 | lib.cargo_metadatarust-analyzer cargo vcpkg 0.2.8 Library#cargo_metadata..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 959 | "cargo:rustc-link-search=native={}", |
| 960 | vcpkg_target |
| 961 | .lib_pathrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#lib_path. |
| 962 | .to_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_str().() |
| 963 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("failed to convert string type") |
| 964 | )); |
| 965 | lib.link_pathsrust-analyzer cargo vcpkg 0.2.8 Library#link_paths..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(vcpkg_target.lib_pathrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#lib_path..clonerust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][Clone]clone().()); |
| 966 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().vcpkg_target.is_staticrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#is_static. { |
| 967 | lib.cargo_metadatarust-analyzer cargo vcpkg 0.2.8 Library#cargo_metadata..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 968 | "cargo:rustc-link-search=native={}", |
| 969 | vcpkg_target |
| 970 | .bin_pathrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#bin_path. |
| 971 | .to_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_str().() |
| 972 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("failed to convert string type") |
| 973 | )); |
| 974 | // this path is dropped by recent versions of cargo hence the copies to OUT_DIR below |
| 975 | lib.dll_pathsrust-analyzer cargo vcpkg 0.2.8 Library#dll_paths..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(vcpkg_target.bin_pathrust-analyzer cargo vcpkg 0.2.8 VcpkgTarget#bin_path..clonerust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][Clone]clone().()); |
| 976 | } |
| 977 | |
| 978 | lib.portsrust-analyzer cargo vcpkg 0.2.8 Library#ports. = required_port_order; |
| 979 | |
| 980 | tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(self.emit_libsrust-analyzer cargo vcpkg 0.2.8 impl#[Config]emit_libs().(&mut lib, &vcpkg_target)); |
| 981 | |
| 982 | if self.copy_dllsrust-analyzer cargo vcpkg 0.2.8 Config#copy_dlls. { |
| 983 | tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(self.do_dll_copyrust-analyzer cargo vcpkg 0.2.8 impl#[Config]do_dll_copy().(&mut lib)); |
| 984 | } |
| 985 | |
| 986 | if self.cargo_metadatarust-analyzer cargo vcpkg 0.2.8 Config#cargo_metadata. { |
| 987 | for line in &lib.cargo_metadatarust-analyzer cargo vcpkg 0.2.8 Library#cargo_metadata. { |
| 988 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{}", line); |
| 989 | } |
| 990 | } |
| 991 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(lib) |
| 992 | } |
| 993 | } |
| 994 | |
| 995 | fn remove_itemrust-analyzer cargo vcpkg 0.2.8 remove_item().(cont: &mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, item: &Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> { |
| 996 | match cont.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().positionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]position().(|x| *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().x rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<Self>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<Self>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<Self>`]eq().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().item) { |
| 997 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(pos) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(cont.removerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]remove().(pos)), |
| 998 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 999 | } |
| 1000 | } |
| 1001 | |
| 1002 | impl Libraryrust-analyzer cargo vcpkg 0.2.8 Library# { |
| 1003 | fn newrust-analyzer cargo vcpkg 0.2.8 impl#[Library]new().(is_static: bool) -> Libraryrust-analyzer cargo vcpkg 0.2.8 Library# { |
| 1004 | Libraryrust-analyzer cargo vcpkg 0.2.8 Library# { |
| 1005 | link_pathsrust-analyzer cargo vcpkg 0.2.8 Library#link_paths.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(), |
| 1006 | dll_pathsrust-analyzer cargo vcpkg 0.2.8 Library#dll_paths.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(), |
| 1007 | include_pathsrust-analyzer cargo vcpkg 0.2.8 Library#include_paths.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(), |
| 1008 | cargo_metadatarust-analyzer cargo vcpkg 0.2.8 Library#cargo_metadata.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(), |
| 1009 | is_staticrust-analyzer cargo vcpkg 0.2.8 Library#is_static.: is_static, |
| 1010 | found_dllsrust-analyzer cargo vcpkg 0.2.8 Library#found_dlls.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(), |
| 1011 | found_libsrust-analyzer cargo vcpkg 0.2.8 Library#found_libs.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(), |
| 1012 | found_namesrust-analyzer cargo vcpkg 0.2.8 Library#found_names.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(), |
| 1013 | portsrust-analyzer cargo vcpkg 0.2.8 Library#ports.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(), |
| 1014 | } |
| 1015 | } |
| 1016 | } |
| 1017 | |
| 1018 | fn envifyrust-analyzer cargo vcpkg 0.2.8 envify().(name: &str) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# { |
| 1019 | name.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().() |
| 1020 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|c| c.to_ascii_uppercaserust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]to_ascii_uppercase().()) |
| 1021 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|c| if c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'-' { '_' } else { c }) |
| 1022 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().() |
| 1023 | } |
| 1024 | |
| 1025 | fn msvc_targetrust-analyzer cargo vcpkg 0.2.8 msvc_target().() -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<MSVCTargetrust-analyzer cargo vcpkg 0.2.8 MSVCTarget#, Errorrust-analyzer cargo vcpkg 0.2.8 Error#> { |
| 1026 | let target = envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var().("TARGET").unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().()); |
| 1027 | if target rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."x86_64-apple-darwin" { |
| 1028 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(MSVCTargetrust-analyzer cargo vcpkg 0.2.8 MSVCTarget#::X64MacOSrust-analyzer cargo vcpkg 0.2.8 MSVCTarget#X64MacOS#) |
| 1029 | } else if target rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."x86_64-unknown-linux-gnu" { |
| 1030 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(MSVCTargetrust-analyzer cargo vcpkg 0.2.8 MSVCTarget#::X64Linuxrust-analyzer cargo vcpkg 0.2.8 MSVCTarget#X64Linux#) |
| 1031 | } else if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().target.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().("-pc-windows-msvc") { |
| 1032 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo vcpkg 0.2.8 Error#::NotMSVCrust-analyzer cargo vcpkg 0.2.8 Error#NotMSVC#) |
| 1033 | } else if target.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("x86_64-") { |
| 1034 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(MSVCTargetrust-analyzer cargo vcpkg 0.2.8 MSVCTarget#::X64Windowsrust-analyzer cargo vcpkg 0.2.8 MSVCTarget#X64Windows#) |
| 1035 | } else { |
| 1036 | // everything else is x86 |
| 1037 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(MSVCTargetrust-analyzer cargo vcpkg 0.2.8 MSVCTarget#::X86Windowsrust-analyzer cargo vcpkg 0.2.8 MSVCTarget#X86Windows#) |
| 1038 | } |
| 1039 | } |
| 1040 | |
| 1041 | #[cfg(test)] |
| 1042 | mod testsrust-analyzer cargo vcpkg 0.2.8 tests/ { |
| 1043 | |
| 1044 | extern crate tempdirrust-analyzer cargo vcpkg 0.2.8 tests/tempdir/; |
| 1045 | |
| 1046 | use superrust-analyzer cargo vcpkg 0.2.8 crate/::*; |
| 1047 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/; |
| 1048 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::Mutexrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/Mutex#; |
| 1049 | |
| 1050 | lazy_staticrust-analyzer cargo lazy_static 1.5.0 lazy_static!! { |
| 1051 | static ref LOCKrust-analyzer cargo vcpkg 0.2.8 tests/LOCK#: Mutexrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/Mutex#<()> = Mutexrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/Mutex#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/impl#[`Mutex<T>`]new().(()); |
| 1052 | } |
| 1053 | |
| 1054 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1055 | fn do_nothing_for_unsupported_targetrust-analyzer cargo vcpkg 0.2.8 tests/do_nothing_for_unsupported_target().() { |
| 1056 | let _g = LOCKrust-analyzer cargo vcpkg 0.2.8 tests/LOCK..lockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/impl#[`Mutex<T>`]lock().(); |
| 1057 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("VCPKG_ROOT", "/"); |
| 1058 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("TARGET", "x86_64-pc-windows-gnu"); |
| 1059 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(match ::probe_packagerust-analyzer cargo vcpkg 0.2.8 probe_package().("foo") { |
| 1060 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo vcpkg 0.2.8 Error#::NotMSVCrust-analyzer cargo vcpkg 0.2.8 Error#NotMSVC#) => true, |
| 1061 | _ => false, |
| 1062 | }); |
| 1063 | |
| 1064 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("TARGET", "x86_64-pc-windows-gnu"); |
| 1065 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var().("TARGET"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#("x86_64-pc-windows-gnu".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())); |
| 1066 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(match ::probe_packagerust-analyzer cargo vcpkg 0.2.8 probe_package().("foo") { |
| 1067 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo vcpkg 0.2.8 Error#::NotMSVCrust-analyzer cargo vcpkg 0.2.8 Error#NotMSVC#) => true, |
| 1068 | _ => false, |
| 1069 | }); |
| 1070 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::remove_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/remove_var().("TARGET"); |
| 1071 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::remove_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/remove_var().("VCPKG_ROOT"); |
| 1072 | } |
| 1073 | |
| 1074 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1075 | fn do_nothing_for_bailout_variables_setrust-analyzer cargo vcpkg 0.2.8 tests/do_nothing_for_bailout_variables_set().() { |
| 1076 | let _g = LOCKrust-analyzer cargo vcpkg 0.2.8 tests/LOCK..lockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/impl#[`Mutex<T>`]lock().(); |
| 1077 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("VCPKG_ROOT", "/"); |
| 1078 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("TARGET", "x86_64-pc-windows-msvc"); |
| 1079 | |
| 1080 | for &var in &[ |
| 1081 | "VCPKGRS_DISABLE", |
| 1082 | "VCPKGRS_NO_FOO", |
| 1083 | "FOO_NO_VCPKG", |
| 1084 | "NO_VCPKG", |
| 1085 | ] { |
| 1086 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().(var, "1"); |
| 1087 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(match ::probe_packagerust-analyzer cargo vcpkg 0.2.8 probe_package().("foo") { |
| 1088 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo vcpkg 0.2.8 Error#::DisabledByEnvrust-analyzer cargo vcpkg 0.2.8 Error#DisabledByEnv#(ref v)) if v == var => true, |
| 1089 | _ => false, |
| 1090 | }); |
| 1091 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::remove_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/remove_var().(var); |
| 1092 | } |
| 1093 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::remove_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/remove_var().("TARGET"); |
| 1094 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::remove_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/remove_var().("VCPKG_ROOT"); |
| 1095 | } |
| 1096 | |
| 1097 | // these tests are good but are leaning on a real vcpkg installation |
| 1098 | |
| 1099 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1100 | fn default_build_refuses_dynamicrust-analyzer cargo vcpkg 0.2.8 tests/default_build_refuses_dynamic().() { |
| 1101 | let _g = LOCKrust-analyzer cargo vcpkg 0.2.8 tests/LOCK..lockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/impl#[`Mutex<T>`]lock().(); |
| 1102 | clean_envrust-analyzer cargo vcpkg 0.2.8 tests/clean_env().(); |
| 1103 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("VCPKG_ROOT", vcpkg_test_tree_locrust-analyzer cargo vcpkg 0.2.8 tests/vcpkg_test_tree_loc().("no-status")); |
| 1104 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("TARGET", "x86_64-pc-windows-msvc"); |
| 1105 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("Result is {:?}", ::find_packagerust-analyzer cargo vcpkg 0.2.8 find_package().("libmysql")); |
| 1106 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(match ::find_packagerust-analyzer cargo vcpkg 0.2.8 find_package().("libmysql") { |
| 1107 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo vcpkg 0.2.8 Error#::RequiredEnvMissingrust-analyzer cargo vcpkg 0.2.8 Error#RequiredEnvMissing#(ref v)) if v == "VCPKGRS_DYNAMIC" => true, |
| 1108 | _ => false, |
| 1109 | }); |
| 1110 | clean_envrust-analyzer cargo vcpkg 0.2.8 tests/clean_env().(); |
| 1111 | } |
| 1112 | |
| 1113 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1114 | fn static_build_finds_librust-analyzer cargo vcpkg 0.2.8 tests/static_build_finds_lib().() { |
| 1115 | let _g = LOCKrust-analyzer cargo vcpkg 0.2.8 tests/LOCK..lockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/impl#[`Mutex<T>`]lock().(); |
| 1116 | clean_envrust-analyzer cargo vcpkg 0.2.8 tests/clean_env().(); |
| 1117 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("VCPKG_ROOT", vcpkg_test_tree_locrust-analyzer cargo vcpkg 0.2.8 tests/vcpkg_test_tree_loc().("normalized")); |
| 1118 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("TARGET", "x86_64-pc-windows-msvc"); |
| 1119 | let tmp_dir = tempdirrust-analyzer cargo tempdir 0.3.7 crate/::TempDirrust-analyzer cargo tempdir 0.3.7 TempDir#::newrust-analyzer cargo tempdir 0.3.7 impl#[TempDir]new().("vcpkg_tests").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 1120 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("OUT_DIR", tmp_dir.pathrust-analyzer cargo tempdir 0.3.7 impl#[TempDir]path().()); |
| 1121 | |
| 1122 | // CARGO_CFG_TARGET_FEATURE is set in response to |
| 1123 | // RUSTFLAGS=-Ctarget-feature=+crt-static. It would |
| 1124 | // be nice to test that also. |
| 1125 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("CARGO_CFG_TARGET_FEATURE", "crt-static"); |
| 1126 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("Result is {:?}", ::find_packagerust-analyzer cargo vcpkg 0.2.8 find_package().("libmysql")); |
| 1127 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(match ::find_packagerust-analyzer cargo vcpkg 0.2.8 find_package().("libmysql") { |
| 1128 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(_) => true, |
| 1129 | _ => false, |
| 1130 | }); |
| 1131 | clean_envrust-analyzer cargo vcpkg 0.2.8 tests/clean_env().(); |
| 1132 | } |
| 1133 | |
| 1134 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1135 | fn dynamic_build_finds_librust-analyzer cargo vcpkg 0.2.8 tests/dynamic_build_finds_lib().() { |
| 1136 | let _g = LOCKrust-analyzer cargo vcpkg 0.2.8 tests/LOCK..lockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/impl#[`Mutex<T>`]lock().(); |
| 1137 | clean_envrust-analyzer cargo vcpkg 0.2.8 tests/clean_env().(); |
| 1138 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("VCPKG_ROOT", vcpkg_test_tree_locrust-analyzer cargo vcpkg 0.2.8 tests/vcpkg_test_tree_loc().("no-status")); |
| 1139 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("TARGET", "x86_64-pc-windows-msvc"); |
| 1140 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("VCPKGRS_DYNAMIC", "1"); |
| 1141 | let tmp_dir = tempdirrust-analyzer cargo tempdir 0.3.7 crate/::TempDirrust-analyzer cargo tempdir 0.3.7 TempDir#::newrust-analyzer cargo tempdir 0.3.7 impl#[TempDir]new().("vcpkg_tests").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 1142 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("OUT_DIR", tmp_dir.pathrust-analyzer cargo tempdir 0.3.7 impl#[TempDir]path().()); |
| 1143 | |
| 1144 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("Result is {:?}", ::find_packagerust-analyzer cargo vcpkg 0.2.8 find_package().("libmysql")); |
| 1145 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(match ::find_packagerust-analyzer cargo vcpkg 0.2.8 find_package().("libmysql") { |
| 1146 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(_) => true, |
| 1147 | _ => false, |
| 1148 | }); |
| 1149 | clean_envrust-analyzer cargo vcpkg 0.2.8 tests/clean_env().(); |
| 1150 | } |
| 1151 | |
| 1152 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1153 | fn handle_multiline_descriptionrust-analyzer cargo vcpkg 0.2.8 tests/handle_multiline_description().() { |
| 1154 | let _g = LOCKrust-analyzer cargo vcpkg 0.2.8 tests/LOCK..lockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/impl#[`Mutex<T>`]lock().(); |
| 1155 | clean_envrust-analyzer cargo vcpkg 0.2.8 tests/clean_env().(); |
| 1156 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("VCPKG_ROOT", vcpkg_test_tree_locrust-analyzer cargo vcpkg 0.2.8 tests/vcpkg_test_tree_loc().("multiline-description")); |
| 1157 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("TARGET", "i686-pc-windows-msvc"); |
| 1158 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("VCPKGRS_DYNAMIC", "1"); |
| 1159 | let tmp_dir = tempdirrust-analyzer cargo tempdir 0.3.7 crate/::TempDirrust-analyzer cargo tempdir 0.3.7 TempDir#::newrust-analyzer cargo tempdir 0.3.7 impl#[TempDir]new().("vcpkg_tests").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 1160 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("OUT_DIR", tmp_dir.pathrust-analyzer cargo tempdir 0.3.7 impl#[TempDir]path().()); |
| 1161 | |
| 1162 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("Result is {:?}", ::find_packagerust-analyzer cargo vcpkg 0.2.8 find_package().("graphite2")); |
| 1163 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(match ::find_packagerust-analyzer cargo vcpkg 0.2.8 find_package().("graphite2") { |
| 1164 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(_) => true, |
| 1165 | _ => false, |
| 1166 | }); |
| 1167 | clean_envrust-analyzer cargo vcpkg 0.2.8 tests/clean_env().(); |
| 1168 | } |
| 1169 | |
| 1170 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1171 | fn link_libs_required_by_optional_featuresrust-analyzer cargo vcpkg 0.2.8 tests/link_libs_required_by_optional_features().() { |
| 1172 | let _g = LOCKrust-analyzer cargo vcpkg 0.2.8 tests/LOCK..lockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/impl#[`Mutex<T>`]lock().(); |
| 1173 | clean_envrust-analyzer cargo vcpkg 0.2.8 tests/clean_env().(); |
| 1174 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("VCPKG_ROOT", vcpkg_test_tree_locrust-analyzer cargo vcpkg 0.2.8 tests/vcpkg_test_tree_loc().("normalized")); |
| 1175 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("TARGET", "i686-pc-windows-msvc"); |
| 1176 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("VCPKGRS_DYNAMIC", "1"); |
| 1177 | let tmp_dir = tempdirrust-analyzer cargo tempdir 0.3.7 crate/::TempDirrust-analyzer cargo tempdir 0.3.7 TempDir#::newrust-analyzer cargo tempdir 0.3.7 impl#[TempDir]new().("vcpkg_tests").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 1178 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("OUT_DIR", tmp_dir.pathrust-analyzer cargo tempdir 0.3.7 impl#[TempDir]path().()); |
| 1179 | |
| 1180 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("Result is {:?}", ::find_packagerust-analyzer cargo vcpkg 0.2.8 find_package().("harfbuzz")); |
| 1181 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(match ::find_packagerust-analyzer cargo vcpkg 0.2.8 find_package().("harfbuzz") { |
| 1182 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(lib) => lib |
| 1183 | .cargo_metadatarust-analyzer cargo vcpkg 0.2.8 Library#cargo_metadata. |
| 1184 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 1185 | .findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]find().(|&x| x == "cargo:rustc-link-lib=icuuc") |
| 1186 | .is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().(), |
| 1187 | _ => false, |
| 1188 | }); |
| 1189 | clean_envrust-analyzer cargo vcpkg 0.2.8 tests/clean_env().(); |
| 1190 | } |
| 1191 | |
| 1192 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1193 | fn link_lib_name_is_correctrust-analyzer cargo vcpkg 0.2.8 tests/link_lib_name_is_correct().() { |
| 1194 | let _g = LOCKrust-analyzer cargo vcpkg 0.2.8 tests/LOCK..lockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/impl#[`Mutex<T>`]lock().(); |
| 1195 | |
| 1196 | for target in &[ |
| 1197 | "x86_64-apple-darwin", |
| 1198 | "i686-pc-windows-msvc", |
| 1199 | // "x86_64-pc-windows-msvc", |
| 1200 | // "x86_64-unknown-linux-gnu", |
| 1201 | ] { |
| 1202 | clean_envrust-analyzer cargo vcpkg 0.2.8 tests/clean_env().(); |
| 1203 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("VCPKG_ROOT", vcpkg_test_tree_locrust-analyzer cargo vcpkg 0.2.8 tests/vcpkg_test_tree_loc().("normalized")); |
| 1204 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("TARGET", target); |
| 1205 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("VCPKGRS_DYNAMIC", "1"); |
| 1206 | let tmp_dir = tempdirrust-analyzer cargo tempdir 0.3.7 crate/::TempDirrust-analyzer cargo tempdir 0.3.7 TempDir#::newrust-analyzer cargo tempdir 0.3.7 impl#[TempDir]new().("vcpkg_tests").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 1207 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("OUT_DIR", tmp_dir.pathrust-analyzer cargo tempdir 0.3.7 impl#[TempDir]path().()); |
| 1208 | |
| 1209 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("Result is {:?}", ::find_packagerust-analyzer cargo vcpkg 0.2.8 find_package().("harfbuzz")); |
| 1210 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(match ::find_packagerust-analyzer cargo vcpkg 0.2.8 find_package().("harfbuzz") { |
| 1211 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(lib) => lib |
| 1212 | .cargo_metadatarust-analyzer cargo vcpkg 0.2.8 Library#cargo_metadata. |
| 1213 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 1214 | .findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]find().(|&x| x == "cargo:rustc-link-lib=harfbuzz") |
| 1215 | .is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().(), |
| 1216 | _ => false, |
| 1217 | }); |
| 1218 | clean_envrust-analyzer cargo vcpkg 0.2.8 tests/clean_env().(); |
| 1219 | } |
| 1220 | } |
| 1221 | |
| 1222 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1223 | fn link_dependencies_after_portrust-analyzer cargo vcpkg 0.2.8 tests/link_dependencies_after_port().() { |
| 1224 | let _g = LOCKrust-analyzer cargo vcpkg 0.2.8 tests/LOCK..lockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/impl#[`Mutex<T>`]lock().(); |
| 1225 | clean_envrust-analyzer cargo vcpkg 0.2.8 tests/clean_env().(); |
| 1226 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("VCPKG_ROOT", vcpkg_test_tree_locrust-analyzer cargo vcpkg 0.2.8 tests/vcpkg_test_tree_loc().("normalized")); |
| 1227 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("TARGET", "i686-pc-windows-msvc"); |
| 1228 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("VCPKGRS_DYNAMIC", "1"); |
| 1229 | let tmp_dir = tempdirrust-analyzer cargo tempdir 0.3.7 crate/::TempDirrust-analyzer cargo tempdir 0.3.7 TempDir#::newrust-analyzer cargo tempdir 0.3.7 impl#[TempDir]new().("vcpkg_tests").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 1230 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("OUT_DIR", tmp_dir.pathrust-analyzer cargo tempdir 0.3.7 impl#[TempDir]path().()); |
| 1231 | |
| 1232 | let lib = ::find_packagerust-analyzer cargo vcpkg 0.2.8 find_package().("harfbuzz").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 1233 | |
| 1234 | check_beforerust-analyzer cargo vcpkg 0.2.8 tests/check_before().(&lib, "freetype", "zlib"); |
| 1235 | check_beforerust-analyzer cargo vcpkg 0.2.8 tests/check_before().(&lib, "freetype", "bzip2"); |
| 1236 | check_beforerust-analyzer cargo vcpkg 0.2.8 tests/check_before().(&lib, "freetype", "libpng"); |
| 1237 | check_beforerust-analyzer cargo vcpkg 0.2.8 tests/check_before().(&lib, "harfbuzz", "freetype"); |
| 1238 | check_beforerust-analyzer cargo vcpkg 0.2.8 tests/check_before().(&lib, "harfbuzz", "ragel"); |
| 1239 | check_beforerust-analyzer cargo vcpkg 0.2.8 tests/check_before().(&lib, "libpng", "zlib"); |
| 1240 | |
| 1241 | clean_envrust-analyzer cargo vcpkg 0.2.8 tests/clean_env().(); |
| 1242 | |
| 1243 | fn check_beforerust-analyzer cargo vcpkg 0.2.8 tests/check_before().(lib: &Libraryrust-analyzer cargo vcpkg 0.2.8 Library#, earlier: &str, later: &str) { |
| 1244 | match ( |
| 1245 | lib.portsrust-analyzer cargo vcpkg 0.2.8 Library#ports..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().positionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]position().(|x| *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().x rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<str>`]eq().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().earlier), |
| 1246 | lib.portsrust-analyzer cargo vcpkg 0.2.8 Library#ports..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().positionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]position().(|x| *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().x rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<str>`]eq().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().later), |
| 1247 | ) { |
| 1248 | (Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(earlier_pos), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(later_pos)) if earlier_pos rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().later_pos => { |
| 1249 | // ok |
| 1250 | } |
| 1251 | _ => { |
| 1252 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!( |
| 1253 | "earlier: {}, later: {}\nLibrary found: {:#?}", |
| 1254 | earlier, later, lib |
| 1255 | ); |
| 1256 | panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!(); |
| 1257 | } |
| 1258 | } |
| 1259 | } |
| 1260 | } |
| 1261 | // #[test] |
| 1262 | // fn dynamic_build_package_specific_bailout() { |
| 1263 | // clean_env(); |
| 1264 | // env::set_var("VCPKG_ROOT", vcpkg_test_tree_loc("no-status")); |
| 1265 | // env::set_var("TARGET", "x86_64-pc-windows-msvc"); |
| 1266 | // env::set_var("VCPKGRS_DYNAMIC", "1"); |
| 1267 | // env::set_var("VCPKGRS_NO_LIBMYSQL", "1"); |
| 1268 | |
| 1269 | // println!("Result is {:?}", ::find_package("libmysql")); |
| 1270 | // assert!(match ::find_package("libmysql") { |
| 1271 | // Err(Error::DisabledByEnv(ref v)) if v == "VCPKGRS_NO_LIBMYSQL" => true, |
| 1272 | // _ => false, |
| 1273 | // }); |
| 1274 | // clean_env(); |
| 1275 | // } |
| 1276 | |
| 1277 | // #[test] |
| 1278 | // fn dynamic_build_global_bailout() { |
| 1279 | // clean_env(); |
| 1280 | // env::set_var("VCPKG_ROOT", vcpkg_test_tree_loc("no-status")); |
| 1281 | // env::set_var("TARGET", "x86_64-pc-windows-msvc"); |
| 1282 | // env::set_var("VCPKGRS_DYNAMIC", "1"); |
| 1283 | // env::set_var("VCPKGRS_DISABLE", "1"); |
| 1284 | |
| 1285 | // println!("Result is {:?}", ::find_package("libmysql")); |
| 1286 | // assert!(match ::find_package("libmysql") { |
| 1287 | // Err(Error::DisabledByEnv(ref v)) if v == "VCPKGRS_DISABLE" => true, |
| 1288 | // _ => false, |
| 1289 | // }); |
| 1290 | // clean_env(); |
| 1291 | // } |
| 1292 | |
| 1293 | fn clean_envrust-analyzer cargo vcpkg 0.2.8 tests/clean_env().() { |
| 1294 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::remove_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/remove_var().("TARGET"); |
| 1295 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::remove_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/remove_var().("VCPKG_ROOT"); |
| 1296 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::remove_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/remove_var().("VCPKGRS_DYNAMIC"); |
| 1297 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::remove_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/remove_var().("RUSTFLAGS"); |
| 1298 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::remove_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/remove_var().("CARGO_CFG_TARGET_FEATURE"); |
| 1299 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::remove_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/remove_var().("VCPKGRS_DISABLE"); |
| 1300 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::remove_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/remove_var().("VCPKGRS_NO_LIBMYSQL"); |
| 1301 | } |
| 1302 | |
| 1303 | // path to a to vcpkg installation to test against |
| 1304 | fn vcpkg_test_tree_locrust-analyzer cargo vcpkg 0.2.8 tests/vcpkg_test_tree_loc().(name: &str) -> PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf# { |
| 1305 | let mut path = PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]new().(); |
| 1306 | path.pushrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]push().(envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var().("CARGO_MANIFEST_DIR").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()); |
| 1307 | path.poprust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]pop().(); |
| 1308 | path.pushrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]push().("test-data"); |
| 1309 | path.pushrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]push().(name); |
| 1310 | path |
| 1311 | } |
| 1312 | } |