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