0024816: Tool for upgrading OCCT and dependent code
[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# Tests
26set (TESTS_RUN OFF CACHE BOOL "Run tests or not")
27set (TESTS_INSTALL OFF CACHE BOOL "Copy tests to folder install")
28set (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)
31set (BUILD_BISON_FLEX_FILES OFF CACHE BOOL "Build *.yacc/*.lex files")
32if (${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()
42endif()
43
19286d7c 44# copy samples to install directory
94829f84 45set (INSTALL_SAMPLES OFF CACHE BOOL "Copy OCCT samples to install directory")
19286d7c 46
9f33b387 47# install dir of the built project
48set (INSTALL_DIR "" CACHE PATH "Directory that will contain install files of OCCT" )
49set (CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE )
03c69aec 50
19286d7c 51set (BUILD_PATCH_DIR "" CACHE PATH "directory with occt patch")
03c69aec 52
9f33b387 53# the list of being built toolkits
ad211ad3 54set (BUILD_TOOLKITS "" CACHE STRING "Toolkits are also included in OCCT")
9f33b387 55separate_arguments (BUILD_TOOLKITS)
03c69aec 56
ad211ad3 57if (MSVC)
9f33b387 58 set (BUILD_MFC_SAMPLES OFF CACHE BOOL "OCCT samples building")
85bcc072 59endif()
60
9f33b387 61# whether use optional 3rdparty or not
62if (APPLE)
63 set (USE_GLX OFF CACHE BOOL "Are X11 OpenGL used on OSX or not")
03c69aec 64endif()
85bcc072 65
9f33b387 66set (USE_FREEIMAGE OFF CACHE BOOL "Is freeimage used or not")
09c597c9 67set (USE_VTK OFF CACHE BOOL "Is VTK used or not")
03c69aec 68
9f33b387 69if (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 73endif()
74
9f33b387 75# macro: include patched file if it exists
76macro (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 82endmacro()
03c69aec 83
9f33b387 84# include occt macros
19286d7c 85OCCT_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
90OCCT_MODULES_AND_TOOLKITS (OCCT_MODULES)
03c69aec 91
19286d7c 92foreach (MODULE ${OCCT_MODULES})
93 set (BUILD_${MODULE} ON CACHE BOOL "include ${MODULE}")
94endforeach()
95
adc33035 96# Overview
97set (BUILD_OCCT_OVERVIEW OFF CACHE BOOL "Build OCCT overview in HTML format")
98
19286d7c 99if (NOT USE_VTK)
100 list (REMOVE_ITEM Visualization_TOOLKITS TKIVtk)
101 list (REMOVE_ITEM Draw_TOOLKITS TKIVtkDraw)
102endif()
103
104# accumulate used toolkits (first level) in USED_TOOLKITS variable
105list (APPEND USED_TOOLKITS ${BUILD_TOOLKITS})
106
107foreach (MODULE ${OCCT_MODULES})
108 if (BUILD_${MODULE})
109 list (APPEND USED_TOOLKITS ${${MODULE}_TOOLKITS})
110 endif()
111endforeach()
112
113# DRAWEXE excluded when library build is static
114if (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")
117endif()
118
119# accumulate all used toolkits
120list (REMOVE_DUPLICATES USED_TOOLKITS)
121set (RAW_USED_TOOLKIT)
122foreach(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})
125endforeach()
126
127list (REMOVE_DUPLICATES RAW_USED_TOOLKIT)
128set (USED_TOOLKITS ${RAW_USED_TOOLKIT})
03c69aec 129
9f33b387 130# include the patched or original list of definitions and flags
19286d7c 131OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_defs_flags")
03c69aec 132
19286d7c 133OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/3rdparty_macro")
03c69aec 134
9f33b387 135set (3RDPARTY_DIR_LABEL "The directory containing required 3rdparty products")
136if (NOT DEFINED 3RDPARTY_DIR)
137 set (3RDPARTY_DIR "" CACHE PATH ${3RDPARTY_DIR_LABEL})
138endif()
03c69aec 139
9f33b387 140# search for 3rdparty dir
141if ("${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()
149endif()
234e52be 150
9f33b387 151# search for CSF_TclLibs variable in EXTERNLIB of each being used toolkit
152OCCT_IS_PRODUCT_REQUIRED(CSF_TclLibs USE_TCL)
03c69aec 153
9f33b387 154if ("${USE_TCL}" STREQUAL ON)
155 message (STATUS "Info: tcl is used by OCCT")
19286d7c 156 OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tcl")
9f33b387 157else()
9ccea0c6 158 OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TCL")
159 OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TK")
9f33b387 160endif()
03c69aec 161
9f33b387 162# search for CSF_FREETYPE variable in EXTERNLIB of each being used toolkit
163OCCT_IS_PRODUCT_REQUIRED(CSF_FREETYPE USE_FREETYPE)
03c69aec 164
9f33b387 165if ("${USE_FREETYPE}" STREQUAL ON)
166 message (STATUS "Info: freetype is used by OCCT")
19286d7c 167 OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freetype")
9f33b387 168else()
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 172endif()
03c69aec 173
09c597c9 174# VTK
175if (USE_VTK)
176 add_definitions (-DHAVE_VTK)
19286d7c 177 OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/vtk")
09c597c9 178endif()
179
180# GLX
181if (USE_GLX)
182 add_definitions (-DMACOSX_USE_GLX)
19286d7c 183 OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/glx")
09c597c9 184endif()
185
03c69aec 186# FREEIMAGE
9f33b387 187if (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 191else()
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")
196endif()
03c69aec 197
198# GL2PS
9f33b387 199if (USE_GL2PS)
200 add_definitions (-DHAVE_GL2PS)
19286d7c 201 OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gl2ps")
9f33b387 202else()
203 OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GL2PS")
204 OCCT_CHECK_AND_UNSET ("INSTALL_GL2PS")
205endif()
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
219if (USE_TBB)
9ccea0c6 220 add_definitions (-DHAVE_TBB)
19286d7c 221 OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tbb")
9f33b387 222else()
223 OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB")
224 OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBBMALLOC")
225 OCCT_CHECK_AND_UNSET ("INSTALL_TBB")
226endif()
234e52be 227
adc33035 228# Doxygen
229if (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")
240else()
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")
245endif()
246
9f33b387 247string (REGEX REPLACE ";" " " 3RDPARTY_NOT_INCLUDED "${3RDPARTY_NOT_INCLUDED}")
234e52be 248
9f33b387 249# check all 3rdparty paths
250if (3RDPARTY_NOT_INCLUDED)
251 message (FATAL_ERROR "NOT FOUND: ${3RDPARTY_NOT_INCLUDED}" )
252endif()
7c633a3e 253
9bb81d6c 254if (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})
259endif()
260
94829f84 261# include <cmake binary folder>/inc
262include_directories (${CMAKE_BINARY_DIR}/inc)
263
9bb81d6c 264if (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})
269endif()
234e52be 270
fa0cbe55 271# Get all used variables: OS_WITH_BIT, COMPILER
19286d7c 272OCCT_MAKE_OS_WITH_BITNESS()
273OCCT_MAKE_COMPILER_SHORT_NAME()
03c69aec 274
9f33b387 275# build directories
fa0cbe55 276set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
277set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin")
278set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
19286d7c 279
fa0cbe55 280set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
281set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin")
282set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
19286d7c 283
fa0cbe55 284set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libd")
285set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bind")
286set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libd")
19286d7c 287
fa0cbe55 288if (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 291endif()
03c69aec 292
adc33035 293if ("${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}")
300endif()
301
94829f84 302message (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
306COLLECT_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 312OCCT_INSTALL_FILE_OR_DIR ("data" "${INSTALL_DIR}")
313OCCT_INSTALL_FILE_OR_DIR ("samples/tcl" "${INSTALL_DIR}/samples")
03c69aec 314
910970ab 315if (INSTALL_SAMPLES)
316 OCCT_INSTALL_FILE_OR_DIR ("samples" "${INSTALL_DIR}")
317endif()
03c69aec 318
910970ab 319if (TESTS_INSTALL)
320 OCCT_INSTALL_FILE_OR_DIR ("tests" "${INSTALL_DIR}")
321endif()
03c69aec 322
910970ab 323if (WIN32)
324 set (SCRIPT_EXT bat)
325else()
326 set (SCRIPT_EXT sh)
327endif()
03c69aec 328
910970ab 329# Creation of "START_TESTS" project
330if (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)
335endif()
19286d7c 336
910970ab 337# DRAW.BAT or DRAW.SH
338if (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)
341else()
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)
344endif()
345OCCT_COPY_FILE_OR_DIR ("adm/templates/draw.${SCRIPT_EXT}" "${CMAKE_BINARY_DIR}")
9f33b387 346
910970ab 347set (SUB_CUSTOM "custom_${COMPILER}_${COMPILER_BITNESS}.${SCRIPT_EXT}")
9f33b387 348
910970ab 349if (WIN32)
350 set (ADDITIONAL_CUSTOM_CONTENT "\nif exist \"%~dp0${SUB_CUSTOM}\" (\n call \"%~dp0${SUB_CUSTOM}\" %VCVER% %ARCH% %CASDEB% \n)")
351else()
352 set (ADDITIONAL_CUSTOM_CONTENT "\nif [ -e \"\${aScriptPath}/${SUB_CUSTOM}\" ]; then\n source \"\${aScriptPath}/${SUB_CUSTOM}\" \"\${COMPILER}\" \"\${WOKSTATION}\${ARCH}\" \"\${CASDEB}\" \nfi")
353endif()
32856b63 354
910970ab 355 # change custom.bat/sh
356if (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}")
362else()
363 OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.${SCRIPT_EXT}.main" "custom.${SCRIPT_EXT}" "${INSTALL_DIR}")
364endif()
32856b63 365
910970ab 366# write current custom.bat/sh
367OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.${SCRIPT_EXT}.in" "${SUB_CUSTOM}" "${INSTALL_DIR}")
03c69aec 368
910970ab 369if (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 372endif()
373
910970ab 374OCCT_CONFIGURE ("adm/templates/env.build.${SCRIPT_EXT}.in" "env.${SCRIPT_EXT}")
375OCCT_CONFIGURE ("adm/templates/env.${SCRIPT_EXT}.in" "env.install.${SCRIPT_EXT}")
376install (FILES "${CMAKE_BINARY_DIR}/env.install.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}" RENAME "env.${SCRIPT_EXT}")
377
9f33b387 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
adc33035 401if (BUILD_OCCT_OVERVIEW)
402 add_subdirectory (dox)
403endif()
404
94829f84 405# patch DRAWEXE
406if (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()
424endif()
425
33839ae6 426# samples do not support patch usage
19286d7c 427if (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 444endif()