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