| 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 | # set type of OCCT libraries |
| 8 | if (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) |
| 11 | endif() |
| 12 | |
| 13 | if ("${BUILD_LIBRARY_TYPE}" STREQUAL "Shared") |
| 14 | set (BUILD_SHARED_LIBS ON) |
| 15 | else() |
| 16 | unset (BUILD_SHARED_LIBS) |
| 17 | endif() |
| 18 | |
| 19 | # the name of the project |
| 20 | project (OCCT) |
| 21 | |
| 22 | # Solution folder property |
| 23 | set_property (GLOBAL PROPERTY USE_FOLDERS ON) |
| 24 | |
| 25 | # Tests |
| 26 | set (TESTS_RUN OFF CACHE BOOL "Run tests or not") |
| 27 | set (TESTS_INSTALL OFF CACHE BOOL "Copy tests to folder install") |
| 28 | set (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) |
| 31 | set (BUILD_BISON_FLEX_FILES OFF CACHE BOOL "Build *.yacc/*.lex files") |
| 32 | if (${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() |
| 42 | endif() |
| 43 | |
| 44 | # copy samples to install directory |
| 45 | set (INSTALL_SAMPLES OFF CACHE BOOL "Copy OCCT samples to install directory") |
| 46 | |
| 47 | # install dir of the built project |
| 48 | set (INSTALL_DIR "" CACHE PATH "Directory that will contain install files of OCCT" ) |
| 49 | set (CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE ) |
| 50 | |
| 51 | set (BUILD_PATCH_DIR "" CACHE PATH "directory with occt patch") |
| 52 | |
| 53 | # the list of being built toolkits |
| 54 | set (BUILD_TOOLKITS "" CACHE STRING "Toolkits are also included in OCCT") |
| 55 | separate_arguments (BUILD_TOOLKITS) |
| 56 | |
| 57 | if (MSVC) |
| 58 | set (BUILD_MFC_SAMPLES OFF CACHE BOOL "OCCT samples building") |
| 59 | endif() |
| 60 | |
| 61 | # whether use optional 3rdparty or not |
| 62 | if (APPLE) |
| 63 | set (USE_GLX OFF CACHE BOOL "Are X11 OpenGL used on OSX or not") |
| 64 | endif() |
| 65 | |
| 66 | set (USE_FREEIMAGE OFF CACHE BOOL "Is freeimage used or not") |
| 67 | set (USE_VTK OFF CACHE BOOL "Is VTK used or not") |
| 68 | |
| 69 | if (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") |
| 72 | #set (USE_OPENCL OFF CACHE BOOL "Is OpenCL used or not") |
| 73 | endif() |
| 74 | |
| 75 | # macro: include patched file if it exists |
| 76 | macro (OCCT_INCLUDE_CMAKE_FILE BEING_INCLUDED_FILE) |
| 77 | if (NOT "${BUILD_PATCH_DIR}" STREQUAL "" AND EXISTS "${BUILD_PATCH_DIR}/${BEING_INCLUDED_FILE}.cmake") |
| 78 | include (${BUILD_PATCH_DIR}/${BEING_INCLUDED_FILE}.cmake) |
| 79 | else() |
| 80 | include (${BEING_INCLUDED_FILE}.cmake) |
| 81 | endif() |
| 82 | endmacro() |
| 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 (MODULE ${OCCT_MODULES}) |
| 93 | set (BUILD_${MODULE} ON CACHE BOOL "include ${MODULE}") |
| 94 | endforeach() |
| 95 | |
| 96 | # Overview |
| 97 | set (BUILD_OCCT_OVERVIEW OFF CACHE BOOL "Build OCCT overview in HTML format") |
| 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 USED_TOOLKITS variable |
| 105 | list (APPEND USED_TOOLKITS ${BUILD_TOOLKITS}) |
| 106 | |
| 107 | foreach (MODULE ${OCCT_MODULES}) |
| 108 | if (BUILD_${MODULE}) |
| 109 | list (APPEND USED_TOOLKITS ${${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 USED_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 USED_TOOLKITS) |
| 121 | set (RAW_USED_TOOLKIT) |
| 122 | foreach(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}) |
| 125 | endforeach() |
| 126 | |
| 127 | list (REMOVE_DUPLICATES RAW_USED_TOOLKIT) |
| 128 | set (USED_TOOLKITS ${RAW_USED_TOOLKIT}) |
| 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 | set (3RDPARTY_DIR_LABEL "The directory containing required 3rdparty products") |
| 136 | if (NOT DEFINED 3RDPARTY_DIR) |
| 137 | set (3RDPARTY_DIR "" CACHE PATH ${3RDPARTY_DIR_LABEL}) |
| 138 | endif() |
| 139 | |
| 140 | # search for 3rdparty dir |
| 141 | if ("${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 |
| 146 | get_filename_component (3RDPARTY_DIR "${CMAKE_SOURCE_DIR}/../" ABSOLUTE) |
| 147 | set (3RDPARTY_DIR "${3RDPARTY_DIR}" CACHE PATH ${3RDPARTY_DIR_LABEL} FORCE) |
| 148 | endif() |
| 149 | endif() |
| 150 | |
| 151 | # search for CSF_TclLibs variable in EXTERNLIB of each being used toolkit |
| 152 | OCCT_IS_PRODUCT_REQUIRED(CSF_TclLibs USE_TCL) |
| 153 | |
| 154 | if ("${USE_TCL}" STREQUAL ON) |
| 155 | message (STATUS "Info: tcl is used by OCCT") |
| 156 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tcl") |
| 157 | else() |
| 158 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TCL") |
| 159 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TK") |
| 160 | endif() |
| 161 | |
| 162 | # search for CSF_FREETYPE variable in EXTERNLIB of each being used toolkit |
| 163 | OCCT_IS_PRODUCT_REQUIRED(CSF_FREETYPE USE_FREETYPE) |
| 164 | |
| 165 | if ("${USE_FREETYPE}" STREQUAL ON) |
| 166 | message (STATUS "Info: freetype is used by OCCT") |
| 167 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freetype") |
| 168 | else() |
| 169 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREETYPE") |
| 170 | OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2") |
| 171 | OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build") |
| 172 | endif() |
| 173 | |
| 174 | # VTK |
| 175 | if (USE_VTK) |
| 176 | add_definitions (-DHAVE_VTK) |
| 177 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/vtk") |
| 178 | endif() |
| 179 | |
| 180 | # GLX |
| 181 | if (USE_GLX) |
| 182 | add_definitions (-DMACOSX_USE_GLX) |
| 183 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/glx") |
| 184 | endif() |
| 185 | |
| 186 | # FREEIMAGE |
| 187 | if (USE_FREEIMAGE) |
| 188 | add_definitions (-DHAVE_FREEIMAGE) |
| 189 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freeimage") |
| 190 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freeimageplus") |
| 191 | else() |
| 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") |
| 196 | endif() |
| 197 | |
| 198 | # GL2PS |
| 199 | if (USE_GL2PS) |
| 200 | add_definitions (-DHAVE_GL2PS) |
| 201 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gl2ps") |
| 202 | else() |
| 203 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GL2PS") |
| 204 | OCCT_CHECK_AND_UNSET ("INSTALL_GL2PS") |
| 205 | endif() |
| 206 | |
| 207 | # OPENCL |
| 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() |
| 217 | |
| 218 | # TBB |
| 219 | if (USE_TBB) |
| 220 | add_definitions (-DHAVE_TBB) |
| 221 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tbb") |
| 222 | else() |
| 223 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB") |
| 224 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBBMALLOC") |
| 225 | OCCT_CHECK_AND_UNSET ("INSTALL_TBB") |
| 226 | endif() |
| 227 | |
| 228 | # Doxygen |
| 229 | if (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") |
| 240 | else() |
| 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") |
| 245 | endif() |
| 246 | |
| 247 | string (REGEX REPLACE ";" " " 3RDPARTY_NOT_INCLUDED "${3RDPARTY_NOT_INCLUDED}") |
| 248 | |
| 249 | # check all 3rdparty paths |
| 250 | if (3RDPARTY_NOT_INCLUDED) |
| 251 | message (FATAL_ERROR "NOT FOUND: ${3RDPARTY_NOT_INCLUDED}" ) |
| 252 | endif() |
| 253 | |
| 254 | if (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}) |
| 259 | endif() |
| 260 | |
| 261 | # include <cmake binary folder>/inc |
| 262 | include_directories (${CMAKE_BINARY_DIR}/inc) |
| 263 | |
| 264 | if (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}) |
| 269 | endif() |
| 270 | |
| 271 | # Get all used variables: OS_WITH_BIT, COMPILER |
| 272 | OCCT_MAKE_OS_WITH_BITNESS() |
| 273 | OCCT_MAKE_COMPILER_SHORT_NAME() |
| 274 | |
| 275 | # build directories |
| 276 | set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib") |
| 277 | set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin") |
| 278 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib") |
| 279 | |
| 280 | set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib") |
| 281 | set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin") |
| 282 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib") |
| 283 | |
| 284 | set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libd") |
| 285 | set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bind") |
| 286 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libd") |
| 287 | |
| 288 | if (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") |
| 291 | endif() |
| 292 | |
| 293 | if ("${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}") |
| 300 | endif() |
| 301 | |
| 302 | message (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 |
| 306 | COLLECT_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 | |
| 312 | OCCT_INSTALL_FILE_OR_DIR ("data" "${INSTALL_DIR}") |
| 313 | OCCT_INSTALL_FILE_OR_DIR ("samples/tcl" "${INSTALL_DIR}/samples") |
| 314 | |
| 315 | if (INSTALL_SAMPLES) |
| 316 | OCCT_INSTALL_FILE_OR_DIR ("samples" "${INSTALL_DIR}") |
| 317 | endif() |
| 318 | |
| 319 | if (TESTS_INSTALL) |
| 320 | OCCT_INSTALL_FILE_OR_DIR ("tests" "${INSTALL_DIR}") |
| 321 | endif() |
| 322 | |
| 323 | if (WIN32) |
| 324 | set (SCRIPT_EXT bat) |
| 325 | else() |
| 326 | set (SCRIPT_EXT sh) |
| 327 | endif() |
| 328 | |
| 329 | # Creation of "START_TESTS" project |
| 330 | if (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) |
| 335 | endif() |
| 336 | |
| 337 | # DRAW.BAT or DRAW.SH |
| 338 | if (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) |
| 341 | else() |
| 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) |
| 344 | endif() |
| 345 | OCCT_COPY_FILE_OR_DIR ("adm/templates/draw.${SCRIPT_EXT}" "${CMAKE_BINARY_DIR}") |
| 346 | |
| 347 | set (SUB_CUSTOM "custom_${COMPILER}_${COMPILER_BITNESS}.${SCRIPT_EXT}") |
| 348 | |
| 349 | if (WIN32) |
| 350 | set (ADDITIONAL_CUSTOM_CONTENT "\nif exist \"%~dp0${SUB_CUSTOM}\" (\n call \"%~dp0${SUB_CUSTOM}\" %VCVER% %ARCH% %CASDEB% \n)") |
| 351 | else() |
| 352 | set (ADDITIONAL_CUSTOM_CONTENT "\nif [ -e \"\${aScriptPath}/${SUB_CUSTOM}\" ]; then\n source \"\${aScriptPath}/${SUB_CUSTOM}\" \"\${COMPILER}\" \"\${WOKSTATION}\${ARCH}\" \"\${CASDEB}\" \nfi") |
| 353 | endif() |
| 354 | |
| 355 | # change custom.bat/sh |
| 356 | if (EXISTS "${INSTALL_DIR}/custom.${SCRIPT_EXT}") |
| 357 | file (READ "${INSTALL_DIR}/custom.${SCRIPT_EXT}" CUSTOM_CONTENT) |
| 358 | |
| 359 | set (CUSTOM_CONTENT "${CUSTOM_CONTENT} ${ADDITIONAL_CUSTOM_CONTENT}") |
| 360 | |
| 361 | file (WRITE "${INSTALL_DIR}/custom.${SCRIPT_EXT}" "${CUSTOM_CONTENT}") |
| 362 | else() |
| 363 | OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.${SCRIPT_EXT}.main" "custom.${SCRIPT_EXT}" "${INSTALL_DIR}") |
| 364 | endif() |
| 365 | |
| 366 | # write current custom.bat/sh |
| 367 | OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.${SCRIPT_EXT}.in" "${SUB_CUSTOM}" "${INSTALL_DIR}") |
| 368 | |
| 369 | if (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}") |
| 372 | endif() |
| 373 | |
| 374 | OCCT_CONFIGURE ("adm/templates/env.build.${SCRIPT_EXT}.in" "env.${SCRIPT_EXT}") |
| 375 | OCCT_CONFIGURE ("adm/templates/env.${SCRIPT_EXT}.in" "env.install.${SCRIPT_EXT}") |
| 376 | install (FILES "${CMAKE_BINARY_DIR}/env.install.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}" RENAME "env.${SCRIPT_EXT}") |
| 377 | |
| 378 | # RESOURCES |
| 379 | FILE_TO_LIST ("adm/RESOURCES" RESOURCES) |
| 380 | foreach(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() |
| 388 | endforeach() |
| 389 | |
| 390 | # include patched toolkit projects or original ones |
| 391 | foreach (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() |
| 399 | endforeach() |
| 400 | |
| 401 | if (BUILD_OCCT_OVERVIEW) |
| 402 | add_subdirectory (dox) |
| 403 | endif() |
| 404 | |
| 405 | # patch DRAWEXE |
| 406 | if (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() |
| 424 | endif() |
| 425 | |
| 426 | # samples do not support patch usage |
| 427 | if (BUILD_MFC_SAMPLES) |
| 428 | set (OCCT_ROOT ${CMAKE_SOURCE_DIR}) |
| 429 | |
| 430 | set (MFC_STANDARD_SAMPLES_DIR ${OCCT_ROOT}/samples/mfc/standard) |
| 431 | set (COMMON_WINMAIN_FILE ${MFC_STANDARD_SAMPLES_DIR}/Common/Winmain.cpp) |
| 432 | |
| 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) |
| 444 | endif() |