Skip to content

Commit 7772c79

Browse files
Install the component creator if available
Find the component creator and set CMake variables to its components. Add it to the install target. - Added `FindAdskUsdComponentCreator.cmake` CMake helper that finds the component creator. - It requires that a `ADSK_USD_COMPONENT_CREATOR_ROOT_DIR` env var or CMake var be set to the component creator install folder. - Find the component creator from the main CMakeLists.txt file. - Added a new CMake sub-project for the componen creator. - For now, it merely installs the pre-built component creator, if given any.
1 parent 386b4fd commit 7772c79

File tree

3 files changed

+192
-0
lines changed

3 files changed

+192
-0
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ if(BUILD_LOOKDEVXUSD_LIBRARY)
257257
endif()
258258
endif()
259259

260+
find_package(AdskUsdComponentCreator)
260261
find_package(AR)
261262

262263
#------------------------------------------------------------------------------
@@ -345,6 +346,13 @@ if (BUILD_ADSK_PLUGIN)
345346
add_subdirectory(plugin/adsk)
346347
endif()
347348

349+
if (AdskUsdComponentCreator_FOUND)
350+
message(STATUS "Building with Autodesk USD Component Creator support.")
351+
add_subdirectory(plugin/AdskUsdComponentCreator)
352+
else()
353+
message(STATUS "Autodesk USD Component Creator not found. Skipping building the component creator plugin.")
354+
endif()
355+
348356
#------------------------------------------------------------------------------
349357
# install
350358
#------------------------------------------------------------------------------
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
#
2+
# Module to find AdskUsdComponentCreator.
3+
#
4+
# This module searches for a valid USD component creator installation.
5+
# See the find_package at the bottom for the list of variables that will be set.
6+
#
7+
8+
message(STATUS "Finding Autodesk USD Component Creator")
9+
10+
############################################################################
11+
#
12+
# Install root folder
13+
14+
if (NOT DEFINED ADSK_USD_COMPONENT_CREATOR_ROOT_DIR)
15+
set(ADSK_USD_COMPONENT_CREATOR_ROOT_DIR $ENV{ADSK_USD_COMPONENT_CREATOR_ROOT_DIR})
16+
endif()
17+
18+
message(STATUS " Autodesk USD Component Creator given root is ${ADSK_USD_COMPONENT_CREATOR_ROOT_DIR}")
19+
20+
############################################################################
21+
#
22+
# C++ headers
23+
24+
find_path(ADSK_USD_COMPONENT_CREATOR_INCLUDE_DIR
25+
NAMES
26+
AdskUsdComponentCreator/AdskUsdComponentCreatorVersion.h
27+
HINTS
28+
${ADSK_USD_COMPONENT_CREATOR_ROOT_DIR}
29+
PATH_SUFFIXES
30+
include
31+
DOC
32+
"USD Component Creator C++ include headers folder"
33+
)
34+
35+
############################################################################
36+
#
37+
# Link libraries
38+
39+
find_path(ADSK_USD_COMPONENT_CREATOR_LIBRARY_DIR
40+
AdskUsdComponentCreator.lib
41+
HINTS
42+
${ADSK_USD_COMPONENT_CREATOR_ROOT_DIR}
43+
PATH_SUFFIXES
44+
lib
45+
DOC
46+
"USD Component Creator libraries folder"
47+
)
48+
49+
set(ADSK_USD_COMPONENT_CREATOR_LIBS_TO_FIND
50+
AdskUsdComponentCreator
51+
AdskVariantEditor
52+
sdf_tools
53+
)
54+
55+
set(ADSK_USD_COMPONENT_CREATOR_LIBRARIES)
56+
57+
foreach(ADSK_USD_COMPONENT_CREATOR_LIB ${ADSK_USD_COMPONENT_CREATOR_LIBS_TO_FIND})
58+
find_library(ADSK_USD_COMPONENT_CREATOR_${ADSK_USD_COMPONENT_CREATOR_LIB}_LIBRARY
59+
NAMES
60+
${ADSK_USD_COMPONENT_CREATOR_LIB}
61+
HINTS
62+
${ADSK_USD_COMPONENT_CREATOR_LIBRARY_DIR}
63+
DOC
64+
"USD Component Creator ${ADSK_USD_COMPONENT_CREATOR_LIB} library"
65+
NO_CMAKE_SYSTEM_PATH
66+
)
67+
if (ADSK_USD_COMPONENT_CREATOR_${ADSK_USD_COMPONENT_CREATOR_LIB}_LIBRARY)
68+
list(APPEND ADSK_USD_COMPONENT_CREATOR_LIBRARIES ${ADSK_USD_COMPONENT_CREATOR_${ADSK_USD_COMPONENT_CREATOR_LIB}_LIBRARY})
69+
endif()
70+
endforeach()
71+
72+
############################################################################
73+
#
74+
# Binaries, dynamic-libraries (DLL) and commands folder
75+
76+
if(IS_MACOSX)
77+
set(ADSK_USD_COMPONENT_CREATOR_PLUGIN_EXT "dylib")
78+
elseif(IS_WINDOWS)
79+
set(ADSK_USD_COMPONENT_CREATOR_PLUGIN_EXT "dll")
80+
elseif(IS_LINUX)
81+
set(ADSK_USD_COMPONENT_CREATOR_PLUGIN_EXT "so")
82+
else()
83+
set(ADSK_USD_COMPONENT_CREATOR_PLUGIN_EXT "unknown")
84+
endif()
85+
86+
find_path(ADSK_USD_COMPONENT_CREATOR_BIN_DIR
87+
NAMES
88+
AdskUsdComponentCreator.${ADSK_USD_COMPONENT_CREATOR_PLUGIN_EXT}
89+
HINTS
90+
${ADSK_USD_COMPONENT_CREATOR_ROOT_DIR}
91+
PATH_SUFFIXES
92+
bin
93+
DOC
94+
"USD Component Creator binaries (DLL and commands) folder"
95+
)
96+
97+
############################################################################
98+
#
99+
# Maya plugin folder
100+
101+
find_path(ADSK_USD_COMPONENT_CREATOR_MAYA_PLUGIN_DIR
102+
NAMES
103+
usd_component_creator.mod
104+
HINTS
105+
${ADSK_USD_COMPONENT_CREATOR_ROOT_DIR}
106+
PATH_SUFFIXES
107+
plugin
108+
DOC
109+
"USD Component Creator Maya plugin folder"
110+
)
111+
112+
############################################################################
113+
#
114+
# Component creator version
115+
116+
if(ADSK_USD_COMPONENT_CREATOR_INCLUDE_DIR)
117+
file(STRINGS ${MAYA_INCLUDE_DIR}/maya/MTypes.h ADSK_USD_COMPONENT_CREATOR_VERSION REGEX "#define ADSK_ADSK_USD_COMPONENT_CREATOR_VERSION \".*$\"")
118+
if(ADSK_USD_COMPONENT_CREATOR_VERSION)
119+
string(REGEX MATCHALL "[0-9]+" ADSK_USD_COMPONENT_CREATOR_VERSION ${ADSK_USD_COMPONENT_CREATOR_VERSION})
120+
endif()
121+
endif()
122+
123+
# Handle the QUIETLY and REQUIRED arguments and set ADSK_USD_COMPONENT_CREATOR_FOUND to TRUE if
124+
# all listed variables are TRUE.
125+
126+
############################################################################
127+
#
128+
# Component creator package
129+
130+
include(FindPackageHandleStandardArgs)
131+
find_package_handle_standard_args(AdskUsdComponentCreator
132+
REQUIRED_VARS
133+
ADSK_USD_COMPONENT_CREATOR_ROOT_DIR
134+
ADSK_USD_COMPONENT_CREATOR_INCLUDE_DIR
135+
ADSK_USD_COMPONENT_CREATOR_LIBRARY_DIR
136+
ADSK_USD_COMPONENT_CREATOR_MAYA_PLUGIN_DIR
137+
ADSK_USD_COMPONENT_CREATOR_BIN_DIR
138+
ADSK_USD_COMPONENT_CREATOR_LIBRARIES
139+
VERSION_VAR
140+
ADSK_USD_COMPONENT_CREATOR_VERSION
141+
)
142+
143+
# Report to the user where the component creator package was found.
144+
145+
if (AdskUsdComponentCreator_FOUND)
146+
message(STATUS " Autodesk USD Component Creator root folder is ${ADSK_USD_COMPONENT_CREATOR_ROOT_DIR}")
147+
message(STATUS " Autodesk USD Component Creator include folder is ${ADSK_USD_COMPONENT_CREATOR_INCLUDE_DIR}")
148+
message(STATUS " Autodesk USD Component Creator library folder is ${ADSK_USD_COMPONENT_CREATOR_LIBRARY_DIR}")
149+
message(STATUS " Autodesk USD Component Creator Maya plugin folder is ${ADSK_USD_COMPONENT_CREATOR_MAYA_PLUGIN_DIR}")
150+
message(STATUS " Autodesk USD Component Creator binaries folder is ${ADSK_USD_COMPONENT_CREATOR_BIN_DIR}")
151+
message(STATUS " Autodesk USD Component Creator libraries are ${ADSK_USD_COMPONENT_CREATOR_LIBRARIES}")
152+
endif()
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
message("========== ADSK USD Component Creator Plugin ==========")
2+
3+
set(ADSK_USD_COMPONENT_CREATOR_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/../AdskUsdComponentCreator")
4+
message(STATUS "Installing Autodesk USD Component Creator plugin into ${ADSK_USD_COMPONENT_CREATOR_INSTALL_DIR}")
5+
6+
install(
7+
DIRECTORY
8+
${ADSK_USD_COMPONENT_CREATOR_BIN_DIR}
9+
DESTINATION
10+
${ADSK_USD_COMPONENT_CREATOR_INSTALL_DIR}
11+
)
12+
13+
install(
14+
DIRECTORY
15+
${ADSK_USD_COMPONENT_CREATOR_INCLUDE_DIR}
16+
DESTINATION
17+
${ADSK_USD_COMPONENT_CREATOR_INSTALL_DIR}
18+
)
19+
20+
install(
21+
DIRECTORY
22+
${ADSK_USD_COMPONENT_CREATOR_LIBRARY_DIR}
23+
DESTINATION
24+
${ADSK_USD_COMPONENT_CREATOR_INSTALL_DIR}
25+
)
26+
27+
install(
28+
DIRECTORY
29+
${ADSK_USD_COMPONENT_CREATOR_MAYA_PLUGIN_DIR}
30+
DESTINATION
31+
${ADSK_USD_COMPONENT_CREATOR_INSTALL_DIR}
32+
)

0 commit comments

Comments
 (0)