-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeSettings.txt
274 lines (226 loc) · 9.29 KB
/
CMakeSettings.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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# ===================================================================================
#
# PRE-REQUISITES
#
# ===================================================================================
STRING(REGEX REPLACE "/[^/]*$" "" FBX_CMAKE_ROOT "${CMAKE_CURRENT_LIST_FILE}")
STRING(REGEX MATCH "[^/]+$" FBX_CMAKE_OUTPUT_FOLDER "${CMAKE_CURRENT_BINARY_DIR}")
SET(FBX_CMAKELIST_DEPENDENT)
IF(WIN32 AND CMAKE_SUPPRESS_REGENERATION)
SET(FBX_CMAKELIST_DEPENDENT "CMakeLists.txt")
ENDIF(WIN32 AND CMAKE_SUPPRESS_REGENERATION)
IF (NOT WIN32 AND NOT APPLE)
# assume we are on Linux
SET(LINUX 1)
ENDIF()
# ===================================================================================
#
# MACROS SECTION
#
# ===================================================================================
MACRO(SETPOLICY policy state)
if(POLICY ${policy})
cmake_policy(SET ${policy} ${state})
endif()
ENDMACRO(SETPOLICY policy state)
MACRO(SET_SAMPLES_GLOBAL_FLAGS)
SET(FBX_TMP_TARGET_LIBS ${FBX_REQUIRED_LIBS_DEPENDENCY})
IF(NOT WIN32)
SET(FBX_TMP_TARGET_LIBS ${FBX_TMP_TARGET_LIBS} dl pthread)
IF(APPLE)
IF(NOT FBX_CLANG)
SET(FBX_LINKER_FLAGS "-framework Carbon -framework SystemConfiguration ${FBX_LINKER_FLAGS}")
ELSE(NOT FBX_CLANG)
SET(FBX_LINKER_FLAGS "-framework CoreFoundation -framework SystemConfiguration ${FBX_LINKER_FLAGS}")
ENDIF(NOT FBX_CLANG)
SET(FBX_TMP_TARGET_LIBS ${FBX_TMP_TARGET_LIBS} iconv)
ELSEIF(LINUX)
SET(FBX_LINKER_FLAGS ${FBX_LINKER_FLAGS} "-Wl,-rpath,${FBX_BUILD_ROOT}")
ENDIF()
IF(FBX_LINKER_FLAGS)
SET_TARGET_PROPERTIES(${FBX_TARGET_NAME} PROPERTIES LINK_FLAGS ${FBX_LINKER_FLAGS})
ENDIF()
ENDIF(NOT WIN32)
INCLUDE_DIRECTORIES(BEFORE "${FBX_ROOT}/include")
INCLUDE_DIRECTORIES(AFTER "${FBX_CMAKE_ROOT}/Common")
IF(WIN32)
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /W4 ${FBX_CC_RTLd}")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /W4 ${FBX_CC_RTLd}")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${FBX_CC_RTL}")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${FBX_CC_RTL}")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${FBX_CC_RTL}")
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${FBX_CC_RTL}")
ELSE(WIN32)
SET(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
IF(FBX_ARCH STREQUAL "x64")
SET(CMAKE_CXX_FLAGS "-m64 ${CMAKE_CXX_FLAGS}")
SET(CMAKE_C_FLAGS "-m64 ${CMAKE_C_FLAGS}")
ELSEIF(FBX_ARCH STREQUAL "x86")
SET(CMAKE_CXX_FLAGS "-m32 ${CMAKE_CXX_FLAGS}")
SET(CMAKE_C_FLAGS "-m32 ${CMAKE_C_FLAGS}")
ENDIF()
IF (FBX_DEBUG)
SET(CMAKE_CXX_FLAGS "-D_DEBUG -g ${CMAKE_CXX_FLAGS}")
SET(CMAKE_C_FLAGS "-D_DEBUG -g ${CMAKE_C_FLAGS}")
ELSE()
SET(CMAKE_CXX_FLAGS "-D_NDEBUG -Os ${CMAKE_CXX_FLAGS}")
SET(CMAKE_C_FLAGS "-D_NDEBUG -Os ${CMAKE_C_FLAGS}")
ENDIF()
IF(APPLE)
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall")
ENDIF(APPLE)
ENDIF(WIN32)
IF(FBX_SHARED)
ADD_DEFINITIONS(-DFBXSDK_SHARED)
IF(WIN32)
STRING(REGEX REPLACE "\\.lib" ".dll" DLL_FILE "${FBX_REQUIRED_LIBS_DEPENDENCY}")
ADD_CUSTOM_COMMAND(TARGET ${FBX_TARGET_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${DLL_FILE}
$<TARGET_FILE_DIR:${FBX_TARGET_NAME}>)
ENDIF()
# copy the fbxsdk dynamic library to the output directory
ADD_CUSTOM_COMMAND(
TARGET ${FBX_TARGET_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FBX_SDK_ABS} ${FBX_BUILD_ROOT}/${FBX_SDK}
)
ENDIF(FBX_SHARED)
TARGET_LINK_LIBRARIES(${FBX_TARGET_NAME} ${FBX_TMP_TARGET_LIBS})
SET(FBX_TMP_TARGET_LIBS)
ENDMACRO(SET_SAMPLES_GLOBAL_FLAGS)
MACRO(FBX_PROJECT project subdir)
SET(FBX_PROJECT_NAME ${project})
SET(FBX_TARGET_NAME ${project})
SET(FBX_PROJECT_SUBDIR ${subdir} )
SET(TMP_COMPILER ${FBX_COMPILER})
IF(FBX_RTL_SUFFX)
SET(TMP_COMPILER ${FBX_COMPILER}${FBX_RTL_SUFFX})
ENDIF()
IF(NOT WIN32)
IF (NOT FBX_SHARED)
SET(TMP_COMPILER ${FBX_COMPILER}-static)
ENDIF()
ENDIF()
IF (WIN32)
SET(FBX_BUILD_ROOT "${FBX_ROOT}/bin/${TMP_COMPILER}") #${CMAKE_CFG_INTDIR} is automatically added by CMake
ELSEIF(LINUX OR APPLE)
SET(FBX_BUILD_ROOT "${FBX_ROOT}/bin/${FBX_ARCH}/${TMP_COMPILER}/${FBX_VARIANT}")
ELSE()
MESSAGE(FATAL_ERROR "Unsupported platform.")
RETURN()
ENDIF()
PROJECT(${project} ${ARGN})
SET(PROJECT_BINARY_DIR "${FBX_BUILD_ROOT}")
SET(EXECUTABLE_OUTPUT_PATH "${FBX_BUILD_ROOT}")
SET(LIBRARY_OUTPUT_PATH "${FBX_BUILD_ROOT}")
# Put the Variant part back into FBX_BUILD_ROOT
IF (WIN32)
SET(FBX_BUILD_ROOT "${FBX_ROOT}/bin/${TMP_COMPILER}/${CMAKE_CFG_INTDIR}")
ENDIF()
ENDMACRO(FBX_PROJECT project subdir)
# ===================================================================================
#
# COMMON SECTION
#
# ===================================================================================
SET(FBX_SHARED) # can be set at command line with -DFBX_SHARED=1
SET(FBX_STATIC_RTL) # can be set at command line with -DFBX_STATIC_RTL=1 (use static MSVCRT (/MT), otherwise use dynamic MSVCRT (/MD))
SET(FBX_VARIANT) # can be set at command line with -DFBX_VARIANT=debug or release (Unix only)
SET(FBX_ARCH) # can be set at command line with -DFBX_ARCH=x64 or x86 (Unix only)
SET(FBX_LINKER_FLAGS)
IF (FBX_SHARED AND FBX_STATIC_RTL)
SET(FBX_STATIC_RTL)
MESSAGE("\nBoth FBX_SHARED and FBX_STATIC_RTL have been defined. They are mutually exclusive, considering FBX_SHARED only.")
ENDIF()
IF(NOT FBX_VARIANT)
SET(FBX_VARIANT "debug")
ENDIF()
SET(FBX_DEBUG)
IF (FBX_VARIANT MATCHES "debug")
SET(FBX_DEBUG 1)
ENDIF()
IF(NOT FBX_ARCH)
SET(FBX_ARCH "x64")
IF(WIN32 AND NOT CMAKE_CL_64)
SET(FBX_ARCH "x86")
ENDIF()
ENDIF()
IF(WIN32)
SET(CMAKE_USE_RELATIVE_PATHS 1)
SET(LIB_EXTENSION ".lib")
ELSE(WIN32)
SET(LIB_EXTENSION ".a")
IF(FBX_SHARED)
IF(APPLE)
SET(LIB_EXTENSION ".dylib")
ELSEIF(LINUX)
SET(LIB_EXTENSION ".so")
ENDIF()
ENDIF()
ENDIF(WIN32)
SET(FBX_SDK libfbxsdk${LIB_EXTENSION})
IF(WIN32)
IF(CMAKE_CONFIGURATION_TYPES)
set(CMAKE_CONFIGURATION_TYPES Debug Release RelWithDebInfo)
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Reset the configurations to what we need" FORCE)
ENDIF()
IF(MSVC_VERSION EQUAL 1700)
SET(FBX_COMPILER "vs2012")
ELSEIF(MSVC_VERSION EQUAL 1800)
SET(FBX_COMPILER "vs2013")
ELSEIF(MSVC_VERSION EQUAL 1900)
SET(FBX_COMPILER "vs2015")
ELSEIF(MSVC_VERSION EQUAL 1911)
SET(FBX_COMPILER "vs2017")
ELSEIF(MSVC_VERSION GREATER 1920)
SET(FBX_COMPILER "vs2017")
ENDIF()
set(Configuration "Debug")
message("CCCCCCCCCCCCCC ${Configuration}")
SET(FBX_TARGET_LIBS_PATH "${FBX_ROOT}/lib/${FBX_COMPILER}/${FBX_ARCH}/${Configuration}")
SET(FBX_SDK_ABS ${FBX_TARGET_LIBS_PATH}/${FBX_SDK})
SET(FBX_REQUIRED_LIBS_DEPENDENCY ${FBX_SDK_ABS})
IF(NOT FBX_SHARED)
IF(FBX_STATIC_RTL)
SET(FBX_CC_RTL "/MT")
SET(FBX_CC_RTLd "/MTd")
SET(FBX_RTL_SUFFX "-mt")
ELSE()
SET(FBX_CC_RTL "/MD")
SET(FBX_CC_RTLd "/MDd")
SET(FBX_RTL_SUFFX "-md")
ENDIF()
SET(FBX_REQUIRED_LIBS_DEPENDENCY
${FBX_TARGET_LIBS_PATH}/libfbxsdk${FBX_RTL_SUFFX}${LIB_EXTENSION}
${FBX_TARGET_LIBS_PATH}/libxml2${FBX_RTL_SUFFX}${LIB_EXTENSION}
${FBX_TARGET_LIBS_PATH}/zlib${FBX_RTL_SUFFX}${LIB_EXTENSION})
ENDIF()
ELSE()
MESSAGE("Detecting compiler version used")
EXEC_PROGRAM(${CMAKE_CXX_COMPILER} ARGS --version OUTPUT_VARIABLE CMAKE_CXX_COMPILER_VERSION)
IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
MESSAGE("Detected Clang ${CMAKE_CXX_COMPILER_VERSION}")
SET(FBX_COMPILER "clang")
SET(FBX_CLANG 1)
ELSE()
SET(FBX_COMPILER "gcc")
IF(CMAKE_CXX_COMPILER_VERSION MATCHES " [4-9]\\.[0-9].*")
MESSAGE( "Detected GCC >= 4.0" )
ELSE()
MESSAGE(FATAL_ERROR "Detected " ${GCC_PREFIX} " only GCC 4.x and higher supported")
ENDIF()
ENDIF()
IF(APPLE)
SET(FBX_TARGET_LIBS_PATH "${FBX_ROOT}/lib/${FBX_COMPILER}/${Configuration}")
IF(FBX_COMPILER STREQUAL "gcc")
SET(FBX_TARGET_LIBS_PATH "${FBX_ROOT}/lib/${FBX_COMPILER}/ub/${Configuration}")
ENDIF()
SET(FBX_EXTRA_LIBS_PATH ${FBX_TARGET_LIBS_PATH}/lib)
ELSEIF(LINUX)
SET(FBX_TARGET_LIBS_PATH "${FBX_ROOT}/lib/${FBX_COMPILER}/${FBX_ARCH}/${Configuration}")
SET(FBX_EXTRA_LIBS_PATH ${FBX_TARGET_LIBS_PATH}/lib)
ENDIF()
SET(FBX_SDK_ABS ${FBX_EXTRA_LIBS_PATH}fbxsdk${LIB_EXTENSION})
SET(FBX_REQUIRED_LIBS_DEPENDENCY ${FBX_SDK_ABS} z xml2)
ENDIF()