From 8ee0d35c9679a3954f9007ee74ca158366e7e2fd Mon Sep 17 00:00:00 2001 From: Pasukhin Dmitry Date: Sat, 7 Mar 2026 17:49:26 +0000 Subject: [PATCH] Testing - Add support for ARM64 architecture (#1149) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Allow the custom `tcl` vcpkg port to build on Windows ARM64 and map vcpkg architecture to Tcl’s NMAKE build flags. - Add a `target-arch` input to the composite GitHub Actions used to configure/build OCCT, selecting the correct CMake `-A` architecture and vcpkg triplet. - Adjust OCCT CMake vcpkg feature list macros to update `VCPKG_MANIFEST_FEATURES` in the current scope. --- .github/actions/build-occt/action.yml | 5 ++ .github/actions/configure-occt/action.yml | 91 ++++++++++++++++------- adm/cmake/occt_macros.cmake | 4 +- adm/vcpkg/ports/tcl/portfile.cmake | 10 +-- adm/vcpkg/ports/tcl/vcpkg.json | 2 +- 5 files changed, 78 insertions(+), 34 deletions(-) diff --git a/.github/actions/build-occt/action.yml b/.github/actions/build-occt/action.yml index 058ea795c3..79d1a9414f 100644 --- a/.github/actions/build-occt/action.yml +++ b/.github/actions/build-occt/action.yml @@ -8,6 +8,10 @@ inputs: compiler: description: 'Compiler (msvc, clang, gcc)' required: true + target-arch: + description: 'Target architecture (x64, arm64)' + required: false + default: 'x64' artifact-name: description: 'Name of the artifact to store build results' required: true @@ -47,6 +51,7 @@ runs: with: platform: ${{ inputs.platform }} compiler: ${{ inputs.compiler }} + target-arch: ${{ inputs.target-arch }} additional-cmake-flags: ${{ inputs.additional-cmake-flags }} use-vtk: ${{ inputs.use-vtk }} build-use-pch: ${{ inputs.build-use-pch }} diff --git a/.github/actions/configure-occt/action.yml b/.github/actions/configure-occt/action.yml index 26dcace716..aef3f75c3c 100644 --- a/.github/actions/configure-occt/action.yml +++ b/.github/actions/configure-occt/action.yml @@ -8,6 +8,10 @@ inputs: compiler: description: 'Compiler (msvc, clang, gcc)' required: true + target-arch: + description: 'Target architecture (x64, arm64)' + required: false + default: 'x64' additional-cmake-flags: description: 'Additional CMake flags' required: false @@ -76,30 +80,67 @@ runs: run: | mkdir build cd build - cmake -T ${{ inputs.compiler == 'msvc' && 'host=x64' || 'ClangCL' }} ` - -D USE_FREETYPE=ON ` - -D USE_TK=ON ` - -D BUILD_USE_PCH=${{ inputs.build-use-pch }} ` - -D BUILD_OPT_PROFILE=${{ inputs.build-opt-profile }} ` - -D BUILD_INCLUDE_SYMLINK=ON ` - -D CMAKE_BUILD_TYPE=${{ inputs.cmake-build-type }} ` - -D INSTALL_DIR=${{ github.workspace }}/install ` - -D BUILD_USE_VCPKG=ON ` - -D VCPKG_TARGET_TRIPLET=x64-windows ` - -D USE_D3D=ON ` - -D USE_DRACO=ON ` - -D USE_FFMPEG=ON ` - -D USE_FREEIMAGE=ON ` - -D USE_GLES2=ON ` - -D USE_OPENVR=ON ` - -D USE_VTK=${{ inputs.use-vtk }} ` - -D USE_TBB=ON ` - -D USE_RAPIDJSON=ON ` - -D USE_OPENGL=ON ` - -D BUILD_GTEST=ON ` - -D BUILD_CPP_STANDARD=C++17 ` - -D INSTALL_GTEST=ON ` - ${{ inputs.additional-cmake-flags }} .. + $targetArch = "${{ inputs.target-arch }}" + switch ($targetArch) { + "x64" { + $cmakeArch = "x64" + $vcpkgTriplet = "x64-windows" + $cmakeToolset = if ("${{ inputs.compiler }}" -eq "msvc") { "host=x64" } else { "ClangCL" } + $useTk = "ON" + $useOpenVr = "ON" + } + "arm64" { + $cmakeArch = "ARM64" + $vcpkgTriplet = "arm64-windows" + # Visual Studio ARM64 generators do not accept host=arm64 here. + $cmakeToolset = if ("${{ inputs.compiler }}" -eq "msvc") { "" } else { "ClangCL" } + $useTk = "OFF" + $useOpenVr = "OFF" + } + default { + throw "Unsupported Windows target architecture: $targetArch" + } + } + + $cmakeArgs = @( + "-A", $cmakeArch, + "-D", "USE_FREETYPE=ON", + "-D", "USE_TK=$useTk", + "-D", "BUILD_USE_PCH=${{ inputs.build-use-pch }}", + "-D", "BUILD_OPT_PROFILE=${{ inputs.build-opt-profile }}", + "-D", "BUILD_INCLUDE_SYMLINK=ON", + "-D", "CMAKE_BUILD_TYPE=${{ inputs.cmake-build-type }}", + "-D", "INSTALL_DIR=${{ github.workspace }}/install", + "-D", "BUILD_USE_VCPKG=ON", + "-D", "VCPKG_TARGET_TRIPLET=$vcpkgTriplet", + "-D", "USE_D3D=ON", + "-D", "USE_DRACO=ON", + "-D", "USE_FFMPEG=ON", + "-D", "USE_FREEIMAGE=ON", + "-D", "USE_GLES2=ON", + "-D", "USE_OPENVR=$useOpenVr", + "-D", "USE_VTK=${{ inputs.use-vtk }}", + "-D", "USE_TBB=ON", + "-D", "USE_RAPIDJSON=ON", + "-D", "USE_OPENGL=ON", + "-D", "BUILD_GTEST=ON", + "-D", "BUILD_CPP_STANDARD=C++17", + "-D", "INSTALL_GTEST=ON" + ) + + if ($cmakeToolset) { + $cmakeArgs = @("-T", $cmakeToolset) + $cmakeArgs + } + + if ("${{ inputs.additional-cmake-flags }}") { + $cmakeArgs += "${{ inputs.additional-cmake-flags }}" + } + $cmakeArgs += ".." + + & cmake @cmakeArgs + if ($LASTEXITCODE -ne 0) { + exit $LASTEXITCODE + } echo "Configuration completed successfully for Windows" shell: pwsh @@ -166,4 +207,4 @@ runs: -D INSTALL_GTEST=ON \ ${{ inputs.additional-cmake-flags }} .. echo "Configuration completed successfully for Linux" - shell: bash \ No newline at end of file + shell: bash diff --git a/adm/cmake/occt_macros.cmake b/adm/cmake/occt_macros.cmake index 2c2a03a827..11c686a1a4 100644 --- a/adm/cmake/occt_macros.cmake +++ b/adm/cmake/occt_macros.cmake @@ -842,12 +842,12 @@ function (PROCESS_CSF_LIBRARIES CURRENT_CSF LIST_NAME TARGET_NAME) endfunction() macro(OCCT_ADD_VCPKG_FEATURE THE_FEATURE) if (BUILD_USE_VCPKG) - list(APPEND VCPKG_MANIFEST_FEATURES "${THE_FEATURE}" PARENT_SCOPE) + list(APPEND VCPKG_MANIFEST_FEATURES "${THE_FEATURE}") endif() endmacro() macro (OCCT_UNSET_VCPKG_FEATURE THE_FEATURE) if (BUILD_USE_VCPKG) - list (REMOVE_ITEM VCPKG_MANIFEST_FEATURES "${THE_FEATURE}" PARENT_SCOPE) + list (REMOVE_ITEM VCPKG_MANIFEST_FEATURES "${THE_FEATURE}") endif() endmacro() diff --git a/adm/vcpkg/ports/tcl/portfile.cmake b/adm/vcpkg/ports/tcl/portfile.cmake index d46032ccd7..3fff89d759 100644 --- a/adm/vcpkg/ports/tcl/portfile.cmake +++ b/adm/vcpkg/ports/tcl/portfile.cmake @@ -33,19 +33,17 @@ endif() # Use Windows NMAKE build for MSVC, but Unix build for MinGW if (VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) - if(VCPKG_TARGET_ARCHITECTURE MATCHES "x64") + if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") set(TCL_BUILD_MACHINE_STR MACHINE=AMD64) set(TCL_BUILD_ARCH_STR ARCH=AMD64) - elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "arm") + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") set(TCL_BUILD_MACHINE_STR MACHINE=ARM64) set(TCL_BUILD_ARCH_STR ARCH=ARM64) - elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86") + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") set(TCL_BUILD_MACHINE_STR MACHINE=IX86) set(TCL_BUILD_ARCH_STR ARCH=IX86) else() - # Default fallback for unknown architectures - set(TCL_BUILD_MACHINE_STR MACHINE=IX86) - set(TCL_BUILD_ARCH_STR ARCH=IX86) + message(FATAL_ERROR "Unsupported Windows Tcl architecture: ${VCPKG_TARGET_ARCHITECTURE}") endif() # Handle features diff --git a/adm/vcpkg/ports/tcl/vcpkg.json b/adm/vcpkg/ports/tcl/vcpkg.json index e1acd43e1a..60325b95cf 100644 --- a/adm/vcpkg/ports/tcl/vcpkg.json +++ b/adm/vcpkg/ports/tcl/vcpkg.json @@ -4,7 +4,7 @@ "port-version": 1, "description": "Tcl provides a powerful platform for creating integration applications that tie together diverse applications, protocols, devices, and frameworks. When paired with the Tk toolkit, Tcl provides the fastest and most powerful way to create GUI applications that run on PCs, Unix, and Mac OS X. Tcl can also be used for a variety of web-related tasks and for creating powerful command languages for applications.", "homepage": "https://github.com/tcltk/tcl", - "supports": "!android & !(windows & arm) & !uwp", + "supports": "!android & !uwp & (!(windows & arm) | (windows & arm64))", "dependencies": [ "zlib" ],