19286d7c |
1 | cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR) |
166d6cd7 |
2 | |
576f8b11 |
3 | set (CMAKE_SUPPRESS_REGENERATION TRUE) |
4 | |
9f33b387 |
5 | # set build configurations list |
ad211ad3 |
6 | if (NOT BUILD_CONFIGURATION) |
9f33b387 |
7 | set (BUILD_CONFIGURATION "Release" CACHE STRING "Build type of OCCT" FORCE) |
ad211ad3 |
8 | SET_PROPERTY(CACHE BUILD_CONFIGURATION PROPERTY STRINGS Release Debug RelWithDebInfo) |
03c69aec |
9 | endif() |
166d6cd7 |
10 | |
9f33b387 |
11 | set (CMAKE_CONFIGURATION_TYPES ${BUILD_CONFIGURATION} CACHE INTERNAL "" FORCE) |
03c69aec |
12 | |
c259930b |
13 | # set type of OCCT libraries |
14 | if (NOT BUILD_LIBRARY_TYPE) |
15 | set (BUILD_LIBRARY_TYPE "Shared" CACHE STRING "The type of OCCT libraries" FORCE) |
16 | SET_PROPERTY(CACHE BUILD_LIBRARY_TYPE PROPERTY STRINGS Shared Static) |
17 | endif() |
18 | |
19 | if ("${BUILD_LIBRARY_TYPE}" STREQUAL "Shared") |
20 | set (BUILD_SHARED_LIBS ON) |
21 | else() |
22 | unset (BUILD_SHARED_LIBS) |
23 | endif() |
24 | |
9f33b387 |
25 | # the name of the project |
26 | project (OCCT) |
03c69aec |
27 | |
9f33b387 |
28 | # Solution folder property |
29 | set_property (GLOBAL PROPERTY USE_FOLDERS ON) |
03c69aec |
30 | |
19286d7c |
31 | # Generate documentation |
32 | # Overview and User Guides |
33 | set (DOC_GENERATE_OVERVIEW OFF CACHE BOOL "Generate Overview and User Guides") |
34 | if (NOT DOC_OVERVIEW_OUTPUT_FORMAT) |
35 | set (DOC_OVERVIEW_OUTPUT_FORMAT "html" CACHE STRING "Output format of Overview and User Guides" FORCE) |
36 | SET_PROPERTY (CACHE DOC_OVERVIEW_OUTPUT_FORMAT PROPERTY STRINGS html chm pdf) |
37 | endif() |
38 | # class Reference Manual |
39 | set (DOC_GENERATE_REFMAN OFF CACHE BOOL "Generate class Reference Manual") |
40 | |
41 | # Tests |
42 | set (TESTS_RUN OFF CACHE BOOL "Run tests or not") |
43 | set (TESTS_INSTALL OFF CACHE BOOL "Copy tests to folder install") |
44 | set (TESTS_SHAPES_DIR "" CACHE PATH "Directory that will contain shapes for tests" ) |
45 | |
46 | # Find Bison and Flex executables to rebuild *.yacc and *.lex files if it is necessary (BUILD_BISON_FLEX_FILES is ON) |
47 | set (BUILD_BISON_FLEX_FILES OFF CACHE BOOL "Build *.yacc/*.lex files") |
48 | if (${BUILD_BISON_FLEX_FILES}) |
49 | foreach (aTool BISON FLEX) |
50 | list (APPEND CMAKE_PROGRAM_PATH ${BUILD_BISON_FLEX_DIR}) |
51 | find_package (${aTool}) |
52 | if (NOT ${${aTool}_FOUND}) |
53 | message ("Warning : set BUILD_BISON_FLEX_DIR directory") |
54 | set (BUILD_BISON_FLEX_DIR "" CACHE PATH "Filepath to BISON and FLEX executables") |
55 | set (BUILD_BISON_FLEX_FILES OFF) |
56 | endif() |
57 | endforeach() |
58 | endif() |
59 | |
19286d7c |
60 | # copy samples to install directory |
94829f84 |
61 | set (INSTALL_SAMPLES OFF CACHE BOOL "Copy OCCT samples to install directory") |
19286d7c |
62 | |
9f33b387 |
63 | set (CMAKE_BUILD_TYPE ${BUILD_CONFIGURATION} CACHE INTERNAL "Build type of OCCT" FORCE ) |
03c69aec |
64 | |
9f33b387 |
65 | # install dir of the built project |
66 | set (INSTALL_DIR "" CACHE PATH "Directory that will contain install files of OCCT" ) |
67 | set (CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE ) |
03c69aec |
68 | |
19286d7c |
69 | set (BUILD_PATCH_DIR "" CACHE PATH "directory with occt patch") |
03c69aec |
70 | |
9f33b387 |
71 | # the list of being built toolkits |
ad211ad3 |
72 | set (BUILD_TOOLKITS "" CACHE STRING "Toolkits are also included in OCCT") |
9f33b387 |
73 | separate_arguments (BUILD_TOOLKITS) |
03c69aec |
74 | |
ad211ad3 |
75 | if (MSVC) |
9f33b387 |
76 | set (BUILD_MFC_SAMPLES OFF CACHE BOOL "OCCT samples building") |
85bcc072 |
77 | endif() |
78 | |
9f33b387 |
79 | # whether use optional 3rdparty or not |
80 | if (APPLE) |
81 | set (USE_GLX OFF CACHE BOOL "Are X11 OpenGL used on OSX or not") |
03c69aec |
82 | endif() |
85bcc072 |
83 | |
9f33b387 |
84 | set (USE_FREEIMAGE OFF CACHE BOOL "Is freeimage used or not") |
09c597c9 |
85 | set (USE_VTK OFF CACHE BOOL "Is VTK used or not") |
03c69aec |
86 | |
9f33b387 |
87 | if (NOT DEFINED ANDROID) |
88 | set (USE_GL2PS OFF CACHE BOOL "Is gl2ps used or not") |
89 | set (USE_TBB OFF CACHE BOOL "Is tbb used or not") |
19286d7c |
90 | #set (USE_OPENCL OFF CACHE BOOL "Is OpenCL used or not") |
03c69aec |
91 | endif() |
92 | |
9f33b387 |
93 | # macro: include patched file if it exists |
94 | macro (OCCT_INCLUDE_CMAKE_FILE BEING_INCLUDED_FILE) |
95 | if (NOT "${BUILD_PATCH_DIR}" STREQUAL "" AND EXISTS "${BUILD_PATCH_DIR}/${BEING_INCLUDED_FILE}.cmake") |
19286d7c |
96 | include (${BUILD_PATCH_DIR}/${BEING_INCLUDED_FILE}.cmake) |
d5aedb2c |
97 | else() |
19286d7c |
98 | include (${BEING_INCLUDED_FILE}.cmake) |
d5aedb2c |
99 | endif() |
9f33b387 |
100 | endmacro() |
03c69aec |
101 | |
9f33b387 |
102 | # include occt macros |
19286d7c |
103 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros") |
03c69aec |
104 | |
9f33b387 |
105 | # BUILD_POSTFIX variable is used by all toolkit cmakelists.txt projects |
106 | OCCT_MAKE_BUILD_POSTFIX() |
03c69aec |
107 | |
9f33b387 |
108 | # include the patched or original list of modules |
19286d7c |
109 | # list <MODULENAME>_TOOLKITS is created foreach module and contains its toolkits |
110 | # list <OCCT_MODULES> will contain all modules |
111 | OCCT_MODULES_AND_TOOLKITS (OCCT_MODULES) |
03c69aec |
112 | |
19286d7c |
113 | foreach (MODULE ${OCCT_MODULES}) |
114 | set (BUILD_${MODULE} ON CACHE BOOL "include ${MODULE}") |
115 | endforeach() |
116 | |
117 | if (NOT USE_VTK) |
118 | list (REMOVE_ITEM Visualization_TOOLKITS TKIVtk) |
119 | list (REMOVE_ITEM Draw_TOOLKITS TKIVtkDraw) |
120 | endif() |
121 | |
122 | # accumulate used toolkits (first level) in USED_TOOLKITS variable |
123 | list (APPEND USED_TOOLKITS ${BUILD_TOOLKITS}) |
124 | |
125 | foreach (MODULE ${OCCT_MODULES}) |
126 | if (BUILD_${MODULE}) |
127 | list (APPEND USED_TOOLKITS ${${MODULE}_TOOLKITS}) |
128 | endif() |
129 | endforeach() |
130 | |
131 | # DRAWEXE excluded when library build is static |
132 | if (NOT BUILD_SHARED_LIBS) |
133 | list (REMOVE_ITEM USED_TOOLKITS DRAWEXE) |
134 | message (STATUS "Info: DRAWEXE is not included due to ${BUILD_LIBRARY_TYPE} build library type") |
135 | endif() |
136 | |
137 | # accumulate all used toolkits |
138 | list (REMOVE_DUPLICATES USED_TOOLKITS) |
139 | set (RAW_USED_TOOLKIT) |
140 | foreach(USED_TOOLKIT ${USED_TOOLKITS}) |
141 | OCCT_TOOLKIT_FULL_DEP (${USED_TOOLKIT} TOOLKIT_FULL_DEPS) |
142 | list (APPEND RAW_USED_TOOLKIT ${USED_TOOLKIT} ${TOOLKIT_FULL_DEPS}) |
143 | endforeach() |
144 | |
145 | list (REMOVE_DUPLICATES RAW_USED_TOOLKIT) |
146 | set (USED_TOOLKITS ${RAW_USED_TOOLKIT}) |
03c69aec |
147 | |
9f33b387 |
148 | # include the patched or original list of definitions and flags |
19286d7c |
149 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_defs_flags") |
03c69aec |
150 | |
19286d7c |
151 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/3rdparty_macro") |
03c69aec |
152 | |
9f33b387 |
153 | set (3RDPARTY_DIR_LABEL "The directory containing required 3rdparty products") |
154 | if (NOT DEFINED 3RDPARTY_DIR) |
155 | set (3RDPARTY_DIR "" CACHE PATH ${3RDPARTY_DIR_LABEL}) |
156 | endif() |
03c69aec |
157 | |
9f33b387 |
158 | # search for 3rdparty dir |
159 | if ("${3RDPARTY_DIR}" STREQUAL "") |
160 | if (DEFINED ENV{3RDPARTY_DIR}) |
161 | set (3RDPARTY_DIR "$ENV{3RDPARTY_DIR}" CACHE PATH ${3RDPARTY_DIR_LABEL} FORCE) |
162 | elseif (EXISTS "${CMAKE_SOURCE_DIR}/../") |
163 | # in version 6.7.0 and above, occt parent directory contains 3rdparties |
9ccea0c6 |
164 | get_filename_component (3RDPARTY_DIR "${CMAKE_SOURCE_DIR}/../" ABSOLUTE) |
165 | set (3RDPARTY_DIR "${3RDPARTY_DIR}" CACHE PATH ${3RDPARTY_DIR_LABEL} FORCE) |
9f33b387 |
166 | endif() |
167 | endif() |
234e52be |
168 | |
9f33b387 |
169 | # search for CSF_TclLibs variable in EXTERNLIB of each being used toolkit |
170 | OCCT_IS_PRODUCT_REQUIRED(CSF_TclLibs USE_TCL) |
03c69aec |
171 | |
9f33b387 |
172 | if ("${USE_TCL}" STREQUAL ON) |
173 | message (STATUS "Info: tcl is used by OCCT") |
19286d7c |
174 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tcl") |
9f33b387 |
175 | else() |
9ccea0c6 |
176 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TCL") |
177 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TK") |
9f33b387 |
178 | endif() |
03c69aec |
179 | |
9f33b387 |
180 | # search for CSF_FREETYPE variable in EXTERNLIB of each being used toolkit |
181 | OCCT_IS_PRODUCT_REQUIRED(CSF_FREETYPE USE_FREETYPE) |
03c69aec |
182 | |
9f33b387 |
183 | if ("${USE_FREETYPE}" STREQUAL ON) |
184 | message (STATUS "Info: freetype is used by OCCT") |
19286d7c |
185 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freetype") |
9f33b387 |
186 | else() |
9ccea0c6 |
187 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREETYPE") |
9f33b387 |
188 | OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2") |
189 | OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build") |
9f33b387 |
190 | endif() |
03c69aec |
191 | |
09c597c9 |
192 | # VTK |
193 | if (USE_VTK) |
194 | add_definitions (-DHAVE_VTK) |
19286d7c |
195 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/vtk") |
09c597c9 |
196 | endif() |
197 | |
198 | # GLX |
199 | if (USE_GLX) |
200 | add_definitions (-DMACOSX_USE_GLX) |
19286d7c |
201 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/glx") |
09c597c9 |
202 | endif() |
203 | |
03c69aec |
204 | # FREEIMAGE |
9f33b387 |
205 | if (USE_FREEIMAGE) |
206 | add_definitions (-DHAVE_FREEIMAGE) |
19286d7c |
207 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freeimage") |
208 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freeimageplus") |
9f33b387 |
209 | else() |
210 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGE") |
211 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGEPLUS") |
212 | OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGE") |
213 | OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGEPLUS") |
214 | endif() |
03c69aec |
215 | |
216 | # GL2PS |
9f33b387 |
217 | if (USE_GL2PS) |
218 | add_definitions (-DHAVE_GL2PS) |
19286d7c |
219 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gl2ps") |
9f33b387 |
220 | else() |
221 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GL2PS") |
222 | OCCT_CHECK_AND_UNSET ("INSTALL_GL2PS") |
223 | endif() |
03c69aec |
224 | |
7c633a3e |
225 | # OPENCL |
19286d7c |
226 | #if (USE_OPENCL) |
227 | # add_definitions (-DHAVE_OPENCL) |
228 | # OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/opencl") |
229 | #else() |
230 | # OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_OPENCL") |
231 | # OCCT_CHECK_AND_UNSET ("3RDPARTY_OPENCL_ADDITIONAL_PATH_FOR_HEADER") |
232 | # OCCT_CHECK_AND_UNSET ("3RDPARTY_OPENCL_ADDITIONAL_PATH_FOR_LIB") |
233 | # OCCT_CHECK_AND_UNSET ("INSTALL_OPENCL") |
234 | #endif() |
234e52be |
235 | |
9f33b387 |
236 | # TBB |
237 | if (USE_TBB) |
9ccea0c6 |
238 | add_definitions (-DHAVE_TBB) |
19286d7c |
239 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tbb") |
9f33b387 |
240 | else() |
241 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB") |
242 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBBMALLOC") |
243 | OCCT_CHECK_AND_UNSET ("INSTALL_TBB") |
244 | endif() |
234e52be |
245 | |
9f33b387 |
246 | string (REGEX REPLACE ";" " " 3RDPARTY_NOT_INCLUDED "${3RDPARTY_NOT_INCLUDED}") |
234e52be |
247 | |
9f33b387 |
248 | # check all 3rdparty paths |
249 | if (3RDPARTY_NOT_INCLUDED) |
250 | message (FATAL_ERROR "NOT FOUND: ${3RDPARTY_NOT_INCLUDED}" ) |
251 | endif() |
7c633a3e |
252 | |
9bb81d6c |
253 | if (3RDPARTY_INCLUDE_DIRS) |
254 | list (REMOVE_DUPLICATES 3RDPARTY_INCLUDE_DIRS) |
255 | string (REGEX REPLACE ";" "\n\t" 3RDPARTY_INCLUDE_DIRS_WITH_ENDS "${3RDPARTY_INCLUDE_DIRS}") |
256 | message (STATUS "The directories containing 3rdparty headers: ${3RDPARTY_INCLUDE_DIRS_WITH_ENDS}") |
257 | include_directories (${3RDPARTY_INCLUDE_DIRS}) |
258 | endif() |
259 | |
94829f84 |
260 | # include <cmake binary folder>/inc |
261 | include_directories (${CMAKE_BINARY_DIR}/inc) |
262 | |
9bb81d6c |
263 | if (3RDPARTY_LIBRARY_DIRS) |
264 | list (REMOVE_DUPLICATES 3RDPARTY_LIBRARY_DIRS) |
265 | string (REGEX REPLACE ";" "\n\t" 3RDPARTY_LIBRARY_DIRS_WITH_ENDS "${3RDPARTY_LIBRARY_DIRS}") |
266 | message (STATUS "The directories containing 3rdparty libraries: ${3RDPARTY_LIBRARY_DIRS_WITH_ENDS}") |
267 | link_directories (${3RDPARTY_LIBRARY_DIRS}) |
268 | endif() |
234e52be |
269 | |
19286d7c |
270 | # Get all used variables: OS_WITH_BIT, COMPILER, BUILD_POSTFIX |
9f33b387 |
271 | OCCT_MAKE_BUILD_POSTFIX() |
19286d7c |
272 | OCCT_MAKE_OS_WITH_BITNESS() |
273 | OCCT_MAKE_COMPILER_SHORT_NAME() |
03c69aec |
274 | |
9f33b387 |
275 | # build directories |
19286d7c |
276 | string (TOUPPER "${BUILD_CONFIGURATION}" TAIL_OF_OUTPUT_VARNAME) |
277 | |
278 | set (OUTPUT_LIBRARY_DIR ${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BUILD_POSTFIX}) |
279 | set (OUTPUT_BINARY_DIR ${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BUILD_POSTFIX}) |
280 | |
281 | set ("CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${TAIL_OF_OUTPUT_VARNAME}" "${OUTPUT_LIBRARY_DIR}") |
282 | set ("CMAKE_RUNTIME_OUTPUT_DIRECTORY_${TAIL_OF_OUTPUT_VARNAME}" "${OUTPUT_BINARY_DIR}") |
283 | set ("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${TAIL_OF_OUTPUT_VARNAME}" "${OUTPUT_LIBRARY_DIR}") |
284 | |
285 | if (WIN32) |
286 | set ("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${TAIL_OF_OUTPUT_VARNAME}" "${OUTPUT_BINARY_DIR}") |
287 | endif() |
03c69aec |
288 | |
94829f84 |
289 | message (STATUS "\nInfo: Collecting all OCCT header files into ${CMAKE_BINARY_DIR}/inc ...") |
290 | |
291 | # (!) patch is not taken into account COLLECT_AND_INSTALL_OCCT_HEADER_FILES |
292 | # collect all the headers to <binary dir>/inc folder |
293 | COLLECT_AND_INSTALL_OCCT_HEADER_FILES ("${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/adm/templates/header.in" "${CMAKE_BINARY_DIR}" "${USED_TOOLKITS}") |
294 | # apply patched header files |
295 | #if (NOT "${BUILD_PATCH_DIR}" STREQUAL "") |
296 | # COLLECT_AND_INSTALL_OCCT_HEADER_FILES ("${BUILD_PATCH_DIR}" "${CMAKE_SOURCE_DIR}/adm/templates/header.in" "${CMAKE_BINARY_DIR}") |
297 | #endif() |
298 | |
9f33b387 |
299 | if ("${INSTALL_DIR}" STREQUAL "") |
300 | message (FATAL_ERROR "INSTALL_DIR variable is empty. It's required to define installation directory") |
301 | else() |
19286d7c |
302 | |
03c69aec |
303 | |
94829f84 |
304 | OCCT_INSTALL_FILE_OR_DIR ("data" "${INSTALL_DIR}") |
305 | OCCT_INSTALL_FILE_OR_DIR ("samples/tcl" "${INSTALL_DIR}/samples") |
03c69aec |
306 | |
94829f84 |
307 | if (INSTALL_SAMPLES) |
308 | OCCT_INSTALL_FILE_OR_DIR ("samples" "${INSTALL_DIR}") |
309 | endif() |
03c69aec |
310 | |
94829f84 |
311 | if (TESTS_INSTALL) |
312 | OCCT_INSTALL_FILE_OR_DIR ("tests" "${INSTALL_DIR}") |
9f33b387 |
313 | endif() |
03c69aec |
314 | |
9f33b387 |
315 | if (WIN32) |
316 | set (SCRIPT_EXT bat) |
317 | else() |
318 | set (SCRIPT_EXT sh) |
319 | endif() |
03c69aec |
320 | |
19286d7c |
321 | # Creation of "START_TESTS" project |
322 | if (TESTS_RUN AND TESTS_INSTALL) |
323 | #set(BUILD_TESTING ON) |
324 | #enable_testing () |
325 | #add_test(NAME RUN_TESTS COMMAND ${INSTALL_DIR}/draw.${SCRIPT_EXT} -c testgrid -overwrite -outdir ${INSTALL_DIR}/TestResults) |
326 | add_custom_target(START_TESTS ${INSTALL_DIR}/draw.${SCRIPT_EXT} -c testgrid -overwrite -outdir ${INSTALL_DIR}/TestResults DEPENDS INSTALL) |
327 | endif() |
328 | |
329 | # Creation of "GenerateDocumentation" project |
330 | if (DOC_GENERATE_OVERVIEW OR DOC_GENERATE_REFMAN) |
331 | OCCT_INCLUDE_CMAKE_FILE("adm/cmake/occt_gendoc") |
332 | if(DOC_GENERATE_OVERVIEW) |
333 | gendoc(-overview -${DOC_OVERVIEW_OUTPUT_FORMAT}) |
334 | endif() |
335 | if(DOC_GENERATE_REFMAN) |
336 | gendoc(-refman -html) |
337 | endif() |
338 | endif() |
339 | |
03c69aec |
340 | # DRAW.BAT or DRAW.SH |
19286d7c |
341 | if (NOT "${BUILD_PATCH_DIR}" STREQUAL "" AND EXISTS "${BUILD_PATCH_DIR}/adm/templates/draw.${SCRIPT_EXT}") |
9f33b387 |
342 | install(FILES "${BUILD_PATCH_DIR}/adm/templates/draw.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}" PERMISSIONS |
33839ae6 |
343 | OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE) |
19286d7c |
344 | else() |
9f33b387 |
345 | install(FILES "${CMAKE_SOURCE_DIR}/adm/templates/draw.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}" PERMISSIONS |
33839ae6 |
346 | OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE) |
19286d7c |
347 | endif() |
348 | OCCT_COPY_FILE_OR_DIR ("adm/templates/draw.${SCRIPT_EXT}" "${CMAKE_BINARY_DIR}") |
9f33b387 |
349 | |
19286d7c |
350 | set (SUB_CUSTOM "custom_${COMPILER}_${COMPILER_BITNESS}.${SCRIPT_EXT}") |
351 | if ("${BUILD_CONFIGURATION}" STREQUAL "Debug") |
352 | set (SUB_CUSTOM "custom_${COMPILER}_${COMPILER_BITNESS}_${BUILD_POSTFIX}.${SCRIPT_EXT}") |
353 | endif() |
9f33b387 |
354 | |
32856b63 |
355 | if (WIN32) |
19286d7c |
356 | set (ADDITIONAL_CUSTOM_CONTENT "\nif exist \"%~dp0${SUB_CUSTOM}\" (\n call \"%~dp0${SUB_CUSTOM}\" %1 %2 %3 \n)") |
32856b63 |
357 | else() |
19286d7c |
358 | set (ADDITIONAL_CUSTOM_CONTENT "\nif [ -e \"\${aScriptPath}/${SUB_CUSTOM}\" ]; then\n source \"\${aScriptPath}/${SUB_CUSTOM}\" \"\${COMPILER}\" \"\${WOKSTATION}\${ARCH}\" \"\${CASDEB}\" \nfi") |
32856b63 |
359 | endif() |
9f33b387 |
360 | |
19286d7c |
361 | # change custom.bat/sh |
32856b63 |
362 | if (EXISTS "${INSTALL_DIR}/custom.${SCRIPT_EXT}") |
9f33b387 |
363 | file (READ "${INSTALL_DIR}/custom.${SCRIPT_EXT}" CUSTOM_CONTENT) |
32856b63 |
364 | |
9f33b387 |
365 | set (CUSTOM_CONTENT "${CUSTOM_CONTENT} ${ADDITIONAL_CUSTOM_CONTENT}") |
32856b63 |
366 | |
9f33b387 |
367 | file (WRITE "${INSTALL_DIR}/custom.${SCRIPT_EXT}" "${CUSTOM_CONTENT}") |
32856b63 |
368 | else() |
9f33b387 |
369 | OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.${SCRIPT_EXT}.main" "custom.${SCRIPT_EXT}" "${INSTALL_DIR}") |
32856b63 |
370 | endif() |
371 | |
372 | # write current custom.bat/sh |
9f33b387 |
373 | OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.${SCRIPT_EXT}.in" "${SUB_CUSTOM}" "${INSTALL_DIR}") |
32856b63 |
374 | |
9f33b387 |
375 | if (BUILD_MFC_SAMPLES) |
376 | OCCT_INSTALL_FILE_OR_DIR ("adm/templates/sample.bat" "${INSTALL_DIR}") |
19286d7c |
377 | OCCT_COPY_FILE_OR_DIR ("adm/templates/sample.bat" "${CMAKE_BINARY_DIR}") |
9f33b387 |
378 | endif() |
03c69aec |
379 | |
19286d7c |
380 | OCCT_CONFIGURE ("adm/templates/env.build.${SCRIPT_EXT}.in" "env.${SCRIPT_EXT}") |
381 | OCCT_CONFIGURE ("adm/templates/env.${SCRIPT_EXT}.in" "env.install.${SCRIPT_EXT}") |
382 | install(FILES "${CMAKE_BINARY_DIR}/env.install.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}" RENAME "env.${SCRIPT_EXT}") |
9f33b387 |
383 | endif() |
384 | |
385 | # RESOURCES |
19286d7c |
386 | FILE_TO_LIST ("adm/RESOURCES" RESOURCES) |
387 | foreach(RESOURCE ${RESOURCES}) |
388 | get_filename_component(RESOURCE_FOLDER ${RESOURCE} DIRECTORY) |
389 | if(NOT "${RESOURCE_FOLDER}" STREQUAL "") |
390 | get_filename_component(RESOURCE_FOLDER ${RESOURCE_FOLDER} NAME) |
391 | OCCT_INSTALL_FILE_OR_DIR ("src/${RESOURCE}" "${INSTALL_DIR}/src/${RESOURCE_FOLDER}") |
392 | else() |
393 | OCCT_INSTALL_FILE_OR_DIR ("src/${RESOURCE}" "${INSTALL_DIR}/src") |
394 | endif() |
395 | endforeach() |
03c69aec |
396 | |
33839ae6 |
397 | # include patched toolkit projects or original ones |
19286d7c |
398 | foreach (USED_TOOLKIT ${USED_TOOLKITS}) |
399 | if (NOT "${BUILD_PATCH_DIR}" STREQUAL "" AND EXISTS "${BUILD_PATCH_DIR}/src/${USED_TOOLKIT}") |
400 | add_subdirectory(${BUILD_PATCH_DIR}/src/${USED_TOOLKIT}) |
401 | elseif (EXISTS "${CMAKE_SOURCE_DIR}/src/${USED_TOOLKIT}") |
402 | add_subdirectory (${CMAKE_SOURCE_DIR}/src/${USED_TOOLKIT}) |
403 | else() |
404 | message (STATUS "${USED_TOOLKIT} is not included") |
405 | endif() |
406 | endforeach() |
234e52be |
407 | |
94829f84 |
408 | # patch DRAWEXE |
409 | if (MSVC AND 3RDPARTY_DLL_DIRS) |
410 | list (FIND USED_TOOLKITS DRAWEXE DRAWEXE_INDEX) |
411 | if (${DRAWEXE_INDEX} GREATER -1) |
412 | list (REMOVE_DUPLICATES 3RDPARTY_DLL_DIRS) |
413 | set (3RDPARTY_DLL_DIRS_FOR_PATH "") |
414 | |
415 | foreach (3RDPARTY_DLL_DIR ${3RDPARTY_DLL_DIRS}) |
416 | set (3RDPARTY_DLL_DIRS_FOR_PATH "${3RDPARTY_DLL_DIRS_FOR_PATH};${3RDPARTY_DLL_DIR}") |
417 | endforeach() |
418 | |
419 | OCCT_MAKE_COMPILER_BITNESS() |
420 | set (X_COMPILER_BITNESS "x64") |
421 | if ("${COMPILER_BITNESS}" STREQUAL "32") |
422 | set (X_COMPILER_BITNESS "Win32") |
423 | endif() |
424 | |
425 | configure_file (${CMAKE_SOURCE_DIR}/adm/templates/DRAWEXE.vcxproj.user.in ${CMAKE_BINARY_DIR}/src/DRAWEXE/DRAWEXE.vcxproj.user @ONLY) |
426 | endif() |
427 | endif() |
428 | |
33839ae6 |
429 | # samples do not support patch usage |
19286d7c |
430 | if (BUILD_MFC_SAMPLES) |
431 | set (OCCT_ROOT ${CMAKE_SOURCE_DIR}) |
234e52be |
432 | |
19286d7c |
433 | set (MFC_STANDARD_SAMPLES_DIR ${OCCT_ROOT}/samples/mfc/standard) |
434 | set (COMMON_WINMAIN_FILE ${MFC_STANDARD_SAMPLES_DIR}/Common/Winmain.cpp) |
234e52be |
435 | |
9f33b387 |
436 | add_subdirectory(samples/mfc/standard/mfcsample) |
437 | add_subdirectory(samples/mfc/standard/01_Geometry) |
438 | add_subdirectory(samples/mfc/standard/02_Modeling) |
439 | add_subdirectory(samples/mfc/standard/03_Viewer2d) |
440 | add_subdirectory(samples/mfc/standard/04_Viewer3d) |
441 | add_subdirectory(samples/mfc/standard/05_ImportExport) |
442 | add_subdirectory(samples/mfc/standard/06_Ocaf) |
443 | add_subdirectory(samples/mfc/standard/07_Triangulation) |
444 | add_subdirectory(samples/mfc/standard/08_HLR) |
445 | add_subdirectory(samples/mfc/standard/09_Animation) |
446 | add_subdirectory(samples/mfc/standard/10_Convert) |
19286d7c |
447 | endif() |