-
Notifications
You must be signed in to change notification settings - Fork 202
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
MAYA-124107 - MayaUSD: build as Universal Binary 2 (x86_64 + arm64) #2575
Conversation
* Added support for Microsoft Visual Studio 2019/2022. * Created helper for general external project settings. Includes OSX UB2 and Linux CXX11_ABI.
def IsVisualStudioVersionOrGreater(desiredVersion): | ||
if not Windows(): | ||
return False | ||
|
||
msvcCompilerAndVersion = GetVisualStudioCompilerAndVersion() | ||
if msvcCompilerAndVersion: | ||
_, version = msvcCompilerAndVersion | ||
return version >= VISUAL_STUDIO_2017_VERSION | ||
return version >= desiredVersion | ||
return False | ||
|
||
def IsVisualStudio2022OrGreater(): | ||
VISUAL_STUDIO_2022_VERSION = (17, 0) | ||
return IsVisualStudioVersionOrGreater(VISUAL_STUDIO_2022_VERSION) | ||
|
||
def IsVisualStudio2019OrGreater(): | ||
VISUAL_STUDIO_2019_VERSION = (16, 0) | ||
return IsVisualStudioVersionOrGreater(VISUAL_STUDIO_2019_VERSION) | ||
|
||
def IsVisualStudio2017OrGreater(): | ||
VISUAL_STUDIO_2017_VERSION = (15, 0) | ||
return IsVisualStudioVersionOrGreater(VISUAL_STUDIO_2017_VERSION) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added support for both VS2019 and VS2022.
# Force the use of ABI version 0 on Linux. | ||
# This is what Maya has been using for 2019...2023 | ||
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") | ||
set(FORCE_OLD_ABI "-D_GLIBCXX_USE_CXX11_ABI=0") | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved into new helper: get_external_project_default_values()
@@ -21,9 +21,8 @@ ExternalProject_Add(googletest | |||
SOURCE_DIR "${GOOGLETEST_BUILD_ROOT}/googletest-src" | |||
BINARY_DIR "${GOOGLETEST_BUILD_ROOT}/googletest-build" | |||
CMAKE_ARGS | |||
"-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}" | |||
"${MAYAUSD_EXTERNAL_PROJECT_GENERAL_SETTINGS}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just like Maya does, use a set of general settings for all external projects (MayaUsd currently only has one for googletest).
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") | ||
list(APPEND setting_list -D_GLIBCXX_USE_CXX11_ABI=0) | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved from googletest.cmake
if(BUILD_UB2) | ||
# UB2 builds require this flag | ||
external_project_conditional_define(CMAKE_OSX_ARCHITECTURES) | ||
external_project_conditional_define(CMAKE_OSX_DEPLOYMENT_TARGET) | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add flags for UB2
# It can take an optional argument that will replace the list separator | ||
# in CMake values. For instance, if an external project uses a different | ||
# list separator, the values in here must be changed to reflect this. | ||
function(get_external_project_default_values out_var) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically copied this function from Maya for how it setup the external projects.
endfunction(get_external_project_default_values) | ||
|
||
# Create one for all the project using the default list separator | ||
get_external_project_default_values(MAYAUSD_EXTERNAL_PROJECT_GENERAL_SETTINGS "$<SEMICOLON>") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create one variable "MAYAUSD_EXTERNAL_PROJECT_GENERAL_SETTINGS" with all general settings. Used by googletest external project.
# Force the use of ABI version 0 on Linux. | ||
# This is what Maya has been using for 2019...2023 | ||
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") | ||
list(APPEND setting_list -D_GLIBCXX_USE_CXX11_ABI=0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was supposed to change for 2024, I don't know what is the current status of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I'm aware of this. Its part of the support for RHEL8. We'll need changes for USD and MayaUsd at some point.
MAYA-124107 - MayaUSD: build as Universal Binary 2 (x86_64 + arm64)