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