onnxruntime/cmake/CMakePresets.json
PARK DongHa 5b9c968eaa
Correct ONNX and Protobuf version in vcpkg build (#23285)
### Description

Changes vcpkg manifest and configuration file (vcpkg.json &
vcpkg-configuration.json)

* Update vcpkg version to
https://github.com/microsoft/vcpkg/releases/tag/2024.12.16
* Use protobuf 3.21.12(= `v21.12`) to sync with
[cmake/deps.txt](https://github.com/microsoft/onnxruntime/blob/main/cmake/deps.txt)
  * Resolve https://github.com/microsoft/onnxruntime/issues/22750
* Add `onnx` to vcpkg manifest so `find_package(ONNX)` and
`find_dependency(Protobuf)` can work as expected.
  * Currently, It uses 1.16.2
* v1.17.0 will become available after
https://github.com/microsoft/vcpkg/pull/42942

However, `onnx` in vcpkg doesn't configure
`ONNX_DISABLE_STATIC_REGISTRATION` build option.

* https://github.com/microsoft/vcpkg/pull/38879
* Create "cmake/vcpkg-triplets/" folder and triplet files which use
`VCPKG_CMAKE_CONFIGURE_OPTIONS` for the option
* This requires `VCPKG_OVERLAY_TRIPLETS` environment variable for CI
steps, which is a bit inconvenient.
     I will try to find simple way to get same result

### Motivation and Context

* Help #23158 
  * "ONNX is not consumed from vcpkg"
* "Mismatch protobuf version. When vcpkg is enabled , we should not
fetch protoc from Github which may cause version mismatches."
* https://github.com/microsoft/vcpkg/pull/43126
* #21348
2025-01-08 12:25:17 -08:00

193 lines
6.5 KiB
JSON

{
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 25,
"patch": 0
},
"configurePresets": [
{
"name": "vcpkg-manifest",
"hidden": true,
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"cacheVariables": {
"VCPKG_INSTALLED_DIR": "${sourceParentDir}/.build"
},
"environment": {
"VCPKG_OVERLAY_TRIPLETS": "${sourceDir}/vcpkg-triplets",
"VCPKG_FEATURE_FLGAS": "manifests,versions"
}
},
{
"name": "msvc-static-runtime",
"hidden": true,
"cacheVariables": {
"ONNX_USE_MSVC_STATIC_RUNTIME": true,
"protobuf_MSVC_STATIC_RUNTIME": true,
"gtest_force_shared_crt": false,
"CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded$<$<CONFIG:Debug>:Debug>"
}
},
{
"name": "unit-test",
"hidden": true,
"cacheVariables": {
"onnxruntime_RUN_ONNX_TESTS": true,
"onnxruntime_BUILD_BENCHMARKS": true,
"onnxruntime_BUILD_UNIT_TESTS": true,
"onnxruntime_GENERATE_TEST_REPORTS": true
}
},
{
"name": "x64-windows",
"inherits": [
"msvc-static-runtime",
"unit-test"
],
"generator": "Visual Studio 17 2022",
"architecture": "x64",
"binaryDir": "${sourceParentDir}/cmake_build/x64-windows",
"installDir": "${sourceParentDir}/cmake_build/out",
"cacheVariables": {
"onnxruntime_USE_XNNPACK": true,
"onnxruntime_USE_DML": true,
"onnxruntime_BUILD_SHARED_LIB": true,
"CMAKE_CONFIGURATION_TYPES": "Debug;Release"
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"intelliSenseMode": "windows-msvc-x64"
}
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "x64-windows-vcpkg",
"inherits": [
"unit-test",
"vcpkg-manifest"
],
"generator": "Visual Studio 17 2022",
"architecture": "x64",
"binaryDir": "${sourceParentDir}/cmake_build/x64-windows",
"installDir": "${sourceParentDir}/cmake_build/out",
"cacheVariables": {
"onnxruntime_USE_VCPKG": true,
"onnxruntime_USE_XNNPACK": false,
"onnxruntime_USE_DML": false,
"onnxruntime_BUILD_SHARED_LIB": true,
"CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL",
"CMAKE_CONFIGURATION_TYPES": "Debug;Release",
"VCPKG_INSTALL_OPTIONS": "--x-feature=tests",
"VCPKG_TARGET_TRIPLET": "x64-windows"
}
},
{
"name": "x64-osx",
"inherits": [
"unit-test"
],
"generator": "Xcode",
"binaryDir": "${sourceParentDir}/cmake_build/x64-osx",
"installDir": "${sourceParentDir}/cmake_build/out",
"cacheVariables": {
"CMAKE_OSX_ARCHITECTURES": "x86_64",
"onnxruntime_BUILD_SHARED_LIB": true,
"onnxruntime_USE_XNNPACK": false,
"onnxruntime_USE_COREML": true,
"onnxruntime_BUILD_OBJC": true,
"onnxruntime_BUILD_APPLE_FRAMEWORK": true,
"CMAKE_CONFIGURATION_TYPES": "Debug;Release"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
}
},
{
"name": "x64-osx-vcpkg",
"inherits": [
"x64-osx",
"vcpkg-manifest"
],
"cacheVariables": {
"onnxruntime_USE_VCPKG": true,
"onnxruntime_USE_XNNPACK": false,
"onnxruntime_USE_COREML": false,
"onnxruntime_BUILD_OBJC": false,
"onnxruntime_BUILD_APPLE_FRAMEWORK": false,
"VCPKG_INSTALL_OPTIONS": "--x-feature=tests",
"VCPKG_TARGET_TRIPLET": "x64-osx"
}
}
],
"buildPresets": [
{
"name": "x64-windows-debug",
"configurePreset": "x64-windows",
"configuration": "Debug"
},
{
"name": "x64-windows-vcpkg-debug",
"configurePreset": "x64-windows-vcpkg",
"configuration": "Debug"
},
{
"name": "x64-osx-debug",
"configurePreset": "x64-osx",
"configuration": "Debug"
},
{
"name": "x64-osx-vcpkg-debug",
"configurePreset": "x64-osx-vcpkg",
"configuration": "Debug"
}
],
"testPresets": [
{
"name": "x64-windows-debug",
"configurePreset": "x64-windows",
"configuration": "Debug",
"output": {
"verbosity": "default",
"outputJUnitFile": "TEST-x64-windows-debug.xml",
"outputLogFile": "TEST-x64-windows-debug.log",
"outputOnFailure": true
},
"execution": {
"noTestsAction": "error",
"stopOnFailure": false
}
},
{
"name": "x64-windows-vcpkg-debug",
"inherits": "x64-windows-debug",
"configurePreset": "x64-windows-vcpkg"
},
{
"name": "x64-osx-debug",
"configurePreset": "x64-osx",
"configuration": "Debug",
"output": {
"verbosity": "default",
"outputJUnitFile": "TEST-x64-osx-debug.xml",
"outputLogFile": "TEST-x64-osx-debug.log",
"outputOnFailure": true
},
"execution": {
"noTestsAction": "error",
"stopOnFailure": false
}
},
{
"name": "x64-osx-vcpkg-debug",
"inherits": "x64-osx-debug",
"configurePreset": "x64-osx-vcpkg"
}
]
}