1. 程式人生 > 其它 >Filesystem registries 使用示例

Filesystem registries 使用示例

建立登錄檔

參考 https://github.com/PhoebeHui/filesystem 及以下檔案結構來建立檔案及資料夾,或者克隆官方示例庫https://github.com/vcpkg/example-filesystem-registry

filesystem/
|-- ports/
|-------- beicode/
|--------------1.0.0/
|---------------- portfile.cmake
|---------------- vcpkg.json
|--------- beison/
|-------------- 1.0.0/
|---------------- portfile.cmake
|---------------- vcpkg.json
|-------------- 1.0.1/
|---------------- portfile.cmake
|---------------- vcpkg.json
|-- versions/
| -------- baseline.json
|--------- b-/
|------------ beicode.json
|------------ beison.json

使用登錄檔(manifest模式)

1. 建立Vcpkg-configuration.json 與vcpkg.json檔案, 為了方便測試,可以把它放置到vcpkg根目錄。實際使用時,請放置在您專案的工程專案與vcpkg.json同級目錄下。

vcpkg-configuration.json檔案:

{
   "registries": [
    {
      "kind": "filesystem",
      "baseline": "2021-04-08",
      "path": "E:/vcpkg/vcpkgtest/registries/filesystem",
      "packages": [ "beicode", "beison"]
    }
  ]
}

vcpkg.json 檔案:

{
  "name": "test",
  "version": "0",
  "dependencies": [
      "beicode",
      "beison"
   ]
}

2. 安裝使用,可以看到,它安裝了登錄檔配置的庫。

PS E:\vcpkg\clean\vcpkg> ./vcpkg install --triplet=x64-windows
Detecting compiler hash for triplet x64-windows...
The following packages will be built and installed:

    beicode[core]:x64-windows -> 1.0.0 -- E:/vcpkg/vcpkgtest/registries/filesystem\ports/beicode/1.0.0
    beison[core]:x64-windows -> 1.0.1 -- E:/vcpkg/vcpkgtest/registries/filesystem\ports/beison/1.0.1

Using cached binary package: C:\Users\phoebe\AppData\Local\vcpkg\archives\df\df818eb2474ab4e697ccbb6876ad31d41aa6a6008c938225856014ca82881e02.zip
Could not locate cached archive: C:\Users\phoebe\AppData\Local\vcpkg\archives\66\66899286c8a08d5310336ed80de170053d24220cc4b0e464fb90521c58b094ed.zip
...

使用登錄檔(經典模式)

1. 在vcpkg根目錄下建立檔案 vcpkg-configuration.json:

{
   "registries": [
    {
      "kind": "filesystem",
      "baseline": "2021-04-08",
      "path": "E:/vcpkg/vcpkgtest/registries/filesystem",
      "packages": [ "beicode", "beison"]
    }
  ]
}

2. 安裝beicode庫。

PS E:\vcpkg\clean\vcpkg> ./vcpkg install beicode
Computing installation plan...
The following packages will be built and installed:
    beicode[core]:x86-windows -> 1.0.0 -- E:/vcpkg/vcpkgtest/registries/filesystem\ports/beicode/1.0.0

Detecting compiler hash for triplet x86-windows...
Could not locate cached archive: C:\Users\phoebe\AppData\Local\vcpkg\archives\af\af12a6c0126c79f715ae3940197c60e56a9845ecd605a07c041b0ffe61009e09.zip
Starting package 1/1: beicode:x86-windows
...
VCPKG 團隊期待您的貢獻!