Skip to content

Commit

Permalink
Merge branch 'dev' into sabrih/MAYA-101460/pxr_mesh_write_part1
Browse files Browse the repository at this point in the history
  • Loading branch information
Hamed Sabri committed Jun 1, 2020
2 parents 21850e1 + a1a3871 commit 39c824f
Show file tree
Hide file tree
Showing 278 changed files with 10,284 additions and 3,242 deletions.
79 changes: 79 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
Language: Cpp

BasedOnStyle: WebKit
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveMacros: 'true'
AlignConsecutiveDeclarations: 'true'
AlignEscapedNewlines: Left
AlignTrailingComments: 'true'
AllowAllConstructorInitializersOnNextLine: 'false'
AllowAllParametersOfDeclarationOnNextLine: 'false'
AllowShortCaseLabelsOnASingleLine: 'true'
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: 'true'
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: 'false'
BinPackParameters: 'false'
BreakBeforeTernaryOperators: 'true'
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeComma
ColumnLimit: '100'
FixNamespaceComments: 'true'
IncludeBlocks: Regroup
IncludeCategories:

# Desired final ordering:
# 1. Related header
# 2. All private headers
# 3. All public headers from this repository (maya-usd)
# 4. Pixar + USD headers
# 5. Autodesk + Maya headers
# 6. Other libraries' headers
# 7. C++ standard library headers
# 8. C system headers
# 9. Conditional includes

# 1. Related header
# Handled by the default IncludeIsMainRegex regex, and auto-assigned
# Priority 0

# 3. All public headers from this repository (maya-usd)
- Regex: '^<(mayaUsd|hdMaya|AL|usdMaya)/'
Priority: 3

# 4. Pixar + USD headers
- Regex: '^<pxr/'
Priority: 4

# 5. Autodesk + Maya headers
- Regex: '^<(maya|ufe)/'
Priority: 5

# 7. C++ standard library headers
# angle brackets, no directory, no extension
- Regex: '^<[A-Za-z0-9_-]+>$'
Priority: 7

# 8. C system headers
# angle brackets, no directory, end with ".h"
- Regex: '^<[A-Za-z0-9_-]+\.h>$'
Priority: 8

# 2. All private headers
- Regex: '^"'
Priority: 2

# 6. Other libraries' headers
- Regex: '^<'
Priority: 6

# 9. Conditional includes
# Not reordered by clang-format, we need to manually make sure these come last

MaxEmptyLinesToKeep: '1'
NamespaceIndentation: None
UseTab: Never

...
Empty file added .clang-format-exclude
Empty file.
8 changes: 8 additions & 0 deletions .clang-format-include
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
\.c$
\.cc$
\.cpp$
\.cxx$
\.h$
\.hh$
\.hpp$
\.hxx$
39 changes: 16 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ option(BUILD_PXR_PLUGIN "Build the Pixar USD plugin and libraries." ON)
option(BUILD_AL_PLUGIN "Build the Animal Logic USD plugin and libraries." ON)
option(BUILD_HDMAYA "Build the Maya-To-Hydra plugin and scene delegate." ON)
option(BUILD_TESTS "Build tests." ON)
option(BUILD_STRICT_MODE "Enforce all warnings as errors." ON)
option(BUILD_SHARED_LIBS "Build libraries as shared or static." ON)
option(BUILD_WITH_PYTHON_3 "Build with python 3." OFF)
option(CMAKE_WANT_UFE_BUILD "Enable building with UFE (if found)." ON)
option(PXR_ENABLE_PYTHON_SUPPORT "Enable Python based components for USD" ON)
option(PXR_BUILD_TESTS "Build tests" ON)
option(PXR_BUILD_MONOLITHIC "Build a monolithic library." OFF)

#------------------------------------------------------------------------------
# internal flags to control build
Expand All @@ -46,13 +52,12 @@ set(CMAKE_OSX_ARCHITECTURES "x86_64")
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules
${CMAKE_CURRENT_SOURCE_DIR}/cmake/defaults
)

