-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
148 lines (136 loc) · 4.07 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
148
cmake_minimum_required(VERSION 3.11)
project(mariUsdImport)
# Get essential dependencies
if (NOT DEFINED ENV{USD_ROOT})
message(FATAL_ERROR "USD_ROOT has not been set")
else()
message(STATUS "USD_ROOT: $ENV{USD_ROOT}")
endif()
if (NOT DEFINED ENV{TBB_DIR})
message(FATAL_ERROR "TBB_DIR has not been set")
else()
message(STATUS "TBB_DIR: $ENV{TBB_DIR}")
endif()
if (NOT DEFINED ENV{BOOST_ROOT})
message(FATAL_ERROR "BOOST_ROOT has not been set")
else()
message(STATUS "BOOST_ROOT: $ENV{BOOST_ROOT}")
endif()
if (NOT DEFINED ENV{BOOST_INCLUDEDIR})
message(FATAL_ERROR "BOOST_INCLUDEDIR has not been set")
else()
message(STATUS "BOOST_INCLUDEDIR: $ENV{BOOST_INCLUDEDIR}")
endif()
if (NOT DEFINED ENV{BOOST_LIBRARYDIR})
message(FATAL_ERROR "BOOST_LIBRARYDIR has not been set")
else()
message(STATUS "BOOST_LIBRARYDIR: $ENV{BOOST_LIBRARYDIR}")
endif()
if (NOT DEFINED ENV{MARI_SDK_INCLUDE_DIR})
message(FATAL_ERROR "MARI_SDK_INCLUDE_DIR has not been set")
else()
message(STATUS "MARI_SDK_INCLUDE_DIR: $ENV{MARI_SDK_INCLUDE_DIR}")
endif()
include($ENV{USD_ROOT}/pxrConfig.cmake)
find_package(TBB CONFIG REQUIRED)
if (NOT DEFINED ENV{PYTHON_ROOT})
message(STATUS "Python not enabled")
else()
message(STATUS "Adding python package with PYTHON_ROOT: $ENV{PYTHON_ROOT}")
set (Python_DIR "$ENV{PYTHON_ROOT}/cmake")
find_package(Python CONFIG REQUIRED)
endif()
if (NOT DEFINED Boost_USE_STATIC_LIBS)
set (Boost_USE_STATIC_LIBS ON)
message(STATUS "Setting Boost_USE_STATIC_LIBS to ${Boost_USE_STATIC_LIBS}")
else()
message(STATUS "Boost_USE_STATIC_LIBS: ${Boost_USE_STATIC_LIBS}")
endif()
find_package(Boost COMPONENTS python)
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
# Use C++ 17
set (CMAKE_CXX_STANDARD "17" CACHE STRING "" FORCE)
set (CMAKE_CXX_STANDARD_REQUIRED ON CACHE BOOL "" FORCE)
set (CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "" FORCE)
add_library(
USDImport
SHARED
${CMAKE_CURRENT_LIST_DIR}/plugins/fnUsdMeshImport/GeoData.cpp
${CMAKE_CURRENT_LIST_DIR}/plugins/fnUsdMeshImport/ModelData.cpp
${CMAKE_CURRENT_LIST_DIR}/plugins/fnUsdMeshImport/pxrMariUsdReaderPlugin.cpp
${CMAKE_CURRENT_LIST_DIR}/plugins/fnUsdMeshImport/UsdReader.cpp
${CMAKE_CURRENT_LIST_DIR}/plugins/fnUsdMeshImport/GeoData.h
${CMAKE_CURRENT_LIST_DIR}/plugins/fnUsdMeshImport/ModelData.h
${CMAKE_CURRENT_LIST_DIR}/plugins/fnUsdMeshImport/pxrMariUsdReaderPlugin.h
${CMAKE_CURRENT_LIST_DIR}/plugins/fnUsdMeshImport/UsdReader.h
${CMAKE_CURRENT_LIST_DIR}/plugins/fnUsdMeshImport/MariHostConfig.h
)
target_include_directories(
USDImport
PRIVATE
$ENV{MARI_SDK_INCLUDE_DIR}
$ENV{USD_ROOT}/include
$ENV{BOOST_INCLUDEDIR}
$ENV{TBB_DIR}/include
)
target_compile_options(
USDImport
PRIVATE
-DMARI_VERSION=70
-DBOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE
$<$<CONFIG:Debug>:-DBOOST_DEBUG_PYTHON>
$<$<CXX_COMPILER_ID:MSVC>:-WX -W4 -DNOMINMAX -DWIN32_LEAN_AND_MEAN /FIiso646.h -wd4201 -wd4127 -wd4244 -wd4305 -wd4800 -wd4100 -wd4267 -wd4018 -wd4996 -wd4701 -EHsc>
$<$<CXX_COMPILER_ID:GNU>:-Wall -Wno-sign-compare -Wno-deprecated>
)
target_link_libraries(
USDImport
PRIVATE
usdGeom
)
# Bundling
install(
TARGETS
USDImport
DESTINATION
${CMAKE_INSTALL_PREFIX}
)
# Copy across libs
install(
DIRECTORY
$ENV{USD_ROOT}/lib
DESTINATION
${CMAKE_INSTALL_PREFIX}
)
install(
DIRECTORY
$ENV{TBB_DIR}/lib
DESTINATION
${CMAKE_INSTALL_PREFIX}
)
install(
DIRECTORY
$ENV{BOOST_LIBRARYDIR}
DESTINATION
${CMAKE_INSTALL_PREFIX}
)
if (DEFINED ENV{PYTHON_ROOT})
install(
DIRECTORY
$ENV{PYTHON_ROOT}/lib
DESTINATION
${CMAKE_INSTALL_PREFIX}
)
endif()
# Copy across bin dlls for windows
FILE(GLOB LibFiles "$ENV{USD_ROOT}/bin/*.dll")
list(APPEND DEP_LIB_FILES ${LibFiles})
FILE(GLOB LibFiles "$ENV{TBB_DIR}/bin/*.dll")
list(APPEND DEP_LIB_FILES ${LibFiles})
FILE(GLOB LibFiles "$ENV{BOOST_ROOT}/bin/*.dll")
list(APPEND DEP_LIB_FILES ${LibFiles})
install(
FILES
${DEP_LIB_FILES}
DESTINATION
${CMAKE_INSTALL_PREFIX}/lib
)