19286d7c |
1 | cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR) |
166d6cd7 |
2 | |
576f8b11 |
3 | set (CMAKE_SUPPRESS_REGENERATION TRUE) |
4 | |
fa0cbe55 |
5 | set (CMAKE_CONFIGURATION_TYPES Release Debug RelWithDebInfo CACHE INTERNAL "" FORCE) |
03c69aec |
6 | |
316d77d9 |
7 | # macro: include patched file if it exists |
8 | macro (OCCT_INCLUDE_CMAKE_FILE BEING_INCLUDED_FILE) |
f2e9c853 |
9 | if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/${BEING_INCLUDED_FILE}.cmake") |
316d77d9 |
10 | include (${APPLY_OCCT_PATCH_DIR}/${BEING_INCLUDED_FILE}.cmake) |
11 | else() |
f2e9c853 |
12 | include (${CMAKE_SOURCE_DIR}/${BEING_INCLUDED_FILE}.cmake) |
316d77d9 |
13 | endif() |
14 | endmacro() |
15 | |
16 | # include variable description |
17 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/vardescr") |
18 | |
c259930b |
19 | # set type of OCCT libraries |
20 | if (NOT BUILD_LIBRARY_TYPE) |
316d77d9 |
21 | set (BUILD_LIBRARY_TYPE "Shared" CACHE STRING "${BUILD_LIBRARY_TYPE_DESCR}" FORCE) |
c259930b |
22 | SET_PROPERTY(CACHE BUILD_LIBRARY_TYPE PROPERTY STRINGS Shared Static) |
23 | endif() |
24 | |
25 | if ("${BUILD_LIBRARY_TYPE}" STREQUAL "Shared") |
26 | set (BUILD_SHARED_LIBS ON) |
27 | else() |
28 | unset (BUILD_SHARED_LIBS) |
29 | endif() |
30 | |
9f33b387 |
31 | # the name of the project |
32 | project (OCCT) |
03c69aec |
33 | |
9f33b387 |
34 | # Solution folder property |
35 | set_property (GLOBAL PROPERTY USE_FOLDERS ON) |
03c69aec |
36 | |
0e617b05 |
37 | set (INSTALL_TEST_CASES OFF CACHE BOOL "${INSTALL_TEST_CASES_DESCR}") |
316d77d9 |
38 | # a single-configuration generator like the Makefile generator defines CMAKE_BUILD_TYPE variable |
39 | # check this variable and set if it's required |
40 | if (DEFINED CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE) # single-configuration generator. |
41 | 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 |
42 | endif() |
43 | |
898f6a92 |
44 | # enable extended messages of many OCCT algorithms |
45 | set (OCCT_ALGO_EXTENDED_OUTPUT OFF CACHE BOOL "${OCCT_ALGO_EXTENDED_OUTPUT_DESCR}") |
bc54ec04 |
46 | if (OCCT_ALGO_EXTENDED_OUTPUT) |
898f6a92 |
47 | add_definitions (-DOCCT_DEBUG) |
48 | endif() |
316d77d9 |
49 | |
19286d7c |
50 | # copy samples to install directory |
0e617b05 |
51 | set (INSTALL_SAMPLES OFF CACHE BOOL "${INSTALL_SAMPLES_DESCR}") |
19286d7c |
52 | |
9f33b387 |
53 | # install dir of the built project |
316d77d9 |
54 | set (INSTALL_DIR "" CACHE PATH "${INSTALL_DIR_DESCR}" ) |
9f33b387 |
55 | set (CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE ) |
03c69aec |
56 | |
316d77d9 |
57 | set (APPLY_OCCT_PATCH_DIR "" CACHE PATH "${APPLY_OCCT_PATCH_DIR_DESCR}") |
03c69aec |
58 | |
9f33b387 |
59 | # the list of being built toolkits |
316d77d9 |
60 | set (BUILD_ADDITIONAL_TOOLKITS "" CACHE STRING "${BUILD_ADDITIONAL_TOOLKITS_DESCR}") |
61 | separate_arguments (BUILD_ADDITIONAL_TOOLKITS) |
03c69aec |
62 | |
ad211ad3 |
63 | if (MSVC) |
316d77d9 |
64 | set (BUILD_MODULE_OcctMfcSamples OFF CACHE BOOL "${BUILD_MODULE_OcctMfcSamples_DESCR}") |
85bcc072 |
65 | endif() |
66 | |
9f33b387 |
67 | # whether use optional 3rdparty or not |
68 | if (APPLE) |
316d77d9 |
69 | set (USE_GLX OFF CACHE BOOL "${USE_GLX_DESCR}") |
03c69aec |
70 | endif() |
f60111dc |
71 | if (WIN32) |
72 | set (USE_D3D OFF CACHE BOOL "${USE_D3D_DESCR}") |
73 | endif() |
85bcc072 |
74 | |
9f33b387 |
75 | # include occt macros |
19286d7c |
76 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros") |
03c69aec |
77 | |
9f33b387 |
78 | # include the patched or original list of modules |
19286d7c |
79 | # list <MODULENAME>_TOOLKITS is created foreach module and contains its toolkits |
80 | # list <OCCT_MODULES> will contain all modules |
81 | OCCT_MODULES_AND_TOOLKITS (OCCT_MODULES) |
03c69aec |
82 | |
316d77d9 |
83 | foreach (OCCT_MODULE ${OCCT_MODULES}) |
84 | BUILD_MODULE (${OCCT_MODULE}) |
19286d7c |
85 | endforeach() |
86 | |
e713baee |
87 | if (ANDROID AND BUILD_MODULE_Draw) |
88 | message (STATUS "Info. Draw module is turned off due to it is not supported on Android") |
89 | set (BUILD_MODULE_Draw OFF CACHE BOOL "${BUILD_MODULE_Draw_DESCR}" FORCE) |
90 | endif() |
91 | |
adc33035 |
92 | # Overview |
316d77d9 |
93 | set (BUILD_DOC_OcctOverview OFF CACHE BOOL "${BUILD_DOC_OcctOverview_DESCR}") |
adc33035 |
94 | |
f60111dc |
95 | if (NOT USE_D3D) |
96 | list (REMOVE_ITEM Visualization_TOOLKITS TKD3DHost) |
97 | endif() |
98 | |
316d77d9 |
99 | # accumulate used toolkits (first level) in BUILD_TOOLKITS variable |
100 | list (APPEND BUILD_TOOLKITS ${BUILD_ADDITIONAL_TOOLKITS}) |
19286d7c |
101 | |
316d77d9 |
102 | foreach (OCCT_MODULE ${OCCT_MODULES}) |
103 | if (BUILD_MODULE_${OCCT_MODULE}) |
104 | list (APPEND BUILD_TOOLKITS ${${OCCT_MODULE}_TOOLKITS}) |
19286d7c |
105 | endif() |
106 | endforeach() |
107 | |
108 | # DRAWEXE excluded when library build is static |
109 | if (NOT BUILD_SHARED_LIBS) |
316d77d9 |
110 | list (REMOVE_ITEM BUILD_TOOLKITS DRAWEXE) |
19286d7c |
111 | message (STATUS "Info: DRAWEXE is not included due to ${BUILD_LIBRARY_TYPE} build library type") |
112 | endif() |
113 | |
114 | # accumulate all used toolkits |
316d77d9 |
115 | list (REMOVE_DUPLICATES BUILD_TOOLKITS) |
116 | set (RAW_BUILD_TOOLKITS) |
117 | foreach(BUILD_TOOLKIT ${BUILD_TOOLKITS}) |
118 | OCCT_TOOLKIT_FULL_DEP (${BUILD_TOOLKIT} TOOLKIT_FULL_DEPS) |
119 | list (APPEND RAW_BUILD_TOOLKITS ${BUILD_TOOLKIT} ${TOOLKIT_FULL_DEPS}) |
19286d7c |
120 | endforeach() |
121 | |
316d77d9 |
122 | list (REMOVE_DUPLICATES RAW_BUILD_TOOLKITS) |
123 | set (BUILD_TOOLKITS ${RAW_BUILD_TOOLKITS}) |
03c69aec |
124 | |
9f33b387 |
125 | # include the patched or original list of definitions and flags |
19286d7c |
126 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_defs_flags") |
03c69aec |
127 | |
19286d7c |
128 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/3rdparty_macro") |
03c69aec |
129 | |
a6874708 |
130 | # search for TKIVtk and TKIVtkDraw in BUILD_TOOLKITS |
131 | list (FIND BUILD_TOOLKITS TKIVtk CAN_USE_VTK) |
132 | if (CAN_USE_VTK EQUAL -1) |
133 | list (FIND BUILD_TOOLKITS TKIVtkDraw CAN_USE_VTK) |
134 | endif() |
135 | |
136 | if (NOT CAN_USE_VTK EQUAL -1) |
137 | if (NOT DEFINED USE_VTK) |
138 | set (USE_VTK OFF CACHE BOOL "${USE_VTK_DESCR}") |
139 | endif() |
140 | else() |
141 | OCCT_CHECK_AND_UNSET (USE_VTK) |
142 | endif() |
143 | |
5682a6fa |
144 | # Rebuild *.yacc and *.lex files that are contained by TKMath toolkit |
145 | list (FIND BUILD_TOOLKITS TKMath CAN_REBUILD_PDC_FOR_TKMATH) |
146 | list (FIND BUILD_TOOLKITS StepFile CAN_REBUILD_PDC_FOR_STEPFILE) |
147 | |
fb3267c7 |
148 | if (NOT ${CAN_REBUILD_PDC_FOR_TKMATH} EQUAL -1 OR NOT ${CAN_REBUILD_PDC_FOR_STEPFILE} EQUAL -1) |
5682a6fa |
149 | set (REBUILD_PLATFORM_DEPENDENT_CODE OFF CACHE BOOL "${REBUILD_PLATFORM_DEPENDENT_CODE_DESCR}") |
150 | else() |
151 | OCCT_CHECK_AND_UNSET (REBUILD_PLATFORM_DEPENDENT_CODE) |
152 | endif() |
153 | |
9f33b387 |
154 | if (NOT DEFINED 3RDPARTY_DIR) |
316d77d9 |
155 | set (3RDPARTY_DIR "" CACHE PATH ${3RDPARTY_DIR_DESCR}) |
e713baee |
156 | get_filename_component (3RDPARTY_DIR "${3RDPARTY_DIR}" ABSOLUTE) |
9f33b387 |
157 | endif() |
234e52be |
158 | |
9f33b387 |
159 | # search for CSF_TclLibs variable in EXTERNLIB of each being used toolkit |
f2e9c853 |
160 | OCCT_IS_PRODUCT_REQUIRED (CSF_TclLibs USE_TCL) |
03c69aec |
161 | |
fb3267c7 |
162 | if (USE_TCL) |
5682a6fa |
163 | message (STATUS "Info: TCL is used by OCCT") |
19286d7c |
164 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tcl") |
82f443b6 |
165 | |
166 | message (STATUS "Info: TK is used by OCCT") |
167 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tk") |
9f33b387 |
168 | else() |
9ccea0c6 |
169 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TCL") |
170 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TK") |
5682a6fa |
171 | |
172 | OCCT_CHECK_AND_UNSET ("INSTALL_TCL") |
82f443b6 |
173 | OCCT_CHECK_AND_UNSET ("INSTALL_TK") |
9f33b387 |
174 | endif() |
03c69aec |
175 | |
9f33b387 |
176 | # search for CSF_FREETYPE variable in EXTERNLIB of each being used toolkit |
f2e9c853 |
177 | OCCT_IS_PRODUCT_REQUIRED (CSF_FREETYPE USE_FREETYPE) |
03c69aec |
178 | |
fb3267c7 |
179 | if (USE_FREETYPE) |
5682a6fa |
180 | message (STATUS "Info: Freetype is used by OCCT") |
19286d7c |
181 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freetype") |
9f33b387 |
182 | else() |
9ccea0c6 |
183 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREETYPE") |
9f33b387 |
184 | OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2") |
185 | OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build") |
5682a6fa |
186 | OCCT_CHECK_AND_UNSET ("INSTALL_FREETYPE") |
9f33b387 |
187 | endif() |
03c69aec |
188 | |
09c597c9 |
189 | # VTK |
190 | if (USE_VTK) |
191 | add_definitions (-DHAVE_VTK) |
19286d7c |
192 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/vtk") |
f2e9c853 |
193 | else() |
194 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_VTK") |
a6874708 |
195 | |
196 | if (NOT CAN_USE_VTK EQUAL -1) |
197 | message (STATUS "Info: TKIVtk and TKIVtkDraw toolkits excluded due to VTK usage is disabled") |
198 | |
199 | list (REMOVE_ITEM BUILD_TOOLKITS TKIVtk) |
200 | list (REMOVE_ITEM BUILD_TOOLKITS TKIVtkDraw) |
201 | endif() |
09c597c9 |
202 | endif() |
203 | |
f60111dc |
204 | # D3D |
205 | if (USE_D3D) |
206 | add_definitions (-DHAVE_D3D) |
207 | #if(MSVC_VERSION LESS 1700) |
208 | #OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/d3d") |
209 | #endif() |
210 | endif() |
211 | |
09c597c9 |
212 | # GLX |
213 | if (USE_GLX) |
214 | add_definitions (-DMACOSX_USE_GLX) |
19286d7c |
215 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/glx") |
09c597c9 |
216 | endif() |
217 | |
03c69aec |
218 | # FREEIMAGE |
5682a6fa |
219 | # search for CSF_FREEIMAGE variable in EXTERNLIB of each being used toolkit |
220 | OCCT_IS_PRODUCT_REQUIRED (CSF_FREEIMAGE CAN_USE_FREEIMAGE) |
221 | OCCT_IS_PRODUCT_REQUIRED (CSF_FreeImagePlus CAN_USE_FREEIMAGEPLUS) |
222 | |
223 | if (CAN_USE_FREEIMAGE OR CAN_USE_FREEIMAGEPLUS) |
224 | set (USE_FREEIMAGE OFF CACHE BOOL "${USE_FREEIMAGE_DESCR}") |
225 | |
226 | if (USE_FREEIMAGE) |
227 | add_definitions (-DHAVE_FREEIMAGE) |
228 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freeimage") |
229 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freeimageplus") |
230 | else() |
231 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGE") |
232 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGEPLUS") |
233 | OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGE") |
234 | OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGEPLUS") |
235 | endif() |
9f33b387 |
236 | else() |
5682a6fa |
237 | OCCT_CHECK_AND_UNSET ("USE_FREEIMAGE") |
238 | |
9f33b387 |
239 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGE") |
240 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGEPLUS") |
241 | OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGE") |
242 | OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGEPLUS") |
243 | endif() |
03c69aec |
244 | |
245 | # GL2PS |
5682a6fa |
246 | # search for CSF_GL2PS variable in EXTERNLIB of each being used toolkit |
247 | OCCT_IS_PRODUCT_REQUIRED (CSF_GL2PS CAN_USE_GL2PS) |
248 | |
249 | if (NOT DEFINED ANDROID AND CAN_USE_GL2PS) |
250 | set (USE_GL2PS OFF CACHE BOOL "${USE_GL2PS_DESCR}") |
251 | |
252 | if (USE_GL2PS) |
253 | add_definitions (-DHAVE_GL2PS) |
254 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gl2ps") |
255 | else() |
256 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GL2PS") |
257 | OCCT_CHECK_AND_UNSET ("INSTALL_GL2PS") |
258 | endif() |
9f33b387 |
259 | else() |
5682a6fa |
260 | OCCT_CHECK_AND_UNSET ("USE_GL2PS") |
261 | |
9f33b387 |
262 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GL2PS") |
263 | OCCT_CHECK_AND_UNSET ("INSTALL_GL2PS") |
264 | endif() |
03c69aec |
265 | |
9f33b387 |
266 | # TBB |
5682a6fa |
267 | # search for CSF_TBB variable in EXTERNLIB of each being used toolkit |
268 | OCCT_IS_PRODUCT_REQUIRED (CSF_TBB CAN_USE_TBB) |
269 | |
270 | if (NOT DEFINED ANDROID AND CAN_USE_TBB) |
271 | set (USE_TBB OFF CACHE BOOL "${USE_TBB_DESCR}") |
272 | |
273 | if (USE_TBB) |
274 | add_definitions (-DHAVE_TBB) |
275 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tbb") |
276 | else() |
277 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB") |
278 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBBMALLOC") |
279 | OCCT_CHECK_AND_UNSET ("INSTALL_TBB") |
280 | endif() |
9f33b387 |
281 | else() |
5682a6fa |
282 | OCCT_CHECK_AND_UNSET ("USE_TBB") |
283 | |
9f33b387 |
284 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB") |
285 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBBMALLOC") |
286 | OCCT_CHECK_AND_UNSET ("INSTALL_TBB") |
287 | endif() |
234e52be |
288 | |
adc33035 |
289 | # Doxygen |
316d77d9 |
290 | if (BUILD_DOC_OcctOverview) |
291 | if (NOT DEFINED INSTALL_DOC_OcctOverview) |
292 | set (INSTALL_DOC_OcctOverview OFF CACHE BOOL "${INSTALL_DOC_OcctOverview_DESCR}") |
adc33035 |
293 | endif() |
294 | |
316d77d9 |
295 | if (INSTALL_DOC_OcctOverview) |
adc33035 |
296 | install (DIRECTORY "${CMAKE_BINARY_DIR}/doc/overview" DESTINATION "${INSTALL_DIR}/doc") |
f2e9c853 |
297 | |
298 | OCCT_INSTALL_FILE_OR_DIR ("dox/resources/overview.html" "${INSTALL_DIR}") |
adc33035 |
299 | endif() |
300 | |
301 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/doxygen") |
302 | else() |
316d77d9 |
303 | OCCT_CHECK_AND_UNSET ("INSTALL_DOC_OcctOverview") |
adc33035 |
304 | |
305 | OCCT_CHECK_AND_UNSET ("3RDPARTY_DOXYGEN_EXECUTABLE") |
306 | OCCT_CHECK_AND_UNSET ("3RDPARTY_DOXYGEN_DOT_EXECUTABLE") |
307 | endif() |
308 | |
316d77d9 |
309 | # bison |
310 | if (REBUILD_PLATFORM_DEPENDENT_CODE) |
311 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/bison") |
312 | else() |
313 | OCCT_CHECK_AND_UNSET ("3RDPARTY_BISON_EXECUTABLE") |
314 | endif() |
315 | |
316 | # flex |
317 | if (REBUILD_PLATFORM_DEPENDENT_CODE) |
318 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/flex") |
319 | else() |
320 | OCCT_CHECK_AND_UNSET ("3RDPARTY_FLEX_EXECUTABLE") |
321 | endif() |
322 | |
9f33b387 |
323 | string (REGEX REPLACE ";" " " 3RDPARTY_NOT_INCLUDED "${3RDPARTY_NOT_INCLUDED}") |
234e52be |
324 | |
9f33b387 |
325 | # check all 3rdparty paths |
326 | if (3RDPARTY_NOT_INCLUDED) |
327 | message (FATAL_ERROR "NOT FOUND: ${3RDPARTY_NOT_INCLUDED}" ) |
328 | endif() |
7c633a3e |
329 | |
9bb81d6c |
330 | if (3RDPARTY_INCLUDE_DIRS) |
331 | list (REMOVE_DUPLICATES 3RDPARTY_INCLUDE_DIRS) |
332 | string (REGEX REPLACE ";" "\n\t" 3RDPARTY_INCLUDE_DIRS_WITH_ENDS "${3RDPARTY_INCLUDE_DIRS}") |
a6874708 |
333 | message (STATUS "Info: The directories of 3rdparty headers: ${3RDPARTY_INCLUDE_DIRS_WITH_ENDS}") |
9bb81d6c |
334 | include_directories (${3RDPARTY_INCLUDE_DIRS}) |
335 | endif() |
336 | |
94829f84 |
337 | # include <cmake binary folder>/inc |
338 | include_directories (${CMAKE_BINARY_DIR}/inc) |
339 | |
9bb81d6c |
340 | if (3RDPARTY_LIBRARY_DIRS) |
341 | list (REMOVE_DUPLICATES 3RDPARTY_LIBRARY_DIRS) |
342 | string (REGEX REPLACE ";" "\n\t" 3RDPARTY_LIBRARY_DIRS_WITH_ENDS "${3RDPARTY_LIBRARY_DIRS}") |
a6874708 |
343 | message (STATUS "Info: The directories of 3rdparty libraries: ${3RDPARTY_LIBRARY_DIRS_WITH_ENDS}") |
9bb81d6c |
344 | link_directories (${3RDPARTY_LIBRARY_DIRS}) |
345 | endif() |
234e52be |
346 | |
fa0cbe55 |
347 | # Get all used variables: OS_WITH_BIT, COMPILER |
19286d7c |
348 | OCCT_MAKE_OS_WITH_BITNESS() |
349 | OCCT_MAKE_COMPILER_SHORT_NAME() |
03c69aec |
350 | |
9f33b387 |
351 | # build directories |
fa0cbe55 |
352 | set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib") |
353 | set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin") |
354 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib") |
19286d7c |
355 | |
316d77d9 |
356 | set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libi") |
357 | set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bini") |
358 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libi") |
19286d7c |
359 | |
fa0cbe55 |
360 | set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libd") |
361 | set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bind") |
362 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libd") |
19286d7c |
363 | |
fa0cbe55 |
364 | if (WIN32) |
f2e9c853 |
365 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin") |
366 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bini") |
367 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bind") |
19286d7c |
368 | endif() |
03c69aec |
369 | |
adc33035 |
370 | if ("${INSTALL_DIR}" STREQUAL "") |
371 | get_filename_component (CMAKE_BINARY_DIR_PARENT ${CMAKE_BINARY_DIR} DIRECTORY) |
372 | |
316d77d9 |
373 | set (INSTALL_DIR "${CMAKE_BINARY_DIR_PARENT}/install" CACHE PATH "${INSTALL_DIR_DESCR}" FORCE) |
adc33035 |
374 | set (CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE ) |
375 | |
376 | message (STATUS "Info: INSTALL_DIR has been set as ${INSTALL_DIR}") |
377 | endif() |
378 | |
d94d80e5 |
379 | string(TIMESTAMP CURRENT_TIME "%H:%M:%S") |
380 | message (STATUS "\nInfo: \(${CURRENT_TIME}\) Start collecting all OCCT header files into ${CMAKE_BINARY_DIR}/inc ...") |
94829f84 |
381 | |
94829f84 |
382 | # collect all the headers to <binary dir>/inc folder |
f2e9c853 |
383 | COLLECT_AND_INSTALL_OCCT_HEADER_FILES ("${CMAKE_BINARY_DIR}" "${BUILD_TOOLKITS}") |
94829f84 |
384 | |
d94d80e5 |
385 | string(TIMESTAMP CURRENT_TIME "%H:%M:%S") |
386 | message (STATUS "Info: \(${CURRENT_TIME}\) End the collecting") |
387 | |
910970ab |
388 | OCCT_INSTALL_FILE_OR_DIR ("data" "${INSTALL_DIR}") |
389 | OCCT_INSTALL_FILE_OR_DIR ("samples/tcl" "${INSTALL_DIR}/samples") |
03c69aec |
390 | |
0e617b05 |
391 | if (INSTALL_SAMPLES) |
910970ab |
392 | OCCT_INSTALL_FILE_OR_DIR ("samples" "${INSTALL_DIR}") |
393 | endif() |
03c69aec |
394 | |
0e617b05 |
395 | if (INSTALL_TEST_CASES) |
910970ab |
396 | OCCT_INSTALL_FILE_OR_DIR ("tests" "${INSTALL_DIR}") |
397 | endif() |
03c69aec |
398 | |
910970ab |
399 | if (WIN32) |
400 | set (SCRIPT_EXT bat) |
401 | else() |
402 | set (SCRIPT_EXT sh) |
403 | endif() |
03c69aec |
404 | |
910970ab |
405 | # DRAW.BAT or DRAW.SH |
f2e9c853 |
406 | if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/adm/templates/draw.${SCRIPT_EXT}") |
316d77d9 |
407 | install (FILES "${APPLY_OCCT_PATCH_DIR}/adm/templates/draw.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}" PERMISSIONS |
910970ab |
408 | OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE) |
409 | else() |
410 | install (FILES "${CMAKE_SOURCE_DIR}/adm/templates/draw.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}" PERMISSIONS |
411 | OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE) |
412 | endif() |
413 | OCCT_COPY_FILE_OR_DIR ("adm/templates/draw.${SCRIPT_EXT}" "${CMAKE_BINARY_DIR}") |
9f33b387 |
414 | |
316d77d9 |
415 | set (SUB_CUSTOM_NAME "custom_${COMPILER}_${COMPILER_BITNESS}.${SCRIPT_EXT}") |
9f33b387 |
416 | |
910970ab |
417 | if (WIN32) |
316d77d9 |
418 | set (ADDITIONAL_CUSTOM_CONTENT "\nif exist \"%~dp0${SUB_CUSTOM_NAME}\" (\n call \"%~dp0${SUB_CUSTOM_NAME}\" %VCVER% %ARCH% %CASDEB% \n)") |
910970ab |
419 | else() |
316d77d9 |
420 | set (ADDITIONAL_CUSTOM_CONTENT "\nif [ -e \"\${aScriptPath}/${SUB_CUSTOM_NAME}\" ]; then\n source \"\${aScriptPath}/${SUB_CUSTOM_NAME}\" \"\${COMPILER}\" \"\${WOKSTATION}\${ARCH}\" \"\${CASDEB}\" \nfi") |
910970ab |
421 | endif() |
32856b63 |
422 | |
910970ab |
423 | # change custom.bat/sh |
424 | if (EXISTS "${INSTALL_DIR}/custom.${SCRIPT_EXT}") |
425 | file (READ "${INSTALL_DIR}/custom.${SCRIPT_EXT}" CUSTOM_CONTENT) |
32856b63 |
426 | |
910970ab |
427 | set (CUSTOM_CONTENT "${CUSTOM_CONTENT} ${ADDITIONAL_CUSTOM_CONTENT}") |
32856b63 |
428 | |
910970ab |
429 | file (WRITE "${INSTALL_DIR}/custom.${SCRIPT_EXT}" "${CUSTOM_CONTENT}") |
430 | else() |
316d77d9 |
431 | OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.${SCRIPT_EXT}.main" "custom.${SCRIPT_EXT}" "custom.${SCRIPT_EXT}" "${INSTALL_DIR}") |
910970ab |
432 | endif() |
32856b63 |
433 | |
316d77d9 |
434 | # write current custom.bat/sh (for install directory) |
435 | set (SUB_CUSTOM_BUILD_NAME "custom_${COMPILER}_${COMPILER_BITNESS}.install.${SCRIPT_EXT}") |
436 | OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.install.${SCRIPT_EXT}.in" "${SUB_CUSTOM_BUILD_NAME}" "${SUB_CUSTOM_NAME}" "${INSTALL_DIR}") |
03c69aec |
437 | |
316d77d9 |
438 | # write current custom.bat/sh (for build directory) |
439 | OCCT_CONFIGURE ("adm/templates/custom.build.${SCRIPT_EXT}.in" "${SUB_CUSTOM_NAME}") |
440 | |
441 | if (BUILD_MODULE_OcctMfcSamples) |
910970ab |
442 | OCCT_INSTALL_FILE_OR_DIR ("adm/templates/sample.bat" "${INSTALL_DIR}") |
f2e9c853 |
443 | OCCT_COPY_FILE_OR_DIR ("adm/templates/sample.bat" "${CMAKE_BINARY_DIR}") |
9f33b387 |
444 | endif() |
445 | |
316d77d9 |
446 | # env script for draw in building environment |
910970ab |
447 | OCCT_CONFIGURE ("adm/templates/env.build.${SCRIPT_EXT}.in" "env.${SCRIPT_EXT}") |
316d77d9 |
448 | |
449 | # end script for draw in standalone environment |
450 | # release version |
451 | set (BUILD_LETTER "") |
452 | OCCT_CONFIGURE ("adm/templates/env.install.${SCRIPT_EXT}.in" "env.install.release.${SCRIPT_EXT}") |
453 | install (FILES "${CMAKE_BINARY_DIR}/env.install.release.${SCRIPT_EXT}" |
454 | CONFIGURATIONS Release |
455 | DESTINATION "${INSTALL_DIR}" |
456 | RENAME "env.${SCRIPT_EXT}") |
457 | |
458 | # debug version |
459 | set (BUILD_LETTER "d") |
460 | OCCT_CONFIGURE ("adm/templates/env.install.${SCRIPT_EXT}.in" "env.install.debug.${SCRIPT_EXT}") |
461 | install (FILES "${CMAKE_BINARY_DIR}/env.install.debug.${SCRIPT_EXT}" |
462 | CONFIGURATIONS Debug |
463 | DESTINATION "${INSTALL_DIR}" |
464 | RENAME "env.${SCRIPT_EXT}") |
465 | |
466 | # release with debug info version |
467 | set (BUILD_LETTER "i") |
468 | OCCT_CONFIGURE ("adm/templates/env.install.${SCRIPT_EXT}.in" "env.install.relwithdebinfo.${SCRIPT_EXT}") |
469 | install (FILES "${CMAKE_BINARY_DIR}/env.install.relwithdebinfo.${SCRIPT_EXT}" |
470 | CONFIGURATIONS RelWithDebInfo |
471 | DESTINATION "${INSTALL_DIR}" |
472 | RENAME "env.${SCRIPT_EXT}") |
473 | |
474 | # copy DrawAppliInit from OCCT source to build directory |
f2e9c853 |
475 | if (NOT EXISTS "${CMAKE_BINARY_DIR}/DrawAppliInit") |
476 | OCCT_COPY_FILE_OR_DIR (DrawAppliInit "${CMAKE_BINARY_DIR}") |
316d77d9 |
477 | endif() |
910970ab |
478 | |
9f33b387 |
479 | # RESOURCES |
19286d7c |
480 | FILE_TO_LIST ("adm/RESOURCES" RESOURCES) |
481 | foreach(RESOURCE ${RESOURCES}) |
482 | get_filename_component(RESOURCE_FOLDER ${RESOURCE} DIRECTORY) |
483 | if(NOT "${RESOURCE_FOLDER}" STREQUAL "") |
484 | get_filename_component(RESOURCE_FOLDER ${RESOURCE_FOLDER} NAME) |
485 | OCCT_INSTALL_FILE_OR_DIR ("src/${RESOURCE}" "${INSTALL_DIR}/src/${RESOURCE_FOLDER}") |
486 | else() |
487 | OCCT_INSTALL_FILE_OR_DIR ("src/${RESOURCE}" "${INSTALL_DIR}/src") |
488 | endif() |
489 | endforeach() |
03c69aec |
490 | |
fb3267c7 |
491 | # define CSF variable |
492 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_csf") |
493 | |
33839ae6 |
494 | # include patched toolkit projects or original ones |
316d77d9 |
495 | foreach (BUILD_TOOLKIT ${BUILD_TOOLKITS}) |
f2e9c853 |
496 | OCCT_ADD_SUBDIRECTORY ("src/${BUILD_TOOLKIT}") |
19286d7c |
497 | endforeach() |
234e52be |
498 | |
316d77d9 |
499 | if (BUILD_DOC_OcctOverview) |
f2e9c853 |
500 | OCCT_ADD_SUBDIRECTORY (dox) |
adc33035 |
501 | endif() |
502 | |
94829f84 |
503 | # patch DRAWEXE |
504 | if (MSVC AND 3RDPARTY_DLL_DIRS) |
316d77d9 |
505 | list (FIND BUILD_TOOLKITS DRAWEXE DRAWEXE_INDEX) |
94829f84 |
506 | if (${DRAWEXE_INDEX} GREATER -1) |
507 | list (REMOVE_DUPLICATES 3RDPARTY_DLL_DIRS) |
508 | set (3RDPARTY_DLL_DIRS_FOR_PATH "") |
509 | |
510 | foreach (3RDPARTY_DLL_DIR ${3RDPARTY_DLL_DIRS}) |
511 | set (3RDPARTY_DLL_DIRS_FOR_PATH "${3RDPARTY_DLL_DIRS_FOR_PATH};${3RDPARTY_DLL_DIR}") |
512 | endforeach() |
513 | |
514 | OCCT_MAKE_COMPILER_BITNESS() |
515 | set (X_COMPILER_BITNESS "x64") |
516 | if ("${COMPILER_BITNESS}" STREQUAL "32") |
517 | set (X_COMPILER_BITNESS "Win32") |
518 | endif() |
519 | |
f2e9c853 |
520 | OCCT_CONFIGURE ("adm/templates/DRAWEXE.vcxproj.user.in" "${CMAKE_BINARY_DIR}/src/DRAWEXE/DRAWEXE.vcxproj.user") |
94829f84 |
521 | endif() |
522 | endif() |
523 | |
33839ae6 |
524 | # samples do not support patch usage |
316d77d9 |
525 | if (BUILD_MODULE_OcctMfcSamples) |
19286d7c |
526 | set (OCCT_ROOT ${CMAKE_SOURCE_DIR}) |
234e52be |
527 | |
19286d7c |
528 | set (MFC_STANDARD_SAMPLES_DIR ${OCCT_ROOT}/samples/mfc/standard) |
529 | set (COMMON_WINMAIN_FILE ${MFC_STANDARD_SAMPLES_DIR}/Common/Winmain.cpp) |
234e52be |
530 | |
9f33b387 |
531 | add_subdirectory(samples/mfc/standard/mfcsample) |
532 | add_subdirectory(samples/mfc/standard/01_Geometry) |
533 | add_subdirectory(samples/mfc/standard/02_Modeling) |
534 | add_subdirectory(samples/mfc/standard/03_Viewer2d) |
535 | add_subdirectory(samples/mfc/standard/04_Viewer3d) |
536 | add_subdirectory(samples/mfc/standard/05_ImportExport) |
537 | add_subdirectory(samples/mfc/standard/06_Ocaf) |
538 | add_subdirectory(samples/mfc/standard/07_Triangulation) |
539 | add_subdirectory(samples/mfc/standard/08_HLR) |
540 | add_subdirectory(samples/mfc/standard/09_Animation) |
541 | add_subdirectory(samples/mfc/standard/10_Convert) |
19286d7c |
542 | endif() |