| 1 | cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR) |
| 2 | |
| 3 | set (CMAKE_SUPPRESS_REGENERATION TRUE) |
| 4 | |
| 5 | # set build configurations list |
| 6 | if (NOT BUILD_CONFIGURATION) |
| 7 | set (BUILD_CONFIGURATION "Release" CACHE STRING "Build type of OCCT" FORCE) |
| 8 | SET_PROPERTY(CACHE BUILD_CONFIGURATION PROPERTY STRINGS Release Debug RelWithDebInfo) |
| 9 | endif() |
| 10 | |
| 11 | set (CMAKE_CONFIGURATION_TYPES ${BUILD_CONFIGURATION} CACHE INTERNAL "" FORCE) |
| 12 | |
| 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 | |
| 25 | # the name of the project |
| 26 | project (OCCT) |
| 27 | |
| 28 | # Solution folder property |
| 29 | set_property (GLOBAL PROPERTY USE_FOLDERS ON) |
| 30 | |
| 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 | |
| 66 | set (CMAKE_BUILD_TYPE ${BUILD_CONFIGURATION} CACHE INTERNAL "Build type of OCCT" FORCE ) |
| 67 | |
| 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 ) |
| 71 | |
| 72 | set (BUILD_PATCH_DIR "" CACHE PATH "directory with occt patch") |
| 73 | |
| 74 | # the list of being built toolkits |
| 75 | set (BUILD_TOOLKITS "" CACHE STRING "Toolkits are also included in OCCT") |
| 76 | separate_arguments (BUILD_TOOLKITS) |
| 77 | |
| 78 | if (MSVC) |
| 79 | set (BUILD_MFC_SAMPLES OFF CACHE BOOL "OCCT samples building") |
| 80 | endif() |
| 81 | |
| 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") |
| 85 | endif() |
| 86 | |
| 87 | set (USE_FREEIMAGE OFF CACHE BOOL "Is freeimage used or not") |
| 88 | set (USE_VTK OFF CACHE BOOL "Is VTK used or not") |
| 89 | |
| 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") |
| 93 | #set (USE_OPENCL OFF CACHE BOOL "Is OpenCL used or not") |
| 94 | endif() |
| 95 | |
| 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") |
| 99 | include (${BUILD_PATCH_DIR}/${BEING_INCLUDED_FILE}.cmake) |
| 100 | else() |
| 101 | include (${BEING_INCLUDED_FILE}.cmake) |
| 102 | endif() |
| 103 | endmacro() |
| 104 | |
| 105 | # include occt macros |
| 106 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros") |
| 107 | |
| 108 | # BUILD_POSTFIX variable is used by all toolkit cmakelists.txt projects |
| 109 | OCCT_MAKE_BUILD_POSTFIX() |
| 110 | |
| 111 | # include the patched or original list of modules |
| 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) |
| 115 | |
| 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}) |
| 150 | |
| 151 | # include the patched or original list of definitions and flags |
| 152 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_defs_flags") |
| 153 | |
| 154 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/3rdparty_macro") |
| 155 | |
| 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() |
| 160 | |
| 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 |
| 167 | get_filename_component (3RDPARTY_DIR "${CMAKE_SOURCE_DIR}/../" ABSOLUTE) |
| 168 | set (3RDPARTY_DIR "${3RDPARTY_DIR}" CACHE PATH ${3RDPARTY_DIR_LABEL} FORCE) |
| 169 | endif() |
| 170 | endif() |
| 171 | |
| 172 | # search for CSF_TclLibs variable in EXTERNLIB of each being used toolkit |
| 173 | OCCT_IS_PRODUCT_REQUIRED(CSF_TclLibs USE_TCL) |
| 174 | |
| 175 | if ("${USE_TCL}" STREQUAL ON) |
| 176 | message (STATUS "Info: tcl is used by OCCT") |
| 177 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tcl") |
| 178 | else() |
| 179 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TCL") |
| 180 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TK") |
| 181 | endif() |
| 182 | |
| 183 | # search for CSF_FREETYPE variable in EXTERNLIB of each being used toolkit |
| 184 | OCCT_IS_PRODUCT_REQUIRED(CSF_FREETYPE USE_FREETYPE) |
| 185 | |
| 186 | if ("${USE_FREETYPE}" STREQUAL ON) |
| 187 | message (STATUS "Info: freetype is used by OCCT") |
| 188 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freetype") |
| 189 | else() |
| 190 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREETYPE") |
| 191 | OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2") |
| 192 | OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build") |
| 193 | endif() |
| 194 | |
| 195 | # VTK |
| 196 | if (USE_VTK) |
| 197 | add_definitions (-DHAVE_VTK) |
| 198 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/vtk") |
| 199 | endif() |
| 200 | |
| 201 | # GLX |
| 202 | if (USE_GLX) |
| 203 | add_definitions (-DMACOSX_USE_GLX) |
| 204 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/glx") |
| 205 | endif() |
| 206 | |
| 207 | # FREEIMAGE |
| 208 | if (USE_FREEIMAGE) |
| 209 | add_definitions (-DHAVE_FREEIMAGE) |
| 210 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freeimage") |
| 211 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freeimageplus") |
| 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() |
| 218 | |
| 219 | # GL2PS |
| 220 | if (USE_GL2PS) |
| 221 | add_definitions (-DHAVE_GL2PS) |
| 222 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gl2ps") |
| 223 | else() |
| 224 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GL2PS") |
| 225 | OCCT_CHECK_AND_UNSET ("INSTALL_GL2PS") |
| 226 | endif() |
| 227 | |
| 228 | # OPENCL |
| 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() |
| 238 | |
| 239 | # TBB |
| 240 | if (USE_TBB) |
| 241 | add_definitions (-DHAVE_TBB) |
| 242 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tbb") |
| 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() |
| 248 | |
| 249 | string (REGEX REPLACE ";" " " 3RDPARTY_NOT_INCLUDED "${3RDPARTY_NOT_INCLUDED}") |
| 250 | |
| 251 | # check all 3rdparty paths |
| 252 | if (3RDPARTY_NOT_INCLUDED) |
| 253 | message (FATAL_ERROR "NOT FOUND: ${3RDPARTY_NOT_INCLUDED}" ) |
| 254 | endif() |
| 255 | |
| 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() |
| 269 | |
| 270 | # Get all used variables: OS_WITH_BIT, COMPILER, BUILD_POSTFIX |
| 271 | OCCT_MAKE_BUILD_POSTFIX() |
| 272 | OCCT_MAKE_OS_WITH_BITNESS() |
| 273 | OCCT_MAKE_COMPILER_SHORT_NAME() |
| 274 | |
| 275 | # build directories |
| 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() |
| 288 | |
| 289 | if ("${INSTALL_DIR}" STREQUAL "") |
| 290 | message (FATAL_ERROR "INSTALL_DIR variable is empty. It's required to define installation directory") |
| 291 | else() |
| 292 | |
| 293 | # inc,data,tests DIRECTORY |
| 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 | |
| 304 | install (DIRECTORY "${CMAKE_SOURCE_DIR}/data" DESTINATION "${INSTALL_DIR}") |
| 305 | install (DIRECTORY "${CMAKE_SOURCE_DIR}/samples/tcl" DESTINATION "${INSTALL_DIR}/samples") |
| 306 | if (TESTS_INSTALL) |
| 307 | install (DIRECTORY "${CMAKE_SOURCE_DIR}/tests" DESTINATION "${INSTALL_DIR}" ) |
| 308 | endif() |
| 309 | |
| 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}" ) |
| 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) |
| 324 | endif() |
| 325 | |
| 326 | if (EXISTS "${BUILD_PATCH_DIR}/data") |
| 327 | install (DIRECTORY "${BUILD_PATCH_DIR}/data" DESTINATION "${INSTALL_DIR}" ) |
| 328 | endif() |
| 329 | |
| 330 | if (TESTS_INSTALL) |
| 331 | if (EXISTS "${BUILD_PATCH_DIR}/tests") |
| 332 | install (DIRECTORY "${BUILD_PATCH_DIR}/tests" DESTINATION "${INSTALL_DIR}" ) |
| 333 | endif() |
| 334 | endif() |
| 335 | endif() |
| 336 | |
| 337 | if (WIN32) |
| 338 | set (SCRIPT_EXT bat) |
| 339 | else() |
| 340 | set (SCRIPT_EXT sh) |
| 341 | endif() |
| 342 | |
| 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 | |
| 363 | # DRAW.BAT or DRAW.SH |
| 364 | if (NOT "${BUILD_PATCH_DIR}" STREQUAL "" AND EXISTS "${BUILD_PATCH_DIR}/adm/templates/draw.${SCRIPT_EXT}") |
| 365 | install(FILES "${BUILD_PATCH_DIR}/adm/templates/draw.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}" PERMISSIONS |
| 366 | OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE) |
| 367 | else() |
| 368 | install(FILES "${CMAKE_SOURCE_DIR}/adm/templates/draw.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}" PERMISSIONS |
| 369 | OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE) |
| 370 | endif() |
| 371 | OCCT_COPY_FILE_OR_DIR ("adm/templates/draw.${SCRIPT_EXT}" "${CMAKE_BINARY_DIR}") |
| 372 | |
| 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() |
| 377 | |
| 378 | if (WIN32) |
| 379 | set (ADDITIONAL_CUSTOM_CONTENT "\nif exist \"%~dp0${SUB_CUSTOM}\" (\n call \"%~dp0${SUB_CUSTOM}\" %1 %2 %3 \n)") |
| 380 | else() |
| 381 | set (ADDITIONAL_CUSTOM_CONTENT "\nif [ -e \"\${aScriptPath}/${SUB_CUSTOM}\" ]; then\n source \"\${aScriptPath}/${SUB_CUSTOM}\" \"\${COMPILER}\" \"\${WOKSTATION}\${ARCH}\" \"\${CASDEB}\" \nfi") |
| 382 | endif() |
| 383 | |
| 384 | # change custom.bat/sh |
| 385 | if (EXISTS "${INSTALL_DIR}/custom.${SCRIPT_EXT}") |
| 386 | file (READ "${INSTALL_DIR}/custom.${SCRIPT_EXT}" CUSTOM_CONTENT) |
| 387 | |
| 388 | set (CUSTOM_CONTENT "${CUSTOM_CONTENT} ${ADDITIONAL_CUSTOM_CONTENT}") |
| 389 | |
| 390 | file (WRITE "${INSTALL_DIR}/custom.${SCRIPT_EXT}" "${CUSTOM_CONTENT}") |
| 391 | else() |
| 392 | OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.${SCRIPT_EXT}.main" "custom.${SCRIPT_EXT}" "${INSTALL_DIR}") |
| 393 | endif() |
| 394 | |
| 395 | |
| 396 | # write current custom.bat/sh |
| 397 | OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.${SCRIPT_EXT}.in" "${SUB_CUSTOM}" "${INSTALL_DIR}") |
| 398 | |
| 399 | if (BUILD_MFC_SAMPLES) |
| 400 | OCCT_INSTALL_FILE_OR_DIR ("adm/templates/sample.bat" "${INSTALL_DIR}") |
| 401 | OCCT_COPY_FILE_OR_DIR ("adm/templates/sample.bat" "${CMAKE_BINARY_DIR}") |
| 402 | endif() |
| 403 | |
| 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}") |
| 407 | endif() |
| 408 | |
| 409 | # RESOURCES |
| 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() |
| 420 | |
| 421 | # include patched toolkit projects or original ones |
| 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() |
| 431 | |
| 432 | # samples do not support patch usage |
| 433 | if (BUILD_MFC_SAMPLES) |
| 434 | set (OCCT_ROOT ${CMAKE_SOURCE_DIR}) |
| 435 | |
| 436 | set (MFC_STANDARD_SAMPLES_DIR ${OCCT_ROOT}/samples/mfc/standard) |
| 437 | set (COMMON_WINMAIN_FILE ${MFC_STANDARD_SAMPLES_DIR}/Common/Winmain.cpp) |
| 438 | |
| 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) |
| 450 | endif() |
| 451 | |
| 452 | if (INSTALL_SAMPLES) |
| 453 | OCCT_INSTALL_FILE_OR_DIR ("samples" "${INSTALL_DIR}") |
| 454 | endif() |