# single-configuration generator
set (SINGLE_GENERATOR OFF)
-if (CMAKE_BUILD_TYPE)
+if (DEFINED CMAKE_BUILD_TYPE)
set (SINGLE_GENERATOR ON)
endif()
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:DEBUG>:OCCT_DEBUG>)
endif()
+# option disabling OCCT exceptions in Release builds (No_Exception)
+if (NOT DEFINED BUILD_RELEASE_DISABLE_EXCEPTIONS)
+ set (BUILD_RELEASE_DISABLE_EXCEPTIONS ON CACHE BOOL "${BUILD_RELEASE_DISABLE_EXCEPTIONS_DESCR}")
+endif()
+
# option to enable or disable use of precompiled headers
if (NOT DEFINED BUILD_USE_PCH)
set (BUILD_USE_PCH OFF CACHE BOOL "${BUILD_USE_PCH_DESCR}")
# Load Cotire tool for accelerating build procedure
include(cotire)
- # Set Cotire to ignore lxx, pxx, gxx
+ # Set Cotire to ignore lxx, pxx, gxx
set (COTIRE_ADDITIONAL_PREFIX_HEADER_IGNORE_EXTENSIONS "lxx;pxx;gxx" CACHE STRING "Set Cotire to ignore OCCT specific files that can be #included" FORCE)
# Set priority for inclusion of system headers in PCH to reduce problems
elseif (NOT "${CMAKE_INSTALL_PREFIX_PREV}" STREQUAL "${CMAKE_INSTALL_PREFIX}")
# CMAKE_INSTALL_PREFIX has been changed at previous step
set (CMAKE_INSTALL_PREFIX_PREV "${CMAKE_INSTALL_PREFIX}" CACHE INTERNAL "" FORCE)
-
+
# INSTALL_DIR is required to be updated
set (INSTALL_DIR "${CMAKE_INSTALL_PREFIX}" CACHE PATH "${INSTALL_DIR_DESCR}" FORCE)
endif()
# INSTALL_DIR has been changed at previous step
set (INSTALL_DIR_PREV "${INSTALL_DIR}" CACHE INTERNAL "" FORCE)
- # sync CMAKE_INSTALL_PREFIX with INSTALL_DIR
+ # sync CMAKE_INSTALL_PREFIX with INSTALL_DIR
set (CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE)
- # set CMAKE_INSTALL_PREFIX_PREV to avoid the reset of structure of the install folder
+ # set CMAKE_INSTALL_PREFIX_PREV to avoid the reset of structure of the install folder
set (CMAKE_INSTALL_PREFIX_PREV "${INSTALL_DIR}" CACHE INTERNAL "" FORCE)
endif()
separate_arguments (BUILD_ADDITIONAL_TOOLKITS)
if (MSVC)
- set (BUILD_MODULE_MfcSamples OFF CACHE BOOL "${BUILD_MODULE_MfcSamples_DESCR}")
+ set (BUILD_SAMPLES_MFC OFF CACHE BOOL "${BUILD_SAMPLES_MFC_DESCR}")
endif()
-set (BUILD_MODULE_QtSamples OFF CACHE BOOL "${BUILD_MODULE_QtSamples_DESCR}")
+set (BUILD_SAMPLES_QT OFF CACHE BOOL "${BUILD_SAMPLES_QT_DESCR}")
set (BUILD_Inspector OFF CACHE BOOL "${BUILD_Inspector_DESCR}")
set (DO_ONLY_CHECK_FOR_DOXYGEN ON)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/doxygen")
set (DO_ONLY_CHECK_FOR_DOXYGEN OFF)
-
+
if (CAN_DOXYGEN_BE_USED)
message (STATUS "Info. Overview building is turned on")
endif()
OCCT_IS_PRODUCT_REQUIRED (CSF_TclLibs USE_TCL)
OCCT_IS_PRODUCT_REQUIRED (CSF_FREETYPE USE_FREETYPE)
OCCT_IS_PRODUCT_REQUIRED (CSF_OpenGlLibs CAN_USE_GLES2)
-OCCT_IS_PRODUCT_REQUIRED (CSF_GL2PS CAN_USE_GL2PS)
OCCT_IS_PRODUCT_REQUIRED (CSF_TBB CAN_USE_TBB)
OCCT_IS_PRODUCT_REQUIRED (CSF_EIGEN CAN_USE_EIGEN)
if (USE_TCL)
message (STATUS "Info: TCL is used by OCCT")
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tcl")
-
+
message (STATUS "Info: TK is used by OCCT")
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tk")
else()
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/vtk")
else()
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_VTK")
-
+
if (NOT CAN_USE_VTK EQUAL -1)
message (STATUS "Info: TKIVtk and TKIVtkDraw toolkits excluded due to VTK usage is disabled")
OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGE")
endif()
+# OpenVR
+# search for CSF_OpenVR variable in EXTERNLIB of each being used toolkit
+OCCT_IS_PRODUCT_REQUIRED (CSF_OpenVR CAN_USE_OPENVR)
+if (CAN_USE_OPENVR)
+ set (USE_OPENVR OFF CACHE BOOL "${USE_OPENVR_DESCR}")
+
+ if (USE_OPENVR)
+ add_definitions (-DHAVE_OPENVR)
+ OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/openvr")
+ else()
+ OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_OPENVR")
+ OCCT_CHECK_AND_UNSET ("INSTALL_OPENVR")
+ endif()
+else()
+ OCCT_CHECK_AND_UNSET ("USE_OPENVR")
+
+ OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_OPENVR")
+ OCCT_CHECK_AND_UNSET ("INSTALL_OPENVR")
+endif()
+
# FFmpeg
# search for CSF_FFmpeg variable in EXTERNLIB of each being used toolkit
OCCT_IS_PRODUCT_REQUIRED (CSF_FFmpeg CAN_USE_FFMPEG)
OCCT_CHECK_AND_UNSET ("INSTALL_GLES2")
endif()
-# GL2PS
-if (NOT DEFINED ANDROID AND CAN_USE_GL2PS)
- set (USE_GL2PS OFF CACHE BOOL "${USE_GL2PS_DESCR}")
-
- if (USE_GL2PS)
- add_definitions (-DHAVE_GL2PS)
- OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gl2ps")
- else()
- OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GL2PS")
- OCCT_CHECK_AND_UNSET ("INSTALL_GL2PS")
- endif()
-else()
- OCCT_CHECK_AND_UNSET ("USE_GL2PS")
-
- OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GL2PS")
- OCCT_CHECK_AND_UNSET ("INSTALL_GL2PS")
-endif()
-
# TBB
if (NOT DEFINED ANDROID AND CAN_USE_TBB)
set (USE_TBB OFF CACHE BOOL "${USE_TBB_DESCR}")
OCCT_CHECK_AND_UNSET ("INSTALL_TBB")
endif()
+# RapidJSON
+# search for CSF_RapidJSON variable in EXTERNLIB of each being used toolkit
+OCCT_IS_PRODUCT_REQUIRED (CSF_RapidJSON CAN_USE_RAPIDJSON)
+if (CAN_USE_RAPIDJSON)
+ set (USE_RAPIDJSON OFF CACHE BOOL "${USE_RAPIDJSON_DESCR}")
+
+ if (USE_RAPIDJSON)
+ add_definitions (-DHAVE_RAPIDJSON)
+ OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/rapidjson")
+ else()
+ OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_RAPIDJSON")
+ OCCT_CHECK_AND_UNSET ("INSTALL_RAPIDJSON")
+ endif()
+else()
+ OCCT_CHECK_AND_UNSET ("USE_RAPIDJSON")
+
+ OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_RAPIDJSON")
+ OCCT_CHECK_AND_UNSET ("INSTALL_RAPIDJSON")
+endif()
+
# EIGEN
if (CAN_USE_EIGEN)
set (USE_EIGEN OFF CACHE BOOL "${USE_EIGEN_DESCR}")
OCCT_CHECK_AND_UNSET ("3RDPARTY_DOT_EXECUTABLE")
endif()
-# bison
+# bison
if (BUILD_YACCLEX)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/bison")
else()
OCCT_CHECK_AND_UNSET ("3RDPARTY_BISON_EXECUTABLE")
endif()
-# flex
+# flex
if (BUILD_YACCLEX)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/flex")
else()
OCCT_CHECK_AND_UNSET ("3RDPARTY_FLEX_EXECUTABLE")
endif()
+# qt for inspector and samples
+if (BUILD_Inspector OR BUILD_SAMPLES_QT)
+ # check qt 3rdparty path
+ add_definitions (-DHAVE_QT)
+ OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/qt")
+ message (STATUS "Info: Qt is used by OCCT")
+else()
+ OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_QT")
+ OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TQTMALLOC")
+ OCCT_CHECK_AND_UNSET ("INSTALL_QT")
+endif()
+
# check all 3rdparty include paths
string (REGEX REPLACE ";" " " 3RDPARTY_NOT_INCLUDED "${3RDPARTY_NOT_INCLUDED}")
if (3RDPARTY_NOT_INCLUDED)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bind")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libd")
-if (WIN32)
+if (WIN32)
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bini")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bind")
set (SCRIPT_EXT sh)
endif()
-if (BUILD_Inspector OR BUILD_MODULE_QtSamples)
- # check qt 3rdparty path
- add_definitions (-DHAVE_QT)
- OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/qt")
- message (STATUS "Info: Qt is used by OCCT")
-else()
- OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_QT")
- OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TQTMALLOC")
- OCCT_CHECK_AND_UNSET ("INSTALL_QT")
-endif()
-
# OCCT tools
# include the patched or original list of tools
# list <TOOLNAME>_TOOLKITS is created foreach tool and contains its toolkits
# list <OCCT_TOOLS> will contain all tools
if (BUILD_Inspector)
+ add_definitions (-DHAVE_Inspector)
+
OCCT_MODULES_AND_TOOLKITS (TOOLS "TOOL_TOOLKITS" OCCT_TOOLS)
foreach (OCCT_TOOL ${OCCT_TOOLS})
list (APPEND BUILD_TOOL_TOOLKITS ${${OCCT_TOOL}_TOOL_TOOLKITS})
OCCT_INSTALL_FILE_OR_DIR ("samples/java" "${INSTALL_DIR_SAMPLES}")
OCCT_INSTALL_FILE_OR_DIR ("samples/ocafsamples" "${INSTALL_DIR_SAMPLES}")
OCCT_INSTALL_FILE_OR_DIR ("samples/qt" "${INSTALL_DIR_SAMPLES}")
+ OCCT_INSTALL_FILE_OR_DIR ("samples/OCCTOverview/code" "${INSTALL_DIR_SAMPLES}/OCCTOverview")
install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SAMPLES}/qt/FuncDemo" RENAME "env.${SCRIPT_EXT}")
install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SAMPLES}/qt/IESample" RENAME "env.${SCRIPT_EXT}")
+ install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SAMPLES}/qt/OCCTOverview" RENAME "env.${SCRIPT_EXT}")
install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SAMPLES}/qt/Tutorial" RENAME "env.${SCRIPT_EXT}")
endif()
# write current custom.bat/sh (for build directory)
OCCT_CONFIGURE ("adm/templates/custom.build.${SCRIPT_EXT}.in" "${SUB_CUSTOM_NAME}")
-if (BUILD_MODULE_MfcSamples OR BUILD_MODULE_QtSamples)
- OCCT_INSTALL_FILE_OR_DIR ("adm/templates/sample.bat" "${INSTALL_DIR_SCRIPT}")
- OCCT_COPY_FILE_OR_DIR ("adm/templates/sample.bat" "${CMAKE_BINARY_DIR}")
+if (BUILD_SAMPLES_MFC OR BUILD_SAMPLES_QT)
+ OCCT_INSTALL_FILE_OR_DIR ("adm/templates/sample.${SCRIPT_EXT}" "${INSTALL_DIR_SCRIPT}")
+ OCCT_COPY_FILE_OR_DIR ("adm/templates/sample.${SCRIPT_EXT}" "${CMAKE_BINARY_DIR}")
endif()
-# env script for draw in building environment
-OCCT_CONFIGURE ("adm/templates/env.${SCRIPT_EXT}.in" "env.${SCRIPT_EXT}")
-
-# install env script
-install (FILES "${CMAKE_BINARY_DIR}/env.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SCRIPT}")
+if (WIN32)
+ # env script for draw in building environment
+ OCCT_CONFIGURE ("adm/templates/env.${SCRIPT_EXT}.in" "env.${SCRIPT_EXT}")
+ # install env script
+ install (FILES "${CMAKE_BINARY_DIR}/env.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SCRIPT}")
+ # copy build.bat and install.bat scripts to CMake binary folder
+ OCCT_COPY_FILE_OR_DIR ("adm/templates/build.bat" "${CMAKE_BINARY_DIR}")
+ OCCT_COPY_FILE_OR_DIR ("adm/templates/install.bat" "${CMAKE_BINARY_DIR}")
+else()
+ set (SUB_ENV_NAME "env.${SCRIPT_EXT}")
+ set (SUB_ENV_BUILD_NAME "env.install.${SCRIPT_EXT}")
+ # install env script
+ OCCT_CONFIGURE_AND_INSTALL ("adm/templates/env.install.${SCRIPT_EXT}.in" "${SUB_ENV_BUILD_NAME}" "${SUB_ENV_NAME}" "${INSTALL_DIR_SCRIPT}")
+ # env script for draw in building environment
+ OCCT_CONFIGURE ("adm/templates/env.build.${SCRIPT_EXT}.in" "env.${SCRIPT_EXT}")
+endif()
# copy DrawAppliInit from OCCT source to build directory
if (NOT EXISTS "${CMAKE_BINARY_DIR}/DrawAppliInit")
endif()
endforeach()
-if (BUILD_MODULE_QtSamples)
+if (BUILD_SAMPLES_QT)
FILE_TO_LIST ("adm/SAMPLES_RESOURCES" SAMPLES_RESOURCES)
foreach(RESOURCE ${SAMPLES_RESOURCES})
OCCT_INSTALL_FILE_OR_DIR ("samples/${RESOURCE}" "${INSTALL_DIR_RESOURCE}/samples")
#message("Copy Sample resources: samples/${RESOURCE} into ${INSTALL_DIR_RESOURCE}/samples")
endforeach()
+
+ ## Copy sources of OCCTOverview for using in the sample
+ OCCT_INSTALL_FILE_OR_DIR ("samples/OCCTOverview/code/DataExchangeSamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
+ OCCT_INSTALL_FILE_OR_DIR ("samples/OCCTOverview/code/OcafSamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
+ OCCT_INSTALL_FILE_OR_DIR ("samples/OCCTOverview/code/GeometrySamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
+ OCCT_INSTALL_FILE_OR_DIR ("samples/OCCTOverview/code/TopologySamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
+ OCCT_INSTALL_FILE_OR_DIR ("samples/OCCTOverview/code/TriangulationSamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
+ OCCT_INSTALL_FILE_OR_DIR ("samples/OCCTOverview/code/Viewer2dSamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
+ OCCT_INSTALL_FILE_OR_DIR ("samples/OCCTOverview/code/Viewer3dSamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
endif()
message (STATUS "Info: \(${CURRENT_TIME}\) OCCT toolkits processed")
# samples do not support patch usage
-if (BUILD_MODULE_MfcSamples OR BUILD_MODULE_QtSamples)
+if (BUILD_SAMPLES_MFC OR BUILD_SAMPLES_QT)
set (OCCT_ROOT ${CMAKE_SOURCE_DIR})
endif()
-if (BUILD_MODULE_MfcSamples)
+if (BUILD_SAMPLES_MFC)
set (MFC_STANDARD_SAMPLES_DIR ${OCCT_ROOT}/samples/mfc/standard)
set (COMMON_WINMAIN_FILE ${MFC_STANDARD_SAMPLES_DIR}/Common/Winmain.cpp)
OCCT_MODULES_AND_TOOLKITS (SAMPLES "SAMPLES_TOOLKITS" OCCT_SAMPLES)
-if (BUILD_MODULE_QtSamples)
- if (NOT Qt5_FOUND OR NOT WIN32)
- list (REMOVE_ITEM qt_SAMPLES_TOOLKITS AndroidQt)
- message (STATUS "Info: AndroidQt sample excluded due to Qt5 usage is disabled or OS is not Windows")
- endif()
-
- if (NOT BUILD_Inspector)
- list (REMOVE_ITEM tools_SAMPLES_TOOLKITS TInspectorEXE)
- message (STATUS "Info: TInspectorEXE sample excluded due to BUILD_Inspector is disabled")
+if (BUILD_Inspector OR BUILD_SAMPLES_QT)
+ if (BUILD_SAMPLES_QT)
+ if (NOT Qt5_FOUND OR "${Qt5Gui_EGL_INCLUDE_DIRS}" STREQUAL "" OR NOT WIN32)
+ list (REMOVE_ITEM qt_SAMPLES_TOOLKITS AndroidQt)
+ message (STATUS "Info: AndroidQt sample excluded due to OS is not Windows or Qt is configured without ANGLE")
+ endif()
+ else()
+ list (REMOVE_ITEM OCCT_SAMPLES qt)
+ message (STATUS "Info: qt samples excluded due to BUILD_SAMPLES_QT is disabled")
endif()
foreach (OCCT_SAMPLE ${OCCT_SAMPLES})
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE)
endif()
+ set (OpenCASCADE_BINARY_DIR "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
# patch TInspectorEXE
- OCCT_CONFIGURE ("adm/templates/TInspectorEXE.vcxproj.user.in" "${CMAKE_BINARY_DIR}/samples/tools/TInspectorEXE/TInspectorEXE.vcxproj.user")
+ OCCT_CONFIGURE ("adm/templates/TInspectorEXE.vcxproj.user.in" "${CMAKE_BINARY_DIR}/tools/TInspectorEXE/TInspectorEXE.vcxproj.user")
endif()
# Prepare variables for configuration of OpenCASCADE cmake config file
install(EXPORT OpenCASCADE${OCCT_MODULE}Targets DESTINATION "${INSTALL_DIR_CMAKE}")
endforeach()
-# Update generated OpenCASCADETargets-*.cmake files
+# Update generated OpenCASCADETargets-*.cmake files
# to have correct paths to libraries depending on the configuration
OCCT_UPDATE_TARGET_FILE ()