]>
Commit | Line | Data |
---|---|---|
19286d7c | 1 | cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR) |
166d6cd7 | 2 | |
896faa72 | 3 | set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/adm/cmake") |
4 | ||
576f8b11 | 5 | set (CMAKE_SUPPRESS_REGENERATION TRUE) |
6 | ||
fa0cbe55 | 7 | set (CMAKE_CONFIGURATION_TYPES Release Debug RelWithDebInfo CACHE INTERNAL "" FORCE) |
03c69aec | 8 | |
316d77d9 | 9 | # macro: include patched file if it exists |
10 | macro (OCCT_INCLUDE_CMAKE_FILE BEING_INCLUDED_FILE) | |
109aa56e | 11 | if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/${BEING_INCLUDED_FILE}.cmake") |
12 | include (${BUILD_PATCH}/${BEING_INCLUDED_FILE}.cmake) | |
316d77d9 | 13 | else() |
f2e9c853 | 14 | include (${CMAKE_SOURCE_DIR}/${BEING_INCLUDED_FILE}.cmake) |
316d77d9 | 15 | endif() |
16 | endmacro() | |
17 | ||
18 | # include variable description | |
19 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/vardescr") | |
20 | ||
c259930b | 21 | # set type of OCCT libraries |
22 | if (NOT BUILD_LIBRARY_TYPE) | |
316d77d9 | 23 | set (BUILD_LIBRARY_TYPE "Shared" CACHE STRING "${BUILD_LIBRARY_TYPE_DESCR}" FORCE) |
c259930b | 24 | SET_PROPERTY(CACHE BUILD_LIBRARY_TYPE PROPERTY STRINGS Shared Static) |
25 | endif() | |
26 | ||
27 | if ("${BUILD_LIBRARY_TYPE}" STREQUAL "Shared") | |
28 | set (BUILD_SHARED_LIBS ON) | |
46bd680a | 29 | |
30 | if (NOT DEFINED BUILD_SHARED_LIBRARY_NAME_POSTFIX) | |
31 | set (BUILD_SHARED_LIBRARY_NAME_POSTFIX "" CACHE STRING "${BUILD_SHARED_LIBRARY_NAME_POSTFIX_DESCR}" FORCE) | |
32 | endif() | |
c259930b | 33 | else() |
34 | unset (BUILD_SHARED_LIBS) | |
46bd680a | 35 | unset (BUILD_SHARED_LIBRARY_NAME_POSTFIX) |
c259930b | 36 | endif() |
37 | ||
9f33b387 | 38 | # the name of the project |
39 | project (OCCT) | |
03c69aec | 40 | |
ad03c234 | 41 | if (WIN32) |
42 | add_definitions(-DUNICODE) | |
43 | add_definitions(-D_UNICODE) | |
44 | endif() | |
45 | ||
096ef695 | 46 | # include occt macros |
47 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros") | |
48 | ||
9f33b387 | 49 | # Solution folder property |
50 | set_property (GLOBAL PROPERTY USE_FOLDERS ON) | |
03c69aec | 51 | |
096ef695 | 52 | # get current OCCT version |
53 | OCC_VERSION (OCC_VERSION_MAJOR OCC_VERSION_MINOR OCC_VERSION_MAINTENANCE OCC_VERSION_DEVELOPMENT OCC_VERSION_STRING_EXT) | |
54 | ||
55 | set_property (GLOBAL PROPERTY OCC_VERSION_MAJOR ${OCC_VERSION_MAJOR}) | |
56 | set_property (GLOBAL PROPERTY OCC_VERSION_MINOR ${OCC_VERSION_MINOR}) | |
57 | set_property (GLOBAL PROPERTY OCC_VERSION_MAINTENANCE ${OCC_VERSION_MAINTENANCE}) | |
58 | ||
0e617b05 | 59 | set (INSTALL_TEST_CASES OFF CACHE BOOL "${INSTALL_TEST_CASES_DESCR}") |
096ef695 | 60 | |
ee5befae | 61 | # Regeneration of OCCT resource files |
62 | set (BUILD_RESOURCES OFF CACHE BOOL "${BUILD_RESOURCES_DESCR}") | |
63 | ||
096ef695 | 64 | # single-configuration generator |
65 | set (SINGLE_GENERATOR OFF) | |
66 | if (CMAKE_BUILD_TYPE) | |
67 | set (SINGLE_GENERATOR ON) | |
68 | endif() | |
69 | ||
316d77d9 | 70 | # a single-configuration generator like the Makefile generator defines CMAKE_BUILD_TYPE variable |
71 | # check this variable and set if it's required | |
72 | if (DEFINED CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE) # single-configuration generator. | |
73 | set (CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE) | |
19286d7c | 74 | endif() |
75 | ||
898f6a92 | 76 | # enable extended messages of many OCCT algorithms |
742cc8b0 | 77 | if (((SINGLE_GENERATOR AND "${CMAKE_BUILD_TYPE}" STREQUAL "Debug") OR NOT SINGLE_GENERATOR) AND (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")) |
e13e5f39 | 78 | if (NOT BUILD_WITH_DEBUG) |
79 | set (BUILD_WITH_DEBUG OFF CACHE BOOL "${BUILD_WITH_DEBUG_DESCR}") | |
80 | endif() | |
81 | else() | |
82 | OCCT_CHECK_AND_UNSET (BUILD_WITH_DEBUG) | |
83 | endif() | |
84 | ||
109aa56e | 85 | if (BUILD_WITH_DEBUG) |
e13e5f39 | 86 | set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:DEBUG>:OCCT_DEBUG>) |
898f6a92 | 87 | endif() |
316d77d9 | 88 | |
896faa72 | 89 | # option to enable or disable use of precompiled headers |
90 | if (NOT DEFINED BUILD_USE_PCH) | |
91 | set (BUILD_USE_PCH OFF CACHE BOOL "${BUILD_USE_PCH_DESCR}") | |
92 | endif() | |
93 | ||
94 | if (BUILD_USE_PCH) | |
95 | ||
96 | # Load Cotire tool for accelerating build procedure | |
97 | include(cotire) | |
98 | ||
99 | # Set Cotire to ignore lxx, pxx, gxx | |
100 | set (COTIRE_ADDITIONAL_PREFIX_HEADER_IGNORE_EXTENSIONS "lxx;pxx;gxx" CACHE STRING "Set Cotire to ignore OCCT specific files that can be #included" FORCE) | |
101 | ||
102 | # Set priority for inclusion of system headers in PCH to reduce problems | |
103 | # due to incomplete inclusion or wrong order. | |
104 | if (WIN32) | |
105 | # on Windows, assume that SDK (windows.h) is in default location | |
106 | set(ProgramFilesX86 "ProgramFiles(x86)") | |
107 | file(TO_CMAKE_PATH "$ENV{${ProgramFilesX86}}" ProgramFilesX86) | |
108 | set_property (DIRECTORY PROPERTY COTIRE_PREFIX_HEADER_INCLUDE_PRIORITY_PATH "${ProgramFilesX86}") | |
109 | unset(ProgramFilesX86) | |
110 | endif() | |
111 | ||
112 | endif() | |
113 | ||
19286d7c | 114 | # copy samples to install directory |
0e617b05 | 115 | set (INSTALL_SAMPLES OFF CACHE BOOL "${INSTALL_SAMPLES_DESCR}") |
19286d7c | 116 | |
096ef695 | 117 | # install dir of the project |
118 | if (NOT DEFINED INSTALL_DIR) | |
4b3541c6 | 119 | # set default install directory for Windows |
84258256 | 120 | if (WIN32 AND NOT DEFINED CMAKE_INSTALL_PREFIX) |
4b3541c6 | 121 | set (CMAKE_INSTALL_PREFIX "C:/opencascade-${OCC_VERSION_STRING_EXT}") |
122 | endif() | |
096ef695 | 123 | set (INSTALL_DIR "${CMAKE_INSTALL_PREFIX}" CACHE PATH "${INSTALL_DIR_DESCR}") |
84258256 | 124 | else() |
1d505bb0 | 125 | file (TO_CMAKE_PATH "${INSTALL_DIR}" INSTALL_DIR) |
84258256 | 126 | set (INSTALL_DIR "${INSTALL_DIR}" CACHE PATH "${INSTALL_DIR_DESCR}" FORCE) |
096ef695 | 127 | endif() |
128 | ||
4b3541c6 | 129 | # choose a variant of the layout of the install paths |
130 | if (NOT INSTALL_DIR_LAYOUT) | |
131 | if (WIN32) | |
132 | set (INSTALL_DIR_LAYOUT "Windows" CACHE STRING "${INSTALL_DIR_LAYOUT_DESCR}" FORCE) | |
133 | else() | |
134 | set (INSTALL_DIR_LAYOUT "Unix" CACHE STRING "${INSTALL_DIR_LAYOUT_DESCR}" FORCE) | |
135 | endif() | |
136 | SET_PROPERTY(CACHE INSTALL_DIR_LAYOUT PROPERTY STRINGS Windows Unix) | |
137 | endif() | |
138 | ||
139 | # check INSTALL_DIR_LAYOUT changes and update INSTALL_DIR_* paths if necessary | |
140 | if (NOT DEFINED INSTALL_DIR_LAYOUT_PREV) | |
141 | set (INSTALL_DIR_LAYOUT_PREV "${INSTALL_DIR_LAYOUT}" CACHE INTERNAL "" FORCE) | |
142 | elseif (NOT "${INSTALL_DIR_LAYOUT_PREV}" STREQUAL "${INSTALL_DIR_LAYOUT}") | |
143 | set (INSTALL_DIR_LAYOUT_PREV "${INSTALL_DIR_LAYOUT}" CACHE INTERNAL "" FORCE) | |
144 | # The structure of install folder should be reset due to changed layout | |
145 | OCCT_CHECK_AND_UNSET_INSTALL_DIR_SUBDIRS () | |
146 | ||
147 | # Unset INSTALL_DIR_WITH_VERSION on windows | |
148 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Windows") | |
149 | OCCT_CHECK_AND_UNSET (INSTALL_DIR_WITH_VERSION) | |
150 | else() | |
151 | if (NOT DEFINED INSTALL_DIR_WITH_VERSION) | |
152 | set (INSTALL_DIR_WITH_VERSION OFF CACHE BOOL "${INSTALL_DIR_WITH_VERSION_DESCR}") | |
153 | endif() | |
154 | endif() | |
155 | endif() | |
156 | ||
157 | # check CMAKE_INSTALL_PREFIX changes and update INSTALL_DIR if necessary | |
d573adcf | 158 | if (NOT DEFINED CMAKE_INSTALL_PREFIX_PREV) |
159 | set (CMAKE_INSTALL_PREFIX_PREV "${CMAKE_INSTALL_PREFIX}" CACHE INTERNAL "" FORCE) | |
160 | elseif (NOT "${CMAKE_INSTALL_PREFIX_PREV}" STREQUAL "${CMAKE_INSTALL_PREFIX}") | |
161 | # CMAKE_INSTALL_PREFIX has been changed at previous step | |
162 | set (CMAKE_INSTALL_PREFIX_PREV "${CMAKE_INSTALL_PREFIX}" CACHE INTERNAL "" FORCE) | |
163 | ||
164 | # INSTALL_DIR is required to be updated | |
165 | set (INSTALL_DIR "${CMAKE_INSTALL_PREFIX}" CACHE PATH "${INSTALL_DIR_DESCR}" FORCE) | |
166 | endif() | |
167 | ||
4b3541c6 | 168 | # check INSTALL_DIR changes and update CMAKE_INSTALL_PREFIX if necessary |
d573adcf | 169 | if (NOT DEFINED INSTALL_DIR_PREV) |
170 | set (INSTALL_DIR_PREV "${INSTALL_DIR}" CACHE INTERNAL "" FORCE) | |
171 | elseif (NOT "${INSTALL_DIR_PREV}" STREQUAL "${INSTALL_DIR}") | |
172 | # INSTALL_DIR has been changed at previous step | |
173 | set (INSTALL_DIR_PREV "${INSTALL_DIR}" CACHE INTERNAL "" FORCE) | |
174 | ||
175 | # sync CMAKE_INSTALL_PREFIX with INSTALL_DIR | |
176 | set (CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE) | |
177 | ||
178 | # set CMAKE_INSTALL_PREFIX_PREV to avoid the reset of structure of the install folder | |
179 | set (CMAKE_INSTALL_PREFIX_PREV "${INSTALL_DIR}" CACHE INTERNAL "" FORCE) | |
4b3541c6 | 180 | endif() |
d573adcf | 181 | |
4b3541c6 | 182 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") |
183 | if (NOT DEFINED INSTALL_DIR_WITH_VERSION_PREV) | |
184 | set (INSTALL_DIR_WITH_VERSION_PREV "${INSTALL_DIR_WITH_VERSION}" CACHE INTERNAL "" FORCE) | |
185 | elseif (NOT "${INSTALL_DIR_WITH_VERSION_PREV}" STREQUAL "${INSTALL_DIR_WITH_VERSION}") | |
186 | # INSTALL_DIR_WITH_VERSION has been changed at previous step | |
187 | set (INSTALL_DIR_WITH_VERSION_PREV "${INSTALL_DIR_WITH_VERSION}" CACHE INTERNAL "" FORCE) | |
188 | ||
189 | OCCT_CHECK_AND_UNSET_INSTALL_DIR_SUBDIRS () | |
190 | endif() | |
096ef695 | 191 | endif() |
192 | ||
193 | # hide CMAKE_INSTALL_PREFIX from a user | |
194 | set (CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE) | |
195 | ||
196 | set (BIN_LETTER "") | |
197 | if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") | |
198 | set (BIN_LETTER "d") | |
199 | elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo") | |
200 | set (BIN_LETTER "i") | |
201 | endif() | |
03c69aec | 202 | |
096ef695 | 203 | # Get all used variables: OS_WITH_BIT, COMPILER |
204 | OCCT_MAKE_OS_WITH_BITNESS() | |
205 | OCCT_MAKE_COMPILER_SHORT_NAME() | |
206 | ||
4b3541c6 | 207 | # do not define INSTALL_DIR_BIN for win. |
096ef695 | 208 | # Leave library structure for win: <prefix>/win64/vc10/bin(d) |
4b3541c6 | 209 | if (NOT DEFINED INSTALL_DIR_BIN) |
210 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") | |
211 | set (INSTALL_DIR_BIN "bin" CACHE PATH "${INSTALL_DIR_BIN_DESCR}") | |
096ef695 | 212 | else() |
4b3541c6 | 213 | set (INSTALL_DIR_BIN "${OS_WITH_BIT}/${COMPILER}/bin" CACHE PATH "${INSTALL_DIR_BIN_DESCR}") |
096ef695 | 214 | endif() |
215 | endif() | |
216 | ||
217 | # define folder contaning all shell/batch scripts | |
4b3541c6 | 218 | if (NOT DEFINED INSTALL_DIR_SCRIPT) |
219 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") | |
220 | set (INSTALL_DIR_SCRIPT "${INSTALL_DIR_BIN}" CACHE PATH "${INSTALL_DIR_SCRIPT_DESCR}") | |
096ef695 | 221 | else() |
4b3541c6 | 222 | set (INSTALL_DIR_SCRIPT "." CACHE PATH "${INSTALL_DIR_SCRIPT_DESCR}") |
096ef695 | 223 | endif() |
224 | endif() | |
225 | ||
226 | # place the libraries to <prefix>/lib folder for unix and leave old structure for windows | |
4b3541c6 | 227 | if (NOT DEFINED INSTALL_DIR_LIB) |
228 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") | |
229 | set (INSTALL_DIR_LIB "lib" CACHE PATH "${INSTALL_DIR_LIB_DESCR}") | |
096ef695 | 230 | else() |
4b3541c6 | 231 | set (INSTALL_DIR_LIB "${OS_WITH_BIT}/${COMPILER}/lib" CACHE PATH "${INSTALL_DIR_LIB_DESCR}") |
096ef695 | 232 | endif() |
233 | endif() | |
234 | ||
235 | # OCCT headers: <prefix>/inc for windows, | |
236 | # <prefix>/include/opencascade-7.0.0 for unix | |
4b3541c6 | 237 | if (NOT DEFINED INSTALL_DIR_INCLUDE) |
238 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") | |
239 | set (INSTALL_DIR_INCLUDE "include/opencascade" CACHE PATH "${INSTALL_DIR_INCLUDE_DESCR}") | |
240 | if (INSTALL_DIR_WITH_VERSION) | |
241 | set (INSTALL_DIR_INCLUDE "include/opencascade-${OCC_VERSION_STRING_EXT}" CACHE PATH "${INSTALL_DIR_INCLUDE_DESCR}" FORCE) | |
242 | endif() | |
096ef695 | 243 | else() |
4b3541c6 | 244 | set (INSTALL_DIR_INCLUDE "inc" CACHE PATH "${INSTALL_DIR_INCLUDE_DESCR}") |
096ef695 | 245 | endif() |
246 | endif() | |
247 | ||
248 | # OCCT resources: <prefix>/src for windows, | |
249 | # <prefix>/share/opencascade-7.0.0/resources for unix | |
4b3541c6 | 250 | if (NOT DEFINED INSTALL_DIR_RESOURCE) |
251 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") | |
252 | set (INSTALL_DIR_RESOURCE "share/opencascade/resources" CACHE PATH "${INSTALL_DIR_RESOURCE_DESCR}") | |
253 | if (INSTALL_DIR_WITH_VERSION) | |
254 | set (INSTALL_DIR_RESOURCE "share/opencascade-${OCC_VERSION_STRING_EXT}/resources" CACHE PATH "${INSTALL_DIR_RESOURCE_DESCR}" FORCE) | |
255 | endif() | |
096ef695 | 256 | else() |
4b3541c6 | 257 | set (INSTALL_DIR_RESOURCE "src" CACHE PATH "${INSTALL_DIR_RESOURCE_DESCR}") |
096ef695 | 258 | endif() |
259 | endif() | |
260 | ||
261 | # OCCT data | |
4b3541c6 | 262 | if (NOT DEFINED INSTALL_DIR_DATA) |
263 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") | |
264 | set (INSTALL_DIR_DATA "share/opencascade/data" CACHE PATH "${INSTALL_DIR_DATA_DESCR}") | |
265 | if (INSTALL_DIR_WITH_VERSION) | |
266 | set (INSTALL_DIR_DATA "share/opencascade-${OCC_VERSION_STRING_EXT}/data" CACHE PATH "${INSTALL_DIR_DATA_DESCR}" FORCE) | |
267 | endif() | |
268 | else() | |
269 | set (INSTALL_DIR_DATA "data" CACHE PATH "${INSTALL_DIR_DATA_DESCR}") | |
270 | endif() | |
271 | endif() | |
272 | ||
273 | # OCCT samples | |
274 | if (NOT DEFINED INSTALL_DIR_SAMPLES) | |
275 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") | |
276 | set (INSTALL_DIR_SAMPLES "share/opencascade/samples" CACHE PATH "${INSTALL_DIR_SAMPLES_DESCR}") | |
277 | if (INSTALL_DIR_WITH_VERSION) | |
278 | set (INSTALL_DIR_SAMPLES "share/opencascade-${OCC_VERSION_STRING_EXT}/samples" CACHE PATH "${INSTALL_DIR_SAMPLES_DESCR}" FORCE) | |
279 | endif() | |
280 | else() | |
281 | set (INSTALL_DIR_SAMPLES "samples" CACHE PATH "${INSTALL_DIR_SAMPLES_DESCR}") | |
282 | endif() | |
283 | endif() | |
284 | ||
285 | # OCCT tests | |
286 | if (NOT DEFINED INSTALL_DIR_TESTS) | |
287 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") | |
288 | set (INSTALL_DIR_TESTS "share/opencascade/tests" CACHE PATH "${INSTALL_DIR_TESTS_DESCR}") | |
289 | if (INSTALL_DIR_WITH_VERSION) | |
290 | set (INSTALL_DIR_TESTS "share/opencascade-${OCC_VERSION_STRING_EXT}/tests" CACHE PATH "${INSTALL_DIR_TESTS_DESCR}" FORCE) | |
291 | endif() | |
292 | else() | |
293 | set (INSTALL_DIR_TESTS "tests" CACHE PATH "${INSTALL_DIR_TESTS_DESCR}") | |
294 | endif() | |
295 | endif() | |
296 | ||
297 | # OCCT doc | |
298 | if (NOT DEFINED INSTALL_DIR_DOC) | |
299 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") | |
300 | set (INSTALL_DIR_DOC "share/doc/opencascade" CACHE PATH "${INSTALL_DIR_DOC_DESCR}") | |
301 | if (INSTALL_DIR_WITH_VERSION) | |
302 | set (INSTALL_DIR_DOC "share/doc/opencascade-${OCC_VERSION_STRING_EXT}" CACHE PATH "${INSTALL_DIR_DOC_DESCR}" FORCE) | |
303 | endif() | |
096ef695 | 304 | else() |
4b3541c6 | 305 | set (INSTALL_DIR_DOC "doc" CACHE PATH "${INSTALL_DIR_DOC_DESCR}") |
096ef695 | 306 | endif() |
307 | endif() | |
308 | ||
2e48c1cb | 309 | # define folder contaning CMake configuration files |
310 | if (NOT DEFINED INSTALL_DIR_CMAKE) | |
311 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") | |
312 | if (INSTALL_DIR_WITH_VERSION) | |
313 | set (INSTALL_DIR_CMAKE "lib/cmake/opencascade-${OCC_VERSION_STRING_EXT}" CACHE PATH "${INSTALL_DIR_CMAKE_DESCR}") | |
314 | else() | |
315 | set (INSTALL_DIR_CMAKE "lib/cmake/opencascade" CACHE PATH "${INSTALL_DIR_CMAKE_DESCR}") | |
316 | endif() | |
317 | else() | |
ada9ef40 | 318 | set (INSTALL_DIR_CMAKE "cmake" CACHE PATH "${INSTALL_DIR_CMAKE_DESCR}") |
2e48c1cb | 319 | endif() |
320 | endif() | |
321 | ||
ee5befae | 322 | # include occt macros |
323 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_resources") | |
324 | ||
4b3541c6 | 325 | # install LICENSE_LGPL_21.txt and OCCT_LGPL_EXCEPTION.txt files |
326 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") | |
d26375e2 | 327 | OCCT_INSTALL_FILE_OR_DIR ("LICENSE_LGPL_21.txt" "${INSTALL_DIR_DOC}") |
328 | OCCT_INSTALL_FILE_OR_DIR ("OCCT_LGPL_EXCEPTION.txt" "${INSTALL_DIR_DOC}") | |
4b3541c6 | 329 | else() |
d26375e2 | 330 | OCCT_INSTALL_FILE_OR_DIR ("LICENSE_LGPL_21.txt" ".") |
331 | OCCT_INSTALL_FILE_OR_DIR ("OCCT_LGPL_EXCEPTION.txt" ".") | |
4b3541c6 | 332 | endif() |
333 | ||
09eca2b5 | 334 | if(APPLE) |
335 | set (INSTALL_NAME_DIR "" CACHE STRING "install_name library suffix on OS X (e.g. @executable_path/../Frameworks)") | |
336 | endif() | |
337 | ||
096ef695 | 338 | # a directory recognized as a 'patch' for OCCT |
109aa56e | 339 | set (BUILD_PATCH "" CACHE PATH "${BUILD_PATCH_DESCR}") |
03c69aec | 340 | |
9f33b387 | 341 | # the list of being built toolkits |
316d77d9 | 342 | set (BUILD_ADDITIONAL_TOOLKITS "" CACHE STRING "${BUILD_ADDITIONAL_TOOLKITS_DESCR}") |
343 | separate_arguments (BUILD_ADDITIONAL_TOOLKITS) | |
03c69aec | 344 | |
ad211ad3 | 345 | if (MSVC) |
510d9690 | 346 | set (BUILD_SAMPLES_MFC OFF CACHE BOOL "${BUILD_SAMPLES_MFC_DESCR}") |
85bcc072 | 347 | endif() |
510d9690 | 348 | set (BUILD_SAMPLES_QT OFF CACHE BOOL "${BUILD_SAMPLES_QT_DESCR}") |
85bcc072 | 349 | |
4f4b8935 | 350 | set (BUILD_Inspector OFF CACHE BOOL "${BUILD_Inspector_DESCR}") |
351 | ||
742cc8b0 | 352 | # uwp sample |
353 | if (MSVC) | |
354 | if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore") | |
355 | set (BUILD_MODULE_UwpSample OFF CACHE BOOL "${BUILD_MODULE_UwpSample_DESCR}") | |
356 | else() | |
357 | unset (BUILD_MODULE_UwpSample) | |
358 | endif() | |
359 | endif() | |
360 | ||
9f33b387 | 361 | # whether use optional 3rdparty or not |
362 | if (APPLE) | |
316d77d9 | 363 | set (USE_GLX OFF CACHE BOOL "${USE_GLX_DESCR}") |
03c69aec | 364 | endif() |
096ef695 | 365 | |
f60111dc | 366 | if (WIN32) |
367 | set (USE_D3D OFF CACHE BOOL "${USE_D3D_DESCR}") | |
368 | endif() | |
85bcc072 | 369 | |
7a59f4ce | 370 | # Enable/Disable the floating point exceptions (FPE) during runtime. |
371 | if (NOT BUILD_ENABLE_FPE_SIGNAL_HANDLER) | |
372 | set (BUILD_ENABLE_FPE_SIGNAL_HANDLER OFF CACHE BOOL "${BUILD_ENABLE_FPE_SIGNAL_HANDLER_DESCR}" FORCE) | |
373 | endif() | |
374 | ||
375 | if (BUILD_ENABLE_FPE_SIGNAL_HANDLER) | |
376 | set (BUILD_ENABLE_FPE_SIGNAL_HANDLER 1) | |
377 | else() | |
378 | set (BUILD_ENABLE_FPE_SIGNAL_HANDLER 0) | |
379 | endif() | |
380 | ||
9f33b387 | 381 | # include the patched or original list of modules |
19286d7c | 382 | # list <MODULENAME>_TOOLKITS is created foreach module and contains its toolkits |
383 | # list <OCCT_MODULES> will contain all modules | |
1fa16152 | 384 | OCCT_MODULES_AND_TOOLKITS (MODULES "TOOLKITS" OCCT_MODULES) |
03c69aec | 385 | |
316d77d9 | 386 | foreach (OCCT_MODULE ${OCCT_MODULES}) |
387 | BUILD_MODULE (${OCCT_MODULE}) | |
19286d7c | 388 | endforeach() |
389 | ||
e713baee | 390 | if (ANDROID AND BUILD_MODULE_Draw) |
391 | message (STATUS "Info. Draw module is turned off due to it is not supported on Android") | |
392 | set (BUILD_MODULE_Draw OFF CACHE BOOL "${BUILD_MODULE_Draw_DESCR}" FORCE) | |
393 | endif() | |
49e5d238 | 394 | if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore" AND BUILD_MODULE_Draw) |
395 | message (STATUS "Info. Draw module is turned off due to it is not supported on UWP") | |
396 | set (BUILD_MODULE_Draw OFF CACHE BOOL "${BUILD_MODULE_Draw_DESCR}" FORCE) | |
397 | endif() | |
e713baee | 398 | |
adc33035 | 399 | # Overview |
9d034c37 | 400 | if (NOT DEFINED BUILD_DOC_Overview) |
401 | set (DO_ONLY_CHECK_FOR_DOXYGEN ON) | |
402 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/doxygen") | |
403 | set (DO_ONLY_CHECK_FOR_DOXYGEN OFF) | |
404 | ||
405 | if (CAN_DOXYGEN_BE_USED) | |
406 | message (STATUS "Info. Overview building is turned on") | |
407 | endif() | |
408 | ||
409 | set (BUILD_DOC_Overview ${CAN_DOXYGEN_BE_USED} CACHE BOOL "${BUILD_DOC_Overview_DESCR}") | |
410 | endif() | |
adc33035 | 411 | |
f60111dc | 412 | if (NOT USE_D3D) |
413 | list (REMOVE_ITEM Visualization_TOOLKITS TKD3DHost) | |
414 | endif() | |
415 | ||
316d77d9 | 416 | # accumulate used toolkits (first level) in BUILD_TOOLKITS variable |
417 | list (APPEND BUILD_TOOLKITS ${BUILD_ADDITIONAL_TOOLKITS}) | |
19286d7c | 418 | |
316d77d9 | 419 | foreach (OCCT_MODULE ${OCCT_MODULES}) |
420 | if (BUILD_MODULE_${OCCT_MODULE}) | |
421 | list (APPEND BUILD_TOOLKITS ${${OCCT_MODULE}_TOOLKITS}) | |
19286d7c | 422 | endif() |
423 | endforeach() | |
424 | ||
425 | # DRAWEXE excluded when library build is static | |
426 | if (NOT BUILD_SHARED_LIBS) | |
316d77d9 | 427 | list (REMOVE_ITEM BUILD_TOOLKITS DRAWEXE) |
19286d7c | 428 | message (STATUS "Info: DRAWEXE is not included due to ${BUILD_LIBRARY_TYPE} build library type") |
429 | endif() | |
430 | ||
431 | # accumulate all used toolkits | |
316d77d9 | 432 | list (REMOVE_DUPLICATES BUILD_TOOLKITS) |
433 | set (RAW_BUILD_TOOLKITS) | |
096ef695 | 434 | foreach (BUILD_TOOLKIT ${BUILD_TOOLKITS}) |
316d77d9 | 435 | OCCT_TOOLKIT_FULL_DEP (${BUILD_TOOLKIT} TOOLKIT_FULL_DEPS) |
436 | list (APPEND RAW_BUILD_TOOLKITS ${BUILD_TOOLKIT} ${TOOLKIT_FULL_DEPS}) | |
19286d7c | 437 | endforeach() |
438 | ||
316d77d9 | 439 | list (REMOVE_DUPLICATES RAW_BUILD_TOOLKITS) |
440 | set (BUILD_TOOLKITS ${RAW_BUILD_TOOLKITS}) | |
03c69aec | 441 | |
9f33b387 | 442 | # include the patched or original list of definitions and flags |
19286d7c | 443 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_defs_flags") |
03c69aec | 444 | |
19286d7c | 445 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/3rdparty_macro") |
03c69aec | 446 | |
a6874708 | 447 | # search for TKIVtk and TKIVtkDraw in BUILD_TOOLKITS |
448 | list (FIND BUILD_TOOLKITS TKIVtk CAN_USE_VTK) | |
449 | if (CAN_USE_VTK EQUAL -1) | |
450 | list (FIND BUILD_TOOLKITS TKIVtkDraw CAN_USE_VTK) | |
451 | endif() | |
452 | ||
453 | if (NOT CAN_USE_VTK EQUAL -1) | |
454 | if (NOT DEFINED USE_VTK) | |
455 | set (USE_VTK OFF CACHE BOOL "${USE_VTK_DESCR}") | |
456 | endif() | |
457 | else() | |
458 | OCCT_CHECK_AND_UNSET (USE_VTK) | |
459 | endif() | |
460 | ||
5682a6fa | 461 | # Rebuild *.yacc and *.lex files that are contained by TKMath toolkit |
462 | list (FIND BUILD_TOOLKITS TKMath CAN_REBUILD_PDC_FOR_TKMATH) | |
463 | list (FIND BUILD_TOOLKITS StepFile CAN_REBUILD_PDC_FOR_STEPFILE) | |
464 | ||
fb3267c7 | 465 | if (NOT ${CAN_REBUILD_PDC_FOR_TKMATH} EQUAL -1 OR NOT ${CAN_REBUILD_PDC_FOR_STEPFILE} EQUAL -1) |
109aa56e | 466 | set (BUILD_YACCLEX OFF CACHE BOOL "${BUILD_YACCLEX_DESCR}") |
5682a6fa | 467 | else() |
109aa56e | 468 | OCCT_CHECK_AND_UNSET (BUILD_YACCLEX) |
5682a6fa | 469 | endif() |
470 | ||
9f33b387 | 471 | if (NOT DEFINED 3RDPARTY_DIR) |
316d77d9 | 472 | set (3RDPARTY_DIR "" CACHE PATH ${3RDPARTY_DIR_DESCR}) |
e713baee | 473 | get_filename_component (3RDPARTY_DIR "${3RDPARTY_DIR}" ABSOLUTE) |
84258256 | 474 | else() |
1d505bb0 | 475 | file (TO_CMAKE_PATH "${3RDPARTY_DIR}" 3RDPARTY_DIR) |
84258256 | 476 | set (3RDPARTY_DIR "${3RDPARTY_DIR}" CACHE PATH "${3RDPARTY_DIR_DESCR}" FORCE) |
9f33b387 | 477 | endif() |
234e52be | 478 | |
4fecc365 | 479 | # search for CSF variable in EXTERNLIB of each being used toolkit |
480 | OCCT_IS_PRODUCT_REQUIRED (CSF_FreeImagePlus CAN_USE_FREEIMAGE) | |
f2e9c853 | 481 | OCCT_IS_PRODUCT_REQUIRED (CSF_TclLibs USE_TCL) |
4fecc365 | 482 | OCCT_IS_PRODUCT_REQUIRED (CSF_FREETYPE USE_FREETYPE) |
483 | OCCT_IS_PRODUCT_REQUIRED (CSF_OpenGlLibs CAN_USE_GLES2) | |
4fecc365 | 484 | OCCT_IS_PRODUCT_REQUIRED (CSF_TBB CAN_USE_TBB) |
485 | OCCT_IS_PRODUCT_REQUIRED (CSF_EIGEN CAN_USE_EIGEN) | |
486 | ||
487 | # define CSF variable | |
488 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_csf") | |
03c69aec | 489 | |
fb3267c7 | 490 | if (USE_TCL) |
5682a6fa | 491 | message (STATUS "Info: TCL is used by OCCT") |
19286d7c | 492 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tcl") |
82f443b6 | 493 | |
494 | message (STATUS "Info: TK is used by OCCT") | |
495 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tk") | |
9f33b387 | 496 | else() |
9ccea0c6 | 497 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TCL") |
498 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TK") | |
5682a6fa | 499 | |
500 | OCCT_CHECK_AND_UNSET ("INSTALL_TCL") | |
82f443b6 | 501 | OCCT_CHECK_AND_UNSET ("INSTALL_TK") |
9f33b387 | 502 | endif() |
03c69aec | 503 | |
fb3267c7 | 504 | if (USE_FREETYPE) |
5682a6fa | 505 | message (STATUS "Info: Freetype is used by OCCT") |
19286d7c | 506 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freetype") |
9f33b387 | 507 | else() |
9ccea0c6 | 508 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREETYPE") |
9f33b387 | 509 | OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2") |
510 | OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build") | |
5682a6fa | 511 | OCCT_CHECK_AND_UNSET ("INSTALL_FREETYPE") |
9f33b387 | 512 | endif() |
03c69aec | 513 | |
09c597c9 | 514 | # VTK |
515 | if (USE_VTK) | |
516 | add_definitions (-DHAVE_VTK) | |
c22e576d | 517 | set (OCCT_VTK_USED_TARGETS "" CACHE INTERNAL "" FORCE) |
19286d7c | 518 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/vtk") |
f2e9c853 | 519 | else() |
520 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_VTK") | |
a6874708 | 521 | |
522 | if (NOT CAN_USE_VTK EQUAL -1) | |
523 | message (STATUS "Info: TKIVtk and TKIVtkDraw toolkits excluded due to VTK usage is disabled") | |
524 | ||
525 | list (REMOVE_ITEM BUILD_TOOLKITS TKIVtk) | |
526 | list (REMOVE_ITEM BUILD_TOOLKITS TKIVtkDraw) | |
527 | endif() | |
09c597c9 | 528 | endif() |
529 | ||
f60111dc | 530 | # D3D |
531 | if (USE_D3D) | |
532 | add_definitions (-DHAVE_D3D) | |
533 | #if(MSVC_VERSION LESS 1700) | |
534 | #OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/d3d") | |
535 | #endif() | |
536 | endif() | |
537 | ||
09c597c9 | 538 | # GLX |
539 | if (USE_GLX) | |
540 | add_definitions (-DMACOSX_USE_GLX) | |
19286d7c | 541 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/glx") |
09c597c9 | 542 | endif() |
543 | ||
03c69aec | 544 | # FREEIMAGE |
5682a6fa | 545 | |
60273f77 | 546 | if (CAN_USE_FREEIMAGE) |
5682a6fa | 547 | set (USE_FREEIMAGE OFF CACHE BOOL "${USE_FREEIMAGE_DESCR}") |
548 | ||
549 | if (USE_FREEIMAGE) | |
550 | add_definitions (-DHAVE_FREEIMAGE) | |
551 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freeimage") | |
5682a6fa | 552 | else() |
553 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGE") | |
5682a6fa | 554 | OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGE") |
5682a6fa | 555 | endif() |
9f33b387 | 556 | else() |
5682a6fa | 557 | OCCT_CHECK_AND_UNSET ("USE_FREEIMAGE") |
558 | ||
9f33b387 | 559 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGE") |
9f33b387 | 560 | OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGE") |
9f33b387 | 561 | endif() |
03c69aec | 562 | |
08f8a185 | 563 | # FFmpeg |
564 | # search for CSF_FFmpeg variable in EXTERNLIB of each being used toolkit | |
565 | OCCT_IS_PRODUCT_REQUIRED (CSF_FFmpeg CAN_USE_FFMPEG) | |
566 | ||
567 | if (CAN_USE_FFMPEG) | |
568 | set (USE_FFMPEG OFF CACHE BOOL "${USE_FFMPEG_DESCR}") | |
569 | ||
570 | if (USE_FFMPEG) | |
571 | add_definitions (-DHAVE_FFMPEG) | |
572 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/ffmpeg") | |
573 | else() | |
574 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FFMPEG") | |
575 | OCCT_CHECK_AND_UNSET ("INSTALL_FFMPEG") | |
576 | endif() | |
577 | else() | |
578 | OCCT_CHECK_AND_UNSET ("USE_FFMPEG") | |
579 | ||
580 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FFMPEG") | |
581 | OCCT_CHECK_AND_UNSET ("INSTALL_FFMPEG") | |
582 | endif() | |
583 | ||
1ce0716b | 584 | # OpenGL ES 2.0 |
8bf738e6 | 585 | if (CAN_USE_GLES2) |
1ce0716b | 586 | if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore") |
587 | set (USE_GLES2 ON) | |
588 | else() | |
589 | set (USE_GLES2 OFF CACHE BOOL "${USE_GLES2_DESCR}") | |
590 | endif() | |
591 | ||
592 | if (USE_GLES2) | |
593 | add_definitions (-DHAVE_GLES2) | |
594 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/egl") | |
595 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gles2") | |
596 | else() | |
597 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_EGL") | |
598 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GLES2") | |
599 | OCCT_CHECK_AND_UNSET ("INSTALL_EGL") | |
600 | OCCT_CHECK_AND_UNSET ("INSTALL_GLES2") | |
601 | endif() | |
602 | else() | |
603 | OCCT_CHECK_AND_UNSET ("USE_GLES2") | |
604 | ||
605 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_EGL") | |
606 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GLES2") | |
607 | OCCT_CHECK_AND_UNSET ("INSTALL_EGL") | |
608 | OCCT_CHECK_AND_UNSET ("INSTALL_GLES2") | |
609 | endif() | |
610 | ||
9f33b387 | 611 | # TBB |
5682a6fa | 612 | if (NOT DEFINED ANDROID AND CAN_USE_TBB) |
613 | set (USE_TBB OFF CACHE BOOL "${USE_TBB_DESCR}") | |
614 | ||
615 | if (USE_TBB) | |
616 | add_definitions (-DHAVE_TBB) | |
617 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tbb") | |
618 | else() | |
619 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB") | |
620 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBBMALLOC") | |
621 | OCCT_CHECK_AND_UNSET ("INSTALL_TBB") | |
622 | endif() | |
9f33b387 | 623 | else() |
5682a6fa | 624 | OCCT_CHECK_AND_UNSET ("USE_TBB") |
625 | ||
9f33b387 | 626 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB") |
627 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBBMALLOC") | |
628 | OCCT_CHECK_AND_UNSET ("INSTALL_TBB") | |
629 | endif() | |
234e52be | 630 | |
3b1a2e51 | 631 | # EIGEN |
3b1a2e51 | 632 | if (CAN_USE_EIGEN) |
633 | set (USE_EIGEN OFF CACHE BOOL "${USE_EIGEN_DESCR}") | |
634 | ||
635 | if (USE_EIGEN) | |
636 | add_definitions (-DHAVE_EIGEN) | |
637 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/eigen") | |
638 | else() | |
639 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_EIGEN") | |
7d7a3e84 | 640 | OCCT_CHECK_AND_UNSET ("INSTALL_EIGEN") |
3b1a2e51 | 641 | endif() |
642 | else() | |
643 | OCCT_CHECK_AND_UNSET ("USE_EIGEN") | |
644 | ||
645 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_EIGEN") | |
7d7a3e84 | 646 | OCCT_CHECK_AND_UNSET ("INSTALL_EIGEN") |
3b1a2e51 | 647 | endif() |
648 | ||
adc33035 | 649 | # Doxygen |
4b3541c6 | 650 | if (BUILD_DOC_Overview) |
651 | if (NOT DEFINED INSTALL_DOC_Overview) | |
652 | set (INSTALL_DOC_Overview OFF CACHE BOOL "${INSTALL_DOC_Overview_DESCR}") | |
adc33035 | 653 | endif() |
654 | ||
4b3541c6 | 655 | if (INSTALL_DOC_Overview) |
d26375e2 | 656 | install (DIRECTORY "${CMAKE_BINARY_DIR}/doc/overview" DESTINATION "${INSTALL_DIR_DOC}") |
f2e9c853 | 657 | |
096ef695 | 658 | # create overview.html only for windows |
4b3541c6 | 659 | if (WIN32 AND "${INSTALL_DIR_LAYOUT}" STREQUAL "Windows") |
d26375e2 | 660 | OCCT_INSTALL_FILE_OR_DIR ("dox/resources/overview.html" "${INSTALL_DIR_DOC}/..") |
096ef695 | 661 | endif() |
adc33035 | 662 | endif() |
663 | ||
664 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/doxygen") | |
665 | else() | |
4b3541c6 | 666 | OCCT_CHECK_AND_UNSET ("INSTALL_DOC_Overview") |
adc33035 | 667 | |
668 | OCCT_CHECK_AND_UNSET ("3RDPARTY_DOXYGEN_EXECUTABLE") | |
109aa56e | 669 | OCCT_CHECK_AND_UNSET ("3RDPARTY_DOT_EXECUTABLE") |
adc33035 | 670 | endif() |
671 | ||
316d77d9 | 672 | # bison |
109aa56e | 673 | if (BUILD_YACCLEX) |
316d77d9 | 674 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/bison") |
675 | else() | |
676 | OCCT_CHECK_AND_UNSET ("3RDPARTY_BISON_EXECUTABLE") | |
677 | endif() | |
678 | ||
679 | # flex | |
109aa56e | 680 | if (BUILD_YACCLEX) |
316d77d9 | 681 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/flex") |
682 | else() | |
683 | OCCT_CHECK_AND_UNSET ("3RDPARTY_FLEX_EXECUTABLE") | |
684 | endif() | |
685 | ||
0553a8ea | 686 | # check all 3rdparty include paths |
9f33b387 | 687 | string (REGEX REPLACE ";" " " 3RDPARTY_NOT_INCLUDED "${3RDPARTY_NOT_INCLUDED}") |
9f33b387 | 688 | if (3RDPARTY_NOT_INCLUDED) |
0553a8ea | 689 | message (FATAL_ERROR "Could not find headers of used third-party products: ${3RDPARTY_NOT_INCLUDED}" ) |
9f33b387 | 690 | endif() |
7c633a3e | 691 | |
9bb81d6c | 692 | if (3RDPARTY_INCLUDE_DIRS) |
693 | list (REMOVE_DUPLICATES 3RDPARTY_INCLUDE_DIRS) | |
694 | string (REGEX REPLACE ";" "\n\t" 3RDPARTY_INCLUDE_DIRS_WITH_ENDS "${3RDPARTY_INCLUDE_DIRS}") | |
ada9ef40 | 695 | message (STATUS "Info: The directories of 3rdparty headers: \n\t${3RDPARTY_INCLUDE_DIRS_WITH_ENDS}") |
9bb81d6c | 696 | include_directories (${3RDPARTY_INCLUDE_DIRS}) |
697 | endif() | |
698 | ||
94829f84 | 699 | # include <cmake binary folder>/inc |
14bbbdcb | 700 | include_directories (${CMAKE_BINARY_DIR}/${INSTALL_DIR_INCLUDE}) |
94829f84 | 701 | |
0553a8ea | 702 | # check all 3rdparty library paths |
703 | string (REGEX REPLACE ";" " " 3RDPARTY_NO_LIBS "${3RDPARTY_NO_LIBS}") | |
704 | if (3RDPARTY_NO_LIBS) | |
705 | if (BUILD_SHARED_LIBS) | |
706 | message (SEND_ERROR "Could not find libraries of used third-party products: ${3RDPARTY_NO_LIBS}" ) | |
707 | else() | |
708 | message (WARNING "Could not find libraries of used third-party products: ${3RDPARTY_NO_LIBS}" ) | |
709 | endif() | |
710 | endif() | |
711 | if (3RDPARTY_LIBRARY_DIRS) | |
9bb81d6c | 712 | list (REMOVE_DUPLICATES 3RDPARTY_LIBRARY_DIRS) |
713 | string (REGEX REPLACE ";" "\n\t" 3RDPARTY_LIBRARY_DIRS_WITH_ENDS "${3RDPARTY_LIBRARY_DIRS}") | |
ada9ef40 | 714 | message (STATUS "Info: The directories of 3rdparty libraries: \n\t${3RDPARTY_LIBRARY_DIRS_WITH_ENDS}") |
9bb81d6c | 715 | link_directories (${3RDPARTY_LIBRARY_DIRS}) |
716 | endif() | |
234e52be | 717 | |
0553a8ea | 718 | # report not found 3rdparty dll paths |
719 | string (REGEX REPLACE ";" " " 3RDPARTY_NO_DLLS "${3RDPARTY_NO_DLLS}") | |
720 | if (3RDPARTY_NO_DLLS) | |
721 | message (WARNING "Could not find DLLs of used third-party products: ${3RDPARTY_NO_DLLS}" ) | |
722 | endif() | |
723 | ||
9f33b387 | 724 | # build directories |
4b3541c6 | 725 | if (SINGLE_GENERATOR) |
726 | set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BIN_LETTER}") | |
727 | set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BIN_LETTER}") | |
728 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BIN_LETTER}") | |
729 | if (WIN32) | |
730 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BIN_LETTER}") | |
731 | endif() | |
732 | endif() | |
733 | ||
fa0cbe55 | 734 | set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib") |
735 | set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin") | |
736 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib") | |
19286d7c | 737 | |
316d77d9 | 738 | set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libi") |
739 | set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bini") | |
740 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libi") | |
19286d7c | 741 | |
fa0cbe55 | 742 | set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libd") |
743 | set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bind") | |
744 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libd") | |
19286d7c | 745 | |
fa0cbe55 | 746 | if (WIN32) |
f2e9c853 | 747 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin") |
748 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bini") | |
749 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bind") | |
19286d7c | 750 | endif() |
03c69aec | 751 | |
d94d80e5 | 752 | string(TIMESTAMP CURRENT_TIME "%H:%M:%S") |
753 | message (STATUS "\nInfo: \(${CURRENT_TIME}\) Start collecting all OCCT header files into ${CMAKE_BINARY_DIR}/inc ...") | |
94829f84 | 754 | |
94829f84 | 755 | # collect all the headers to <binary dir>/inc folder |
14bbbdcb | 756 | COLLECT_AND_INSTALL_OCCT_HEADER_FILES ("${CMAKE_BINARY_DIR}" "${BUILD_TOOLKITS}" "${CMAKE_SOURCE_DIR}/src" "${INSTALL_DIR_INCLUDE}") |
94829f84 | 757 | |
d94d80e5 | 758 | string(TIMESTAMP CURRENT_TIME "%H:%M:%S") |
759 | message (STATUS "Info: \(${CURRENT_TIME}\) End the collecting") | |
760 | ||
d26375e2 | 761 | list (FIND BUILD_TOOLKITS DRAWEXE DRAWEXE_INDEX) |
762 | if (${DRAWEXE_INDEX} GREATER -1) | |
763 | OCCT_INSTALL_FILE_OR_DIR ("data/" "${INSTALL_DIR_DATA}") | |
764 | OCCT_INSTALL_FILE_OR_DIR ("samples/tcl" "${INSTALL_DIR_SAMPLES}") | |
765 | endif() | |
766 | ||
4b3541c6 | 767 | if (WIN32) |
768 | set (SCRIPT_EXT bat) | |
769 | else() | |
770 | set (SCRIPT_EXT sh) | |
771 | endif() | |
03c69aec | 772 | |
510d9690 | 773 | if (BUILD_Inspector OR BUILD_SAMPLES_QT) |
1fa16152 | 774 | # check qt 3rdparty path |
775 | add_definitions (-DHAVE_QT) | |
776 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/qt") | |
777 | message (STATUS "Info: Qt is used by OCCT") | |
778 | else() | |
779 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_QT") | |
780 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TQTMALLOC") | |
781 | OCCT_CHECK_AND_UNSET ("INSTALL_QT") | |
782 | endif() | |
783 | ||
14bbbdcb | 784 | # OCCT tools |
785 | # include the patched or original list of tools | |
786 | # list <TOOLNAME>_TOOLKITS is created foreach tool and contains its toolkits | |
787 | # list <OCCT_TOOLS> will contain all tools | |
1fa16152 | 788 | if (BUILD_Inspector) |
ae5225df | 789 | add_definitions (-DHAVE_Inspector) |
790 | ||
1fa16152 | 791 | OCCT_MODULES_AND_TOOLKITS (TOOLS "TOOL_TOOLKITS" OCCT_TOOLS) |
14bbbdcb | 792 | foreach (OCCT_TOOL ${OCCT_TOOLS}) |
793 | list (APPEND BUILD_TOOL_TOOLKITS ${${OCCT_TOOL}_TOOL_TOOLKITS}) | |
794 | endforeach() | |
795 | ||
1fa16152 | 796 | # collect all the headers to <binary dir>/inc/inspector folder |
14bbbdcb | 797 | string(TIMESTAMP CURRENT_TIME "%H:%M:%S") |
1fa16152 | 798 | message (STATUS "\nInfo: \(${CURRENT_TIME}\) Start collecting all OCCT tool header files into ${CMAKE_BINARY_DIR}/inc/inspector ...") |
0cb512c0 | 799 | COLLECT_AND_INSTALL_OCCT_HEADER_FILES ("${CMAKE_BINARY_DIR}" "${BUILD_TOOL_TOOLKITS}" "${CMAKE_SOURCE_DIR}/tools" "${INSTALL_DIR_INCLUDE}/inspector") |
14bbbdcb | 800 | endif() |
801 | ||
096ef695 | 802 | # OCCT samples |
d26375e2 | 803 | # get absolute path from INSTALL_DIR |
804 | set (INSTALL_DIR_ABSOLUTE "${INSTALL_DIR}") | |
805 | if(NOT IS_ABSOLUTE "${INSTALL_DIR_ABSOLUTE}") | |
806 | get_filename_component(INSTALL_DIR_ABSOLUTE "${CMAKE_BINARY_DIR}/${INSTALL_DIR}" ABSOLUTE) | |
807 | endif() | |
808 | ||
0e617b05 | 809 | if (INSTALL_SAMPLES) |
4b3541c6 | 810 | OCCT_CONFIGURE ("adm/templates/env.samples.${SCRIPT_EXT}.in" "env.samples.${SCRIPT_EXT}") |
096ef695 | 811 | if (WIN32) |
d26375e2 | 812 | OCCT_INSTALL_FILE_OR_DIR ("samples/CSharp" "${INSTALL_DIR_SAMPLES}") |
813 | OCCT_INSTALL_FILE_OR_DIR ("samples/mfc" "${INSTALL_DIR_SAMPLES}") | |
4b3541c6 | 814 | |
742cc8b0 | 815 | if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore") |
d26375e2 | 816 | OCCT_INSTALL_FILE_OR_DIR ("samples/xaml" "${INSTALL_DIR_SAMPLES}") |
742cc8b0 | 817 | endif() |
818 | ||
d26375e2 | 819 | install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SAMPLES}/CSharp" RENAME "env.${SCRIPT_EXT}") |
820 | install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SAMPLES}/mfc/standard" RENAME "env.${SCRIPT_EXT}") | |
096ef695 | 821 | endif() |
03c69aec | 822 | |
d26375e2 | 823 | OCCT_INSTALL_FILE_OR_DIR ("samples/java" "${INSTALL_DIR_SAMPLES}") |
824 | OCCT_INSTALL_FILE_OR_DIR ("samples/ocafsamples" "${INSTALL_DIR_SAMPLES}") | |
825 | OCCT_INSTALL_FILE_OR_DIR ("samples/qt" "${INSTALL_DIR_SAMPLES}") | |
096ef695 | 826 | |
d26375e2 | 827 | install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SAMPLES}/qt/FuncDemo" RENAME "env.${SCRIPT_EXT}") |
828 | install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SAMPLES}/qt/IESample" RENAME "env.${SCRIPT_EXT}") | |
829 | install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SAMPLES}/qt/Tutorial" RENAME "env.${SCRIPT_EXT}") | |
910970ab | 830 | endif() |
03c69aec | 831 | |
4b3541c6 | 832 | if (INSTALL_TEST_CASES) |
d26375e2 | 833 | OCCT_INSTALL_FILE_OR_DIR ("tests/" "${INSTALL_DIR_TESTS}") |
910970ab | 834 | endif() |
03c69aec | 835 | |
3eabbe1b | 836 | list (FIND BUILD_TOOLKITS DRAWEXE DRAWEXE_INDEX) |
837 | if (${DRAWEXE_INDEX} GREATER -1) | |
838 | # copy data and samples/tcl folders to install script folder | |
d26375e2 | 839 | OCCT_INSTALL_FILE_OR_DIR ("data/" "${INSTALL_DIR_DATA}") |
840 | OCCT_INSTALL_FILE_OR_DIR ("samples/tcl" "${INSTALL_DIR_SAMPLES}") | |
096ef695 | 841 | |
3eabbe1b | 842 | # copy draw script to install script folder |
843 | if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/adm/templates/draw.${SCRIPT_EXT}") | |
d26375e2 | 844 | install (FILES "${BUILD_PATCH}/adm/templates/draw.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SCRIPT}" |
3eabbe1b | 845 | PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE) |
846 | else() | |
d26375e2 | 847 | install (FILES "${CMAKE_SOURCE_DIR}/adm/templates/draw.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SCRIPT}" |
3eabbe1b | 848 | PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE) |
849 | endif() | |
850 | ||
851 | # copy draw script to CMake binary folder | |
852 | OCCT_COPY_FILE_OR_DIR ("adm/templates/draw.${SCRIPT_EXT}" "${CMAKE_BINARY_DIR}") | |
853 | endif() | |
9f33b387 | 854 | |
316d77d9 | 855 | set (SUB_CUSTOM_NAME "custom_${COMPILER}_${COMPILER_BITNESS}.${SCRIPT_EXT}") |
9f33b387 | 856 | |
910970ab | 857 | if (WIN32) |
4b3541c6 | 858 | set (ADDITIONAL_CUSTOM_CONTENT "\nif exist \"%~dp0${SUB_CUSTOM_NAME}\" (\n call \"%~dp0${SUB_CUSTOM_NAME}\" %1 %2 %3 \n)") |
910970ab | 859 | else() |
096ef695 | 860 | set (ADDITIONAL_CUSTOM_CONTENT "\nif [ -e \"\${aScriptPath}/${SUB_CUSTOM_NAME}\" ]; then\n source \"\${aScriptPath}/${SUB_CUSTOM_NAME}\" \"\$1\" \"\$2\" \nfi") |
910970ab | 861 | endif() |
32856b63 | 862 | |
910970ab | 863 | # change custom.bat/sh |
4b3541c6 | 864 | if (EXISTS "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}/custom.${SCRIPT_EXT}") |
865 | file (READ "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}/custom.${SCRIPT_EXT}" CUSTOM_CONTENT) | |
32856b63 | 866 | |
910970ab | 867 | set (CUSTOM_CONTENT "${CUSTOM_CONTENT} ${ADDITIONAL_CUSTOM_CONTENT}") |
32856b63 | 868 | |
4b3541c6 | 869 | file (WRITE "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}/custom.${SCRIPT_EXT}" "${CUSTOM_CONTENT}") |
910970ab | 870 | else() |
d26375e2 | 871 | OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.${SCRIPT_EXT}.main" "custom.${SCRIPT_EXT}" "custom.${SCRIPT_EXT}" "${INSTALL_DIR_SCRIPT}") |
910970ab | 872 | endif() |
32856b63 | 873 | |
249dd6ed | 874 | if (WIN32) |
875 | set (THIRDPARTY_DIR_REPLACE "%THIRDPARTY_DIR%") | |
876 | else() | |
877 | set (THIRDPARTY_DIR_REPLACE "\${THIRDPARTY_DIR}") | |
878 | endif() | |
879 | get_cmake_property(USED_3RDPARTY_CACHE_VARIABLES VARIABLES) | |
880 | string (REGEX MATCHALL "(^|;)USED_3RDPARTY_[^;]+_DIR[^;]*" USED_3RDPARTY_CACHE_VARIABLES "${USED_3RDPARTY_CACHE_VARIABLES}") | |
881 | file (TO_CMAKE_PATH "${3RDPARTY_DIR}" 3RDPARTY_DIR) | |
882 | foreach (USED_3RDPARTY_CACHE_VARIABLE ${USED_3RDPARTY_CACHE_VARIABLES}) | |
883 | file (TO_CMAKE_PATH "${${USED_3RDPARTY_CACHE_VARIABLE}}" ${USED_3RDPARTY_CACHE_VARIABLE}) | |
884 | string (REPLACE "${3RDPARTY_DIR}" "${THIRDPARTY_DIR_REPLACE}" ${USED_3RDPARTY_CACHE_VARIABLE} "${${USED_3RDPARTY_CACHE_VARIABLE}}") | |
885 | if (NOT WIN32) | |
886 | string (REGEX REPLACE ";" ":" ${USED_3RDPARTY_CACHE_VARIABLE} "${${USED_3RDPARTY_CACHE_VARIABLE}}") | |
887 | endif() | |
888 | endforeach() | |
889 | ||
316d77d9 | 890 | # write current custom.bat/sh (for install directory) |
891 | set (SUB_CUSTOM_BUILD_NAME "custom_${COMPILER}_${COMPILER_BITNESS}.install.${SCRIPT_EXT}") | |
d26375e2 | 892 | OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.install.${SCRIPT_EXT}.in" "${SUB_CUSTOM_BUILD_NAME}" "${SUB_CUSTOM_NAME}" "${INSTALL_DIR_SCRIPT}") |
03c69aec | 893 | |
316d77d9 | 894 | # write current custom.bat/sh (for build directory) |
895 | OCCT_CONFIGURE ("adm/templates/custom.build.${SCRIPT_EXT}.in" "${SUB_CUSTOM_NAME}") | |
896 | ||
510d9690 | 897 | if (BUILD_SAMPLES_MFC OR BUILD_SAMPLES_QT) |
6664a9c2 | 898 | OCCT_INSTALL_FILE_OR_DIR ("adm/templates/sample.${SCRIPT_EXT}" "${INSTALL_DIR_SCRIPT}") |
899 | OCCT_COPY_FILE_OR_DIR ("adm/templates/sample.${SCRIPT_EXT}" "${CMAKE_BINARY_DIR}") | |
9f33b387 | 900 | endif() |
901 | ||
316d77d9 | 902 | # env script for draw in building environment |
4b3541c6 | 903 | OCCT_CONFIGURE ("adm/templates/env.${SCRIPT_EXT}.in" "env.${SCRIPT_EXT}") |
316d77d9 | 904 | |
4b3541c6 | 905 | # install env script |
d26375e2 | 906 | install (FILES "${CMAKE_BINARY_DIR}/env.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SCRIPT}") |
316d77d9 | 907 | |
908 | # copy DrawAppliInit from OCCT source to build directory | |
f2e9c853 | 909 | if (NOT EXISTS "${CMAKE_BINARY_DIR}/DrawAppliInit") |
910 | OCCT_COPY_FILE_OR_DIR (DrawAppliInit "${CMAKE_BINARY_DIR}") | |
316d77d9 | 911 | endif() |
910970ab | 912 | |
9f33b387 | 913 | # RESOURCES |
19286d7c | 914 | FILE_TO_LIST ("adm/RESOURCES" RESOURCES) |
915 | foreach(RESOURCE ${RESOURCES}) | |
916 | get_filename_component(RESOURCE_FOLDER ${RESOURCE} DIRECTORY) | |
917 | if(NOT "${RESOURCE_FOLDER}" STREQUAL "") | |
918 | get_filename_component(RESOURCE_FOLDER ${RESOURCE_FOLDER} NAME) | |
d26375e2 | 919 | OCCT_INSTALL_FILE_OR_DIR ("src/${RESOURCE}" "${INSTALL_DIR_RESOURCE}/${RESOURCE_FOLDER}") |
19286d7c | 920 | else() |
d26375e2 | 921 | OCCT_INSTALL_FILE_OR_DIR ("src/${RESOURCE}" "${INSTALL_DIR_RESOURCE}") |
19286d7c | 922 | endif() |
923 | endforeach() | |
03c69aec | 924 | |
510d9690 | 925 | if (BUILD_SAMPLES_QT) |
1fa16152 | 926 | FILE_TO_LIST ("adm/SAMPLES_RESOURCES" SAMPLES_RESOURCES) |
927 | foreach(RESOURCE ${SAMPLES_RESOURCES}) | |
928 | OCCT_INSTALL_FILE_OR_DIR ("samples/${RESOURCE}" "${INSTALL_DIR_RESOURCE}/samples") | |
929 | #message("Copy Sample resources: samples/${RESOURCE} into ${INSTALL_DIR_RESOURCE}/samples") | |
930 | endforeach() | |
931 | endif() | |
932 | ||
933 | ||
46bd680a | 934 | # patch installed DrawDefault file if BUILD_SHARED_LIBRARY_NAME_POSTFIX is changed |
935 | if (NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "") | |
936 | OCCT_UPDATE_DRAW_DEFAULT_FILE() | |
937 | endif() | |
938 | ||
33839ae6 | 939 | # include patched toolkit projects or original ones |
316d77d9 | 940 | foreach (BUILD_TOOLKIT ${BUILD_TOOLKITS}) |
f2e9c853 | 941 | OCCT_ADD_SUBDIRECTORY ("src/${BUILD_TOOLKIT}") |
19286d7c | 942 | endforeach() |
234e52be | 943 | |
4b3541c6 | 944 | if (BUILD_DOC_Overview) |
f2e9c853 | 945 | OCCT_ADD_SUBDIRECTORY (dox) |
adc33035 | 946 | endif() |
947 | ||
94829f84 | 948 | # patch DRAWEXE |
949 | if (MSVC AND 3RDPARTY_DLL_DIRS) | |
316d77d9 | 950 | list (FIND BUILD_TOOLKITS DRAWEXE DRAWEXE_INDEX) |
94829f84 | 951 | if (${DRAWEXE_INDEX} GREATER -1) |
952 | list (REMOVE_DUPLICATES 3RDPARTY_DLL_DIRS) | |
953 | set (3RDPARTY_DLL_DIRS_FOR_PATH "") | |
954 | ||
955 | foreach (3RDPARTY_DLL_DIR ${3RDPARTY_DLL_DIRS}) | |
956 | set (3RDPARTY_DLL_DIRS_FOR_PATH "${3RDPARTY_DLL_DIRS_FOR_PATH};${3RDPARTY_DLL_DIR}") | |
957 | endforeach() | |
958 | ||
959 | OCCT_MAKE_COMPILER_BITNESS() | |
960 | set (X_COMPILER_BITNESS "x64") | |
961 | if ("${COMPILER_BITNESS}" STREQUAL "32") | |
962 | set (X_COMPILER_BITNESS "Win32") | |
963 | endif() | |
964 | ||
f2e9c853 | 965 | OCCT_CONFIGURE ("adm/templates/DRAWEXE.vcxproj.user.in" "${CMAKE_BINARY_DIR}/src/DRAWEXE/DRAWEXE.vcxproj.user") |
94829f84 | 966 | endif() |
967 | endif() | |
968 | ||
14bbbdcb | 969 | # include patched toolkit projects or original ones |
970 | if (BUILD_TOOL_TOOLKITS) | |
971 | foreach (BUILD_TOOL_TOOLKIT ${BUILD_TOOL_TOOLKITS}) | |
972 | OCCT_ADD_SUBDIRECTORY ("tools/${BUILD_TOOL_TOOLKIT}") | |
973 | endforeach() | |
974 | endif() | |
896faa72 | 975 | |
14bbbdcb | 976 | message (STATUS "Info: \(${CURRENT_TIME}\) OCCT toolkits processed") |
33839ae6 | 977 | # samples do not support patch usage |
510d9690 | 978 | if (BUILD_SAMPLES_MFC OR BUILD_SAMPLES_QT) |
19286d7c | 979 | set (OCCT_ROOT ${CMAKE_SOURCE_DIR}) |
1fa16152 | 980 | endif() |
234e52be | 981 | |
510d9690 | 982 | if (BUILD_SAMPLES_MFC) |
19286d7c | 983 | set (MFC_STANDARD_SAMPLES_DIR ${OCCT_ROOT}/samples/mfc/standard) |
984 | set (COMMON_WINMAIN_FILE ${MFC_STANDARD_SAMPLES_DIR}/Common/Winmain.cpp) | |
234e52be | 985 | |
9f33b387 | 986 | add_subdirectory(samples/mfc/standard/mfcsample) |
987 | add_subdirectory(samples/mfc/standard/01_Geometry) | |
988 | add_subdirectory(samples/mfc/standard/02_Modeling) | |
989 | add_subdirectory(samples/mfc/standard/03_Viewer2d) | |
990 | add_subdirectory(samples/mfc/standard/04_Viewer3d) | |
991 | add_subdirectory(samples/mfc/standard/05_ImportExport) | |
992 | add_subdirectory(samples/mfc/standard/06_Ocaf) | |
993 | add_subdirectory(samples/mfc/standard/07_Triangulation) | |
994 | add_subdirectory(samples/mfc/standard/08_HLR) | |
995 | add_subdirectory(samples/mfc/standard/09_Animation) | |
996 | add_subdirectory(samples/mfc/standard/10_Convert) | |
896faa72 | 997 | |
998 | message (STATUS "Info: \(${CURRENT_TIME}\) MFC Sample projects added") | |
19286d7c | 999 | endif() |
2e48c1cb | 1000 | |
1fa16152 | 1001 | OCCT_MODULES_AND_TOOLKITS (SAMPLES "SAMPLES_TOOLKITS" OCCT_SAMPLES) |
1002 | ||
510d9690 | 1003 | if (BUILD_Inspector OR BUILD_SAMPLES_QT) |
1004 | if (BUILD_SAMPLES_QT) | |
6822a3be | 1005 | if (NOT Qt5_FOUND OR "${Qt5Gui_EGL_INCLUDE_DIRS}" STREQUAL "" OR NOT WIN32) |
6664a9c2 | 1006 | list (REMOVE_ITEM qt_SAMPLES_TOOLKITS AndroidQt) |
6822a3be | 1007 | message (STATUS "Info: AndroidQt sample excluded due to OS is not Windows or Qt is configured without ANGLE") |
6664a9c2 | 1008 | endif() |
1009 | else() | |
1010 | list (REMOVE_ITEM OCCT_SAMPLES qt) | |
510d9690 | 1011 | message (STATUS "Info: qt samples excluded due to BUILD_SAMPLES_QT is disabled") |
1fa16152 | 1012 | endif() |
1013 | ||
1fa16152 | 1014 | foreach (OCCT_SAMPLE ${OCCT_SAMPLES}) |
1015 | list (APPEND BUILD_SAMPLE_TOOLKITS ${${OCCT_SAMPLE}_SAMPLES_TOOLKITS}) | |
1016 | ||
1017 | # collect all the headers to <binary dir>/inc/samples folder | |
1018 | string(TIMESTAMP CURRENT_TIME "%H:%M:%S") | |
1019 | message (STATUS "Info: \(${CURRENT_TIME}\) ${OCCT_SAMPLE} Sample projects added") | |
1020 | ||
1021 | # include patched toolkit projects or original ones | |
1022 | foreach (BUILD_SAMPLE_TOOLKIT ${${OCCT_SAMPLE}_SAMPLES_TOOLKITS}) | |
1023 | OCCT_ADD_SUBDIRECTORY ("samples/${OCCT_SAMPLE}/${BUILD_SAMPLE_TOOLKIT}") | |
1024 | endforeach() | |
1025 | endforeach() | |
1026 | endif() | |
1027 | ||
742cc8b0 | 1028 | if (BUILD_MODULE_UwpSample) |
1029 | add_subdirectory(samples/xaml) | |
1030 | endif() | |
1031 | ||
14bbbdcb | 1032 | if (BUILD_TOOL_TOOLKITS) |
1033 | # copy tinspector script to install script folder | |
4f4b8935 | 1034 | if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/adm/templates/inspector.${SCRIPT_EXT}") |
1035 | install (FILES "${BUILD_PATCH}/adm/templates/inspector.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SCRIPT}" | |
14bbbdcb | 1036 | PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE) |
1037 | else() | |
4f4b8935 | 1038 | install (FILES "${CMAKE_SOURCE_DIR}/adm/templates/inspector.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SCRIPT}" |
14bbbdcb | 1039 | PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE) |
1040 | endif() | |
1041 | ||
ae5225df | 1042 | set (OpenCASCADE_BINARY_DIR "${INSTALL_DIR}/${INSTALL_DIR_BIN}") |
4f4b8935 | 1043 | # patch TInspectorEXE |
ae5225df | 1044 | OCCT_CONFIGURE ("adm/templates/TInspectorEXE.vcxproj.user.in" "${CMAKE_BINARY_DIR}/tools/TInspectorEXE/TInspectorEXE.vcxproj.user") |
14bbbdcb | 1045 | endif() |
1046 | ||
2e48c1cb | 1047 | # Prepare variables for configuration of OpenCASCADE cmake config file |
1048 | set (OCCT_MODULES_ENABLED) | |
1049 | set (OCCT_LIBRARIES) | |
ada9ef40 | 1050 | set (SET_OpenCASCADE_MODULES_TOOLKITS "\n# List of available OpenCASCADE libraries for each module\n") |
a3d2cb24 | 1051 | set (OCCT_COMPILE_DEFINITIONS) |
1052 | ||
2e48c1cb | 1053 | foreach (OCCT_TOOLKIT ${BUILD_TOOLKITS}) |
1054 | if (TARGET ${OCCT_TOOLKIT}) | |
1055 | ||
1056 | # get all libraries | |
1057 | get_target_property (${OCCT_TOOLKIT}_TYPE ${OCCT_TOOLKIT} "TYPE") | |
1058 | if ("${${OCCT_TOOLKIT}_TYPE}" STREQUAL "STATIC_LIBRARY" OR "${${OCCT_TOOLKIT}_TYPE}" STREQUAL "SHARED_LIBRARY" ) | |
1059 | list (APPEND OCCT_LIBRARIES ${OCCT_TOOLKIT}) | |
2e48c1cb | 1060 | |
ada9ef40 | 1061 | # get all modules |
1062 | get_target_property (${OCCT_TOOLKIT}_MODULE ${OCCT_TOOLKIT} "MODULE") | |
1063 | list (APPEND OCCT_MODULES_ENABLED ${${OCCT_TOOLKIT}_MODULE}) | |
1064 | list (APPEND OpenCASCADE_${${OCCT_TOOLKIT}_MODULE}_TOOLKITS ${OCCT_TOOLKIT}) | |
a3d2cb24 | 1065 | |
1066 | # get compile definitions of target directory | |
1067 | get_directory_property (COMPILE_DEFINITIONS DIRECTORY "${${OCCT_TOOLKIT}_SOURCE_DIR}" "COMPILE_DEFINITIONS") | |
1068 | list (APPEND OCCT_COMPILE_DEFINITIONS ${COMPILE_DEFINITIONS}) | |
2e48c1cb | 1069 | endif() |
1070 | endif() | |
1071 | endforeach() | |
1072 | list (REMOVE_DUPLICATES OCCT_MODULES_ENABLED) | |
a3d2cb24 | 1073 | list (REMOVE_DUPLICATES OCCT_COMPILE_DEFINITIONS) |
1074 | ||
1075 | # export compile definitions and C/C++ flags for each configuration to OpenCASCADE config files | |
1076 | foreach (OCCT_CONFIGURATION ${CMAKE_CONFIGURATION_TYPES}) | |
1077 | set (SET_OpenCASCADE_COMPILE_DEFINITIONS) | |
1078 | string (TOUPPER "${OCCT_CONFIGURATION}" OCCT_CONFIGURATION_UPPER) | |
1079 | string (TOLOWER "${OCCT_CONFIGURATION}" OCCT_CONFIGURATION_LOWER) | |
1080 | foreach(COMPILE_DEFINITION ${OCCT_COMPILE_DEFINITIONS}) | |
1081 | string(REPLACE "(" "\\(" COMPILE_DEFINITION "${COMPILE_DEFINITION}") | |
1082 | string(REPLACE ")" "\\)" COMPILE_DEFINITION "${COMPILE_DEFINITION}") | |
1083 | set (SET_OpenCASCADE_COMPILE_DEFINITIONS "${SET_OpenCASCADE_COMPILE_DEFINITIONS}set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:${OCCT_CONFIGURATION}>:${COMPILE_DEFINITION}>)\n") | |
1084 | endforeach() | |
1085 | set (SET_OpenCASCADE_CMAKE_C_FLAGS "${CMAKE_C_FLAGS_${OCCT_CONFIGURATION_UPPER}}") | |
1086 | set (SET_OpenCASCADE_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_${OCCT_CONFIGURATION_UPPER}}") | |
1087 | configure_file("${CMAKE_SOURCE_DIR}/adm/templates/OpenCASCADECompileDefinitionsAndFlags.cmake.in" "OpenCASCADECompileDefinitionsAndFlags-${OCCT_CONFIGURATION_LOWER}.cmake" @ONLY) | |
1088 | endforeach() | |
1089 | # install OpenCASCADE config file with compile definitions and C/C++ flags ONLY for current configuration | |
1090 | install (CODE "string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWER)") | |
1091 | install (CODE "configure_file(\"${CMAKE_BINARY_DIR}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" COPYONLY)") | |
2e48c1cb | 1092 | |
ada9ef40 | 1093 | foreach (OCCT_MODULE ${OCCT_MODULES}) |
1094 | if (BUILD_MODULE_${OCCT_MODULE}) | |
1095 | set (SET_OpenCASCADE_MODULES_TOOLKITS "${SET_OpenCASCADE_MODULES_TOOLKITS}set (OpenCASCADE_${OCCT_MODULE}_LIBRARIES ${OpenCASCADE_${OCCT_MODULE}_TOOLKITS})\n") | |
1096 | endif() | |
f7ac9097 | 1097 | |
1098 | # sort enabled modules for correct work of OpenCASCADE config file | |
1099 | list(FIND OCCT_MODULES_ENABLED "${OCCT_MODULE}" OCCT_MODULE_INDEX) | |
1100 | if (NOT ${OCCT_MODULE_INDEX} EQUAL -1) | |
1101 | list (APPEND OCCT_MODULES_ENABLED_SORTED ${OCCT_MODULE}) | |
1102 | endif() | |
ada9ef40 | 1103 | endforeach() |
f7ac9097 | 1104 | set (OCCT_MODULES_ENABLED ${OCCT_MODULES_ENABLED_SORTED}) |
ada9ef40 | 1105 | |
1106 | # Add all targets to the build-tree export set | |
1107 | export (TARGETS ${OCCT_LIBRARIES} FILE "${CMAKE_BINARY_DIR}/OpenCASCADETargets.cmake") | |
1108 | ||
1109 | # Export the package for use from the build-tree | |
1110 | # (this registers the build-tree with a global CMake-registry) | |
1111 | export(PACKAGE OpenCASCADE) | |
1112 | ||
2e48c1cb | 1113 | if (CMAKE_BUILD_TYPE) |
1114 | set (SET_OpenCASCADE_BUILD_TYPE "set (OpenCASCADE_BUILD_TYPE \"${CMAKE_BUILD_TYPE}\")") | |
1115 | endif() | |
1116 | ||
1117 | if (BUILD_SHARED_LIBS) | |
1118 | set (SET_OpenCASCADE_LINKER_FLAGS "set (OpenCASCADE_LINKER_FLAGS \"${CMAKE_SHARED_LINKER_FLAGS}\")") | |
1119 | else() | |
1120 | set (SET_OpenCASCADE_LINKER_FLAGS "set (OpenCASCADE_LINKER_FLAGS \"${CMAKE_STATIC_LINKER_FLAGS}\")") | |
1121 | endif() | |
1122 | ||
1123 | if (WIN32) | |
1124 | set (SET_OpenCASCADE_WITH_D3D "set (OpenCASCADE_WITH_D3D ${USE_D3D})") | |
1125 | endif() | |
1126 | if (APPLE) | |
1127 | set (SET_OpenCASCADE_WITH_GLX "set (OpenCASCADE_WITH_GLX ${USE_GLX})") | |
1128 | endif() | |
1129 | ||
1130 | # Configure and install cmake config file | |
ada9ef40 | 1131 | configure_file("${CMAKE_SOURCE_DIR}/adm/templates/OpenCASCADEConfig.cmake.in" "OpenCASCADEConfig.cmake" @ONLY) |
d26375e2 | 1132 | install(FILES "${CMAKE_BINARY_DIR}/OpenCASCADEConfig.cmake" DESTINATION "${INSTALL_DIR_CMAKE}") |
2e48c1cb | 1133 | |
1134 | # Configure cmake version file | |
1135 | include(CMakePackageConfigHelpers) | |
1136 | write_basic_package_version_file( ${CMAKE_BINARY_DIR}/OpenCASCADEConfigVersion.cmake | |
1137 | VERSION ${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE} | |
1138 | COMPATIBILITY ExactVersion ) | |
1139 | ||
1140 | # Install cmake version file | |
d26375e2 | 1141 | install (FILES "${CMAKE_BINARY_DIR}/OpenCASCADEConfigVersion.cmake" DESTINATION "${INSTALL_DIR_CMAKE}") |
ada9ef40 | 1142 | |
1143 | # Install the export set for use with the install-tree for each configuration | |
f7ac9097 | 1144 | foreach (OCCT_MODULE ${OCCT_MODULES_ENABLED}) |
1145 | install(EXPORT OpenCASCADE${OCCT_MODULE}Targets DESTINATION "${INSTALL_DIR_CMAKE}") | |
ada9ef40 | 1146 | endforeach() |
1147 | ||
1148 | # Update generated OpenCASCADETargets-*.cmake files | |
1149 | # to have correct paths to libraries depending on the configuration | |
1150 | OCCT_UPDATE_TARGET_FILE () | |
896faa72 | 1151 | |
1152 | message (STATUS "Info: \(${CURRENT_TIME}\) OCCT configuration files prepared") |