This repository has been archived by the owner on Jun 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathCMakeLists.txt
137 lines (124 loc) · 3.18 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
# Copyright 2019 Google LLC
#
# 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.
cmake_minimum_required (VERSION 3.0)
project (usd_from_gltf)
# We don't use Python in this tool, but when the USD library is built with
# PXR_PYTHON_SUPPORT_ENABLED it references it anyway.
if (EXISTS "${USD_DIR}/lib/python/")
find_package(Python COMPONENTS Development)
if (NOT Python_FOUND)
message(FATAL_ERROR "Missing python libs.")
endif (NOT Python_FOUND)
endif (EXISTS "${USD_DIR}/lib/python/")
set(USD_INCLUDE_DIRS
"${USD_DIR}/include"
"${USD_DIR}/include/boost-1_61"
# Visual Studio 2017 requires boost 1.65.1.
"${USD_DIR}/include/boost-1_65_1"
${Python_INCLUDE_DIRS}
)
link_directories(
"${USD_DIR}/lib"
${Python_LIBRARY_DIRS}
)
if (MSVC)
set(USD_LIBS
gf.lib
plug.lib
sdf.lib
tf.lib
usd.lib
usdGeom.lib
usdShade.lib
usdSkel.lib
usdUtils.lib
vt.lib
)
elseif (APPLE)
set(USD_LIBS
${Python_LIBRARIES}
-lpthread
libgf.dylib
libplug.dylib
libsdf.dylib
libtf.dylib
libusd.dylib
libusdGeom.dylib
libusdShade.dylib
libusdSkel.dylib
libusdUtils.dylib
libvt.dylib
)
if (Python_FOUND)
list(APPEND USD_LIBS "${USD_DIR}/lib/libboost_python.dylib")
endif (Python_FOUND)
else ()
set(USD_LIBS
${Python_LIBRARIES}
-lpthread
libgf.so
libplug.so
libsdf.so
libtf.so
libusd.so
libusdGeom.so
libusdShade.so
libusdSkel.so
libusdUtils.so
libvt.so
)
if (Python_FOUND)
list(APPEND USD_LIBS "${USD_DIR}/lib/libboost_python.so")
endif (Python_FOUND)
endif ()
if (MSVC)
add_compile_definitions(
_CRT_SECURE_NO_WARNINGS
)
add_compile_options(
/wd4996 # Call to 'std::copy' with parameters that may be unsafe
)
# Use the release runtime for all builds so we can compile the library in Debug
# without having to recompile dependencies.
set(CompilerFlags
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
)
foreach(CompilerFlag ${CompilerFlags})
string(REPLACE "/MDd" "/MD" ${CompilerFlag} "${${CompilerFlag}}")
string(REPLACE "/RTC1" "" ${CompilerFlag} "${${CompilerFlag}}")
endforeach()
else (MSVC)
add_compile_options(
-Wno-deprecated # Silence deprecation warnings due to USD headers.
-std=c++14
)
endif (MSVC)
# PIC is necessary for building the plugin shared library.
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Set RPATH to locate USD shared libraries on Linux/OSX.
set(CMAKE_INSTALL_RPATH "${USD_DIR}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
add_subdirectory(common)
add_subdirectory(convert)
add_subdirectory(gltf)
add_subdirectory(process)
add_subdirectory(usd_from_gltf)
add_subdirectory(ufg_plugin)
install(EXPORT ufglib DESTINATION lib/ufg)
install(FILES ufg-config.cmake DESTINATION .)