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

[build_usd.py] add --toolset option #1325

Merged
merged 1 commit into from
Sep 30, 2020

Conversation

neilo-df
Copy link
Contributor

Description of Change(s)

This change adds the --toolset option to the build which corresponds to passing the cmake parameter -T <toolset> into the build, or the equivalent b2 flag toolset=<toolset> for any boost components that need to be built.

While the support for --toolset can be applied generally to any cmake generator supporting toolsets, the work here was motivated by Windows, where it is possible to have multiple versions of Visual Studio with one or more compiler toolsets. With this change the caller can configure exactly which generator and toolset will be used.

Fixes Issue(s)

  • prior to this change there was no convenient way to compile USD with an older/alternate toolset on Windows; for example using Visual Studio 2019 but compiling for toolset v141 or earlier,

While the support for --toolset is general, the work here was
motivated by Windows, where it is possible to have multiple versions
of Visual Studio with one or more compiler toolsets.  With this change
the caller can configure exactly which generator and toolset will be
used.
@spitzak
Copy link

spitzak commented Sep 15, 2020

I think it would be better to just make a way to pass arbitrary extra parameters to cmake from the build_usd.py script.

@neilo-df
Copy link
Contributor Author

Hi Bill, yes, I considered using the --build-args option and of course I tried that first, but it isn't quite that simple.

What I found is you need to modify build_usd.py anyway because on Windows the boost build hardcodes the toolset. What that logic says is, "use whatever is the newest toolset corresponding to the newest version of Visual Studio found on this machine." The heuristic is wrong in the case where you use Visual Studio 2019 but need to target an older toolset like v141. The heuristic also ignores --generator which in principle can select from multiple versions of Visual Studio if more than one is available.

So following down that path was turning into a bunch more logic in the way Boost is built, and little additional clarity to the caller that they would need to match "--toolset=msvc-14.1" specifically for Boost, and "-T v141" specifically for things built with cmake.

IMHO this way seemed cleaner under the hood and offers more explicit parameterization for the caller.

@meshula
Copy link
Member

meshula commented Sep 15, 2020

Related ~ Allow user to specify boost version #347

@jtran56
Copy link

jtran56 commented Sep 16, 2020

Filed as internal issue #USD-6344

@sunyab
Copy link
Contributor

sunyab commented Sep 18, 2020

I haven't looked deeply at this PR yet but my initial reaction is that given the first-class status we've given to CMake's "generator" argument, adding "toolset" as well is consistent and avoids the issues that @neilo-df mentioned.

@pixar-oss pixar-oss merged commit 3166ebd into PixarAnimationStudios:dev Sep 30, 2020
@neilo-df neilo-df deleted the pr-win-build branch March 22, 2022 15:00
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