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 | |
60 | # group include files in folder install |
61 | set (INSTALL_GROUP_INC ON CACHE BOOL "In include files grouped in install folder") |
62 | |
63 | # copy samples to install directory |
64 | set (INSTALL_SAMPLES OFF CACHE BOOL "Copy samples to install directory") |
65 | |
9f33b387 |
66 | set (CMAKE_BUILD_TYPE ${BUILD_CONFIGURATION} CACHE INTERNAL "Build type of OCCT" FORCE ) |
03c69aec |
67 | |
9f33b387 |
68 | # install dir of the built project |
69 | set (INSTALL_DIR "" CACHE PATH "Directory that will contain install files of OCCT" ) |
70 | set (CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE ) |
03c69aec |
71 | |
19286d7c |
72 | set (BUILD_PATCH_DIR "" CACHE PATH "directory with occt patch") |
03c69aec |
73 | |
9f33b387 |
74 | # the list of being built toolkits |
ad211ad3 |
75 | set (BUILD_TOOLKITS "" CACHE STRING "Toolkits are also included in OCCT") |
9f33b387 |
76 | separate_arguments (BUILD_TOOLKITS) |
03c69aec |
77 | |
ad211ad3 |
78 | if (MSVC) |
9f33b387 |
79 | set (BUILD_MFC_SAMPLES OFF CACHE BOOL "OCCT samples building") |
85bcc072 |
80 | endif() |
81 | |
9f33b387 |
82 | # whether use optional 3rdparty or not |
83 | if (APPLE) |
84 | set (USE_GLX OFF CACHE BOOL "Are X11 OpenGL used on OSX or not") |
03c69aec |
85 | endif() |
85bcc072 |
86 | |
9f33b387 |
87 | set (USE_FREEIMAGE OFF CACHE BOOL "Is freeimage used or not") |
09c597c9 |
88 | set (USE_VTK OFF CACHE BOOL "Is VTK used or not") |
03c69aec |
89 | |
9f33b387 |
90 | if (NOT DEFINED ANDROID) |
91 | set (USE_GL2PS OFF CACHE BOOL "Is gl2ps used or not") |
92 | set (USE_TBB OFF CACHE BOOL "Is tbb used or not") |
19286d7c |
93 | #set (USE_OPENCL OFF CACHE BOOL "Is OpenCL used or not") |
03c69aec |
94 | endif() |
95 | |
9f33b387 |
96 | # macro: include patched file if it exists |
97 | macro (OCCT_INCLUDE_CMAKE_FILE BEING_INCLUDED_FILE) |
98 | if (NOT "${BUILD_PATCH_DIR}" STREQUAL "" AND EXISTS "${BUILD_PATCH_DIR}/${BEING_INCLUDED_FILE}.cmake") |
19286d7c |
99 | include (${BUILD_PATCH_DIR}/${BEING_INCLUDED_FILE}.cmake) |
d5aedb2c |
100 | else() |
19286d7c |
101 | include (${BEING_INCLUDED_FILE}.cmake) |
d5aedb2c |
102 | endif() |
9f33b387 |
103 | endmacro() |
03c69aec |
104 | |
9f33b387 |
105 | # include occt macros |
19286d7c |
106 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros") |
03c69aec |
107 | |
9f33b387 |
108 | # BUILD_POSTFIX variable is used by all toolkit cmakelists.txt projects |
109 | OCCT_MAKE_BUILD_POSTFIX() |
03c69aec |
110 | |
9f33b387 |
111 | # include the patched or original list of modules |
19286d7c |
112 | # list <MODULENAME>_TOOLKITS is created foreach module and contains its toolkits |
113 | # list <OCCT_MODULES> will contain all modules |
114 | OCCT_MODULES_AND_TOOLKITS (OCCT_MODULES) |
03c69aec |
115 | |
19286d7c |
116 | foreach (MODULE ${OCCT_MODULES}) |
117 | set (BUILD_${MODULE} ON CACHE BOOL "include ${MODULE}") |
118 | endforeach() |
119 | |
120 | if (NOT USE_VTK) |
121 | list (REMOVE_ITEM Visualization_TOOLKITS TKIVtk) |
122 | list (REMOVE_ITEM Draw_TOOLKITS TKIVtkDraw) |
123 | endif() |
124 | |
125 | # accumulate used toolkits (first level) in USED_TOOLKITS variable |
126 | list (APPEND USED_TOOLKITS ${BUILD_TOOLKITS}) |
127 | |
128 | foreach (MODULE ${OCCT_MODULES}) |
129 | if (BUILD_${MODULE}) |
130 | list (APPEND USED_TOOLKITS ${${MODULE}_TOOLKITS}) |
131 | endif() |
132 | endforeach() |
133 | |
134 | # DRAWEXE excluded when library build is static |
135 | if (NOT BUILD_SHARED_LIBS) |
136 | list (REMOVE_ITEM USED_TOOLKITS DRAWEXE) |
137 | message (STATUS "Info: DRAWEXE is not included due to ${BUILD_LIBRARY_TYPE} build library type") |
138 | endif() |
139 | |
140 | # accumulate all used toolkits |
141 | list (REMOVE_DUPLICATES USED_TOOLKITS) |
142 | set (RAW_USED_TOOLKIT) |
143 | foreach(USED_TOOLKIT ${USED_TOOLKITS}) |
144 | OCCT_TOOLKIT_FULL_DEP (${USED_TOOLKIT} TOOLKIT_FULL_DEPS) |
145 | list (APPEND RAW_USED_TOOLKIT ${USED_TOOLKIT} ${TOOLKIT_FULL_DEPS}) |
146 | endforeach() |
147 | |
148 | list (REMOVE_DUPLICATES RAW_USED_TOOLKIT) |
149 | set (USED_TOOLKITS ${RAW_USED_TOOLKIT}) |
03c69aec |
150 | |
9f33b387 |
151 | # include the patched or original list of definitions and flags |
19286d7c |
152 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_defs_flags") |
03c69aec |
153 | |
19286d7c |
154 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/3rdparty_macro") |
03c69aec |
155 | |
9f33b387 |
156 | set (3RDPARTY_DIR_LABEL "The directory containing required 3rdparty products") |
157 | if (NOT DEFINED 3RDPARTY_DIR) |
158 | set (3RDPARTY_DIR "" CACHE PATH ${3RDPARTY_DIR_LABEL}) |
159 | endif() |
03c69aec |
160 | |
9f33b387 |
161 | # search for 3rdparty dir |
162 | if ("${3RDPARTY_DIR}" STREQUAL "") |
163 | if (DEFINED ENV{3RDPARTY_DIR}) |
164 | set (3RDPARTY_DIR "$ENV{3RDPARTY_DIR}" CACHE PATH ${3RDPARTY_DIR_LABEL} FORCE) |
165 | elseif (EXISTS "${CMAKE_SOURCE_DIR}/../") |
166 | # in version 6.7.0 and above, occt parent directory contains 3rdparties |
9ccea0c6 |
167 | get_filename_component (3RDPARTY_DIR "${CMAKE_SOURCE_DIR}/../" ABSOLUTE) |
168 | set (3RDPARTY_DIR "${3RDPARTY_DIR}" CACHE PATH ${3RDPARTY_DIR_LABEL} FORCE) |
9f33b387 |
169 | endif() |
170 | endif() |
234e52be |
171 | |
9f33b387 |
172 | # search for CSF_TclLibs variable in EXTERNLIB of each being used toolkit |
173 | OCCT_IS_PRODUCT_REQUIRED(CSF_TclLibs USE_TCL) |
03c69aec |
174 | |
9f33b387 |
175 | if ("${USE_TCL}" STREQUAL ON) |
176 | message (STATUS "Info: tcl is used by OCCT") |
19286d7c |
177 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tcl") |
9f33b387 |
178 | else() |
9ccea0c6 |
179 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TCL") |
180 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TK") |
9f33b387 |
181 | endif() |
03c69aec |
182 | |
9f33b387 |
183 | # search for CSF_FREETYPE variable in EXTERNLIB of each being used toolkit |
184 | OCCT_IS_PRODUCT_REQUIRED(CSF_FREETYPE USE_FREETYPE) |
03c69aec |
185 | |
9f33b387 |
186 | if ("${USE_FREETYPE}" STREQUAL ON) |
187 | message (STATUS "Info: freetype is used by OCCT") |
19286d7c |
188 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freetype") |
9f33b387 |
189 | else() |
9ccea0c6 |
190 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREETYPE") |
9f33b387 |
191 | OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2") |
192 | OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build") |
9f33b387 |
193 | endif() |
03c69aec |
194 | |
09c597c9 |
195 | # VTK |
196 | if (USE_VTK) |
197 | add_definitions (-DHAVE_VTK) |
19286d7c |
198 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/vtk") |
09c597c9 |
199 | endif() |
200 | |
201 | # GLX |
202 | if (USE_GLX) |
203 | add_definitions (-DMACOSX_USE_GLX) |
19286d7c |
204 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/glx") |
09c597c9 |
205 | endif() |
206 | |
03c69aec |
207 | # FREEIMAGE |
9f33b387 |
208 | if (USE_FREEIMAGE) |
209 | add_definitions (-DHAVE_FREEIMAGE) |
19286d7c |
210 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freeimage") |
211 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freeimageplus") |
9f33b387 |
212 | else() |
213 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGE") |
214 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGEPLUS") |
215 | OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGE") |
216 | OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGEPLUS") |
217 | endif() |
03c69aec |
218 | |
219 | # GL2PS |
9f33b387 |
220 | if (USE_GL2PS) |
221 | add_definitions (-DHAVE_GL2PS) |
19286d7c |
222 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gl2ps") |
9f33b387 |
223 | else() |
224 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GL2PS") |
225 | OCCT_CHECK_AND_UNSET ("INSTALL_GL2PS") |
226 | endif() |
03c69aec |
227 | |
7c633a3e |
228 | # OPENCL |
19286d7c |
229 | #if (USE_OPENCL) |
230 | # add_definitions (-DHAVE_OPENCL) |
231 | # OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/opencl") |
232 | #else() |
233 | # OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_OPENCL") |
234 | # OCCT_CHECK_AND_UNSET ("3RDPARTY_OPENCL_ADDITIONAL_PATH_FOR_HEADER") |
235 | # OCCT_CHECK_AND_UNSET ("3RDPARTY_OPENCL_ADDITIONAL_PATH_FOR_LIB") |
236 | # OCCT_CHECK_AND_UNSET ("INSTALL_OPENCL") |
237 | #endif() |
234e52be |
238 | |
9f33b387 |
239 | # TBB |
240 | if (USE_TBB) |
9ccea0c6 |
241 | add_definitions (-DHAVE_TBB) |
19286d7c |
242 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tbb") |
9f33b387 |
243 | else() |
244 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB") |
245 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBBMALLOC") |
246 | OCCT_CHECK_AND_UNSET ("INSTALL_TBB") |
247 | endif() |
234e52be |
248 | |
9f33b387 |
249 | string (REGEX REPLACE ";" " " 3RDPARTY_NOT_INCLUDED "${3RDPARTY_NOT_INCLUDED}") |
234e52be |
250 | |
9f33b387 |
251 | # check all 3rdparty paths |
252 | if (3RDPARTY_NOT_INCLUDED) |
253 | message (FATAL_ERROR "NOT FOUND: ${3RDPARTY_NOT_INCLUDED}" ) |
254 | endif() |
7c633a3e |
255 | |
9bb81d6c |
256 | if (3RDPARTY_INCLUDE_DIRS) |
257 | list (REMOVE_DUPLICATES 3RDPARTY_INCLUDE_DIRS) |
258 | string (REGEX REPLACE ";" "\n\t" 3RDPARTY_INCLUDE_DIRS_WITH_ENDS "${3RDPARTY_INCLUDE_DIRS}") |
259 | message (STATUS "The directories containing 3rdparty headers: ${3RDPARTY_INCLUDE_DIRS_WITH_ENDS}") |
260 | include_directories (${3RDPARTY_INCLUDE_DIRS}) |
261 | endif() |
262 | |
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 | |
9f33b387 |
289 | if ("${INSTALL_DIR}" STREQUAL "") |
290 | message (FATAL_ERROR "INSTALL_DIR variable is empty. It's required to define installation directory") |
291 | else() |
19286d7c |
292 | |
9f33b387 |
293 | # inc,data,tests DIRECTORY |
19286d7c |
294 | file (GLOB DIRS RELATIVE ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/*) |
295 | foreach(CDIR ${DIRS}) |
296 | file(GLOB HFiles "${CMAKE_SOURCE_DIR}/src/${CDIR}/*.[hgl]xx" "${CMAKE_SOURCE_DIR}/src/${CDIR}/*.h") |
297 | set (GROUP_CDIR "") |
298 | if (INSTALL_GROUP_INC) |
299 | set (GROUP_CDIR ${CDIR}) |
300 | endif() |
301 | install(FILES ${HFiles} DESTINATION "${INSTALL_DIR}/inc/${GROUP_CDIR}") |
302 | endforeach(CDIR) |
303 | |
9f33b387 |
304 | install (DIRECTORY "${CMAKE_SOURCE_DIR}/data" DESTINATION "${INSTALL_DIR}") |
305 | install (DIRECTORY "${CMAKE_SOURCE_DIR}/samples/tcl" DESTINATION "${INSTALL_DIR}/samples") |
19286d7c |
306 | if (TESTS_INSTALL) |
9f33b387 |
307 | install (DIRECTORY "${CMAKE_SOURCE_DIR}/tests" DESTINATION "${INSTALL_DIR}" ) |
308 | endif() |
03c69aec |
309 | |
9f33b387 |
310 | # install patch inc, data, tests folder |
311 | if (NOT "${BUILD_PATCH_DIR}" STREQUAL "") |
312 | if (EXISTS "${BUILD_PATCH_DIR}/inc") |
313 | install (DIRECTORY "${BUILD_PATCH_DIR}/inc" DESTINATION "${INSTALL_DIR}" ) |
19286d7c |
314 | else() |
315 | file (GLOB DIRS RELATIVE ${BUILD_PATCH_DIR}/src ${BUILD_PATCH_DIR}/src/*) |
316 | foreach(CDIR ${DIRS}) |
317 | file(GLOB HFiles "${BUILD_PATCH_DIR}/src/${CDIR}/*.[hgl]xx" "${BUILD_PATCH_DIR}/src/${CDIR}/*.h") |
318 | if (INSTALL_GROUP_INC) |
319 | install(FILES ${HFiles} DESTINATION "${INSTALL_DIR}/inc/${CDIR}") |
320 | else() |
321 | install(FILES ${HFiles} DESTINATION "${INSTALL_DIR}/inc") |
322 | endif() |
323 | endforeach(CDIR) |
9f33b387 |
324 | endif() |
03c69aec |
325 | |
9f33b387 |
326 | if (EXISTS "${BUILD_PATCH_DIR}/data") |
327 | install (DIRECTORY "${BUILD_PATCH_DIR}/data" DESTINATION "${INSTALL_DIR}" ) |
328 | endif() |
03c69aec |
329 | |
19286d7c |
330 | if (TESTS_INSTALL) |
9f33b387 |
331 | if (EXISTS "${BUILD_PATCH_DIR}/tests") |
19286d7c |
332 | install (DIRECTORY "${BUILD_PATCH_DIR}/tests" DESTINATION "${INSTALL_DIR}" ) |
9f33b387 |
333 | endif() |
334 | endif() |
335 | endif() |
03c69aec |
336 | |
9f33b387 |
337 | if (WIN32) |
338 | set (SCRIPT_EXT bat) |
339 | else() |
340 | set (SCRIPT_EXT sh) |
341 | endif() |
03c69aec |
342 | |
19286d7c |
343 | # Creation of "START_TESTS" project |
344 | if (TESTS_RUN AND TESTS_INSTALL) |
345 | #set(BUILD_TESTING ON) |
346 | #enable_testing () |
347 | #add_test(NAME RUN_TESTS COMMAND ${INSTALL_DIR}/draw.${SCRIPT_EXT} -c testgrid -overwrite -outdir ${INSTALL_DIR}/TestResults) |
348 | add_custom_target(START_TESTS ${INSTALL_DIR}/draw.${SCRIPT_EXT} -c testgrid -overwrite -outdir ${INSTALL_DIR}/TestResults DEPENDS INSTALL) |
349 | endif() |
350 | |
351 | # Creation of "GenerateDocumentation" project |
352 | if (DOC_GENERATE_OVERVIEW OR DOC_GENERATE_REFMAN) |
353 | OCCT_INCLUDE_CMAKE_FILE("adm/cmake/occt_gendoc") |
354 | if(DOC_GENERATE_OVERVIEW) |
355 | gendoc(-overview -${DOC_OVERVIEW_OUTPUT_FORMAT}) |
356 | endif() |
357 | if(DOC_GENERATE_REFMAN) |
358 | gendoc(-refman -html) |
359 | endif() |
360 | endif() |
361 | |
362 | |
03c69aec |
363 | # DRAW.BAT or DRAW.SH |
19286d7c |
364 | if (NOT "${BUILD_PATCH_DIR}" STREQUAL "" AND EXISTS "${BUILD_PATCH_DIR}/adm/templates/draw.${SCRIPT_EXT}") |
9f33b387 |
365 | install(FILES "${BUILD_PATCH_DIR}/adm/templates/draw.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}" PERMISSIONS |
33839ae6 |
366 | OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE) |
19286d7c |
367 | else() |
9f33b387 |
368 | install(FILES "${CMAKE_SOURCE_DIR}/adm/templates/draw.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}" PERMISSIONS |
33839ae6 |
369 | OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE) |
19286d7c |
370 | endif() |
371 | OCCT_COPY_FILE_OR_DIR ("adm/templates/draw.${SCRIPT_EXT}" "${CMAKE_BINARY_DIR}") |
9f33b387 |
372 | |
19286d7c |
373 | set (SUB_CUSTOM "custom_${COMPILER}_${COMPILER_BITNESS}.${SCRIPT_EXT}") |
374 | if ("${BUILD_CONFIGURATION}" STREQUAL "Debug") |
375 | set (SUB_CUSTOM "custom_${COMPILER}_${COMPILER_BITNESS}_${BUILD_POSTFIX}.${SCRIPT_EXT}") |
376 | endif() |
9f33b387 |
377 | |
32856b63 |
378 | if (WIN32) |
19286d7c |
379 | set (ADDITIONAL_CUSTOM_CONTENT "\nif exist \"%~dp0${SUB_CUSTOM}\" (\n call \"%~dp0${SUB_CUSTOM}\" %1 %2 %3 \n)") |
32856b63 |
380 | else() |
19286d7c |
381 | set (ADDITIONAL_CUSTOM_CONTENT "\nif [ -e \"\${aScriptPath}/${SUB_CUSTOM}\" ]; then\n source \"\${aScriptPath}/${SUB_CUSTOM}\" \"\${COMPILER}\" \"\${WOKSTATION}\${ARCH}\" \"\${CASDEB}\" \nfi") |
32856b63 |
382 | endif() |
9f33b387 |
383 | |
19286d7c |
384 | # change custom.bat/sh |
32856b63 |
385 | if (EXISTS "${INSTALL_DIR}/custom.${SCRIPT_EXT}") |
9f33b387 |
386 | file (READ "${INSTALL_DIR}/custom.${SCRIPT_EXT}" CUSTOM_CONTENT) |
32856b63 |
387 | |
9f33b387 |
388 | set (CUSTOM_CONTENT "${CUSTOM_CONTENT} ${ADDITIONAL_CUSTOM_CONTENT}") |
32856b63 |
389 | |
9f33b387 |
390 | file (WRITE "${INSTALL_DIR}/custom.${SCRIPT_EXT}" "${CUSTOM_CONTENT}") |
32856b63 |
391 | else() |
9f33b387 |
392 | OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.${SCRIPT_EXT}.main" "custom.${SCRIPT_EXT}" "${INSTALL_DIR}") |
32856b63 |
393 | endif() |
394 | |
19286d7c |
395 | |
32856b63 |
396 | # write current custom.bat/sh |
9f33b387 |
397 | OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.${SCRIPT_EXT}.in" "${SUB_CUSTOM}" "${INSTALL_DIR}") |
32856b63 |
398 | |
9f33b387 |
399 | if (BUILD_MFC_SAMPLES) |
400 | OCCT_INSTALL_FILE_OR_DIR ("adm/templates/sample.bat" "${INSTALL_DIR}") |
19286d7c |
401 | OCCT_COPY_FILE_OR_DIR ("adm/templates/sample.bat" "${CMAKE_BINARY_DIR}") |
9f33b387 |
402 | endif() |
03c69aec |
403 | |
19286d7c |
404 | OCCT_CONFIGURE ("adm/templates/env.build.${SCRIPT_EXT}.in" "env.${SCRIPT_EXT}") |
405 | OCCT_CONFIGURE ("adm/templates/env.${SCRIPT_EXT}.in" "env.install.${SCRIPT_EXT}") |
406 | install(FILES "${CMAKE_BINARY_DIR}/env.install.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}" RENAME "env.${SCRIPT_EXT}") |
9f33b387 |
407 | endif() |
408 | |
409 | # RESOURCES |
19286d7c |
410 | FILE_TO_LIST ("adm/RESOURCES" RESOURCES) |
411 | foreach(RESOURCE ${RESOURCES}) |
412 | get_filename_component(RESOURCE_FOLDER ${RESOURCE} DIRECTORY) |
413 | if(NOT "${RESOURCE_FOLDER}" STREQUAL "") |
414 | get_filename_component(RESOURCE_FOLDER ${RESOURCE_FOLDER} NAME) |
415 | OCCT_INSTALL_FILE_OR_DIR ("src/${RESOURCE}" "${INSTALL_DIR}/src/${RESOURCE_FOLDER}") |
416 | else() |
417 | OCCT_INSTALL_FILE_OR_DIR ("src/${RESOURCE}" "${INSTALL_DIR}/src") |
418 | endif() |
419 | endforeach() |
03c69aec |
420 | |
33839ae6 |
421 | # include patched toolkit projects or original ones |
19286d7c |
422 | foreach (USED_TOOLKIT ${USED_TOOLKITS}) |
423 | if (NOT "${BUILD_PATCH_DIR}" STREQUAL "" AND EXISTS "${BUILD_PATCH_DIR}/src/${USED_TOOLKIT}") |
424 | add_subdirectory(${BUILD_PATCH_DIR}/src/${USED_TOOLKIT}) |
425 | elseif (EXISTS "${CMAKE_SOURCE_DIR}/src/${USED_TOOLKIT}") |
426 | add_subdirectory (${CMAKE_SOURCE_DIR}/src/${USED_TOOLKIT}) |
427 | else() |
428 | message (STATUS "${USED_TOOLKIT} is not included") |
429 | endif() |
430 | endforeach() |
234e52be |
431 | |
33839ae6 |
432 | # samples do not support patch usage |
19286d7c |
433 | if (BUILD_MFC_SAMPLES) |
434 | set (OCCT_ROOT ${CMAKE_SOURCE_DIR}) |
234e52be |
435 | |
19286d7c |
436 | set (MFC_STANDARD_SAMPLES_DIR ${OCCT_ROOT}/samples/mfc/standard) |
437 | set (COMMON_WINMAIN_FILE ${MFC_STANDARD_SAMPLES_DIR}/Common/Winmain.cpp) |
234e52be |
438 | |
9f33b387 |
439 | add_subdirectory(samples/mfc/standard/mfcsample) |
440 | add_subdirectory(samples/mfc/standard/01_Geometry) |
441 | add_subdirectory(samples/mfc/standard/02_Modeling) |
442 | add_subdirectory(samples/mfc/standard/03_Viewer2d) |
443 | add_subdirectory(samples/mfc/standard/04_Viewer3d) |
444 | add_subdirectory(samples/mfc/standard/05_ImportExport) |
445 | add_subdirectory(samples/mfc/standard/06_Ocaf) |
446 | add_subdirectory(samples/mfc/standard/07_Triangulation) |
447 | add_subdirectory(samples/mfc/standard/08_HLR) |
448 | add_subdirectory(samples/mfc/standard/09_Animation) |
449 | add_subdirectory(samples/mfc/standard/10_Convert) |
19286d7c |
450 | endif() |
451 | |
452 | if (INSTALL_SAMPLES) |
453 | OCCT_INSTALL_FILE_OR_DIR ("samples" "${INSTALL_DIR}") |
454 | endif() |