Skip to content

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

Merged
seando-adsk merged 2 commits intodevfrom
donnels/EMSUSD-2133/remove_boost
Jul 31, 2025
Merged

EMSUSD-2133 - [GitHub #4095] Remove Boost#4250
seando-adsk merged 2 commits intodevfrom
donnels/EMSUSD-2133/remove_boost

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

# 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.

# 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.

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

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.

AramAzhari-adsk
AramAzhari-adsk previously approved these changes Jul 4, 2025
@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.

@seando-adsk
Copy link
Collaborator Author

@AramAzhari-adsk I had to merge in latest dev to resolve some conflicts. Nothing should have changed.

@seando-adsk seando-adsk self-assigned this Jul 30, 2025
@seando-adsk seando-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Jul 31, 2025
@seando-adsk seando-adsk merged commit 5502d83 into dev Jul 31, 2025
11 checks passed
@seando-adsk seando-adsk deleted the donnels/EMSUSD-2133/remove_boost branch July 31, 2025 12:09
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 ready-for-merge Development process is finished, PR is ready for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants