mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-05-11 01:58:22 +08:00
Testing - Add support for ARM64 architecture (#1149)
- 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.
This commit is contained in:
5
.github/actions/build-occt/action.yml
vendored
5
.github/actions/build-occt/action.yml
vendored
@@ -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 }}
|
||||
|
||||
91
.github/actions/configure-occt/action.yml
vendored
91
.github/actions/configure-occt/action.yml
vendored
@@ -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
|
||||
shell: bash
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user