forked from Autodesk/arnold-usd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
165 lines (135 loc) · 4.38 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
project(arnold-usd)
cmake_minimum_required(VERSION 3.20)
if (UNIX AND NOT APPLE)
set(LINUX TRUE)
endif ()
if (LINUX)
set(LIB_EXTENSION ".so")
add_compile_definitions(_LINUX)
elseif (APPLE)
set(LIB_EXTENSION ".dylib")
add_compile_definitions(_DARWIN)
else ()
set(LIB_EXTENSION ".dll")
add_compile_definitions(_WINDOWS _WIN32 WIN32)
add_compile_definitions(_WIN64)
endif ()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" 0)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/utils" 0)
include(options)
include(build)
# Global required packagse
find_package(USD REQUIRED)
find_package(Arnold REQUIRED)
if (BUILD_SCHEMAS OR (BUILD_TESTSUITE AND BUILD_RENDER_DELEGATE AND BUILD_NDR_PLUGIN))
if (BUILD_USE_PYTHON3)
find_package(Python3 COMPONENTS Development Interpreter REQUIRED)
else ()
find_package(Python2 COMPONENTS Development Interpreter REQUIRED)
endif ()
else ()
if (BUILD_USE_PYTHON3)
find_package(Python3 COMPONENTS Development REQUIRED)
else ()
find_package(Python2 COMPONENTS Development REQUIRED)
endif ()
endif ()
if (BUILD_USE_PYTHON3)
set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
else ()
set(PYTHON_EXECUTABLE ${Python2_EXECUTABLE})
endif ()
if (NOT BUILD_USE_CUSTOM_BOOST)
if (USD_HAS_PYTHON)
find_package(Boost COMPONENTS python REQUIRED)
else ()
find_package(Boost REQUIRED)
endif ()
endif ()
# This disables explicit linking from boost headers on Windows.
if (BUILD_BOOST_ALL_NO_LIB AND WIN32)
add_compile_definitions(BOOST_ALL_NO_LIB=1)
# This is for Houdini's boost libs.
add_compile_definitions(HBOOST_ALL_NO_LIB=1)
endif ()
find_package(TBB REQUIRED)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/arnold_usd.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/arnold_usd.h")
set(CMAKE_CXX_STANDARD 11 CACHE STRING "CMake CXX Standard")
if (APPLE)
string(APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,-undefined,error")
elseif (LINUX)
string(APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,--no-undefined")
endif ()
if (WIN32)
# So we can use std::min and std::max, because windows headers are indirectly included by TF.
add_compile_definitions(NOMINMAX)
if (TBB_NO_EXPLICIT_LINKAGE)
add_compile_definitions(__TBB_NO_IMPLICIT_LINKAGE=1)
endif ()
endif ()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 6.3)
# GCC 6.3.1 complains about the usage of auto_ptr from the newer
# TBB versions.
add_compile_options(-Wno-deprecated-declarations)
if (BUILD_DISABLE_CXX11_ABI)
add_compile_options(-D_GLIBCXX_USE_CXX11_ABI=0)
endif ()
endif ()
endif ()
# Common directory includes.
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/common")
set(COMMON_SRC
"${CMAKE_CURRENT_SOURCE_DIR}/common/common_utils.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/common/constant_strings.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/common/shape_utils.cpp")
set(COMMON_HDR
"${CMAKE_CURRENT_SOURCE_DIR}/common/common_bits.h"
"${CMAKE_CURRENT_SOURCE_DIR}/common/common_utils.h"
"${CMAKE_CURRENT_SOURCE_DIR}/common/constant_strings.h"
"${CMAKE_CURRENT_SOURCE_DIR}/common/shape_utils.h")
if (BUILD_SCHEMAS AND USD_HAS_PYTHON)
add_subdirectory(schemas)
install(FILES plugInfo.json
DESTINATION "${PREFIX_SCHEMA}")
endif ()
if (NOT USD_STATIC_BUILD)
if (BUILD_NDR_PLUGIN)
add_subdirectory(ndr)
endif ()
if (BUILD_RENDER_DELEGATE)
add_subdirectory(render_delegate)
endif ()
if (BUILD_USD_IMAGING_PLUGIN)
add_subdirectory(usd_imaging)
endif ()
if (BUILD_SCENE_DELEGATE)
add_subdirectory(scene_delegate)
endif ()
if (BUILD_RENDER_DELEGATE OR BUILD_NDR_PLUGIN OR BUILD_USD_IMAGING_PLUGIN OR BUILD_SCENE_DELEGATE)
install(FILES plugInfo.json
DESTINATION "${PREFIX_PLUGINS}")
endif ()
endif ()
if (BUILD_PROCEDURAL OR BUILD_USD_WRITER)
add_subdirectory(translator)
endif ()
if (BUILD_PROCEDURAL)
add_subdirectory(procedural)
endif ()
if (BUILD_USD_WRITER)
add_subdirectory(cmd)
endif ()
if (BUILD_DOCS)
add_subdirectory(docs)
endif ()
if (BUILD_TESTSUITE)
enable_testing()
add_subdirectory(testsuite)
endif ()
install(FILES LICENSE.md
DESTINATION .)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/arnold_usd.h"
DESTINATION "${PREFIX_HEADERS}/arnold_usd")