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