-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3555 from Autodesk/lanierd/EMSUSD-917
EMSUSD-917 : Add a stable library as a subset of MayaUSD LIbrary call…
- Loading branch information
Showing
24 changed files
with
1,242 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
set(MAYAUSDAPI_MAJOR_VERSION 0) | ||
set(MAYAUSDAPI_MINOR_VERSION 0) | ||
set(MAYAUSDAPI_PATCH_LEVEL 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
# | ||
# Copyright 2023 Autodesk | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
project(mayaUsdAPI) | ||
|
||
add_library(${PROJECT_NAME} SHARED) | ||
|
||
# ----------------------------------------------------------------------------- | ||
# sources | ||
# ----------------------------------------------------------------------------- | ||
target_sources(${PROJECT_NAME} | ||
PRIVATE | ||
proxyStage.cpp | ||
proxyShapeNotice.cpp | ||
) | ||
|
||
set(HEADERS | ||
api.h | ||
proxyStage.h | ||
proxyShapeNotice.h | ||
) | ||
|
||
#------------------------------------------------------------------------------ | ||
# modules and definitions | ||
#------------------------------------------------------------------------------ | ||
if(NOT DEFINED ENV{BOOST_ROOT}) | ||
set(ENV{BOOST_ROOT} ${PXR_USD_LOCATION}) | ||
endif() | ||
if(MAYAUSD_DEFINE_BOOST_DEBUG_PYTHON_FLAG) | ||
set(Boost_USE_DEBUG_PYTHON ON) | ||
endif() | ||
|
||
# ----------------------------------------------------------------------------- | ||
# compiler configuration | ||
# ----------------------------------------------------------------------------- | ||
target_compile_definitions(${PROJECT_NAME} | ||
PUBLIC | ||
$<$<STREQUAL:${CMAKE_BUILD_TYPE},Debug>:BOOST_DEBUG_PYTHON> | ||
$<$<STREQUAL:${CMAKE_BUILD_TYPE},Debug>:BOOST_LINKING_PYTHON> | ||
PRIVATE | ||
MAYAUSD_API_EXPORT | ||
MFB_PACKAGE_NAME="${PROJECT_NAME}" | ||
MFB_ALT_PACKAGE_NAME="${PROJECT_NAME}" | ||
MFB_PACKAGE_MODULE="${PROJECT_NAME}" | ||
$<$<BOOL:${IS_MACOSX}>:OSMac_> | ||
$<$<BOOL:${IS_LINUX}>:LINUX> | ||
# this flag is needed when building for Maya | ||
$<$<BOOL:${IS_WINDOWS}>:WIN32> | ||
) | ||
|
||
set(SRCFILE ${CMAKE_CURRENT_SOURCE_DIR}/mayaUsdAPI.h.src) | ||
set(DSTFILE ${CMAKE_BINARY_DIR}/include/mayaUsdAPI/mayaUsdAPI.h) | ||
if (NOT EXISTS ${DSTFILE}) | ||
message(STATUS "promoting: " ${SRCFILE}) | ||
endif() | ||
configure_file(${SRCFILE} ${DSTFILE}) | ||
|
||
mayaUsd_compile_config(${PROJECT_NAME}) | ||
|
||
mayaUsd_promoteHeaderList( | ||
HEADERS | ||
${HEADERS} | ||
BASEDIR | ||
${PROJECT_NAME} | ||
) | ||
|
||
# ----------------------------------------------------------------------------- | ||
# include directories | ||
# ----------------------------------------------------------------------------- | ||
target_include_directories(${PROJECT_NAME} | ||
PRIVATE | ||
${MAYA_INCLUDE_DIRS} | ||
${CMAKE_BINARY_DIR}/include | ||
) | ||
|
||
# ----------------------------------------------------------------------------- | ||
# link libraries | ||
# ----------------------------------------------------------------------------- | ||
target_link_libraries(${PROJECT_NAME} | ||
PUBLIC | ||
tf | ||
PRIVATE | ||
sdf | ||
mayaUsd | ||
) | ||
|
||
# ----------------------------------------------------------------------------- | ||
# run-time search paths | ||
# ----------------------------------------------------------------------------- | ||
if(IS_MACOSX OR IS_LINUX) | ||
mayaUsd_init_rpath(rpath "lib") | ||
mayaUsd_add_rpath(rpath "${CMAKE_INSTALL_PREFIX}/lib") | ||
if(DEFINED MAYAUSD_TO_USD_RELATIVE_PATH) | ||
mayaUsd_add_rpath(rpath "../${MAYAUSD_TO_USD_RELATIVE_PATH}/lib") | ||
elseif(DEFINED PXR_USD_LOCATION) | ||
mayaUsd_add_rpath(rpath "${PXR_USD_LOCATION}/lib") | ||
endif() | ||
if(IS_LINUX AND DEFINED MAYAUSD_TO_USD_RELATIVE_PATH) | ||
mayaUsd_add_rpath(rpath "../${MAYAUSD_TO_USD_RELATIVE_PATH}/lib64") | ||
endif() | ||
if(IS_MACOSX AND DEFINED MAYAUSD_TO_USD_RELATIVE_PATH) | ||
mayaUsd_add_rpath(rpath "../../../Maya.app/Contents/MacOS") | ||
endif() | ||
mayaUsd_install_rpath(rpath ${PROJECT_NAME}) | ||
endif() | ||
|
||
#------------------------------------------------------------------------------ | ||
# install | ||
#------------------------------------------------------------------------------ | ||
install(FILES ${HEADERS} | ||
DESTINATION | ||
${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME} | ||
) | ||
|
||
set(LIBRARY_INSTALL_PATH | ||
${CMAKE_INSTALL_PREFIX}/lib | ||
) | ||
|
||
install( | ||
TARGETS ${PROJECT_NAME} | ||
LIBRARY | ||
DESTINATION ${LIBRARY_INSTALL_PATH} | ||
ARCHIVE | ||
DESTINATION ${LIBRARY_INSTALL_PATH} | ||
RUNTIME | ||
DESTINATION ${LIBRARY_INSTALL_PATH} | ||
) | ||
|
||
if(IS_WINDOWS) | ||
install(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}> | ||
DESTINATION ${LIBRARY_INSTALL_PATH} OPTIONAL | ||
) | ||
endif() | ||
|
||
# We need an empty __init__.py file in each subfolder so it is considered a python module. | ||
install(FILES __init__.py DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/python/${PROJECT_NAME}) | ||
install(FILES ${CMAKE_BINARY_DIR}/include/${PROJECT_NAME}/mayaUsdAPI.h | ||
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME}) | ||
|
||
|
||
add_subdirectory(python) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#is needed for python2 to be able to run tests. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// | ||
// Copyright 2023 Autodesk | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
#ifndef MAYAUSD_API_H | ||
#define MAYAUSD_API_H | ||
|
||
#include <pxr/base/arch/export.h> | ||
#include <pxr/pxr.h> | ||
|
||
// clang-format off | ||
#if defined _WIN32 || defined __CYGWIN__ | ||
|
||
// The main export symbol used for the mayaUSDAPI library. | ||
#ifdef MAYAUSD_API_EXPORT | ||
#ifdef __GNUC__ | ||
#define MAYAUSD_API_PUBLIC __attribute__ ((dllexport)) | ||
#else | ||
#define MAYAUSD_API_PUBLIC __declspec(dllexport) | ||
#endif | ||
#else | ||
#ifdef __GNUC__ | ||
#define MAYAUSD_API_PUBLIC __attribute__ ((dllimport)) | ||
#else | ||
#define MAYAUSD_API_PUBLIC __declspec(dllimport) | ||
#endif | ||
#endif | ||
#define MAYAUSD_API_LOCAL | ||
#else | ||
#if __GNUC__ >= 4 | ||
#define MAYAUSD_API_PUBLIC __attribute__ ((visibility ("default"))) | ||
#define MAYAUSD_API_LOCAL __attribute__ ((visibility ("hidden"))) | ||
#else | ||
#define MAYAUSD_API_PUBLIC | ||
#define MAYAUSD_API_LOCAL | ||
#endif | ||
#endif | ||
|
||
#ifdef MAYAUSD_API_EXPORT | ||
#define MAYAUSD_API_TEMPLATE_CLASS(...) ARCH_EXPORT_TEMPLATE(class, __VA_ARGS__) | ||
#define MAYAUSD_API_TEMPLATE_STRUCT(...) ARCH_EXPORT_TEMPLATE(struct, __VA_ARGS__) | ||
#else | ||
#define MAYAUSD_API_TEMPLATE_CLASS(...) ARCH_IMPORT_TEMPLATE(class, __VA_ARGS__) | ||
#define MAYAUSD_API_TEMPLATE_STRUCT(...) ARCH_IMPORT_TEMPLATE(struct, __VA_ARGS__) | ||
#endif | ||
// clang-format on | ||
|
||
// Convenience symbol versioning include: because api.h is widely | ||
// included, this reduces the need to explicitly include mayaUsdAPI.h. | ||
#include <mayaUsdAPI/mayaUsdAPI.h> | ||
|
||
#endif // MAYAUSD_API_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// Copyright 2023 Autodesk, Inc. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
#pragma once | ||
|
||
#define MAYAUSDAPI_MAJOR_VERSION ${MAYAUSDAPI_MAJOR_VERSION} | ||
#define MAYAUSDAPI_MINOR_VERSION ${MAYAUSDAPI_MINOR_VERSION} | ||
#define MAYAUSDAPI_PATCH_LEVEL ${MAYAUSDAPI_PATCH_LEVEL} | ||
#define MAYAUSDAPI_API_VERSION (MAYAUSDAPI_MAJOR_VERSION * 10000 + MAYAUSDAPI_MINOR_VERSION * 100 + MAYAUSDAPI_PATCH_LEVEL) | ||
|
||
// mayaUsdAPI viewport public namespace string will never change. | ||
#define MAYAUSDAPI_NS MayaUsdAPI | ||
// C preprocessor trickery to expand arguments. | ||
#define MAYAUSDAPI_CONCAT(A, B) MAYAUSDAPI_CONCAT_IMPL(A, B) | ||
#define MAYAUSDAPI_CONCAT_IMPL(A, B) A##B | ||
// Versioned namespace includes the major version number. | ||
#define MAYAUSDAPI_VERSIONED_NS MAYAUSDAPI_CONCAT(MAYAUSDAPI_NS, _v${MAYAUSDAPI_MAJOR_VERSION}) | ||
|
||
namespace MAYAUSDAPI_VERSIONED_NS {} | ||
|
||
// With a using namespace declaration, pull in the versioned namespace into the | ||
// mayaUsdAPI public namespace, to allow client code to use the plain mayaUsdAPI | ||
// namespace, e.g. MayaUsdAPI::Class. | ||
namespace MAYAUSDAPI_NS { | ||
using namespace MAYAUSDAPI_VERSIONED_NS; | ||
} | ||
|
||
// Macro to place the mayaUsdAPI symbols in the versioned namespace, which | ||
// is how they will appear in the shared library, e.g. MayaUsdAPI_v1::Class. | ||
#ifdef DOXYGEN | ||
#define MAYAUSDAPI_NS_DEF MAYAUSDAPI_NS | ||
#else | ||
#define MAYAUSDAPI_NS_DEF MAYAUSDAPI_VERSIONED_NS | ||
#endif |
Oops, something went wrong.