-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EMSUSD-1692 - Add LookdevXUsd Extension
- Loading branch information
1 parent
1082fa2
commit 68b861f
Showing
60 changed files
with
6,106 additions
and
7 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,79 @@ | ||
# | ||
# Simple module to find LookdevXUfe. | ||
# | ||
# This module searches for a valid LookdevXUfe installation in the Maya devkit. | ||
# It searches for LookdevXUfe's libraries and include files. | ||
# | ||
# Variables that will be defined: | ||
# LookdevXUfe_FOUND Defined if a LookdevXUfe installation has been detected | ||
# LookdevXUfe_LIBRARY Path to LookdevXUfe library | ||
# LookdevXUfe_INCLUDE_DIR Path to the LookdevXUfe include directory | ||
# LookdevXUfe_VERSION LookdevXUfe version (major.minor.patch) from LookdevXUfe.h | ||
# | ||
|
||
find_path(LookdevXUfe_INCLUDE_DIR | ||
LookdevXUfe/LookdevXUfe.h | ||
HINTS | ||
$ENV{LOOKDEVXUFE_INCLUDE_ROOT} | ||
${LOOKDEVXUFE_INCLUDE_ROOT} | ||
${MAYA_DEVKIT_LOCATION} | ||
$ENV{MAYA_DEVKIT_LOCATION} | ||
${MAYA_LOCATION} | ||
$ENV{MAYA_LOCATION} | ||
${MAYA_BASE_DIR} | ||
PATH_SUFFIXES | ||
devkit/ufe/extensions/lookdevXUfe/include | ||
include/ | ||
DOC | ||
"LookdevXUfe header path" | ||
) | ||
|
||
# Get the LookdevXUfe_VERSION from LookdevXUfe.h | ||
if(LookdevXUfe_INCLUDE_DIR AND EXISTS "${LookdevXUfe_INCLUDE_DIR}/LookdevXUfe/LookdevXUfe.h") | ||
# Parse the file and get the three lines that have the version info. | ||
file(STRINGS | ||
"${LookdevXUfe_INCLUDE_DIR}/LookdevXUfe/LookdevXUfe.h" | ||
_ldx_vers | ||
REGEX "#define[ ]+(LOOKDEVXUFE_MAJOR_VERSION|LOOKDEVXUFE_MINOR_VERSION|LOOKDEVXUFE_PATCH_LEVEL)[ ]+[0-9]+$") | ||
|
||
# Then extract the number from each one. | ||
foreach(_ldxufe_tmp ${_ldx_vers}) | ||
if(_ldxufe_tmp MATCHES "#define[ ]+(LOOKDEVXUFE_MAJOR_VERSION|LOOKDEVXUFE_MINOR_VERSION|LOOKDEVXUFE_PATCH_LEVEL)[ ]+([0-9]+)$") | ||
set(${CMAKE_MATCH_1} ${CMAKE_MATCH_2}) | ||
endif() | ||
endforeach() | ||
set(LookdevXUfe_VERSION ${LOOKDEVXUFE_MAJOR_VERSION}.${LOOKDEVXUFE_MINOR_VERSION}.${LOOKDEVXUFE_PATCH_LEVEL}) | ||
endif() | ||
|
||
find_library(LookdevXUfe_LIBRARY | ||
NAMES | ||
lookdevXUfe_${LOOKDEVXUFE_MAJOR_VERSION}_${LOOKDEVXUFE_MINOR_VERSION} | ||
HINTS | ||
$ENV{LOOKDEVXUFE_LIB_ROOT} | ||
${LOOKDEVXUFE_LIB_ROOT} | ||
${MAYA_DEVKIT_LOCATION} | ||
$ENV{MAYA_DEVKIT_LOCATION} | ||
${MAYA_LOCATION} | ||
$ENV{MAYA_LOCATION} | ||
${MAYA_BASE_DIR} | ||
PATHS | ||
${UFE_LIBRARY_DIR} | ||
PATH_SUFFIXES | ||
devkit/ufe/extensions/lookdevXUfe/lib | ||
lib/ | ||
DOC | ||
"LookdevXUfe library" | ||
NO_DEFAULT_PATH | ||
) | ||
|
||
# Handle the QUIETLY and REQUIRED arguments and set LookdevXUfe_FOUND to TRUE if | ||
# all listed variables are TRUE. | ||
include(FindPackageHandleStandardArgs) | ||
|
||
find_package_handle_standard_args(LookdevXUfe | ||
REQUIRED_VARS | ||
LookdevXUfe_INCLUDE_DIR | ||
LookdevXUfe_LIBRARY | ||
VERSION_VAR | ||
LookdevXUfe_VERSION | ||
) |
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,177 @@ | ||
# | ||
# Copyright 2024 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(lookdevXUsd) | ||
|
||
add_library(${PROJECT_NAME} SHARED) | ||
|
||
# ----------------------------------------------------------------------------- | ||
# sources | ||
# ----------------------------------------------------------------------------- | ||
target_sources(${PROJECT_NAME} | ||
PRIVATE | ||
LookdevXUsd.cpp | ||
UsdCapabilityHandler.cpp | ||
UsdClipboardHandler.cpp | ||
UsdComponentConnections.cpp | ||
UsdConnectionCommands.cpp | ||
UsdDebugHandler.cpp | ||
UsdDeleteCommand.cpp | ||
UsdExtendedAttributeHandler.cpp | ||
UsdExtendedConnectionHandler.cpp | ||
UsdFileHandler.cpp | ||
UsdHierarchy.cpp | ||
UsdHierarchyHandler.cpp | ||
UsdLookdevHandler.cpp | ||
UsdMaterial.cpp | ||
UsdMaterialCommands.cpp | ||
UsdMaterialHandler.cpp | ||
UsdMaterialValidator.cpp | ||
UsdSceneItemOps.cpp | ||
UsdSceneItemOpsHandler.cpp | ||
UsdSceneItemUI.cpp | ||
UsdSceneItemUIHandler.cpp | ||
UsdSoloingHandler.cpp | ||
UsdUINodeGraphNode.cpp | ||
UsdUINodeGraphNodeHandler.cpp | ||
Utils.cpp | ||
) | ||
|
||
set(HEADERS | ||
Export.h | ||
LookdevXUsd.h | ||
UsdCapabilityHandler.h | ||
UsdClipboardHandler.h | ||
UsdComponentConnections.h | ||
UsdConnectionCommands.h | ||
UsdDebugHandler.h | ||
UsdDeleteCommand.h | ||
UsdExtendedAttributeHandler.h | ||
UsdExtendedConnectionHandler.h | ||
UsdFileHandler.h | ||
UsdHierarchy.h | ||
UsdHierarchyHandler.h | ||
UsdLookdevHandler.h | ||
UsdMaterial.h | ||
UsdMaterialCommands.h | ||
UsdMaterialHandler.h | ||
UsdMaterialValidator.h | ||
UsdSceneItemOps.h | ||
UsdSceneItemOpsHandler.h | ||
UsdSceneItemUI.h | ||
UsdSceneItemUIHandler.h | ||
UsdSoloingHandler.h | ||
UsdUINodeGraphNode.h | ||
UsdUINodeGraphNodeHandler.h | ||
Utils.h | ||
) | ||
|
||
# ----------------------------------------------------------------------------- | ||
# Compiler configuration | ||
# ----------------------------------------------------------------------------- | ||
target_compile_definitions(${PROJECT_NAME} | ||
PRIVATE | ||
LOOKDEVX_USD_SHARED | ||
PXR_VERSION=${PXR_VERSION} | ||
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> | ||
) | ||
|
||
mayaUsd_compile_config(${PROJECT_NAME}) | ||
|
||
mayaUsd_promoteHeaderList( | ||
HEADERS | ||
${HEADERS} | ||
BASEDIR | ||
${PROJECT_NAME} | ||
) | ||
|
||
# ----------------------------------------------------------------------------- | ||
# include directories | ||
# ----------------------------------------------------------------------------- | ||
target_include_directories(${PROJECT_NAME} | ||
PUBLIC | ||
${PXR_INCLUDE_DIRS} | ||
${UFE_INCLUDE_DIR} | ||
${LookdevXUfe_INCLUDE_DIR} | ||
${CMAKE_BINARY_DIR}/include | ||
) | ||
|
||
# ----------------------------------------------------------------------------- | ||
# link libraries | ||
# ----------------------------------------------------------------------------- | ||
target_link_libraries(${PROJECT_NAME} | ||
PUBLIC | ||
sdf | ||
sdr | ||
mayaUsdAPI | ||
PRIVATE | ||
usd | ||
usdShade | ||
usdUtils | ||
usdUI | ||
${UFE_LIBRARY} | ||
${LookdevXUfe_LIBRARY} | ||
) | ||
|
||
# ----------------------------------------------------------------------------- | ||
# run-time search paths | ||
# ----------------------------------------------------------------------------- | ||
if(IS_MACOSX OR IS_LINUX) | ||
mayaUsd_init_rpath(rpath "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 | ||
# ----------------------------------------------------------------------------- | ||
|
||
# TODO - do we need to install the headers? | ||
#install(FILES ${HEADERS} | ||
# DESTINATION | ||
# ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME} | ||
#) | ||
|
||
install(TARGETS ${PROJECT_NAME} | ||
LIBRARY | ||
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib | ||
ARCHIVE | ||
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib | ||
RUNTIME | ||
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib | ||
) | ||
|
||
if(IS_WINDOWS) | ||
install(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}> | ||
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib OPTIONAL | ||
) | ||
endif() |
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,27 @@ | ||
//***************************************************************************** | ||
// Copyright (c) 2024 Autodesk, Inc. | ||
// All rights reserved. | ||
// | ||
// These coded instructions, statements, and computer programs contain | ||
// unpublished proprietary information written by Autodesk, Inc. and are | ||
// protected by Federal copyright law. They may not be disclosed to third | ||
// parties or copied or duplicated in any form, in whole or in part, without | ||
// the prior written consent of Autodesk, Inc. | ||
//***************************************************************************** | ||
|
||
#ifndef LOOKDEVX_USD_EXPORT_H_ | ||
#define LOOKDEVX_USD_EXPORT_H_ | ||
|
||
#if defined(_WIN32) | ||
#if defined(LOOKDEVX_USD_SHARED) | ||
#define LOOKDEVX_USD_EXPORT __declspec(dllexport) | ||
#else | ||
#define LOOKDEVX_USD_EXPORT __declspec(dllimport) | ||
#endif | ||
#elif defined(__GNUC__) | ||
#define LOOKDEVX_USD_EXPORT __attribute__((visibility("default"))) | ||
#else | ||
#error "Unsupported platform." | ||
#endif | ||
|
||
#endif |
Oops, something went wrong.