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