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

Incompatible with USD 23.11 and C++17 #3426

Closed
dgovil opened this issue Oct 31, 2023 · 4 comments
Closed

Incompatible with USD 23.11 and C++17 #3426

dgovil opened this issue Oct 31, 2023 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@dgovil
Copy link
Collaborator

dgovil commented Oct 31, 2023

Describe the issue
When trying to build Maya USD against USD 23.11, I'm hitting two issues.

  1. USD 23.11 uses C++17, and Maya USD doesn't specify a CXX standard , so fails to support new C++17 features
  2. The Boost version that aligns with Maya 2024 doesn't support new clang versions because it assumes deprecated functions are still available. See Building with C++17 standard and Boost results in use of removed functions PixarAnimationStudios/OpenUSD#2634

The change to make both work would be simply adding the following:

set(CMAKE_CXX_STANDARD 17)
add_compile_definitions(BOOST_NO_CXX98_FUNCTION_BASE)

While a PR would be small and minimal, I didn't want to make these assumptions as something Autodesk wants across the board.

@dgovil dgovil added the help wanted Extra attention is needed label Oct 31, 2023
@seando-adsk
Copy link
Collaborator

Actually we do set the CXX standard here: https://github.com/Autodesk/maya-usd/blob/dev/cmake/compiler_config.cmake#L90
I am working on updating our internal builds to USD 23.11. For that I have changed this line to:

            # USD updated to c++17 for USD v23.11
            $<IF:$<VERSION_GREATER_EQUAL:${USD_VERSION},0.23.11>,cxx_std_17,cxx_std_14>

I'm not sure about the var BOOST_NO_CXX98_FUNCTION_BASE. We won't be updating USD for Maya 2024 (it will remain at 22.11). Will adding that var have an impact on our preflight builds with previous Maya's that use older USD builds?

Sean

@dgovil
Copy link
Collaborator Author

dgovil commented Oct 31, 2023

Ah I'd done a grep for CMAKE_CXX_STANDARD and missed that.
Regarding BOOST_NO_CXX98_FUNCTION_BASE, I don't think it should have a negative effect on older Maya builds.

Sunya had done this in USD with this note

# Parts of boost (in particular, boost::hash) rely on deprecated features
# of the STL that have been removed from some implementations under C++17.
# This define tells boost not to use those features.
#
# Under Visual Studio, boost automatically detects that this flag is
# needed so we don't need to define it ourselves. Otherwise, we'll get a
# C4005 macro redefinition warning.
if (NOT MSVC)
    _add_define(BOOST_NO_CXX98_FUNCTION_BASE)
endif()

So it seems like what might make sense is that if both these conditions are true, then the variable is set:

  • Using anything except MSVC
  • Using C++17 or higher

That would leave your older builds alone

@seando-adsk
Copy link
Collaborator

Do we need that flag for only clang, or gcc as well? I can incorporate this into my changes.

Sean

@dgovil
Copy link
Collaborator Author

dgovil commented Oct 31, 2023

GCC would need it as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants