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