| 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 (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/${BEING_INCLUDED_FILE}.cmake") |
| 10 | include (${BUILD_PATCH}/${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 | |
| 28 | if (NOT DEFINED BUILD_SHARED_LIBRARY_NAME_POSTFIX) |
| 29 | set (BUILD_SHARED_LIBRARY_NAME_POSTFIX "" CACHE STRING "${BUILD_SHARED_LIBRARY_NAME_POSTFIX_DESCR}" FORCE) |
| 30 | endif() |
| 31 | else() |
| 32 | unset (BUILD_SHARED_LIBS) |
| 33 | message (STATUS "Info: Only 3rdparty's header files are used for building of static OCCT libraries") |
| 34 | unset (BUILD_SHARED_LIBRARY_NAME_POSTFIX) |
| 35 | endif() |
| 36 | |
| 37 | # the name of the project |
| 38 | project (OCCT) |
| 39 | |
| 40 | # include occt macros |
| 41 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros") |
| 42 | |
| 43 | # Solution folder property |
| 44 | set_property (GLOBAL PROPERTY USE_FOLDERS ON) |
| 45 | |
| 46 | # get current OCCT version |
| 47 | OCC_VERSION (OCC_VERSION_MAJOR OCC_VERSION_MINOR OCC_VERSION_MAINTENANCE OCC_VERSION_DEVELOPMENT OCC_VERSION_STRING_EXT) |
| 48 | |
| 49 | set_property (GLOBAL PROPERTY OCC_VERSION_MAJOR ${OCC_VERSION_MAJOR}) |
| 50 | set_property (GLOBAL PROPERTY OCC_VERSION_MINOR ${OCC_VERSION_MINOR}) |
| 51 | set_property (GLOBAL PROPERTY OCC_VERSION_MAINTENANCE ${OCC_VERSION_MAINTENANCE}) |
| 52 | |
| 53 | set (INSTALL_TEST_CASES OFF CACHE BOOL "${INSTALL_TEST_CASES_DESCR}") |
| 54 | |
| 55 | # single-configuration generator |
| 56 | set (SINGLE_GENERATOR OFF) |
| 57 | if (CMAKE_BUILD_TYPE) |
| 58 | set (SINGLE_GENERATOR ON) |
| 59 | endif() |
| 60 | |
| 61 | # a single-configuration generator like the Makefile generator defines CMAKE_BUILD_TYPE variable |
| 62 | # check this variable and set if it's required |
| 63 | if (DEFINED CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE) # single-configuration generator. |
| 64 | 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) |
| 65 | endif() |
| 66 | |
| 67 | # enable extended messages of many OCCT algorithms |
| 68 | set (BUILD_WITH_DEBUG OFF CACHE BOOL "${BUILD_WITH_DEBUG_DESCR}") |
| 69 | if (BUILD_WITH_DEBUG) |
| 70 | add_definitions (-DOCCT_DEBUG) |
| 71 | endif() |
| 72 | |
| 73 | # copy samples to install directory |
| 74 | set (INSTALL_SAMPLES OFF CACHE BOOL "${INSTALL_SAMPLES_DESCR}") |
| 75 | |
| 76 | # install dir of the project |
| 77 | if (NOT DEFINED INSTALL_DIR) |
| 78 | # set default install directory for Windows |
| 79 | if (WIN32 AND NOT DEFINED CMAKE_INSTALL_PREFIX) |
| 80 | set (CMAKE_INSTALL_PREFIX "C:/opencascade-${OCC_VERSION_STRING_EXT}") |
| 81 | endif() |
| 82 | set (INSTALL_DIR "${CMAKE_INSTALL_PREFIX}" CACHE PATH "${INSTALL_DIR_DESCR}") |
| 83 | else() |
| 84 | file (TO_CMAKE_PATH "${INSTALL_DIR}" INSTALL_DIR) |
| 85 | set (INSTALL_DIR "${INSTALL_DIR}" CACHE PATH "${INSTALL_DIR_DESCR}" FORCE) |
| 86 | endif() |
| 87 | |
| 88 | # choose a variant of the layout of the install paths |
| 89 | if (NOT INSTALL_DIR_LAYOUT) |
| 90 | if (WIN32) |
| 91 | set (INSTALL_DIR_LAYOUT "Windows" CACHE STRING "${INSTALL_DIR_LAYOUT_DESCR}" FORCE) |
| 92 | else() |
| 93 | set (INSTALL_DIR_LAYOUT "Unix" CACHE STRING "${INSTALL_DIR_LAYOUT_DESCR}" FORCE) |
| 94 | endif() |
| 95 | SET_PROPERTY(CACHE INSTALL_DIR_LAYOUT PROPERTY STRINGS Windows Unix) |
| 96 | endif() |
| 97 | |
| 98 | # check INSTALL_DIR_LAYOUT changes and update INSTALL_DIR_* paths if necessary |
| 99 | if (NOT DEFINED INSTALL_DIR_LAYOUT_PREV) |
| 100 | set (INSTALL_DIR_LAYOUT_PREV "${INSTALL_DIR_LAYOUT}" CACHE INTERNAL "" FORCE) |
| 101 | elseif (NOT "${INSTALL_DIR_LAYOUT_PREV}" STREQUAL "${INSTALL_DIR_LAYOUT}") |
| 102 | set (INSTALL_DIR_LAYOUT_PREV "${INSTALL_DIR_LAYOUT}" CACHE INTERNAL "" FORCE) |
| 103 | # The structure of install folder should be reset due to changed layout |
| 104 | OCCT_CHECK_AND_UNSET_INSTALL_DIR_SUBDIRS () |
| 105 | |
| 106 | # Unset INSTALL_DIR_WITH_VERSION on windows |
| 107 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Windows") |
| 108 | OCCT_CHECK_AND_UNSET (INSTALL_DIR_WITH_VERSION) |
| 109 | else() |
| 110 | if (NOT DEFINED INSTALL_DIR_WITH_VERSION) |
| 111 | set (INSTALL_DIR_WITH_VERSION OFF CACHE BOOL "${INSTALL_DIR_WITH_VERSION_DESCR}") |
| 112 | endif() |
| 113 | endif() |
| 114 | endif() |
| 115 | |
| 116 | # check CMAKE_INSTALL_PREFIX changes and update INSTALL_DIR if necessary |
| 117 | if (NOT DEFINED CMAKE_INSTALL_PREFIX_PREV) |
| 118 | set (CMAKE_INSTALL_PREFIX_PREV "${CMAKE_INSTALL_PREFIX}" CACHE INTERNAL "" FORCE) |
| 119 | elseif (NOT "${CMAKE_INSTALL_PREFIX_PREV}" STREQUAL "${CMAKE_INSTALL_PREFIX}") |
| 120 | # CMAKE_INSTALL_PREFIX has been changed at previous step |
| 121 | set (CMAKE_INSTALL_PREFIX_PREV "${CMAKE_INSTALL_PREFIX}" CACHE INTERNAL "" FORCE) |
| 122 | |
| 123 | # INSTALL_DIR is required to be updated |
| 124 | set (INSTALL_DIR "${CMAKE_INSTALL_PREFIX}" CACHE PATH "${INSTALL_DIR_DESCR}" FORCE) |
| 125 | endif() |
| 126 | |
| 127 | # check INSTALL_DIR changes and update CMAKE_INSTALL_PREFIX if necessary |
| 128 | if (NOT DEFINED INSTALL_DIR_PREV) |
| 129 | set (INSTALL_DIR_PREV "${INSTALL_DIR}" CACHE INTERNAL "" FORCE) |
| 130 | elseif (NOT "${INSTALL_DIR_PREV}" STREQUAL "${INSTALL_DIR}") |
| 131 | # INSTALL_DIR has been changed at previous step |
| 132 | set (INSTALL_DIR_PREV "${INSTALL_DIR}" CACHE INTERNAL "" FORCE) |
| 133 | |
| 134 | # sync CMAKE_INSTALL_PREFIX with INSTALL_DIR |
| 135 | set (CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE) |
| 136 | |
| 137 | # set CMAKE_INSTALL_PREFIX_PREV to avoid the reset of structure of the install folder |
| 138 | set (CMAKE_INSTALL_PREFIX_PREV "${INSTALL_DIR}" CACHE INTERNAL "" FORCE) |
| 139 | endif() |
| 140 | |
| 141 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") |
| 142 | if (NOT DEFINED INSTALL_DIR_WITH_VERSION_PREV) |
| 143 | set (INSTALL_DIR_WITH_VERSION_PREV "${INSTALL_DIR_WITH_VERSION}" CACHE INTERNAL "" FORCE) |
| 144 | elseif (NOT "${INSTALL_DIR_WITH_VERSION_PREV}" STREQUAL "${INSTALL_DIR_WITH_VERSION}") |
| 145 | # INSTALL_DIR_WITH_VERSION has been changed at previous step |
| 146 | set (INSTALL_DIR_WITH_VERSION_PREV "${INSTALL_DIR_WITH_VERSION}" CACHE INTERNAL "" FORCE) |
| 147 | |
| 148 | OCCT_CHECK_AND_UNSET_INSTALL_DIR_SUBDIRS () |
| 149 | endif() |
| 150 | endif() |
| 151 | |
| 152 | # hide CMAKE_INSTALL_PREFIX from a user |
| 153 | set (CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE) |
| 154 | |
| 155 | set (BIN_LETTER "") |
| 156 | if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") |
| 157 | set (BIN_LETTER "d") |
| 158 | elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo") |
| 159 | set (BIN_LETTER "i") |
| 160 | endif() |
| 161 | |
| 162 | # Get all used variables: OS_WITH_BIT, COMPILER |
| 163 | OCCT_MAKE_OS_WITH_BITNESS() |
| 164 | OCCT_MAKE_COMPILER_SHORT_NAME() |
| 165 | |
| 166 | # do not define INSTALL_DIR_BIN for win. |
| 167 | # Leave library structure for win: <prefix>/win64/vc10/bin(d) |
| 168 | if (NOT DEFINED INSTALL_DIR_BIN) |
| 169 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") |
| 170 | set (INSTALL_DIR_BIN "bin" CACHE PATH "${INSTALL_DIR_BIN_DESCR}") |
| 171 | else() |
| 172 | set (INSTALL_DIR_BIN "${OS_WITH_BIT}/${COMPILER}/bin" CACHE PATH "${INSTALL_DIR_BIN_DESCR}") |
| 173 | endif() |
| 174 | endif() |
| 175 | |
| 176 | # define folder contaning all shell/batch scripts |
| 177 | if (NOT DEFINED INSTALL_DIR_SCRIPT) |
| 178 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") |
| 179 | set (INSTALL_DIR_SCRIPT "${INSTALL_DIR_BIN}" CACHE PATH "${INSTALL_DIR_SCRIPT_DESCR}") |
| 180 | else() |
| 181 | set (INSTALL_DIR_SCRIPT "." CACHE PATH "${INSTALL_DIR_SCRIPT_DESCR}") |
| 182 | endif() |
| 183 | endif() |
| 184 | |
| 185 | # place the libraries to <prefix>/lib folder for unix and leave old structure for windows |
| 186 | if (NOT DEFINED INSTALL_DIR_LIB) |
| 187 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") |
| 188 | set (INSTALL_DIR_LIB "lib" CACHE PATH "${INSTALL_DIR_LIB_DESCR}") |
| 189 | else() |
| 190 | set (INSTALL_DIR_LIB "${OS_WITH_BIT}/${COMPILER}/lib" CACHE PATH "${INSTALL_DIR_LIB_DESCR}") |
| 191 | endif() |
| 192 | endif() |
| 193 | |
| 194 | # OCCT headers: <prefix>/inc for windows, |
| 195 | # <prefix>/include/opencascade-7.0.0 for unix |
| 196 | if (NOT DEFINED INSTALL_DIR_INCLUDE) |
| 197 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") |
| 198 | set (INSTALL_DIR_INCLUDE "include/opencascade" CACHE PATH "${INSTALL_DIR_INCLUDE_DESCR}") |
| 199 | if (INSTALL_DIR_WITH_VERSION) |
| 200 | set (INSTALL_DIR_INCLUDE "include/opencascade-${OCC_VERSION_STRING_EXT}" CACHE PATH "${INSTALL_DIR_INCLUDE_DESCR}" FORCE) |
| 201 | endif() |
| 202 | else() |
| 203 | set (INSTALL_DIR_INCLUDE "inc" CACHE PATH "${INSTALL_DIR_INCLUDE_DESCR}") |
| 204 | endif() |
| 205 | endif() |
| 206 | |
| 207 | # OCCT resources: <prefix>/src for windows, |
| 208 | # <prefix>/share/opencascade-7.0.0/resources for unix |
| 209 | if (NOT DEFINED INSTALL_DIR_RESOURCE) |
| 210 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") |
| 211 | set (INSTALL_DIR_RESOURCE "share/opencascade/resources" CACHE PATH "${INSTALL_DIR_RESOURCE_DESCR}") |
| 212 | if (INSTALL_DIR_WITH_VERSION) |
| 213 | set (INSTALL_DIR_RESOURCE "share/opencascade-${OCC_VERSION_STRING_EXT}/resources" CACHE PATH "${INSTALL_DIR_RESOURCE_DESCR}" FORCE) |
| 214 | endif() |
| 215 | else() |
| 216 | set (INSTALL_DIR_RESOURCE "src" CACHE PATH "${INSTALL_DIR_RESOURCE_DESCR}") |
| 217 | endif() |
| 218 | endif() |
| 219 | |
| 220 | # OCCT data |
| 221 | if (NOT DEFINED INSTALL_DIR_DATA) |
| 222 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") |
| 223 | set (INSTALL_DIR_DATA "share/opencascade/data" CACHE PATH "${INSTALL_DIR_DATA_DESCR}") |
| 224 | if (INSTALL_DIR_WITH_VERSION) |
| 225 | set (INSTALL_DIR_DATA "share/opencascade-${OCC_VERSION_STRING_EXT}/data" CACHE PATH "${INSTALL_DIR_DATA_DESCR}" FORCE) |
| 226 | endif() |
| 227 | else() |
| 228 | set (INSTALL_DIR_DATA "data" CACHE PATH "${INSTALL_DIR_DATA_DESCR}") |
| 229 | endif() |
| 230 | endif() |
| 231 | |
| 232 | # OCCT samples |
| 233 | if (NOT DEFINED INSTALL_DIR_SAMPLES) |
| 234 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") |
| 235 | set (INSTALL_DIR_SAMPLES "share/opencascade/samples" CACHE PATH "${INSTALL_DIR_SAMPLES_DESCR}") |
| 236 | if (INSTALL_DIR_WITH_VERSION) |
| 237 | set (INSTALL_DIR_SAMPLES "share/opencascade-${OCC_VERSION_STRING_EXT}/samples" CACHE PATH "${INSTALL_DIR_SAMPLES_DESCR}" FORCE) |
| 238 | endif() |
| 239 | else() |
| 240 | set (INSTALL_DIR_SAMPLES "samples" CACHE PATH "${INSTALL_DIR_SAMPLES_DESCR}") |
| 241 | endif() |
| 242 | endif() |
| 243 | |
| 244 | # OCCT tests |
| 245 | if (NOT DEFINED INSTALL_DIR_TESTS) |
| 246 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") |
| 247 | set (INSTALL_DIR_TESTS "share/opencascade/tests" CACHE PATH "${INSTALL_DIR_TESTS_DESCR}") |
| 248 | if (INSTALL_DIR_WITH_VERSION) |
| 249 | set (INSTALL_DIR_TESTS "share/opencascade-${OCC_VERSION_STRING_EXT}/tests" CACHE PATH "${INSTALL_DIR_TESTS_DESCR}" FORCE) |
| 250 | endif() |
| 251 | else() |
| 252 | set (INSTALL_DIR_TESTS "tests" CACHE PATH "${INSTALL_DIR_TESTS_DESCR}") |
| 253 | endif() |
| 254 | endif() |
| 255 | |
| 256 | # OCCT doc |
| 257 | if (NOT DEFINED INSTALL_DIR_DOC) |
| 258 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") |
| 259 | set (INSTALL_DIR_DOC "share/doc/opencascade" CACHE PATH "${INSTALL_DIR_DOC_DESCR}") |
| 260 | if (INSTALL_DIR_WITH_VERSION) |
| 261 | set (INSTALL_DIR_DOC "share/doc/opencascade-${OCC_VERSION_STRING_EXT}" CACHE PATH "${INSTALL_DIR_DOC_DESCR}" FORCE) |
| 262 | endif() |
| 263 | else() |
| 264 | set (INSTALL_DIR_DOC "doc" CACHE PATH "${INSTALL_DIR_DOC_DESCR}") |
| 265 | endif() |
| 266 | endif() |
| 267 | |
| 268 | # define folder contaning CMake configuration files |
| 269 | if (NOT DEFINED INSTALL_DIR_CMAKE) |
| 270 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") |
| 271 | if (INSTALL_DIR_WITH_VERSION) |
| 272 | set (INSTALL_DIR_CMAKE "lib/cmake/opencascade-${OCC_VERSION_STRING_EXT}" CACHE PATH "${INSTALL_DIR_CMAKE_DESCR}") |
| 273 | else() |
| 274 | set (INSTALL_DIR_CMAKE "lib/cmake/opencascade" CACHE PATH "${INSTALL_DIR_CMAKE_DESCR}") |
| 275 | endif() |
| 276 | else() |
| 277 | set (INSTALL_DIR_CMAKE "cmake" CACHE PATH "${INSTALL_DIR_CMAKE_DESCR}") |
| 278 | endif() |
| 279 | endif() |
| 280 | |
| 281 | # install LICENSE_LGPL_21.txt and OCCT_LGPL_EXCEPTION.txt files |
| 282 | if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix") |
| 283 | OCCT_INSTALL_FILE_OR_DIR ("LICENSE_LGPL_21.txt" "${INSTALL_DIR}/${INSTALL_DIR_DOC}") |
| 284 | OCCT_INSTALL_FILE_OR_DIR ("OCCT_LGPL_EXCEPTION.txt" "${INSTALL_DIR}/${INSTALL_DIR_DOC}") |
| 285 | else() |
| 286 | OCCT_INSTALL_FILE_OR_DIR ("LICENSE_LGPL_21.txt" "${INSTALL_DIR}") |
| 287 | OCCT_INSTALL_FILE_OR_DIR ("OCCT_LGPL_EXCEPTION.txt" "${INSTALL_DIR}") |
| 288 | endif() |
| 289 | |
| 290 | # a directory recognized as a 'patch' for OCCT |
| 291 | set (BUILD_PATCH "" CACHE PATH "${BUILD_PATCH_DESCR}") |
| 292 | |
| 293 | # the list of being built toolkits |
| 294 | set (BUILD_ADDITIONAL_TOOLKITS "" CACHE STRING "${BUILD_ADDITIONAL_TOOLKITS_DESCR}") |
| 295 | separate_arguments (BUILD_ADDITIONAL_TOOLKITS) |
| 296 | |
| 297 | if (MSVC) |
| 298 | set (BUILD_MODULE_MfcSamples OFF CACHE BOOL "${BUILD_MODULE_MfcSamples_DESCR}") |
| 299 | endif() |
| 300 | |
| 301 | # whether use optional 3rdparty or not |
| 302 | if (APPLE) |
| 303 | set (USE_GLX OFF CACHE BOOL "${USE_GLX_DESCR}") |
| 304 | endif() |
| 305 | |
| 306 | if (WIN32) |
| 307 | set (USE_D3D OFF CACHE BOOL "${USE_D3D_DESCR}") |
| 308 | endif() |
| 309 | |
| 310 | # include the patched or original list of modules |
| 311 | # list <MODULENAME>_TOOLKITS is created foreach module and contains its toolkits |
| 312 | # list <OCCT_MODULES> will contain all modules |
| 313 | OCCT_MODULES_AND_TOOLKITS (OCCT_MODULES) |
| 314 | |
| 315 | foreach (OCCT_MODULE ${OCCT_MODULES}) |
| 316 | BUILD_MODULE (${OCCT_MODULE}) |
| 317 | endforeach() |
| 318 | |
| 319 | if (ANDROID AND BUILD_MODULE_Draw) |
| 320 | message (STATUS "Info. Draw module is turned off due to it is not supported on Android") |
| 321 | set (BUILD_MODULE_Draw OFF CACHE BOOL "${BUILD_MODULE_Draw_DESCR}" FORCE) |
| 322 | endif() |
| 323 | |
| 324 | # Overview |
| 325 | if (NOT DEFINED BUILD_DOC_Overview) |
| 326 | set (DO_ONLY_CHECK_FOR_DOXYGEN ON) |
| 327 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/doxygen") |
| 328 | set (DO_ONLY_CHECK_FOR_DOXYGEN OFF) |
| 329 | |
| 330 | if (CAN_DOXYGEN_BE_USED) |
| 331 | message (STATUS "Info. Overview building is turned on") |
| 332 | endif() |
| 333 | |
| 334 | set (BUILD_DOC_Overview ${CAN_DOXYGEN_BE_USED} CACHE BOOL "${BUILD_DOC_Overview_DESCR}") |
| 335 | endif() |
| 336 | |
| 337 | if (NOT USE_D3D) |
| 338 | list (REMOVE_ITEM Visualization_TOOLKITS TKD3DHost) |
| 339 | endif() |
| 340 | |
| 341 | # accumulate used toolkits (first level) in BUILD_TOOLKITS variable |
| 342 | list (APPEND BUILD_TOOLKITS ${BUILD_ADDITIONAL_TOOLKITS}) |
| 343 | |
| 344 | foreach (OCCT_MODULE ${OCCT_MODULES}) |
| 345 | if (BUILD_MODULE_${OCCT_MODULE}) |
| 346 | list (APPEND BUILD_TOOLKITS ${${OCCT_MODULE}_TOOLKITS}) |
| 347 | endif() |
| 348 | endforeach() |
| 349 | |
| 350 | # DRAWEXE excluded when library build is static |
| 351 | if (NOT BUILD_SHARED_LIBS) |
| 352 | list (REMOVE_ITEM BUILD_TOOLKITS DRAWEXE) |
| 353 | message (STATUS "Info: DRAWEXE is not included due to ${BUILD_LIBRARY_TYPE} build library type") |
| 354 | endif() |
| 355 | |
| 356 | # accumulate all used toolkits |
| 357 | list (REMOVE_DUPLICATES BUILD_TOOLKITS) |
| 358 | set (RAW_BUILD_TOOLKITS) |
| 359 | foreach (BUILD_TOOLKIT ${BUILD_TOOLKITS}) |
| 360 | OCCT_TOOLKIT_FULL_DEP (${BUILD_TOOLKIT} TOOLKIT_FULL_DEPS) |
| 361 | list (APPEND RAW_BUILD_TOOLKITS ${BUILD_TOOLKIT} ${TOOLKIT_FULL_DEPS}) |
| 362 | endforeach() |
| 363 | |
| 364 | list (REMOVE_DUPLICATES RAW_BUILD_TOOLKITS) |
| 365 | set (BUILD_TOOLKITS ${RAW_BUILD_TOOLKITS}) |
| 366 | |
| 367 | # include the patched or original list of definitions and flags |
| 368 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_defs_flags") |
| 369 | |
| 370 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/3rdparty_macro") |
| 371 | |
| 372 | # search for TKIVtk and TKIVtkDraw in BUILD_TOOLKITS |
| 373 | list (FIND BUILD_TOOLKITS TKIVtk CAN_USE_VTK) |
| 374 | if (CAN_USE_VTK EQUAL -1) |
| 375 | list (FIND BUILD_TOOLKITS TKIVtkDraw CAN_USE_VTK) |
| 376 | endif() |
| 377 | |
| 378 | if (NOT CAN_USE_VTK EQUAL -1) |
| 379 | if (NOT DEFINED USE_VTK) |
| 380 | set (USE_VTK OFF CACHE BOOL "${USE_VTK_DESCR}") |
| 381 | endif() |
| 382 | else() |
| 383 | OCCT_CHECK_AND_UNSET (USE_VTK) |
| 384 | endif() |
| 385 | |
| 386 | # Rebuild *.yacc and *.lex files that are contained by TKMath toolkit |
| 387 | list (FIND BUILD_TOOLKITS TKMath CAN_REBUILD_PDC_FOR_TKMATH) |
| 388 | list (FIND BUILD_TOOLKITS StepFile CAN_REBUILD_PDC_FOR_STEPFILE) |
| 389 | |
| 390 | if (NOT ${CAN_REBUILD_PDC_FOR_TKMATH} EQUAL -1 OR NOT ${CAN_REBUILD_PDC_FOR_STEPFILE} EQUAL -1) |
| 391 | set (BUILD_YACCLEX OFF CACHE BOOL "${BUILD_YACCLEX_DESCR}") |
| 392 | else() |
| 393 | OCCT_CHECK_AND_UNSET (BUILD_YACCLEX) |
| 394 | endif() |
| 395 | |
| 396 | if (NOT DEFINED 3RDPARTY_DIR) |
| 397 | set (3RDPARTY_DIR "" CACHE PATH ${3RDPARTY_DIR_DESCR}) |
| 398 | get_filename_component (3RDPARTY_DIR "${3RDPARTY_DIR}" ABSOLUTE) |
| 399 | else() |
| 400 | file (TO_CMAKE_PATH "${3RDPARTY_DIR}" 3RDPARTY_DIR) |
| 401 | set (3RDPARTY_DIR "${3RDPARTY_DIR}" CACHE PATH "${3RDPARTY_DIR_DESCR}" FORCE) |
| 402 | endif() |
| 403 | |
| 404 | # search for CSF_TclLibs variable in EXTERNLIB of each being used toolkit |
| 405 | OCCT_IS_PRODUCT_REQUIRED (CSF_TclLibs USE_TCL) |
| 406 | |
| 407 | if (USE_TCL) |
| 408 | message (STATUS "Info: TCL is used by OCCT") |
| 409 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tcl") |
| 410 | |
| 411 | message (STATUS "Info: TK is used by OCCT") |
| 412 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tk") |
| 413 | else() |
| 414 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TCL") |
| 415 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TK") |
| 416 | |
| 417 | OCCT_CHECK_AND_UNSET ("INSTALL_TCL") |
| 418 | OCCT_CHECK_AND_UNSET ("INSTALL_TK") |
| 419 | endif() |
| 420 | |
| 421 | # search for CSF_FREETYPE variable in EXTERNLIB of each being used toolkit |
| 422 | OCCT_IS_PRODUCT_REQUIRED (CSF_FREETYPE USE_FREETYPE) |
| 423 | |
| 424 | if (USE_FREETYPE) |
| 425 | message (STATUS "Info: Freetype is used by OCCT") |
| 426 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freetype") |
| 427 | else() |
| 428 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREETYPE") |
| 429 | OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2") |
| 430 | OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build") |
| 431 | OCCT_CHECK_AND_UNSET ("INSTALL_FREETYPE") |
| 432 | endif() |
| 433 | |
| 434 | # VTK |
| 435 | if (USE_VTK) |
| 436 | add_definitions (-DHAVE_VTK) |
| 437 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/vtk") |
| 438 | else() |
| 439 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_VTK") |
| 440 | |
| 441 | if (NOT CAN_USE_VTK EQUAL -1) |
| 442 | message (STATUS "Info: TKIVtk and TKIVtkDraw toolkits excluded due to VTK usage is disabled") |
| 443 | |
| 444 | list (REMOVE_ITEM BUILD_TOOLKITS TKIVtk) |
| 445 | list (REMOVE_ITEM BUILD_TOOLKITS TKIVtkDraw) |
| 446 | endif() |
| 447 | endif() |
| 448 | |
| 449 | # D3D |
| 450 | if (USE_D3D) |
| 451 | add_definitions (-DHAVE_D3D) |
| 452 | #if(MSVC_VERSION LESS 1700) |
| 453 | #OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/d3d") |
| 454 | #endif() |
| 455 | endif() |
| 456 | |
| 457 | # GLX |
| 458 | if (USE_GLX) |
| 459 | add_definitions (-DMACOSX_USE_GLX) |
| 460 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/glx") |
| 461 | endif() |
| 462 | |
| 463 | # FREEIMAGE |
| 464 | # search for CSF_FREEIMAGE variable in EXTERNLIB of each being used toolkit |
| 465 | OCCT_IS_PRODUCT_REQUIRED (CSF_FREEIMAGE CAN_USE_FREEIMAGE) |
| 466 | OCCT_IS_PRODUCT_REQUIRED (CSF_FreeImagePlus CAN_USE_FREEIMAGEPLUS) |
| 467 | |
| 468 | if (CAN_USE_FREEIMAGE OR CAN_USE_FREEIMAGEPLUS) |
| 469 | set (USE_FREEIMAGE OFF CACHE BOOL "${USE_FREEIMAGE_DESCR}") |
| 470 | |
| 471 | if (USE_FREEIMAGE) |
| 472 | add_definitions (-DHAVE_FREEIMAGE) |
| 473 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freeimage") |
| 474 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freeimageplus") |
| 475 | else() |
| 476 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGE") |
| 477 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGEPLUS") |
| 478 | OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGE") |
| 479 | OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGEPLUS") |
| 480 | endif() |
| 481 | else() |
| 482 | OCCT_CHECK_AND_UNSET ("USE_FREEIMAGE") |
| 483 | |
| 484 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGE") |
| 485 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGEPLUS") |
| 486 | OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGE") |
| 487 | OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGEPLUS") |
| 488 | endif() |
| 489 | |
| 490 | # GL2PS |
| 491 | # search for CSF_GL2PS variable in EXTERNLIB of each being used toolkit |
| 492 | OCCT_IS_PRODUCT_REQUIRED (CSF_GL2PS CAN_USE_GL2PS) |
| 493 | |
| 494 | if (NOT DEFINED ANDROID AND CAN_USE_GL2PS) |
| 495 | set (USE_GL2PS OFF CACHE BOOL "${USE_GL2PS_DESCR}") |
| 496 | |
| 497 | if (USE_GL2PS) |
| 498 | add_definitions (-DHAVE_GL2PS) |
| 499 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gl2ps") |
| 500 | else() |
| 501 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GL2PS") |
| 502 | OCCT_CHECK_AND_UNSET ("INSTALL_GL2PS") |
| 503 | endif() |
| 504 | else() |
| 505 | OCCT_CHECK_AND_UNSET ("USE_GL2PS") |
| 506 | |
| 507 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GL2PS") |
| 508 | OCCT_CHECK_AND_UNSET ("INSTALL_GL2PS") |
| 509 | endif() |
| 510 | |
| 511 | # TBB |
| 512 | # search for CSF_TBB variable in EXTERNLIB of each being used toolkit |
| 513 | OCCT_IS_PRODUCT_REQUIRED (CSF_TBB CAN_USE_TBB) |
| 514 | |
| 515 | if (NOT DEFINED ANDROID AND CAN_USE_TBB) |
| 516 | set (USE_TBB OFF CACHE BOOL "${USE_TBB_DESCR}") |
| 517 | |
| 518 | if (USE_TBB) |
| 519 | add_definitions (-DHAVE_TBB) |
| 520 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tbb") |
| 521 | else() |
| 522 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB") |
| 523 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBBMALLOC") |
| 524 | OCCT_CHECK_AND_UNSET ("INSTALL_TBB") |
| 525 | endif() |
| 526 | else() |
| 527 | OCCT_CHECK_AND_UNSET ("USE_TBB") |
| 528 | |
| 529 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB") |
| 530 | OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBBMALLOC") |
| 531 | OCCT_CHECK_AND_UNSET ("INSTALL_TBB") |
| 532 | endif() |
| 533 | |
| 534 | # Doxygen |
| 535 | if (BUILD_DOC_Overview) |
| 536 | if (NOT DEFINED INSTALL_DOC_Overview) |
| 537 | set (INSTALL_DOC_Overview OFF CACHE BOOL "${INSTALL_DOC_Overview_DESCR}") |
| 538 | endif() |
| 539 | |
| 540 | if (INSTALL_DOC_Overview) |
| 541 | install (DIRECTORY "${CMAKE_BINARY_DIR}/doc/overview" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_DOC}") |
| 542 | |
| 543 | # create overview.html only for windows |
| 544 | if (WIN32 AND "${INSTALL_DIR_LAYOUT}" STREQUAL "Windows") |
| 545 | OCCT_INSTALL_FILE_OR_DIR ("dox/resources/overview.html" "${INSTALL_DIR}/${INSTALL_DIR_DOC}/..") |
| 546 | endif() |
| 547 | endif() |
| 548 | |
| 549 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/doxygen") |
| 550 | else() |
| 551 | OCCT_CHECK_AND_UNSET ("INSTALL_DOC_Overview") |
| 552 | |
| 553 | OCCT_CHECK_AND_UNSET ("3RDPARTY_DOXYGEN_EXECUTABLE") |
| 554 | OCCT_CHECK_AND_UNSET ("3RDPARTY_DOT_EXECUTABLE") |
| 555 | endif() |
| 556 | |
| 557 | # bison |
| 558 | if (BUILD_YACCLEX) |
| 559 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/bison") |
| 560 | else() |
| 561 | OCCT_CHECK_AND_UNSET ("3RDPARTY_BISON_EXECUTABLE") |
| 562 | endif() |
| 563 | |
| 564 | # flex |
| 565 | if (BUILD_YACCLEX) |
| 566 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/flex") |
| 567 | else() |
| 568 | OCCT_CHECK_AND_UNSET ("3RDPARTY_FLEX_EXECUTABLE") |
| 569 | endif() |
| 570 | |
| 571 | string (REGEX REPLACE ";" " " 3RDPARTY_NOT_INCLUDED "${3RDPARTY_NOT_INCLUDED}") |
| 572 | |
| 573 | # check all 3rdparty paths |
| 574 | if (3RDPARTY_NOT_INCLUDED) |
| 575 | message (FATAL_ERROR "NOT FOUND: ${3RDPARTY_NOT_INCLUDED}" ) |
| 576 | endif() |
| 577 | |
| 578 | if (3RDPARTY_INCLUDE_DIRS) |
| 579 | list (REMOVE_DUPLICATES 3RDPARTY_INCLUDE_DIRS) |
| 580 | string (REGEX REPLACE ";" "\n\t" 3RDPARTY_INCLUDE_DIRS_WITH_ENDS "${3RDPARTY_INCLUDE_DIRS}") |
| 581 | message (STATUS "Info: The directories of 3rdparty headers: \n\t${3RDPARTY_INCLUDE_DIRS_WITH_ENDS}") |
| 582 | include_directories (${3RDPARTY_INCLUDE_DIRS}) |
| 583 | endif() |
| 584 | |
| 585 | # include <cmake binary folder>/inc |
| 586 | include_directories (${CMAKE_BINARY_DIR}/inc) |
| 587 | |
| 588 | if (3RDPARTY_LIBRARY_DIRS AND BUILD_SHARED_LIBS) |
| 589 | list (REMOVE_DUPLICATES 3RDPARTY_LIBRARY_DIRS) |
| 590 | string (REGEX REPLACE ";" "\n\t" 3RDPARTY_LIBRARY_DIRS_WITH_ENDS "${3RDPARTY_LIBRARY_DIRS}") |
| 591 | message (STATUS "Info: The directories of 3rdparty libraries: \n\t${3RDPARTY_LIBRARY_DIRS_WITH_ENDS}") |
| 592 | link_directories (${3RDPARTY_LIBRARY_DIRS}) |
| 593 | endif() |
| 594 | |
| 595 | # build directories |
| 596 | if (SINGLE_GENERATOR) |
| 597 | set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BIN_LETTER}") |
| 598 | set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BIN_LETTER}") |
| 599 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BIN_LETTER}") |
| 600 | if (WIN32) |
| 601 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BIN_LETTER}") |
| 602 | endif() |
| 603 | endif() |
| 604 | |
| 605 | set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib") |
| 606 | set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin") |
| 607 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib") |
| 608 | |
| 609 | set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libi") |
| 610 | set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bini") |
| 611 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libi") |
| 612 | |
| 613 | set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libd") |
| 614 | set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bind") |
| 615 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libd") |
| 616 | |
| 617 | if (WIN32) |
| 618 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin") |
| 619 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bini") |
| 620 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bind") |
| 621 | endif() |
| 622 | |
| 623 | string(TIMESTAMP CURRENT_TIME "%H:%M:%S") |
| 624 | message (STATUS "\nInfo: \(${CURRENT_TIME}\) Start collecting all OCCT header files into ${CMAKE_BINARY_DIR}/inc ...") |
| 625 | |
| 626 | # collect all the headers to <binary dir>/inc folder |
| 627 | COLLECT_AND_INSTALL_OCCT_HEADER_FILES ("${CMAKE_BINARY_DIR}" "${BUILD_TOOLKITS}") |
| 628 | |
| 629 | string(TIMESTAMP CURRENT_TIME "%H:%M:%S") |
| 630 | message (STATUS "Info: \(${CURRENT_TIME}\) End the collecting") |
| 631 | |
| 632 | OCCT_INSTALL_FILE_OR_DIR ("data/" "${INSTALL_DIR}/${INSTALL_DIR_DATA}") |
| 633 | |
| 634 | if (WIN32) |
| 635 | set (SCRIPT_EXT bat) |
| 636 | else() |
| 637 | set (SCRIPT_EXT sh) |
| 638 | endif() |
| 639 | |
| 640 | # OCCT samples |
| 641 | if (INSTALL_SAMPLES) |
| 642 | OCCT_CONFIGURE ("adm/templates/env.samples.${SCRIPT_EXT}.in" "env.samples.${SCRIPT_EXT}") |
| 643 | if (WIN32) |
| 644 | OCCT_INSTALL_FILE_OR_DIR ("samples/CSharp" "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}") |
| 645 | OCCT_INSTALL_FILE_OR_DIR ("samples/mfc" "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}") |
| 646 | |
| 647 | install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}/CSharp" RENAME "env.${SCRIPT_EXT}") |
| 648 | install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}/mfc/standard" RENAME "env.${SCRIPT_EXT}") |
| 649 | endif() |
| 650 | |
| 651 | OCCT_INSTALL_FILE_OR_DIR ("samples/java" "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}") |
| 652 | OCCT_INSTALL_FILE_OR_DIR ("samples/ocafsamples" "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}") |
| 653 | OCCT_INSTALL_FILE_OR_DIR ("samples/qt" "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}") |
| 654 | |
| 655 | install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}/qt/FuncDemo" RENAME "env.${SCRIPT_EXT}") |
| 656 | install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}/qt/IESample" RENAME "env.${SCRIPT_EXT}") |
| 657 | install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}/qt/Tutorial" RENAME "env.${SCRIPT_EXT}") |
| 658 | endif() |
| 659 | |
| 660 | OCCT_INSTALL_FILE_OR_DIR ("samples/tcl" "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}") |
| 661 | |
| 662 | if (INSTALL_TEST_CASES) |
| 663 | OCCT_INSTALL_FILE_OR_DIR ("tests/" "${INSTALL_DIR}/${INSTALL_DIR_TESTS}") |
| 664 | endif() |
| 665 | |
| 666 | # copy draw script to install script folder |
| 667 | if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/adm/templates/draw.${SCRIPT_EXT}") |
| 668 | install (FILES "${BUILD_PATCH}/adm/templates/draw.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}" |
| 669 | PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE) |
| 670 | else() |
| 671 | install (FILES "${CMAKE_SOURCE_DIR}/adm/templates/draw.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}" |
| 672 | PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE) |
| 673 | endif() |
| 674 | |
| 675 | # copy draw script to CMake binary folder |
| 676 | OCCT_COPY_FILE_OR_DIR ("adm/templates/draw.${SCRIPT_EXT}" "${CMAKE_BINARY_DIR}") |
| 677 | |
| 678 | set (SUB_CUSTOM_NAME "custom_${COMPILER}_${COMPILER_BITNESS}.${SCRIPT_EXT}") |
| 679 | |
| 680 | if (WIN32) |
| 681 | set (ADDITIONAL_CUSTOM_CONTENT "\nif exist \"%~dp0${SUB_CUSTOM_NAME}\" (\n call \"%~dp0${SUB_CUSTOM_NAME}\" %1 %2 %3 \n)") |
| 682 | else() |
| 683 | set (ADDITIONAL_CUSTOM_CONTENT "\nif [ -e \"\${aScriptPath}/${SUB_CUSTOM_NAME}\" ]; then\n source \"\${aScriptPath}/${SUB_CUSTOM_NAME}\" \"\$1\" \"\$2\" \nfi") |
| 684 | endif() |
| 685 | |
| 686 | # change custom.bat/sh |
| 687 | if (EXISTS "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}/custom.${SCRIPT_EXT}") |
| 688 | file (READ "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}/custom.${SCRIPT_EXT}" CUSTOM_CONTENT) |
| 689 | |
| 690 | set (CUSTOM_CONTENT "${CUSTOM_CONTENT} ${ADDITIONAL_CUSTOM_CONTENT}") |
| 691 | |
| 692 | file (WRITE "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}/custom.${SCRIPT_EXT}" "${CUSTOM_CONTENT}") |
| 693 | else() |
| 694 | OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.${SCRIPT_EXT}.main" "custom.${SCRIPT_EXT}" "custom.${SCRIPT_EXT}" "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}") |
| 695 | endif() |
| 696 | |
| 697 | # write current custom.bat/sh (for install directory) |
| 698 | set (SUB_CUSTOM_BUILD_NAME "custom_${COMPILER}_${COMPILER_BITNESS}.install.${SCRIPT_EXT}") |
| 699 | OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.install.${SCRIPT_EXT}.in" "${SUB_CUSTOM_BUILD_NAME}" "${SUB_CUSTOM_NAME}" "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}") |
| 700 | |
| 701 | # write current custom.bat/sh (for build directory) |
| 702 | OCCT_CONFIGURE ("adm/templates/custom.build.${SCRIPT_EXT}.in" "${SUB_CUSTOM_NAME}") |
| 703 | |
| 704 | if (BUILD_MODULE_MfcSamples) |
| 705 | OCCT_INSTALL_FILE_OR_DIR ("adm/templates/sample.bat" "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}") |
| 706 | OCCT_COPY_FILE_OR_DIR ("adm/templates/sample.bat" "${CMAKE_BINARY_DIR}") |
| 707 | endif() |
| 708 | |
| 709 | # env script for draw in building environment |
| 710 | OCCT_CONFIGURE ("adm/templates/env.${SCRIPT_EXT}.in" "env.${SCRIPT_EXT}") |
| 711 | |
| 712 | # install env script |
| 713 | install (FILES "${CMAKE_BINARY_DIR}/env.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}") |
| 714 | |
| 715 | # copy DrawAppliInit from OCCT source to build directory |
| 716 | if (NOT EXISTS "${CMAKE_BINARY_DIR}/DrawAppliInit") |
| 717 | OCCT_COPY_FILE_OR_DIR (DrawAppliInit "${CMAKE_BINARY_DIR}") |
| 718 | endif() |
| 719 | |
| 720 | # RESOURCES |
| 721 | FILE_TO_LIST ("adm/RESOURCES" RESOURCES) |
| 722 | foreach(RESOURCE ${RESOURCES}) |
| 723 | get_filename_component(RESOURCE_FOLDER ${RESOURCE} DIRECTORY) |
| 724 | if(NOT "${RESOURCE_FOLDER}" STREQUAL "") |
| 725 | get_filename_component(RESOURCE_FOLDER ${RESOURCE_FOLDER} NAME) |
| 726 | OCCT_INSTALL_FILE_OR_DIR ("src/${RESOURCE}" "${INSTALL_DIR}/${INSTALL_DIR_RESOURCE}/${RESOURCE_FOLDER}") |
| 727 | else() |
| 728 | OCCT_INSTALL_FILE_OR_DIR ("src/${RESOURCE}" "${INSTALL_DIR}/${INSTALL_DIR_RESOURCE}") |
| 729 | endif() |
| 730 | endforeach() |
| 731 | |
| 732 | # patch installed DrawDefault file if BUILD_SHARED_LIBRARY_NAME_POSTFIX is changed |
| 733 | if (NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "") |
| 734 | OCCT_UPDATE_DRAW_DEFAULT_FILE() |
| 735 | endif() |
| 736 | |
| 737 | # define CSF variable |
| 738 | OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_csf") |
| 739 | |
| 740 | # include patched toolkit projects or original ones |
| 741 | foreach (BUILD_TOOLKIT ${BUILD_TOOLKITS}) |
| 742 | OCCT_ADD_SUBDIRECTORY ("src/${BUILD_TOOLKIT}") |
| 743 | endforeach() |
| 744 | |
| 745 | if (BUILD_DOC_Overview) |
| 746 | OCCT_ADD_SUBDIRECTORY (dox) |
| 747 | endif() |
| 748 | |
| 749 | # patch DRAWEXE |
| 750 | if (MSVC AND 3RDPARTY_DLL_DIRS) |
| 751 | list (FIND BUILD_TOOLKITS DRAWEXE DRAWEXE_INDEX) |
| 752 | if (${DRAWEXE_INDEX} GREATER -1) |
| 753 | list (REMOVE_DUPLICATES 3RDPARTY_DLL_DIRS) |
| 754 | set (3RDPARTY_DLL_DIRS_FOR_PATH "") |
| 755 | |
| 756 | foreach (3RDPARTY_DLL_DIR ${3RDPARTY_DLL_DIRS}) |
| 757 | set (3RDPARTY_DLL_DIRS_FOR_PATH "${3RDPARTY_DLL_DIRS_FOR_PATH};${3RDPARTY_DLL_DIR}") |
| 758 | endforeach() |
| 759 | |
| 760 | OCCT_MAKE_COMPILER_BITNESS() |
| 761 | set (X_COMPILER_BITNESS "x64") |
| 762 | if ("${COMPILER_BITNESS}" STREQUAL "32") |
| 763 | set (X_COMPILER_BITNESS "Win32") |
| 764 | endif() |
| 765 | |
| 766 | OCCT_CONFIGURE ("adm/templates/DRAWEXE.vcxproj.user.in" "${CMAKE_BINARY_DIR}/src/DRAWEXE/DRAWEXE.vcxproj.user") |
| 767 | endif() |
| 768 | endif() |
| 769 | |
| 770 | # samples do not support patch usage |
| 771 | if (BUILD_MODULE_MfcSamples) |
| 772 | set (OCCT_ROOT ${CMAKE_SOURCE_DIR}) |
| 773 | |
| 774 | set (MFC_STANDARD_SAMPLES_DIR ${OCCT_ROOT}/samples/mfc/standard) |
| 775 | set (COMMON_WINMAIN_FILE ${MFC_STANDARD_SAMPLES_DIR}/Common/Winmain.cpp) |
| 776 | |
| 777 | add_subdirectory(samples/mfc/standard/mfcsample) |
| 778 | add_subdirectory(samples/mfc/standard/01_Geometry) |
| 779 | add_subdirectory(samples/mfc/standard/02_Modeling) |
| 780 | add_subdirectory(samples/mfc/standard/03_Viewer2d) |
| 781 | add_subdirectory(samples/mfc/standard/04_Viewer3d) |
| 782 | add_subdirectory(samples/mfc/standard/05_ImportExport) |
| 783 | add_subdirectory(samples/mfc/standard/06_Ocaf) |
| 784 | add_subdirectory(samples/mfc/standard/07_Triangulation) |
| 785 | add_subdirectory(samples/mfc/standard/08_HLR) |
| 786 | add_subdirectory(samples/mfc/standard/09_Animation) |
| 787 | add_subdirectory(samples/mfc/standard/10_Convert) |
| 788 | endif() |
| 789 | |
| 790 | # Prepare variables for configuration of OpenCASCADE cmake config file |
| 791 | set (OCCT_MODULES_ENABLED) |
| 792 | set (OCCT_LIBRARIES) |
| 793 | set (SET_OpenCASCADE_MODULES_TOOLKITS "\n# List of available OpenCASCADE libraries for each module\n") |
| 794 | foreach (OCCT_TOOLKIT ${BUILD_TOOLKITS}) |
| 795 | if (TARGET ${OCCT_TOOLKIT}) |
| 796 | |
| 797 | # get all libraries |
| 798 | get_target_property (${OCCT_TOOLKIT}_TYPE ${OCCT_TOOLKIT} "TYPE") |
| 799 | if ("${${OCCT_TOOLKIT}_TYPE}" STREQUAL "STATIC_LIBRARY" OR "${${OCCT_TOOLKIT}_TYPE}" STREQUAL "SHARED_LIBRARY" ) |
| 800 | list (APPEND OCCT_LIBRARIES ${OCCT_TOOLKIT}) |
| 801 | |
| 802 | # get all modules |
| 803 | get_target_property (${OCCT_TOOLKIT}_MODULE ${OCCT_TOOLKIT} "MODULE") |
| 804 | list (APPEND OCCT_MODULES_ENABLED ${${OCCT_TOOLKIT}_MODULE}) |
| 805 | list (APPEND OpenCASCADE_${${OCCT_TOOLKIT}_MODULE}_TOOLKITS ${OCCT_TOOLKIT}) |
| 806 | endif() |
| 807 | endif() |
| 808 | endforeach() |
| 809 | list (REMOVE_DUPLICATES OCCT_MODULES_ENABLED) |
| 810 | |
| 811 | foreach (OCCT_MODULE ${OCCT_MODULES}) |
| 812 | if (BUILD_MODULE_${OCCT_MODULE}) |
| 813 | set (SET_OpenCASCADE_MODULES_TOOLKITS "${SET_OpenCASCADE_MODULES_TOOLKITS}set (OpenCASCADE_${OCCT_MODULE}_LIBRARIES ${OpenCASCADE_${OCCT_MODULE}_TOOLKITS})\n") |
| 814 | endif() |
| 815 | |
| 816 | # sort enabled modules for correct work of OpenCASCADE config file |
| 817 | list(FIND OCCT_MODULES_ENABLED "${OCCT_MODULE}" OCCT_MODULE_INDEX) |
| 818 | if (NOT ${OCCT_MODULE_INDEX} EQUAL -1) |
| 819 | list (APPEND OCCT_MODULES_ENABLED_SORTED ${OCCT_MODULE}) |
| 820 | endif() |
| 821 | endforeach() |
| 822 | set (OCCT_MODULES_ENABLED ${OCCT_MODULES_ENABLED_SORTED}) |
| 823 | |
| 824 | # Add all targets to the build-tree export set |
| 825 | export (TARGETS ${OCCT_LIBRARIES} FILE "${CMAKE_BINARY_DIR}/OpenCASCADETargets.cmake") |
| 826 | |
| 827 | # Export the package for use from the build-tree |
| 828 | # (this registers the build-tree with a global CMake-registry) |
| 829 | export(PACKAGE OpenCASCADE) |
| 830 | |
| 831 | if (CMAKE_BUILD_TYPE) |
| 832 | set (SET_OpenCASCADE_BUILD_TYPE "set (OpenCASCADE_BUILD_TYPE \"${CMAKE_BUILD_TYPE}\")") |
| 833 | endif() |
| 834 | |
| 835 | if (BUILD_SHARED_LIBS) |
| 836 | set (SET_OpenCASCADE_LINKER_FLAGS "set (OpenCASCADE_LINKER_FLAGS \"${CMAKE_SHARED_LINKER_FLAGS}\")") |
| 837 | else() |
| 838 | set (SET_OpenCASCADE_LINKER_FLAGS "set (OpenCASCADE_LINKER_FLAGS \"${CMAKE_STATIC_LINKER_FLAGS}\")") |
| 839 | endif() |
| 840 | |
| 841 | if (WIN32) |
| 842 | set (SET_OpenCASCADE_WITH_D3D "set (OpenCASCADE_WITH_D3D ${USE_D3D})") |
| 843 | endif() |
| 844 | if (APPLE) |
| 845 | set (SET_OpenCASCADE_WITH_GLX "set (OpenCASCADE_WITH_GLX ${USE_GLX})") |
| 846 | endif() |
| 847 | |
| 848 | if (NOT SINGLE_GENERATOR) |
| 849 | OCCT_INSERT_CODE_FOR_TARGET() |
| 850 | endif() |
| 851 | |
| 852 | # Configure and install cmake config file |
| 853 | configure_file("${CMAKE_SOURCE_DIR}/adm/templates/OpenCASCADEConfig.cmake.in" "OpenCASCADEConfig.cmake" @ONLY) |
| 854 | install(FILES "${CMAKE_BINARY_DIR}/OpenCASCADEConfig.cmake" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_CMAKE}") |
| 855 | |
| 856 | # Configure cmake version file |
| 857 | include(CMakePackageConfigHelpers) |
| 858 | write_basic_package_version_file( ${CMAKE_BINARY_DIR}/OpenCASCADEConfigVersion.cmake |
| 859 | VERSION ${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE} |
| 860 | COMPATIBILITY ExactVersion ) |
| 861 | |
| 862 | # Install cmake version file |
| 863 | install (FILES "${CMAKE_BINARY_DIR}/OpenCASCADEConfigVersion.cmake" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_CMAKE}") |
| 864 | |
| 865 | # Install the export set for use with the install-tree for each configuration |
| 866 | foreach (OCCT_MODULE ${OCCT_MODULES_ENABLED}) |
| 867 | install(EXPORT OpenCASCADE${OCCT_MODULE}Targets DESTINATION "${INSTALL_DIR_CMAKE}") |
| 868 | endforeach() |
| 869 | |
| 870 | # Update generated OpenCASCADETargets-*.cmake files |
| 871 | # to have correct paths to libraries depending on the configuration |
| 872 | OCCT_UPDATE_TARGET_FILE () |