From 7e3b83b1468cff4d51c541d1bca477b4763b499b Mon Sep 17 00:00:00 2001 From: Anthony Roberts Date: Wed, 6 Mar 2024 15:45:51 +0100 Subject: [PATCH] Build: Add Windows ARM64 support for library dependencies * VS2022 is required. * Only OpenPGL and DPCPP are disabled, other libraries are supported. * Embree is built with LLVM and VS2019 tools, and for that reason has its own cmake file as it is quite different. * TBB and USD patches should become obsolete once these are upstreamed and Blender upgrades to the latest versions. Ref #119126 Pull Request: https://projects.blender.org/blender/blender/pulls/117036 --- build_files/build_environment/CMakeLists.txt | 18 +- build_files/build_environment/cmake/aom.cmake | 4 +- .../cmake/boost_build_options.cmake | 5 +- .../cmake/embree_windows_arm.cmake | 114 ++++ build_files/build_environment/cmake/gmp.cmake | 2 + .../build_environment/cmake/harvest.cmake | 4 +- .../build_environment/cmake/ispc.cmake | 7 +- .../build_environment/cmake/lame.cmake | 6 +- .../build_environment/cmake/llvm.cmake | 6 +- .../cmake/openimagedenoise.cmake | 19 +- .../build_environment/cmake/openimageio.cmake | 6 +- .../build_environment/cmake/opensubdiv.cmake | 4 +- .../build_environment/cmake/openvdb.cmake | 13 +- .../build_environment/cmake/options.cmake | 24 +- .../build_environment/cmake/python.cmake | 19 +- .../build_environment/cmake/setup_msys2.cmake | 2 +- .../build_environment/cmake/sse2neon.cmake | 12 +- build_files/build_environment/cmake/usd.cmake | 3 + build_files/build_environment/cmake/vpx.cmake | 4 +- .../build_environment/cmake/vulkan.cmake | 5 + .../patches/cmakelists_tbb.txt | 8 +- .../build_environment/patches/embree.diff | 15 +- .../patches/embree_Directory.Build.Props.in | 7 + .../build_environment/patches/level-zero.diff | 20 +- .../patches/openjpeg_msvc.diff | 13 + .../build_environment/patches/pthreads.diff | 39 +- .../patches/python_windows_arm64.diff | 34 + ...n_windows.diff => python_windows_x64.diff} | 0 .../build_environment/patches/tbb.diff | 624 +++++++++++++++++- .../build_environment/patches/usd.diff | 117 +++- .../build_environment/windows/build_deps.cmd | 30 +- 31 files changed, 1092 insertions(+), 92 deletions(-) create mode 100644 build_files/build_environment/cmake/embree_windows_arm.cmake create mode 100644 build_files/build_environment/patches/embree_Directory.Build.Props.in create mode 100644 build_files/build_environment/patches/openjpeg_msvc.diff create mode 100644 build_files/build_environment/patches/python_windows_arm64.diff rename build_files/build_environment/patches/{python_windows.diff => python_windows_x64.diff} (100%) diff --git a/build_files/build_environment/CMakeLists.txt b/build_files/build_environment/CMakeLists.txt index e2098186d34..32e968dbd6d 100644 --- a/build_files/build_environment/CMakeLists.txt +++ b/build_files/build_environment/CMakeLists.txt @@ -100,8 +100,10 @@ include(cmake/fribidi.cmake) include(cmake/harfbuzz.cmake) if(NOT APPLE) include(cmake/xr_openxr.cmake) - include(cmake/dpcpp.cmake) - include(cmake/dpcpp_deps.cmake) + if(NOT BLENDER_PLATFORM_WINDOWS_ARM) + include(cmake/dpcpp.cmake) + include(cmake/dpcpp_deps.cmake) + endif() if(NOT WIN32) include(cmake/igc.cmake) include(cmake/gmmlib.cmake) @@ -109,13 +111,19 @@ if(NOT APPLE) endif() endif() include(cmake/ispc.cmake) +if(NOT BLENDER_PLATFORM_WINDOWS_ARM) + include(cmake/openpgl.cmake) +endif() # Embree needs to be included after dpcpp as it uses it for compiling with GPU support -include(cmake/embree.cmake) -include(cmake/openpgl.cmake) +if(BLENDER_PLATFORM_WINDOWS_ARM) + # WoA needs embree to be built with the VS Generator + LLVM, put it in it's own file to avoid clutter + include(cmake/embree_windows_arm.cmake) +else() + include(cmake/embree.cmake) +endif() include(cmake/fmt.cmake) include(cmake/robinmap.cmake) include(cmake/xml2.cmake) - # OpenColorIO and dependencies. include(cmake/expat.cmake) include(cmake/pystring.cmake) diff --git a/build_files/build_environment/cmake/aom.cmake b/build_files/build_environment/cmake/aom.cmake index 18f3af70a94..8f65c7afd4b 100644 --- a/build_files/build_environment/cmake/aom.cmake +++ b/build_files/build_environment/cmake/aom.cmake @@ -2,7 +2,9 @@ # # SPDX-License-Identifier: GPL-2.0-or-later -if(NOT WIN32) +if(BLENDER_PLATFORM_WINDOWS_ARM) + set(AOM_EXTRA_ARGS_WIN32 -DAOM_TARGET_CPU=generic) +else() set(AOM_CMAKE_FLAGS ${DEFAULT_CMAKE_FLAGS}) endif() diff --git a/build_files/build_environment/cmake/boost_build_options.cmake b/build_files/build_environment/cmake/boost_build_options.cmake index 656827bec4b..b4fe14b9b97 100644 --- a/build_files/build_environment/cmake/boost_build_options.cmake +++ b/build_files/build_environment/cmake/boost_build_options.cmake @@ -10,7 +10,10 @@ else() endif() if(WIN32) - if(MSVC_VERSION GREATER_EQUAL 1920) # 2019 + if(MSVC_TOOLSET_VERSION GREATER_EQUAL 143) # 2022 + set(BOOST_TOOLSET toolset=msvc-14.3) + set(BOOST_COMPILER_STRING -vc143) + elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 142) # 2019 set(BOOST_TOOLSET toolset=msvc-14.2) set(BOOST_COMPILER_STRING -vc142) else() # 2017 diff --git a/build_files/build_environment/cmake/embree_windows_arm.cmake b/build_files/build_environment/cmake/embree_windows_arm.cmake new file mode 100644 index 00000000000..cc0b246aa6f --- /dev/null +++ b/build_files/build_environment/cmake/embree_windows_arm.cmake @@ -0,0 +1,114 @@ +# SPDX-FileCopyrightText: 2017-2023 Blender Authors +# +# SPDX-License-Identifier: GPL-2.0-or-later + +# Note the utility apps may use png/tiff/gif system libraries, but the +# library itself does not depend on them, so should give no problems. + +set(EMBREE_CMAKE_FLAGS ${DEFAULT_CMAKE_FLAGS}) + +set(EMBREE_EXTRA_ARGS + -DEMBREE_ISPC_SUPPORT=OFF + -DEMBREE_TUTORIALS=OFF + -DEMBREE_STATIC_LIB=OFF + -DEMBREE_RAY_MASK=ON + -DEMBREE_FILTER_FUNCTION=ON + -DEMBREE_BACKFACE_CULLING=OFF + -DEMBREE_BACKFACE_CULLING_CURVES=ON + -DEMBREE_BACKFACE_CULLING_SPHERES=ON + -DEMBREE_NO_SPLASH=ON + -DEMBREE_TASKING_SYSTEM=TBB + -DEMBREE_TBB_ROOT=${LIBDIR}/tbb + -DTBB_ROOT=${LIBDIR}/tbb +) + +set(EMBREE_EXTRA_ARGS + ${EMBREE_EXTRA_ARGS} + -DCMAKE_DEBUG_POSTFIX=_d +) + +set(EMBREE_LLVM_INSTALL_PATH ${LIBDIR}/llvm) + +set(EMBREE_CMAKE_FLAGS + -DCMAKE_BUILD_TYPE=${BUILD_MODE} +) +set(EMBREE_EXTRA_ARGS + -DCMAKE_CXX_COMPILER=${EMBREE_LLVM_INSTALL_PATH}/bin/clang-cl.exe + -DCMAKE_C_COMPILER=${EMBREE_LLVM_INSTALL_PATH}/bin/clang-cl.exe + -DCMAKE_C_FLAGS_INIT="--target=arm64-pc-windows-msvc" + -DCMAKE_CXX_FLAGS_INIT="--target=arm64-pc-windows-msvc" + -DCMAKE_SHARED_LINKER_FLAGS=-L"${LIBDIR}/llvm/lib" + ${EMBREE_EXTRA_ARGS} +) + +# We want the VS2019 tools for embree, as they are stable. +# We cannot use VS2022 easily, unless we specify an older (unsupported) toolset such as 17.35, +# as the newer toolsets mandate LLVM 16, which we cannot use currently, due to lack of support in OSL and ISPC. +set(EMBREE_VCTOOLS_REQUIRED_VERSION 14.29) + +# Extract the list of installed tools that match the required version from the `VCToolsInstallDir` env var +file(TO_CMAKE_PATH $ENV{VCToolsInstallDir} EMBREE_VCTOOLSINSTALLDIR_PATH) +cmake_path(GET EMBREE_VCTOOLSINSTALLDIR_PATH PARENT_PATH EMBREE_VCTOOLSDIR_PATH) +file(GLOB EMBREE_INSTALLED_VCTOOLS RELATIVE ${EMBREE_VCTOOLSDIR_PATH} ${EMBREE_VCTOOLSDIR_PATH}/${EMBREE_VCTOOLS_REQUIRED_VERSION}*) + +# Check that at least one the installed tool versions (there may be different subversions) is present +if(NOT EMBREE_INSTALLED_VCTOOLS) + message(FATAL_ERROR "When building for Windows ARM64 platforms, embree requires VC Tools ${EMBREE_VCTOOLS_REQUIRED_VERSION} to be installed alongside the current version.") +endif() + +# Get the last item in the list (latest, when list is sorted) +list(SORT EMBREE_INSTALLED_VCTOOLS) +list(GET EMBREE_INSTALLED_VCTOOLS -1 EMBREE_VCTOOLS_VERSION) + +# Configure our in file and temporarily store it in the build dir (with modified extension so nothing else picks it up) +# This feels icky, but boost does something similar, and we haven't called ExternalProject_Add yet, so the embree dir does not yet exist +configure_file(${PATCH_DIR}/embree_Directory.Build.Props.in ${BUILD_DIR}/embree_Directory.Build.Props_temp) + +# Update the patch command to copy the configured build props file in +set(EMBREE_PATCH_COMMAND COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/embree_Directory.Build.Props_temp ${BUILD_DIR}/embree/src/external_embree-build/Directory.Build.Props && ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/embree/src/external_embree < ${PATCH_DIR}/embree.diff) + +# This all only works if we use the VS generator (with clangcl toolset), so switch back to that +# Note: there is literally no way to get ninja to use a different toolset other than manually overwriting every env var, or calling a nested vcvarsall, both of which are *messy* +set(EMBREE_GENERATOR ${CMAKE_GENERATOR}) +set(EMBREE_GENERATOR_TOOLSET ClangCL) + +if(TBB_STATIC_LIBRARY) + set(EMBREE_EXTRA_ARGS + ${EMBREE_EXTRA_ARGS} + -DEMBREE_TBB_COMPONENT=tbb_static + ) +endif() + +ExternalProject_Add(external_embree + URL file://${PACKAGE_DIR}/${EMBREE_FILE} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH ${EMBREE_HASH_TYPE}=${EMBREE_HASH} + CMAKE_GENERATOR ${EMBREE_GENERATOR} + CMAKE_GENERATOR_TOOLSET ${EMBREE_GENERATOR_TOOLSET} + PREFIX ${BUILD_DIR}/embree + PATCH_COMMAND ${EMBREE_PATCH_COMMAND} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/embree ${EMBREE_CMAKE_FLAGS} ${EMBREE_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/embree +) + +add_dependencies( + external_embree + external_tbb + ll +) + +if(BUILD_MODE STREQUAL Release) + ExternalProject_Add_Step(external_embree after_install + COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/embree/include ${HARVEST_TARGET}/embree/include + COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/embree/lib ${HARVEST_TARGET}/embree/lib + COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/embree/share ${HARVEST_TARGET}/embree/share + COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/bin/embree4.dll ${HARVEST_TARGET}/embree/bin/embree4.dll + DEPENDEES install + ) +else() + ExternalProject_Add_Step(external_embree after_install + COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/bin/embree4_d.dll ${HARVEST_TARGET}/embree/bin/embree4_d.dll + COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree4_d.lib ${HARVEST_TARGET}/embree/lib/embree4_d.lib + DEPENDEES install + ) +endif() diff --git a/build_files/build_environment/cmake/gmp.cmake b/build_files/build_environment/cmake/gmp.cmake index 04fbbb1b06b..0fb38a4e214 100644 --- a/build_files/build_environment/cmake/gmp.cmake +++ b/build_files/build_environment/cmake/gmp.cmake @@ -32,6 +32,8 @@ if(WIN32) ac_cv_prog_YACC=: ac_cv_prog_ac_ct_STRIP=: ac_cv_prog_RANLIB=: + lt_cv_to_host_file_cmd=func_convert_file_noop + lt_cv_to_tool_file_cmd=func_convert_file_noop ) if(BLENDER_PLATFORM_ARM) diff --git a/build_files/build_environment/cmake/harvest.cmake b/build_files/build_environment/cmake/harvest.cmake index 1c50d529736..1e8948e7e8d 100644 --- a/build_files/build_environment/cmake/harvest.cmake +++ b/build_files/build_environment/cmake/harvest.cmake @@ -29,9 +29,7 @@ if(WIN32) ${HARVEST_TARGET}/png/lib/libpng.lib && ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/png/include/ - ${HARVEST_TARGET}/png/include/ && - - DEPENDS + ${HARVEST_TARGET}/png/include/ ) endif() diff --git a/build_files/build_environment/cmake/ispc.cmake b/build_files/build_environment/cmake/ispc.cmake index 90c9c860240..9fd9bcfd247 100644 --- a/build_files/build_environment/cmake/ispc.cmake +++ b/build_files/build_environment/cmake/ispc.cmake @@ -7,9 +7,14 @@ if(WIN32) -DFLEX_EXECUTABLE=${LIBDIR}/flexbison/win_flex.exe -DBISON_EXECUTABLE=${LIBDIR}/flexbison/win_bison.exe -DM4_EXECUTABLE=${DOWNLOAD_DIR}/msys2/msys64/usr/bin/m4.exe - -DARM_ENABLED=Off -DPython3_FIND_REGISTRY=NEVER ) + + if(BLENDER_PLATFORM_ARM) + set(ISPC_EXTRA_ARGS_WIN ${ISPC_EXTRA_ARGS_WIN} -DARM_ENABLED=On) + else() + set(ISPC_EXTRA_ARGS_WIN ${ISPC_EXTRA_ARGS_WIN} -DARM_ENABLED=Off) + endif() elseif(APPLE) # Use bison and flex installed via Homebrew. # The ones that come with Xcode toolset are too old. diff --git a/build_files/build_environment/cmake/lame.cmake b/build_files/build_environment/cmake/lame.cmake index 5491f0aedf5..3b23640d4f5 100644 --- a/build_files/build_environment/cmake/lame.cmake +++ b/build_files/build_environment/cmake/lame.cmake @@ -4,7 +4,11 @@ set(LAME_EXTRA_ARGS) if(MSVC) - set(LAME_ARCH Win64) + if(BLENDER_PLATFORM_ARM) + set(LAME_ARCH ARM64) + else() + set(LAME_ARCH Win64) + endif() set(LAME_CONFIGURE echo .) set(LAME_BUILD cd ${BUILD_DIR}/lame/src/external_lame/ && diff --git a/build_files/build_environment/cmake/llvm.cmake b/build_files/build_environment/cmake/llvm.cmake index c27a5f37c88..68214a5208e 100644 --- a/build_files/build_environment/cmake/llvm.cmake +++ b/build_files/build_environment/cmake/llvm.cmake @@ -13,8 +13,10 @@ if(APPLE) -DLIBXML2_LIBRARY=${LIBDIR}/xml2/lib/libxml2.a -DLIBXML2_INCLUDE_DIR=${LIBDIR}/xml2/include/libxml2 ) - set(LLVM_BUILD_CLANG_TOOLS_EXTRA ^^clang-tools-extra) + set(LLVM_EXTRA_PROJECTS ^^clang-tools-extra) set(BUILD_CLANG_TOOLS ON) +elseif(MSVC AND BLENDER_PLATFORM_ARM) + set(LLVM_EXTRA_PROJECTS ^^lld) else() # NVIDIA PTX for OSL on Windows and Linux. set(LLVM_TARGETS ${LLVM_TARGETS}$NVPTX) @@ -31,7 +33,7 @@ set(LLVM_EXTRA_ARGS -DLLVM_ENABLE_UNWIND_TABLES=OFF -DLLVM_ENABLE_ZSTD=OFF -DLLVM_ENABLE_ZLIB=OFF - -DLLVM_ENABLE_PROJECTS=clang${LLVM_BUILD_CLANG_TOOLS_EXTRA} + -DLLVM_ENABLE_PROJECTS=clang${LLVM_EXTRA_PROJECTS} -DPython3_ROOT_DIR=${LIBDIR}/python/ -DPython3_EXECUTABLE=${PYTHON_BINARY} ${LLVM_XML2_ARGS} diff --git a/build_files/build_environment/cmake/openimagedenoise.cmake b/build_files/build_environment/cmake/openimagedenoise.cmake index 2585de31aea..db19ba08dd6 100644 --- a/build_files/build_environment/cmake/openimagedenoise.cmake +++ b/build_files/build_environment/cmake/openimagedenoise.cmake @@ -17,15 +17,22 @@ if(APPLE) else() set(OIDN_EXTRA_ARGS ${OIDN_EXTRA_ARGS} - -DOIDN_DEVICE_SYCL=ON - -DOIDN_DEVICE_SYCL_AOT=OFF - -DOIDN_DEVICE_CUDA=ON - -DOIDN_DEVICE_HIP=ON + -DOIDN_DEVICE_CPU=ON -DLEVEL_ZERO_ROOT=${LIBDIR}/level-zero ) + + # x64 platforms support SyCL, ARM64 don't + if(NOT BLENDER_PLATFORM_WINDOWS_ARM) + set(OIDN_EXTRA_ARGS + ${OIDN_EXTRA_ARGS} + -DOIDN_DEVICE_SYCL=ON + -DOIDN_DEVICE_SYCL_AOT=OFF + -DOIDN_DEVICE_CUDA=ON + -DOIDN_DEVICE_HIP=ON) + endif() endif() -if(WIN32) +if(WIN32 AND NOT BLENDER_PLATFORM_WINDOWS_ARM) set(OIDN_EXTRA_ARGS ${OIDN_EXTRA_ARGS} -DTBB_DEBUG_LIBRARY=${LIBDIR}/tbb/lib/tbb.lib @@ -41,7 +48,7 @@ if(WIN32) -DCMAKE_EXE_LINKER_FLAGS=-L"${LIBDIR}/dpcpp/lib" ) else() - if(NOT APPLE) + if(NOT (APPLE OR BLENDER_PLATFORM_WINDOWS_ARM)) set(OIDN_EXTRA_ARGS ${OIDN_EXTRA_ARGS} -DCMAKE_CXX_COMPILER=${LIBDIR}/dpcpp/bin/clang++ diff --git a/build_files/build_environment/cmake/openimageio.cmake b/build_files/build_environment/cmake/openimageio.cmake index 534ab069bb9..c0f40f8fa7c 100644 --- a/build_files/build_environment/cmake/openimageio.cmake +++ b/build_files/build_environment/cmake/openimageio.cmake @@ -17,7 +17,11 @@ else() endif() if(WIN32) - set(OIIO_SIMD_FLAGS -DUSE_SIMD=sse2) + if(BLENDER_PLATFORM_ARM) + set(OIIO_SIMD_FLAGS -DUSE_SIMD=0) + else() + set(OIIO_SIMD_FLAGS -DUSE_SIMD=sse2) + endif() set(OPENJPEG_POSTFIX _msvc) if(BUILD_MODE STREQUAL Debug) set(TIFF_POSTFIX d) diff --git a/build_files/build_environment/cmake/opensubdiv.cmake b/build_files/build_environment/cmake/opensubdiv.cmake index 11ae926702f..498e32ba5ac 100644 --- a/build_files/build_environment/cmake/opensubdiv.cmake +++ b/build_files/build_environment/cmake/opensubdiv.cmake @@ -58,8 +58,8 @@ if(WIN32) COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opensubdiv/lib/osdCPU.lib ${HARVEST_TARGET}/opensubdiv/lib/osdCPU_d.lib - COMMAND ${CMAKE_COMMAND} -E copy $ - {LIBDIR}/opensubdiv/lib/osdGPU.lib + COMMAND ${CMAKE_COMMAND} -E copy + ${LIBDIR}/opensubdiv/lib/osdGPU.lib ${HARVEST_TARGET}/opensubdiv/lib/osdGPU_d.lib DEPENDEES install diff --git a/build_files/build_environment/cmake/openvdb.cmake b/build_files/build_environment/cmake/openvdb.cmake index 36f59aa6bbd..cebdc46681d 100644 --- a/build_files/build_environment/cmake/openvdb.cmake +++ b/build_files/build_environment/cmake/openvdb.cmake @@ -87,6 +87,11 @@ add_dependencies( ) if(WIN32) + if(BLENDER_PLATFORM_ARM) + set(OPENVDB_ARCH arm64) + else() + set(OPENVDB_ARCH amd64) + endif() if(BUILD_MODE STREQUAL Release) ExternalProject_Add_Step(openvdb after_install COMMAND ${CMAKE_COMMAND} -E copy_directory @@ -99,8 +104,8 @@ if(WIN32) ${LIBDIR}/openvdb/bin/openvdb.dll ${HARVEST_TARGET}/openvdb/bin/openvdb.dll COMMAND ${CMAKE_COMMAND} -E copy - ${LIBDIR}/openvdb/lib/python${PYTHON_SHORT_VERSION}/site-packages/pyopenvdb.cp${PYTHON_SHORT_VERSION_NO_DOTS}-win_amd64.pyd - ${HARVEST_TARGET}openvdb/python/pyopenvdb.cp${PYTHON_SHORT_VERSION_NO_DOTS}-win_amd64.pyd + ${LIBDIR}/openvdb/lib/python${PYTHON_SHORT_VERSION}/site-packages/pyopenvdb.cp${PYTHON_SHORT_VERSION_NO_DOTS}-win_${OPENVDB_ARCH}.pyd + ${HARVEST_TARGET}openvdb/python/pyopenvdb.cp${PYTHON_SHORT_VERSION_NO_DOTS}-win_${OPENVDB_ARCH}.pyd DEPENDEES install ) @@ -114,8 +119,8 @@ if(WIN32) ${LIBDIR}/openvdb/bin/openvdb_d.dll ${HARVEST_TARGET}/openvdb/bin/openvdb_d.dll COMMAND ${CMAKE_COMMAND} -E copy - ${LIBDIR}/openvdb/lib/python${PYTHON_SHORT_VERSION}/site-packages/pyopenvdb_d.cp${PYTHON_SHORT_VERSION_NO_DOTS}-win_amd64.pyd - ${HARVEST_TARGET}openvdb/python/pyopenvdb_d.cp${PYTHON_SHORT_VERSION_NO_DOTS}-win_amd64.pyd + ${LIBDIR}/openvdb/lib/python${PYTHON_SHORT_VERSION}/site-packages/pyopenvdb_d.cp${PYTHON_SHORT_VERSION_NO_DOTS}-win_${OPENVDB_ARCH}.pyd + ${HARVEST_TARGET}openvdb/python/pyopenvdb_d.cp${PYTHON_SHORT_VERSION_NO_DOTS}-win_${OPENVDB_ARCH}.pyd DEPENDEES install ) diff --git a/build_files/build_environment/cmake/options.cmake b/build_files/build_environment/cmake/options.cmake index 7e78e423d18..1073fa50cd8 100644 --- a/build_files/build_environment/cmake/options.cmake +++ b/build_files/build_environment/cmake/options.cmake @@ -41,6 +41,10 @@ message("PATCH_DIR = ${PATCH_DIR}") message("BUILD_DIR = ${BUILD_DIR}") if(WIN32) + if(CMAKE_SYSTEM_PROCESSOR MATCHES ARM64) + set(BLENDER_PLATFORM_ARM ON) + set(BLENDER_PLATFORM_WINDOWS_ARM ON) + endif() set(PATCH_CMD ${DOWNLOAD_DIR}/msys2/msys64/usr/bin/patch.exe) set(LIBEXT ".lib") set(SHAREDLIBEXT ".lib") @@ -112,7 +116,25 @@ if(WIN32) set(PLATFORM_FLAGS) set(PLATFORM_CXX_FLAGS) - set(PLATFORM_CMAKE_FLAGS) + + if(BLENDER_PLATFORM_ARM) + # In some cases on ARM64 (unsure why), dep builds using the "Ninja" generator appear to use + # the x86 host tools (ie, x86 cl.exe producing ARM64 binaries). This is problematic when + # building things like LLVM, as memory is limited to 3GB, giving internal compiler errors. + # Here, we set CMAKE_C_COMPILER et al via PLATFORM_CMAKE_FLAGS to point to the ARM64 native + # binary, which doesn't have this issue. + # We make an assumption that the tools (ie, right now in the code) are the ones we want + set(PLATFORM_CMAKE_FLAGS + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_AR=${CMAKE_AR} + -DCMAKE_LINKER=${CMAKE_LINKER} + -DCMAKE_MT=${CMAKE_MT} + -DCMAKE_RC_COMPILER=${CMAKE_RC_COMPILER} + ) + else() + set(PLATFORM_CMAKE_FLAGS) + endif() set(MINGW_PATH ${DOWNLOAD_DIR}/msys2/msys64/) set(MINGW_SHELL ming64sh.cmd) diff --git a/build_files/build_environment/cmake/python.cmake b/build_files/build_environment/cmake/python.cmake index e2cf2141c7c..19e556fc6c5 100644 --- a/build_files/build_environment/cmake/python.cmake +++ b/build_files/build_environment/cmake/python.cmake @@ -9,13 +9,24 @@ if(BUILD_MODE STREQUAL Debug) endif() if(WIN32) - set(PYTHON_BINARY_INTERNAL ${BUILD_DIR}/python/src/external_python/PCBuild/amd64/python${PYTHON_POSTFIX}.exe) set(PYTHON_BINARY ${LIBDIR}/python/python${PYTHON_POSTFIX}.exe) set(PYTHON_SRC ${BUILD_DIR}/python/src/external_python/) macro(cmake_to_dos_path MsysPath ResultingPath) string(REPLACE "/" "\\" ${ResultingPath} "${MsysPath}") endmacro() + if(BLENDER_PLATFORM_ARM) + set(PYTHON_BINARY_INTERNAL ${BUILD_DIR}/python/src/external_python/PCBuild/arm64/python${PYTHON_POSTFIX}.exe) + set(PYTHON_BAT_ARCH arm64) + set(PYTHON_INSTALL_ARCH_FOLDER ${PYTHON_SRC}/PCbuild/arm64) + set(PYTHON_PATCH_FILE python_windows_arm64.diff) + else() + set(PYTHON_BINARY_INTERNAL ${BUILD_DIR}/python/src/external_python/PCBuild/amd64/python${PYTHON_POSTFIX}.exe) + set(PYTHON_BAT_ARCH x64) + set(PYTHON_INSTALL_ARCH_FOLDER ${PYTHON_SRC}/PCbuild/amd64) + set(PYTHON_PATCH_FILE python_windows_x64.diff) + endif() + set(PYTHON_EXTERNALS_FOLDER ${BUILD_DIR}/python/src/external_python/externals) set(ZLIB_SOURCE_FOLDER ${BUILD_DIR}/zlib/src/external_zlib) set(SSL_SOURCE_FOLDER ${BUILD_DIR}/ssl/src/external_ssl) @@ -44,7 +55,7 @@ if(WIN32) ${PYTHON_EXTERNALS_FOLDER}/zlib-1.2.13/zconf.h && ${PATCH_CMD} --verbose -p1 -d ${BUILD_DIR}/python/src/external_python < - ${PATCH_DIR}/python_windows.diff + ${PATCH_DIR}/${PYTHON_PATCH_FILE} CONFIGURE_COMMAND echo "." @@ -53,10 +64,10 @@ if(WIN32) set IncludeTkinter=false && set LDFLAGS=/DEBUG && call prepare_ssl.bat && - call build.bat -e -p x64 -c ${BUILD_MODE} + call build.bat -e -p ${PYTHON_BAT_ARCH} -c ${BUILD_MODE} INSTALL_COMMAND ${PYTHON_BINARY_INTERNAL} ${PYTHON_SRC}/PC/layout/main.py - -b ${PYTHON_SRC}/PCbuild/amd64 + -b ${PYTHON_INSTALL_ARCH_FOLDER} -s ${PYTHON_SRC} -t ${PYTHON_SRC}/tmp/ --include-stable diff --git a/build_files/build_environment/cmake/setup_msys2.cmake b/build_files/build_environment/cmake/setup_msys2.cmake index f82c49eda5f..dbf6de78dc4 100644 --- a/build_files/build_environment/cmake/setup_msys2.cmake +++ b/build_files/build_environment/cmake/setup_msys2.cmake @@ -58,7 +58,7 @@ if((NOT EXISTS "${DOWNLOAD_DIR}/msys2/msys64/msys2_shell.cmd") AND # Do initial upgrade of pacman packages (only required for initial setup, to get # latest packages as opposed to to what the installer comes with) execute_process( - COMMAND ${DOWNLOAD_DIR}/msys2/msys64/msys2_shell.cmd -defterm -no-start -clang64 -c "pacman -Syu --noconfirm && exit" + COMMAND ${DOWNLOAD_DIR}/msys2/msys64/msys2_shell.cmd -defterm -no-start -clang64 -c "pacman -Sy --noconfirm && exit" WORKING_DIRECTORY ${DOWNLOAD_DIR}/msys2/msys64 ) endif() diff --git a/build_files/build_environment/cmake/sse2neon.cmake b/build_files/build_environment/cmake/sse2neon.cmake index c8a8f494976..a75c5ac1ded 100644 --- a/build_files/build_environment/cmake/sse2neon.cmake +++ b/build_files/build_environment/cmake/sse2neon.cmake @@ -9,9 +9,13 @@ ExternalProject_Add(external_sse2neon PREFIX ${BUILD_DIR}/sse2neon CONFIGURE_COMMAND echo sse2neon - Nothing to configure BUILD_COMMAND echo sse2neon - nothing to build - - INSTALL_COMMAND mkdir -p ${LIBDIR}/sse2neon && - cp ${BUILD_DIR}/sse2neon/src/external_sse2neon/sse2neon.h ${LIBDIR}/sse2neon - + INSTALL_COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/sse2neon/src/external_sse2neon/sse2neon.h ${LIBDIR}/sse2neon INSTALL_DIR ${LIBDIR}/sse2neon ) + +if(BUILD_MODE STREQUAL Release AND WIN32) + ExternalProject_Add_Step(external_sse2neon after_install + COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/sse2neon ${HARVEST_TARGET}/sse2neon + DEPENDEES install + ) +endif() diff --git a/build_files/build_environment/cmake/usd.cmake b/build_files/build_environment/cmake/usd.cmake index 99ab8b3366c..ac5ef653d94 100644 --- a/build_files/build_environment/cmake/usd.cmake +++ b/build_files/build_environment/cmake/usd.cmake @@ -5,6 +5,9 @@ if(WIN32) # OIIO and OSL are statically linked for us, but USD doesn't know set(USD_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DOIIO_STATIC_DEFINE /DOSL_STATIC_DEFINE") + if(BLENDER_PLATFORM_ARM) + set(USD_CXX_FLAGS "${USD_CXX_FLAGS} /DOIIO_NO_SSE") + endif() if(BUILD_MODE STREQUAL Debug) # USD does not look for debug libs, nor does it link them # when building static, so this is just to keep find_package happy diff --git a/build_files/build_environment/cmake/vpx.cmake b/build_files/build_environment/cmake/vpx.cmake index 243885ec1c5..9ed28e6fad3 100644 --- a/build_files/build_environment/cmake/vpx.cmake +++ b/build_files/build_environment/cmake/vpx.cmake @@ -23,8 +23,8 @@ if(WIN32) if(BLENDER_PLATFORM_ARM) # ARM64 requires a min of vc142 - set(VPX_EXTRA_FLAGS --target=arm64-win64-vs16 --as=nasm) - set(VPX_INCL_ARCH nopost-nodocs-arm64) + set(VPX_EXTRA_FLAGS --target=arm64-win64-vs16 --as=nasm --disable-neon_dotprod --disable-neon_i8mm) + set(VPX_INCL_ARCH nopost-nodocs-arm64-win64) else() set(VPX_EXTRA_FLAGS --target=x86_64-win64-${VPX_COMPILER_STRING} --as=nasm) set(VPX_INCL_ARCH nodocs-x86_64-win64) diff --git a/build_files/build_environment/cmake/vulkan.cmake b/build_files/build_environment/cmake/vulkan.cmake index 80523563d52..f882cbc6417 100644 --- a/build_files/build_environment/cmake/vulkan.cmake +++ b/build_files/build_environment/cmake/vulkan.cmake @@ -30,6 +30,11 @@ if(UNIX AND NOT APPLE) -DPKG_WAYLAND_INCLUDE_DIRS=${LIBDIR}/wayland/include -DPKG_WAYLAND_LIBRARY_DIRS=${LIBDIR}/wayland/lib64 ) +elseif(BLENDER_PLATFORM_WINDOWS_ARM) + set(VULKAN_LOADER_EXTRA_ARGS + -DUSE_MASM=OFF + -DVulkanHeaders_DIR=${LIBDIR}/vulkan_headers/share/cmake/VulkanHeaders + ) endif() ExternalProject_Add(external_vulkan_loader diff --git a/build_files/build_environment/patches/cmakelists_tbb.txt b/build_files/build_environment/patches/cmakelists_tbb.txt index e05f27afdd6..2bcd8cfac1c 100644 --- a/build_files/build_environment/patches/cmakelists_tbb.txt +++ b/build_files/build_environment/patches/cmakelists_tbb.txt @@ -145,7 +145,7 @@ if (UNIX) elseif(WIN32) target_compile_definitions(tbb_interface INTERFACE USE_WINTHREAD _WIN32_WINNT=0x0600) - if (MSVC) + if (MSVC AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES ARM64) enable_language(ASM_MASM) target_compile_options(tbb_interface INTERFACE /GS- /Zc:wchar_t /Zc:forScope) check_cxx_compiler_flag ("/volatile:iso" SUPPORTS_VOLATILE_FLAG) @@ -209,7 +209,11 @@ endif() if (APPLE) set (ARCH_PREFIX "mac") elseif(WIN32) - set (ARCH_PREFIX "win") + if(CMAKE_SYSTEM_PROCESSOR MATCHES ARM64) + set (ARCH_PREFIX "winarm") + else() + set (ARCH_PREFIX "win") + endif() else() set (ARCH_PREFIX "lin") endif() diff --git a/build_files/build_environment/patches/embree.diff b/build_files/build_environment/patches/embree.diff index fe69493f89e..44b314d8e6a 100644 --- a/build_files/build_environment/patches/embree.diff +++ b/build_files/build_environment/patches/embree.diff @@ -1,5 +1,18 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7fa9423e2..6de9b072b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -242,7 +242,7 @@ OPTION(EMBREE_MIN_WIDTH "Enables min-width feature to enlarge curve and point th + IF (APPLE AND CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" OR CMAKE_OSX_ARCHITECTURES MATCHES "arm64")) + MESSAGE(STATUS "Building for Apple silicon") + SET(EMBREE_ARM ON) +-ELSEIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") ++ELSEIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64") + MESSAGE(STATUS "Building for AArch64") + SET(EMBREE_ARM ON) + ENDIF() diff --git a/kernels/CMakeLists.txt b/kernels/CMakeLists.txt -index 7c2f43d..106b1d5 100644 +index fae31f4a4..8bb3601e7 100644 --- a/kernels/CMakeLists.txt +++ b/kernels/CMakeLists.txt @@ -208,6 +208,12 @@ embree_files(EMBREE_LIBRARY_FILES_AVX512 ${AVX512}) diff --git a/build_files/build_environment/patches/embree_Directory.Build.Props.in b/build_files/build_environment/patches/embree_Directory.Build.Props.in new file mode 100644 index 00000000000..d3f7caa5fae --- /dev/null +++ b/build_files/build_environment/patches/embree_Directory.Build.Props.in @@ -0,0 +1,7 @@ + + + ${EMBREE_LLVM_INSTALL_PATH} + ${LLVM_VERSION} + ${EMBREE_VCTOOLS_VERSION} + + diff --git a/build_files/build_environment/patches/level-zero.diff b/build_files/build_environment/patches/level-zero.diff index 03106e03149..d28b3310d70 100644 --- a/build_files/build_environment/patches/level-zero.diff +++ b/build_files/build_environment/patches/level-zero.diff @@ -1,6 +1,7 @@ -diff -Naur external_levelzero_org/CMakeLists.txt external_levelzero/CMakeLists.txt ---- external_levelzero_org/CMakeLists.txt 2022-03-07 13:22:11 -0700 -+++ external_levelzero/CMakeLists.txt 2022-03-29 13:22:15 -0600 +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7e27816..bd34055 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt @@ -81,13 +81,6 @@ if(MSVC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /DYNAMICBASE") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DYNAMICBASE") @@ -13,5 +14,16 @@ diff -Naur external_levelzero_org/CMakeLists.txt external_levelzero/CMakeLists.t - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Qspectre") - endif() endif() - + #CXX compiler support +@@ -128,7 +121,9 @@ if(MSVC) + set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF") + + # enable CET shadow stack +- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /CETCOMPAT") ++ if(NOT CMAKE_SYSTEM_PROCESSOR MATCHES ARM64) ++ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /CETCOMPAT") ++ endif() + + #Use of sccache with MSVC requires workaround of replacing /Zi with /Z7 + #https://github.com/mozilla/sccache diff --git a/build_files/build_environment/patches/openjpeg_msvc.diff b/build_files/build_environment/patches/openjpeg_msvc.diff new file mode 100644 index 00000000000..e7aa76f0faa --- /dev/null +++ b/build_files/build_environment/patches/openjpeg_msvc.diff @@ -0,0 +1,13 @@ +diff --git a/src/lib/openjp2/ht_dec.c b/src/lib/openjp2/ht_dec.c +index 1eb4d525..e2f3afd6 100644 +--- a/src/lib/openjp2/ht_dec.c ++++ b/src/lib/openjp2/ht_dec.c +@@ -69,7 +69,7 @@ static OPJ_BOOL only_cleanup_pass_is_decoded = OPJ_FALSE; + static INLINE + OPJ_UINT32 population_count(OPJ_UINT32 val) + { +-#ifdef OPJ_COMPILER_MSVC ++#if defined(OPJ_COMPILER_MSVC) && (defined(_M_IX86) || defined(_M_AMD64)) + return (OPJ_UINT32)__popcnt(val); + #elif (defined OPJ_COMPILER_GNUC) + return (OPJ_UINT32)__builtin_popcount(val); diff --git a/build_files/build_environment/patches/pthreads.diff b/build_files/build_environment/patches/pthreads.diff index 4b6c9766e11..eae27bb8a45 100644 --- a/build_files/build_environment/patches/pthreads.diff +++ b/build_files/build_environment/patches/pthreads.diff @@ -1,6 +1,6 @@ -diff -Naur orig/Makefile external_pthreads/Makefile ---- orig/Makefile 2018-08-08 04:47:40 -0600 -+++ external_pthreads/Makefile 2020-05-09 11:20:28 -0600 +diff -Naur pthreads4w-clean/Makefile pthreads4w-dirty/Makefile +--- pthreads4w-clean/Makefile 2022-11-18 10:08:27.266563200 +0000 ++++ pthreads4w-dirty/Makefile 2022-11-18 10:16:59.465704400 +0000 @@ -185,7 +185,7 @@ @ $(MAKE) /E /nologo XCFLAGS="/MTd" EHFLAGS="$(VSEFLAGSD) /D__PTW32_STATIC_LIB /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_SEH pthreadVSE$(PTW32_VER_DEBUG).inlined_static_stamp @@ -10,3 +10,36 @@ diff -Naur orig/Makefile external_pthreads/Makefile VC-static-debug: @ $(MAKE) /E /nologo XCFLAGS="/MTd" EHFLAGS="$(VCFLAGSD) /D__PTW32_STATIC_LIB /D__PTW32_BUILD_INLINED" CLEANUP=__PTW32_CLEANUP_C pthreadVC$(PTW32_VER_DEBUG).inlined_static_stamp +diff -Naur pthreads4w-clean/context.h pthreads4w-dirty/context.h +--- pthreads4w-clean/context.h 2022-11-18 10:08:27.564507100 +0000 ++++ pthreads4w-dirty/context.h 2022-11-18 10:13:50.209986300 +0000 +@@ -62,7 +62,7 @@ + #endif + + #if defined(_ARM_) || defined(ARM) || defined(_M_ARM) || defined(_M_ARM64) +-#define PTW32_PROGCTR(Context) ((Context).Pc) ++#define __PTW32_PROGCTR(Context) ((Context).Pc) + #endif + + #if !defined (__PTW32_PROGCTR) +diff -Naur pthreads4w-clean/version.rc pthreads4w-dirty/version.rc +--- pthreads4w-clean/version.rc 2022-11-18 10:08:30.101359500 +0000 ++++ pthreads4w-dirty/version.rc 2022-11-18 10:14:44.651478200 +0000 +@@ -63,6 +63,17 @@ + # define __PTW32_VERSIONINFO_NAME "pthreadVSE2.DLL\0" + # define __PTW32_VERSIONINFO_DESCRIPTION "MS C SEH x86\0" + # endif ++# elif defined (__PTW32_ARCHARM64) ++# if defined(__PTW32_CLEANUP_C) ++# define __PTW32_VERSIONINFO_NAME "pthreadVC2.DLL\0" ++# define __PTW32_VERSIONINFO_DESCRIPTION "MS C arm64\0" ++# elif defined(__PTW32_CLEANUP_CXX) ++# define __PTW32_VERSIONINFO_NAME "pthreadVCE2.DLL\0" ++# define __PTW32_VERSIONINFO_DESCRIPTION "MS C++ arm64\0" ++# elif defined(__PTW32_CLEANUP_SEH) ++# define __PTW32_VERSIONINFO_NAME "pthreadVSE2.DLL\0" ++# define __PTW32_VERSIONINFO_DESCRIPTION "MS C SEH arm64\0" ++# endif + # endif + #elif defined(__GNUC__) + # if defined(_M_X64) diff --git a/build_files/build_environment/patches/python_windows_arm64.diff b/build_files/build_environment/patches/python_windows_arm64.diff new file mode 100644 index 00000000000..feb8296fbf5 --- /dev/null +++ b/build_files/build_environment/patches/python_windows_arm64.diff @@ -0,0 +1,34 @@ +--- a/PCbuild/prepare_ssl.bat 2022-10-30 11:48:14 -0600 ++++ b/PCbuild/prepare_ssl.bat 2022-10-30 11:53:16 -0600 +@@ -47,12 +47,13 @@ + if "%PERL%" == "" where perl > "%TEMP%\perl.loc" 2> nul && set /P PERL= <"%TEMP%\perl.loc" & del "%TEMP%\perl.loc" + if "%PERL%" == "" (echo Cannot locate perl.exe on PATH or as PERL variable & exit /b 4) + +-%MSBUILD% "%PCBUILD%\openssl.vcxproj" /p:Configuration=Release /p:Platform=Win32 +-if errorlevel 1 exit /b ++REM Blender: we only need x64, ssl is kind of a long build, so just build what we need ++REM %MSBUILD% "%PCBUILD%\openssl.vcxproj" /p:Configuration=Release /p:Platform=Win32 ++REM if errorlevel 1 exit /b +-%MSBUILD% "%PCBUILD%\openssl.vcxproj" /p:Configuration=Release /p:Platform=x64 +-if errorlevel 1 exit /b +-%MSBUILD% "%PCBUILD%\openssl.vcxproj" /p:Configuration=Release /p:Platform=ARM +-if errorlevel 1 exit /b ++REM %MSBUILD% "%PCBUILD%\openssl.vcxproj" /p:Configuration=Release /p:Platform=x64 ++REM if errorlevel 1 exit /b ++REM %MSBUILD% "%PCBUILD%\openssl.vcxproj" /p:Configuration=Release /p:Platform=ARM ++REM if errorlevel 1 exit /b + %MSBUILD% "%PCBUILD%\openssl.vcxproj" /p:Configuration=Release /p:Platform=ARM64 + if errorlevel 1 exit /b + +diff -aurw Python-3.10.12/PCbuild/openssl.vcxproj external_python/PCbuild/openssl.vcxproj +--- Python-3.10.12/PCbuild/openssl.vcxproj 2023-06-06 16:30:33 -0600 ++++ external_python/PCbuild/openssl.vcxproj 2023-06-20 08:50:43 -0600 +@@ -98,7 +98,7 @@ + + + +- <_Built Include="$(opensslDir)\LICENSE" /> ++ <_Built Include="$(opensslDir)\LICENSE.txt" /> + <_Built Include="$(IntDir)\libcrypto.lib;$(IntDir)\libcrypto-*.dll;$(IntDir)\libcrypto-*.pdb" /> + <_Built Include="$(IntDir)\libssl.lib;$(IntDir)\libssl-*.dll;$(IntDir)\libssl-*.pdb" /> + <_AppLink Include="$(opensslDir)\ms\applink.c" /> diff --git a/build_files/build_environment/patches/python_windows.diff b/build_files/build_environment/patches/python_windows_x64.diff similarity index 100% rename from build_files/build_environment/patches/python_windows.diff rename to build_files/build_environment/patches/python_windows_x64.diff diff --git a/build_files/build_environment/patches/tbb.diff b/build_files/build_environment/patches/tbb.diff index 07f70aa7007..dedf8225ae9 100644 --- a/build_files/build_environment/patches/tbb.diff +++ b/build_files/build_environment/patches/tbb.diff @@ -1,16 +1,191 @@ -diff --git a/include/tbb/tbb_config.h b/include/tbb/tbb_config.h -index 7a8d06a0..886699d8 100644 ---- a/include/tbb/tbb_config.h -+++ b/include/tbb/tbb_config.h -@@ -620,7 +620,7 @@ There are four cases that are supported: - // instantiation site, which is too late for suppression of the corresponding messages for internal - // stuff. - #if !defined(__INTEL_COMPILER) && (!defined(TBB_SUPPRESS_DEPRECATED_MESSAGES) || (TBB_SUPPRESS_DEPRECATED_MESSAGES == 0)) -- #if (__cplusplus >= 201402L) -+ #if (__cplusplus >= 201402L && (!defined(_MSC_VER) || _MSC_VER >= 1920)) - #define __TBB_DEPRECATED [[deprecated]] - #define __TBB_DEPRECATED_MSG(msg) [[deprecated(msg)]] - #elif _MSC_VER +diff --git a/include/tbb/machine/msvc_armv8.h b/include/tbb/machine/msvc_armv8.h +new file mode 100644 +index 00000000..13d56678 +--- /dev/null ++++ b/include/tbb/machine/msvc_armv8.h +@@ -0,0 +1,167 @@ ++/* ++ Copyright (c) 2005-2020 Intel Corporation ++ ++ Licensed under the Apache License, Version 2.0 (the "License"); ++ you may not use this file except in compliance with the License. ++ You may obtain a copy of the License at ++ ++ http://www.apache.org/licenses/LICENSE-2.0 ++ ++ Unless required by applicable law or agreed to in writing, software ++ distributed under the License is distributed on an "AS IS" BASIS, ++ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ See the License for the specific language governing permissions and ++ limitations under the License. ++*/ ++ ++#if !defined(__TBB_machine_H) || defined(__TBB_msvc_armv8_H) ++#error Do not #include this internal file directly; use public TBB headers instead. ++#endif ++ ++#define __TBB_msvc_armv8_H ++ ++#include ++#include ++ ++#define __TBB_WORDSIZE 8 ++ ++#define __TBB_ENDIANNESS __TBB_ENDIAN_UNSUPPORTED ++ ++#if defined(TBB_WIN32_USE_CL_BUILTINS) ++// We can test this on _M_IX86 ++#pragma intrinsic(_ReadWriteBarrier) ++#pragma intrinsic(_mm_mfence) ++#define __TBB_compiler_fence() _ReadWriteBarrier() ++#define __TBB_full_memory_fence() _mm_mfence() ++#define __TBB_control_consistency_helper() __TBB_compiler_fence() ++#define __TBB_acquire_consistency_helper() __TBB_compiler_fence() ++#define __TBB_release_consistency_helper() __TBB_compiler_fence() ++#else ++//Now __dmb(_ARM_BARRIER_SY) is used for both compiler and memory fences ++//This might be changed later after testing ++#define __TBB_compiler_fence() __dmb(_ARM64_BARRIER_SY) ++#define __TBB_full_memory_fence() __dmb(_ARM64_BARRIER_SY) ++#define __TBB_control_consistency_helper() __TBB_compiler_fence() ++#define __TBB_acquire_consistency_helper() __TBB_full_memory_fence() ++#define __TBB_release_consistency_helper() __TBB_full_memory_fence() ++#endif ++ ++//-------------------------------------------------- ++// Compare and swap ++//-------------------------------------------------- ++ ++/** ++ * Atomic CAS for 32 bit values, if *ptr==comparand, then *ptr=value, returns *ptr ++ * @param ptr pointer to value in memory to be swapped with value if *ptr==comparand ++ * @param value value to assign *ptr to if *ptr==comparand ++ * @param comparand value to compare with *ptr ++ * @return value originally in memory at ptr, regardless of success ++*/ ++ ++#define __TBB_MACHINE_DEFINE_ATOMICS_CMPSWP(S,T,F) \ ++inline T __TBB_machine_cmpswp##S( volatile void *ptr, T value, T comparand ) { \ ++ return _InterlockedCompareExchange##F(reinterpret_cast(ptr),value,comparand); \ ++} \ ++ ++#define __TBB_MACHINE_DEFINE_ATOMICS_FETCHADD(S,T,F) \ ++inline T __TBB_machine_fetchadd##S( volatile void *ptr, T value ) { \ ++ return _InterlockedExchangeAdd##F(reinterpret_cast(ptr),value); \ ++} \ ++ ++__TBB_MACHINE_DEFINE_ATOMICS_CMPSWP(1,char,8) ++__TBB_MACHINE_DEFINE_ATOMICS_CMPSWP(2,short,16) ++__TBB_MACHINE_DEFINE_ATOMICS_CMPSWP(4,long,) ++__TBB_MACHINE_DEFINE_ATOMICS_CMPSWP(8,__int64,64) ++__TBB_MACHINE_DEFINE_ATOMICS_FETCHADD(4,long,) ++#if defined(TBB_WIN32_USE_CL_BUILTINS) ++// No _InterlockedExchangeAdd64 intrinsic on _M_IX86 ++#define __TBB_64BIT_ATOMICS 0 ++#else ++__TBB_MACHINE_DEFINE_ATOMICS_FETCHADD(8,__int64,64) ++#endif ++ ++inline void __TBB_machine_pause (int32_t delay ) ++{ ++ while(delay>0) ++ { ++ __TBB_compiler_fence(); ++ delay--; ++ } ++} ++ ++// API to retrieve/update FPU control setting ++#define __TBB_CPU_CTL_ENV_PRESENT 1 ++ ++namespace tbb { ++namespace internal { ++ ++template ++struct machine_load_store_relaxed { ++ static inline T load ( const volatile T& location ) { ++ const T value = location; ++ ++ /* ++ * An extra memory barrier is required for errata #761319 ++ * Please see http://infocenter.arm.com/help/topic/com.arm.doc.uan0004a ++ */ ++ __TBB_acquire_consistency_helper(); ++ return value; ++ } ++ ++ static inline void store ( volatile T& location, T value ) { ++ location = value; ++ } ++}; ++ ++class cpu_ctl_env { ++private: ++ unsigned int my_ctl; ++public: ++ bool operator!=( const cpu_ctl_env& ctl ) const { return my_ctl != ctl.my_ctl; } ++ void get_env() { my_ctl = _control87(0, 0); } ++ void set_env() const { _control87( my_ctl, ~0U ); } ++}; ++ ++} // namespace internal ++} // namespaces tbb ++ ++// Machine specific atomic operations ++#define __TBB_CompareAndSwap4(P,V,C) __TBB_machine_cmpswp4(P,V,C) ++#define __TBB_CompareAndSwap8(P,V,C) __TBB_machine_cmpswp8(P,V,C) ++#define __TBB_Pause(V) __TBB_machine_pause(V) ++ ++// Use generics for some things ++#define __TBB_USE_FETCHSTORE_AS_FULL_FENCED_STORE 1 ++#define __TBB_USE_GENERIC_HALF_FENCED_LOAD_STORE 1 ++#define __TBB_USE_GENERIC_PART_WORD_FETCH_ADD 1 ++#define __TBB_USE_GENERIC_PART_WORD_FETCH_STORE 1 ++#define __TBB_USE_GENERIC_FETCH_STORE 1 ++#define __TBB_USE_GENERIC_DWORD_LOAD_STORE 0 ++#define __TBB_USE_GENERIC_SEQUENTIAL_CONSISTENCY_LOAD_STORE 1 ++ ++#if defined(TBB_WIN32_USE_CL_BUILTINS) ++#if !__TBB_WIN8UI_SUPPORT ++extern "C" __declspec(dllimport) int __stdcall SwitchToThread( void ); ++#define __TBB_Yield() SwitchToThread() ++#else ++#include ++#define __TBB_Yield() std::this_thread::yield() ++#endif ++#else ++#define __TBB_Yield() __yield() ++#endif ++ ++// Machine specific atomic operations ++#define __TBB_AtomicOR(P,V) __TBB_machine_OR(P,V) ++#define __TBB_AtomicAND(P,V) __TBB_machine_AND(P,V) ++ ++template ++inline void __TBB_machine_OR( T1 *operand, T2 addend ) { ++ _InterlockedOr((long volatile *)operand, (long)addend); ++} ++ ++template ++inline void __TBB_machine_AND( T1 *operand, T2 addend ) { ++ _InterlockedAnd((long volatile *)operand, (long)addend); ++} ++ +diff --git a/include/tbb/tbb_machine.h b/include/tbb/tbb_machine.h +index 9752be58..ebb98ec2 100644 +--- a/include/tbb/tbb_machine.h ++++ b/include/tbb/tbb_machine.h +@@ -208,6 +208,8 @@ template<> struct atomic_selector<8> { + #include "machine/windows_intel64.h" + #elif defined(_M_ARM) || defined(__TBB_WIN32_USE_CL_BUILTINS) + #include "machine/msvc_armv7.h" ++ #elif defined(_M_ARM64) ++ #include "machine/msvc_armv8.h" + #endif + + #ifdef _MANAGED +diff --git a/src/tbb/tools_api/ittnotify_config.h b/src/tbb/tools_api/ittnotify_config.h +index bdb4ec29..7c363f4f 100644 --- a/src/tbb/tools_api/ittnotify_config.h +++ b/src/tbb/tools_api/ittnotify_config.h @@ -162,7 +162,7 @@ @@ -18,7 +193,428 @@ index 7a8d06a0..886699d8 100644 # elif defined _M_IA64 || defined __ia64__ # define ITT_ARCH ITT_ARCH_IA64 -# elif defined _M_ARM || defined __arm__ -+# elif defined _M_ARM || defined __arm__ || defined __aarch64__ ++# elif defined _M_ARM || defined _M_ARM64 || defined __arm__ || defined __arm64__ # define ITT_ARCH ITT_ARCH_ARM # elif defined __powerpc64__ # define ITT_ARCH ITT_ARCH_PPC64 +diff --git a/src/tbb/winarm64-tbb-export.def b/src/tbb/winarm64-tbb-export.def +new file mode 100644 +index 00000000..813eb002 +--- /dev/null ++++ b/src/tbb/winarm64-tbb-export.def +@@ -0,0 +1,21 @@ ++; Copyright (c) 2005-2020 Intel Corporation ++; Copyright (c) 2022 Linaro Ltd. ++; ++; Licensed under the Apache License, Version 2.0 (the "License"); ++; you may not use this file except in compliance with the License. ++; You may obtain a copy of the License at ++; ++; http://www.apache.org/licenses/LICENSE-2.0 ++; ++; Unless required by applicable law or agreed to in writing, software ++; distributed under the License is distributed on an "AS IS" BASIS, ++; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++; See the License for the specific language governing permissions and ++; limitations under the License. ++ ++EXPORTS ++ ++#define __TBB_SYMBOL( sym ) sym ++#include "winarm64-tbb-export.lst" ++ ++ +diff --git a/src/tbb/winarm64-tbb-export.lst b/src/tbb/winarm64-tbb-export.lst +new file mode 100644 +index 00000000..a25d545e +--- /dev/null ++++ b/src/tbb/winarm64-tbb-export.lst +@@ -0,0 +1,310 @@ ++; Copyright (c) 2005-2020 Intel Corporation ++; ++; Licensed under the Apache License, Version 2.0 (the "License"); ++; you may not use this file except in compliance with the License. ++; You may obtain a copy of the License at ++; ++; http://www.apache.org/licenses/LICENSE-2.0 ++; ++; Unless required by applicable law or agreed to in writing, software ++; distributed under the License is distributed on an "AS IS" BASIS, ++; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++; See the License for the specific language governing permissions and ++; limitations under the License. ++ ++#include "tbb/tbb_config.h" ++ ++// cache_aligned_allocator.cpp ++__TBB_SYMBOL( ?NFS_Allocate@internal@tbb@@YAPEAX_K0PEAX@Z ) ++__TBB_SYMBOL( ?NFS_GetLineSize@internal@tbb@@YA_KXZ ) ++__TBB_SYMBOL( ?NFS_Free@internal@tbb@@YAXPEAX@Z ) ++__TBB_SYMBOL( ?allocate_via_handler_v3@internal@tbb@@YAPEAX_K@Z ) ++__TBB_SYMBOL( ?deallocate_via_handler_v3@internal@tbb@@YAXPEAX@Z ) ++__TBB_SYMBOL( ?is_malloc_used_v3@internal@tbb@@YA_NXZ ) ++ ++// task.cpp v3 ++__TBB_SYMBOL( ?allocate@allocate_additional_child_of_proxy@internal@tbb@@QEBAAEAVtask@3@_K@Z ) ++__TBB_SYMBOL( ?allocate@allocate_child_proxy@internal@tbb@@QEBAAEAVtask@3@_K@Z ) ++__TBB_SYMBOL( ?allocate@allocate_continuation_proxy@internal@tbb@@QEBAAEAVtask@3@_K@Z ) ++__TBB_SYMBOL( ?allocate@allocate_root_proxy@internal@tbb@@SAAEAVtask@3@_K@Z ) ++__TBB_SYMBOL( ?destroy@task_base@internal@interface5@tbb@@SAXAEAVtask@4@@Z ) ++__TBB_SYMBOL( ?free@allocate_additional_child_of_proxy@internal@tbb@@QEBAXAEAVtask@3@@Z ) ++__TBB_SYMBOL( ?free@allocate_child_proxy@internal@tbb@@QEBAXAEAVtask@3@@Z ) ++__TBB_SYMBOL( ?free@allocate_continuation_proxy@internal@tbb@@QEBAXAEAVtask@3@@Z ) ++__TBB_SYMBOL( ?free@allocate_root_proxy@internal@tbb@@SAXAEAVtask@3@@Z ) ++__TBB_SYMBOL( ?internal_set_ref_count@task@tbb@@AEAAXH@Z ) ++__TBB_SYMBOL( ?internal_decrement_ref_count@task@tbb@@AEAA_JXZ ) ++__TBB_SYMBOL( ?is_owned_by_current_thread@task@tbb@@QEBA_NXZ ) ++__TBB_SYMBOL( ?note_affinity@task@tbb@@UEAAXG@Z ) ++__TBB_SYMBOL( ?resize@affinity_partitioner_base_v3@internal@tbb@@AEAAXI@Z ) ++__TBB_SYMBOL( ?self@task@tbb@@SAAEAV12@XZ ) ++__TBB_SYMBOL( ?spawn_and_wait_for_all@task@tbb@@QEAAXAEAVtask_list@2@@Z ) ++__TBB_SYMBOL( ?default_num_threads@task_scheduler_init@tbb@@SAHXZ ) ++__TBB_SYMBOL( ?initialize@task_scheduler_init@tbb@@QEAAXH_K@Z ) ++__TBB_SYMBOL( ?initialize@task_scheduler_init@tbb@@QEAAXH@Z ) ++__TBB_SYMBOL( ?terminate@task_scheduler_init@tbb@@QEAAXXZ ) ++#if __TBB_SCHEDULER_OBSERVER ++__TBB_SYMBOL( ?observe@task_scheduler_observer_v3@internal@tbb@@QEAAX_N@Z ) ++#endif /* __TBB_SCHEDULER_OBSERVER */ ++ ++/* arena.cpp */ ++__TBB_SYMBOL( ?internal_max_concurrency@task_arena_base@internal@interface7@tbb@@KAHPEBVtask_arena@34@@Z ) ++__TBB_SYMBOL( ?internal_current_slot@task_arena_base@internal@interface7@tbb@@KAHXZ ) ++__TBB_SYMBOL( ?internal_initialize@task_arena_base@internal@interface7@tbb@@IEAAXXZ ) ++__TBB_SYMBOL( ?internal_terminate@task_arena_base@internal@interface7@tbb@@IEAAXXZ ) ++__TBB_SYMBOL( ?internal_attach@task_arena_base@internal@interface7@tbb@@IEAAXXZ ) ++__TBB_SYMBOL( ?internal_enqueue@task_arena_base@internal@interface7@tbb@@IEBAXAEAVtask@4@_J@Z ) ++__TBB_SYMBOL( ?internal_execute@task_arena_base@internal@interface7@tbb@@IEBAXAEAVdelegate_base@234@@Z ) ++__TBB_SYMBOL( ?internal_wait@task_arena_base@internal@interface7@tbb@@IEBAXXZ ) ++#if __TBB_TASK_ISOLATION ++__TBB_SYMBOL( ?isolate_within_arena@internal@interface7@tbb@@YAXAEAVdelegate_base@123@_J@Z ) ++#endif /* __TBB_TASK_ISOLATION */ ++ ++#if !TBB_NO_LEGACY ++// task_v2.cpp ++__TBB_SYMBOL( ?destroy@task@tbb@@QEAAXAEAV12@@Z ) ++#endif ++ ++// exception handling support ++#if __TBB_TASK_GROUP_CONTEXT ++__TBB_SYMBOL( ?allocate@allocate_root_with_context_proxy@internal@tbb@@QEBAAEAVtask@3@_K@Z ) ++__TBB_SYMBOL( ?free@allocate_root_with_context_proxy@internal@tbb@@QEBAXAEAVtask@3@@Z ) ++__TBB_SYMBOL( ?change_group@task@tbb@@QEAAXAEAVtask_group_context@2@@Z ) ++__TBB_SYMBOL( ?is_group_execution_cancelled@task_group_context@tbb@@QEBA_NXZ ) ++__TBB_SYMBOL( ?cancel_group_execution@task_group_context@tbb@@QEAA_NXZ ) ++__TBB_SYMBOL( ?reset@task_group_context@tbb@@QEAAXXZ ) ++__TBB_SYMBOL( ?capture_fp_settings@task_group_context@tbb@@QEAAXXZ ) ++__TBB_SYMBOL( ?init@task_group_context@tbb@@IEAAXXZ ) ++__TBB_SYMBOL( ?register_pending_exception@task_group_context@tbb@@QEAAXXZ ) ++__TBB_SYMBOL( ??1task_group_context@tbb@@QEAA@XZ ) ++#if __TBB_TASK_PRIORITY ++__TBB_SYMBOL( ?set_priority@task_group_context@tbb@@QEAAXW4priority_t@2@@Z ) ++__TBB_SYMBOL( ?priority@task_group_context@tbb@@QEBA?AW4priority_t@2@XZ ) ++#endif /* __TBB_TASK_PRIORITY */ ++__TBB_SYMBOL( ?name@captured_exception@tbb@@UEBAPEBDXZ ) ++__TBB_SYMBOL( ?what@captured_exception@tbb@@UEBAPEBDXZ ) ++__TBB_SYMBOL( ??1captured_exception@tbb@@UEAA@XZ ) ++__TBB_SYMBOL( ?move@captured_exception@tbb@@UEAAPEAV12@XZ ) ++__TBB_SYMBOL( ?destroy@captured_exception@tbb@@UEAAXXZ ) ++__TBB_SYMBOL( ?set@captured_exception@tbb@@QEAAXPEBD0@Z ) ++__TBB_SYMBOL( ?clear@captured_exception@tbb@@QEAAXXZ ) ++#endif /* __TBB_TASK_GROUP_CONTEXT */ ++ ++// Symbols for exceptions thrown from TBB ++__TBB_SYMBOL( ?throw_bad_last_alloc_exception_v4@internal@tbb@@YAXXZ ) ++__TBB_SYMBOL( ?throw_exception_v4@internal@tbb@@YAXW4exception_id@12@@Z ) ++__TBB_SYMBOL( ?what@bad_last_alloc@tbb@@UEBAPEBDXZ ) ++__TBB_SYMBOL( ?what@missing_wait@tbb@@UEBAPEBDXZ ) ++__TBB_SYMBOL( ?what@invalid_multiple_scheduling@tbb@@UEBAPEBDXZ ) ++__TBB_SYMBOL( ?what@improper_lock@tbb@@UEBAPEBDXZ ) ++__TBB_SYMBOL( ?what@user_abort@tbb@@UEBAPEBDXZ ) ++ ++// tbb_misc.cpp ++__TBB_SYMBOL( ?assertion_failure@tbb@@YAXPEBDH00@Z ) ++__TBB_SYMBOL( ?get_initial_auto_partitioner_divisor@internal@tbb@@YA_KXZ ) ++__TBB_SYMBOL( ?handle_perror@internal@tbb@@YAXHPEBD@Z ) ++__TBB_SYMBOL( ?set_assertion_handler@tbb@@YAP6AXPEBDH00@ZP6AX0H00@Z@Z ) ++__TBB_SYMBOL( ?runtime_warning@internal@tbb@@YAXPEBDZZ ) ++__TBB_SYMBOL( TBB_runtime_interface_version ) ++ ++// tbb_main.cpp ++__TBB_SYMBOL( ?itt_load_pointer_with_acquire_v3@internal@tbb@@YAPEAXPEBX@Z ) ++__TBB_SYMBOL( ?itt_store_pointer_with_release_v3@internal@tbb@@YAXPEAX0@Z ) ++__TBB_SYMBOL( ?call_itt_notify_v5@internal@tbb@@YAXHPEAX@Z ) ++__TBB_SYMBOL( ?itt_set_sync_name_v3@internal@tbb@@YAXPEAXPEB_W@Z ) ++__TBB_SYMBOL( ?itt_load_pointer_v3@internal@tbb@@YAPEAXPEBX@Z ) ++__TBB_SYMBOL( ?itt_make_task_group_v7@internal@tbb@@YAXW4itt_domain_enum@12@PEAX_K12W4string_index@12@@Z ) ++__TBB_SYMBOL( ?itt_metadata_str_add_v7@internal@tbb@@YAXW4itt_domain_enum@12@PEAX_KW4string_index@12@PEBD@Z ) ++__TBB_SYMBOL( ?itt_relation_add_v7@internal@tbb@@YAXW4itt_domain_enum@12@PEAX_KW4itt_relation@12@12@Z ) ++__TBB_SYMBOL( ?itt_task_begin_v7@internal@tbb@@YAXW4itt_domain_enum@12@PEAX_K12W4string_index@12@@Z ) ++__TBB_SYMBOL( ?itt_task_end_v7@internal@tbb@@YAXW4itt_domain_enum@12@@Z ) ++__TBB_SYMBOL( ?itt_region_begin_v9@internal@tbb@@YAXW4itt_domain_enum@12@PEAX_K12W4string_index@12@@Z ) ++__TBB_SYMBOL( ?itt_region_end_v9@internal@tbb@@YAXW4itt_domain_enum@12@PEAX_K@Z ) ++ ++ ++// pipeline.cpp ++__TBB_SYMBOL( ??0pipeline@tbb@@QEAA@XZ ) ++__TBB_SYMBOL( ??1filter@tbb@@UEAA@XZ ) ++__TBB_SYMBOL( ??1pipeline@tbb@@UEAA@XZ ) ++__TBB_SYMBOL( ??_7pipeline@tbb@@6B@ ) ++__TBB_SYMBOL( ?add_filter@pipeline@tbb@@QEAAXAEAVfilter@2@@Z ) ++__TBB_SYMBOL( ?clear@pipeline@tbb@@QEAAXXZ ) ++__TBB_SYMBOL( ?inject_token@pipeline@tbb@@AEAAXAEAVtask@2@@Z ) ++__TBB_SYMBOL( ?run@pipeline@tbb@@QEAAX_K@Z ) ++#if __TBB_TASK_GROUP_CONTEXT ++__TBB_SYMBOL( ?run@pipeline@tbb@@QEAAX_KAEAVtask_group_context@2@@Z ) ++#endif ++__TBB_SYMBOL( ?process_item@thread_bound_filter@tbb@@QEAA?AW4result_type@12@XZ ) ++__TBB_SYMBOL( ?try_process_item@thread_bound_filter@tbb@@QEAA?AW4result_type@12@XZ ) ++__TBB_SYMBOL( ?set_end_of_input@filter@tbb@@IEAAXXZ ) ++ ++// queuing_rw_mutex.cpp ++__TBB_SYMBOL( ?internal_construct@queuing_rw_mutex@tbb@@QEAAXXZ ) ++__TBB_SYMBOL( ?acquire@scoped_lock@queuing_rw_mutex@tbb@@QEAAXAEAV23@_N@Z ) ++__TBB_SYMBOL( ?downgrade_to_reader@scoped_lock@queuing_rw_mutex@tbb@@QEAA_NXZ ) ++__TBB_SYMBOL( ?release@scoped_lock@queuing_rw_mutex@tbb@@QEAAXXZ ) ++__TBB_SYMBOL( ?upgrade_to_writer@scoped_lock@queuing_rw_mutex@tbb@@QEAA_NXZ ) ++__TBB_SYMBOL( ?try_acquire@scoped_lock@queuing_rw_mutex@tbb@@QEAA_NAEAV23@_N@Z ) ++ ++// reader_writer_lock.cpp ++__TBB_SYMBOL( ?try_lock_read@reader_writer_lock@interface5@tbb@@QEAA_NXZ ) ++__TBB_SYMBOL( ?try_lock@reader_writer_lock@interface5@tbb@@QEAA_NXZ ) ++__TBB_SYMBOL( ?unlock@reader_writer_lock@interface5@tbb@@QEAAXXZ ) ++__TBB_SYMBOL( ?lock_read@reader_writer_lock@interface5@tbb@@QEAAXXZ ) ++__TBB_SYMBOL( ?lock@reader_writer_lock@interface5@tbb@@QEAAXXZ ) ++__TBB_SYMBOL( ?internal_construct@reader_writer_lock@interface5@tbb@@AEAAXXZ ) ++__TBB_SYMBOL( ?internal_destroy@reader_writer_lock@interface5@tbb@@AEAAXXZ ) ++__TBB_SYMBOL( ?internal_construct@scoped_lock@reader_writer_lock@interface5@tbb@@AEAAXAEAV234@@Z ) ++__TBB_SYMBOL( ?internal_destroy@scoped_lock@reader_writer_lock@interface5@tbb@@AEAAXXZ ) ++__TBB_SYMBOL( ?internal_construct@scoped_lock_read@reader_writer_lock@interface5@tbb@@AEAAXAEAV234@@Z ) ++__TBB_SYMBOL( ?internal_destroy@scoped_lock_read@reader_writer_lock@interface5@tbb@@AEAAXXZ ) ++ ++#if !TBB_NO_LEGACY ++// spin_rw_mutex.cpp v2 ++__TBB_SYMBOL( ?internal_acquire_reader@spin_rw_mutex@tbb@@CAXPEAV12@@Z ) ++__TBB_SYMBOL( ?internal_acquire_writer@spin_rw_mutex@tbb@@CA_NPEAV12@@Z ) ++__TBB_SYMBOL( ?internal_downgrade@spin_rw_mutex@tbb@@CAXPEAV12@@Z ) ++__TBB_SYMBOL( ?internal_itt_releasing@spin_rw_mutex@tbb@@CAXPEAV12@@Z ) ++__TBB_SYMBOL( ?internal_release_reader@spin_rw_mutex@tbb@@CAXPEAV12@@Z ) ++__TBB_SYMBOL( ?internal_release_writer@spin_rw_mutex@tbb@@CAXPEAV12@@Z ) ++__TBB_SYMBOL( ?internal_upgrade@spin_rw_mutex@tbb@@CA_NPEAV12@@Z ) ++__TBB_SYMBOL( ?internal_try_acquire_writer@spin_rw_mutex@tbb@@CA_NPEAV12@@Z ) ++__TBB_SYMBOL( ?internal_try_acquire_reader@spin_rw_mutex@tbb@@CA_NPEAV12@@Z ) ++#endif ++ ++// spin_rw_mutex v3 ++__TBB_SYMBOL( ?internal_construct@spin_rw_mutex_v3@tbb@@AEAAXXZ ) ++__TBB_SYMBOL( ?internal_upgrade@spin_rw_mutex_v3@tbb@@AEAA_NXZ ) ++__TBB_SYMBOL( ?internal_downgrade@spin_rw_mutex_v3@tbb@@AEAAXXZ ) ++__TBB_SYMBOL( ?internal_acquire_reader@spin_rw_mutex_v3@tbb@@AEAAXXZ ) ++__TBB_SYMBOL( ?internal_acquire_writer@spin_rw_mutex_v3@tbb@@AEAA_NXZ ) ++__TBB_SYMBOL( ?internal_release_reader@spin_rw_mutex_v3@tbb@@AEAAXXZ ) ++__TBB_SYMBOL( ?internal_release_writer@spin_rw_mutex_v3@tbb@@AEAAXXZ ) ++__TBB_SYMBOL( ?internal_try_acquire_reader@spin_rw_mutex_v3@tbb@@AEAA_NXZ ) ++__TBB_SYMBOL( ?internal_try_acquire_writer@spin_rw_mutex_v3@tbb@@AEAA_NXZ ) ++ ++// spin_mutex.cpp ++__TBB_SYMBOL( ?internal_construct@spin_mutex@tbb@@QEAAXXZ ) ++__TBB_SYMBOL( ?internal_acquire@scoped_lock@spin_mutex@tbb@@AEAAXAEAV23@@Z ) ++__TBB_SYMBOL( ?internal_release@scoped_lock@spin_mutex@tbb@@AEAAXXZ ) ++__TBB_SYMBOL( ?internal_try_acquire@scoped_lock@spin_mutex@tbb@@AEAA_NAEAV23@@Z ) ++ ++// mutex.cpp ++__TBB_SYMBOL( ?internal_acquire@scoped_lock@mutex@tbb@@AEAAXAEAV23@@Z ) ++__TBB_SYMBOL( ?internal_release@scoped_lock@mutex@tbb@@AEAAXXZ ) ++__TBB_SYMBOL( ?internal_try_acquire@scoped_lock@mutex@tbb@@AEAA_NAEAV23@@Z ) ++__TBB_SYMBOL( ?internal_construct@mutex@tbb@@AEAAXXZ ) ++__TBB_SYMBOL( ?internal_destroy@mutex@tbb@@AEAAXXZ ) ++ ++// recursive_mutex.cpp ++__TBB_SYMBOL( ?internal_acquire@scoped_lock@recursive_mutex@tbb@@AEAAXAEAV23@@Z ) ++__TBB_SYMBOL( ?internal_release@scoped_lock@recursive_mutex@tbb@@AEAAXXZ ) ++__TBB_SYMBOL( ?internal_try_acquire@scoped_lock@recursive_mutex@tbb@@AEAA_NAEAV23@@Z ) ++__TBB_SYMBOL( ?internal_construct@recursive_mutex@tbb@@AEAAXXZ ) ++__TBB_SYMBOL( ?internal_destroy@recursive_mutex@tbb@@AEAAXXZ ) ++ ++// queuing_mutex.cpp ++__TBB_SYMBOL( ?internal_construct@queuing_mutex@tbb@@QEAAXXZ ) ++__TBB_SYMBOL( ?acquire@scoped_lock@queuing_mutex@tbb@@QEAAXAEAV23@@Z ) ++__TBB_SYMBOL( ?release@scoped_lock@queuing_mutex@tbb@@QEAAXXZ ) ++__TBB_SYMBOL( ?try_acquire@scoped_lock@queuing_mutex@tbb@@QEAA_NAEAV23@@Z ) ++ ++// critical_section.cpp ++__TBB_SYMBOL( ?internal_construct@critical_section_v4@internal@tbb@@QEAAXXZ ) ++ ++#if !TBB_NO_LEGACY ++// concurrent_hash_map.cpp ++__TBB_SYMBOL( ?internal_grow_predicate@hash_map_segment_base@internal@tbb@@QEBA_NXZ ) ++ ++// concurrent_queue.cpp v2 ++__TBB_SYMBOL( ?advance@concurrent_queue_iterator_base@internal@tbb@@IEAAXXZ ) ++__TBB_SYMBOL( ?assign@concurrent_queue_iterator_base@internal@tbb@@IEAAXAEBV123@@Z ) ++__TBB_SYMBOL( ?internal_size@concurrent_queue_base@internal@tbb@@IEBA_JXZ ) ++__TBB_SYMBOL( ??0concurrent_queue_base@internal@tbb@@IEAA@_K@Z ) ++__TBB_SYMBOL( ??0concurrent_queue_iterator_base@internal@tbb@@IEAA@AEBVconcurrent_queue_base@12@@Z ) ++__TBB_SYMBOL( ??1concurrent_queue_base@internal@tbb@@MEAA@XZ ) ++__TBB_SYMBOL( ??1concurrent_queue_iterator_base@internal@tbb@@IEAA@XZ ) ++__TBB_SYMBOL( ?internal_pop@concurrent_queue_base@internal@tbb@@IEAAXPEAX@Z ) ++__TBB_SYMBOL( ?internal_pop_if_present@concurrent_queue_base@internal@tbb@@IEAA_NPEAX@Z ) ++__TBB_SYMBOL( ?internal_push@concurrent_queue_base@internal@tbb@@IEAAXPEBX@Z ) ++__TBB_SYMBOL( ?internal_push_if_not_full@concurrent_queue_base@internal@tbb@@IEAA_NPEBX@Z ) ++__TBB_SYMBOL( ?internal_set_capacity@concurrent_queue_base@internal@tbb@@IEAAX_J_K@Z ) ++#endif ++ ++// concurrent_queue v3 ++__TBB_SYMBOL( ??1concurrent_queue_iterator_base_v3@internal@tbb@@IEAA@XZ ) ++__TBB_SYMBOL( ??0concurrent_queue_iterator_base_v3@internal@tbb@@IEAA@AEBVconcurrent_queue_base_v3@12@@Z ) ++__TBB_SYMBOL( ??0concurrent_queue_iterator_base_v3@internal@tbb@@IEAA@AEBVconcurrent_queue_base_v3@12@_K@Z ) ++__TBB_SYMBOL( ?advance@concurrent_queue_iterator_base_v3@internal@tbb@@IEAAXXZ ) ++__TBB_SYMBOL( ?assign@concurrent_queue_iterator_base_v3@internal@tbb@@IEAAXAEBV123@@Z ) ++__TBB_SYMBOL( ??0concurrent_queue_base_v3@internal@tbb@@IEAA@_K@Z ) ++__TBB_SYMBOL( ??1concurrent_queue_base_v3@internal@tbb@@MEAA@XZ ) ++__TBB_SYMBOL( ?internal_pop@concurrent_queue_base_v3@internal@tbb@@IEAAXPEAX@Z ) ++__TBB_SYMBOL( ?internal_pop_if_present@concurrent_queue_base_v3@internal@tbb@@IEAA_NPEAX@Z ) ++__TBB_SYMBOL( ?internal_abort@concurrent_queue_base_v3@internal@tbb@@IEAAXXZ ) ++__TBB_SYMBOL( ?internal_push@concurrent_queue_base_v3@internal@tbb@@IEAAXPEBX@Z ) ++__TBB_SYMBOL( ?internal_push_move@concurrent_queue_base_v8@internal@tbb@@IEAAXPEBX@Z ) ++__TBB_SYMBOL( ?internal_push_if_not_full@concurrent_queue_base_v3@internal@tbb@@IEAA_NPEBX@Z ) ++__TBB_SYMBOL( ?internal_push_move_if_not_full@concurrent_queue_base_v8@internal@tbb@@IEAA_NPEBX@Z ) ++__TBB_SYMBOL( ?internal_size@concurrent_queue_base_v3@internal@tbb@@IEBA_JXZ ) ++__TBB_SYMBOL( ?internal_empty@concurrent_queue_base_v3@internal@tbb@@IEBA_NXZ ) ++__TBB_SYMBOL( ?internal_set_capacity@concurrent_queue_base_v3@internal@tbb@@IEAAX_J_K@Z ) ++__TBB_SYMBOL( ?internal_finish_clear@concurrent_queue_base_v3@internal@tbb@@IEAAXXZ ) ++__TBB_SYMBOL( ?internal_throw_exception@concurrent_queue_base_v3@internal@tbb@@IEBAXXZ ) ++__TBB_SYMBOL( ?assign@concurrent_queue_base_v3@internal@tbb@@IEAAXAEBV123@@Z ) ++__TBB_SYMBOL( ?move_content@concurrent_queue_base_v8@internal@tbb@@IEAAXAEAV123@@Z ) ++ ++#if !TBB_NO_LEGACY ++// concurrent_vector.cpp v2 ++__TBB_SYMBOL( ?internal_assign@concurrent_vector_base@internal@tbb@@IEAAXAEBV123@_KP6AXPEAX1@ZP6AX2PEBX1@Z5@Z ) ++__TBB_SYMBOL( ?internal_capacity@concurrent_vector_base@internal@tbb@@IEBA_KXZ ) ++__TBB_SYMBOL( ?internal_clear@concurrent_vector_base@internal@tbb@@IEAAXP6AXPEAX_K@Z_N@Z ) ++__TBB_SYMBOL( ?internal_copy@concurrent_vector_base@internal@tbb@@IEAAXAEBV123@_KP6AXPEAXPEBX1@Z@Z ) ++__TBB_SYMBOL( ?internal_grow_by@concurrent_vector_base@internal@tbb@@IEAA_K_K0P6AXPEAX0@Z@Z ) ++__TBB_SYMBOL( ?internal_grow_to_at_least@concurrent_vector_base@internal@tbb@@IEAAX_K0P6AXPEAX0@Z@Z ) ++__TBB_SYMBOL( ?internal_push_back@concurrent_vector_base@internal@tbb@@IEAAPEAX_KAEA_K@Z ) ++__TBB_SYMBOL( ?internal_reserve@concurrent_vector_base@internal@tbb@@IEAAX_K00@Z ) ++#endif ++ ++// concurrent_vector v3 ++__TBB_SYMBOL( ??1concurrent_vector_base_v3@internal@tbb@@IEAA@XZ ) ++__TBB_SYMBOL( ?internal_assign@concurrent_vector_base_v3@internal@tbb@@IEAAXAEBV123@_KP6AXPEAX1@ZP6AX2PEBX1@Z5@Z ) ++__TBB_SYMBOL( ?internal_capacity@concurrent_vector_base_v3@internal@tbb@@IEBA_KXZ ) ++__TBB_SYMBOL( ?internal_clear@concurrent_vector_base_v3@internal@tbb@@IEAA_KP6AXPEAX_K@Z@Z ) ++__TBB_SYMBOL( ?internal_copy@concurrent_vector_base_v3@internal@tbb@@IEAAXAEBV123@_KP6AXPEAXPEBX1@Z@Z ) ++__TBB_SYMBOL( ?internal_grow_by@concurrent_vector_base_v3@internal@tbb@@IEAA_K_K0P6AXPEAXPEBX0@Z2@Z ) ++__TBB_SYMBOL( ?internal_grow_to_at_least@concurrent_vector_base_v3@internal@tbb@@IEAAX_K0P6AXPEAXPEBX0@Z2@Z ) ++__TBB_SYMBOL( ?internal_push_back@concurrent_vector_base_v3@internal@tbb@@IEAAPEAX_KAEA_K@Z ) ++__TBB_SYMBOL( ?internal_reserve@concurrent_vector_base_v3@internal@tbb@@IEAAX_K00@Z ) ++__TBB_SYMBOL( ?internal_compact@concurrent_vector_base_v3@internal@tbb@@IEAAPEAX_KPEAXP6AX10@ZP6AX1PEBX0@Z@Z ) ++__TBB_SYMBOL( ?internal_swap@concurrent_vector_base_v3@internal@tbb@@IEAAXAEAV123@@Z ) ++__TBB_SYMBOL( ?internal_throw_exception@concurrent_vector_base_v3@internal@tbb@@IEBAX_K@Z ) ++__TBB_SYMBOL( ?internal_resize@concurrent_vector_base_v3@internal@tbb@@IEAAX_K00PEBXP6AXPEAX0@ZP6AX210@Z@Z ) ++__TBB_SYMBOL( ?internal_grow_to_at_least_with_result@concurrent_vector_base_v3@internal@tbb@@IEAA_K_K0P6AXPEAXPEBX0@Z2@Z ) ++ ++// tbb_thread ++__TBB_SYMBOL( ?join@tbb_thread_v3@internal@tbb@@QEAAXXZ ) ++__TBB_SYMBOL( ?detach@tbb_thread_v3@internal@tbb@@QEAAXXZ ) ++__TBB_SYMBOL( ?internal_start@tbb_thread_v3@internal@tbb@@AEAAXP6AIPEAX@Z0@Z ) ++__TBB_SYMBOL( ?allocate_closure_v3@internal@tbb@@YAPEAX_K@Z ) ++__TBB_SYMBOL( ?free_closure_v3@internal@tbb@@YAXPEAX@Z ) ++__TBB_SYMBOL( ?hardware_concurrency@tbb_thread_v3@internal@tbb@@SAIXZ ) ++__TBB_SYMBOL( ?thread_yield_v3@internal@tbb@@YAXXZ ) ++__TBB_SYMBOL( ?thread_sleep_v3@internal@tbb@@YAXAEBVinterval_t@tick_count@2@@Z ) ++__TBB_SYMBOL( ?move_v3@internal@tbb@@YAXAEAVtbb_thread_v3@12@0@Z ) ++__TBB_SYMBOL( ?thread_get_id_v3@internal@tbb@@YA?AVid@tbb_thread_v3@12@XZ ) ++ ++// condition_variable ++__TBB_SYMBOL( ?internal_initialize_condition_variable@internal@interface5@tbb@@YAXAEATcondvar_impl_t@123@@Z ) ++__TBB_SYMBOL( ?internal_condition_variable_wait@internal@interface5@tbb@@YA_NAEATcondvar_impl_t@123@PEAVmutex@3@PEBVinterval_t@tick_count@3@@Z ) ++__TBB_SYMBOL( ?internal_condition_variable_notify_one@internal@interface5@tbb@@YAXAEATcondvar_impl_t@123@@Z ) ++__TBB_SYMBOL( ?internal_condition_variable_notify_all@internal@interface5@tbb@@YAXAEATcondvar_impl_t@123@@Z ) ++__TBB_SYMBOL( ?internal_destroy_condition_variable@internal@interface5@tbb@@YAXAEATcondvar_impl_t@123@@Z ) ++ ++ ++// global parameter ++__TBB_SYMBOL( ?active_value@global_control@interface9@tbb@@CA_KH@Z ) ++__TBB_SYMBOL( ?internal_create@global_control@interface9@tbb@@AEAAXXZ ) ++__TBB_SYMBOL( ?internal_destroy@global_control@interface9@tbb@@AEAAXXZ ) ++ ++#undef __TBB_SYMBOL +diff --git a/src/tbbmalloc/TypeDefinitions.h b/src/tbbmalloc/TypeDefinitions.h +index aa6763b0..fffef73d 100644 +--- a/src/tbbmalloc/TypeDefinitions.h ++++ b/src/tbbmalloc/TypeDefinitions.h +@@ -25,7 +25,7 @@ + # define __ARCH_ipf 1 + # elif defined(_M_IX86)||defined(__i386__) // the latter for MinGW support + # define __ARCH_x86_32 1 +-# elif defined(_M_ARM) ++# elif defined(_M_ARM)||defined(_M_ARM64) + # define __ARCH_other 1 + # else + # error Unknown processor architecture for Windows +diff --git a/src/tbbmalloc/winarm64-tbbmalloc-export.def b/src/tbbmalloc/winarm64-tbbmalloc-export.def +new file mode 100644 +index 00000000..ec64b015 +--- /dev/null ++++ b/src/tbbmalloc/winarm64-tbbmalloc-export.def +@@ -0,0 +1,46 @@ ++; Copyright (c) 2005-2020 Intel Corporation ++; Copyright (c) 2022 Linaro Ltd ++; ++; Licensed under the Apache License, Version 2.0 (the "License"); ++; you may not use this file except in compliance with the License. ++; You may obtain a copy of the License at ++; ++; http://www.apache.org/licenses/LICENSE-2.0 ++; ++; Unless required by applicable law or agreed to in writing, software ++; distributed under the License is distributed on an "AS IS" BASIS, ++; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++; See the License for the specific language governing permissions and ++; limitations under the License. ++ ++EXPORTS ++ ++; frontend.cpp ++scalable_calloc ++scalable_free ++scalable_malloc ++scalable_realloc ++scalable_posix_memalign ++scalable_aligned_malloc ++scalable_aligned_realloc ++scalable_aligned_free ++scalable_msize ++scalable_allocation_mode ++scalable_allocation_command ++__TBB_malloc_safer_free ++__TBB_malloc_safer_realloc ++__TBB_malloc_safer_msize ++__TBB_malloc_safer_aligned_msize ++__TBB_malloc_safer_aligned_realloc ++?pool_create@rml@@YAPEAVMemoryPool@1@_JPEBUMemPoolPolicy@1@@Z ++?pool_create_v1@rml@@YA?AW4MemPoolError@1@_JPEBUMemPoolPolicy@1@PEAPEAVMemoryPool@1@@Z ++?pool_destroy@rml@@YA_NPEAVMemoryPool@1@@Z ++?pool_malloc@rml@@YAPEAXPEAVMemoryPool@1@_K@Z ++?pool_free@rml@@YA_NPEAVMemoryPool@1@PEAX@Z ++?pool_reset@rml@@YA_NPEAVMemoryPool@1@@Z ++?pool_realloc@rml@@YAPEAXPEAVMemoryPool@1@PEAX_K@Z ++?pool_aligned_realloc@rml@@YAPEAXPEAVMemoryPool@1@PEAX_K2@Z ++?pool_aligned_malloc@rml@@YAPEAXPEAVMemoryPool@1@_K1@Z ++?pool_identify@rml@@YAPEAVMemoryPool@1@PEAX@Z ++?pool_msize@rml@@YA_KPEAVMemoryPool@1@PEAX@Z ++ +diff --git a/src/test/harness_fp.h b/src/test/harness_fp.h +index b007e2b8..f6d0066e 100644 +--- a/src/test/harness_fp.h ++++ b/src/test/harness_fp.h +@@ -84,7 +84,7 @@ inline void SetSseMode ( int mode ) { + ctl.set_env(); + } + +-#elif defined(_M_ARM) || defined(__TBB_WIN32_USE_CL_BUILTINS) ++#elif defined(_M_ARM) || defined(_M_ARM64) || defined(__TBB_WIN32_USE_CL_BUILTINS) + const int NumSseModes = 1; + const int SseModes[NumSseModes] = { 0 }; + diff --git a/build_files/build_environment/patches/usd.diff b/build_files/build_environment/patches/usd.diff index 976e58a2e80..23607839cdf 100644 --- a/build_files/build_environment/patches/usd.diff +++ b/build_files/build_environment/patches/usd.diff @@ -1,8 +1,9 @@ -diff -Naur orig/cmake/defaults/Packages.cmake external_usd/cmake/defaults/Packages.cmake ---- orig/cmake/defaults/Packages.cmake 2022-10-27 12:56:33 -0600 -+++ external_usd/cmake/defaults/Packages.cmake 2022-10-27 13:05:08 -0600 -@@ -129,7 +129,7 @@ - endif() +diff --git a/cmake/defaults/Packages.cmake b/cmake/defaults/Packages.cmake +index 2bb1f30d0..adcc7422e 100644 +--- a/cmake/defaults/Packages.cmake ++++ b/cmake/defaults/Packages.cmake +@@ -152,7 +152,7 @@ endif() + # --TBB -find_package(TBB REQUIRED COMPONENTS tbb) @@ -10,10 +11,11 @@ diff -Naur orig/cmake/defaults/Packages.cmake external_usd/cmake/defaults/Packag add_definitions(${TBB_DEFINITIONS}) # --math -diff -Naur orig/cmake/defaults/msvcdefaults.cmake external_usd/cmake/defaults/msvcdefaults.cmake ---- orig/cmake/defaults/msvcdefaults.cmake 2022-10-27 12:56:33 -0600 -+++ external_usd/cmake/defaults/msvcdefaults.cmake 2022-10-27 13:05:08 -0600 -@@ -120,9 +120,6 @@ +diff --git a/cmake/defaults/msvcdefaults.cmake b/cmake/defaults/msvcdefaults.cmake +index 0f7fb7ef6..a467341ed 100644 +--- a/cmake/defaults/msvcdefaults.cmake ++++ b/cmake/defaults/msvcdefaults.cmake +@@ -140,9 +140,6 @@ _add_define("WIN32_LEAN_AND_MEAN") # for all translation units. set(_PXR_CXX_FLAGS "${_PXR_CXX_FLAGS} /bigobj") @@ -23,10 +25,49 @@ diff -Naur orig/cmake/defaults/msvcdefaults.cmake external_usd/cmake/defaults/ms # Enable multiprocessor builds. set(_PXR_CXX_FLAGS "${_PXR_CXX_FLAGS} /MP") set(_PXR_CXX_FLAGS "${_PXR_CXX_FLAGS} /Gm-") -diff -Naur orig/pxr/base/arch/timing.h external_usd/pxr/base/arch/timing.h ---- orig/pxr/base/arch/timing.h 2022-10-27 12:56:34 -0600 -+++ external_usd/pxr/base/arch/timing.h 2022-10-27 13:05:08 -0600 -@@ -84,6 +84,10 @@ +diff --git a/pxr/base/arch/defines.h b/pxr/base/arch/defines.h +index cb6ad44c5..c6c1a604b 100644 +--- a/pxr/base/arch/defines.h ++++ b/pxr/base/arch/defines.h +@@ -49,7 +49,8 @@ + #if defined(i386) || defined(__i386__) || defined(__x86_64__) || \ + defined(_M_IX86) || defined(_M_X64) + #define ARCH_CPU_INTEL +-#elif defined(__arm__) || defined(__aarch64__) || defined(_M_ARM) ++#elif defined(__arm__) || defined(__aarch64__) || defined(_M_ARM) || \ ++ defined(_M_ARM64) + #define ARCH_CPU_ARM + #endif + +@@ -57,7 +58,8 @@ + // Bits + // + +-#if defined(__x86_64__) || defined(__aarch64__) || defined(_M_X64) ++#if defined(__x86_64__) || defined(__aarch64__) || defined(_M_X64) || \ ++ defined(_M_ARM64) + #define ARCH_BITS_64 + #else + #error "Unsupported architecture. x86_64 or ARM64 required." +diff --git a/pxr/base/arch/timing.h b/pxr/base/arch/timing.h +index d78598a84..2f44a5f89 100644 +--- a/pxr/base/arch/timing.h ++++ b/pxr/base/arch/timing.h +@@ -69,7 +69,13 @@ ArchGetTickTime() + return __rdtsc(); + #elif defined (ARCH_CPU_ARM) + uint64_t result; ++ #if defined(ARCH_COMPILER_MSVC) ++ // MSVC does not support inline assembly on ARM64 platforms ++ // 0x5F02 == ARM64_CNTVCT - manually calculated value avoids ++ result = _ReadStatusReg(0x5F02); ++ #else + __asm __volatile("mrs %0, CNTVCT_EL0" : "=&r" (result)); ++ #endif + return result; + #else + #error Unknown architecture. +@@ -84,6 +90,10 @@ ArchGetTickTime() inline uint64_t ArchGetStartTickTime() { @@ -37,7 +78,7 @@ diff -Naur orig/pxr/base/arch/timing.h external_usd/pxr/base/arch/timing.h uint64_t t; #if defined (ARCH_OS_DARWIN) return ArchGetTickTime(); -@@ -116,6 +120,7 @@ +@@ -116,6 +126,7 @@ ArchGetStartTickTime() #error "Unsupported architecture." #endif return t; @@ -45,7 +86,7 @@ diff -Naur orig/pxr/base/arch/timing.h external_usd/pxr/base/arch/timing.h } /// Get a "stop" tick time for measuring an interval of time. See -@@ -125,6 +130,10 @@ +@@ -125,6 +136,10 @@ ArchGetStartTickTime() inline uint64_t ArchGetStopTickTime() { @@ -56,7 +97,7 @@ diff -Naur orig/pxr/base/arch/timing.h external_usd/pxr/base/arch/timing.h uint64_t t; #if defined (ARCH_OS_DARWIN) return ArchGetTickTime(); -@@ -155,11 +164,11 @@ +@@ -155,11 +170,11 @@ ArchGetStopTickTime() #error "Unsupported architecture." #endif return t; @@ -71,10 +112,37 @@ diff -Naur orig/pxr/base/arch/timing.h external_usd/pxr/base/arch/timing.h /// A simple timer class for measuring an interval of time using the /// ArchTickTimer facilities. -diff -Naur orig/pxr/imaging/hioOpenVDB/CMakeLists.txt external_usd/pxr/imaging/hioOpenVDB/CMakeLists.txt ---- orig/pxr/imaging/hioOpenVDB/CMakeLists.txt 2022-10-27 12:56:35 -0600 -+++ external_usd/pxr/imaging/hioOpenVDB/CMakeLists.txt 2022-10-27 13:05:08 -0600 -@@ -20,6 +20,12 @@ +diff --git a/pxr/base/tf/pxrDoubleConversion/utils.h b/pxr/base/tf/pxrDoubleConversion/utils.h +index 547ac1110..10fd96cf9 100644 +--- a/pxr/base/tf/pxrDoubleConversion/utils.h ++++ b/pxr/base/tf/pxrDoubleConversion/utils.h +@@ -78,7 +78,7 @@ inline void abort_noreturn() { abort(); } + defined(__sparc__) || defined(__sparc) || defined(__s390__) || \ + defined(__SH4__) || defined(__alpha__) || \ + defined(_MIPS_ARCH_MIPS32R2) || \ +- defined(__AARCH64EL__) || defined(__aarch64__) || \ ++ defined(__AARCH64EL__) || defined(__aarch64__) || defined (_M_ARM64) || \ + defined(__riscv) + #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1 + #elif defined(__mc68000__) +diff --git a/pxr/imaging/hio/OpenEXR/OpenEXRCore/internal_dwa_simd.h b/pxr/imaging/hio/OpenEXR/OpenEXRCore/internal_dwa_simd.h +index 459fb3084..c1f98f160 100644 +--- a/pxr/imaging/hio/OpenEXR/OpenEXRCore/internal_dwa_simd.h ++++ b/pxr/imaging/hio/OpenEXR/OpenEXRCore/internal_dwa_simd.h +@@ -18,7 +18,7 @@ + // aligned. Unaligned pointers may risk seg-faulting. + // + +-#if defined __SSE2__ || (_MSC_VER >= 1300 && !_M_CEE_PURE) ++#if defined __SSE2__ || (_MSC_VER >= 1300 && !_M_CEE_PURE && !defined(_M_ARM64)) + # define IMF_HAVE_SSE2 1 + # include + # include +diff --git a/pxr/imaging/hioOpenVDB/CMakeLists.txt b/pxr/imaging/hioOpenVDB/CMakeLists.txt +index e32762cea..d2c08d3da 100644 +--- a/pxr/imaging/hioOpenVDB/CMakeLists.txt ++++ b/pxr/imaging/hioOpenVDB/CMakeLists.txt +@@ -20,6 +20,12 @@ else() LIST(APPEND __VDB_IMATH_LIBS ${OPENEXR_Half_LIBRARY}) endif() @@ -87,10 +155,11 @@ diff -Naur orig/pxr/imaging/hioOpenVDB/CMakeLists.txt external_usd/pxr/imaging/h pxr_library(hioOpenVDB LIBRARIES ar -diff -Naur orig/pxr/usdImaging/CMakeLists.txt external_usd/pxr/usdImaging/CMakeLists.txt ---- orig/pxr/usdImaging/CMakeLists.txt 2022-10-27 12:56:37 -0600 -+++ external_usd/pxr/usdImaging/CMakeLists.txt 2022-10-27 13:05:08 -0600 -@@ -7,7 +7,7 @@ +diff --git a/pxr/usdImaging/CMakeLists.txt b/pxr/usdImaging/CMakeLists.txt +index 53c026689..e99a5ac17 100644 +--- a/pxr/usdImaging/CMakeLists.txt ++++ b/pxr/usdImaging/CMakeLists.txt +@@ -7,7 +7,7 @@ set(DIRS usdVolImaging usdAppUtils usdviewq diff --git a/build_files/build_environment/windows/build_deps.cmd b/build_files/build_environment/windows/build_deps.cmd index 543a10414ce..df8c8b9644e 100644 --- a/build_files/build_environment/windows/build_deps.cmd +++ b/build_files/build_environment/windows/build_deps.cmd @@ -13,12 +13,19 @@ if NOT "%1" == "" ( set VSVER_SHORT=15 set BuildDir=VS15 goto par2 + ) + if "%1" == "2022" ( + echo "Building for VS2022" + set VSVER=15.0 + set VSVER_SHORT=15 + set BuildDir=VS15 + goto par2 ) ) :usage -Echo Usage build_deps 2017/2019 x64 +Echo Usage build_deps 2017/2019/2022 x64/arm64 goto exit :par2 if NOT "%2" == "" ( @@ -28,11 +35,24 @@ if NOT "%2" == "" ( set ARCH=64 if "%1" == "2019" ( set CMAKE_BUILDER=Visual Studio 16 2019 - set CMAKE_BUILD_ARCH=-A x64 + set CMAKE_BUILD_ARCH=-A x64 -Thost=x64 ) if "%1" == "2017" ( set CMAKE_BUILDER=Visual Studio 15 2017 Win64 - set CMAKE_BUILD_ARCH= + set CMAKE_BUILD_ARCH=-Thost=x64 + ) + goto start + ) + if "%2" == "arm64" ( + echo "Building for arm64" + set HARVESTROOT=WinArm64_vc + set ARCH=64 + if "%1" == "2022" ( + set CMAKE_BUILDER=Visual Studio 17 2022 + set CMAKE_BUILD_ARCH=-A arm64 + ) else ( + echo ARM64 can only be used in combination with VS2022 + goto exit ) goto start ) @@ -113,7 +133,7 @@ set path=%BUILD_DIR%\downloads\mingw\mingw64\msys\1.0\bin\;%BUILD_DIR%\downloads mkdir %STAGING%\%BuildDir%%ARCH%R cd %Staging%\%BuildDir%%ARCH%R echo %DATE% %TIME% : Start > %StatusFile% -cmake -G "%CMAKE_BUILDER%" %CMAKE_BUILD_ARCH% -Thost=x64 %SOURCE_DIR% -DPACKAGE_DIR=%BUILD_DIR%/packages -DDOWNLOAD_DIR=%BUILD_DIR%/downloads -DBUILD_MODE=Release -DHARVEST_TARGET=%HARVEST_DIR%/%HARVESTROOT%%VSVER_SHORT%/ +cmake -G "%CMAKE_BUILDER%" %CMAKE_BUILD_ARCH% %SOURCE_DIR% -DPACKAGE_DIR=%BUILD_DIR%/packages -DDOWNLOAD_DIR=%BUILD_DIR%/downloads -DBUILD_MODE=Release -DHARVEST_TARGET=%HARVEST_DIR%/%HARVESTROOT%%VSVER_SHORT%/ echo %DATE% %TIME% : Release Configuration done >> %StatusFile% if "%dobuild%" == "1" ( msbuild -maxcpucount:1 "BlenderDependencies.sln" /p:Configuration=Release /fl /flp:logfile=BlenderDeps.log;Verbosity=minimal /verbosity:minimal @@ -131,7 +151,7 @@ set openexr_paths=%Staging%\%BuildDir%%ARCH%D\Debug\openexr\bin set imath_paths=%Staging%\%BuildDir%%ARCH%D\Debug\imath\bin set tbb_paths=%Staging%\%BuildDir%%ARCH%D\Debug\tbb\bin set path=%BUILD_DIR%\downloads\mingw\mingw64\msys\1.0\bin\;%BUILD_DIR%\downloads\nasm-2.12.01\;%original_path%;%boost_paths%;%oiio_paths%;%openexr_paths%;%imath_paths%;%tbb_paths% -cmake -G "%CMAKE_BUILDER%" %CMAKE_BUILD_ARCH% -Thost=x64 %SOURCE_DIR% -DPACKAGE_DIR=%BUILD_DIR%/packages -DDOWNLOAD_DIR=%BUILD_DIR%/downloads -DCMAKE_BUILD_TYPE=Debug -DBUILD_MODE=Debug -DHARVEST_TARGET=%HARVEST_DIR%/%HARVESTROOT%%VSVER_SHORT%/ %CMAKE_DEBUG_OPTIONS% +cmake -G "%CMAKE_BUILDER%" %CMAKE_BUILD_ARCH% %SOURCE_DIR% -DPACKAGE_DIR=%BUILD_DIR%/packages -DDOWNLOAD_DIR=%BUILD_DIR%/downloads -DCMAKE_BUILD_TYPE=Debug -DBUILD_MODE=Debug -DHARVEST_TARGET=%HARVEST_DIR%/%HARVESTROOT%%VSVER_SHORT%/ %CMAKE_DEBUG_OPTIONS% echo %DATE% %TIME% : Debug Configuration done >> %StatusFile% if "%dobuild%" == "1" ( msbuild -maxcpucount:1 "BlenderDependencies.sln" /p:Configuration=Debug /verbosity:n /fl /flp:logfile=BlenderDeps.log;;Verbosity=normal