forked from ux3d/usd_from_gltf
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
154 lines (138 loc) · 3.84 KB
/
Copy pathCMakeLists.txt
File metadata and controls
154 lines (138 loc) · 3.84 KB
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
148
149
150
151
152
153
154
# 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)
if(APPLE)
set(MACOSX_DEPLOYMENT_TARGET "10.15")
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "")
endif()
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"
# USD uses boost-1_70
"${USD_DIR}/include/boost-1_70"
${Python_INCLUDE_DIRS}
)
link_directories(
"${USD_DIR}/lib"
${Python_LIBRARY_DIRS}
)
if (MSVC)
set(USD_LIBS
usd_gf.lib
usd_plug.lib
usd_sdf.lib
usd_tf.lib
usd_usd.lib
usd_usdGeom.lib
usd_usdShade.lib
usd_usdSkel.lib
usd_usdUtils.lib
usd_vt.lib
)
elseif (APPLE)
set(USD_LIBS
${Python_LIBRARIES}
-lpthread
libusd_gf.dylib
libusd_plug.dylib
libusd_sdf.dylib
libusd_tf.dylib
libusd_usd.dylib
libusd_usdGeom.dylib
libusd_usdShade.dylib
libusd_usdSkel.dylib
libusd_usdUtils.dylib
libusd_vt.dylib
)
if (Python_FOUND)
list(APPEND USD_LIBS "${USD_DIR}/lib/libboost_python37.dylib")
endif (Python_FOUND)
else ()
set(USD_LIBS
${Python_LIBRARIES}
-lpthread
libusd_gf.so
libusd_plug.so
libusd_sdf.so
libusd_tf.so
libusd_usd.so
libusd_usdGeom.so
libusd_usdShade.so
libusd_usdSkel.so
libusd_usdUtils.so
libusd_vt.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)
if(APPLE)
# Ensure the rpath is already deployable for build targets (i.e. doesn't
# contain absolute paths into the build tree)
set(CMAKE_SKIP_BUILD_RPATH TRUE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
set(CMAKE_INSTALL_RPATH "@executable_path;@loader_path/Frameworks;@executable_path/../Frameworks")
endif()
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 .)