From 0a69cafcc884ce23d4b0fa51726694f0f79e6a07 Mon Sep 17 00:00:00 2001 From: debloip Date: Wed, 10 Jan 2024 14:05:05 -0500 Subject: [PATCH 01/10] HYDRA-776 : Automatically determine Python version to use based on Maya version --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ed4f27a56b..a1256b11a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,6 @@ option(BUILD_SHARED_LIBS "Build libraries as shared or static." ON) if(APPLE) option(BUILD_UB2 "Build Universal Binary 2 (UB2) Intel64+arm64" OFF) endif() -set(BUILD_WITH_PYTHON_3_VERSION 3.10 CACHE STRING "The version of Python 3 to build with") option(CMAKE_WANT_MATERIALX_BUILD "Enable building with MaterialX (experimental)." OFF) set(PXR_OVERRIDE_PLUGINPATH_NAME PXR_PLUGINPATH_NAME @@ -89,6 +88,13 @@ set(MAYAHYDRA_VERSION "${MAYAHYDRA_MAJOR_VERSION}.${MAYAHYDRA_MINOR_VERSION}.${M include(cmake/flowViewport_version.info) set(FLOWVIEWPORT_VERSION "${FLOWVIEWPORT_MAJOR_VERSION}.${FLOWVIEWPORT_MINOR_VERSION}.${FLOWVIEWPORT_PATCH_LEVEL}") +set(DEFAULT_PYTHON_3_VERSION 3.10) +if (MAYA_APP_VERSION VERSION_GREATER 2024) + set(DEFAULT_PYTHON_3_VERSION 3.11) +endif() +if (NOT BUILD_WITH_PYTHON_3_VERSION) + set(BUILD_WITH_PYTHON_3_VERSION ${DEFAULT_PYTHON_3_VERSION}) +endif() if (DEFINED PYTHON_INCLUDE_DIR AND DEFINED PYTHON_LIBRARIES AND DEFINED Python_EXECUTABLE) SET(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}") SET(PYTHONLIBS_FOUND TRUE) From abd6b83994a6cb776885138547be56b03c6ecce6 Mon Sep 17 00:00:00 2001 From: debloip Date: Wed, 10 Jan 2024 14:54:43 -0500 Subject: [PATCH 02/10] HYDRA-776 : Remove Jinja --- CMakeLists.txt | 2 -- cmake/jinja.cmake | 56 ----------------------------------------------- doc/build.md | 3 +-- 3 files changed, 1 insertion(+), 60 deletions(-) delete mode 100644 cmake/jinja.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index a1256b11a3..cf1f4e88f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,8 +112,6 @@ message(STATUS " PYTHON_INCLUDE_DIRS = ${PYTHON_INCLUDE_DIRS}") message(STATUS " PYTHON_LIBRARIES = ${PYTHON_LIBRARIES}") message(STATUS " Python_EXECUTABLE = ${Python_EXECUTABLE}") -include(cmake/jinja.cmake) - find_package(USD 0.22.11 REQUIRED) if (CMAKE_WANT_MATERIALX_BUILD) # Requires at least USD 22.11 for hdMtlx module and USD must have been built with MaterialX: diff --git a/cmake/jinja.cmake b/cmake/jinja.cmake deleted file mode 100644 index 4aad9d6084..0000000000 --- a/cmake/jinja.cmake +++ /dev/null @@ -1,56 +0,0 @@ -# -# Copyright 2020 Autodesk -# -# 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. -# -#------------------------------------------------------------------------------ -# -# Gets the Jinja2 and the dependant MarkupSafe python libraries from -# artifactory and set them up. -# -function(init_markupsafe) - - mayaUsd_find_python_module(markupsafe) - - if (NOT MARKUPSAFE_FOUND) - if (NOT MARKUPSAFE_LOCATION) - message(FATAL_ERROR "MARKUPSAFE_LOCATION not set") - endif() - - set(MARKUPSAFE_ROOT "${MARKUPSAFE_LOCATION}/src") - - # Add MarkupSafe to the python path so that Jinja2 can run properly. - mayaUsd_append_path_to_env_var("PYTHONPATH" "${MARKUPSAFE_ROOT}") - endif() - -endfunction() - -function(init_jinja) - - mayaUsd_find_python_module(jinja2) - - if (NOT JINJA2_FOUND) - if (NOT JINJA_LOCATION) - message(FATAL_ERROR "JINJA_LOCATION not set") - endif() - - set(JINJA_ROOT "${JINJA_LOCATION}/src") - - # Add Jinja2 to the python path so that usdGenSchemas can run properly. - mayaUsd_append_path_to_env_var("PYTHONPATH" "${JINJA_ROOT}") - endif() - -endfunction() - -init_markupsafe() -init_jinja() diff --git a/doc/build.md b/doc/build.md index ebea19b063..5df7bda1a5 100644 --- a/doc/build.md +++ b/doc/build.md @@ -14,7 +14,7 @@ Before building the project, consult the following table to ensure you use the r | Compiler Requirement| Maya 2024 (VS 2022) | Maya 2024 (Xcode 13.4 or higher) | Maya 2024 (gcc 11.2.1) | | CMake Version (min/max) | 3.13...3.17 | 3.13...3.17 | 3.13...3.17 | | Python | 3.10.8 | 3.10.8 | 3.10.8 | -| Python Packages | PyYAML, PySide, PyOpenGL, Jinja2 | PyYAML, PySide2, PyOpenGL, Jinja2 | PyYAML, PySide, PyOpenGL, Jinja2 | +| Python Packages | PyYAML, PySide, PyOpenGL | PyYAML, PySide2, PyOpenGL | PyYAML, PySide, PyOpenGL | | Build generator | Visual Studio, Ninja (Recommended) | XCode, Ninja (Recommended) | Ninja (Recommended) | | Command processor | Visual Studio X64 2019 command prompt | bash | bash | | Supported Maya Version| 2024 | 2024 | 2024 | @@ -183,7 +183,6 @@ e.g ➜ pip list Package Version ---------- -------- -Jinja2 3.1.2 MarkupSafe 2.1.1 pip 22.2.1 PyOpenGL 3.1.6 From 61933fbc64412f6269c694aebf600e9e7dc01289 Mon Sep 17 00:00:00 2001 From: debloip Date: Wed, 10 Jan 2024 14:57:08 -0500 Subject: [PATCH 03/10] HYDRA-776 : Remove MarkupSafe --- doc/build.md | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/build.md b/doc/build.md index 5df7bda1a5..9eda8c00f5 100644 --- a/doc/build.md +++ b/doc/build.md @@ -183,7 +183,6 @@ e.g ➜ pip list Package Version ---------- -------- -MarkupSafe 2.1.1 pip 22.2.1 PyOpenGL 3.1.6 PySide2 5.15.2.1 From 47d6a09fe252c8f750bb8c10ec35878770bd4fe6 Mon Sep 17 00:00:00 2001 From: debloip Date: Wed, 10 Jan 2024 16:17:57 -0500 Subject: [PATCH 04/10] HYDRA-776 : Update MAYA_MODULE_PATH section, Ninja section and tool versions prerequisites --- doc/build.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/build.md b/doc/build.md index 9eda8c00f5..6e52e514eb 100644 --- a/doc/build.md +++ b/doc/build.md @@ -12,11 +12,11 @@ Before building the project, consult the following table to ensure you use the r |:---------------------:|:-------------------------:|:------------------------------------------------------------:|:---------------------------:| | Operating System | Windows 10
Windows 11 | High Sierra (10.13)
Mojave (10.14)
Catalina (10.15)
Big Sur (11.2.x) | Rocky Linux 8.6 / Linux® Red Hat® Enterprise 8.6 WS | | Compiler Requirement| Maya 2024 (VS 2022) | Maya 2024 (Xcode 13.4 or higher) | Maya 2024 (gcc 11.2.1) | -| CMake Version (min/max) | 3.13...3.17 | 3.13...3.17 | 3.13...3.17 | +| CMake Version (min/max) | 3.13...3.20 | 3.13...3.20 | 3.13...3.20 | | Python | 3.10.8 | 3.10.8 | 3.10.8 | | Python Packages | PyYAML, PySide, PyOpenGL | PyYAML, PySide2, PyOpenGL | PyYAML, PySide, PyOpenGL | | Build generator | Visual Studio, Ninja (Recommended) | XCode, Ninja (Recommended) | Ninja (Recommended) | -| Command processor | Visual Studio X64 2019 command prompt | bash | bash | +| Command processor | Visual Studio x64 2022 command prompt | bash | bash | | Supported Maya Version| 2024 | 2024 | 2024 | | Optional | ![](images/windows.png) | ![](images/mac.png) | ![](images/linux.png) | @@ -135,9 +135,9 @@ Examples: It is up to the user to select the CMake Generator of choice, but we encourage the use of the Ninja generator. To use the Ninja Generator, you need to first install the Ninja binary from https://ninja-build.org/ -You then need to set the generator to ```Ninja``` and the ```CMAKE_MAKE_PROGRAM``` variable to the Ninja binary you downloaded. +You then need to set the generator to ```Ninja```. ``` -python build.py --generator Ninja --build-args=-DCMAKE_MAKE_PROGRAM='path to ninja binary' +python build.py --generator Ninja ``` ##### Build and Install locations @@ -205,10 +205,11 @@ There is a related ADDITIONAL_PXR_PLUGINPATH_NAME cmake var which can be used if # How to Load Plug-ins in Maya -The provided module files (*.mod) facilitates setting various environment variables for plugins and libraries. After the project is successfully built, ```mayaHydra.mod``` are installed inside the install directory. In order for Maya to discover these mod files, ```MAYA_MODULE_PATH``` environment variable needs to be set to point to the location where the mod files are installed. +The provided module files (*.mod) facilitates setting various environment variables for plugins and libraries. After the project is successfully built, ```mayaHydra.mod``` is installed inside the install directory. In order for Maya to discover this mod file, the ```MAYA_MODULE_PATH``` environment variable needs to be set to point to the location where the mod file is installed. Examples: ``` set MAYA_MODULE_PATH=C:\workspace\install\RelWithDebInfo export MAYA_MODULE_PATH=/usr/local/workspace/install/RelWithDebInfo ``` +The MAYA_MODULE_PATH environment variable can also be set through the Maya.env file. Once MAYA_MODULE_PATH is set, run maya and go to ```Windows -> Setting/Preferences -> Plug-in Manager``` to load the plugins. From beed13e6fbb8c3f07bbb183d2464b10b58075472 Mon Sep 17 00:00:00 2001 From: debloip Date: Wed, 10 Jan 2024 16:30:56 -0500 Subject: [PATCH 05/10] HYDRA-776 : Add mentions to some possible CMake variables --- doc/build.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/build.md b/doc/build.md index 6e52e514eb..a74998cd3c 100644 --- a/doc/build.md +++ b/doc/build.md @@ -108,6 +108,11 @@ Name | Description BUILD_TESTS | builds all unit tests. | ON BUILD_STRICT_MODE | enforces all warnings as errors. | ON BUILD_SHARED_LIBS | build libraries as shared or static. | ON +BUILD_UB2 | build as Universal Binary 2 (OSX) | OFF +BUILD_WITH_PYTHON_3_VERSION | specify which Python 3 version to build with | Determined based on Maya version +Python_EXECUTABLE | path to the Python executable to build with | Determined automatically by CMake +PYTHON_INCLUDE_DIR | directory containing the Python header files | Determined using the DPython_EXECUTABLE +PYTHON_LIBRARIES | path to the Python library to link with | Determined using the DPython_EXECUTABLE ##### Stages From 486422499df4d7c11ce7aa3dc08d3e2c1602ff70 Mon Sep 17 00:00:00 2001 From: debloip Date: Wed, 10 Jan 2024 16:41:18 -0500 Subject: [PATCH 06/10] HYDRA-776 : List MaterialX variable --- doc/build.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/build.md b/doc/build.md index a74998cd3c..a1b0f2f0ff 100644 --- a/doc/build.md +++ b/doc/build.md @@ -71,7 +71,7 @@ cd maya-hydra ##### Arguments -There are four arguments that must be passed to the script: +There are at least four arguments that must be passed to the script: | Flags | Description | |-------------------- |-------------------------------------------------------------------------------------- | @@ -88,7 +88,7 @@ MacOSX: ➜ maya-hydra python build.py --maya-location /Applications/Autodesk/maya2024 --pxrusd-location /opt/local/USD-Release --devkit-location /opt/local/devkitBase /opt/local/workspace Windows: -c:\maya-hydra> python build.py --maya-location "C:\Program Files\Autodesk\Maya2024" --pxrusd-location C:\USD-Release --devkit-location C:\devkitBase C:\workspace +C:\maya-hydra> python build.py --maya-location "C:\Program Files\Autodesk\Maya2024" --pxrusd-location C:\USD-Release --devkit-location C:\devkitBase C:\workspace ``` ##### Build Arguments @@ -101,7 +101,7 @@ c:\maya-hydra> python build.py --maya-location "C:\Program Files\Autodesk\Maya20 --build-args="-DBUILD_TESTS=OFF" ``` -##### CMake Options +##### CMake Options and Variables Name | Description | Default --- | --- | --- @@ -113,6 +113,7 @@ BUILD_WITH_PYTHON_3_VERSION | specify which Python 3 version to build with Python_EXECUTABLE | path to the Python executable to build with | Determined automatically by CMake PYTHON_INCLUDE_DIR | directory containing the Python header files | Determined using the DPython_EXECUTABLE PYTHON_LIBRARIES | path to the Python library to link with | Determined using the DPython_EXECUTABLE +CMAKE_WANT_MATERIALX_BUILD | enable building with MaterialX (experimental) | OFF ##### Stages From a06540b034323b84d66c75b3de28b6427d0c0750 Mon Sep 17 00:00:00 2001 From: debloip Date: Wed, 10 Jan 2024 17:01:00 -0500 Subject: [PATCH 07/10] HYDRA-776 : Adjust UFE versions --- doc/build.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/build.md b/doc/build.md index a1b0f2f0ff..5b333a6122 100644 --- a/doc/build.md +++ b/doc/build.md @@ -25,7 +25,7 @@ Before building the project, consult the following table to ensure you use the r #### 2. Download and Build Pixar USD -See Pixar's official github page for instructions on how to build USD: https://github.com/PixarAnimationStudios/USD. Pixar has recently removed support for building Maya USD libraries/plug-ins in their github repository and ```build_usd.py```. +See Pixar's official github page for instructions on how to build USD: https://github.com/PixarAnimationStudios/USD. Pixar has removed support for building Maya USD libraries/plug-ins in their github repository and ```build_usd.py```. | | ![](images/pxr.png) | |:------------: |:---------------: | @@ -44,8 +44,7 @@ The Universal Front End (UFE) is a DCC-agnostic component that allows Maya to br | Ufe Version | Maya Version | Ufe Docs (external) | |----------------------------|--------------------------------------------------------|:-------------------:| -| v4.0.0 | Maya 2024 | https://help.autodesk.com/view/MAYAUL/2024/ENU/?guid=MAYA_API_REF_ufe_ref_index_html | -| v4.0.1 | Maya 2024.1 | | +| v4.0.0
v4.1.0
v4.2.0 | Maya 2024
Maya 2024.1
Maya 2024.2 | https://help.autodesk.com/view/MAYAUL/2024/ENU/?guid=MAYA_API_REF_ufe_ref_index_html | To build the project with UFE support, you will need to use the headers and libraries included in the ***Maya Devkit***: From f6d5b72e9862b195b0de189e2f8b16f349810faa Mon Sep 17 00:00:00 2001 From: debloip Date: Wed, 10 Jan 2024 17:13:01 -0500 Subject: [PATCH 08/10] HYDRA-776 : Update USD versions and Python versions --- doc/build.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/doc/build.md b/doc/build.md index 5b333a6122..76b2d9386b 100644 --- a/doc/build.md +++ b/doc/build.md @@ -13,7 +13,7 @@ Before building the project, consult the following table to ensure you use the r | Operating System | Windows 10
Windows 11 | High Sierra (10.13)
Mojave (10.14)
Catalina (10.15)
Big Sur (11.2.x) | Rocky Linux 8.6 / Linux® Red Hat® Enterprise 8.6 WS | | Compiler Requirement| Maya 2024 (VS 2022) | Maya 2024 (Xcode 13.4 or higher) | Maya 2024 (gcc 11.2.1) | | CMake Version (min/max) | 3.13...3.20 | 3.13...3.20 | 3.13...3.20 | -| Python | 3.10.8 | 3.10.8 | 3.10.8 | +| Python | 3.10.8, 3.11.4 | 3.10.8, 3.11.4 | 3.10.8, 3.11.4 | | Python Packages | PyYAML, PySide, PyOpenGL | PyYAML, PySide2, PyOpenGL | PyYAML, PySide, PyOpenGL | | Build generator | Visual Studio, Ninja (Recommended) | XCode, Ninja (Recommended) | Ninja (Recommended) | | Command processor | Visual Studio x64 2022 command prompt | bash | bash | @@ -27,15 +27,12 @@ Before building the project, consult the following table to ensure you use the r See Pixar's official github page for instructions on how to build USD: https://github.com/PixarAnimationStudios/USD. Pixar has removed support for building Maya USD libraries/plug-ins in their github repository and ```build_usd.py```. -| | ![](images/pxr.png) | -|:------------: |:---------------: | -| CommitID/Tags | Recommended : [v23.08](https://github.com/PixarAnimationStudios/OpenUSD/releases/tag/v23.08) | -| CommitID/Tags | For older maya-hydra plugin: [v22.11](https://github.com/PixarAnimationStudios/USD/releases/tag/v22.11) | +| | ![](images/pxr.png) |USD version used in Maya +|:------------: |:---------------: |:---------------: +| CommitID/Tags | [v22.11](https://github.com/PixarAnimationStudios/OpenUSD/releases/tag/v22.11) or [v23.08](https://github.com/PixarAnimationStudios/OpenUSD/releases/tag/v23.08) or [v23.11](https://github.com/PixarAnimationStudios/OpenUSD/releases/tag/v23.11) |Maya 2024 = v22.11
Maya PR = v23.11 For additional information on building Pixar USD, see the ***Additional Build Instruction*** section below. -***NOTE:*** Recommended version of USD for building the latest version of MayaHydra plugin is USD23.08 [v23.08](https://github.com/PixarAnimationStudios/OpenUSD/releases/tag/v23.08). If older version of USD needs to be used then maya-hydra v0.1.x is to be used for build and feature compatibility. - ***NOTE:*** Make sure that you don't have an older USD locations in your ```PATH``` and ```PYTHONPATH``` environment settings. ```PATH``` and ```PYTHONPATH``` are automatically adjusted inside the project to point to the correct USD location. See ```cmake/usd.cmake```. #### 3. Universal Front End (UFE) From 1b8f4b986e55bcc630dd61a9177edd3c6e3f94d8 Mon Sep 17 00:00:00 2001 From: debloip Date: Wed, 10 Jan 2024 17:36:40 -0500 Subject: [PATCH 09/10] HYDRA-776 : Add instruction for troubleshooting Python errors --- doc/build.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/doc/build.md b/doc/build.md index 76b2d9386b..209ca9a30a 100644 --- a/doc/build.md +++ b/doc/build.md @@ -87,6 +87,28 @@ Windows: C:\maya-hydra> python build.py --maya-location "C:\Program Files\Autodesk\Maya2024" --pxrusd-location C:\USD-Release --devkit-location C:\devkitBase C:\workspace ``` +**Notes:** +- For OSX builds, you might need to toggle on the `BUILD_UB2` CMake option to build Universal Binary 2 binaries (see below). +- If you get an error saying that the correct Python version could not be found, or an error such as "Imported target includes non-existent path" pointing to a Python path, you might need to specify the `Python_EXECUTABLE`, `PYTHON_INCLUDE_DIR` and `PYTHON_LIBRARIES` CMake variables to point to directories of the bundled Maya Python. Here is what to set them to for each platform : +``` +Linux: +Python_EXECUTABLE=/bin/mayapy +PYTHON_INCLUDE_DIR=/include/Python/Python (e.g. /include/Python311/Python) +PYTHON_LIBRARIES=/lib/libpython.so (e.g. : /lib/libpython3.11.so) + +OSX: +Python_EXECUTABLE=/Maya.app/Contents/bin/mayapy +PYTHON_INCLUDE_DIR=/Maya.app/Contents/Frameworks/Python.framework/Versions//include/python +(e.g. /Maya.app/Contents/Frameworks/Python.framework/Versions/3.11/include/python3.11) +PYTHON_LIBRARIES=/Maya.app/Contents/Frameworks/Python.framework/Versions//lib/libpython.dylib +(e.g. : /Maya.app/Contents/Frameworks/Python.framework/Versions/3.11/lib/libpython3.11.dylib) + +Windows: +Python_EXECUTABLE=\bin\mayapy.exe +PYTHON_INCLUDE_DIR=\include\Python\Python (e.g. \include\Python311\Python) +PYTHON_LIBRARIES=\lib\python.lib (e.g. : \lib\python311.lib) +``` + ##### Build Arguments | Flag | Description | From f2f96cbf2a558e74d82ebad99187b658975c26e8 Mon Sep 17 00:00:00 2001 From: debloip Date: Wed, 10 Jan 2024 18:23:49 -0500 Subject: [PATCH 10/10] HYDRA-776 : Mention PR as supported --- doc/build.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/build.md b/doc/build.md index 209ca9a30a..a22982e0f0 100644 --- a/doc/build.md +++ b/doc/build.md @@ -17,7 +17,7 @@ Before building the project, consult the following table to ensure you use the r | Python Packages | PyYAML, PySide, PyOpenGL | PyYAML, PySide2, PyOpenGL | PyYAML, PySide, PyOpenGL | | Build generator | Visual Studio, Ninja (Recommended) | XCode, Ninja (Recommended) | Ninja (Recommended) | | Command processor | Visual Studio x64 2022 command prompt | bash | bash | -| Supported Maya Version| 2024 | 2024 | 2024 | +| Supported Maya Version| 2024, PR | 2024, PR | 2024, PR | | Optional | ![](images/windows.png) | ![](images/mac.png) | ![](images/linux.png) |