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