# Use RUNPATH instead of RPATH for all shared libs and executables on Linux
if(IS_LINUX)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--enable-new-dtags")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--enable-new-dtags")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--enable-new-dtags")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--enable-new-dtags")
endif()

#------------------------------------------------------------------------------
Expand All @@ -66,7 +71,12 @@ endif()
if (DEFINED PYTHON_INCLUDE_DIR AND DEFINED PYTHON_LIBRARIES AND DEFINED Python_EXECUTABLE)
SET(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
SET(PYTHONLIBS_FOUND TRUE)
find_package(Python 2.7 EXACT REQUIRED COMPONENTS Interpreter)
# Use the Python module to find the python lib.
if(BUILD_WITH_PYTHON_3)
find_package(Python 3.7 EXACT REQUIRED COMPONENTS Interpreter)
else()
find_package(Python 2.7 EXACT REQUIRED COMPONENTS Interpreter)
endif()
if(NOT Python_Interpreter_FOUND)
set(PYTHONLIBS_FOUND FALSE)
endif()
Expand All @@ -87,7 +97,7 @@ if (BUILD_USDMAYA_SCHEMAS)
include(cmake/jinja.cmake)
endif()

find_package(Maya REQUIRED)
find_package(Maya 2018 REQUIRED)
find_package(USD REQUIRED)
include(cmake/usd.cmake)
include(${USD_CONFIG_FILE})
Expand Down Expand Up @@ -128,20 +138,7 @@ endif()
#------------------------------------------------------------------------------
# compiler configuration
#------------------------------------------------------------------------------
# CXXDefaults will set a variety of variables for the project.
# Consume them here. This is an effort to keep the most common
# build files readable.
include(CXXDefaults)
add_definitions(${_PXR_CXX_DEFINITIONS} -DBOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE)
set(CMAKE_CXX_FLAGS "${_PXR_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")

if(NOT WIN32)
set(CMAKE_CXX_FLAGS
-msse3
"${CMAKE_CXX_FLAGS} ${_PXR_CXX_FLAGS}"
)
endif()
string(REPLACE ";" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
include(cmake/compiler_config.cmake)

#------------------------------------------------------------------------------
# test
Expand Down Expand Up @@ -175,10 +172,6 @@ if (BUILD_AL_PLUGIN)
endif()

add_subdirectory(plugin/al)

if(BUILD_USDMAYA_PXR_TRANSLATORS)
add_dependencies(AL_USDMayaPxrTranslators usdMaya)
endif()
endif()

if (BUILD_ADSK_PLUGIN)
Expand Down
15 changes: 9 additions & 6 deletions build.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import print_function

from distutils.spawn import find_executable

import argparse
Expand All @@ -21,19 +23,19 @@

def Print(msg):
if verbosity > 0:
print msg
print(msg)

def PrintWarning(warning):
if verbosity > 0:
print "WARNING:", warning
print("WARNING:", warning)

def PrintStatus(status):
if verbosity >= 1:
print "STATUS:", status
print("STATUS:", status)

def PrintInfo(info):
if verbosity >= 2:
print "INFO:", info
print("INFO:", info)

def PrintCommandOutput(output):
if verbosity >= 3:
Expand All @@ -43,7 +45,7 @@ def PrintError(error):
if verbosity >= 3 and sys.exc_info()[1] is not None:
import traceback
traceback.print_exc()
print "ERROR:", error
print("ERROR:", error)

############################################################
def Windows():
Expand Down Expand Up @@ -135,8 +137,9 @@ def Run(context, cmd):
if context.redirectOutstreamFile:
p = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
encoding = sys.stdout.encoding or "UTF-8"
while True:
l = p.stdout.readline()
l = p.stdout.readline().decode(encoding)
if l != "":
logfile.write(l)
PrintCommandOutput(l)
Expand Down
93 changes: 93 additions & 0 deletions cmake/compiler_config.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#------------------------------------------------------------------------------
# compiler flags/definitions
#------------------------------------------------------------------------------
set(gnu_clang_flags
# we want to be as strict as possible
-Wall
$<$<BOOL:${BUILD_STRICT_MODE}>:-Werror>
# optimization
-msse3
# disable warnings
-Wno-deprecated
-Wno-deprecated-declarations
-Wno-unused-local-typedefs
)

set(msvc_flags
# we want to be as strict as possible
/W3
$<$<BOOL:${BUILD_STRICT_MODE}>:/WX>
# enable pdb generation.
/Zi
# standards compliant.
/Zc:inline
/Zc:rvalueCast
# enable multiprocessor builds.
/MP
# enable exception handling.
/EHsc
# disable warnings
/wd4244
/wd4267
/wd4273
/wd4305
/wd4506
/wd4996
/wd4180
)

set(msvc_definitions
# Make sure WinDef.h does not define min and max macros which
# will conflict with std::min() and std::max().
NOMINMAX

_CRT_SECURE_NO_WARNINGS
_SCL_SECURE_NO_WARNINGS

# Boost
BOOST_ALL_DYN_LINK
BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE

# Needed to prevent Python from adding a define for snprintf
# since it was added in Visual Studio 2015.
HAVE_SNPRINTF
)

#------------------------------------------------------------------------------
# compiler configuration
#------------------------------------------------------------------------------
# Do not use GNU extension
# Use -std=c++11 instead of -std=gnu++11
set(CMAKE_CXX_EXTENSIONS OFF)

function(mayaUsd_compile_config TARGET)
# required compiler feature
# Require C++14 if we're either building for Maya 2019 or later, or if we're building against
# USD 20.05 or later. Otherwise require C++11.
if ((MAYA_APP_VERSION VERSION_GREATER_EQUAL 2019) OR (USD_VERSION_NUM VERSION_GREATER_EQUAL 2005))
target_compile_features(${TARGET}
PRIVATE
cxx_std_14
)
else()
target_compile_features(${TARGET}
PRIVATE
cxx_std_11
)
endif()
if(IS_GNU OR IS_CLANG)
target_compile_options(${TARGET}
PRIVATE
${gnu_clang_flags}
)
elseif(IS_MSVC)
target_compile_options(${TARGET}
PRIVATE
${msvc_flags}
)
target_compile_definitions(${TARGET}
PRIVATE
${msvc_definitions}
)
endif()
endfunction()
21 changes: 0 additions & 21 deletions cmake/defaults/Version.cmake

This file was deleted.

4 changes: 2 additions & 2 deletions cmake/modules/FindMaya.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ find_package_handle_standard_args(Maya
MAYA_PY_EXECUTABLE
MAYA_INCLUDE_DIRS
MAYA_LIBRARIES
VERSION_VAR
MAYA_API_VERSION
MAYA_APP_VERSION
VERSION_VAR
MAYA_APP_VERSION
)
)
2 changes: 2 additions & 0 deletions cmake/modules/FindUSD.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ find_package_handle_standard_args(USD
USD_LIBRARY_DIR
USD_GENSCHEMA
USD_CONFIG_FILE
USD_VERSION
USD_VERSION_NUM
VERSION_VAR
USD_VERSION
)
8 changes: 6 additions & 2 deletions cmake/python.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,12 @@ if(PYTHONLIBS_FOUND AND PYTHON_MODULE_EXTENSION)
return()
endif()

# Use the Python interpreter to find the libs.
find_package(Python 2.7 EXACT REQUIRED COMPONENTS Interpreter)
# Use the Python module to find the python lib.
if(BUILD_WITH_PYTHON_3)
find_package(Python 3.7 EXACT REQUIRED COMPONENTS Interpreter)
else()
find_package(Python 2.7 EXACT REQUIRED COMPONENTS Interpreter)
endif()

if(NOT Python_Interpreter_FOUND)
set(PYTHONLIBS_FOUND FALSE)
Expand Down
Loading

0 comments on commit 39c824f

Please sign in to comment.