Skip to content

EMSUSD-2133 - [GitHub #4095] Remove Boost #4250

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

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

seando-adsk
Copy link
Collaborator

EMSUSD-2133 - [GitHub #4095] Remove Boost

  • New cxx17_legacy_support.h file to deal with c++14/17.
  • No longer need to find Boost. Removed linking of Boost.
  • Conditional boost compile definitions.
  • Rewrote coding guidelines related to Boost.
  • Fixed comments to remove Boost.
  • boost::has -> TfHash/std::hash.

* New cxx17_legacy_support.h file to deal with c++14/17.
* No longer need to find Boost. Removed linking of Boost.
* Conditional boost compile definitions.
* Rewrote coding guidelines related to Boost.
* Fixed comments to remove Boost.
* boost::has -> TfHash/std::hash.
@seando-adsk seando-adsk added the build Related to building maya-usd repository label Jun 26, 2025
@@ -54,7 +54,7 @@ IncludeCategories:
# Priority 0

# 3. All public headers from this repository (maya-usd)
- Regex: '^<(mayaUsd.*|hdMaya|AL|usdMaya)/'
- Regex: '(cxx17_legacy_support\.h|^<(mayaUsd.*|hdMaya|AL|usdMaya)/)'
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

New file which I'll describe its purpose below.

@@ -527,9 +527,9 @@ def BuildAndInstall(context, buildArgs, stages):
# Many people on Windows may not have python with the
# debugging symbol (python27_d.lib) installed, this is the common case.
if context.buildDebug and context.debugPython:
extraArgs.append('-DMAYAUSD_DEFINE_BOOST_DEBUG_PYTHON_FLAG=ON')
extraArgs.append('-DMAYAUSD_DEFINE_DEBUG_PYTHON_FLAG=ON')
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Simply renamed this flag to remove BOOST

Comment on lines +36 to +38
namespace MayaUsdCxxLegacySupport {
using boost::optional;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unfortunately when compiling with C++14 there is no std::optional - thus there are a couple of cases where its still needed. Its our older builds for Maya 2023. That build has a USD which still has boost.

@@ -67,7 +67,8 @@ bool UsdMayaShaderReader::TraverseUnconnectableInput(const TfToken& usdAttrName)

void UsdMayaShaderReader::PostConnectSubtree(UsdMayaPrimReaderContext* context) { }

boost::optional<UsdMayaShaderReader::IsConverterResult> UsdMayaShaderReader::IsConverter()
MayaUsdCxxLegacySupport::optional<UsdMayaShaderReader::IsConverterResult>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This comes from that new legacy header. C++14 == boost::optional, C++17 == std::optional

@@ -626,11 +626,7 @@ px_vp20Utils::GetLightingContextFromDrawContext(const MHWRender::MDrawContext& c
light.SetSpotCutoff(lightCutoff);
light.SetSpotFalloff(lightFalloff);
light.SetAttenuation(lightAttenuation);
#if HDX_API_VERSION >= 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.

USD v21.11 is our min, so only need to support 9+

// To get rid of boost here, switch to C++17 compatible implementation:
// return std::hash(std::string_view(s.asChar(), s.length()))();
#if (__cplusplus >= 201703L)
return std::hash<std::string_view> {}(std::string_view(s.asChar(), s.length()));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

std::string_view is C++17, so again we still need to support older Maya 2023 builds using boost.

@seando-adsk
Copy link
Collaborator Author

@hamedsabri Hamed, can you have a look at these changes to remove Boost and let me know if everything looks good.

@dj-mcg Dan, can you try building with this branch to make sure these changes don't affect your internal build system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Related to building maya-usd repository
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants