-
Notifications
You must be signed in to change notification settings - Fork 203
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
Detect if USD was built with extra security patches #2945
Conversation
and set mod file variable MAYA_USD_VERSION accordingly.
# Set special Autodesk USD version. We use this to communicate whether or not | ||
# there are extra patches on-top of the normal USD build. | ||
set(ADSK_USD_VERSION ${USD_VERSION}) | ||
if (USD_VERSION VERSION_LESS_EQUAL "0.23.02") | ||
# In the security fix there was a new inline method "max_size" added so we | ||
# can use that to determine if this USD build has the security fix. | ||
if (USD_INCLUDE_DIR AND EXISTS "${USD_INCLUDE_DIR}/pxr/base/vt/array.h") | ||
file(STRINGS ${USD_INCLUDE_DIR}/pxr/base/vt/array.h USD_HAS_SECURITY_PATCH REGEX "constexpr size_t max_size\(\)") | ||
if (USD_HAS_SECURITY_PATCH) | ||
set(ADSK_USD_VERSION "${ADSK_USD_VERSION}-ad1") | ||
message(STATUS "USD v${USD_VERSION} has security patches.") | ||
endif() | ||
endif() | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added new cmake variable "ADSK_USD_VERSION" which starts out equal to normal "USD_VERSION". Detect in an automatic way if the USD build (any version <= 0.23.02) has the extra security patches. Do this by looking at the vt/array.h header file for a new method which was added in one of the patches. If so then add "-ad1" to new variable ADSK_USD_VERSION.
@@ -233,7 +233,7 @@ void registerVersionedPlugins() | |||
static std::once_flag once; | |||
std::call_once(once, []() { | |||
const std::string pythonVersion = TOSTRING(MAYA_PY_VERSION); | |||
const std::string usdVersion = TOSTRING(MAYA_USD_VERSION); | |||
const std::string usdVersion = TOSTRING(ADSK_USD_VERSION); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the new adsk usd version here which may contain "-ad1".
@@ -6,7 +6,7 @@ scripts: | |||
resources: | |||
PYTHONPATH+:=lib/python | |||
USD_LOCATION:= | |||
MAYA_USD_VERSION=${USD_VERSION} | |||
MAYA_USD_VERSION=${ADSK_USD_VERSION} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the mod file set MAYA_USD_VERSION to new ADSK_USD_VERSION.
Detect if USD was built with extra security patches and set mod file variable MAYA_USD_VERSION accordingly.