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