Scott Wilson
Scott Wilson

Reputation: 73

Is there an easy way to move vckpg to new "identical" machine?

I've got two "identical" (same OS, Visual Studio, etc.) machines. One has vcpkg with a number of installed packages ('older' versions), and I'd like an identical copy on the new machine that is integrated with Visual Studio. There seem to be a number of relatively complicated methods of accomplishing this: export/import, manifest versioning and binary caching. But what I'd really like to do is run a command on the new machine like "vcpkg installfrompath " or copy the vcpkg folder to the new machine and run "vcpkg restore". I really feel like this must exist and I'm just not seeing it.

Upvotes: 0

Views: 899

Answers (2)

Hajo Kirchhoff
Hajo Kirchhoff

Reputation: 2075

Use manifest mode. It's really easy and gives you exact control over different versions. Just add a file called "vcpkg.json" to the root folder of your project, activate "manifest" in the vcpkg entry of your Visual Studio project and you are almost done.

This is what a manifest file looks like:

{
  "name": "myapp",
  "version": "1.66.0",
  "dependencies": [
    { "name": "pybind11" },
    { "name": "boost-format" },
    { "name": "boost-preprocessor" },
    { "name": "boost-uuid" },
    {
      "name": "python3",
      "version>=":  "3.7.4"
    }
  ],
  "builtin-baseline": "03ca9b59af1506a86840e3a3a01a092f3333a29b",
  "homepage": "https://some.server.loc",
  "supports": "windows"
}

Then simply build with Visual Studio. This will invoke vcpkg and build the exact versions you want.

Upvotes: 0

Scott Wilson
Scott Wilson

Reputation: 73

Got answer from MS :) https://github.com/microsoft/vcpkg/issues/23464

Simply copy the vcpkg folder and run "vcpkg integrate install"

I verified that this works. Interestingly, this is the command you use when initially setting up vcpkg, but it didn't click for me, not did I see this answer in any of the similar questions I saw posted.

Upvotes: 2

Related Questions