19286d7c |
1 | cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR) |
166d6cd7 |
2 | |
576f8b11 |
3 | set (CMAKE_SUPPRESS_REGENERATION TRUE) |
4 | |
fa0cbe55 |
5 | set (CMAKE_CONFIGURATION_TYPES Release Debug RelWithDebInfo CACHE INTERNAL "" FORCE) |
03c69aec |
6 | |
316d77d9 |
7 | # macro: include patched file if it exists |
8 | macro (OCCT_INCLUDE_CMAKE_FILE BEING_INCLUDED_FILE) |
109aa56e |
9 | if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/${BEING_INCLUDED_FILE}.cmake") |
10 | include (${BUILD_PATCH}/${BEING_INCLUDED_FILE}.cmake) |
316d77d9 |
11 | else() |
f2e9c853 |
12 | include (${CMAKE_SOURCE_DIR}/${BEING_INCLUDED_FILE}.cmake) |
316d77d9 |
13 | endif() |
14 | endmacro() |
15 | |
16 | # include variable description |
17 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/vardescr") |
18 | |
c259930b |
19 | # set type of OCCT libraries |
20 | if (NOT BUILD_LIBRARY_TYPE) |
316d77d9 |
21 | set (BUILD_LIBRARY_TYPE "Shared" CACHE STRING "${BUILD_LIBRARY_TYPE_DESCR}" FORCE) |
c259930b |
22 | SET_PROPERTY(CACHE BUILD_LIBRARY_TYPE PROPERTY STRINGS Shared Static) |
23 | endif() |
24 | |
25 | if ("${BUILD_LIBRARY_TYPE}" STREQUAL "Shared") |
26 | set (BUILD_SHARED_LIBS ON) |
27 | else() |
28 | unset (BUILD_SHARED_LIBS) |
29 | endif() |
30 | |
9f33b387 |
31 | # the name of the project |
32 | project (OCCT) |
03c69aec |
33 | |
096ef695 |
34 | # include occt macros |
35 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros") |
36 | |
9f33b387 |
37 | # Solution folder property |
38 | set_property (GLOBAL PROPERTY USE_FOLDERS ON) |
03c69aec |
39 | |
096ef695 |
40 | # get current OCCT version |
41 | OCC_VERSION (OCC_VERSION_MAJOR OCC_VERSION_MINOR OCC_VERSION_MAINTENANCE OCC_VERSION_DEVELOPMENT OCC_VERSION_STRING_EXT) |
42 | |
43 | set_property (GLOBAL PROPERTY OCC_VERSION_MAJOR ${OCC_VERSION_MAJOR}) |
44 | set_property (GLOBAL PROPERTY OCC_VERSION_MINOR ${OCC_VERSION_MINOR}) |
45 | set_property (GLOBAL PROPERTY OCC_VERSION_MAINTENANCE ${OCC_VERSION_MAINTENANCE}) |
46 | |
0e617b05 |
47 | set (INSTALL_TEST_CASES OFF CACHE BOOL "${INSTALL_TEST_CASES_DESCR}") |
096ef695 |
48 | |
49 | # single-configuration generator |
50 | set (SINGLE_GENERATOR OFF) |
51 | if (CMAKE_BUILD_TYPE) |
52 | set (SINGLE_GENERATOR ON) |
53 | endif() |
54 | |
316d77d9 |
55 | # a single-configuration generator like the Makefile generator defines CMAKE_BUILD_TYPE variable |
56 | # check this variable and set if it's required |
57 | if (DEFINED CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE) # single-configuration generator. |
58 | 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 |
59 | endif() |
60 | |
898f6a92 |
61 | # enable extended messages of many OCCT algorithms |
109aa56e |
62 | set (BUILD_WITH_DEBUG OFF CACHE BOOL "${BUILD_WITH_DEBUG_DESCR}") |
63 | if (BUILD_WITH_DEBUG) |
898f6a92 |
64 | add_definitions (-DOCCT_DEBUG) |
65 | endif() |
316d77d9 |
66 | |
19286d7c |
67 | # copy samples to install directory |
0e617b05 |
68 | set (INSTALL_SAMPLES OFF CACHE BOOL "${INSTALL_SAMPLES_DESCR}") |
19286d7c |
69 | |
096ef695 |
70 | # install dir of the project |
71 | if (NOT DEFINED INSTALL_DIR) |
4b3541c6 |
72 | # set default install directory for Windows |
84258256 |
73 | if (WIN32 AND NOT DEFINED CMAKE_INSTALL_PREFIX) |
4b3541c6 |
74 | set (CMAKE_INSTALL_PREFIX "C:/opencascade-${OCC_VERSION_STRING_EXT}") |
75 | endif() |
096ef695 |
76 | set (INSTALL_DIR "${CMAKE_INSTALL_PREFIX}" CACHE PATH "${INSTALL_DIR_DESCR}") |
84258256 |
77 | else() |
1d505bb0 |
78 | file (TO_CMAKE_PATH "${INSTALL_DIR}" INSTALL_DIR) |
84258256 |
79 | set (INSTALL_DIR "${INSTALL_DIR}" CACHE PATH "${INSTALL_DIR_DESCR}" FORCE) |
096ef695 |
80 | endif() |
81 | |
4b3541c6 |
82 | # choose a variant of the layout of the install paths |
83 | if (NOT INSTALL_DIR_LAYOUT) |
84 | if (WIN32) |
85 | set (INSTALL_DIR_LAYOUT "Windows" CACHE STRING "${INSTALL_DIR_LAYOUT_DESCR}" FORCE) |
86 | else() |
87 | set (INSTALL_DIR_LAYOUT "Unix" CACHE STRING "${INSTALL_DIR_LAYOUT_DESCR}" FORCE) |
88 | endif() |
89 | SET_PROPERTY(CACHE INSTALL_DIR_LAYOUT PROPERTY STRINGS Windows Unix) |
90 | endif() |
91 | |
92 | # check INSTALL_DIR_LAYOUT changes and update INSTALL_DIR_* paths if necessary |
93 | if (NOT DEFINED INSTALL_DIR_LAYOUT_PREV) |
94 | set (INSTALL_DIR_LAYOUT_PREV "${INSTALL_DIR_LAYOUT}" CACHE INTERNAL "" FORCE) |
95 | elseif (NOT "${INSTALL_DIR_LAYOUT_PREV}" STREQUAL "${INSTALL_DIR_LAYOUT}") |
96 | set (INSTALL_DIR_LAYOUT_PREV "${INSTALL_DIR_LAYOUT}" CACHE INTERNAL "" FORCE) |
97 | # The structure of install folder should be reset due to changed layout |
98 | OCCT_CHECK_AND_UNSET_INSTALL_DIR_SUBDIRS () |
99 | |
100 | # Unset INSTALL_DIR_WITH_VERSION on windows |
101 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Windows") |
102 | OCCT_CHECK_AND_UNSET (INSTALL_DIR_WITH_VERSION) |
103 | else() |
104 | if (NOT DEFINED INSTALL_DIR_WITH_VERSION) |
105 | set (INSTALL_DIR_WITH_VERSION OFF CACHE BOOL "${INSTALL_DIR_WITH_VERSION_DESCR}") |
106 | endif() |
107 | endif() |
108 | endif() |
109 | |
110 | # check CMAKE_INSTALL_PREFIX changes and update INSTALL_DIR if necessary |
d573adcf |
111 | if (NOT DEFINED CMAKE_INSTALL_PREFIX_PREV) |
112 | set (CMAKE_INSTALL_PREFIX_PREV "${CMAKE_INSTALL_PREFIX}" CACHE INTERNAL "" FORCE) |
113 | elseif (NOT "${CMAKE_INSTALL_PREFIX_PREV}" STREQUAL "${CMAKE_INSTALL_PREFIX}") |
114 | # CMAKE_INSTALL_PREFIX has been changed at previous step |
115 | set (CMAKE_INSTALL_PREFIX_PREV "${CMAKE_INSTALL_PREFIX}" CACHE INTERNAL "" FORCE) |
116 | |
117 | # INSTALL_DIR is required to be updated |
118 | set (INSTALL_DIR "${CMAKE_INSTALL_PREFIX}" CACHE PATH "${INSTALL_DIR_DESCR}" FORCE) |
119 | endif() |
120 | |
4b3541c6 |
121 | # check INSTALL_DIR changes and update CMAKE_INSTALL_PREFIX if necessary |
d573adcf |
122 | if (NOT DEFINED INSTALL_DIR_PREV) |
123 | set (INSTALL_DIR_PREV "${INSTALL_DIR}" CACHE INTERNAL "" FORCE) |
124 | elseif (NOT "${INSTALL_DIR_PREV}" STREQUAL "${INSTALL_DIR}") |
125 | # INSTALL_DIR has been changed at previous step |
126 | set (INSTALL_DIR_PREV "${INSTALL_DIR}" CACHE INTERNAL "" FORCE) |
127 | |
128 | # sync CMAKE_INSTALL_PREFIX with INSTALL_DIR |
129 | set (CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE) |
130 | |
131 | # set CMAKE_INSTALL_PREFIX_PREV to avoid the reset of structure of the install folder |
132 | set (CMAKE_INSTALL_PREFIX_PREV "${INSTALL_DIR}" CACHE INTERNAL "" FORCE) |
4b3541c6 |
133 | endif() |
d573adcf |
134 | |
4b3541c6 |
135 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") |
136 | if (NOT DEFINED INSTALL_DIR_WITH_VERSION_PREV) |
137 | set (INSTALL_DIR_WITH_VERSION_PREV "${INSTALL_DIR_WITH_VERSION}" CACHE INTERNAL "" FORCE) |
138 | elseif (NOT "${INSTALL_DIR_WITH_VERSION_PREV}" STREQUAL "${INSTALL_DIR_WITH_VERSION}") |
139 | # INSTALL_DIR_WITH_VERSION has been changed at previous step |
140 | set (INSTALL_DIR_WITH_VERSION_PREV "${INSTALL_DIR_WITH_VERSION}" CACHE INTERNAL "" FORCE) |
141 | |
142 | OCCT_CHECK_AND_UNSET_INSTALL_DIR_SUBDIRS () |
143 | endif() |
096ef695 |
144 | endif() |
145 | |
146 | # hide CMAKE_INSTALL_PREFIX from a user |
147 | set (CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE) |
148 | |
149 | set (BIN_LETTER "") |
150 | if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") |
151 | set (BIN_LETTER "d") |
152 | elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo") |
153 | set (BIN_LETTER "i") |
154 | endif() |
03c69aec |
155 | |
096ef695 |
156 | # Get all used variables: OS_WITH_BIT, COMPILER |
157 | OCCT_MAKE_OS_WITH_BITNESS() |
158 | OCCT_MAKE_COMPILER_SHORT_NAME() |
159 | |
4b3541c6 |
160 | # do not define INSTALL_DIR_BIN for win. |
096ef695 |
161 | # Leave library structure for win: <prefix>/win64/vc10/bin(d) |
4b3541c6 |
162 | if (NOT DEFINED INSTALL_DIR_BIN) |
163 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") |
164 | set (INSTALL_DIR_BIN "bin" CACHE PATH "${INSTALL_DIR_BIN_DESCR}") |
096ef695 |
165 | else() |
4b3541c6 |
166 | set (INSTALL_DIR_BIN "${OS_WITH_BIT}/${COMPILER}/bin" CACHE PATH "${INSTALL_DIR_BIN_DESCR}") |
096ef695 |
167 | endif() |
168 | endif() |
169 | |
170 | # define folder contaning all shell/batch scripts |
4b3541c6 |
171 | if (NOT DEFINED INSTALL_DIR_SCRIPT) |
172 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") |
173 | set (INSTALL_DIR_SCRIPT "${INSTALL_DIR_BIN}" CACHE PATH "${INSTALL_DIR_SCRIPT_DESCR}") |
096ef695 |
174 | else() |
4b3541c6 |
175 | set (INSTALL_DIR_SCRIPT "." CACHE PATH "${INSTALL_DIR_SCRIPT_DESCR}") |
096ef695 |
176 | endif() |
177 | endif() |
178 | |
179 | # place the libraries to <prefix>/lib folder for unix and leave old structure for windows |
4b3541c6 |
180 | if (NOT DEFINED INSTALL_DIR_LIB) |
181 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") |
182 | set (INSTALL_DIR_LIB "lib" CACHE PATH "${INSTALL_DIR_LIB_DESCR}") |
096ef695 |
183 | else() |
4b3541c6 |
184 | set (INSTALL_DIR_LIB "${OS_WITH_BIT}/${COMPILER}/lib" CACHE PATH "${INSTALL_DIR_LIB_DESCR}") |
096ef695 |
185 | endif() |
186 | endif() |
187 | |
188 | # OCCT headers: <prefix>/inc for windows, |
189 | # <prefix>/include/opencascade-7.0.0 for unix |
4b3541c6 |
190 | if (NOT DEFINED INSTALL_DIR_INCLUDE) |
191 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") |
192 | set (INSTALL_DIR_INCLUDE "include/opencascade" CACHE PATH "${INSTALL_DIR_INCLUDE_DESCR}") |
193 | if (INSTALL_DIR_WITH_VERSION) |
194 | set (INSTALL_DIR_INCLUDE "include/opencascade-${OCC_VERSION_STRING_EXT}" CACHE PATH "${INSTALL_DIR_INCLUDE_DESCR}" FORCE) |
195 | endif() |
096ef695 |
196 | else() |
4b3541c6 |
197 | set (INSTALL_DIR_INCLUDE "inc" CACHE PATH "${INSTALL_DIR_INCLUDE_DESCR}") |
096ef695 |
198 | endif() |
199 | endif() |
200 | |
201 | # OCCT resources: <prefix>/src for windows, |
202 | # <prefix>/share/opencascade-7.0.0/resources for unix |
4b3541c6 |
203 | if (NOT DEFINED INSTALL_DIR_RESOURCE) |
204 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") |
205 | set (INSTALL_DIR_RESOURCE "share/opencascade/resources" CACHE PATH "${INSTALL_DIR_RESOURCE_DESCR}") |
206 | if (INSTALL_DIR_WITH_VERSION) |
207 | set (INSTALL_DIR_RESOURCE "share/opencascade-${OCC_VERSION_STRING_EXT}/resources" CACHE PATH "${INSTALL_DIR_RESOURCE_DESCR}" FORCE) |
208 | endif() |
096ef695 |
209 | else() |
4b3541c6 |
210 | set (INSTALL_DIR_RESOURCE "src" CACHE PATH "${INSTALL_DIR_RESOURCE_DESCR}") |
096ef695 |
211 | endif() |
212 | endif() |
213 | |
214 | # OCCT data |
4b3541c6 |
215 | if (NOT DEFINED INSTALL_DIR_DATA) |
216 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") |
217 | set (INSTALL_DIR_DATA "share/opencascade/data" CACHE PATH "${INSTALL_DIR_DATA_DESCR}") |
218 | if (INSTALL_DIR_WITH_VERSION) |
219 | set (INSTALL_DIR_DATA "share/opencascade-${OCC_VERSION_STRING_EXT}/data" CACHE PATH "${INSTALL_DIR_DATA_DESCR}" FORCE) |
220 | endif() |
221 | else() |
222 | set (INSTALL_DIR_DATA "data" CACHE PATH "${INSTALL_DIR_DATA_DESCR}") |
223 | endif() |
224 | endif() |
225 | |
226 | # OCCT samples |
227 | if (NOT DEFINED INSTALL_DIR_SAMPLES) |
228 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") |
229 | set (INSTALL_DIR_SAMPLES "share/opencascade/samples" CACHE PATH "${INSTALL_DIR_SAMPLES_DESCR}") |
230 | if (INSTALL_DIR_WITH_VERSION) |
231 | set (INSTALL_DIR_SAMPLES "share/opencascade-${OCC_VERSION_STRING_EXT}/samples" CACHE PATH "${INSTALL_DIR_SAMPLES_DESCR}" FORCE) |
232 | endif() |
233 | else() |
234 | set (INSTALL_DIR_SAMPLES "samples" CACHE PATH "${INSTALL_DIR_SAMPLES_DESCR}") |
235 | endif() |
236 | endif() |
237 | |
238 | # OCCT tests |
239 | if (NOT DEFINED INSTALL_DIR_TESTS) |
240 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") |
241 | set (INSTALL_DIR_TESTS "share/opencascade/tests" CACHE PATH "${INSTALL_DIR_TESTS_DESCR}") |
242 | if (INSTALL_DIR_WITH_VERSION) |
243 | set (INSTALL_DIR_TESTS "share/opencascade-${OCC_VERSION_STRING_EXT}/tests" CACHE PATH "${INSTALL_DIR_TESTS_DESCR}" FORCE) |
244 | endif() |
245 | else() |
246 | set (INSTALL_DIR_TESTS "tests" CACHE PATH "${INSTALL_DIR_TESTS_DESCR}") |
247 | endif() |
248 | endif() |
249 | |
250 | # OCCT doc |
251 | if (NOT DEFINED INSTALL_DIR_DOC) |
252 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") |
253 | set (INSTALL_DIR_DOC "share/doc/opencascade" CACHE PATH "${INSTALL_DIR_DOC_DESCR}") |
254 | if (INSTALL_DIR_WITH_VERSION) |
255 | set (INSTALL_DIR_DOC "share/doc/opencascade-${OCC_VERSION_STRING_EXT}" CACHE PATH "${INSTALL_DIR_DOC_DESCR}" FORCE) |
256 | endif() |
096ef695 |
257 | else() |
4b3541c6 |
258 | set (INSTALL_DIR_DOC "doc" CACHE PATH "${INSTALL_DIR_DOC_DESCR}") |
096ef695 |
259 | endif() |
260 | endif() |
261 | |
2e48c1cb |
262 | # define folder contaning CMake configuration files |
263 | if (NOT DEFINED INSTALL_DIR_CMAKE) |
264 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") |
265 | if (INSTALL_DIR_WITH_VERSION) |
266 | set (INSTALL_DIR_CMAKE "lib/cmake/opencascade-${OCC_VERSION_STRING_EXT}" CACHE PATH "${INSTALL_DIR_CMAKE_DESCR}") |
267 | else() |
268 | set (INSTALL_DIR_CMAKE "lib/cmake/opencascade" CACHE PATH "${INSTALL_DIR_CMAKE_DESCR}") |
269 | endif() |
270 | else() |
ada9ef40 |
271 | set (INSTALL_DIR_CMAKE "cmake" CACHE PATH "${INSTALL_DIR_CMAKE_DESCR}") |
2e48c1cb |
272 | endif() |
273 | endif() |
274 | |
4b3541c6 |
275 | # install LICENSE_LGPL_21.txt and OCCT_LGPL_EXCEPTION.txt files |
276 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") |
277 | OCCT_INSTALL_FILE_OR_DIR ("LICENSE_LGPL_21.txt" "${INSTALL_DIR}/${INSTALL_DIR_DOC}") |
278 | OCCT_INSTALL_FILE_OR_DIR ("OCCT_LGPL_EXCEPTION.txt" "${INSTALL_DIR}/${INSTALL_DIR_DOC}") |
279 | else() |
280 | OCCT_INSTALL_FILE_OR_DIR ("LICENSE_LGPL_21.txt" "${INSTALL_DIR}") |
281 | OCCT_INSTALL_FILE_OR_DIR ("OCCT_LGPL_EXCEPTION.txt" "${INSTALL_DIR}") |
282 | endif() |
283 | |
096ef695 |
284 | # a directory recognized as a 'patch' for OCCT |
109aa56e |
285 | set (BUILD_PATCH "" CACHE PATH "${BUILD_PATCH_DESCR}") |
03c69aec |
286 | |
9f33b387 |
287 | # the list of being built toolkits |
316d77d9 |
288 | set (BUILD_ADDITIONAL_TOOLKITS "" CACHE STRING "${BUILD_ADDITIONAL_TOOLKITS_DESCR}") |
289 | separate_arguments (BUILD_ADDITIONAL_TOOLKITS) |
03c69aec |
290 | |
ad211ad3 |
291 | if (MSVC) |
4b3541c6 |
292 | set (BUILD_MODULE_MfcSamples OFF CACHE BOOL "${BUILD_MODULE_MfcSamples_DESCR}") |
85bcc072 |
293 | endif() |
294 | |
9f33b387 |
295 | # whether use optional 3rdparty or not |
296 | if (APPLE) |
316d77d9 |
297 | set (USE_GLX OFF CACHE BOOL "${USE_GLX_DESCR}") |
03c69aec |
298 | endif() |
096ef695 |
299 | |
f60111dc |
300 | if (WIN32) |
301 | set (USE_D3D OFF CACHE BOOL "${USE_D3D_DESCR}") |
302 | endif() |
85bcc072 |
303 | |
9f33b387 |
304 | # include the patched or original list of modules |
19286d7c |
305 | # list <MODULENAME>_TOOLKITS is created foreach module and contains its toolkits |
306 | # list <OCCT_MODULES> will contain all modules |
307 | OCCT_MODULES_AND_TOOLKITS (OCCT_MODULES) |
03c69aec |
308 | |
316d77d9 |
309 | foreach (OCCT_MODULE ${OCCT_MODULES}) |
310 | BUILD_MODULE (${OCCT_MODULE}) |
19286d7c |
311 | endforeach() |
312 | |
e713baee |
313 | if (ANDROID AND BUILD_MODULE_Draw) |
314 | message (STATUS "Info. Draw module is turned off due to it is not supported on Android") |
315 | set (BUILD_MODULE_Draw OFF CACHE BOOL "${BUILD_MODULE_Draw_DESCR}" FORCE) |
316 | endif() |
317 | |
adc33035 |
318 | # Overview |
4b3541c6 |
319 | set (BUILD_DOC_Overview OFF CACHE BOOL "${BUILD_DOC_Overview_DESCR}") |
adc33035 |
320 | |
f60111dc |
321 | if (NOT USE_D3D) |
322 | list (REMOVE_ITEM Visualization_TOOLKITS TKD3DHost) |
323 | endif() |
324 | |
316d77d9 |
325 | # accumulate used toolkits (first level) in BUILD_TOOLKITS variable |
326 | list (APPEND BUILD_TOOLKITS ${BUILD_ADDITIONAL_TOOLKITS}) |
19286d7c |
327 | |
316d77d9 |
328 | foreach (OCCT_MODULE ${OCCT_MODULES}) |
329 | if (BUILD_MODULE_${OCCT_MODULE}) |
330 | list (APPEND BUILD_TOOLKITS ${${OCCT_MODULE}_TOOLKITS}) |
19286d7c |
331 | endif() |
332 | endforeach() |
333 | |
334 | # DRAWEXE excluded when library build is static |
335 | if (NOT BUILD_SHARED_LIBS) |
316d77d9 |
336 | list (REMOVE_ITEM BUILD_TOOLKITS DRAWEXE) |
19286d7c |
337 | message (STATUS "Info: DRAWEXE is not included due to ${BUILD_LIBRARY_TYPE} build library type") |
338 | endif() |
339 | |
340 | # accumulate all used toolkits |
316d77d9 |
341 | list (REMOVE_DUPLICATES BUILD_TOOLKITS) |
342 | set (RAW_BUILD_TOOLKITS) |
096ef695 |
343 | foreach (BUILD_TOOLKIT ${BUILD_TOOLKITS}) |
316d77d9 |
344 | OCCT_TOOLKIT_FULL_DEP (${BUILD_TOOLKIT} TOOLKIT_FULL_DEPS) |
345 | list (APPEND RAW_BUILD_TOOLKITS ${BUILD_TOOLKIT} ${TOOLKIT_FULL_DEPS}) |
19286d7c |
346 | endforeach() |
347 | |
316d77d9 |
348 | list (REMOVE_DUPLICATES RAW_BUILD_TOOLKITS) |
349 | set (BUILD_TOOLKITS ${RAW_BUILD_TOOLKITS}) |
03c69aec |
350 | |
9f33b387 |
351 | # include the patched or original list of definitions and flags |
19286d7c |
352 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_defs_flags") |
03c69aec |
353 | |
19286d7c |
354 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/3rdparty_macro") |
03c69aec |
355 | |
a6874708 |
356 | # search for TKIVtk and TKIVtkDraw in BUILD_TOOLKITS |
357 | list (FIND BUILD_TOOLKITS TKIVtk CAN_USE_VTK) |
358 | if (CAN_USE_VTK EQUAL -1) |
359 | list (FIND BUILD_TOOLKITS TKIVtkDraw CAN_USE_VTK) |
360 | endif() |
361 | |
362 | if (NOT CAN_USE_VTK EQUAL -1) |
363 | if (NOT DEFINED USE_VTK) |
364 | set (USE_VTK OFF CACHE BOOL "${USE_VTK_DESCR}") |
365 | endif() |
366 | else() |
367 | OCCT_CHECK_AND_UNSET (USE_VTK) |
368 | endif() |
369 | |
5682a6fa |
370 | # Rebuild *.yacc and *.lex files that are contained by TKMath toolkit |
371 | list (FIND BUILD_TOOLKITS TKMath CAN_REBUILD_PDC_FOR_TKMATH) |
372 | list (FIND BUILD_TOOLKITS StepFile CAN_REBUILD_PDC_FOR_STEPFILE) |
373 | |
fb3267c7 |
374 | if (NOT ${CAN_REBUILD_PDC_FOR_TKMATH} EQUAL -1 OR NOT ${CAN_REBUILD_PDC_FOR_STEPFILE} EQUAL -1) |
109aa56e |
375 | set (BUILD_YACCLEX OFF CACHE BOOL "${BUILD_YACCLEX_DESCR}") |
5682a6fa |
376 | else() |
109aa56e |
377 | OCCT_CHECK_AND_UNSET (BUILD_YACCLEX) |
5682a6fa |
378 | endif() |
379 | |
9f33b387 |
380 | if (NOT DEFINED 3RDPARTY_DIR) |
316d77d9 |
381 | set (3RDPARTY_DIR "" CACHE PATH ${3RDPARTY_DIR_DESCR}) |
e713baee |
382 | get_filename_component (3RDPARTY_DIR "${3RDPARTY_DIR}" ABSOLUTE) |
84258256 |
383 | else() |
1d505bb0 |
384 | file (TO_CMAKE_PATH "${3RDPARTY_DIR}" 3RDPARTY_DIR) |
84258256 |
385 | set (3RDPARTY_DIR "${3RDPARTY_DIR}" CACHE PATH "${3RDPARTY_DIR_DESCR}" FORCE) |
9f33b387 |
386 | endif() |
234e52be |
387 | |
9f33b387 |
388 | # search for CSF_TclLibs variable in EXTERNLIB of each being used toolkit |
f2e9c853 |
389 | OCCT_IS_PRODUCT_REQUIRED (CSF_TclLibs USE_TCL) |
03c69aec |
390 | |
fb3267c7 |
391 | if (USE_TCL) |
5682a6fa |
392 | message (STATUS "Info: TCL is used by OCCT") |
19286d7c |
393 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tcl") |
82f443b6 |
394 | |
395 | message (STATUS "Info: TK is used by OCCT") |
396 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tk") |
9f33b387 |
397 | else() |
9ccea0c6 |
398 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TCL") |
399 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TK") |
5682a6fa |
400 | |
401 | OCCT_CHECK_AND_UNSET ("INSTALL_TCL") |
82f443b6 |
402 | OCCT_CHECK_AND_UNSET ("INSTALL_TK") |
9f33b387 |
403 | endif() |
03c69aec |
404 | |
9f33b387 |
405 | # search for CSF_FREETYPE variable in EXTERNLIB of each being used toolkit |
f2e9c853 |
406 | OCCT_IS_PRODUCT_REQUIRED (CSF_FREETYPE USE_FREETYPE) |
03c69aec |
407 | |
fb3267c7 |
408 | if (USE_FREETYPE) |
5682a6fa |
409 | message (STATUS "Info: Freetype is used by OCCT") |
19286d7c |
410 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freetype") |
9f33b387 |
411 | else() |
9ccea0c6 |
412 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREETYPE") |
9f33b387 |
413 | OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2") |
414 | OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build") |
5682a6fa |
415 | OCCT_CHECK_AND_UNSET ("INSTALL_FREETYPE") |
9f33b387 |
416 | endif() |
03c69aec |
417 | |
09c597c9 |
418 | # VTK |
419 | if (USE_VTK) |
420 | add_definitions (-DHAVE_VTK) |
19286d7c |
421 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/vtk") |
f2e9c853 |
422 | else() |
423 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_VTK") |
a6874708 |
424 | |
425 | if (NOT CAN_USE_VTK EQUAL -1) |
426 | message (STATUS "Info: TKIVtk and TKIVtkDraw toolkits excluded due to VTK usage is disabled") |
427 | |
428 | list (REMOVE_ITEM BUILD_TOOLKITS TKIVtk) |
429 | list (REMOVE_ITEM BUILD_TOOLKITS TKIVtkDraw) |
430 | endif() |
09c597c9 |
431 | endif() |
432 | |
f60111dc |
433 | # D3D |
434 | if (USE_D3D) |
435 | add_definitions (-DHAVE_D3D) |
436 | #if(MSVC_VERSION LESS 1700) |
437 | #OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/d3d") |
438 | #endif() |
439 | endif() |
440 | |
09c597c9 |
441 | # GLX |
442 | if (USE_GLX) |
443 | add_definitions (-DMACOSX_USE_GLX) |
19286d7c |
444 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/glx") |
09c597c9 |
445 | endif() |
446 | |
03c69aec |
447 | # FREEIMAGE |
5682a6fa |
448 | # search for CSF_FREEIMAGE variable in EXTERNLIB of each being used toolkit |
449 | OCCT_IS_PRODUCT_REQUIRED (CSF_FREEIMAGE CAN_USE_FREEIMAGE) |
450 | OCCT_IS_PRODUCT_REQUIRED (CSF_FreeImagePlus CAN_USE_FREEIMAGEPLUS) |
451 | |
452 | if (CAN_USE_FREEIMAGE OR CAN_USE_FREEIMAGEPLUS) |
453 | set (USE_FREEIMAGE OFF CACHE BOOL "${USE_FREEIMAGE_DESCR}") |
454 | |
455 | if (USE_FREEIMAGE) |
456 | add_definitions (-DHAVE_FREEIMAGE) |
457 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freeimage") |
458 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freeimageplus") |
459 | else() |
460 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGE") |
461 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGEPLUS") |
462 | OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGE") |
463 | OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGEPLUS") |
464 | endif() |
9f33b387 |
465 | else() |
5682a6fa |
466 | OCCT_CHECK_AND_UNSET ("USE_FREEIMAGE") |
467 | |
9f33b387 |
468 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGE") |
469 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGEPLUS") |
470 | OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGE") |
471 | OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGEPLUS") |
472 | endif() |
03c69aec |
473 | |
474 | # GL2PS |
5682a6fa |
475 | # search for CSF_GL2PS variable in EXTERNLIB of each being used toolkit |
476 | OCCT_IS_PRODUCT_REQUIRED (CSF_GL2PS CAN_USE_GL2PS) |
477 | |
478 | if (NOT DEFINED ANDROID AND CAN_USE_GL2PS) |
479 | set (USE_GL2PS OFF CACHE BOOL "${USE_GL2PS_DESCR}") |
480 | |
481 | if (USE_GL2PS) |
482 | add_definitions (-DHAVE_GL2PS) |
483 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gl2ps") |
484 | else() |
485 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GL2PS") |
486 | OCCT_CHECK_AND_UNSET ("INSTALL_GL2PS") |
487 | endif() |
9f33b387 |
488 | else() |
5682a6fa |
489 | OCCT_CHECK_AND_UNSET ("USE_GL2PS") |
490 | |
9f33b387 |
491 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GL2PS") |
492 | OCCT_CHECK_AND_UNSET ("INSTALL_GL2PS") |
493 | endif() |
03c69aec |
494 | |
9f33b387 |
495 | # TBB |
5682a6fa |
496 | # search for CSF_TBB variable in EXTERNLIB of each being used toolkit |
497 | OCCT_IS_PRODUCT_REQUIRED (CSF_TBB CAN_USE_TBB) |
498 | |
499 | if (NOT DEFINED ANDROID AND CAN_USE_TBB) |
500 | set (USE_TBB OFF CACHE BOOL "${USE_TBB_DESCR}") |
501 | |
502 | if (USE_TBB) |
503 | add_definitions (-DHAVE_TBB) |
504 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tbb") |
505 | else() |
506 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB") |
507 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBBMALLOC") |
508 | OCCT_CHECK_AND_UNSET ("INSTALL_TBB") |
509 | endif() |
9f33b387 |
510 | else() |
5682a6fa |
511 | OCCT_CHECK_AND_UNSET ("USE_TBB") |
512 | |
9f33b387 |
513 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB") |
514 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBBMALLOC") |
515 | OCCT_CHECK_AND_UNSET ("INSTALL_TBB") |
516 | endif() |
234e52be |
517 | |
adc33035 |
518 | # Doxygen |
4b3541c6 |
519 | if (BUILD_DOC_Overview) |
520 | if (NOT DEFINED INSTALL_DOC_Overview) |
521 | set (INSTALL_DOC_Overview OFF CACHE BOOL "${INSTALL_DOC_Overview_DESCR}") |
adc33035 |
522 | endif() |
523 | |
4b3541c6 |
524 | if (INSTALL_DOC_Overview) |
525 | install (DIRECTORY "${CMAKE_BINARY_DIR}/doc/overview" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_DOC}") |
f2e9c853 |
526 | |
096ef695 |
527 | # create overview.html only for windows |
4b3541c6 |
528 | if (WIN32 AND "${INSTALL_DIR_LAYOUT}" STREQUAL "Windows") |
529 | OCCT_INSTALL_FILE_OR_DIR ("dox/resources/overview.html" "${INSTALL_DIR}/${INSTALL_DIR_DOC}/..") |
096ef695 |
530 | endif() |
adc33035 |
531 | endif() |
532 | |
533 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/doxygen") |
534 | else() |
4b3541c6 |
535 | OCCT_CHECK_AND_UNSET ("INSTALL_DOC_Overview") |
adc33035 |
536 | |
537 | OCCT_CHECK_AND_UNSET ("3RDPARTY_DOXYGEN_EXECUTABLE") |
109aa56e |
538 | OCCT_CHECK_AND_UNSET ("3RDPARTY_DOT_EXECUTABLE") |
adc33035 |
539 | endif() |
540 | |
316d77d9 |
541 | # bison |
109aa56e |
542 | if (BUILD_YACCLEX) |
316d77d9 |
543 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/bison") |
544 | else() |
545 | OCCT_CHECK_AND_UNSET ("3RDPARTY_BISON_EXECUTABLE") |
546 | endif() |
547 | |
548 | # flex |
109aa56e |
549 | if (BUILD_YACCLEX) |
316d77d9 |
550 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/flex") |
551 | else() |
552 | OCCT_CHECK_AND_UNSET ("3RDPARTY_FLEX_EXECUTABLE") |
553 | endif() |
554 | |
9f33b387 |
555 | string (REGEX REPLACE ";" " " 3RDPARTY_NOT_INCLUDED "${3RDPARTY_NOT_INCLUDED}") |
234e52be |
556 | |
9f33b387 |
557 | # check all 3rdparty paths |
558 | if (3RDPARTY_NOT_INCLUDED) |
559 | message (FATAL_ERROR "NOT FOUND: ${3RDPARTY_NOT_INCLUDED}" ) |
560 | endif() |
7c633a3e |
561 | |
9bb81d6c |
562 | if (3RDPARTY_INCLUDE_DIRS) |
563 | list (REMOVE_DUPLICATES 3RDPARTY_INCLUDE_DIRS) |
564 | string (REGEX REPLACE ";" "\n\t" 3RDPARTY_INCLUDE_DIRS_WITH_ENDS "${3RDPARTY_INCLUDE_DIRS}") |
ada9ef40 |
565 | message (STATUS "Info: The directories of 3rdparty headers: \n\t${3RDPARTY_INCLUDE_DIRS_WITH_ENDS}") |
9bb81d6c |
566 | include_directories (${3RDPARTY_INCLUDE_DIRS}) |
567 | endif() |
568 | |
94829f84 |
569 | # include <cmake binary folder>/inc |
570 | include_directories (${CMAKE_BINARY_DIR}/inc) |
571 | |
9bb81d6c |
572 | if (3RDPARTY_LIBRARY_DIRS) |
573 | list (REMOVE_DUPLICATES 3RDPARTY_LIBRARY_DIRS) |
574 | string (REGEX REPLACE ";" "\n\t" 3RDPARTY_LIBRARY_DIRS_WITH_ENDS "${3RDPARTY_LIBRARY_DIRS}") |
ada9ef40 |
575 | message (STATUS "Info: The directories of 3rdparty libraries: \n\t${3RDPARTY_LIBRARY_DIRS_WITH_ENDS}") |
9bb81d6c |
576 | link_directories (${3RDPARTY_LIBRARY_DIRS}) |
577 | endif() |
234e52be |
578 | |
9f33b387 |
579 | # build directories |
4b3541c6 |
580 | if (SINGLE_GENERATOR) |
581 | set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BIN_LETTER}") |
582 | set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BIN_LETTER}") |
583 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BIN_LETTER}") |
584 | if (WIN32) |
585 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BIN_LETTER}") |
586 | endif() |
587 | endif() |
588 | |
fa0cbe55 |
589 | set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib") |
590 | set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin") |
591 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib") |
19286d7c |
592 | |
316d77d9 |
593 | set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libi") |
594 | set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bini") |
595 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libi") |
19286d7c |
596 | |
fa0cbe55 |
597 | set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libd") |
598 | set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bind") |
599 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libd") |
19286d7c |
600 | |
fa0cbe55 |
601 | if (WIN32) |
f2e9c853 |
602 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin") |
603 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bini") |
604 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bind") |
19286d7c |
605 | endif() |
03c69aec |
606 | |
d94d80e5 |
607 | string(TIMESTAMP CURRENT_TIME "%H:%M:%S") |
608 | message (STATUS "\nInfo: \(${CURRENT_TIME}\) Start collecting all OCCT header files into ${CMAKE_BINARY_DIR}/inc ...") |
94829f84 |
609 | |
94829f84 |
610 | # collect all the headers to <binary dir>/inc folder |
f2e9c853 |
611 | COLLECT_AND_INSTALL_OCCT_HEADER_FILES ("${CMAKE_BINARY_DIR}" "${BUILD_TOOLKITS}") |
94829f84 |
612 | |
d94d80e5 |
613 | string(TIMESTAMP CURRENT_TIME "%H:%M:%S") |
614 | message (STATUS "Info: \(${CURRENT_TIME}\) End the collecting") |
615 | |
4b3541c6 |
616 | OCCT_INSTALL_FILE_OR_DIR ("data/" "${INSTALL_DIR}/${INSTALL_DIR_DATA}") |
617 | |
618 | if (WIN32) |
619 | set (SCRIPT_EXT bat) |
620 | else() |
621 | set (SCRIPT_EXT sh) |
622 | endif() |
03c69aec |
623 | |
096ef695 |
624 | # OCCT samples |
0e617b05 |
625 | if (INSTALL_SAMPLES) |
4b3541c6 |
626 | OCCT_CONFIGURE ("adm/templates/env.samples.${SCRIPT_EXT}.in" "env.samples.${SCRIPT_EXT}") |
096ef695 |
627 | if (WIN32) |
4b3541c6 |
628 | OCCT_INSTALL_FILE_OR_DIR ("samples/CSharp" "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}") |
629 | OCCT_INSTALL_FILE_OR_DIR ("samples/mfc" "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}") |
630 | |
631 | install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}/CSharp" RENAME "env.${SCRIPT_EXT}") |
632 | install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}/mfc/standard" RENAME "env.${SCRIPT_EXT}") |
096ef695 |
633 | endif() |
03c69aec |
634 | |
4b3541c6 |
635 | OCCT_INSTALL_FILE_OR_DIR ("samples/java" "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}") |
636 | OCCT_INSTALL_FILE_OR_DIR ("samples/ocafsamples" "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}") |
637 | OCCT_INSTALL_FILE_OR_DIR ("samples/qt" "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}") |
096ef695 |
638 | |
4b3541c6 |
639 | install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}/qt/FuncDemo" RENAME "env.${SCRIPT_EXT}") |
640 | install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}/qt/IESample" RENAME "env.${SCRIPT_EXT}") |
641 | install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}/qt/Tutorial" RENAME "env.${SCRIPT_EXT}") |
910970ab |
642 | endif() |
03c69aec |
643 | |
4b3541c6 |
644 | OCCT_INSTALL_FILE_OR_DIR ("samples/tcl" "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}") |
645 | |
646 | if (INSTALL_TEST_CASES) |
647 | OCCT_INSTALL_FILE_OR_DIR ("tests/" "${INSTALL_DIR}/${INSTALL_DIR_TESTS}") |
910970ab |
648 | endif() |
03c69aec |
649 | |
096ef695 |
650 | # copy draw script to install script folder |
109aa56e |
651 | if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/adm/templates/draw.${SCRIPT_EXT}") |
4b3541c6 |
652 | install (FILES "${BUILD_PATCH}/adm/templates/draw.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}" |
096ef695 |
653 | PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE) |
910970ab |
654 | else() |
4b3541c6 |
655 | install (FILES "${CMAKE_SOURCE_DIR}/adm/templates/draw.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}" |
096ef695 |
656 | PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE) |
910970ab |
657 | endif() |
096ef695 |
658 | |
659 | # copy draw script to CMake binary folder |
910970ab |
660 | OCCT_COPY_FILE_OR_DIR ("adm/templates/draw.${SCRIPT_EXT}" "${CMAKE_BINARY_DIR}") |
9f33b387 |
661 | |
316d77d9 |
662 | set (SUB_CUSTOM_NAME "custom_${COMPILER}_${COMPILER_BITNESS}.${SCRIPT_EXT}") |
9f33b387 |
663 | |
910970ab |
664 | if (WIN32) |
4b3541c6 |
665 | set (ADDITIONAL_CUSTOM_CONTENT "\nif exist \"%~dp0${SUB_CUSTOM_NAME}\" (\n call \"%~dp0${SUB_CUSTOM_NAME}\" %1 %2 %3 \n)") |
910970ab |
666 | else() |
096ef695 |
667 | set (ADDITIONAL_CUSTOM_CONTENT "\nif [ -e \"\${aScriptPath}/${SUB_CUSTOM_NAME}\" ]; then\n source \"\${aScriptPath}/${SUB_CUSTOM_NAME}\" \"\$1\" \"\$2\" \nfi") |
910970ab |
668 | endif() |
32856b63 |
669 | |
910970ab |
670 | # change custom.bat/sh |
4b3541c6 |
671 | if (EXISTS "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}/custom.${SCRIPT_EXT}") |
672 | file (READ "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}/custom.${SCRIPT_EXT}" CUSTOM_CONTENT) |
32856b63 |
673 | |
910970ab |
674 | set (CUSTOM_CONTENT "${CUSTOM_CONTENT} ${ADDITIONAL_CUSTOM_CONTENT}") |
32856b63 |
675 | |
4b3541c6 |
676 | file (WRITE "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}/custom.${SCRIPT_EXT}" "${CUSTOM_CONTENT}") |
910970ab |
677 | else() |
4b3541c6 |
678 | OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.${SCRIPT_EXT}.main" "custom.${SCRIPT_EXT}" "custom.${SCRIPT_EXT}" "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}") |
910970ab |
679 | endif() |
32856b63 |
680 | |
316d77d9 |
681 | # write current custom.bat/sh (for install directory) |
682 | set (SUB_CUSTOM_BUILD_NAME "custom_${COMPILER}_${COMPILER_BITNESS}.install.${SCRIPT_EXT}") |
4b3541c6 |
683 | OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.install.${SCRIPT_EXT}.in" "${SUB_CUSTOM_BUILD_NAME}" "${SUB_CUSTOM_NAME}" "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}") |
03c69aec |
684 | |
316d77d9 |
685 | # write current custom.bat/sh (for build directory) |
686 | OCCT_CONFIGURE ("adm/templates/custom.build.${SCRIPT_EXT}.in" "${SUB_CUSTOM_NAME}") |
687 | |
4b3541c6 |
688 | if (BUILD_MODULE_MfcSamples) |
689 | OCCT_INSTALL_FILE_OR_DIR ("adm/templates/sample.bat" "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}") |
f2e9c853 |
690 | OCCT_COPY_FILE_OR_DIR ("adm/templates/sample.bat" "${CMAKE_BINARY_DIR}") |
9f33b387 |
691 | endif() |
692 | |
316d77d9 |
693 | # env script for draw in building environment |
4b3541c6 |
694 | OCCT_CONFIGURE ("adm/templates/env.${SCRIPT_EXT}.in" "env.${SCRIPT_EXT}") |
316d77d9 |
695 | |
4b3541c6 |
696 | # install env script |
697 | install (FILES "${CMAKE_BINARY_DIR}/env.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}") |
316d77d9 |
698 | |
699 | # copy DrawAppliInit from OCCT source to build directory |
f2e9c853 |
700 | if (NOT EXISTS "${CMAKE_BINARY_DIR}/DrawAppliInit") |
701 | OCCT_COPY_FILE_OR_DIR (DrawAppliInit "${CMAKE_BINARY_DIR}") |
316d77d9 |
702 | endif() |
910970ab |
703 | |
9f33b387 |
704 | # RESOURCES |
19286d7c |
705 | FILE_TO_LIST ("adm/RESOURCES" RESOURCES) |
706 | foreach(RESOURCE ${RESOURCES}) |
707 | get_filename_component(RESOURCE_FOLDER ${RESOURCE} DIRECTORY) |
708 | if(NOT "${RESOURCE_FOLDER}" STREQUAL "") |
709 | get_filename_component(RESOURCE_FOLDER ${RESOURCE_FOLDER} NAME) |
4b3541c6 |
710 | OCCT_INSTALL_FILE_OR_DIR ("src/${RESOURCE}" "${INSTALL_DIR}/${INSTALL_DIR_RESOURCE}/${RESOURCE_FOLDER}") |
19286d7c |
711 | else() |
4b3541c6 |
712 | OCCT_INSTALL_FILE_OR_DIR ("src/${RESOURCE}" "${INSTALL_DIR}/${INSTALL_DIR_RESOURCE}") |
19286d7c |
713 | endif() |
714 | endforeach() |
03c69aec |
715 | |
fb3267c7 |
716 | # define CSF variable |
717 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_csf") |
718 | |
33839ae6 |
719 | # include patched toolkit projects or original ones |
316d77d9 |
720 | foreach (BUILD_TOOLKIT ${BUILD_TOOLKITS}) |
f2e9c853 |
721 | OCCT_ADD_SUBDIRECTORY ("src/${BUILD_TOOLKIT}") |
19286d7c |
722 | endforeach() |
234e52be |
723 | |
4b3541c6 |
724 | if (BUILD_DOC_Overview) |
f2e9c853 |
725 | OCCT_ADD_SUBDIRECTORY (dox) |
adc33035 |
726 | endif() |
727 | |
94829f84 |
728 | # patch DRAWEXE |
729 | if (MSVC AND 3RDPARTY_DLL_DIRS) |
316d77d9 |
730 | list (FIND BUILD_TOOLKITS DRAWEXE DRAWEXE_INDEX) |
94829f84 |
731 | if (${DRAWEXE_INDEX} GREATER -1) |
732 | list (REMOVE_DUPLICATES 3RDPARTY_DLL_DIRS) |
733 | set (3RDPARTY_DLL_DIRS_FOR_PATH "") |
734 | |
735 | foreach (3RDPARTY_DLL_DIR ${3RDPARTY_DLL_DIRS}) |
736 | set (3RDPARTY_DLL_DIRS_FOR_PATH "${3RDPARTY_DLL_DIRS_FOR_PATH};${3RDPARTY_DLL_DIR}") |
737 | endforeach() |
738 | |
739 | OCCT_MAKE_COMPILER_BITNESS() |
740 | set (X_COMPILER_BITNESS "x64") |
741 | if ("${COMPILER_BITNESS}" STREQUAL "32") |
742 | set (X_COMPILER_BITNESS "Win32") |
743 | endif() |
744 | |
f2e9c853 |
745 | OCCT_CONFIGURE ("adm/templates/DRAWEXE.vcxproj.user.in" "${CMAKE_BINARY_DIR}/src/DRAWEXE/DRAWEXE.vcxproj.user") |
94829f84 |
746 | endif() |
747 | endif() |
748 | |
33839ae6 |
749 | # samples do not support patch usage |
4b3541c6 |
750 | if (BUILD_MODULE_MfcSamples) |
19286d7c |
751 | set (OCCT_ROOT ${CMAKE_SOURCE_DIR}) |
234e52be |
752 | |
19286d7c |
753 | set (MFC_STANDARD_SAMPLES_DIR ${OCCT_ROOT}/samples/mfc/standard) |
754 | set (COMMON_WINMAIN_FILE ${MFC_STANDARD_SAMPLES_DIR}/Common/Winmain.cpp) |
234e52be |
755 | |
9f33b387 |
756 | add_subdirectory(samples/mfc/standard/mfcsample) |
757 | add_subdirectory(samples/mfc/standard/01_Geometry) |
758 | add_subdirectory(samples/mfc/standard/02_Modeling) |
759 | add_subdirectory(samples/mfc/standard/03_Viewer2d) |
760 | add_subdirectory(samples/mfc/standard/04_Viewer3d) |
761 | add_subdirectory(samples/mfc/standard/05_ImportExport) |
762 | add_subdirectory(samples/mfc/standard/06_Ocaf) |
763 | add_subdirectory(samples/mfc/standard/07_Triangulation) |
764 | add_subdirectory(samples/mfc/standard/08_HLR) |
765 | add_subdirectory(samples/mfc/standard/09_Animation) |
766 | add_subdirectory(samples/mfc/standard/10_Convert) |
19286d7c |
767 | endif() |
2e48c1cb |
768 | |
769 | # Prepare variables for configuration of OpenCASCADE cmake config file |
770 | set (OCCT_MODULES_ENABLED) |
771 | set (OCCT_LIBRARIES) |
ada9ef40 |
772 | set (SET_OpenCASCADE_MODULES_TOOLKITS "\n# List of available OpenCASCADE libraries for each module\n") |
2e48c1cb |
773 | foreach (OCCT_TOOLKIT ${BUILD_TOOLKITS}) |
774 | if (TARGET ${OCCT_TOOLKIT}) |
775 | |
776 | # get all libraries |
777 | get_target_property (${OCCT_TOOLKIT}_TYPE ${OCCT_TOOLKIT} "TYPE") |
778 | if ("${${OCCT_TOOLKIT}_TYPE}" STREQUAL "STATIC_LIBRARY" OR "${${OCCT_TOOLKIT}_TYPE}" STREQUAL "SHARED_LIBRARY" ) |
779 | list (APPEND OCCT_LIBRARIES ${OCCT_TOOLKIT}) |
2e48c1cb |
780 | |
ada9ef40 |
781 | # get all modules |
782 | get_target_property (${OCCT_TOOLKIT}_MODULE ${OCCT_TOOLKIT} "MODULE") |
783 | list (APPEND OCCT_MODULES_ENABLED ${${OCCT_TOOLKIT}_MODULE}) |
784 | list (APPEND OpenCASCADE_${${OCCT_TOOLKIT}_MODULE}_TOOLKITS ${OCCT_TOOLKIT}) |
2e48c1cb |
785 | endif() |
786 | endif() |
787 | endforeach() |
788 | list (REMOVE_DUPLICATES OCCT_MODULES_ENABLED) |
789 | |
ada9ef40 |
790 | foreach (OCCT_MODULE ${OCCT_MODULES}) |
791 | if (BUILD_MODULE_${OCCT_MODULE}) |
792 | set (SET_OpenCASCADE_MODULES_TOOLKITS "${SET_OpenCASCADE_MODULES_TOOLKITS}set (OpenCASCADE_${OCCT_MODULE}_LIBRARIES ${OpenCASCADE_${OCCT_MODULE}_TOOLKITS})\n") |
793 | endif() |
794 | endforeach() |
795 | |
796 | # Add all targets to the build-tree export set |
797 | export (TARGETS ${OCCT_LIBRARIES} FILE "${CMAKE_BINARY_DIR}/OpenCASCADETargets.cmake") |
798 | |
799 | # Export the package for use from the build-tree |
800 | # (this registers the build-tree with a global CMake-registry) |
801 | export(PACKAGE OpenCASCADE) |
802 | |
2e48c1cb |
803 | if (CMAKE_BUILD_TYPE) |
804 | set (SET_OpenCASCADE_BUILD_TYPE "set (OpenCASCADE_BUILD_TYPE \"${CMAKE_BUILD_TYPE}\")") |
805 | endif() |
806 | |
807 | if (BUILD_SHARED_LIBS) |
808 | set (SET_OpenCASCADE_LINKER_FLAGS "set (OpenCASCADE_LINKER_FLAGS \"${CMAKE_SHARED_LINKER_FLAGS}\")") |
809 | else() |
810 | set (SET_OpenCASCADE_LINKER_FLAGS "set (OpenCASCADE_LINKER_FLAGS \"${CMAKE_STATIC_LINKER_FLAGS}\")") |
811 | endif() |
812 | |
813 | if (WIN32) |
814 | set (SET_OpenCASCADE_WITH_D3D "set (OpenCASCADE_WITH_D3D ${USE_D3D})") |
815 | endif() |
816 | if (APPLE) |
817 | set (SET_OpenCASCADE_WITH_GLX "set (OpenCASCADE_WITH_GLX ${USE_GLX})") |
818 | endif() |
819 | |
ada9ef40 |
820 | if (NOT SINGLE_GENERATOR) |
821 | OCCT_INSERT_CODE_FOR_TARGET() |
822 | endif() |
823 | |
2e48c1cb |
824 | # Configure and install cmake config file |
ada9ef40 |
825 | configure_file("${CMAKE_SOURCE_DIR}/adm/templates/OpenCASCADEConfig.cmake.in" "OpenCASCADEConfig.cmake" @ONLY) |
826 | install(FILES "${CMAKE_BINARY_DIR}/OpenCASCADEConfig.cmake" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_CMAKE}") |
2e48c1cb |
827 | |
828 | # Configure cmake version file |
829 | include(CMakePackageConfigHelpers) |
830 | write_basic_package_version_file( ${CMAKE_BINARY_DIR}/OpenCASCADEConfigVersion.cmake |
831 | VERSION ${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE} |
832 | COMPATIBILITY ExactVersion ) |
833 | |
834 | # Install cmake version file |
835 | install (FILES "${CMAKE_BINARY_DIR}/OpenCASCADEConfigVersion.cmake" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_CMAKE}") |
ada9ef40 |
836 | |
837 | # Install the export set for use with the install-tree for each configuration |
838 | foreach (OCCT_MODULE ${OCCT_MODULES}) |
839 | if (BUILD_MODULE_${OCCT_MODULE}) |
840 | install(EXPORT OpenCASCADE${OCCT_MODULE}Targets DESTINATION "${INSTALL_DIR_CMAKE}") |
841 | endif() |
842 | endforeach() |
843 | |
844 | # Update generated OpenCASCADETargets-*.cmake files |
845 | # to have correct paths to libraries depending on the configuration |
846 | OCCT_UPDATE_TARGET_FILE () |