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

Fixes for calling into a USD library built with MSVC, from code built with clang-cl #1079

Merged

Conversation

marktucker
Copy link
Contributor

Description of Change(s)

Submitting these changes on behalf of @e4lam.

From a clang-cl project that uses a pre-built USD library (with MSVC, but that's fine because they're ABI compatible). A few source header adjustments that clang complained about:

  • pxr/base/tf/preprocessorUtils.h: Replace uses of ARCH_OS_WINDOWS with ARCH_COMPILER_MSVC because clang-cl's preprocessor is better. This fixes many compiler errors with the use of boost cpp.
  • pxr/usd/sdf/fileFormat.h: Remove SDF_API from "= delete" methods because it doesn't make sense to export deleted methods. I'm surprised that the other compilers allow this.
  • pxr/usd/ar/asset.h: Remove AR_API from "= delete" methods for same reason as previous.
  • pxr/base/arch/attributes.h: Fix ARCH_CONSTRUCTOR and ARCH_DESTRUCTOR. This issue only showed up when trying to use AR_DEFINE_RESOLVER() in client code and then noticing that it had failed to register the resolver because the ctor (and presumably the dtor as well) never gets called when the plugin library is loaded.

Fixes Issue(s)

… but that's fine because they're ABI compatible). A few source header adjustments that clang complained about:

* pxr/base/tf/preprocessorUtils.h: Replace uses of ARCH_OS_WINDOWS with ARCH_COMPILER_MSVC because clang-cl's preprocessor is better. This fixes many compiler errors with the use of boost cpp.
* pxr/usd/sdf/fileFormat.h: Remove SDF_API from "= delete" methods because it doesn't make sense to export deleted methods. I'm surprised that the other compilers allow this.
* pxr/usd/ar/asset.h: Remove AR_API from "= delete" methods for same reason as previous.
* pxr/base/arch/attributes.h: Fix ARCH_CONSTRUCTOR and ARCH_DESTRUCTOR. This issue only showed up when trying to use AR_DEFINE_RESOLVER() in client code and then noticing that it had failed to register the resolver because the ctor (and presumably the dtor as well) never gets called when the plugin library is loaded.
@jilliene
Copy link

Filed as internal issue #USD-5792

pixar-oss added a commit that referenced this pull request Feb 11, 2020
Fixes for calling into a USD library built with MSVC, from code built with clang-cl

(Internal change: 2039781)
@pixar-oss pixar-oss merged commit de08485 into PixarAnimationStudios:dev Feb 11, 2020
@e4lam
Copy link

e4lam commented Feb 12, 2020

Thank you, everyone!

@marktucker marktucker deleted the dev_windows_clangcl branch April 9, 2020 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants