Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAYA-105621 - MayaUSD: install USD from artifact beside plugin #631

Merged
merged 5 commits into from
Jul 10, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,16 @@ endif()
#------------------------------------------------------------------------------
# install
#------------------------------------------------------------------------------
configure_file(mayaUSD.mod.template ${PROJECT_BINARY_DIR}/mayaUSD.mod)
if (DEFINED MAYAUSD_TO_USD_RELATIVE_PATH)
set(USD_INSTALL_LOCATION "${CMAKE_INSTALL_PREFIX}/${MAYAUSD_TO_USD_RELATIVE_PATH}")
else()
set(USD_INSTALL_LOCATION ${PXR_USD_LOCATION})
endif()
Comment on lines +180 to +184
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When given a USD relative path (from the ADSK internal build system) we will use that for the USD path in the .mod file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: "USD_INSTALL_LOCATION" is a variable inside the module template files.

if (IS_WINDOWS)
configure_file(mayaUSD_Win.mod.template ${PROJECT_BINARY_DIR}/mayaUSD.mod)
else()
configure_file(mayaUSD.mod.template ${PROJECT_BINARY_DIR}/mayaUSD.mod)
endif()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created Windows specific .mod file (with PATH) and one for Linux/Mac (no PATH)

install(FILES ${PROJECT_BINARY_DIR}/mayaUSD.mod
DESTINATION ${CMAKE_INSTALL_PREFIX}
)
10 changes: 8 additions & 2 deletions cmake/usd.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,15 @@
#
function(init_usd)
# Adjust PYTHONPATH, PATH
mayaUsd_append_path_to_env_var("PYTHONPATH" "${PXR_USD_LOCATION}/lib/python")
if (DEFINED MAYAUSD_TO_USD_RELATIVE_PATH)
set(USD_INSTALL_LOCATION "${CMAKE_INSTALL_PREFIX}/${MAYAUSD_TO_USD_RELATIVE_PATH}")
else()
set(USD_INSTALL_LOCATION ${PXR_USD_LOCATION})
endif()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again when given a USD relative path, use that for the PATH and PYTHONPATH.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized (from a clean build) that this change breaks the build. We need the PATH and PYTHONPATH to usd during the configure step for generating the schemas. So for that step we need to use USD from it's original location.

But then for running the tests we would want PATH & PYTHONPATH to point to the USD in the install folder. I need to think some more how to fix this.


mayaUsd_append_path_to_env_var("PYTHONPATH" "${USD_INSTALL_LOCATION}/lib/python")
if(WIN32)
mayaUsd_append_path_to_env_var("PATH" "${PXR_USD_LOCATION}/bin;${PXR_USD_LOCATION}/lib")
mayaUsd_append_path_to_env_var("PATH" "${USD_INSTALL_LOCATION}/bin;${USD_INSTALL_LOCATION}/lib")
endif()
endfunction()

Expand Down
29 changes: 17 additions & 12 deletions mayaUSD.mod.template
Original file line number Diff line number Diff line change
@@ -1,32 +1,37 @@
+ USD ${USD_VERSION} ${PXR_USD_LOCATION}
+ USD ${USD_VERSION} ${USD_INSTALL_LOCATION}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to new variable which is set from top-level CMakeLists.txt above.

icons:
plug-ins:
presets:
scripts:
resources:
Comment on lines +2 to +6
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Maya module specific tags to not add anything specific for these paths since USD is not a Maya plugin and doesn't need Maya to know about its icons/presets/etc.

PYTHONPATH+:=lib/python
PATH+:=bin
PATH+:=lib
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These PATH vars are no needed on Linux/Mac. There is a Windows specific .mod template now.


+ PXR_USDMAYA ${USD_VERSION} ${CMAKE_INSTALL_PREFIX}/plugin/pxr
icons: maya/lib/usd/usdMaya/resources
plug-ins: maya/plugin
scripts: maya/lib/usd/usdMaya/resources
Comment on lines +12 to +14
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use module tags rather than setting the vars directly.

PYTHONPATH+:=lib/python
PATH+:=maya/lib
XBMLANGPATH+:=maya/lib/usd/usdMaya/resources
MAYA_SCRIPT_PATH+:=maya/lib/usd/usdMaya/resources
MAYA_PLUG_IN_PATH+:=maya/plugin
PXR_PLUGINPATH_NAME+:=lib/usd

+ MayaUSD_LIB ${MAYAUSD_VERSION} ${CMAKE_INSTALL_PREFIX}
PATH+:=lib
icons:
plug-ins:
presets:
scripts:
resources:
PYTHONPATH+:=lib/python
PXR_PLUGINPATH_NAME+:=lib/usd
VP2_RENDER_DELEGATE_PROXY=1
${MAYAUSD_GTEST_PATH}

+ MayaUSD ${MAYAUSD_VERSION} ${CMAKE_INSTALL_PREFIX}/plugin/adsk
MAYA_PLUG_IN_PATH+:=plugin
plug-ins: plugin

+ AL_USDMaya ${AL_USDMAYA_VERSION} ${CMAKE_INSTALL_PREFIX}/plugin/al
plug-ins: plugin
PYTHONPATH+:=lib/python
PATH+:=lib
MAYA_PLUG_IN_PATH+:=plugin
PXR_PLUGINPATH_NAME+:=lib/usd
PXR_PLUGINPATH_NAME+:=plugin

+ MTOH ${MAYAUSD_VERSION} ${CMAKE_INSTALL_PREFIX}/lib
MAYA_PLUG_IN_PATH+:=maya
plug-ins: maya
42 changes: 42 additions & 0 deletions mayaUSD_Win.mod.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
+ USD ${USD_VERSION} ${USD_INSTALL_LOCATION}
icons:
plug-ins:
presets:
scripts:
resources:
PYTHONPATH+:=lib/python
PATH+:=bin
PATH+:=lib
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows specific mod template which just has these extra PATH lines. Otherwise it's identical.


+ PXR_USDMAYA ${USD_VERSION} ${CMAKE_INSTALL_PREFIX}/plugin/pxr
icons: maya/lib/usd/usdMaya/resources
plug-ins: maya/plugin
scripts: maya/lib/usd/usdMaya/resources
PYTHONPATH+:=lib/python
PATH+:=maya/lib
PXR_PLUGINPATH_NAME+:=lib/usd

+ MayaUSD_LIB ${MAYAUSD_VERSION} ${CMAKE_INSTALL_PREFIX}
icons:
plug-ins:
presets:
scripts:
resources:
PATH+:=lib
PYTHONPATH+:=lib/python
PXR_PLUGINPATH_NAME+:=lib/usd
VP2_RENDER_DELEGATE_PROXY=1
${MAYAUSD_GTEST_PATH}

+ MayaUSD ${MAYAUSD_VERSION} ${CMAKE_INSTALL_PREFIX}/plugin/adsk
plug-ins: plugin

+ AL_USDMaya ${AL_USDMAYA_VERSION} ${CMAKE_INSTALL_PREFIX}/plugin/al
plug-ins: plugin
PYTHONPATH+:=lib/python
PATH+:=lib
PXR_PLUGINPATH_NAME+:=lib/usd
PXR_PLUGINPATH_NAME+:=plugin

+ MTOH ${MAYAUSD_VERSION} ${CMAKE_INSTALL_PREFIX}/lib
plug-ins: maya