- Ensure
vcpkg
is installed. Get the package manager on your machine.
- clone
vcpkg
into any location of your choice,
git clone https://github.com/microsoft/vcpkg.git
- cd into the install path and run the bootstrap bat file.
cd vcpkg; .\bootstrap-vcpkg.bat
- Create a new
CMakeUserPresets.json
in the root of the project to accompany theCMakePresets.json
. Your CMakeUserPresets.json should look something like this...
{
"version": 3,
"configurePresets": [
{
"name": "debug",
"inherits": "base",
"environment": {
"VCPKG_ROOT": "C:/path/to/vcpkg"
}
},
{
"name": "release",
"inherits": "debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
}
],
"buildPresets": [
{
"name": "default-build-windows",
"displayName": "Default",
"configurePreset": "debug",
"description": "Vanilla build"
},
{
"name": "release_build_windows",
"configurePreset": "release",
"displayName": "Release",
"description": "Vanilla Build"
}
]
}
You can directly copy this and change the VCPKG_ROOT
path value to the instance location of vcpkg
on your machine.
Note: Do not commit the
CMakeUserPresets.json
file, Ever!!!
- To download the dependencies listed in the project's vcpkg.json, run this:
vcpkg install --triplet <triplet>for example, in my Visual Studio project, I use this:
vcpkg install --triplet x64-windows
- Then in your IDE(in my case Visual Studio 2022), reset Cache and Configure the project.
- Build all projects.
- Run the
install
Executables.
There are executables such as
Game.exe
andPurityEditor.exe
in the install directories${projectDir}/out/install/${presetName}/bin
, accompanied by the required runtime artefacts. Running these executables instead of the ones in the target binary directories will resolve theDLL not found errors
.
No more manually copying dlls to executable location. You get the latest build in the install directory.
For more help, check the vcpkg documentation here
To resolve relative path issues, use the json snippet below to setup your launch.vs.json
{
"version": "0.2.1",
"defaults": {},
"configurations": [
{
"type": "default",
"project": "CMakeLists.txt",
"projectTarget": "PurityEditor.exe (Install)",
"name": "PurityEditor.exe (Install)",
"currentDir": "${workspaceRoot}"
},
{
"type": "default",
"project": "CMakeLists.txt",
"projectTarget": "Game.exe (Install)",
"name": "Game.exe (Install)",
"currentDir": "${workspaceRoot}"
},
{
"type": "default",
"project": "CMakeLists.txt",
"projectTarget": "PurityGem.exe (Install)",
"name": "PurityGem.exe (Install)",
"currentDir": "${workspaceRoot}"
}
]
}