forked from dreamworksanimation/USD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
147 lines (122 loc) · 5.37 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
project(usd)
if (WIN32)
cmake_minimum_required(VERSION 3.1.1)
else()
cmake_minimum_required(VERSION 2.8.8)
endif()
if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
if (WIN32)
message(FATAL_ERROR "Compiler does not support 64-bit builds. "
"If you are using Visual Studio, make sure you are in the "
"x64 command prompt and have specified the Win64 cmake "
"generator (e.g., -G \"Visual Studio 14 2015 Win64\")")
else()
message(FATAL_ERROR "Compiler does not support 64-bit builds.")
endif()
endif()
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/defaults
${CMAKE_SOURCE_DIR}/cmake/modules
${CMAKE_SOURCE_DIR}/cmake/macros)
include(Options)
# Versions prior to 3.1.0 on Unix platforms built archive libraries
# incorrectly. Require at least that version if necessary.
if((NOT BUILD_SHARED_LIBS OR PXR_BUILD_MONOLITHIC) AND NOT WIN32)
cmake_minimum_required(VERSION 3.1.0)
endif()
include(ProjectDefaults)
include(Packages)
# This has to be defined after Packages is included, because it relies on the
# discovered path to the python executable.
set(PXR_PYTHON_SHEBANG "${PYTHON_EXECUTABLE}"
CACHE
STRING
"Replacement path for Python #! line."
)
# 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})
set(CMAKE_CXX_FLAGS "${_PXR_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
include(Public)
pxr_toplevel_prologue()
add_subdirectory(pxr)
add_subdirectory(extras)
function(_addIfExists pkg pkgCmakeLists)
if (EXISTS ${pkgCmakeLists})
add_subdirectory(${pkg})
else()
message(WARNING "Specified third party package '${pkgName}' was not found. Please check that '${pkgCmakeLists}' exists")
endif()
endfunction()
function(_enableThirdPartyPlugin identifier)
set(pkg third_party/${identifier})
set(pkgCmakeLists ${CMAKE_CURRENT_SOURCE_DIR}/${pkg}/CMakeLists.txt)
_addIfExists(${pkg} ${pkgCmakeLists})
endfunction()
if (${PXR_BUILD_KATANA_PLUGIN})
if(NOT ${PXR_ENABLE_PYTHON_SUPPORT})
message(WARNING "Skipping third_party/katana because PXR_ENABLE_PYTHON_SUPPORT=OFF")
elseif(NOT ${PXR_BUILD_USD_IMAGING})
message(WARNING "Skipping third_party/katana because PXR_BUILD_USD_IMAGING=OFF")
else()
_enableThirdPartyPlugin("katana")
endif()
endif()
if (${PXR_BUILD_MAYA_PLUGIN})
if(NOT ${PXR_ENABLE_PYTHON_SUPPORT})
message(WARNING "Skipping third_party/maya because PXR_ENABLE_PYTHON_SUPPORT=OFF")
elseif (NOT ${PXR_BUILD_USD_IMAGING})
message(WARNING "Skipping third_party/maya because PXR_BUILD_USD_IMAGING=OFF")
else()
_enableThirdPartyPlugin("maya")
endif()
endif()
if (${PXR_BUILD_HOUDINI_PLUGIN})
if(NOT ${PXR_ENABLE_PYTHON_SUPPORT})
message(WARNING "Skipping third_party/houdini because PXR_ENABLE_PYTHON_SUPPORT=OFF")
else()
message(STATUS "Enable houdini plugin")
_enableThirdPartyPlugin("houdini")
endif()
endif()
if (${PXR_BUILD_DOCUMENTATION})
# Ensure we have doxygen+graphviz available
find_program(DOXYGEN_EXECUTABLE
NAMES doxygen
)
if (NOT EXISTS ${DOXYGEN_EXECUTABLE})
message(WARNING "Cannot run doc generation, doxygen not found.")
return()
endif()
find_program(DOT_EXECUTABLE
NAMES dot
)
if (NOT EXISTS ${DOT_EXECUTABLE})
message(WARNING "Cannot run doc generation, dot not found.")
return()
endif()
_pxrDoxyConfig_subst()
set(DOCS_DIR "${CMAKE_BINARY_DIR}")
set(GEN_SCRIPT "${PROJECT_SOURCE_DIR}/cmake/macros/generateDocs.py")
set(PXR_SOURCE_DIR "${CMAKE_SOURCE_DIR}/pxr")
set(THIRD_PARTY_SOURCE_DIR "${CMAKE_SOURCE_DIR}/third_party")
add_custom_target(
documentation
ALL
COMMAND ${PYTHON_EXECUTABLE} ${GEN_SCRIPT} ${PXR_SOURCE_DIR} ${THIRD_PARTY_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${DOCS_DIR} ${DOXYGEN_EXECUTABLE} ${DOT_EXECUTABLE}
DEPENDS ${CMAKE_BINARY_DIR}/include/pxr/pxr.h
)
set(BUILT_HTML_DOCS "${DOCS_DIR}/docs/doxy_html")
set(INST_DOCS_ROOT "${CMAKE_INSTALL_PREFIX}/docs")
install(
DIRECTORY ${BUILT_HTML_DOCS}
DESTINATION ${INST_DOCS_ROOT}
)
set(BUILT_XML_DOCS "${DOCS_DIR}/docs/doxy_xml")
install(
DIRECTORY ${BUILT_XML_DOCS}
DESTINATION ${INST_DOCS_ROOT}
)
endif()
pxr_toplevel_epilogue()