From 3c50b6a44409b7faaed70ff3c2cdfe99f871a8eb Mon Sep 17 00:00:00 2001 From: Luca Scheller Date: Sat, 7 Sep 2024 09:43:57 -0700 Subject: [PATCH] Add Maya USD SDK 2025.2 Support --- .github/scripts/maya.py | 18 +++++----- .github/scripts/maya_build.bat | 2 +- .github/workflows/build_maya.yml | 60 +++++++++++++++++++++++++++----- CMakeLists.txt | 21 ++++++++--- 4 files changed, 78 insertions(+), 23 deletions(-) diff --git a/.github/scripts/maya.py b/.github/scripts/maya.py index df8c334..958395c 100644 --- a/.github/scripts/maya.py +++ b/.github/scripts/maya.py @@ -1,15 +1,12 @@ import argparse -import hashlib import glob import contextlib import logging import os -import pathlib import platform import re import requests import shutil -import sidefx import subprocess import tarfile import zipfile @@ -17,18 +14,19 @@ import ssl import json + MAYA_USD_SDK_URL = "https://api.github.com/repos/Autodesk/maya-usd" MAYA_USD_SDK_RELEASE_ASSET_ELEMENTS_REGEX = re.compile( "MayaUSD_([0-9.]+)_Maya([0-9.]+)_(Linux|Windows).(run|exe)" ) -MAYA_PYTHON_VERSION_MAPPING = { - "2024.2": "3.10.11" -} +MAYA_PYTHON_VERSION_MAPPING = {"2024.2": "3.10.11", "2025.2": "3.11.4"} PYTHON_SOURCE_DOWNLOAD_URL = { - "3.10.11": "https://www.python.org/ftp/python/3.10.11/Python-3.10.11.tgz" + "3.10.11": "https://www.python.org/ftp/python/3.10.11/Python-3.10.11.tgz", + "3.11.4": "https://www.python.org/ftp/python/3.11.4/Python-3.11.4.tgz", } PYTHON_WINDOWS_DOWNLOAD_URL = { - "3.10.11": "https://www.python.org/ftp/python/3.10.11/python-3.10.11-amd64.exe" + "3.10.11": "https://www.python.org/ftp/python/3.10.11/python-3.10.11-amd64.exe", + "3.11.4": "https://www.python.org/ftp/python/3.11.4/Python-3.11.4.tgz", } SEVENZIP_WINDOWS_DOWNLOAD_URL = { "2301": "https://www.7-zip.org/a/7z2401-x64.exe" @@ -77,12 +75,12 @@ def get_autodesk_platform(): def get_autodesk_maya_usd_sdk_releases(platform_name, maya_version): - """Get the GitHub API service + """Get the Autodesk Maya USD SDK releases Args: client_id (str): The client id client_secret_key (str): The client secret key Returns: - sidefx.Service: The service + list[(str, str)]: A list of (version, url) pairs. """ # Query release data try: diff --git a/.github/scripts/maya_build.bat b/.github/scripts/maya_build.bat index 9694a8a..f16cda9 100644 --- a/.github/scripts/maya_build.bat +++ b/.github/scripts/maya_build.bat @@ -3,6 +3,6 @@ set MAYA_USD_SDK_DEVKIT_ROOT=%cd%\dependency\install\maya_usd_sdk_devkit set PYTHON_ROOT=%cd%\dependency\install\python set AR_DCC_NAME=MAYA set AR_RESOLVER_NAME=%1 -cmake . -B build -G "Visual Studio 16 2019" -A x64 -T v142 +cmake . -B build -G %2 -A x64 -T %3 cmake --build build --clean-first --config Release cmake --install build \ No newline at end of file diff --git a/.github/workflows/build_maya.yml b/.github/workflows/build_maya.yml index 765da77..0f0410a 100644 --- a/.github/workflows/build_maya.yml +++ b/.github/workflows/build_maya.yml @@ -19,7 +19,7 @@ jobs: strategy: matrix: maya_product_name: ["maya"] - maya_product_version: ["2024.2"] + maya_product_version: ["2024.2", "2025.2"] steps: - name: Checkout repository uses: actions/checkout@v4 @@ -63,7 +63,7 @@ jobs: name: UsdAssetResolver-linux-${{ matrix.maya_product_name }}-${{ matrix.maya_product_version }} path: artifacts/*.zip - build_windows: + build_windows_2019: runs-on: windows-2019 environment: maya strategy: @@ -88,16 +88,60 @@ jobs: python3 .github\scripts\maya.py --install --install_maya_product_name ${{ matrix.maya_product_name }} --install_maya_product_version ${{ matrix.maya_product_version }} --install_directory $pwd\dependency - name: Build USD File Resolver run: | - .\.github\scripts\maya_build.bat fileResolver + .\.github\scripts\maya_build.bat fileResolver "Visual Studio 16 2019" "v142" - name: Build USD Python Resolver run: | - .\.github\scripts\maya_build.bat pythonResolver + .\.github\scripts\maya_build.bat pythonResolver "Visual Studio 16 2019" "v142" - name: Build USD Cached Resolver run: | - .\.github\scripts\maya_build.bat cachedResolver + .\.github\scripts\maya_build.bat cachedResolver "Visual Studio 16 2019" "v142" - name: Build USD Http Resolver run: | - .\.github\scripts\maya_build.bat httpResolver + .\.github\scripts\maya_build.bat httpResolver "Visual Studio 16 2019" "v142" + - name: Create single .zip archive + run: | + & python $pwd\.github\scripts\maya.py --artifact --artifact_src=$pwd\dist --artifact_dst=$pwd\artifacts --artifact_prefix=UsdAssetResolver --artifact_product_name ${{ matrix.maya_product_name }} --install_directory $pwd\dependency + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: UsdAssetResolver-windows-${{ matrix.maya_product_name }}-${{ matrix.maya_product_version }} + path: artifacts/*.zip + + build_windows_2022: + runs-on: windows-2022 + environment: maya + strategy: + matrix: + maya_product_name: ["maya"] + maya_product_version: ["2025.2"] + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Switch to latest release tag + run: | + git fetch --all --tags --force + $latest_release_tag=git tag -l --sort=-version:refname v* | select -first 1 + git checkout tags/$latest_release_tag + - name: Install system packages + run: | + pip3 install requests + - name: Install Maya + run: | + python3 .github\scripts\maya.py --install --install_maya_product_name ${{ matrix.maya_product_name }} --install_maya_product_version ${{ matrix.maya_product_version }} --install_directory $pwd\dependency + - name: Build USD File Resolver + run: | + .\.github\scripts\maya_build.bat fileResolver "Visual Studio 17 2022" "v143" + - name: Build USD Python Resolver + run: | + .\.github\scripts\maya_build.bat pythonResolver "Visual Studio 17 2022" "v143" + - name: Build USD Cached Resolver + run: | + .\.github\scripts\maya_build.bat cachedResolver "Visual Studio 17 2022" "v143" + - name: Build USD Http Resolver + run: | + .\.github\scripts\maya_build.bat httpResolver "Visual Studio 17 2022" "v143" - name: Create single .zip archive run: | & python $pwd\.github\scripts\maya.py --artifact --artifact_src=$pwd\dist --artifact_dst=$pwd\artifacts --artifact_prefix=UsdAssetResolver --artifact_product_name ${{ matrix.maya_product_name }} --install_directory $pwd\dependency @@ -111,12 +155,12 @@ jobs: runs-on: ubuntu-latest permissions: contents: write - needs: [build_linux, build_windows] + needs: [build_linux, build_windows_2019, build_windows_2022] strategy: matrix: os: ["linux", "windows"] maya_product_name: ["maya"] - maya_product_version: ["2024.2"] + maya_product_version: ["2024.2", "2025.2"] steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/CMakeLists.txt b/CMakeLists.txt index 987f49a..0095a87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -157,14 +157,20 @@ elseif("$ENV{AR_DCC_NAME}" STREQUAL "MAYA") # Python set(AR_PYTHON_ROOT $ENV{PYTHON_ROOT} CACHE PATH "Python install directory") if (WIN32) - if(EXISTS "${AR_MAYA_USD_SDK_LIB_DIR}/boost_python310-vc142-mt-x64-1_76.dll") + if(EXISTS "${AR_MAYA_USD_SDK_LIB_DIR}/boost_python311-vc143-mt-x64-1_81.dll") + set(AR_PYTHON_LIB python3.11) + set(AR_PYTHON_LIB_NUMBER python311) + elseif(EXISTS "${AR_MAYA_USD_SDK_LIB_DIR}/boost_python310-vc142-mt-x64-1_76.dll") set(AR_PYTHON_LIB python3.10) set(AR_PYTHON_LIB_NUMBER python310) else() message(FATAL_ERROR "Failed to find a compatible Python version.") endif() else() - if(EXISTS "${AR_MAYA_USD_SDK_LIB_DIR}/libboost_python310.so") + if(EXISTS "${AR_MAYA_USD_SDK_LIB_DIR}/libboost_python311.so") + set(AR_PYTHON_LIB python3.11) + set(AR_PYTHON_LIB_NUMBER python311) + elseif(EXISTS "${AR_MAYA_USD_SDK_LIB_DIR}/libboost_python310.so") set(AR_PYTHON_LIB python3.10) set(AR_PYTHON_LIB_NUMBER python310) else() @@ -183,8 +189,15 @@ elseif("$ENV{AR_DCC_NAME}" STREQUAL "MAYA") # Boost set(AR_BOOST_NAMESPACE boost) if (WIN32) - set(AR_BOOST_PYTHON_LIB ${AR_BOOST_NAMESPACE}_${AR_PYTHON_LIB_NUMBER}-vc142-mt-x64-1_76) - set(AR_BOOST_INCLUDE_DIR ${AR_MAYA_INCLUDE_DIR}/${AR_BOOST_NAMESPACE}-1_76) + if(EXISTS "${AR_MAYA_USD_SDK_LIB_DIR}/boost_python311-vc143-mt-x64-1_81.dll") + set(AR_BOOST_PYTHON_LIB ${AR_BOOST_NAMESPACE}_${AR_PYTHON_LIB_NUMBER}-vc143-mt-x64-1_81) + set(AR_BOOST_INCLUDE_DIR ${AR_MAYA_INCLUDE_DIR}/${AR_BOOST_NAMESPACE}-1_81) + elseif(EXISTS "${AR_MAYA_USD_SDK_LIB_DIR}/boost_python310-vc142-mt-x64-1_76.dll") + set(AR_BOOST_PYTHON_LIB ${AR_BOOST_NAMESPACE}_${AR_PYTHON_LIB_NUMBER}-vc142-mt-x64-1_76) + set(AR_BOOST_INCLUDE_DIR ${AR_MAYA_INCLUDE_DIR}/${AR_BOOST_NAMESPACE}-1_76) + else() + message(FATAL_ERROR "Failed to find compatible Python Boost libs.") + endif() else() set(AR_BOOST_PYTHON_LIB ${AR_BOOST_NAMESPACE}_${AR_PYTHON_LIB_NUMBER}) set(AR_BOOST_INCLUDE_DIR ${AR_MAYA_INCLUDE_DIR}/${AR_BOOST_NAMESPACE})