From 267d283cec59f093d1cd03c406a8030505cfa3e3 Mon Sep 17 00:00:00 2001 From: luncliff Date: Mon, 6 Jan 2025 22:23:44 +0900 Subject: [PATCH 1/6] vcpkg: use 2024.12.16, format manifest --- cmake/vcpkg-configuration.json | 2 +- cmake/vcpkg.json | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cmake/vcpkg-configuration.json b/cmake/vcpkg-configuration.json index 4afc30a3b969d..535504db8ad6d 100644 --- a/cmake/vcpkg-configuration.json +++ b/cmake/vcpkg-configuration.json @@ -2,7 +2,7 @@ "default-registry": { "kind": "git", "repository": "https://github.com/Microsoft/vcpkg", - "baseline": "c82f74667287d3dc386bce81e44964370c91a289" + "baseline": "b322364f06308bdd24823f9d8f03fe0cc86fd46f" }, "registries": [] } diff --git a/cmake/vcpkg.json b/cmake/vcpkg.json index fcb2c7d5de89b..cff2637b81c5e 100644 --- a/cmake/vcpkg.json +++ b/cmake/vcpkg.json @@ -30,15 +30,15 @@ }, "ms-gsl", "nlohmann-json", - { - "name": "nsync", - "platform": "!windows" - }, { "name": "nsync", "platform": "!windows", "version>=": "1.26.0" }, + { + "name": "onnx", + "version>=": "1.16.2" + }, "optional-lite", { "name": "protobuf", @@ -66,12 +66,6 @@ "platform": "windows" } ], - "overrides": [ - { - "name": "flatbuffers", - "version": "23.5.26" - } - ], "features": { "tests": { "description": "Build ONNXRuntime unit tests", @@ -80,5 +74,11 @@ "gtest" ] } - } + }, + "overrides": [ + { + "name": "flatbuffers", + "version": "23.5.26" + } + ] } From 6784c6a469344f95900cd6f3847483b9439a3c5f Mon Sep 17 00:00:00 2001 From: luncliff Date: Tue, 7 Jan 2025 00:23:20 +0900 Subject: [PATCH 2/6] vcpkg: use protobuf 3.21.12 * 3.21.12 fails in find_package(ONNX) --- cmake/vcpkg.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/vcpkg.json b/cmake/vcpkg.json index cff2637b81c5e..e874c29a13f1c 100644 --- a/cmake/vcpkg.json +++ b/cmake/vcpkg.json @@ -76,6 +76,10 @@ } }, "overrides": [ + { + "name": "protobuf", + "version": "3.21.12#4" + }, { "name": "flatbuffers", "version": "23.5.26" From 3955fff3c08a46918fbd31d55fe986209a71746d Mon Sep 17 00:00:00 2001 From: luncliff Date: Wed, 8 Jan 2025 10:23:45 +0900 Subject: [PATCH 3/6] vcpkg: use latest commit reference * https://github.com/microsoft/vcpkg/commit/93570a28ecdf49d3d9676cec8aa0cc72935d43db --- cmake/vcpkg-configuration.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/vcpkg-configuration.json b/cmake/vcpkg-configuration.json index 535504db8ad6d..89954eaec9afd 100644 --- a/cmake/vcpkg-configuration.json +++ b/cmake/vcpkg-configuration.json @@ -2,7 +2,7 @@ "default-registry": { "kind": "git", "repository": "https://github.com/Microsoft/vcpkg", - "baseline": "b322364f06308bdd24823f9d8f03fe0cc86fd46f" + "baseline": "93570a28ecdf49d3d9676cec8aa0cc72935d43db" }, "registries": [] } From 6d9e5f072febe4a4c24e0048b8b57fad9d92f20b Mon Sep 17 00:00:00 2001 From: luncliff Date: Wed, 8 Jan 2025 11:19:25 +0900 Subject: [PATCH 4/6] gh-actions: install homebrew packages --- .github/workflows/mac.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index b36b0aa555940..7dc4e4164368c 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -117,6 +117,9 @@ jobs: with: python-version: ${{ env.python_version }} + - name: "Run Homebrew" + run: brew install autoconf automake autoconf-archive + - name: "Run vcpkg(x64-osx)" uses: lukka/run-vcpkg@v11 with: From 8d8dc51a0db3dd392d9b2df6ba78150b29480dcc Mon Sep 17 00:00:00 2001 From: luncliff Date: Wed, 8 Jan 2025 22:16:16 +0900 Subject: [PATCH 5/6] vcpkg: provide ONNX_DISABLE_STATIC_REGISTRATION with overlay triplets * comment CLI commands for vcpkg install * triplets are forked from https://github.com/microsoft/vcpkg/tree/2024.12.16/triplets --- .github/workflows/mac.yml | 10 ++++++---- .github/workflows/windows.yml | 7 +++++-- cmake/CMakePresets.json | 1 + cmake/vcpkg-triplets/arm64-osx.cmake | 14 ++++++++++++++ cmake/vcpkg-triplets/arm64-windows.cmake | 11 +++++++++++ cmake/vcpkg-triplets/x64-osx.cmake | 14 ++++++++++++++ cmake/vcpkg-triplets/x64-windows.cmake | 11 +++++++++++ 7 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 cmake/vcpkg-triplets/arm64-osx.cmake create mode 100644 cmake/vcpkg-triplets/arm64-windows.cmake create mode 100644 cmake/vcpkg-triplets/x64-osx.cmake create mode 100644 cmake/vcpkg-triplets/x64-windows.cmake diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index 7dc4e4164368c..bde2804a21a32 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -124,13 +124,14 @@ jobs: uses: lukka/run-vcpkg@v11 with: vcpkgDirectory: "${{ runner.temp }}/vcpkg" - vcpkgGitCommitId: "1de2026f28ead93ff1773e6e680387643e914ea1" # 2024.07.12 - runVcpkgInstall: true + vcpkgGitCommitId: "b322364f06308bdd24823f9d8f03fe0cc86fd46f" # 2024.12.16 + runVcpkgInstall: true # vcpkg install --x-manifest-root cmake --x-install-root .build --overlay-triplets cmake/vcpkg-triplets vcpkgJsonGlob: "cmake/vcpkg.json" vcpkgConfigurationJsonGlob: "cmake/vcpkg-configuration.json" env: VCPKG_INSTALLED_DIR: "${{ github.workspace }}/.build" VCPKG_DEFAULT_TRIPLET: "x64-osx" + VCPKG_OVERLAY_TRIPLETS: "${{ github.workspace }}/cmake/vcpkg-triplets" # VCPKG_BINARY_SOURCES: "default" # https://learn.microsoft.com/en-us/vcpkg/reference/binarycaching - name: "Run compile_schema.py" @@ -172,13 +173,14 @@ jobs: uses: lukka/run-vcpkg@v11 with: vcpkgDirectory: "${{ runner.temp }}/vcpkg" - vcpkgGitCommitId: "1de2026f28ead93ff1773e6e680387643e914ea1" # 2024.07.12 - runVcpkgInstall: true + doNotUpdateVcpkg: true + runVcpkgInstall: true # vcpkg install --x-manifest-root cmake --x-install-root .build --overlay-triplets cmake/vcpkg-triplets vcpkgJsonGlob: "cmake/vcpkg.json" vcpkgConfigurationJsonGlob: "cmake/vcpkg-configuration.json" env: VCPKG_INSTALLED_DIR: "${{ github.workspace }}/.build" VCPKG_DEFAULT_TRIPLET: "arm64-osx" + VCPKG_OVERLAY_TRIPLETS: "${{ github.workspace }}/cmake/vcpkg-triplets" # VCPKG_BINARY_SOURCES: "default" # https://learn.microsoft.com/en-us/vcpkg/reference/binarycaching - name: "Run build.py(arm64-osx)" diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 8a95e8a7b7b89..c42fe599ab394 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -56,12 +56,14 @@ jobs: uses: lukka/run-vcpkg@v11 with: vcpkgDirectory: "C:/vcpkg" # use VCPKG_INSTALLATION_ROOT of the image - runVcpkgInstall: true + vcpkgGitCommitId: "b322364f06308bdd24823f9d8f03fe0cc86fd46f" # 2024.12.16 + runVcpkgInstall: true # vcpkg install --x-manifest-root cmake --x-install-root .build --overlay-triplets cmake/vcpkg-triplets vcpkgJsonGlob: "cmake/vcpkg.json" vcpkgConfigurationJsonGlob: "cmake/vcpkg-configuration.json" env: VCPKG_INSTALLED_DIR: "${{ github.workspace }}/.build" VCPKG_DEFAULT_TRIPLET: "x64-windows" + VCPKG_OVERLAY_TRIPLETS: "${{ github.workspace }}/cmake/vcpkg-triplets" # VCPKG_BINARY_SOURCES: "default" # https://learn.microsoft.com/en-us/vcpkg/reference/binarycaching - name: "Run compile_schema.py" @@ -106,12 +108,13 @@ jobs: with: vcpkgDirectory: "C:/vcpkg" # use VCPKG_INSTALLATION_ROOT of the image doNotUpdateVcpkg: true - runVcpkgInstall: true + runVcpkgInstall: true # vcpkg install --x-manifest-root cmake --x-install-root .build --overlay-triplets cmake/vcpkg-triplets vcpkgJsonGlob: "cmake/vcpkg.json" vcpkgConfigurationJsonGlob: "cmake/vcpkg-configuration.json" env: VCPKG_INSTALLED_DIR: "${{ github.workspace }}/.build" VCPKG_DEFAULT_TRIPLET: "arm64-windows" + VCPKG_OVERLAY_TRIPLETS: "${{ github.workspace }}/cmake/vcpkg-triplets" # VCPKG_BINARY_SOURCES: "default" # https://learn.microsoft.com/en-us/vcpkg/reference/binarycaching - name: "Run build.py(arm64-windows)" diff --git a/cmake/CMakePresets.json b/cmake/CMakePresets.json index 1b7aa11975a3e..4987edaf85513 100644 --- a/cmake/CMakePresets.json +++ b/cmake/CMakePresets.json @@ -14,6 +14,7 @@ "VCPKG_INSTALLED_DIR": "${sourceParentDir}/.build" }, "environment": { + "VCPKG_OVERLAY_TRIPLETS": "${sourceDir}/vcpkg-triplets", "VCPKG_FEATURE_FLGAS": "manifests,versions" } }, diff --git a/cmake/vcpkg-triplets/arm64-osx.cmake b/cmake/vcpkg-triplets/arm64-osx.cmake new file mode 100644 index 0000000000000..543081c5073c4 --- /dev/null +++ b/cmake/vcpkg-triplets/arm64-osx.cmake @@ -0,0 +1,14 @@ +# https://learn.microsoft.com/en-us/vcpkg/users/triplets +set(VCPKG_TARGET_ARCHITECTURE arm64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE static) + +set(VCPKG_CMAKE_SYSTEM_NAME Darwin) +set(VCPKG_OSX_ARCHITECTURES arm64) + +# provide build options for vcpkg installed packages +if(PORT MATCHES "onnx") + list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS + "-DONNX_DISABLE_STATIC_REGISTRATION=ON" + ) +endif() diff --git a/cmake/vcpkg-triplets/arm64-windows.cmake b/cmake/vcpkg-triplets/arm64-windows.cmake new file mode 100644 index 0000000000000..13caf5a12f72b --- /dev/null +++ b/cmake/vcpkg-triplets/arm64-windows.cmake @@ -0,0 +1,11 @@ +# https://learn.microsoft.com/en-us/vcpkg/users/triplets +set(VCPKG_TARGET_ARCHITECTURE arm64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE dynamic) + +# provide build options for vcpkg installed packages +if(PORT MATCHES "onnx") + list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS + "-DONNX_DISABLE_STATIC_REGISTRATION=ON" + ) +endif() diff --git a/cmake/vcpkg-triplets/x64-osx.cmake b/cmake/vcpkg-triplets/x64-osx.cmake new file mode 100644 index 0000000000000..be656a060490c --- /dev/null +++ b/cmake/vcpkg-triplets/x64-osx.cmake @@ -0,0 +1,14 @@ +# https://learn.microsoft.com/en-us/vcpkg/users/triplets +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE static) + +set(VCPKG_CMAKE_SYSTEM_NAME Darwin) +set(VCPKG_OSX_ARCHITECTURES x86_64) + +# provide build options for vcpkg installed packages +if(PORT MATCHES "onnx") + list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS + "-DONNX_DISABLE_STATIC_REGISTRATION=ON" + ) +endif() diff --git a/cmake/vcpkg-triplets/x64-windows.cmake b/cmake/vcpkg-triplets/x64-windows.cmake new file mode 100644 index 0000000000000..ee137a9586a7d --- /dev/null +++ b/cmake/vcpkg-triplets/x64-windows.cmake @@ -0,0 +1,11 @@ +# https://learn.microsoft.com/en-us/vcpkg/users/triplets +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE dynamic) + +# provide build options for vcpkg installed packages +if(PORT MATCHES "onnx") + list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS + "-DONNX_DISABLE_STATIC_REGISTRATION=ON" + ) +endif() From df681aac38ceb8445e26bdf32ccea963bd3fd022 Mon Sep 17 00:00:00 2001 From: luncliff Date: Wed, 8 Jan 2025 22:34:08 +0900 Subject: [PATCH 6/6] ci: use VCPKG_OVERLAY_TRIPLETS with build.py --- .github/workflows/mac.yml | 4 ++++ .github/workflows/windows.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index bde2804a21a32..04b5fdb85ed56 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -167,6 +167,8 @@ jobs: --cmake_extra_defines "VCPKG_TARGET_TRIPLET=x64-osx" \ --cmake_extra_defines "VCPKG_INSTALLED_DIR:PATH=${{ github.workspace }}/.build" \ --cmake_extra_defines "VCPKG_INSTALL_OPTIONS=--x-feature=tests" + env: + VCPKG_OVERLAY_TRIPLETS: "${{ github.workspace }}/cmake/vcpkg-triplets" shell: bash - name: "Run vcpkg(arm64-osx)" @@ -198,6 +200,8 @@ jobs: --cmake_extra_defines "VCPKG_TARGET_TRIPLET=arm64-osx" \ --cmake_extra_defines "VCPKG_INSTALLED_DIR:PATH=${{ github.workspace }}/.build" \ --cmake_extra_defines "VCPKG_INSTALL_OPTIONS=--x-feature=tests" + env: + VCPKG_OVERLAY_TRIPLETS: "${{ github.workspace }}/cmake/vcpkg-triplets" shell: bash Objective-C-StaticAnalysis: diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index c42fe599ab394..0f73aaac60014 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -101,6 +101,8 @@ jobs: --cmake_extra_defines "VCPKG_TARGET_TRIPLET=x64-windows" ` --cmake_extra_defines "VCPKG_INSTALLED_DIR:PATH=${{ github.workspace }}/.build" ` --cmake_extra_defines "VCPKG_INSTALL_OPTIONS=--x-feature=tests" + env: + VCPKG_OVERLAY_TRIPLETS: "${{ github.workspace }}/cmake/vcpkg-triplets" shell: pwsh - name: "Run vcpkg(arm64-windows)" @@ -131,4 +133,6 @@ jobs: --cmake_extra_defines "VCPKG_TARGET_TRIPLET=arm64-windows" ` --cmake_extra_defines "VCPKG_INSTALLED_DIR:PATH=${{ github.workspace }}/.build" ` --cmake_extra_defines "VCPKG_INSTALL_OPTIONS=--x-feature=tests" + env: + VCPKG_OVERLAY_TRIPLETS: "${{ github.workspace }}/cmake/vcpkg-triplets" shell: pwsh