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
...
posted @ 2021-08-20 19:12  vcpkg_C++包管理器  阅读(257)  评论(0编辑  收藏  举报