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