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