maat
maat copied to clipboard
vcpkg integration
This is a rough integration for usage of vcpkg dependencies. You can build like the following on Linux or macOS:
git clone https://github.com/microsoft/vcpkg
export "VCPKG_ROOT=$(pwd)/vcpkg"
cmake --preset=dev
cmake --build --preset=dev
ctest --preset=dev
and it should work but tests might not pass on Mac because of LIEF upgrade.
You can also attempt to build on Windows (after merging and fixing a few things in #97, see https://github.com/trailofbits/maat/pull/97#issuecomment-1176957386 for more details) with the following
git clone https://github.com/microsoft/vcpkg
$Env:VCPKG_ROOT = "$PWD\vcpkg"
cmake --preset=dev-win64
cmake --build --preset=dev-win64 # Will likely fail due to some Maat bugs
ctest --preset=dev-win64 # Will almost certainly fail
Also, for the dev preset, you can have something like this file as CMakeUserPresets.json in the root of maat.
{
"version": 2,
"cmakeMinimumRequired": {
"major": 3,
"minor": 15,
"patch": 0
},
"configurePresets": [
{
"name": "dev-common",
"hidden": true,
"inherits": [
"dev-mode",
"vcpkg"
],
"cacheVariables": {
"Python3_FIND_UNVERSIONED_NAMES": "FIRST"
}
},
{
"name": "dev-unix",
"binaryDir": "${sourceDir}/build/dev-unix",
"generator": "Ninja",
"inherits": [
"dev-common",
"ci-unix"
],
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "dev-win64",
"binaryDir": "${sourceDir}/build/dev-win64",
"inherits": [
"dev-common",
"ci-win64",
"vcpkg-win64-static"
]
},
{
"name": "dev",
"binaryDir": "/tmp/work/build/dev",
"inherits": "dev-unix"
}
],
"buildPresets": [
{
"name": "dev-win64",
"configurePreset": "dev-win64",
"configuration": "Debug",
"jobs": 8
},
{
"name": "dev",
"configurePreset": "dev",
"configuration": "Debug",
"jobs": 8
}
],
"testPresets": [
{
"name": "dev-win64",
"configurePreset": "dev-win64",
"configuration": "Debug",
"output": {
"outputOnFailure": true,
"verbosity": "verbose"
},
"execution": {
"jobs": 1
}
},
{
"name": "dev",
"configurePreset": "dev",
"configuration": "Debug",
"output": {
"outputOnFailure": true,
"verbosity": "verbose"
},
"execution": {
"jobs": 1
}
}
]
}
TODO:
Things I can think of now...
- [ ] Use vcpkg in CI for native builds
- [ ] We should use NuGet binarycaching to avoid building everything from scratch every time (see the docs here https://learn.microsoft.com/en-us/vcpkg/users/binarycaching#quickstart-github)
- [ ] Use vcpkg in Python builds. Not sure how difficult it will be with cibuildwheel. By default we still want someone to use local dependencies in the event that someone wants to install the package from a git commit (i.e., using a GitHub repo URL)
- [ ] Ideally vcpkg works for cross-compilation of Mac architectures. This will be a real test of vcpkg
- [ ] We will need a custom vcpkg triplet for adding Mac compatibility flags for the vcpkg dependencies
- [x] Merge the changes required of sleigh into
masterbranch https://github.com/lifting-bits/sleigh/pull/105