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

MAYA-124107 - MayaUSD: build as Universal Binary 2 (x86_64 + arm64) #2575

Merged
merged 1 commit into from
Aug 31, 2022

Conversation

seando-adsk
Copy link
Collaborator

MAYA-124107 - MayaUSD: build as Universal Binary 2 (x86_64 + arm64)

  • Added support for Microsoft Visual Studio 2019/2022.
  • Created helper for general external project settings. Includes OSX UB2 and Linux CXX11_ABI.

* Added support for Microsoft Visual Studio 2019/2022.
* Created helper for general external project settings.
  Includes OSX UB2 and Linux CXX11_ABI.
@seando-adsk seando-adsk requested a review from boudrey August 30, 2022 20:41
@seando-adsk seando-adsk added the build Related to building maya-usd repository label Aug 30, 2022
Comment on lines +110 to +130
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)
Copy link
Collaborator Author

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.

Comment on lines -28 to -32
# 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()
Copy link
Collaborator Author

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}"
Copy link
Collaborator Author

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

Comment on lines +279 to +281
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
list(APPEND setting_list -D_GLIBCXX_USE_CXX11_ABI=0)
endif()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved from googletest.cmake

Comment on lines +303 to +307
if(BUILD_UB2)
# UB2 builds require this flag
external_project_conditional_define(CMAKE_OSX_ARCHITECTURES)
external_project_conditional_define(CMAKE_OSX_DEPLOYMENT_TARGET)
endif()
Copy link
Collaborator Author

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)
Copy link
Collaborator Author

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>")
Copy link
Collaborator Author

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)
Copy link
Contributor

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.

Copy link
Collaborator Author

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.

@seando-adsk seando-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Aug 31, 2022
@seando-adsk seando-adsk merged commit 7a415e5 into dev Aug 31, 2022
@seando-adsk seando-adsk deleted the donnels/MAYA-124107/support_for_ub2 branch August 31, 2022 17:47
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.

3 participants