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