1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Compare commits

..

1 Commits

Author SHA1 Message Date
kgv
c77637edb1 0032735: Configuration, scripts - add batch scripts building 3rdparty libraries
Added scripts building:
- FreeType for macOS/iOS/Android targets.
- Draco for macOS/Linux/Android/wasm targets.
- liblzma for macOS/Android targets.
- Tcl for Android/wasm targets.
2021-12-16 14:53:16 +03:00
8304 changed files with 38700 additions and 86391 deletions

View File

@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/adm/cmake")
@@ -6,26 +6,6 @@ set (CMAKE_SUPPRESS_REGENERATION TRUE)
set (CMAKE_CONFIGURATION_TYPES Release Debug RelWithDebInfo CACHE INTERNAL "" FORCE)
# set using C++ standard
set (BUILD_CPP_STANDARD "C++11" CACHE STRING "Select using c++ standard.")
set_property(CACHE BUILD_CPP_STANDARD PROPERTY STRINGS "C++11" "C++14" "C++17" "C++20" "C++23")
# Set desired C++ standard
if ("${BUILD_CPP_STANDARD}" STREQUAL "C++11")
set (CMAKE_CXX_STANDARD 11)
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++14")
set (CMAKE_CXX_STANDARD 14)
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++17")
set (CMAKE_CXX_STANDARD 17)
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++20")
set (CMAKE_CXX_STANDARD 20)
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++23")
set (CMAKE_CXX_STANDARD 23)
else ()
message (FATAL_ERROR, "misprint in c++ standard name")
endif()
set (CMAKE_CXX_STANDARD_REQUIRED ON)
# macro: include patched file if it exists
macro (OCCT_INCLUDE_CMAKE_FILE BEING_INCLUDED_FILE)
if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/${BEING_INCLUDED_FILE}.cmake")
@@ -76,20 +56,6 @@ set_property (GLOBAL PROPERTY OCC_VERSION_MAJOR ${OCC_VERSION_MAJOR})
set_property (GLOBAL PROPERTY OCC_VERSION_MINOR ${OCC_VERSION_MINOR})
set_property (GLOBAL PROPERTY OCC_VERSION_MAINTENANCE ${OCC_VERSION_MAINTENANCE})
# set soversion variable determining compatibility version on platforms with symlinks
# 0 - for empty, 1 - for major, 2 - for major.minor, 3 - for major.minor.maintenance
if (NOT BUILD_SOVERSION_NUMBERS)
set (BUILD_SOVERSION_NUMBERS "0" CACHE STRING "${BUILD_SOVERSION_NUMBERS_DESCR}" FORCE)
SET_PROPERTY(CACHE BUILD_SOVERSION_NUMBERS PROPERTY STRINGS 0 1 2 3)
# update default state of soversion on different platforms
if (WIN32 OR ANDROID OR EMSCRIPTEN)
set (BUILD_SOVERSION_NUMBERS 0)
else()
set (BUILD_SOVERSION_NUMBERS 2)
endif()
endif()
set (INSTALL_TEST_CASES OFF CACHE BOOL "${INSTALL_TEST_CASES_DESCR}")
# Regeneration of OCCT resource files
@@ -695,10 +661,8 @@ endif()
if (CAN_USE_GLES2)
if (USE_GLES2)
add_definitions (-DHAVE_GLES2_EXT)
if (NOT IOS)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/egl")
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gles2")
endif()
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/egl")
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gles2")
else()
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_EGL")
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GLES2")
@@ -820,12 +784,6 @@ else()
OCCT_CHECK_AND_UNSET ("3RDPARTY_DOT_EXECUTABLE")
endif()
# ExpToCasExe
if (EMSCRIPTEN)
list (REMOVE_ITEM BUILD_TOOLKITS TKExpress)
list (REMOVE_ITEM BUILD_TOOLKITS ExpToCasExe)
endif()
# bison
if (BUILD_YACCLEX)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/bison")
@@ -1265,7 +1223,7 @@ foreach (OCCT_CONFIGURATION ${CMAKE_CONFIGURATION_TYPES})
endforeach()
# install OpenCASCADE config file with compile definitions and C/C++ flags ONLY for current configuration
install (CODE "string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWER)")
install (CODE "file(INSTALL FILES \"${CMAKE_BINARY_DIR}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" DESTINATION \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/\" TYPE FILE)")
install (CODE "configure_file(\"${CMAKE_BINARY_DIR}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" COPYONLY)")
foreach (OCCT_MODULE ${OCCT_MODULES})
if (BUILD_MODULE_${OCCT_MODULE})

View File

@@ -3,5 +3,5 @@ ModelingData TKG2d TKG3d TKGeomBase TKBRep
ModelingAlgorithms TKGeomAlgo TKTopAlgo TKPrim TKBO TKBool TKHLR TKFillet TKOffset TKFeat TKMesh TKXMesh TKShHealing
Visualization TKService TKV3d TKOpenGl TKOpenGles TKMeshVS TKIVtk TKD3DHost
ApplicationFramework TKCDF TKLCAF TKCAF TKBinL TKXmlL TKBin TKXml TKStdL TKStd TKTObj TKBinTObj TKXmlTObj TKVCAF
DataExchange TKXDE TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF TKRWMesh TKXDECascade TKExpress ExpToCasExe
DataExchange TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF TKRWMesh
Draw TKDraw TKTopTest TKOpenGlTest TKOpenGlesTest TKD3DHostTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE

View File

@@ -384,8 +384,6 @@ t TKSTEPBase
t TKSTL
t TKVRML
t TKXCAF
t TKXDE
t TKXDECascade
t TKXDEIGES
t TKXDESTEP
t TKXSBase
@@ -396,9 +394,6 @@ n DBRep
n DDF
n DDataStd
n DDocStd
n DE
n DEXCAFCascade
n DEBRepCascade
n DNaming
n DPrsStd
n Draw
@@ -459,7 +454,6 @@ t TKRWMesh
n RWGltf
n RWMesh
n RWObj
n RWPly
n DFBrowser
n DFBrowserPane
n DFBrowserPaneXDE
@@ -480,6 +474,3 @@ n TreeModel
n View
n ViewControl
n VInspector
n Express
t TKExpress
x ExpToCasExe

View File

@@ -22,4 +22,6 @@ if (3RDPARTY_DIR)
endforeach()
endif()
find_package (BISON 3.7.4)
# bison 3.2 is required because it provides options to avoid generation of redundant header
# files and embedding of local paths in the generated code
find_package (BISON 3.2)

View File

@@ -3,7 +3,7 @@
# See the cotire manual for usage hints.
#
#=============================================================================
# Copyright 2012-2018 Sascha Kratky
# Copyright 2012-2016 Sascha Kratky
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
@@ -43,7 +43,7 @@ if (NOT CMAKE_SCRIPT_MODE_FILE)
endif()
set (COTIRE_CMAKE_MODULE_FILE "${CMAKE_CURRENT_LIST_FILE}")
set (COTIRE_CMAKE_MODULE_VERSION "1.8.1")
set (COTIRE_CMAKE_MODULE_VERSION "1.7.9")
# activate select policies
if (POLICY CMP0025)
@@ -106,11 +106,6 @@ if (POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif()
if (POLICY CMP0055)
# strict checking for break() command
cmake_policy(SET CMP0055 NEW)
endif()
include(CMakeParseArguments)
include(ProcessorCount)
@@ -239,13 +234,7 @@ function (cotire_filter_language_source_files _language _target _sourceFilesVar
# add to excluded sources, if file has custom compile flags
list (APPEND _excludedSourceFiles "${_sourceFile}")
else()
get_source_file_property(_sourceCompileOptions "${_sourceFile}" COMPILE_OPTIONS)
if (_sourceCompileOptions)
# add to excluded sources, if file has list of custom compile options
list (APPEND _excludedSourceFiles "${_sourceFile}")
else()
list (APPEND _sourceFiles "${_sourceFile}")
endif()
list (APPEND _sourceFiles "${_sourceFile}")
endif()
endif()
endforeach()
@@ -304,7 +293,7 @@ function (cotire_get_source_file_property_values _valuesVar _property)
set (${_valuesVar} ${_values} PARENT_SCOPE)
endfunction()
function (cotire_resolve_config_properties _configurations _propertiesVar)
function (cotire_resolve_config_properites _configurations _propertiesVar)
set (_properties "")
foreach (_property ${ARGN})
if ("${_property}" MATCHES "<CONFIG>")
@@ -320,8 +309,8 @@ function (cotire_resolve_config_properties _configurations _propertiesVar)
set (${_propertiesVar} ${_properties} PARENT_SCOPE)
endfunction()
function (cotire_copy_set_properties _configurations _type _source _target)
cotire_resolve_config_properties("${_configurations}" _properties ${ARGN})
function (cotire_copy_set_properites _configurations _type _source _target)
cotire_resolve_config_properites("${_configurations}" _properties ${ARGN})
foreach (_property ${_properties})
get_property(_isSet ${_type} ${_source} PROPERTY ${_property} SET)
if (_isSet)
@@ -331,18 +320,13 @@ function (cotire_copy_set_properties _configurations _type _source _target)
endforeach()
endfunction()
function (cotire_get_target_usage_requirements _target _config _targetRequirementsVar)
function (cotire_get_target_usage_requirements _target _targetRequirementsVar)
set (_targetRequirements "")
get_target_property(_librariesToProcess ${_target} LINK_LIBRARIES)
while (_librariesToProcess)
# remove from head
list (GET _librariesToProcess 0 _library)
list (REMOVE_AT _librariesToProcess 0)
if (_library MATCHES "^\\$<\\$<CONFIG:${_config}>:([A-Za-z0-9_:-]+)>$")
set (_library "${CMAKE_MATCH_1}")
elseif (_config STREQUAL "None" AND _library MATCHES "^\\$<\\$<CONFIG:>:([A-Za-z0-9_:-]+)>$")
set (_library "${CMAKE_MATCH_1}")
endif()
if (TARGET ${_library})
list (FIND _targetRequirements ${_library} _index)
if (_index LESS 0)
@@ -457,7 +441,7 @@ function (cotire_get_target_compile_flags _config _language _target _flagsVar)
# interface compile options from linked library targets
if (_target)
set (_linkedTargets "")
cotire_get_target_usage_requirements(${_target} ${_config} _linkedTargets)
cotire_get_target_usage_requirements(${_target} _linkedTargets)
foreach (_linkedTarget ${_linkedTargets})
get_target_property(_targetOptions ${_linkedTarget} INTERFACE_COMPILE_OPTIONS)
if (_targetOptions)
@@ -589,7 +573,7 @@ function (cotire_get_target_include_directories _config _language _target _inclu
# interface include directories from linked library targets
if (_target)
set (_linkedTargets "")
cotire_get_target_usage_requirements(${_target} ${_config} _linkedTargets)
cotire_get_target_usage_requirements(${_target} _linkedTargets)
foreach (_linkedTarget ${_linkedTargets})
get_target_property(_linkedTargetType ${_linkedTarget} TYPE)
if (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE AND NOT CMAKE_VERSION VERSION_LESS "3.4.0" AND
@@ -643,7 +627,7 @@ function (cotire_get_target_include_directories _config _language _target _inclu
if (CMAKE_${_language}_IMPLICIT_INCLUDE_DIRECTORIES)
list (REMOVE_ITEM _includeDirs ${CMAKE_${_language}_IMPLICIT_INCLUDE_DIRECTORIES})
endif()
if (WIN32 AND NOT MINGW)
if (WIN32)
# convert Windows paths in include directories to CMake paths
if (_includeDirs)
set (_paths "")
@@ -719,7 +703,7 @@ function (cotire_get_target_compile_definitions _config _language _target _defin
endif()
# interface compile definitions from linked library targets
set (_linkedTargets "")
cotire_get_target_usage_requirements(${_target} ${_config} _linkedTargets)
cotire_get_target_usage_requirements(${_target} _linkedTargets)
foreach (_linkedTarget ${_linkedTargets})
get_target_property(_definitions ${_linkedTarget} INTERFACE_COMPILE_DEFINITIONS)
if (_definitions)
@@ -727,7 +711,7 @@ function (cotire_get_target_compile_definitions _config _language _target _defin
endif()
endforeach()
# parse additional compile definitions from target compile flags
# and do not look at directory compile definitions, which we already handled
# and don't look at directory compile definitions, which we already handled
set (_targetFlags "")
cotire_get_target_compile_flags("${_config}" "${_language}" "${_target}" _targetFlags)
cotire_filter_compile_flags("${_language}" "D" _definitions _ignore ${_targetFlags})
@@ -875,9 +859,6 @@ macro (cotire_set_cmd_to_prologue _cmdVar)
list (APPEND ${_cmdVar} "--warn-uninitialized")
endif()
list (APPEND ${_cmdVar} "-DCOTIRE_BUILD_TYPE:STRING=$<CONFIGURATION>")
if (XCODE)
list (APPEND ${_cmdVar} "-DXCODE:BOOL=TRUE")
endif()
if (COTIRE_VERBOSE)
list (APPEND ${_cmdVar} "-DCOTIRE_VERBOSE:BOOL=ON")
elseif("${CMAKE_GENERATOR}" MATCHES "Makefiles")
@@ -895,9 +876,6 @@ function (cotire_init_compile_cmd _cmdVar _language _compilerLauncher _compilerE
if (NOT _compilerArg1)
set (_compilerArg1 ${CMAKE_${_language}_COMPILER_ARG1})
endif()
if (WIN32)
file (TO_NATIVE_PATH "${_compilerExe}" _compilerExe)
endif()
string (STRIP "${_compilerArg1}" _compilerArg1)
if ("${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
# compiler launcher is only supported for Makefile and Ninja
@@ -924,16 +902,16 @@ function (cotire_add_includes_to_cmd _cmdVar _language _includesVar _systemInclu
foreach (_include ${_includeDirs})
if (WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
file (TO_NATIVE_PATH "${_include}" _include)
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_SEP_${_language}}${_include}")
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_${_language}_SEP}${_include}")
else()
set (_index -1)
if ("${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}" MATCHES ".+")
list (FIND ${_systemIncludesVar} "${_include}" _index)
endif()
if (_index GREATER -1)
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_SEP_${_language}}${_include}")
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}${_include}")
else()
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_SEP_${_language}}${_include}")
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_${_language}_SEP}${_include}")
endif()
endif()
endforeach()
@@ -1068,10 +1046,10 @@ macro (cotire_check_ignore_header_file_path _headerFile _headerIsIgnoredVar)
set (${_headerIsIgnoredVar} TRUE)
elseif (IS_DIRECTORY "${_headerFile}")
set (${_headerIsIgnoredVar} TRUE)
elseif ("${_headerFile}" MATCHES "\\.\\.|[_-]fixed")
# heuristic: ignore headers with embedded parent directory references or "-fixed" or "_fixed" in path
elseif ("${_headerFile}" MATCHES "\\.\\.|[_-]fixed" AND "${_headerFile}" MATCHES "\\.h$")
# heuristic: ignore C headers with embedded parent directory references or "-fixed" or "_fixed" in path
# these often stem from using GCC #include_next tricks, which may break the precompiled header compilation
# with the error message "error: no include path in which to search for header"
# with the error message "error: no include path in which to search for header.h"
set (${_headerIsIgnoredVar} TRUE)
else()
set (${_headerIsIgnoredVar} FALSE)
@@ -1092,11 +1070,12 @@ endmacro()
macro (cotire_parse_line _line _headerFileVar _headerDepthVar)
if (MSVC)
# cl.exe /showIncludes produces different output, depending on the language pack used, e.g.:
# cl.exe /showIncludes output looks different depending on the language pack used, e.g.:
# English: "Note: including file: C:\directory\file"
# German: "Hinweis: Einlesen der Datei: C:\directory\file"
# We use a very general regular expression, relying on the presence of the : characters
if (_line MATCHES "( +)([a-zA-Z]:[^:]+)$")
# Visual Studio compiler output
string (LENGTH "${CMAKE_MATCH_1}" ${_headerDepthVar})
get_filename_component(${_headerFileVar} "${CMAKE_MATCH_2}" ABSOLUTE)
else()
@@ -1254,19 +1233,11 @@ function (cotire_scan_includes _includesVar)
set (${_includesVar} "" PARENT_SCOPE)
return()
endif()
# add source files to be scanned
if (WIN32)
foreach (_sourceFile ${_existingSourceFiles})
file (TO_NATIVE_PATH "${_sourceFile}" _sourceFileNative)
list (APPEND _cmd "${_sourceFileNative}")
endforeach()
else()
list (APPEND _cmd ${_existingSourceFiles})
endif()
list (APPEND _cmd ${_existingSourceFiles})
if (COTIRE_VERBOSE)
message (STATUS "execute_process: ${_cmd}")
endif()
if (MSVC_IDE OR _option_COMPILER_ID MATCHES "MSVC")
if (_option_COMPILER_ID MATCHES "MSVC")
# cl.exe messes with the output streams unless the environment variable VS_UNICODE_OUTPUT is cleared
unset (ENV{VS_UNICODE_OUTPUT})
endif()
@@ -1502,16 +1473,11 @@ function (cotire_generate_prefix_header _prefixFile)
if (_unparsedLines)
if (COTIRE_VERBOSE OR _scanResult OR NOT _selectedHeaders)
list (LENGTH _unparsedLines _skippedLineCount)
if (WIN32)
file (TO_NATIVE_PATH "${_unparsedLinesFile}" _unparsedLinesLogPath)
else()
set (_unparsedLinesLogPath "${_unparsedLinesFile}")
endif()
message (STATUS "${_skippedLineCount} line(s) skipped, see ${_unparsedLinesLogPath}")
message (STATUS "${_skippedLineCount} line(s) skipped, see ${_unparsedLinesFile}")
endif()
string (REPLACE ";" "\n" _unparsedLines "${_unparsedLines}")
endif()
file (WRITE "${_unparsedLinesFile}" "${_unparsedLines}\n")
file (WRITE "${_unparsedLinesFile}" "${_unparsedLines}")
endfunction()
function (cotire_add_makedep_flags _language _compilerID _compilerVersion _flagsVar)
@@ -1541,7 +1507,7 @@ function (cotire_add_makedep_flags _language _compilerID _compilerVersion _flags
# append to list
list (APPEND _flags -H -E)
if (NOT "${_compilerVersion}" VERSION_LESS "4.3.0")
list (APPEND _flags -fdirectives-only)
list (APPEND _flags "-fdirectives-only")
endif()
else()
# return as a flag string
@@ -1551,36 +1517,16 @@ function (cotire_add_makedep_flags _language _compilerID _compilerVersion _flags
endif()
endif()
elseif (_compilerID MATCHES "Clang")
if (UNIX)
# Clang options used
# -H print the name of each header file used
# -E invoke preprocessor
# -fno-color-diagnostics do not print diagnostics in color
# -Eonly just run preprocessor, no output
if (_flags)
# append to list
list (APPEND _flags -H -E -fno-color-diagnostics -Xclang -Eonly)
else()
# return as a flag string
set (_flags "-H -E -fno-color-diagnostics -Xclang -Eonly")
endif()
elseif (WIN32)
# Clang-cl.exe options used
# /TC treat all files named on the command line as C source files
# /TP treat all files named on the command line as C++ source files
# /EP preprocess to stdout without #line directives
# -H print the name of each header file used
# -fno-color-diagnostics do not print diagnostics in color
# -Eonly just run preprocessor, no output
set (_sourceFileTypeC "/TC")
set (_sourceFileTypeCXX "/TP")
if (_flags)
# append to list
list (APPEND _flags "${_sourceFileType${_language}}" /EP -fno-color-diagnostics -Xclang -H -Xclang -Eonly)
else()
# return as a flag string
set (_flags "${_sourceFileType${_language}} /EP -fno-color-diagnostics -Xclang -H -Xclang -Eonly")
endif()
# Clang options used
# -H print the name of each header file used
# -E invoke preprocessor
# -fno-color-diagnostics don't prints diagnostics in color
if (_flags)
# append to list
list (APPEND _flags -H -E -fno-color-diagnostics)
else()
# return as a flag string
set (_flags "-H -E -fno-color-diagnostics")
endif()
elseif (_compilerID MATCHES "Intel")
if (WIN32)
@@ -1654,8 +1600,8 @@ function (cotire_add_pch_compilation_flags _language _compilerID _compilerVersio
set (_flags "${_flags} /Zm${COTIRE_PCH_MEMORY_SCALING_FACTOR}")
endif()
endif()
elseif (_compilerID MATCHES "GNU")
# GCC options used
elseif (_compilerID MATCHES "GNU|Clang")
# GCC / Clang options used
# -x specify the source language
# -c compile but do not link
# -o place output in file
@@ -1665,55 +1611,11 @@ function (cotire_add_pch_compilation_flags _language _compilerID _compilerVersio
set (_xLanguage_CXX "c++-header")
if (_flags)
# append to list
list (APPEND _flags -x "${_xLanguage_${_language}}" -c "${_prefixFile}" -o "${_pchFile}")
list (APPEND _flags "-x" "${_xLanguage_${_language}}" "-c" "${_prefixFile}" -o "${_pchFile}")
else()
# return as a flag string
set (_flags "-x ${_xLanguage_${_language}} -c \"${_prefixFile}\" -o \"${_pchFile}\"")
endif()
elseif (_compilerID MATCHES "Clang")
if (UNIX)
# Clang options used
# -x specify the source language
# -c compile but do not link
# -o place output in file
# -fno-pch-timestamp disable inclusion of timestamp in precompiled headers (clang 4.0.0+)
set (_xLanguage_C "c-header")
set (_xLanguage_CXX "c++-header")
if (_flags)
# append to list
list (APPEND _flags -x "${_xLanguage_${_language}}" -c "${_prefixFile}" -o "${_pchFile}")
if (NOT "${_compilerVersion}" VERSION_LESS "4.0.0")
list (APPEND _flags -Xclang -fno-pch-timestamp)
endif()
else()
# return as a flag string
set (_flags "-x ${_xLanguage_${_language}} -c \"${_prefixFile}\" -o \"${_pchFile}\"")
if (NOT "${_compilerVersion}" VERSION_LESS "4.0.0")
set (_flags "${_flags} -Xclang -fno-pch-timestamp")
endif()
endif()
elseif (WIN32)
file (TO_NATIVE_PATH "${_prefixFile}" _prefixFileNative)
file (TO_NATIVE_PATH "${_pchFile}" _pchFileNative)
file (TO_NATIVE_PATH "${_hostFile}" _hostFileNative)
# Clang-cl.exe options used
# /Yc creates a precompiled header file
# /Fp specifies precompiled header binary file name
# /FI forces inclusion of file
# /Zs syntax check only
# /TC treat all files named on the command line as C source files
# /TP treat all files named on the command line as C++ source files
set (_sourceFileTypeC "/TC")
set (_sourceFileTypeCXX "/TP")
if (_flags)
# append to list
list (APPEND _flags "${_sourceFileType${_language}}"
"/Yc${_prefixFileNative}" "/Fp${_pchFileNative}" "/FI${_prefixFileNative}" /Zs "${_hostFileNative}")
else()
# return as a flag string
set (_flags "/Yc\"${_prefixFileNative}\" /Fp\"${_pchFileNative}\" /FI\"${_prefixFileNative}\"")
endif()
endif()
elseif (_compilerID MATCHES "Intel")
if (WIN32)
file (TO_NATIVE_PATH "${_prefixFile}" _prefixFileNative)
@@ -1755,28 +1657,20 @@ function (cotire_add_pch_compilation_flags _language _compilerID _compilerVersio
get_filename_component(_pchName "${_pchFile}" NAME)
set (_xLanguage_C "c-header")
set (_xLanguage_CXX "c++-header")
set (_pchSuppressMessages FALSE)
if ("${CMAKE_${_language}_FLAGS}" MATCHES ".*-Wno-pch-messages.*")
set(_pchSuppressMessages TRUE)
endif()
if (_flags)
# append to list
if ("${_language}" STREQUAL "CXX")
list (APPEND _flags -Kc++)
endif()
list (APPEND _flags -include "${_prefixFile}" -pch-dir "${_pchDir}" -pch-create "${_pchName}" -fsyntax-only "${_hostFile}")
list (APPEND _flags "-include" "${_prefixFile}" "-pch-dir" "${_pchDir}" "-pch-create" "${_pchName}" "-fsyntax-only" "${_hostFile}")
if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0")
if (NOT _pchSuppressMessages)
list (APPEND _flags -Wpch-messages)
endif()
list (APPEND _flags "-Wpch-messages")
endif()
else()
# return as a flag string
set (_flags "-include \"${_prefixFile}\" -pch-dir \"${_pchDir}\" -pch-create \"${_pchName}\"")
if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0")
if (NOT _pchSuppressMessages)
set (_flags "${_flags} -Wpch-messages")
endif()
set (_flags "${_flags} -Wpch-messages")
endif()
endif()
endif()
@@ -1827,48 +1721,23 @@ function (cotire_add_prefix_pch_inclusion_flags _language _compilerID _compilerV
# note: ccache requires the -include flag to be used in order to process precompiled header correctly
if (_flags)
# append to list
list (APPEND _flags -Winvalid-pch -include "${_prefixFile}")
list (APPEND _flags "-Winvalid-pch" "-include" "${_prefixFile}")
else()
# return as a flag string
set (_flags "-Winvalid-pch -include \"${_prefixFile}\"")
endif()
elseif (_compilerID MATCHES "Clang")
if (UNIX)
# Clang options used
# -include process include file as the first line of the primary source file
# note: ccache requires the -include flag to be used in order to process precompiled header correctly
if (_flags)
# append to list
list (APPEND _flags -include "${_prefixFile}")
else()
# return as a flag string
set (_flags "-include \"${_prefixFile}\"")
endif()
elseif (WIN32)
file (TO_NATIVE_PATH "${_prefixFile}" _prefixFileNative)
# Clang-cl.exe options used
# /Yu uses a precompiled header file during build
# /Fp specifies precompiled header binary file name
# /FI forces inclusion of file
if (_pchFile)
file (TO_NATIVE_PATH "${_pchFile}" _pchFileNative)
if (_flags)
# append to list
list (APPEND _flags "/Yu${_prefixFileNative}" "/Fp${_pchFileNative}" "/FI${_prefixFileNative}")
else()
# return as a flag string
set (_flags "/Yu\"${_prefixFileNative}\" /Fp\"${_pchFileNative}\" /FI\"${_prefixFileNative}\"")
endif()
else()
# no precompiled header, force inclusion of prefix header
if (_flags)
# append to list
list (APPEND _flags "/FI${_prefixFileNative}")
else()
# return as a flag string
set (_flags "/FI\"${_prefixFileNative}\"")
endif()
endif()
# Clang options used
# -include process include file as the first line of the primary source file
# -include-pch include precompiled header file
# -Qunused-arguments don't emit warning for unused driver arguments
# note: ccache requires the -include flag to be used in order to process precompiled header correctly
if (_flags)
# append to list
list (APPEND _flags "-Qunused-arguments" "-include" "${_prefixFile}")
else()
# return as a flag string
set (_flags "-Qunused-arguments -include \"${_prefixFile}\"")
endif()
elseif (_compilerID MATCHES "Intel")
if (WIN32)
@@ -1912,32 +1781,24 @@ function (cotire_add_prefix_pch_inclusion_flags _language _compilerID _compilerV
if (_pchFile)
get_filename_component(_pchDir "${_pchFile}" DIRECTORY)
get_filename_component(_pchName "${_pchFile}" NAME)
set (_pchSuppressMessages FALSE)
if ("${CMAKE_${_language}_FLAGS}" MATCHES ".*-Wno-pch-messages.*")
set(_pchSuppressMessages TRUE)
endif()
if (_flags)
# append to list
list (APPEND _flags -include "${_prefixFile}" -pch-dir "${_pchDir}" -pch-use "${_pchName}")
list (APPEND _flags "-include" "${_prefixFile}" "-pch-dir" "${_pchDir}" "-pch-use" "${_pchName}")
if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0")
if (NOT _pchSuppressMessages)
list (APPEND _flags -Wpch-messages)
endif()
list (APPEND _flags "-Wpch-messages")
endif()
else()
# return as a flag string
set (_flags "-include \"${_prefixFile}\" -pch-dir \"${_pchDir}\" -pch-use \"${_pchName}\"")
if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0")
if (NOT _pchSuppressMessages)
set (_flags "${_flags} -Wpch-messages")
endif()
set (_flags "${_flags} -Wpch-messages")
endif()
endif()
else()
# no precompiled header, force inclusion of prefix header
if (_flags)
# append to list
list (APPEND _flags -include "${_prefixFile}")
list (APPEND _flags "-include" "${_prefixFile}")
else()
# return as a flag string
set (_flags "-include \"${_prefixFile}\"")
@@ -1975,17 +1836,9 @@ function (cotire_precompile_prefix_header _prefixFile _pchFile _hostFile)
if (COTIRE_VERBOSE)
message (STATUS "execute_process: ${_cmd}")
endif()
if (MSVC_IDE OR _option_COMPILER_ID MATCHES "MSVC")
if (_option_COMPILER_ID MATCHES "MSVC")
# cl.exe messes with the output streams unless the environment variable VS_UNICODE_OUTPUT is cleared
unset (ENV{VS_UNICODE_OUTPUT})
elseif (_option_COMPILER_ID MATCHES "Clang" AND _option_COMPILER_VERSION VERSION_LESS "4.0.0")
if (_option_COMPILER_LAUNCHER MATCHES "ccache" OR
_option_COMPILER_EXECUTABLE MATCHES "ccache")
# Newer versions of Clang embed a compilation timestamp into the precompiled header binary,
# which results in "file has been modified since the precompiled header was built" errors if ccache is used.
# We work around the problem by disabling ccache upon pre-compiling the prefix header.
set (ENV{CCACHE_DISABLE} "true")
endif()
endif()
execute_process(
COMMAND ${_cmd}
@@ -2000,7 +1853,7 @@ function (cotire_check_precompiled_header_support _language _target _msgVar)
set (_unsupportedCompiler
"Precompiled headers not supported for ${_language} compiler ${CMAKE_${_language}_COMPILER_ID}")
if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC")
# PCH supported since Visual Studio C++ 6.0
# supported since Visual Studio C++ 6.0
# and CMake does not support an earlier version
set (${_msgVar} "" PARENT_SCOPE)
elseif (CMAKE_${_language}_COMPILER_ID MATCHES "GNU")
@@ -2011,16 +1864,8 @@ function (cotire_check_precompiled_header_support _language _target _msgVar)
set (${_msgVar} "" PARENT_SCOPE)
endif()
elseif (CMAKE_${_language}_COMPILER_ID MATCHES "Clang")
if (UNIX)
# all Unix Clang versions have PCH support
set (${_msgVar} "" PARENT_SCOPE)
elseif (WIN32)
# only clang-cl is supported under Windows
get_filename_component(_compilerName "${CMAKE_${_language}_COMPILER}" NAME_WE)
if (NOT _compilerName MATCHES "cl$")
set (${_msgVar} "${_unsupportedCompiler} version ${CMAKE_${_language}_COMPILER_VERSION}. Use clang-cl instead." PARENT_SCOPE)
endif()
endif()
# all Clang versions have PCH support
set (${_msgVar} "" PARENT_SCOPE)
elseif (CMAKE_${_language}_COMPILER_ID MATCHES "Intel")
# Intel PCH support requires version >= 8.0.0
if ("${CMAKE_${_language}_COMPILER_VERSION}" VERSION_LESS "8.0.0")
@@ -2031,38 +1876,29 @@ function (cotire_check_precompiled_header_support _language _target _msgVar)
else()
set (${_msgVar} "${_unsupportedCompiler}." PARENT_SCOPE)
endif()
# check if ccache is used as a compiler launcher
get_target_property(_launcher ${_target} ${_language}_COMPILER_LAUNCHER)
get_filename_component(_realCompilerExe "${CMAKE_${_language}_COMPILER}" REALPATH)
if (_realCompilerExe MATCHES "ccache" OR _launcher MATCHES "ccache")
# verify that ccache configuration is compatible with precompiled headers
# always check environment variable CCACHE_SLOPPINESS, because earlier versions of ccache
# do not report the "sloppiness" setting correctly upon printing ccache configuration
if (CMAKE_${_language}_COMPILER MATCHES "ccache" OR _launcher MATCHES "ccache")
if (DEFINED ENV{CCACHE_SLOPPINESS})
if (NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "pch_defines" OR
NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "time_macros")
if (NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "pch_defines" OR NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "time_macros")
set (${_msgVar}
"ccache requires the environment variable CCACHE_SLOPPINESS to be set to \"pch_defines,time_macros\"."
PARENT_SCOPE)
endif()
else()
if (_realCompilerExe MATCHES "ccache")
set (_ccacheExe "${_realCompilerExe}")
if (_launcher MATCHES "ccache")
get_filename_component(_ccacheExe "${_launcher}" REALPATH)
else()
set (_ccacheExe "${_launcher}")
get_filename_component(_ccacheExe "${CMAKE_${_language}_COMPILER}" REALPATH)
endif()
# ccache 3.7.0 replaced --print-config with --show-config
# use -p instead, which seems to work for all version for now, sigh
execute_process(
COMMAND "${_ccacheExe}" "-p"
COMMAND "${_ccacheExe}" "--print-config"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
RESULT_VARIABLE _result
OUTPUT_VARIABLE _ccacheConfig OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET)
if (_result)
set (${_msgVar} "ccache configuration cannot be determined." PARENT_SCOPE)
elseif (NOT _ccacheConfig MATCHES "sloppiness.*=.*time_macros" OR
NOT _ccacheConfig MATCHES "sloppiness.*=.*pch_defines")
if (_result OR NOT
_ccacheConfig MATCHES "sloppiness.*=.*time_macros" OR NOT
_ccacheConfig MATCHES "sloppiness.*=.*pch_defines")
set (${_msgVar}
"ccache requires configuration setting \"sloppiness\" to be set to \"pch_defines,time_macros\"."
PARENT_SCOPE)
@@ -2355,7 +2191,7 @@ function (cotire_generate_target_script _language _configurations _target _targe
XCODE MSVC CMAKE_GENERATOR CMAKE_BUILD_TYPE CMAKE_CONFIGURATION_TYPES
CMAKE_${_language}_COMPILER_ID CMAKE_${_language}_COMPILER_VERSION
CMAKE_${_language}_COMPILER_LAUNCHER CMAKE_${_language}_COMPILER CMAKE_${_language}_COMPILER_ARG1
CMAKE_INCLUDE_FLAG_${_language} CMAKE_INCLUDE_FLAG_SEP_${_language}
CMAKE_INCLUDE_FLAG_${_language} CMAKE_INCLUDE_FLAG_${_language}_SEP
CMAKE_INCLUDE_SYSTEM_FLAG_${_language}
CMAKE_${_language}_FRAMEWORK_SEARCH_FLAG
CMAKE_${_language}_SYSTEM_FRAMEWORK_SEARCH_FLAG
@@ -2388,9 +2224,8 @@ endfunction()
function (cotire_setup_pch_file_compilation _language _target _targetScript _prefixFile _pchFile _hostFile)
set (_sourceFiles ${ARGN})
if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel" OR
(WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "Clang"))
# for MSVC, Intel and Clang-cl, we attach the precompiled header compilation to the host file
if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
# for Visual Studio and Intel, we attach the precompiled header compilation to the host file
# the remaining files include the precompiled header, see cotire_setup_pch_file_inclusion
if (_sourceFiles)
set (_flags "")
@@ -2398,9 +2233,6 @@ function (cotire_setup_pch_file_compilation _language _target _targetScript _pre
"${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}"
"${_prefixFile}" "${_pchFile}" "${_hostFile}" _flags)
set_property (SOURCE ${_hostFile} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ")
if (COTIRE_DEBUG)
message (STATUS "set_property: SOURCE ${_hostFile} APPEND_STRING COMPILE_FLAGS ${_flags}")
endif()
set_property (SOURCE ${_hostFile} APPEND PROPERTY OBJECT_OUTPUTS "${_pchFile}")
# make object file generated from host file depend on prefix header
set_property (SOURCE ${_hostFile} APPEND PROPERTY OBJECT_DEPENDS "${_prefixFile}")
@@ -2438,9 +2270,8 @@ function (cotire_setup_pch_file_compilation _language _target _targetScript _pre
endfunction()
function (cotire_setup_pch_file_inclusion _language _target _wholeTarget _prefixFile _pchFile _hostFile)
if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel" OR
(WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "Clang"))
# for MSVC, Intel and clang-cl, we include the precompiled header in all but the host file
if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
# for Visual Studio and Intel, we include the precompiled header in all but the host file
# the host file does the precompiled header compilation, see cotire_setup_pch_file_compilation
set (_sourceFiles ${ARGN})
list (LENGTH _sourceFiles _numberOfSourceFiles)
@@ -2452,9 +2283,6 @@ function (cotire_setup_pch_file_inclusion _language _target _wholeTarget _prefix
"${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}"
"${_prefixFile}" "${_pchFile}" _flags)
set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ")
if (COTIRE_DEBUG)
message (STATUS "set_property: SOURCE ${_sourceFiles} APPEND_STRING COMPILE_FLAGS ${_flags}")
endif()
# make object files generated from source files depend on precompiled header
set_property (SOURCE ${_sourceFiles} APPEND PROPERTY OBJECT_DEPENDS "${_pchFile}")
endif()
@@ -2468,9 +2296,6 @@ function (cotire_setup_pch_file_inclusion _language _target _wholeTarget _prefix
"${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}"
"${_prefixFile}" "${_pchFile}" _flags)
set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ")
if (COTIRE_DEBUG)
message (STATUS "set_property: SOURCE ${_sourceFiles} APPEND_STRING COMPILE_FLAGS ${_flags}")
endif()
# mark sources as cotired to prevent them from being used in another cotired target
set_source_files_properties(${_sourceFiles} PROPERTIES COTIRE_TARGET "${_target}")
endif()
@@ -2488,9 +2313,6 @@ function (cotire_setup_prefix_file_inclusion _language _target _prefixFile)
"${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}"
"${_prefixFile}" "${_pchFile}" _flags)
set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ")
if (COTIRE_DEBUG)
message (STATUS "set_property: SOURCE ${_sourceFiles} APPEND_STRING COMPILE_FLAGS ${_flags}")
endif()
# mark sources as cotired to prevent them from being used in another cotired target
set_source_files_properties(${_sourceFiles} PROPERTIES COTIRE_TARGET "${_target}")
# make object files generated from source files depend on prefix header
@@ -2580,7 +2402,7 @@ function (cotire_setup_target_pch_usage _languages _target _wholeTarget)
message (STATUS "add_custom_command: TARGET ${_target} PRE_BUILD ${_cmds}")
endif()
# because CMake PRE_BUILD command does not support dependencies,
# we check dependencies explicity in cotire script mode when the pre-build action is run
# we check dependencies explicitly in cotire script mode when the pre-build action is run
add_custom_command(
TARGET "${_target}"
PRE_BUILD ${_cmds}
@@ -2595,10 +2417,9 @@ function (cotire_setup_target_pch_usage _languages _target _wholeTarget)
# if this is a single-language target without any excluded files
if (_wholeTarget)
set (_language "${_languages}")
# for MSVC, Intel and clang-cl, precompiled header inclusion is always done on the source file level
# for Visual Studio and Intel, precompiled header inclusion is always done on the source file level
# see cotire_setup_pch_file_inclusion
if (NOT CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel" AND NOT
(WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "Clang"))
if (NOT CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
get_property(_prefixFile TARGET ${_target} PROPERTY COTIRE_${_language}_PREFIX_HEADER)
if (_prefixFile)
get_property(_pchFile TARGET ${_target} PROPERTY COTIRE_${_language}_PRECOMPILED_HEADER)
@@ -2607,9 +2428,6 @@ function (cotire_setup_target_pch_usage _languages _target _wholeTarget)
"${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}"
"${_prefixFile}" "${_pchFile}" _options)
set_property(TARGET ${_target} APPEND PROPERTY ${_options})
if (COTIRE_DEBUG)
message (STATUS "set_property: TARGET ${_target} APPEND PROPERTY ${_options}")
endif()
endif()
endif()
endif()
@@ -2636,8 +2454,7 @@ function (cotire_setup_unity_generation_commands _language _target _targetScript
set_property (SOURCE "${_unityFile}" PROPERTY OBJECT_DEPENDS ${_objectDependsPaths})
endif()
if (WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
# unity file compilation results in potentially huge object file,
# thus use /bigobj by default unter cl.exe and Windows Intel
# unity file compilation results in potentially huge object file, thus use /bigobj by default unter MSVC and Windows Intel
set_property (SOURCE "${_unityFile}" APPEND_STRING PROPERTY COMPILE_FLAGS "/bigobj")
endif()
cotire_set_cmd_to_prologue(_unityCmd)
@@ -2843,9 +2660,6 @@ function (cotire_make_target_message _target _languages _disableMsg _targetMsgVa
else()
set (_targetMsg "${_languagesStr} target ${_target} cotired without unity build.")
endif()
if (_disableMsg)
set (_targetMsg "${_targetMsg} ${_disableMsg}")
endif()
else()
if (_excludedStr)
set (_targetMsg "${_languagesStr} target ${_target} cotired ${_excludedStr}.")
@@ -2935,20 +2749,6 @@ function (cotire_choose_target_languages _target _targetLanguagesVar _wholeTarge
set (_targetUsePCH FALSE)
endif()
endif()
if (_targetAddSCU)
# disable unity builds if automatic Qt processing is used
get_target_property(_targetAutoMoc ${_target} AUTOMOC)
get_target_property(_targetAutoUic ${_target} AUTOUIC)
get_target_property(_targetAutoRcc ${_target} AUTORCC)
if (_targetAutoMoc OR _targetAutoUic OR _targetAutoRcc)
if (_disableMsg)
set (_disableMsg "${_disableMsg} Target uses automatic CMake Qt processing.")
else()
set (_disableMsg "Target uses automatic CMake Qt processing.")
endif()
set (_targetAddSCU FALSE)
endif()
endif()
set_property(TARGET ${_target} PROPERTY COTIRE_ENABLE_PRECOMPILED_HEADER ${_targetUsePCH})
set_property(TARGET ${_target} PROPERTY COTIRE_ADD_UNITY_BUILD ${_targetAddSCU})
cotire_make_target_message(${_target} "${_targetLanguages}" "${_disableMsg}" _targetMsg ${_allExcludedSourceFiles})
@@ -2976,11 +2776,7 @@ function (cotire_compute_unity_max_number_of_includes _target _maxIncludesVar)
set (_sourceFiles ${ARGN})
get_target_property(_maxIncludes ${_target} COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES)
if (_maxIncludes MATCHES "(-j|--parallel|--jobs) ?([0-9]*)")
if (DEFINED CMAKE_MATCH_2)
set (_numberOfThreads "${CMAKE_MATCH_2}")
else()
set (_numberOfThreads "")
endif()
set (_numberOfThreads "${CMAKE_MATCH_2}")
if (NOT _numberOfThreads)
# use all available cores
ProcessorCount(_numberOfThreads)
@@ -3093,9 +2889,8 @@ function (cotire_setup_pch_target _languages _configurations _target)
set (_dependsFiles "")
foreach (_language ${_languages})
set (_props COTIRE_${_language}_PREFIX_HEADER COTIRE_${_language}_UNITY_SOURCE)
if (NOT CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel" AND NOT
(WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "Clang"))
# MSVC, Intel and clang-cl only create precompiled header as a side effect
if (NOT CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
# Visual Studio and Intel only create precompiled header as a side effect
list (INSERT _props 0 COTIRE_${_language}_PRECOMPILED_HEADER)
endif()
cotire_get_first_set_property_value(_dependsFile TARGET ${_target} ${_props})
@@ -3143,7 +2938,6 @@ function (cotire_collect_unity_target_sources _target _languages _unityTargetSou
list (APPEND _unityTargetSources ${_unityFiles})
endif()
endforeach()
# handle object libraries which are part of the target's sources
get_target_property(_linkLibrariesStrategy ${_target} COTIRE_UNITY_LINK_LIBRARIES_INIT)
if ("${_linkLibrariesStrategy}" MATCHES "^COPY_UNITY$")
cotire_filter_object_libraries(${_target} _objectLibraries ${_targetSourceFiles})
@@ -3188,6 +2982,21 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
# determine unity target sources
set (_unityTargetSources "")
cotire_collect_unity_target_sources(${_target} "${_languages}" _unityTargetSources)
# handle automatic Qt processing
get_target_property(_targetAutoMoc ${_target} AUTOMOC)
get_target_property(_targetAutoUic ${_target} AUTOUIC)
get_target_property(_targetAutoRcc ${_target} AUTORCC)
if (_targetAutoMoc OR _targetAutoUic OR _targetAutoRcc)
# if the original target sources are subject to CMake's automatic Qt processing,
# also include implicitly generated <targetname>_automoc.cpp file
if (CMAKE_VERSION VERSION_LESS "3.8.0")
list (APPEND _unityTargetSources "${_target}_automoc.cpp")
set_property (SOURCE "${_target}_automoc.cpp" PROPERTY GENERATED TRUE)
else()
list (APPEND _unityTargetSources "${_target}_autogen/moc_compilation.cpp")
set_property (SOURCE "${_target}_autogen/moc_compilation.cpp" PROPERTY GENERATED TRUE)
endif()
endif()
# prevent AUTOMOC, AUTOUIC and AUTORCC properties from being set when the unity target is created
set (CMAKE_AUTOMOC OFF)
set (CMAKE_AUTOUIC OFF)
@@ -3201,6 +3010,21 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
else()
add_library(${_unityTargetName} ${_unityTargetSubType} EXCLUDE_FROM_ALL ${_unityTargetSources})
endif()
if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio")
# depend on original target's automoc target, if it exists
if (TARGET ${_target}_automoc)
add_dependencies(${_unityTargetName} ${_target}_automoc)
endif()
else()
if (_targetAutoMoc OR _targetAutoUic OR _targetAutoRcc)
# depend on the original target's implicitly generated <targetname>_automoc target
if (CMAKE_VERSION VERSION_LESS "3.8.0")
add_dependencies(${_unityTargetName} ${_target}_automoc)
else()
add_dependencies(${_unityTargetName} ${_target}_autogen)
endif()
endif()
endif()
# copy output location properties
set (_outputDirProperties
ARCHIVE_OUTPUT_DIRECTORY ARCHIVE_OUTPUT_DIRECTORY_<CONFIG>
@@ -3212,8 +3036,8 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
set (_outputDir "${COTIRE_UNITY_OUTPUT_DIRECTORY}")
else()
# append relative COTIRE_UNITY_OUTPUT_DIRECTORY to target's actual output directory
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName} ${_outputDirProperties})
cotire_resolve_config_properties("${_configurations}" _properties ${_outputDirProperties})
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} ${_outputDirProperties})
cotire_resolve_config_properites("${_configurations}" _properties ${_outputDirProperties})
foreach (_property ${_properties})
get_property(_outputDir TARGET ${_target} PROPERTY ${_property})
if (_outputDir)
@@ -3233,11 +3057,11 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
RUNTIME_OUTPUT_DIRECTORY "${_outputDir}")
endif()
else()
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
${_outputDirProperties})
endif()
# copy output name
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
ARCHIVE_OUTPUT_NAME ARCHIVE_OUTPUT_NAME_<CONFIG>
LIBRARY_OUTPUT_NAME LIBRARY_OUTPUT_NAME_<CONFIG>
OUTPUT_NAME OUTPUT_NAME_<CONFIG>
@@ -3245,7 +3069,7 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
PREFIX <CONFIG>_POSTFIX SUFFIX
IMPORT_PREFIX IMPORT_SUFFIX)
# copy compile stuff
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
COMPILE_DEFINITIONS COMPILE_DEFINITIONS_<CONFIG>
COMPILE_FLAGS COMPILE_OPTIONS
Fortran_FORMAT Fortran_MODULE_DIRECTORY
@@ -3257,12 +3081,12 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
C_VISIBILITY_PRESET CXX_VISIBILITY_PRESET VISIBILITY_INLINES_HIDDEN
C_CLANG_TIDY CXX_CLANG_TIDY)
# copy compile features
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
C_EXTENSIONS C_STANDARD C_STANDARD_REQUIRED
CXX_EXTENSIONS CXX_STANDARD CXX_STANDARD_REQUIRED
COMPILE_FEATURES)
# copy interface stuff
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
COMPATIBLE_INTERFACE_BOOL COMPATIBLE_INTERFACE_NUMBER_MAX COMPATIBLE_INTERFACE_NUMBER_MIN
COMPATIBLE_INTERFACE_STRING
INTERFACE_COMPILE_DEFINITIONS INTERFACE_COMPILE_FEATURES INTERFACE_COMPILE_OPTIONS
@@ -3270,9 +3094,8 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
INTERFACE_POSITION_INDEPENDENT_CODE INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
INTERFACE_AUTOUIC_OPTIONS NO_SYSTEM_FROM_IMPORTED)
# copy link stuff
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
BUILD_WITH_INSTALL_RPATH BUILD_WITH_INSTALL_NAME_DIR
INSTALL_RPATH INSTALL_RPATH_USE_LINK_PATH SKIP_BUILD_RPATH
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
BUILD_WITH_INSTALL_RPATH INSTALL_RPATH INSTALL_RPATH_USE_LINK_PATH SKIP_BUILD_RPATH
LINKER_LANGUAGE LINK_DEPENDS LINK_DEPENDS_NO_SHARED
LINK_FLAGS LINK_FLAGS_<CONFIG>
LINK_INTERFACE_LIBRARIES LINK_INTERFACE_LIBRARIES_<CONFIG>
@@ -3280,18 +3103,18 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
LINK_SEARCH_START_STATIC LINK_SEARCH_END_STATIC
STATIC_LIBRARY_FLAGS STATIC_LIBRARY_FLAGS_<CONFIG>
NO_SONAME SOVERSION VERSION
LINK_WHAT_YOU_USE BUILD_RPATH)
LINK_WHAT_YOU_USE)
# copy cmake stuff
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
IMPLICIT_DEPENDS_INCLUDE_TRANSFORM RULE_LAUNCH_COMPILE RULE_LAUNCH_CUSTOM RULE_LAUNCH_LINK)
# copy Apple platform specific stuff
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
BUNDLE BUNDLE_EXTENSION FRAMEWORK FRAMEWORK_VERSION INSTALL_NAME_DIR
MACOSX_BUNDLE MACOSX_BUNDLE_INFO_PLIST MACOSX_FRAMEWORK_INFO_PLIST MACOSX_RPATH
OSX_ARCHITECTURES OSX_ARCHITECTURES_<CONFIG> PRIVATE_HEADER PUBLIC_HEADER RESOURCE XCTEST
IOS_INSTALL_COMBINED XCODE_EXPLICIT_FILE_TYPE XCODE_PRODUCT_TYPE)
IOS_INSTALL_COMBINED)
# copy Windows platform specific stuff
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
GNUtoMS
COMPILE_PDB_NAME COMPILE_PDB_NAME_<CONFIG>
COMPILE_PDB_OUTPUT_DIRECTORY COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG>
@@ -3305,19 +3128,15 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
VS_WINRT_COMPONENT VS_WINRT_EXTENSIONS VS_WINRT_REFERENCES
WIN32_EXECUTABLE WINDOWS_EXPORT_ALL_SYMBOLS
DEPLOYMENT_REMOTE_DIRECTORY VS_CONFIGURATION_TYPE
VS_SDK_REFERENCES VS_USER_PROPS VS_DEBUGGER_WORKING_DIRECTORY)
VS_SDK_REFERENCES)
# copy Android platform specific stuff
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
ANDROID_API ANDROID_API_MIN ANDROID_GUI
ANDROID_ANT_ADDITIONAL_OPTIONS ANDROID_ARCH ANDROID_ASSETS_DIRECTORIES
ANDROID_JAR_DEPENDENCIES ANDROID_JAR_DIRECTORIES ANDROID_JAVA_SOURCE_DIR
ANDROID_NATIVE_LIB_DEPENDENCIES ANDROID_NATIVE_LIB_DIRECTORIES
ANDROID_PROCESS_MAX ANDROID_PROGUARD ANDROID_PROGUARD_CONFIG_PATH
ANDROID_SECURE_PROPS_PATH ANDROID_SKIP_ANT_STEP ANDROID_STL_TYPE)
# copy CUDA platform specific stuff
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
CUDA_PTX_COMPILATION CUDA_SEPARABLE_COMPILATION CUDA_RESOLVE_DEVICE_SYMBOLS
CUDA_EXTENSIONS CUDA_STANDARD CUDA_STANDARD_REQUIRED)
# use output name from original target
get_target_property(_targetOutputName ${_unityTargetName} OUTPUT_NAME)
if (NOT _targetOutputName)
@@ -3331,13 +3150,6 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
set_property(TARGET ${_unityTargetName} PROPERTY ENABLE_EXPORTS TRUE)
endif()
endif()
# enable parallel compilation for MSVC
if (MSVC AND "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
list (LENGTH _unityTargetSources _numberOfUnityTargetSources)
if (_numberOfUnityTargetSources GREATER 1)
set_property(TARGET ${_unityTargetName} APPEND PROPERTY COMPILE_OPTIONS "/MP")
endif()
endif()
cotire_init_target(${_unityTargetName})
cotire_add_to_unity_all_target(${_unityTargetName})
set_property(TARGET ${_target} PROPERTY COTIRE_UNITY_TARGET_NAME "${_unityTargetName}")
@@ -3496,13 +3308,6 @@ function (cotire_target_link_libraries _target)
message (STATUS "unity target ${_unityTargetName} interface link libraries: ${_unityLinkInterfaceLibraries}")
endif()
endif()
get_target_property(_manualDependencies ${_target} MANUALLY_ADDED_DEPENDENCIES)
if (_manualDependencies)
cotire_map_libraries("${_linkLibrariesStrategy}" _unityManualDependencies ${_manualDependencies})
if (_unityManualDependencies)
add_dependencies("${_unityTargetName}" ${_unityManualDependencies})
endif()
endif()
endif()
endif()
endfunction(cotire_target_link_libraries)
@@ -3535,9 +3340,9 @@ function (cotire_init_target _targetName)
set_target_properties(${_targetName} PROPERTIES FOLDER "${COTIRE_TARGETS_FOLDER}")
endif()
set_target_properties(${_targetName} PROPERTIES EXCLUDE_FROM_ALL TRUE)
# if (MSVC_IDE)
# set_target_properties(${_targetName} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE)
# endif()
if (MSVC_IDE)
set_target_properties(${_targetName} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE)
endif()
endfunction()
function (cotire_add_to_pch_all_target _pchTargetName)
@@ -3799,7 +3604,7 @@ else()
set (COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS "m;mm" CACHE STRING
"Ignore sources with the listed file extensions from the generated unity source.")
set (COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES "2" CACHE STRING
set (COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES "3" CACHE STRING
"Minimum number of sources in target required to enable use of precompiled header.")
if (NOT DEFINED COTIRE_MAXIMUM_NUMBER_OF_UNITY_INCLUDES_INIT)
@@ -3898,7 +3703,7 @@ else()
FULL_DOCS
"The variable can be set to an integer > 0."
"If a target contains less than that number of source files, cotire will not enable the use of the precompiled header for the target."
"If not defined, defaults to 2."
"If not defined, defaults to 3."
)
define_property(

View File

@@ -1,96 +1,4 @@
# Draco - a library for a lossy vertex data compression, used as extension to glTF format.
# https://github.com/google/draco
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
if (NOT DEFINED INSTALL_DRACO)
set (INSTALL_DRACO OFF CACHE BOOL "${INSTALL_DRACO_DESCR}")
endif()
if (NOT DEFINED 3RDPARTY_DRACO_DIR)
set (3RDPARTY_DRACO_DIR "" CACHE PATH "The directory containing Draco")
endif()
if (NOT DEFINED 3RDPARTY_DRACO_INCLUDE_DIR)
set (3RDPARTY_DRACO_INCLUDE_DIR "" CACHE PATH "The directory containing headers of the Draco")
endif()
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY OR NOT 3RDPARTY_DRACO_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_DRACO_LIBRARY_DIR}")
set (3RDPARTY_DRACO_LIBRARY "" CACHE FILEPATH "Draco library" FORCE)
endif()
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY_DIR)
set (3RDPARTY_DRACO_LIBRARY_DIR "" CACHE PATH "The directory containing Draco library")
endif()
if (3RDPARTY_DIR AND EXISTS "${3RDPARTY_DIR}")
if (NOT 3RDPARTY_DRACO_DIR OR NOT EXISTS "${3RDPARTY_DRACO_DIR}")
FIND_PRODUCT_DIR("${3RDPARTY_DIR}" draco DRACO_DIR_NAME)
if (DRACO_DIR_NAME)
set (3RDPARTY_DRACO_DIR "${3RDPARTY_DIR}/${DRACO_DIR_NAME}" CACHE PATH "The directory containing Draco" FORCE)
endif()
endif()
endif()
if (3RDPARTY_DRACO_DIR AND EXISTS "${3RDPARTY_DRACO_DIR}")
set (DRACO_INCLUDE_PATH "${3RDPARTY_DRACO_DIR}/include")
set (DRACO_LIBRARY_PATH "${3RDPARTY_DRACO_DIR}/lib")
endif()
if (NOT 3RDPARTY_DRACO_INCLUDE_DIR)
if (DRACO_INCLUDE_PATH AND EXISTS "${DRACO_INCLUDE_PATH}")
set (3RDPARTY_DRACO_INCLUDE_DIR "${DRACO_INCLUDE_PATH}" CACHE FILEPATH "The directory containing headers of DRACO" FORCE)
endif()
endif()
if (NOT 3RDPARTY_DRACO_LIBRARY_DIR)
if (DRACO_LIBRARY_PATH AND EXISTS "${DRACO_LIBRARY_PATH}")
set (3RDPARTY_DRACO_LIBRARY_DIR "${DRACO_LIBRARY_PATH}" CACHE FILEPATH "The directory containing DRACO library" FORCE)
endif()
endif()
if (3RDPARTY_DRACO_INCLUDE_DIR AND EXISTS "${3RDPARTY_DRACO_INCLUDE_DIR}")
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_DRACO_INCLUDE_DIR}")
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_DRACO_INCLUDE_DIR)
endif()
if (3RDPARTY_DRACO_DIR AND EXISTS "${3RDPARTY_DRACO_DIR}")
if (NOT 3RDPARTY_DRACO_LIBRARY OR NOT EXISTS "${3RDPARTY_DRACO_LIBRARY}")
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
set (3RDPARTY_DRACO_LIBRARY "3RDPARTY_DRACO_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to Draco library" FORCE)
find_library (3RDPARTY_DRACO_LIBRARY NAMES ${CSF_Draco}
PATHS "${3RDPARTY_DRACO_LIBRARY_DIR}"
PATH_SUFFIXES lib
CMAKE_FIND_ROOT_PATH_BOTH
NO_DEFAULT_PATH)
if (3RDPARTY_DRACO_LIBRARY AND EXISTS "${3RDPARTY_DRACO_LIBRARY}")
get_filename_component (3RDPARTY_DRACO_LIBRARY_DIR "${3RDPARTY_DRACO_LIBRARY}" PATH)
set (3RDPARTY_DRACO_LIBRARY_DIR "${3RDPARTY_DRACO_LIBRARY_DIR}" CACHE FILEPATH "The directory containing Draco library" FORCE)
endif()
endif()
endif()
if (3RDPARTY_DRACO_LIBRARY_DIR AND EXISTS "${3RDPARTY_DRACO_LIBRARY_DIR}")
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_DRACO_LIBRARY_DIR}")
else()
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_DRACO_LIBRARY_DIR)
endif()
if (INSTALL_DRACO)
get_filename_component(3RDPARTY_DRACO_LIBRARY_REALPATH ${3RDPARTY_DRACO_LIBRARY} REALPATH)
if (SINGLE_GENERATOR)
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH} DESTINATION "${INSTALL_DIR_LIB}")
else()
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR_LIB}")
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR_LIB}i")
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR_LIB}d")
endif()
endif()
THIRDPARTY_PRODUCT("DRACO" "draco/compression/decode.h" "CSF_Draco" "")

View File

@@ -26,7 +26,9 @@ if (3RDPARTY_DIR)
endforeach()
endif()
find_package (FLEX 2.6.4)
# flex 2.5.37 is required because closest known lower version, 2.5.3 from WOK 6.8.0,
# generates code which is unusable on Windows (includes unistd.h without any way to avoid this)
find_package (FLEX 2.5.37)
if (NOT FLEX_FOUND OR NOT FLEX_INCLUDE_DIR OR NOT EXISTS "${FLEX_INCLUDE_DIR}/FlexLexer.h")
list (APPEND 3RDPARTY_NOT_INCLUDED FLEX_INCLUDE_DIR)

View File

@@ -110,19 +110,8 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
set (ENV{FREETYPE_DIR} "${3RDPARTY_FREETYPE_DIR}")
endif()
unset (FREETYPE_LIBRARY_RELEASE)
find_package(Freetype)
# Only for UNIX (not APPLE)
if ((NOT WIN32) AND (NOT APPLE))
# To avoid linker error on Ubuntu 18.04 and others linux distributives we should
# link with freetype library, compiled as Position Independent Code (PIC),
# for example, with shared object.
if ((DEFINED FREETYPE_LIBRARY_RELEASE) AND (NOT "${FREETYPE_LIBRARY_RELEASE}" STREQUAL "") AND (EXISTS "${FREETYPE_LIBRARY_RELEASE}"))
string (REPLACE "\.a" "\.so" FREETYPE_LIBRARY_RELEASE "${FREETYPE_LIBRARY_RELEASE}")
endif()
endif()
# restore ENV{FREETYPE_DIR}
if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
set (ENV{FREETYPE_DIR} ${CACHED_FREETYPE_DIR})
@@ -133,7 +122,7 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_ft2build FILEPATH "The directory containing ft2build.h header")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_freetype2 FILEPATH "The directory containing ftheader.h header")
if (BUILD_SHARED_LIBS)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_LIBRARY_RELEASE FILEPATH "freetype library")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_LIBRARY FILEPATH "freetype library")
endif()
endif()
@@ -152,8 +141,8 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
if (BUILD_SHARED_LIBS)
if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
if (FREETYPE_LIBRARY_RELEASE AND EXISTS "${FREETYPE_LIBRARY_RELEASE}")
set (3RDPARTY_FREETYPE_LIBRARY "${FREETYPE_LIBRARY_RELEASE}" CACHE FILEPATH "The path to freetype library" FORCE)
if (FREETYPE_LIBRARY AND EXISTS "${FREETYPE_LIBRARY}")
set (3RDPARTY_FREETYPE_LIBRARY "${FREETYPE_LIBRARY}" CACHE FILEPATH "The path to freetype library" FORCE)
endif()
endif()
@@ -231,7 +220,7 @@ endif()
# freetype library
#if (BUILD_SHARED_LIBS)
if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib)
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
set (FREETYPE_PATH_SUFFIXES lib)
if (ANDROID)
@@ -253,16 +242,6 @@ endif()
CMAKE_FIND_ROOT_PATH_BOTH)
endif()
# Only for UNIX (not APPLE)
if ((NOT WIN32) AND (NOT APPLE))
# To avoid linker error on Ubuntu 18.04 and some others linux distributives we should
# link with freetype library, compiled as Position Independent Code (PIC),
# for example, with shared object.
if ((DEFINED 3RDPARTY_FREETYPE_LIBRARY) AND (NOT "${3RDPARTY_FREETYPE_LIBRARY}" STREQUAL "") AND (EXISTS "${3RDPARTY_FREETYPE_LIBRARY}"))
string (REPLACE "\.a" "\.so" 3RDPARTY_FREETYPE_LIBRARY "${3RDPARTY_FREETYPE_LIBRARY}")
endif()
endif()
if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
@@ -371,7 +350,7 @@ endif()
# unset all redundant variables
OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_ft2build)
OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_freetype2)
OCCT_CHECK_AND_UNSET(FREETYPE_LIBRARY_RELEASE)
OCCT_CHECK_AND_UNSET(FREETYPE_LIBRARY)
if (BUILD_SHARED_LIBS)
mark_as_advanced (3RDPARTY_FREETYPE_LIBRARY 3RDPARTY_FREETYPE_DLL)

View File

@@ -25,9 +25,6 @@ if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
endif()
if (MSVC)
# suppress C26812 on VS2019/C++20 (prefer 'enum class' over 'enum')
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:precise /wd\"26812\"")
# suppress warning on using portable non-secure functions in favor of non-portable secure ones
add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
else()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -fPIC")
@@ -116,9 +113,9 @@ if (MSVC)
else()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
endif()
elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]"))
elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
if (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshorten-64-to-32")
endif()
if (BUILD_SHARED_LIBS)
@@ -130,10 +127,14 @@ elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPIL
endif()
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]")
if ("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang")
if (APPLE)
# CLang can be used with both libstdc++ and libc++, however on OS X libstdc++ is outdated.
set (CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}")
set (CMAKE_CXX_FLAGS "-std=c++0x -stdlib=libc++ ${CMAKE_CXX_FLAGS}")
elseif(NOT WIN32)
# CLang for Windows (at least CLang 8.0 distributed with VS 2019)
# does not support option "-std=c++0x"
set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
endif()
# Optimize size of binaries
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,-s ${CMAKE_SHARED_LINKER_FLAGS}")
@@ -144,10 +145,14 @@ elseif(MINGW)
# workaround bugs in mingw with vtable export
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--export-all-symbols")
# Require C++11
set (CMAKE_CXX_FLAGS "-std=gnu++0x ${CMAKE_CXX_FLAGS}")
# Optimize size of binaries
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
# Require C++11
set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
# Optimize size of binaries
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")

View File

@@ -80,9 +80,9 @@ macro (OCCT_MAKE_COMPILER_SHORT_NAME)
set (COMPILER gcc)
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
set (COMPILER gxx)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set (COMPILER clang)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Ii][Nn][Tt][Ee][Ll]")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
set (COMPILER icc)
else()
set (COMPILER ${CMAKE_GENERATOR})
@@ -160,8 +160,6 @@ function (FIND_PRODUCT_DIR ROOT_DIR PRODUCT_NAME RESULT)
if ("${lower_PRODUCT_NAME}" STREQUAL "egl")
string (SUBSTRING "${lower_PRODUCT_NAME}" 1 -1 lower_PRODUCT_NAME)
list (APPEND SEARCH_TEMPLATES "[^gl]+${lower_PRODUCT_NAME}.*")
elseif ("${lower_PRODUCT_NAME}" STREQUAL "tbb")
list (APPEND SEARCH_TEMPLATES "^.*${lower_PRODUCT_NAME}.*")
else()
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*${COMPILER}.*${COMPILER_BITNESS}")
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*[0-9.]+.*${COMPILER}.*${COMPILER_BITNESS}")
@@ -591,7 +589,9 @@ macro (OCCT_UPDATE_TARGET_FILE)
endif()
install (CODE
"string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWERCASE)
"cmake_policy(PUSH)
cmake_policy(SET CMP0007 NEW)
string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWERCASE)
file (GLOB ALL_OCCT_TARGET_FILES \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/OpenCASCADE*Targets-\${CMAKE_INSTALL_CONFIG_NAME_LOWERCASE}.cmake\")
foreach(TARGET_FILENAME \${ALL_OCCT_TARGET_FILES})
file (STRINGS \"\${TARGET_FILENAME}\" TARGET_FILE_CONTENT)
@@ -600,7 +600,8 @@ macro (OCCT_UPDATE_TARGET_FILE)
string (REGEX REPLACE \"[\\\\]?[\\\$]{OCCT_INSTALL_BIN_LETTER}\" \"\${OCCT_INSTALL_BIN_LETTER}\" line \"\${line}\")
file (APPEND \"\${TARGET_FILENAME}\" \"\${line}\\n\")
endforeach()
endforeach()")
endforeach()
cmake_policy(POP)")
endmacro()
macro (OCCT_INSERT_CODE_FOR_TARGET)
@@ -614,14 +615,17 @@ macro (OCCT_INSERT_CODE_FOR_TARGET)
endmacro()
macro (OCCT_UPDATE_DRAW_DEFAULT_FILE)
install(CODE "set (DRAW_DEFAULT_FILE_NAME \"${INSTALL_DIR}/${INSTALL_DIR_RESOURCE}/DrawResources/DrawPlugin\")
install(CODE "cmake_policy(PUSH)
cmake_policy(SET CMP0007 NEW)
set (DRAW_DEFAULT_FILE_NAME \"${INSTALL_DIR}/${INSTALL_DIR_RESOURCE}/DrawResources/DrawPlugin\")
file (STRINGS \"\${DRAW_DEFAULT_FILE_NAME}\" DRAW_DEFAULT_CONTENT)
file (REMOVE \"\${DRAW_DEFAULT_FILE_NAME}\")
foreach (line IN LISTS DRAW_DEFAULT_CONTENT)
string (REGEX MATCH \": TK\([a-zA-Z]+\)$\" IS_TK_LINE \"\${line}\")
string (REGEX REPLACE \": TK\([a-zA-Z]+\)$\" \": TK\${CMAKE_MATCH_1}${BUILD_SHARED_LIBRARY_NAME_POSTFIX}\" line \"\${line}\")
file (APPEND \"\${DRAW_DEFAULT_FILE_NAME}\" \"\${line}\\n\")
endforeach()")
endforeach()
cmake_policy(POP)")
endmacro()
macro (OCCT_CREATE_SYMLINK_TO_FILE LIBRARY_NAME LINK_NAME)

View File

@@ -106,12 +106,6 @@ foreach (OCCT_PACKAGE ${USED_PACKAGES})
set (BISON_OUTPUT_FILE_EXT "cxx")
endif()
endforeach()
if (EXISTS ${FLEX_BISON_TARGET_DIR}/FlexLexer.h)
message (STATUS "Info: remove old FLEX header file: ${FLEX_BISON_TARGET_DIR}/FlexLexer.h")
file(REMOVE ${FLEX_BISON_TARGET_DIR}/FlexLexer.h)
endif()
file (STRINGS "${CURRENT_FLEX_FILE}" FILE_FLEX_CONTENT)
foreach (FILE_FLEX_CONTENT_LINE ${FILE_FLEX_CONTENT})
string (REGEX MATCH "%option c\\+\\+" CXX_FLEX_LANGUAGE_FOUND ${FILE_FLEX_CONTENT_LINE})
@@ -127,19 +121,6 @@ foreach (OCCT_PACKAGE ${USED_PACKAGES})
set (BISON_OUTPUT_FILE ${CURRENT_BISON_FILE_NAME}.tab.${BISON_OUTPUT_FILE_EXT})
set (FLEX_OUTPUT_FILE lex.${CURRENT_FLEX_FILE_NAME}.${FLEX_OUTPUT_FILE_EXT})
if (EXISTS ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.${BISON_OUTPUT_FILE_EXT})
message (STATUS "Info: remove old output BISON file: ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.${BISON_OUTPUT_FILE_EXT}")
file(REMOVE ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.${BISON_OUTPUT_FILE_EXT})
endif()
if (EXISTS ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.hxx)
message (STATUS "Info: remove old output BISON file: ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.hxx")
file(REMOVE ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.hxx)
endif()
if (EXISTS ${FLEX_BISON_TARGET_DIR}/${FLEX_OUTPUT_FILE})
message (STATUS "Info: remove old output FLEX file: ${FLEX_BISON_TARGET_DIR}/${FLEX_OUTPUT_FILE}")
file(REMOVE ${FLEX_BISON_TARGET_DIR}/${FLEX_OUTPUT_FILE})
endif()
BISON_TARGET (Parser_${CURRENT_BISON_FILE_NAME} ${CURRENT_BISON_FILE} "${FLEX_BISON_TARGET_DIR}/${BISON_OUTPUT_FILE}"
COMPILE_FLAGS "-p ${CURRENT_BISON_FILE_NAME} -l -M ${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/=")
FLEX_TARGET (Scanner_${CURRENT_FLEX_FILE_NAME} ${CURRENT_FLEX_FILE} "${FLEX_BISON_TARGET_DIR}/${FLEX_OUTPUT_FILE}"
@@ -245,18 +226,6 @@ endif (USE_QT)
if (EXECUTABLE_PROJECT)
add_executable (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RESOURCE_FILES} ${${PROJECT_NAME}_MOC_FILES})
if (DEFINED ${PROJECT_NAME}_DISABLE_COTIRE AND ${PROJECT_NAME}_DISABLE_COTIRE)
set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_ENABLE_PRECOMPILED_HEADER FALSE)
set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
else()
# To avoid excluding of PROJECT_NAME from cotire tool, we may use cotire
# COTIRE_PREFIX_HEADER_IGNORE_PATH instead. But, practically it causes many 'undefined symbols' error.
# So, we just exclude PROJECT_NAME from cotire list.
# if (DEFINED ${PROJECT_NAME}_COTIRE_IGNORE_PATH)
# set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_PREFIX_HEADER_IGNORE_PATH "${${PROJECT_NAME}_COTIRE_IGNORE_PATH}")
# endif()
endif()
install (TARGETS ${PROJECT_NAME}
DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}")
@@ -266,18 +235,6 @@ if (EXECUTABLE_PROJECT)
else()
add_library (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RESOURCE_FILES} ${${PROJECT_NAME}_MOC_FILES})
if (DEFINED ${PROJECT_NAME}_DISABLE_COTIRE AND ${PROJECT_NAME}_DISABLE_COTIRE)
set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_ENABLE_PRECOMPILED_HEADER FALSE)
set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
else()
# To avoid excluding of PROJECT_NAME from cotire tool, we may use cotire
# COTIRE_PREFIX_HEADER_IGNORE_PATH instead. But, practically it causes many 'undefined symbols' error.
# So, we just exclude PROJECT_NAME from cotire list.
# if (DEFINED ${PROJECT_NAME}_COTIRE_IGNORE_PATH)
# set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_PREFIX_HEADER_IGNORE_PATH "${${PROJECT_NAME}_COTIRE_IGNORE_PATH}")
# endif()
endif()
if (MSVC)
if (BUILD_FORCE_RelWithDebInfo)
set (aReleasePdbConf "Release")
@@ -298,8 +255,7 @@ else()
EXPORT OpenCASCADE${CURRENT_MODULE}Targets
RUNTIME DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}"
ARCHIVE DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}"
LIBRARY DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}"
INCLUDES DESTINATION ${INSTALL_DIR_INCLUDE})
LIBRARY DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}")
if (NOT WIN32)
if (BUILD_SHARED_LIBS AND NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "")
@@ -324,17 +280,14 @@ get_property (OCC_VERSION_MAJOR GLOBAL PROPERTY OCC_VERSION_MAJOR)
get_property (OCC_VERSION_MINOR GLOBAL PROPERTY OCC_VERSION_MINOR)
get_property (OCC_VERSION_MAINTENANCE GLOBAL PROPERTY OCC_VERSION_MAINTENANCE)
set (OCC_SOVERSION "")
if (BUILD_SOVERSION_NUMBERS GREATER 2)
set (OCC_SOVERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}")
elseif (BUILD_SOVERSION_NUMBERS GREATER 1)
set (OCC_SOVERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}")
elseif (BUILD_SOVERSION_NUMBERS GREATER 0)
set (OCC_SOVERSION "${OCC_VERSION_MAJOR}")
if (ANDROID)
# do not append version to the filename
set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}")
else()
set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}"
SOVERSION "${OCC_VERSION_MAJOR}"
VERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}")
endif()
set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}"
SOVERSION "${OCC_SOVERSION}"
VERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}")
set (USED_TOOLKITS_BY_CURRENT_PROJECT)
set (USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT)
@@ -363,10 +316,10 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
else() # get CSF_ value
set (CURRENT_CSF ${${USED_ITEM}})
if (NOT "x${CURRENT_CSF}" STREQUAL "x")
if ("${CURRENT_CSF}" STREQUAL "${CSF_OpenGlLibs}")
if ("${CURRENT_CSF}" STREQUAL "CSF_OpenGlLibs")
add_definitions (-DHAVE_OPENGL)
endif()
if ("${CURRENT_CSF}" STREQUAL "${CSF_OpenGlesLibs}")
if ("${CURRENT_CSF}" STREQUAL "CSF_OpenGlesLibs")
add_definitions (-DHAVE_GLES2)
endif()

View File

@@ -1,240 +1,294 @@
# tbb
if (NOT DEFINED INSTALL_TBB AND BUILD_SHARED_LIBS)
set (INSTALL_TBB OFF CACHE BOOL "${INSTALL_TBB_DESCR}")
endif()
# tbb directory
if (NOT DEFINED 3RDPARTY_TBB_DIR)
set (3RDPARTY_TBB_DIR "" CACHE PATH "The directory containing tbb")
endif()
if (MSVC AND BUILD_SHARED_LIBS)
add_definitions (-D__TBB_NO_IMPLICIT_LINKAGE)
add_definitions (-D__TBBMALLOC_NO_IMPLICIT_LINKAGE)
endif()
if (NOT DEFINED INSTALL_TBB AND BUILD_SHARED_LIBS)
set (INSTALL_TBB OFF CACHE BOOL "${INSTALL_TBB_DESCR}")
endif()
# include occt macros. compiler_bitness, os_wiht_bit, compiler
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
# Initialize tbb directory.
if (NOT DEFINED 3RDPARTY_TBB_DIR)
set (3RDPARTY_TBB_DIR "" CACHE PATH "The directory containing tbb")
endif()
# specify TBB folder in connectin with 3RDPARTY_DIR
if (3RDPARTY_DIR AND EXISTS "${3RDPARTY_DIR}")
#CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_DIR 3RDPARTY_TBB_DIR PATH "The directory containing tbb")
if (WIN32)
if (NOT DEFINED 3RDPARTY_DIR)
message (FATAL_ERROR "3RDPARTY_DIR is not defined.")
endif()
if ("${3RDPARTY_DIR}" STREQUAL "")
message (FATAL_ERROR "3RDPARTY_DIR is empty string.")
endif()
if (NOT EXISTS "${3RDPARTY_DIR}")
message (FATAL_ERROR "3RDPARTY_DIR is not exist.")
endif()
# Below, we have correct 3RDPARTY_DIR.
# Initialize TBB folder in connectin with 3RDPARTY_DIR.
if (("${3RDPARTY_TBB_DIR}" STREQUAL "") OR (NOT EXISTS "${3RDPARTY_TBB_DIR}"))
if (NOT 3RDPARTY_TBB_DIR OR NOT EXISTS "${3RDPARTY_TBB_DIR}")
FIND_PRODUCT_DIR ("${3RDPARTY_DIR}" TBB TBB_DIR_NAME)
if (TBB_DIR_NAME)
set (3RDPARTY_TBB_DIR "${3RDPARTY_DIR}/${TBB_DIR_NAME}" CACHE PATH "The directory containing tbb" FORCE)
endif()
endif()
else()
#set (3RDPARTY_TBB_DIR "" CACHE PATH "The directory containing TBB" FORCE)
endif()
# Here we have full path name to installation directory of TBB.
# Employ it.
if (EXISTS "${3RDPARTY_TBB_DIR}")
find_package (
TBB 2021.5
PATHS "${3RDPARTY_TBB_DIR}" NO_DEFAULT_PATH
REQUIRED
CONFIG)
if (NOT DEFINED 3RDPARTY_TBB_INCLUDE_DIR)
set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE PATH "The directory containing headers of the TBB")
endif()
# Achive include directory
get_target_property (TBB_INCLUDE_DIR TBB::tbb INTERFACE_INCLUDE_DIRECTORIES)
if (NOT DEFINED 3RDPARTY_TBB_INCLUDE_DIR)
set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE PATH "The directory containing headers of the TBB")
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
# check 3RDPARTY_TBB_INCLUDE_DIR for consictency with specified 3RDPARTY_TBB_DIR
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_TBB_INCLUDE_DIR PATH "The directory containing headers of the TBB")
endif()
# tbb.h
if (NOT 3RDPARTY_TBB_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_TBB_INCLUDE_DIR}")
set (HEADER_NAMES tbb.h tbb/tbb.h)
# set 3RDPARTY_TBB_INCLUDE_DIR as notfound, otherwise find_library can't assign a new value to 3RDPARTY_TBB_INCLUDE_DIR
set (3RDPARTY_TBB_INCLUDE_DIR "3RDPARTY_TBB_INCLUDE_DIR-NOTFOUND" CACHE PATH "the path to tbb.h" FORCE)
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
find_path (3RDPARTY_TBB_INCLUDE_DIR NAMES ${HEADER_NAMES}
PATHS ${3RDPARTY_TBB_DIR}
PATH_SUFFIXES include
CMAKE_FIND_ROOT_PATH_BOTH
NO_DEFAULT_PATH)
else()
find_path (3RDPARTY_TBB_INCLUDE_DIR NAMES ${HEADER_NAMES}
PATH_SUFFIXES include
CMAKE_FIND_ROOT_PATH_BOTH)
endif()
endif()
if (3RDPARTY_TBB_INCLUDE_DIR AND EXISTS "${3RDPARTY_TBB_INCLUDE_DIR}")
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TBB_INCLUDE_DIR}")
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_INCLUDE_DIR)
set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE PATH "the path to tbb.h" FORCE)
endif()
# common steps for tbb and tbbmalloc
macro (TBB_PRODUCT_SEARCH PRODUCT_LIBRARY_NAME)
string (TOUPPER ${PRODUCT_LIBRARY_NAME} upper_PRODUCT_LIBRARY_NAME)
# define required tbb/tbbmalloc variables
if (NOT DEFINED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY OR NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}")
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY "" CACHE FILEPATH "${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
endif()
if (NOT DEFINED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR)
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library")
endif()
if (WIN32)
if (NOT DEFINED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL OR NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}")
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL "" CACHE FILEPATH "${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
endif()
if (EXISTS "${TBB_INCLUDE_DIR}")
set (3RDPARTY_TBB_INCLUDE_DIR "${TBB_INCLUDE_DIR}" CACHE PATH "The directory containing headers of the TBB" FORCE)
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TBB_INCLUDE_DIR}")
endif()
if (WIN32 AND NOT DEFINED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR)
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} shared library")
endif()
# check 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_ paths for consistency with specified 3RDPARTY_TBB_DIR
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY FILEPATH "the path to ${upper_PRODUCT_LIBRARY_NAME} library")
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}")
get_filename_component (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}" PATH)
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_INCLUDE_DIR)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library")
endif()
separate_arguments (CSF_TBB)
foreach (LIB IN LISTS CSF_TBB)
string(TOLOWER "${LIB}" LIB_LOWER)
string(TOUPPER "${LIB}" LIB_UPPER)
if (WIN32)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL FILEPATH "the path to ${upper_PRODUCT_LIBRARY_NAME} shared library")
# Achive *.lib files and directory containing it.
get_target_property (TBB_LIB_FILE "TBB::${LIB_LOWER}" IMPORTED_IMPLIB_RELEASE)
# Reserve cache variable for *.lib.
if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_LIBRARY)
set (3RDPARTY_${LIB_UPPER}_LIBRARY "" CACHE FILEPATH "${LIB_UPPER} library (*.lib)")
endif()
# Reserve cache variable for directory containing *.lib file.
if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_LIBRARY_DIR)
set (3RDPARTY_${LIB_UPPER}_LIBRARY_DIR "" CACHE PATH "The directory containing ${LIB_UPPER} library (*.lib)")
endif()
if (EXISTS "${TBB_LIB_FILE}")
set (3RDPARTY_${LIB_UPPER}_LIBRARY
"${TBB_LIB_FILE}"
CACHE FILEPATH
"${LIB_UPPER} library (*.lib)"
FORCE)
get_filename_component (TBB_LIB_FILE_DIRECTORY "${TBB_LIB_FILE}" DIRECTORY)
set (3RDPARTY_${LIB_UPPER}_LIBRARY_DIR
"${TBB_LIB_FILE_DIRECTORY}"
CACHE PATH
"The directory containing ${LIB_UPPER} library (*.lib)"
FORCE)
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${LIB_UPPER}_LIBRARY_DIR}")
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}")
get_filename_component (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}" PATH)
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
else()
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_${LIB_UPPER}_LIBRARY_DIR)
endif()
# Achive *.dll files and directory containing it.
get_target_property (TBB_DLL_FILE "TBB::${LIB_LOWER}" IMPORTED_LOCATION_RELEASE)
# Reserve cache variable for *.dll.
if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_DLL)
set (3RDPARTY_${LIB_UPPER}_DLL "" CACHE FILEPATH "${LIB_UPPER} library (*.dll)")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} shared library")
endif()
# Reserve cache variable for directory containing *.dll file.
if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_DLL_DIR)
set (3RDPARTY_${LIB_UPPER}_DLL_DIR "" CACHE PATH "The directory containing ${LIB_UPPER} library (*.dll)")
endif()
if (EXISTS "${TBB_DLL_FILE}")
set (3RDPARTY_${LIB_UPPER}_DLL
"${TBB_DLL_FILE}"
CACHE FILEPATH
"${LIB_UPPER} library (*.dll)"
FORCE)
get_filename_component (TBB_DLL_FILE_DIRECTORY "${TBB_DLL_FILE}" DIRECTORY)
set (3RDPARTY_${LIB_UPPER}_DLL_DIR
"${TBB_DLL_FILE_DIRECTORY}"
CACHE PATH
"The directory containing ${LIB_UPPER} library (*.dll)"
FORCE)
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_${LIB_UPPER}_DLL_DIR}")
endif()
endif()
OCCT_MAKE_COMPILER_SHORT_NAME()
OCCT_MAKE_COMPILER_BITNESS()
if (${COMPILER_BITNESS} EQUAL 32)
set (${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME ia32)
else()
set (${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME intel64)
endif()
# tbb/tbbmalloc library
if (NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}")
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
set (PRODUCT_PATH_SUFFIXES lib ${PRODUCT_LIBRARY_NAME})
# set 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY "3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
if (NOT EXISTS "${3RDPARTY_TBB_DIR}/lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${COMPILER}")
if (EXISTS "${3RDPARTY_TBB_DIR}/lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}")
file (GLOB ${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST "${3RDPARTY_TBB_DIR}/lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/*")
if (${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST)
list (GET ${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST -1 THE_MOST_FRESH_COMPILER_VERSION)
if (THE_MOST_FRESH_COMPILER_VERSION)
get_filename_component (THE_MOST_FRESH_COMPILER_VERSION_NAME "${THE_MOST_FRESH_COMPILER_VERSION}" NAME)
set (PRODUCT_PATH_SUFFIXES lib ${PRODUCT_LIBRARY_NAME} lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${THE_MOST_FRESH_COMPILER_VERSION_NAME})
endif()
endif()
endif()
else()
list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_${LIB_UPPER}_DLL_DIR)
set (PRODUCT_PATH_SUFFIXES lib ${PRODUCT_LIBRARY_NAME} lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${COMPILER})
endif()
# install *.dll (tbb & tbbmalloc)
if (INSTALL_TBB)
OCCT_MAKE_OS_WITH_BITNESS()
OCCT_MAKE_COMPILER_SHORT_NAME()
find_library (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY ${PRODUCT_LIBRARY_NAME}
PATHS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}" "${3RDPARTY_TBB_DIR}"
PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES}
CMAKE_FIND_ROOT_PATH_BOTH
NO_DEFAULT_PATH)
else()
find_library (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY ${PRODUCT_LIBRARY_NAME}
PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES}
CMAKE_FIND_ROOT_PATH_BOTH)
endif()
if (SINGLE_GENERATOR)
install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} DESTINATION "${INSTALL_DIR_BIN}")
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}")
get_filename_component (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}" PATH)
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
else()
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
endif()
endif()
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}")
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}")
else()
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR)
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY "" CACHE FILEPATH "The path to ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
endif()
# tbb/tbbmalloc shared library
if (WIN32)
if (NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}")
set (CMAKE_FIND_LIBRARY_SUFFIXES .dll)
set (PRODUCT_PATH_SUFFIXES bin)
# set 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL "3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL-NOTFOUND" CACHE FILEPATH "${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
if (NOT EXISTS "${3RDPARTY_TBB_DIR}/bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${COMPILER}")
if (EXISTS "${3RDPARTY_TBB_DIR}/bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}")
file (GLOB ${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST "${3RDPARTY_TBB_DIR}/bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/*")
if (${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST)
list (GET ${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST -1 THE_MOST_FRESH_COMPILER_VERSION)
if (THE_MOST_FRESH_COMPILER_VERSION)
get_filename_component (THE_MOST_FRESH_COMPILER_VERSION_NAME "${THE_MOST_FRESH_COMPILER_VERSION}" NAME)
set (PRODUCT_PATH_SUFFIXES bin bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${THE_MOST_FRESH_COMPILER_VERSION_NAME})
endif()
endif()
endif()
else()
install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} CONFIGURATIONS Release DESTINATION "${INSTALL_DIR_BIN}")
install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} CONFIGURATIONS RelWithDebInfo DESTINATION "${INSTALL_DIR_BIN}i")
install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} CONFIGURATIONS Debug DESTINATION "${INSTALL_DIR_BIN}d")
set (PRODUCT_PATH_SUFFIXES bin bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${COMPILER})
endif()
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
find_library (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL ${PRODUCT_LIBRARY_NAME}
PATHS "${3RDPARTY_TBB_DIR}"
PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES}
NO_DEFAULT_PATH)
else()
find_library (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL ${PRODUCT_LIBRARY_NAME} PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES})
endif()
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}")
get_filename_component (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}" PATH)
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
else()
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL "" CACHE FILEPATH "${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
endif()
endif()
mark_as_advanced (3RDPARTY_${LIB_UPPER}_LIBRARY 3RDPARTY_${LIB_UPPER}_DLL)
endforeach()
if (INSTALL_TBB)
set (USED_3RDPARTY_TBB_DIR "")
else()
# the *.dll/*.so* directory for using by the executable
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_DLL_DIR})
endif()
else()
message (FATAL_ERROR "Installation directory with TBB is not exist.")
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR OR EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}")
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}")
else()
list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR)
endif()
endif()
else ()
# NOT WIN32 branch
if ((DEFINED 3RDPARTY_DIR) AND (NOT "${3RDPARTY_DIR}" STREQUAL "") AND (EXISTS "${3RDPARTY_DIR}"))
# Here, we have correct 3RDPARTY_DIR.
# Trying to specify TBB folder in connection with 3RDPARTY_DIR
if (("${3RDPARTY_TBB_DIR}" STREQUAL "") OR (NOT EXISTS "${3RDPARTY_TBB_DIR}"))
FIND_PRODUCT_DIR ("${3RDPARTY_DIR}" TBB TBB_DIR_NAME)
if (TBB_DIR_NAME)
set (3RDPARTY_TBB_DIR "${3RDPARTY_DIR}/${TBB_DIR_NAME}" CACHE PATH "The directory containing tbb" FORCE)
# install tbb/tbbmalloc
if (INSTALL_TBB)
OCCT_MAKE_OS_WITH_BITNESS()
OCCT_MAKE_COMPILER_SHORT_NAME()
if (WIN32)
if (SINGLE_GENERATOR)
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL} DESTINATION "${INSTALL_DIR_BIN}")
else()
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR_BIN}")
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR_BIN}i")
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR_BIN}d")
endif()
endif()
if ((NOT "${3RDPARTY_TBB_DIR}" STREQUAL "") AND (EXISTS "${3RDPARTY_TBB_DIR}"))
# Find TBB 2021.5 in existing directory.
find_package (
TBB 2021.5
PATHS "${3RDPARTY_TBB_DIR}" NO_DEFAULT_PATH
REQUIRED
CONFIG)
else()
# Find TBB 2021.5 in system directory.
find_package (
TBB 2021.5
REQUIRED
CONFIG)
endif()
else()
# Find TBB 2021.5 in system directory.
find_package (
TBB 2021.5
REQUIRED
CONFIG)
endif()
# TBB has been configured (in other case FATAL_ERROR occures).
# Achive include directory.
get_target_property (TBB_INCLUDE_DIR TBB::tbb INTERFACE_INCLUDE_DIRECTORIES)
if (NOT DEFINED 3RDPARTY_TBB_INCLUDE_DIR)
set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE PATH "The directory containing headers of the TBB")
endif()
if (EXISTS "${TBB_INCLUDE_DIR}")
set (3RDPARTY_TBB_INCLUDE_DIR "${TBB_INCLUDE_DIR}" CACHE PATH "The directory containing headers of the TBB" FORCE)
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TBB_INCLUDE_DIR}")
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_INCLUDE_DIR)
endif()
separate_arguments (CSF_TBB)
foreach (LIB IN LISTS CSF_TBB)
string(TOLOWER "${LIB}" LIB_LOWER)
string(TOUPPER "${LIB}" LIB_UPPER)
# Achive *.so files and directory containing it.
get_target_property (TBB_SO_FILE "TBB::${LIB_LOWER}" IMPORTED_LOCATION_RELEASE)
# Reserve cache variable for *.so.
if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_LIBRARY)
set (3RDPARTY_${LIB_UPPER}_LIBRARY "" CACHE FILEPATH "${LIB_UPPER} library (*.so)")
endif()
# Reserve cache variable for directory containing *.so file.
if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_LIBRARY_DIR)
set (3RDPARTY_${LIB_UPPER}_LIBRARY_DIR "" CACHE PATH "The directory containing ${LIB_UPPER} library (*.so)")
endif()
if (EXISTS "${TBB_SO_FILE}")
set (3RDPARTY_${LIB_UPPER}_LIBRARY
"${TBB_SO_FILE}"
CACHE FILEPATH
"${LIB_UPPER} library (*.so)"
FORCE)
get_filename_component (TBB_SO_FILE_DIRECTORY "${TBB_SO_FILE}" DIRECTORY)
set (3RDPARTY_${LIB_UPPER}_LIBRARY_DIR
"${TBB_SO_FILE_DIRECTORY}"
CACHE PATH
"The directory containing ${LIB_UPPER} library (*.so)"
FORCE)
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${LIB_UPPER}_LIBRARY_DIR}")
else()
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_${LIB_UPPER}_LIBRARY_DIR)
endif()
# install *.so* (tbb & tbbmalloc)
if (INSTALL_TBB)
OCCT_MAKE_OS_WITH_BITNESS()
OCCT_MAKE_COMPILER_SHORT_NAME()
get_filename_component (PRODUCT_LIBRARY_NAME ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY} NAME)
if (SINGLE_GENERATOR)
install (FILES ${3RDPARTY_${LIB_UPPER}_LIBRARY} DESTINATION "${INSTALL_DIR_LIB}")
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}.2
DESTINATION "${INSTALL_DIR_LIB}"
RENAME ${PRODUCT_LIBRARY_NAME}.2)
else()
install (FILES ${3RDPARTY_${LIB_UPPER}_LIBRARY} CONFIGURATIONS Release DESTINATION "${INSTALL_DIR_LIB}")
install (FILES ${3RDPARTY_${LIB_UPPER}_LIBRARY} CONFIGURATIONS RelWithDebInfo DESTINATION "${INSTALL_DIR_LIB}i")
install (FILES ${3RDPARTY_${LIB_UPPER}_LIBRARY} CONFIGURATIONS Debug DESTINATION "${INSTALL_DIR_LIB}d")
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}.2
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR_LIB}"
RENAME ${PRODUCT_LIBRARY_NAME}.2)
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}.2
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR_LIB}i"
RENAME ${PRODUCT_LIBRARY_NAME}.2)
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}.2
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR_LIB}d"
RENAME ${PRODUCT_LIBRARY_NAME}.2)
endif()
endif()
endif()
mark_as_advanced (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL)
endmacro()
#if (BUILD_SHARED_LIBS)
separate_arguments (CSF_TBB)
foreach (LIB IN LISTS CSF_TBB)
TBB_PRODUCT_SEARCH (${LIB})
endforeach()
if (INSTALL_TBB)
set (USED_3RDPARTY_TBB_DIR "")
else()
# the *.so* directory for using by the executable
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR})
# the library directory for using by the executable
if (WIN32)
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_DLL_DIR})
else()
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR})
endif()
endif()
endif()
#endif()

View File

@@ -28,9 +28,6 @@ Applies only for Debug configuration.")
set (BUILD_SHARED_LIBRARY_NAME_POSTFIX_DESCR
"Append the postfix to names of output libraries")
set (BUILD_SOVERSION_NUMBERS_DESCR
"Version numbers to put into SONAME: 0 - for empty, 1 - for major, 2 - for major.minor, 3 - for major.minor.maintenance")
set (BUILD_RELEASE_DISABLE_EXCEPTIONS_DESCR
"Disables exceptions like Standard_OutOfRange in Release builds.
Defines No_Exception macros for Release builds when enabled (default).

View File

@@ -780,14 +780,14 @@ proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64
}
}
if { "$::tcl_platform(platform)" == "windows" } {
set aTbbDllPath [wokdep:SearchBin "tbb12.dll" "$anArchIter"]
set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter"]
if { "$aTbbDllPath" == "" } {
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] $aVcLib "$anArchIter" ]
set aTbbDllPath [wokdep:SearchBin "tbb12.dll" "$anArchIter" "$aPath/bin/$aSubDir/$aVcLib"]
set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter" "$aPath/bin/$aSubDir/$aVcLib"]
if { "$aTbbDllPath" != "" } {
lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin/$aSubDir/$aVcLib"
} else {
lappend anErrBin$anArchIter "Error: 'tbb12.dll' not found (Intel TBB)"
lappend anErrBin$anArchIter "Error: 'tbb.dll' not found (Intel TBB)"
if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
}
}

View File

@@ -1233,11 +1233,28 @@ proc osutils:convertModules { theModules theSrcDir theSourceDirOther theProjects
lappend aProjectsInModule($aModule) $aToolKit
lappend aDependencies [LibToLink $aToolKit $theSrcDir $theSourceDirOther]
}
# executables
# executables, assume one project per cxx file...
foreach aUnit [OS:executable ${aModule}] {
lappend aProjects $aUnit
lappend aProjectsInModule($aModule) $aUnit
lappend aDependencies [LibToLink $aUnit $theSrcDir $theSourceDirOther]
set aUnitLoc $aUnit
set src_files [_get_used_files $aUnit $theSrcDir false]
set aSrcFiles {}
foreach s $src_files {
regexp {source ([^\s]+)} $s dummy name
lappend aSrcFiles $name
}
foreach aSrcFile $aSrcFiles {
set aFileExtension [file extension $aSrcFile]
if { $aFileExtension == ".cxx" } {
set aPrjName [file rootname $aSrcFile]
lappend aProjects $aPrjName
lappend aProjectsInModule($aModule) $aPrjName
if {[file isdirectory $path/$theSrcDir/$aUnitLoc]} {
lappend aDependencies [LibToLinkX $aUnitLoc [file rootname $aSrcFile] $theSrcDir $theSourceDirOther]
} else {
lappend aDependencies {}
}
}
}
}
}
}
@@ -2093,106 +2110,98 @@ proc osutils:tk:execfiles { theFiles theOutDir theCommand thePrefix theExtension
# Generate Visual Studio project file for executable
proc osutils:vcprojx { theVcVer isUWP theOutDir theToolKit theGuidsMap theSrcDir theSourceDirOther } {
set aVcFiles {}
set aProjTmpl [osutils:vcproj:readtemplate $theVcVer $isUWP 1]
foreach f [osutils:tk:cxxfiles $theToolKit wnt $theSrcDir] {
set aProjTmpl [osutils:vcproj:readtemplate $theVcVer $isUWP 1]
set aProjName $theToolKit
set l_compilable [osutils:compilable wnt]
regsub -all -- {__XQTNAM__} $aProjTmpl $aProjName aProjTmpl
set aProjName [file rootname [file tail $f]]
set l_compilable [osutils:compilable wnt]
regsub -all -- {__XQTNAM__} $aProjTmpl $aProjName aProjTmpl
upvar $theGuidsMap aGuidsMap
if { ! [info exists aGuidsMap($aProjName)] } {
set aGuidsMap($aProjName) [OS:genGUID]
}
regsub -all -- {__PROJECT_GUID__} $aProjTmpl $aGuidsMap($aProjName) aProjTmpl
upvar $theGuidsMap aGuidsMap
if { ! [info exists aGuidsMap($aProjName)] } {
set aGuidsMap($aProjName) [OS:genGUID]
}
regsub -all -- {__PROJECT_GUID__} $aProjTmpl $aGuidsMap($aProjName) aProjTmpl
set aUsedLibs [list]
foreach tkx [osutils:commonUsedTK $theToolKit $theSrcDir $theSourceDirOther] {
lappend aUsedLibs "${tkx}.lib"
}
set aUsedLibs [list]
foreach tkx [osutils:commonUsedTK $theToolKit $theSrcDir $theSourceDirOther] {
lappend aUsedLibs "${tkx}.lib"
}
set anOsReleaseLibs {}
set anOsDebugLibs {}
osutils:usedOsLibs $theToolKit "wnt" anOsReleaseLibs aFrameworks $theSrcDir true
osutils:usedOsLibs $theToolKit "wnt" anOsDebugLibs aFrameworks $theSrcDir false
set anOsReleaseLibs {}
set anOsDebugLibs {}
osutils:usedOsLibs $theToolKit "wnt" anOsReleaseLibs aFrameworks $theSrcDir true
osutils:usedOsLibs $theToolKit "wnt" anOsDebugLibs aFrameworks $theSrcDir false
set aVCRTVer [string range $theVcVer 0 3]
regsub -all -- {__TKDEP__} $aProjTmpl [osutils:depLibraries $aUsedLibs $anOsReleaseLibs $theVcVer] aProjTmpl
regsub -all -- {__TKDEP_DEBUG__} $aProjTmpl [osutils:depLibraries $aUsedLibs $anOsDebugLibs $theVcVer] aProjTmpl
regsub -all -- {__TKDEFINES__} $aProjTmpl "" aProjTmpl
set aVCRTVer [string range $theVcVer 0 3]
regsub -all -- {__TKDEP__} $aProjTmpl [osutils:depLibraries $aUsedLibs $anOsReleaseLibs $theVcVer] aProjTmpl
regsub -all -- {__TKDEP_DEBUG__} $aProjTmpl [osutils:depLibraries $aUsedLibs $anOsDebugLibs $theVcVer] aProjTmpl
regsub -all -- {__TKDEFINES__} $aProjTmpl "" aProjTmpl
set aFilesSection ""
set aVcFilesCxx(units) ""
set aVcFilesHxx(units) ""
set aFilesSection ""
set aVcFilesCxx(units) ""
set aVcFilesHxx(units) ""
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
foreach f [osutils:tk:cxxfiles $theToolKit wnt $theSrcDir] {
if { ![info exists written([file tail $f])] } {
set written([file tail $f]) 1
if { ![info exists written([file tail $f])] } {
set written([file tail $f]) 1
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
append aFilesSection [osutils:vcxproj:cxxfile $f "" 3]
if { ! [info exists aVcFilesCxx($theToolKit)] } { lappend aVcFilesCxx(units) $theToolKit }
lappend aVcFilesCxx($theToolKit) $f
} else {
puts "Warning : in vcproj there are more than one occurrences for [file tail $f]"
}
}
} else {
append aFilesSection "\t\t\t<Filter\n"
append aFilesSection "\t\t\t\tName=\"$theToolKit\"\n"
append aFilesSection "\t\t\t\t>\n"
foreach f [osutils:tk:cxxfiles $theToolKit wnt $theSrcDir] {
if { ![info exists written([file tail $f])] } {
set written([file tail $f]) 1
append aFilesSection "\t\t\t<Filter\n"
append aFilesSection "\t\t\t\tName=\"$theToolKit\"\n"
append aFilesSection "\t\t\t\t>\n"
append aFilesSection [osutils:vcproj:file $theVcVer $f ""]
} else {
puts "Warning : in vcproj there are more than one occurrences for [file tail $f]"
append aFilesSection "\t\t\t</Filter>"
}
} else {
puts "Warning : in vcproj there are more than one occurrences for [file tail $f]"
}
append aFilesSection "\t\t\t</Filter>"
}
#puts "$aProjTmpl $aFilesSection"
set anIncPaths "..\\..\\..\\inc"
regsub -all -- {__TKINC__} $aProjTmpl $anIncPaths aProjTmpl
regsub -all -- {__FILES__} $aProjTmpl $aFilesSection aProjTmpl
regsub -all -- {__CONF__} $aProjTmpl Application aProjTmpl
#puts "$aProjTmpl $aFilesSection"
set anIncPaths "..\\..\\..\\inc"
regsub -all -- {__TKINC__} $aProjTmpl $anIncPaths aProjTmpl
regsub -all -- {__FILES__} $aProjTmpl $aFilesSection aProjTmpl
regsub -all -- {__CONF__} $aProjTmpl Application aProjTmpl
regsub -all -- {__XQTEXT__} $aProjTmpl "exe" aProjTmpl
regsub -all -- {__XQTEXT__} $aProjTmpl "exe" aProjTmpl
set aFile [open [set aVcFilePath [file join $theOutDir ${aProjName}.[osutils:vcproj:ext $theVcVer]]] w]
fconfigure $aFile -translation crlf
puts $aFile $aProjTmpl
close $aFile
set aCommonSettingsFile "$aVcFilePath.user"
lappend aVcFiles $aVcFilePath
# write filters file for vc10
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
lappend aVcFiles [osutils:vcxproj:filters $theOutDir $aProjName aVcFilesCxx aVcFilesHxx]
}
# write resource file
lappend aVcFiles [osutils:readtemplate:rc $theOutDir $aProjName]
set aCommonSettingsFileTmpl ""
if { "$theVcVer" == "vc7" || "$theVcVer" == "vc8" } {
# nothing
} elseif { "$theVcVer" == "vc9" } {
set aCommonSettingsFileTmpl [wokUtils:FILES:FileToString "$::THE_CASROOT/adm/templates/vcproj.user.vc9x"]
} else {
set aCommonSettingsFileTmpl [wokUtils:FILES:FileToString "$::THE_CASROOT/adm/templates/vcxproj.user.vc10x"]
}
if { "$aCommonSettingsFileTmpl" != "" } {
regsub -all -- {__VCVER__} $aCommonSettingsFileTmpl $aVCRTVer aCommonSettingsFileTmpl
set aFile [open [set aVcFilePath "$aCommonSettingsFile"] w]
set aFile [open [set aVcFilePath [file join $theOutDir ${aProjName}.[osutils:vcproj:ext $theVcVer]]] w]
fconfigure $aFile -translation crlf
puts $aFile $aCommonSettingsFileTmpl
puts $aFile $aProjTmpl
close $aFile
lappend aVcFiles "$aCommonSettingsFile"
}
set aCommonSettingsFile "$aVcFilePath.user"
lappend aVcFiles $aVcFilePath
# write filters file for vc10
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
lappend aVcFiles [osutils:vcxproj:filters $theOutDir $aProjName aVcFilesCxx aVcFilesHxx]
}
# write resource file
lappend aVcFiles [osutils:readtemplate:rc $theOutDir $aProjName]
set aCommonSettingsFileTmpl ""
if { "$theVcVer" == "vc7" || "$theVcVer" == "vc8" } {
# nothing
} elseif { "$theVcVer" == "vc9" } {
set aCommonSettingsFileTmpl [wokUtils:FILES:FileToString "$::THE_CASROOT/adm/templates/vcproj.user.vc9x"]
} else {
set aCommonSettingsFileTmpl [wokUtils:FILES:FileToString "$::THE_CASROOT/adm/templates/vcxproj.user.vc10x"]
}
if { "$aCommonSettingsFileTmpl" != "" } {
regsub -all -- {__VCVER__} $aCommonSettingsFileTmpl $aVCRTVer aCommonSettingsFileTmpl
set aFile [open [set aVcFilePath "$aCommonSettingsFile"] w]
fconfigure $aFile -translation crlf
puts $aFile $aCommonSettingsFileTmpl
close $aFile
lappend aVcFiles "$aCommonSettingsFile"
}
}
return $aVcFiles
}

View File

@@ -119,8 +119,6 @@ android-g++ {
# VS2015, vc141
} else:equals(aMsvcVer, 16.0){
# VS2019, vc142
} else:equals(aMsvcVer, 17.0){
# VS2022, vc143
} else {
warning (Unknown msvc version. "$$MY_COMPILER" is used)
}

View File

@@ -132,31 +132,21 @@ for (aPackage, aPackages) {
}
}
# extend clean with versioned .so files
!win32 {
aVerList = $$split(VERSION, ".")
aVerMaj = $$member(aVerList, 0)
aVerMin = $$member(aVerList, 1)
aVerMic = $$member(aVerList, 2)
equals(TEMPLATE, app) {
QMAKE_CLEAN += $$DESTDIR/$${TARGET}
} else {
mac {
# override qmake soname versionong logic
QMAKE_LFLAGS_SONAME =
QMAKE_LFLAGS += -Wl,-soname=lib$${TARGET}.dylib.$${aVerMaj}.$${aVerMin}
# extend clean with versioned .dylib files
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.dylib
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.dylib
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.$${aVerMin}.dylib
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.$${aVerMin}.$${aVerMic}.dylib
} else {
# override qmake soname versionong logic
QMAKE_LFLAGS_SONAME =
QMAKE_LFLAGS += -Wl,-soname=lib$${TARGET}.so.$${aVerMaj}.$${aVerMin}
# extend clean with versioned .so files
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so.$${aVerMaj}
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so.$${aVerMaj}.$${aVerMin}

View File

@@ -0,0 +1,142 @@
@echo OFF
rem Auxiliary script for semi-automated building of Bullet for Android platform.
rem Script should be placed into root of Bullet repository, edited with paths
rem to CMake, 3rd-parties, Android NDK and MinGW64 make tool.
rem CMake toolchain definition should be cloned from the following git repository:
rem https://github.com/taka-no-me/android-cmake
set "aBulletSrc=%~dp0"
set aNbJobs=%NUMBER_OF_PROCESSORS%
call c:\TDM-GCC-64\mingwvars.bat
set "PATH=c:\CMake\bin;%PATH%"
set "anNdkPath=c:/android-ndk-r12"
set "aToolchain=c:/android-cmake-master/android.toolchain.cmake"
set "toPack=1"
set /p aBulletVersion=<%aBulletSrc%VERSION
echo "aBulletVersion=%aBulletVersion%"
call :cmakeGenerate "15" "armeabi-v7a"
call :cmakeGenerate "15" "x86"
call :cmakeGenerate "21" "arm64-v8a"
call :cmakeGenerate "21" "x86_64"
set "THE_7Z_PARAMS=-t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on"
if ["%THE_7Z_PATH%"] == [""] set "THE_7Z_PATH=%ProgramW6432%\7-Zip\7z.exe"
if not exist "%THE_7Z_PATH%" set "THE_7Z_PATH=%ProgramW6432%\7-Zip\7z.exe"
if not exist "%THE_7Z_PATH%" set "THE_7Z_PATH=%ProgramFiles%\7-Zip\7z.exe"
set "anArchName=bullet-%aBulletVersion%-android"
set "aTarget=%~dp0work\%anArchName%"
if "%toPack%"=="1" (
echo Creating archive %anArchName%.7z
rmdir /S /Q "%aTarget%"
if not exist "%aTarget%\libs" ( mkdir "%aTarget%\libs" )
if exist "%~dp0work/%anArchName%.7z" del "%~dp0work/%anArchName%.7z"
xcopy /S /Y "%~dp0work\android-armeabi-v7a-gcc\include\*" "%aTarget%\"
xcopy /S /Y "%~dp0work\android-armeabi-v7a-gcc\libs\*" "%aTarget%\libs\"
xcopy /S /Y "%~dp0work\android-arm64-v8a-gcc\libs\*" "%aTarget%\libs\"
xcopy /S /Y "%~dp0work\android-x86-gcc\libs\*" "%aTarget%\libs\"
xcopy /S /Y "%~dp0work\android-x86_64-gcc\libs\*" "%aTarget%\libs\"
xcopy /Y "%aBulletSrc%README.md" "%aTarget%\"
xcopy /Y "%aBulletSrc%LICENSE.txt" "%aTarget%\"
"%THE_7Z_PATH%" a -r %THE_7Z_PARAMS% "%~dp0work/%anArchName%.7z" "%aTarget%"
)
if not ["%1"] == ["-nopause"] (
pause
)
goto :eof
:cmakeGenerate
set "anApi=%1"
set "anAbi=%2"
set "aPlatformAndCompiler=android-%anAbi%-gcc"
set "aWorkDir=work\%aPlatformAndCompiler%-make"
set "aLogFile=%~dp0build-%anAbi%.log"
if not exist "%aWorkDir%" ( mkdir "%aWorkDir%" )
if exist "%aLogFile%" ( del "%aLogFile%" )
pushd "%aWorkDir%"
set STARTTIME=%TIME%
echo Configuring Bullet for Android %anAbi% (API level %anApi%)...
cmake -G "MinGW Makefiles" ^
-D CMAKE_TOOLCHAIN_FILE:FILEPATH="%aToolchain%" ^
-D ANDROID_NDK:FILEPATH="%anNdkPath%" ^
-D CMAKE_BUILD_TYPE:STRING="Release" ^
-D ANDROID_ABI:STRING="%anAbi%" ^
-D ANDROID_NATIVE_API_LEVEL:STRING="%anApi%" ^
-D ANDROID_STL:STRING="gnustl_shared" ^
-D BUILD_LIBRARY_TYPE:STRING="Static" ^
-D CMAKE_INSTALL_PREFIX:PATH="%~dp0work/%aPlatformAndCompiler%" ^
-D LIBRARY_OUTPUT_PATH:PATH="%~dp0work/%aPlatformAndCompiler%/libs/%anAbi%" ^
-D LIB_DESTINATION:STRING="libs/%anAbi%" ^
-D INCLUDE_INSTALL_DIR:STRING="%~dp0work/%aPlatformAndCompiler%/include/bullet" ^
-D BUILD_BULLET3:BOOL="ON" ^
-D BUILD_CPU_DEMOS:BOOL="OFF" ^
-D BUILD_EXTRAS:BOOL="OFF" ^
-D BUILD_BULLET2_DEMOS:BOOL="OFF" ^
-D BUILD_OPENGL3_DEMOS:BOOL="OFF" ^
-D BUILD_PYBULLET:BOOL="OFF" ^
-D BUILD_SHARED_LIBS:BOOL="OFF" ^
-D BUILD_UNIT_TESTS:BOOL="OFF" ^
-D BULLET2_USE_THREAD_LOCKS:BOOL="OFF" ^
-D USE_GLUT:BOOL="OFF" ^
-D USE_DOUBLE_PRECISION:BOOL="OFF" ^
-D USE_CUSTOM_VECTOR_MATH:BOOL="OFF" ^
-D USE_GRAPHICAL_BENCHMARK:BOOL="OFF" ^
-D USE_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD:BOOL="OFF" ^
"%aBulletSrc%"
if errorlevel 1 (
popd
pause
exit /B
goto :eof
)
mingw32-make clean
echo Building Bullet...
mingw32-make -j %aNbJobs% 2>> %aLogFile%
type %aLogFile%
if errorlevel 1 (
popd
pause
exit /B
goto :eof
)
echo Installing Bullet into %~dp0work/%aPlatformAndCompiler%...
mingw32-make install 2>> %aLogFile%
set ENDTIME=%TIME%
rem handle time before 10AM (win10 - remove empty space at the beginning)
if "%STARTTIME:~0,1%"==" " set "STARTTIME=%STARTTIME:~1%"
if "%ENDTIME:~0,1%"==" " set "ENDTIME=%ENDTIME:~1%"
rem handle time before 10AM (win7 - add 0 at the beginning)
if "%STARTTIME:~1,1%"==":" set "STARTTIME=0%STARTTIME%"
if "%ENDTIME:~1,1%"==":" set "ENDTIME=0%ENDTIME%"
rem convert hours:minutes:seconds:ms into duration
set /A STARTTIME=(1%STARTTIME:~0,2%-100)*360000 + (1%STARTTIME:~3,2%-100)*6000 + (1%STARTTIME:~6,2%-100)*100 + (1%STARTTIME:~9,2%-100)
set /A ENDTIME= (1%ENDTIME:~0,2%-100)*360000 + (1%ENDTIME:~3,2%-100)*6000 + (1%ENDTIME:~6,2%-100)*100 + (1%ENDTIME:~9,2%-100)
set /A DURATION=%ENDTIME%-%STARTTIME%
if %ENDTIME% LSS %STARTTIME% set set /A DURATION=%STARTTIME%-%ENDTIME%
set /A DURATIONH=%DURATION% / 360000
set /A DURATIONM=(%DURATION% - %DURATIONH%*360000) / 6000
set /A DURATIONS=(%DURATION% - %DURATIONH%*360000 - %DURATIONM%*6000) / 100
if %DURATIONH% LSS 10 set DURATIONH=0%DURATIONH%
if %DURATIONM% LSS 10 set DURATIONM=0%DURATIONM%
if %DURATIONS% LSS 10 set DURATIONS=0%DURATIONS%
echo Building time: %DURATIONH%:%DURATIONM%:%DURATIONS% for %anAbi%
echo Building time: %DURATIONH%:%DURATIONM%:%DURATIONS% >> %aLogFile%
popd
goto :eof

View File

@@ -0,0 +1,144 @@
#!/bin/bash
# Auxiliary script for semi-automated building building of Bullet for iOS platform.
# Script should be placed into root of Bullet repository, edited with paths to CMake.
# https://github.com/bulletphysics/bullet3/releases
# WARNING! The following line should be removed from CMakeLists.txt in Bullet for building for iOS:
# FIND_PACKAGE(PythonLibs ${PYTHON_VERSION_STRING} EXACT)
# CMake toolchain definition should be cloned from the following git repository:
# https://github.com/leetal/ios-cmake
# go to the script directory
aScriptPath=${BASH_SOURCE%/*}
if [ -d "$aScriptPath" ]; then cd "$aScriptPath"; fi
aScriptPath="$PWD"
aProjName=${PWD##*/}
aBulletSrc=$aScriptPath
aNbJobs="$(getconf _NPROCESSORS_ONLN)"
PATH=/Applications/CMake.app/Contents/bin:$PATH
aToolchain=$HOME/ios-cmake.git/ios.toolchain.cmake
# build stages to perform
toSimulator=0
toCMake=1
toClean=1
toMake=1
toInstall=1
toPack=1
export MACOSX_DEPLOYMENT_TARGET=
export IPHONEOS_DEPLOYMENT_TARGET=8.0
anAbi=arm64
aPlatform=OS
aPlatformAndCompiler=ios-$anAbi-clang
if [[ $toSimulator == 1 ]]; then
anAbi=x86_64
aPlatform=SIMULATOR64
aPlatformAndCompiler=ios-simulator64-clang
fi
aWorkDir=work/$aProjName-${aPlatformAndCompiler}-make
aDestDir=$aBulletSrc/work/$aProjName-$aPlatformAndCompiler
aLogFile=$aBulletSrc/build-${aPlatformAndCompiler}.log
mkdir -p $aWorkDir
rm -f $aLogFile
pushd $aWorkDir
aTimeZERO=$SECONDS
set -o pipefail
function logDuration {
if [[ $1 == 1 ]]; then
aDur=$(($4 - $3))
echo $2 time: $aDur sec>> $aLogFile
fi
}
# (re)generate Make files
if [[ $toCMake == 1 ]]; then
echo Configuring Bullet for iOS...
cmake -G "Unix Makefiles" \
-D CMAKE_TOOLCHAIN_FILE:FILEPATH="$aToolchain" \
-D IOS_PLATFORM:STRING="$aPlatform" \
-D IOS_ARCH:STRING="$anAbi" \
-D IOS_DEPLOYMENT_TARGET:STRING="$IPHONEOS_DEPLOYMENT_TARGET" \
-D CMAKE_BUILD_TYPE:STRING="Release" \
-D BUILD_LIBRARY_TYPE:STRING="Static" \
-D CMAKE_INSTALL_PREFIX:PATH="$aDestDir" \
-D CMAKE_INSTALL_PREFIX:PATH="%~dp0work/%aPlatformAndCompiler%" \
-D LIBRARY_OUTPUT_PATH:PATH="$aDestDir/lib" \
-D LIB_DESTINATION:STRING="lib" \
-D INCLUDE_INSTALL_DIR:STRING="$aDestDir/include/bullet" \
-D BUILD_BULLET3:BOOL="ON" \
-D BUILD_CPU_DEMOS:BOOL="OFF" \
-D BUILD_EXTRAS:BOOL="OFF" \
-D BUILD_BULLET2_DEMOS:BOOL="OFF" \
-D BUILD_OPENGL3_DEMOS:BOOL="OFF" \
-D BUILD_PYBULLET:BOOL="OFF" \
-D BUILD_SHARED_LIBS:BOOL="OFF" \
-D BUILD_UNIT_TESTS:BOOL="OFF" \
-D BULLET2_USE_THREAD_LOCKS:BOOL="OFF" \
-D USE_GLUT:BOOL="OFF" \
-D USE_DOUBLE_PRECISION:BOOL="OFF" \
-D USE_CUSTOM_VECTOR_MATH:BOOL="OFF" \
-D USE_GRAPHICAL_BENCHMARK:BOOL="OFF" \
-D USE_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD:BOOL="OFF" \
"$aBulletSrc" 2>&1 | tee -a $aLogFile
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
fi
aTimeGEN=$SECONDS
logDuration $toCMake "Generation" $aTimeZERO $aTimeGEN
# clean up from previous build
if [[ $toClean == 1 ]]; then
make clean
fi
# build the project
if [[ $toMake == 1 ]]; then
echo Building...
make -j $aNbJobs 2>&1 | tee -a $aLogFile
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
fi
aTimeBUILD=$SECONDS
logDuration $toMake "Building" $aTimeGEN $aTimeBUILD
logDuration $toMake "Total building" $aTimeZERO $aTimeBUILD
# install the project
if [[ $toInstall == 1 ]]; then
echo Installing into $aBulletSrc/work/$aPlatformAndCompiler...
make install 2>&1 | tee -a $aLogFile
xcodebuild -version > $aDestDir/config.log
clang --version >> $aDestDir/config.log
echo IPHONEOS_DEPLOYMENT_TARGET=$IPHONEOS_DEPLOYMENT_TARGET>> $aDestDir/config.log
cp -f $aBulletSrc/VERSION $aDestDir/VERSION
cp -f $aBulletSrc/LICENSE.txt $aDestDir/LICENSE.txt
fi
aTimeINSTALL=$SECONDS
logDuration $toInstall "Install" $aTimeBUILD $aTimeINSTALL
# create an archive
if [[ $toPack == 1 ]]; then
anArchName=$aProjName-$aPlatformAndCompiler.tar.bz2
echo Creating an archive $aBulletSrc/work/$anArchName...
rm $aBulletSrc/work/$anArchName &>/dev/null
pushd $aDestDir
tar -jcf $aBulletSrc/work/$anArchName *
popd
fi
aTimePACK=$SECONDS
logDuration $toPack "Packing archive" $aTimeINSTALL $aTimePACK
# finished
DURATION=$(($aTimePACK - $aTimeZERO))
echo Total time: $DURATION sec
logDuration 1 "Total" $aTimeZERO $aTimePACK
popd

View File

@@ -0,0 +1,124 @@
#!/bin/bash
# Auxiliary script for semi-automated building building of Bullet for macOS platform.
# Script should be placed into root of bullet repository, edited with paths to CMake.
# https://github.com/bulletphysics/bullet3/releases
# go to the script directory
aScriptPath=${BASH_SOURCE%/*}
if [ -d "$aScriptPath" ]; then cd "$aScriptPath"; fi
aScriptPath="$PWD"
aProjName=${PWD##*/}
aBulletSrc=$aScriptPath
aNbJobs="$(getconf _NPROCESSORS_ONLN)"
PATH=/Applications/CMake.app/Contents/bin:$PATH
# build stages to perform
toCMake=1
toClean=1
toMake=1
toInstall=1
toPack=1
export MACOSX_DEPLOYMENT_TARGET=10.10
anAbi=arm64
#anAbi=x86_64
aPlatformAndCompiler=macos-$anAbi
aWorkDir=work/$aProjName-${aPlatformAndCompiler}-make
aDestDir=$aBulletSrc/work/$aProjName-$aPlatformAndCompiler
aLogFile=$aBulletSrc/build-${aPlatformAndCompiler}.log
mkdir -p $aWorkDir
rm -f $aLogFile
pushd $aWorkDir
aTimeZERO=$SECONDS
set -o pipefail
function logDuration {
if [[ $1 == 1 ]]; then
aDur=$(($4 - $3))
echo $2 time: $aDur sec>> $aLogFile
fi
}
# (re)generate Make files
if [[ $toCMake == 1 ]]; then
echo Configuring Bullet for OS X...
cmake -G "Unix Makefiles" \
-D CMAKE_BUILD_TYPE:STRING="Release" \
-D BUILD_LIBRARY_TYPE:STRING="Static" \
-D CMAKE_OSX_ARCHITECTURES:STRING="$anAbi" \
-D CMAKE_INSTALL_PREFIX:PATH="$aDestDir" \
-D LIBRARY_OUTPUT_PATH:PATH="$aDestDir/lib" \
-D LIB_DESTINATION:STRING="lib" \
-D INCLUDE_INSTALL_DIR:STRING="$aDestDir/include/bullet" \
-D BUILD_BULLET3:BOOL="ON" \
-D BUILD_CPU_DEMOS:BOOL="OFF" \
-D BUILD_EXTRAS:BOOL="OFF" \
-D BUILD_BULLET2_DEMOS:BOOL="OFF" \
-D BUILD_OPENGL3_DEMOS:BOOL="OFF" \
-D BUILD_PYBULLET:BOOL="OFF" \
-D BUILD_SHARED_LIBS:BOOL="OFF" \
-D BUILD_UNIT_TESTS:BOOL="OFF" \
-D BULLET2_USE_THREAD_LOCKS:BOOL="OFF" \
-D USE_GLUT:BOOL="OFF" \
-D USE_DOUBLE_PRECISION:BOOL="OFF" \
-D USE_CUSTOM_VECTOR_MATH:BOOL="OFF" \
-D USE_GRAPHICAL_BENCHMARK:BOOL="OFF" \
-D USE_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD:BOOL="OFF" \
"$aBulletSrc" 2>&1 | tee -a $aLogFile
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
fi
aTimeGEN=$SECONDS
logDuration $toCMake "Generation" $aTimeZERO $aTimeGEN
# clean up from previous build
if [[ $toClean == 1 ]]; then
make clean
fi
# build the project
if [[ $toMake == 1 ]]; then
echo Building...
make -j $aNbJobs 2>&1 | tee -a $aLogFile
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
fi
aTimeBUILD=$SECONDS
logDuration $toMake "Building" $aTimeGEN $aTimeBUILD
logDuration $toMake "Total building" $aTimeZERO $aTimeBUILD
# install the project
if [[ $toInstall == 1 ]]; then
echo Installing into $aBulletSrc/work/$aPlatformAndCompiler...
make install 2>&1 | tee -a $aLogFile
xcodebuild -version > $aDestDir/config.log
clang --version >> $aDestDir/config.log
echo MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET>> $aDestDir/config.log
cp -f $aBulletSrc/VERSION $aDestDir/VERSION
cp -f $aBulletSrc/LICENSE.txt $aDestDir/LICENSE.txt
fi
aTimeINSTALL=$SECONDS
logDuration $toInstall "Install" $aTimeBUILD $aTimeINSTALL
# create an archive
if [[ $toPack == 1 ]]; then
anArchName=$aProjName-$aPlatformAndCompiler.tar.bz2
echo Creating an archive $aBulletSrc/work/$anArchName...
rm $aBulletSrc/work/$anArchName &>/dev/null
pushd $aDestDir
tar -jcf $aBulletSrc/work/$anArchName *
popd
fi
aTimePACK=$SECONDS
logDuration $toPack "Packing archive" $aTimeINSTALL $aTimePACK
# finished
DURATION=$(($aTimePACK - $aTimeZERO))
echo Total time: $DURATION sec
logDuration 1 "Total" $aTimeZERO $aTimePACK
popd

View File

@@ -0,0 +1,101 @@
@echo OFF
rem Auxiliary script for semi-automated building of Draco library for Android platform.
rem https://github.com/google/draco
set "aDracoSrc=%~dp0"
set "aBuildRoot=%aDracoSrc%\work"
set aNbJobs=%NUMBER_OF_PROCESSORS%
rem Paths to 3rd-party tools and libraries
call c:\TDM-GCC-64\mingwvars.bat
set "aCmakeBin=c:\CMake\bin"
set "anNdkPath=c:/android-ndk-r12"
set "PATH=%aCmakeBin%;%PATH%"
set "aCompiler=gcc"
set "aCppLib=gnustl_shared"
if not exist "%anNdkPath%/sources/cxx-stl/gnu-libstdc++" (
if exist "%anNdkPath%/sources/cxx-stl/llvm-libc++" (
set "aCompiler=clang"
set "aCppLib=c++_shared"
)
)
set "aDestDir=%aBuildRoot%\draco-android-%aCompiler%"
rmdir /S /Q "%aDestDir%"
if not exist "%aDestDir%" ( mkdir "%aDestDir%" )
if not exist "%aDestDir%\include" ( mkdir "%aDestDir%\include" )
if not exist "%aDestDir%\libs" ( mkdir "%aDestDir%\libs" )
xcopy /Y "%aDracoSrc%\LICENSE" "%aDestDir%\"
xcopy /Y "%aDracoSrc%\README.md" "%aDestDir%\"
call :cmakeGenerate "15" "armeabi-v7a"
call :cmakeGenerate "15" "x86"
call :cmakeGenerate "21" "arm64-v8a"
call :cmakeGenerate "21" "x86_64"
set "anArchName=draco-android"
echo Creating archive %anArchName%.7z
if exist "%aBuildRoot%/%anArchName%.7z" del "%aBuildRoot%/%anArchName%.7z"
set "THE_7Z_PARAMS=-t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on"
set "THE_7Z_PATH=%ProgramW6432%\7-Zip\7z.exe"
"%THE_7Z_PATH%" a -r %THE_7Z_PARAMS% "%aBuildRoot%/%anArchName%.7z" "%aDestDir%"
pause
goto :eof
:cmakeGenerate
set "anApi=%~1"
set "anAbi=%~2"
set "aPlatformAndCompiler=android-%anAbi%-%aCompiler%"
set "aWorkDir=%aBuildRoot%\draco-%aPlatformAndCompiler%-make"
set "aLogFile=%aBuildRoot%\build-%aPlatformAndCompiler%.log"
if not exist "%aWorkDir%" ( mkdir "%aWorkDir%" )
if exist "%aLogFile%" ( del "%aLogFile%" )
pushd "%aWorkDir%"
echo Configuring Draco for Android %anAbi%, API level %anApi%...
cmake -G "MinGW Makefiles" ^
-D CMAKE_SYSTEM_NAME:STRING="Android" ^
-D CMAKE_ANDROID_NDK="%anNdkPath%" ^
-D CMAKE_BUILD_TYPE:STRING="Release" ^
-D CMAKE_ANDROID_ARCH_ABI:STRING="%anAbi%" ^
-D CMAKE_SYSTEM_VERSION:STRING="%anApi%" ^
-D CMAKE_ANDROID_STL_TYPE="%aCppLib%" ^
-D BUILD_LIBRARY_TYPE:STRING="Static" ^
-D CMAKE_INSTALL_PREFIX:PATH="%aBuildRoot%/draco-%aPlatformAndCompiler%" ^
-D LIBRARY_OUTPUT_PATH:PATH="%aBuildRoot%/draco-%aPlatformAndCompiler%/libs/%anAbi%" ^
"%aDracoSrc%"
if errorlevel 1 (
popd
pause
exit /B
goto :eof
)
mingw32-make clean
echo Building...
mingw32-make -j %aNbJobs% 2>> "%aLogFile%"
if errorlevel 1 (
type %aLogFile%
popd
pause
exit /B
goto :eof
)
type %aLogFile%
echo Installing Draco into %aBuildRoot%/draco-%aPlatformAndCompiler%...
mingw32-make install 2>> %aLogFile%
xcopy /S /Y "%aBuildRoot%\draco-%aPlatformAndCompiler%\include\*" "%aDestDir%\include\"
xcopy /S /Y "%aBuildRoot%\draco-%aPlatformAndCompiler%\libs\*" "%aDestDir%\libs\"
popd
goto :eof

View File

@@ -0,0 +1,102 @@
#!/bin/bash
# Auxiliary script for semi-automated building of Draco for Linux platform.
# Script should be placed into root of Draco repository, edited with paths to CMake.
# https://github.com/google/draco
# go to the script directory
aScriptPath=${BASH_SOURCE%/*}
if [ -d "$aScriptPath" ]; then cd "$aScriptPath"; fi
aScriptPath="$PWD"
aProjName=${PWD##*/}
aDracoSrc=$aScriptPath
aNbJobs="$(getconf _NPROCESSORS_ONLN)"
# CMake should be up-to-date
#PATH=~/develop/local/bin:$PATH
# build stages to perform
toCMake=1
toClean=1
toMake=1
toInstall=1
toPack=1
aPlatformAndCompiler=lin64-gcc
aWorkDir=work/$aProjName-${aPlatformAndCompiler}-make
aDestDir=$aDracoSrc/work/$aProjName-$aPlatformAndCompiler
aLogFile=$aDracoSrc/build-${aPlatformAndCompiler}.log
mkdir -p $aWorkDir
rm -f $aLogFile
pushd $aWorkDir
aTimeZERO=$SECONDS
set -o pipefail
function logDuration {
if [[ $1 == 1 ]]; then
aDur=$(($4 - $3))
echo $2 time: $aDur sec>> $aLogFile
fi
}
# (re)generate Make files
if [[ $toCMake == 1 ]]; then
echo Configuring Draco for Linux...
cmake -G "Unix Makefiles" \
-D CMAKE_BUILD_TYPE:STRING="Release" \
-D CMAKE_INSTALL_PREFIX:PATH="$aDestDir" \
-D BUILD_DOCS:BOOL="OFF" \
-D BUILD_LIBRARY_TYPE:STRING="Static" \
"$aDracoSrc" 2>&1 | tee -a $aLogFile
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
fi
aTimeGEN=$SECONDS
logDuration $toCMake "Generation" $aTimeZERO $aTimeGEN
# clean up from previous build
if [[ $toClean == 1 ]]; then
make clean
fi
# build the project
if [[ $toMake == 1 ]]; then
echo Building...
make -j $aNbJobs 2>&1 | tee -a $aLogFile
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
fi
aTimeBUILD=$SECONDS
logDuration $toMake "Building" $aTimeGEN $aTimeBUILD
logDuration $toMake "Total building" $aTimeZERO $aTimeBUILD
# install the project
if [[ $toInstall == 1 ]]; then
echo Installing into $aDracoSrc/work/$aPlatformAndCompiler...
make install 2>&1 | tee -a $aLogFile
gcc --version >> $aDestDir/config.log
cp -f $aDracoSrc/LICENSE $aDestDir/LICENSE
fi
aTimeINSTALL=$SECONDS
logDuration $toInstall "Install" $aTimeBUILD $aTimeINSTALL
# create an archive
if [[ $toPack == 1 ]]; then
anArchName=$aProjName-$aPlatformAndCompiler.tar.bz2
echo Creating an archive $aDracoSrc/work/$anArchName...
rm $aDracoSrc/work/$anArchName &>/dev/null
pushd $aDestDir
tar -jcf $aDracoSrc/work/$anArchName *
popd
fi
aTimePACK=$SECONDS
logDuration $toPack "Packing archive" $aTimeINSTALL $aTimePACK
# finished
DURATION=$(($aTimePACK - $aTimeZERO))
echo Total time: $DURATION sec
logDuration 1 "Total" $aTimeZERO $aTimePACK
popd

View File

@@ -0,0 +1,107 @@
#!/bin/bash
# Auxiliary script for semi-automated building building of Draco for macOS platform.
# Script should be placed into root of Draco repository, edited with paths to CMake.
# https://github.com/google/draco
# go to the script directory
aScriptPath=${BASH_SOURCE%/*}
if [ -d "$aScriptPath" ]; then cd "$aScriptPath"; fi
aScriptPath="$PWD"
aProjName=${PWD##*/}
aDracoSrc=$aScriptPath
aNbJobs="$(getconf _NPROCESSORS_ONLN)"
PATH=/Applications/CMake.app/Contents/bin:$PATH
# build stages to perform
toCMake=1
toClean=1
toMake=1
toInstall=1
toPack=1
export MACOSX_DEPLOYMENT_TARGET=10.10
anAbi=arm64
#anAbi=x86_64
aPlatformAndCompiler=macos-$anAbi
aWorkDir=work/$aProjName-${aPlatformAndCompiler}-make
aDestDir=$aDracoSrc/work/$aProjName-$aPlatformAndCompiler
aLogFile=$aDracoSrc/build-${aPlatformAndCompiler}.log
mkdir -p $aWorkDir
rm -f $aLogFile
pushd $aWorkDir
aTimeZERO=$SECONDS
set -o pipefail
function logDuration {
if [[ $1 == 1 ]]; then
aDur=$(($4 - $3))
echo $2 time: $aDur sec>> $aLogFile
fi
}
# (re)generate Make files
if [[ $toCMake == 1 ]]; then
echo Configuring Draco for macOS...
cmake -G "Unix Makefiles" \
-D CMAKE_BUILD_TYPE:STRING="Release" \
-D BUILD_LIBRARY_TYPE:STRING="Static" \
-D CMAKE_OSX_ARCHITECTURES:STRING="$anAbi" \
-D CMAKE_INSTALL_PREFIX:PATH="$aDestDir" \
"$aDracoSrc" 2>&1 | tee -a $aLogFile
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
fi
aTimeGEN=$SECONDS
logDuration $toCMake "Generation" $aTimeZERO $aTimeGEN
# clean up from previous build
if [[ $toClean == 1 ]]; then
make clean
fi
# build the project
if [[ $toMake == 1 ]]; then
echo Building...
make -j $aNbJobs 2>&1 | tee -a $aLogFile
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
fi
aTimeBUILD=$SECONDS
logDuration $toMake "Building" $aTimeGEN $aTimeBUILD
logDuration $toMake "Total building" $aTimeZERO $aTimeBUILD
# install the project
if [[ $toInstall == 1 ]]; then
echo Installing into $aDracoSrc/work/$aPlatformAndCompiler...
make install 2>&1 | tee -a $aLogFile
xcodebuild -version > $aDestDir/config.log
clang --version >> $aDestDir/config.log
echo MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET>> $aDestDir/config.log
cp -f $aDracoSrc/README.md $aDestDir/README.md
cp -f $aDracoSrc/LICENSE $aDestDir/LICENSE
fi
aTimeINSTALL=$SECONDS
logDuration $toInstall "Install" $aTimeBUILD $aTimeINSTALL
# create an archive
if [[ $toPack == 1 ]]; then
anArchName=$aProjName-$aPlatformAndCompiler.tar.bz2
echo Creating an archive $aDracoSrc/work/$anArchName...
rm $aDracoSrc/work/$anArchName &>/dev/null
pushd $aDestDir
tar -jcf $aDracoSrc/work/$anArchName *
popd
fi
aTimePACK=$SECONDS
logDuration $toPack "Packing archive" $aTimeINSTALL $aTimePACK
# finished
DURATION=$(($aTimePACK - $aTimeZERO))
echo Total time: $DURATION sec
logDuration 1 "Total" $aTimeZERO $aTimePACK
popd

View File

@@ -0,0 +1,107 @@
@echo OFF
rem Auxiliary script for semi-automated building of Draco library as WebAssembly library.
rem https://github.com/google/draco
set "aDracoSrc=%~dp0"
set "aBuildRoot=%aDracoSrc%\work"
set aNbJobs=%NUMBER_OF_PROCESSORS%
rem Paths to 3rd-party tools and libraries
set "aCmakeBin=c:\CMake\bin"
set "EMSDK_ROOT=c:\emsdk"
set "EMSCRIPTEN=%EMSDK_ROOT%/upstream/emscripten"
set "PATH=%EMSDK_ROOT%\python\3.9.2-1_64bit;%PATH%"
rem Build stages to perform
set "toCMake=1"
set "toClean=1"
set "toMake=1"
set "toInstall=1"
set "toDebug=0"
call "%EMSDK_ROOT%\emsdk_env.bat"
set "aToolchain=%EMSDK%/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake"
if not ["%aCmakeBin%"] == [""] ( set "PATH=%aCmakeBin%;%PATH%" )
set "aBuildType=Release"
set "aBuildTypePrefix="
if ["%toDebug%"] == ["1"] (
set "aBuildType=Debug"
set "aBuildTypePrefix=-debug"
)
call :cmakeGenerate
if not ["%1"] == ["-nopause"] (
pause
)
goto :eof
:cmakeGenerate
set "aPlatformAndCompiler=wasm32%aBuildTypePrefix%"
set "aWorkDir=%aBuildRoot%\draco-%aPlatformAndCompiler%-make"
set "aDestDir=%aBuildRoot%\draco-%aPlatformAndCompiler%"
set "aLogFile=%aBuildRoot%\draco-%aPlatformAndCompiler%-build.log"
if ["%toCMake%"] == ["1"] (
if ["%toClean%"] == ["1"] (
rmdir /S /Q %aWorkDir%"
rmdir /S /Q %aDestDir%"
)
)
if not exist "%aWorkDir%" ( mkdir "%aWorkDir%" )
if exist "%aLogFile%" ( del "%aLogFile%" )
pushd "%aWorkDir%"
if ["%toCMake%"] == ["1"] (
cmake -G "MinGW Makefiles" ^
-D CMAKE_TOOLCHAIN_FILE:FILEPATH="%aToolchain%" ^
-D CMAKE_BUILD_TYPE:STRING="%aBuildType%" ^
-D CMAKE_INSTALL_PREFIX:PATH="%aDestDir%" ^
-D BUILD_LIBRARY_TYPE:STRING="Static" ^
-D DRACO_WASM:BOOL="ON" ^
-D DRACO_JS_GLUE:BOOL="OFF" ^
"%aDracoSrc%"
rem -D DRACO_POINT_CLOUD_COMPRESSION:BOOL="OFF" ^
rem -D DRACO_MESH_COMPRESSION:BOOL="OFF" ^
if errorlevel 1 (
popd
pause
exit /B
goto :eof
)
)
if ["%toClean%"] == ["1"] (
mingw32-make clean
)
if ["%toMake%"] == ["1"] (
echo Building...
mingw32-make -j %aNbJobs% 2>> "%aLogFile%"
if errorlevel 1 (
type "%aLogFile%"
popd
pause
exit /B
goto :eof
)
type "%aLogFile%"
)
if ["%toInstall%"] == ["1"] (
mingw32-make install 2>> "%aLogFile%"
if errorlevel 1 (
type "%aLogFile%"
popd
pause
exit /B
goto :eof
)
)
popd
goto :eof

View File

@@ -0,0 +1,139 @@
@echo OFF
rem Auxiliary script for semi-automated building of FreeType for Android platform.
rem Script should be placed into root of FreeType repository, edited with paths
rem to CMake, 3rd-parties, Android NDK and MinGW64 make tool.
rem CMake toolchain definition should be cloned from the following git repository:
rem https://github.com/taka-no-me/android-cmake
rem CMake can be downloaded from official site:
rem https://cmake.org/download/
rem Android NDK can be downloaded from official site:
rem https://developer.android.com/ndk/downloads
set "aFreeTypeSrc=%~dp0"
set aNbJobs=%NUMBER_OF_PROCESSORS%
call c:\TDM-GCC-64\mingwvars.bat
set "PATH=c:\CMake\bin;%PATH%"
set "anNdkPath=c:/android-ndk-r12"
set "aToolchain=c:/android-cmake-master/android.toolchain.cmake"
set "toPack=1"
set "FREETYPE_MAJOR=0"
set "FREETYPE_MINOR=0"
set "FREETYPE_PATCH=0"
for /f "tokens=3" %%i in ('findstr /b /c:"#define FREETYPE_MAJOR" "%aFreeTypeSrc%\include\freetype\freetype.h"') do ( set "FREETYPE_MAJOR=%%i" )
for /f "tokens=3" %%i in ('findstr /b /c:"#define FREETYPE_MINOR" "%aFreeTypeSrc%\include\freetype\freetype.h"') do ( set "FREETYPE_MINOR=%%i" )
for /f "tokens=3" %%i in ('findstr /b /c:"#define FREETYPE_PATCH" "%aFreeTypeSrc%\include\freetype\freetype.h"') do ( set "FREETYPE_PATCH=%%i" )
set "aFreeTypeVersion=%FREETYPE_MAJOR%.%FREETYPE_MINOR%.%FREETYPE_PATCH%"
echo "aFreeTypeVersion=%aFreeTypeVersion%"
call :cmakeGenerate "15" "armeabi-v7a"
call :cmakeGenerate "15" "x86"
call :cmakeGenerate "21" "arm64-v8a"
call :cmakeGenerate "21" "x86_64"
set "THE_7Z_PARAMS=-t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on"
if ["%THE_7Z_PATH%"] == [""] set "THE_7Z_PATH=%ProgramW6432%\7-Zip\7z.exe"
if not exist "%THE_7Z_PATH%" set "THE_7Z_PATH=%ProgramW6432%\7-Zip\7z.exe"
if not exist "%THE_7Z_PATH%" set "THE_7Z_PATH=%ProgramFiles%\7-Zip\7z.exe"
set "anArchName=freetype-%aFreeTypeVersion%-android"
set "aTarget=%~dp0work\%anArchName%"
if "%toPack%"=="1" (
echo Creating archive %anArchName%.7z
rmdir /S /Q "%aTarget%"
if not exist "%aTarget%\libs" ( mkdir "%aTarget%\libs" )
if exist "%~dp0work/%anArchName%.7z" del "%~dp0work/%anArchName%.7z"
xcopy /S /Y /I "%~dp0work\android-armeabi-v7a-gcc\include\freetype2" "%aTarget%\include"
xcopy /Y "%~dp0work\android-armeabi-v7a-gcc\lib\*.so" "%aTarget%\libs\armeabi-v7a\"
xcopy /Y "%~dp0work\android-arm64-v8a-gcc\lib\*.so" "%aTarget%\libs\arm64-v8a\"
xcopy /Y "%~dp0work\android-x86-gcc\lib\*.so" "%aTarget%\libs\x86\"
xcopy /Y "%~dp0work\android-x86_64-gcc\lib\*.so" "%aTarget%\libs\x86_64\"
xcopy /Y "%aFreeTypeSrc%\README" "%aTarget%\"
xcopy /Y "%aFreeTypeSrc%\docs\FTL.TXT" "%aTarget%\"
xcopy /Y "%aFreeTypeSrc%\docs\GPLv2.TXT" "%aTarget%\"
xcopy /Y "%aFreeTypeSrc%\docs\LICENSE.TXT" "%aTarget%\"
"%THE_7Z_PATH%" a -r %THE_7Z_PARAMS% "%~dp0work/%anArchName%.7z" "%aTarget%"
)
if not ["%1"] == ["-nopause"] (
pause
)
goto :eof
:cmakeGenerate
set "anApi=%1"
set "anAbi=%2"
set "aPlatformAndCompiler=android-%anAbi%-gcc"
set "aWorkDir=work\%aPlatformAndCompiler%-make"
set "aLogFile=%~dp0build-%anAbi%.log"
if not exist "%aWorkDir%" ( mkdir "%aWorkDir%" )
if exist "%aLogFile%" ( del "%aLogFile%" )
pushd "%aWorkDir%"
set STARTTIME=%TIME%
echo Configuring OCCT for Android %anAbi% (API level %anApi%)...
cmake -G "MinGW Makefiles" ^
-D CMAKE_TOOLCHAIN_FILE:FILEPATH="%aToolchain%" ^
-D ANDROID_NDK:FILEPATH="%anNdkPath%" ^
-D ANDROID_ABI:STRING="%anAbi%" ^
-D ANDROID_NATIVE_API_LEVEL:STRING="%anApi%" ^
-D ANDROID_STL:STRING="gnustl_shared" ^
-D CMAKE_BUILD_TYPE:STRING="Release" ^
-D BUILD_SHARED_LIBS:BOOL="TRUE" ^
-D CMAKE_INSTALL_PREFIX:PATH="%~dp0work/%aPlatformAndCompiler%" ^
"%aFreeTypeSrc%"
if errorlevel 1 (
popd
pause
exit /B
goto :eof
)
mingw32-make clean
echo Building FreeType...
mingw32-make -j %aNbJobs% 2>> %aLogFile%
type %aLogFile%
if errorlevel 1 (
popd
pause
exit /B
goto :eof
)
echo Installing FreeType into %~dp0work/%aPlatformAndCompiler%...
mingw32-make install 2>> %aLogFile%
set ENDTIME=%TIME%
rem handle time before 10AM (win10 - remove empty space at the beginning)
if "%STARTTIME:~0,1%"==" " set "STARTTIME=%STARTTIME:~1%"
if "%ENDTIME:~0,1%"==" " set "ENDTIME=%ENDTIME:~1%"
rem handle time before 10AM (win7 - add 0 at the beginning)
if "%STARTTIME:~1,1%"==":" set "STARTTIME=0%STARTTIME%"
if "%ENDTIME:~1,1%"==":" set "ENDTIME=0%ENDTIME%"
rem convert hours:minutes:seconds:ms into duration
set /A STARTTIME=(1%STARTTIME:~0,2%-100)*360000 + (1%STARTTIME:~3,2%-100)*6000 + (1%STARTTIME:~6,2%-100)*100 + (1%STARTTIME:~9,2%-100)
set /A ENDTIME= (1%ENDTIME:~0,2%-100)*360000 + (1%ENDTIME:~3,2%-100)*6000 + (1%ENDTIME:~6,2%-100)*100 + (1%ENDTIME:~9,2%-100)
set /A DURATION=%ENDTIME%-%STARTTIME%
if %ENDTIME% LSS %STARTTIME% set set /A DURATION=%STARTTIME%-%ENDTIME%
set /A DURATIONH=%DURATION% / 360000
set /A DURATIONM=(%DURATION% - %DURATIONH%*360000) / 6000
set /A DURATIONS=(%DURATION% - %DURATIONH%*360000 - %DURATIONM%*6000) / 100
if %DURATIONH% LSS 10 set DURATIONH=0%DURATIONH%
if %DURATIONM% LSS 10 set DURATIONM=0%DURATIONM%
if %DURATIONS% LSS 10 set DURATIONS=0%DURATIONS%
echo Building time: %DURATIONH%:%DURATIONM%:%DURATIONS% for %anAbi%
echo Building time: %DURATIONH%:%DURATIONM%:%DURATIONS% >> %aLogFile%
popd
goto :eof

View File

@@ -0,0 +1,103 @@
#!/bin/bash
# Auxiliary script for building FreeType library for iOS platform.
aScriptDir=${BASH_SOURCE%/*}
if [ -d "$aScriptDir" ]; then cd "$aScriptDir"; fi
aScriptDir="$PWD"
aFreeType=freetype-2.10.4
aFreeTypeSrc=${aScriptDir}/${aFreeType}-src
PATH=/Applications/CMake.app/Contents/bin:$PATH
PLATFORMPATH="/Applications/Xcode.app/Contents/Developer/Platforms"
export IPHONEOS_DEPLOYMENT_TARGET=8.0
rm -r -f ${aFreeType}-ios
mkdir -p ${aFreeType}-ios/lib
rm -r -f ${aFreeType}-iPhoneSimulator
mkdir -p ${aFreeType}-iPhoneSimulator/lib
function buildArchCmake {
anAbi=$1
aPlatformSdk=$2
aSysRoot=$PLATFORMPATH/${aPlatformSdk}.platform/Developer/SDKs/${aPlatformSdk}.sdk
aPlatformAndCompiler=${aPlatformSdk}-${anAbi}-clang
aWorkDir="${aScriptDir}/${aFreeType}-${aPlatformAndCompiler}-make"
aDestDir="${aScriptDir}/${aFreeType}-${aPlatformAndCompiler}"
aLogFile="${aScriptDir}/${aFreeType}-build-${aPlatformAndCompiler}.log"
rm -r -f "$aWorkDir"
rm -r -f "$aDestDir"
mkdir -p "$aWorkDir"
mkdir -p "$aDestDir"
rm -f "$aLogFile"
pushd ${aWorkDir}
cmake -G "Unix Makefiles" \
-D CMAKE_SYSTEM_NAME="iOS" \
-D CMAKE_OSX_ARCHITECTURES:STRING="$anAbi" \
-D CMAKE_OSX_DEPLOYMENT_TARGET:STRING="$IPHONEOS_DEPLOYMENT_TARGET" \
-D CMAKE_OSX_SYSROOT:PATH="$aSysRoot" \
-D CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS:BOOL="OFF" \
-D CMAKE_BUILD_TYPE:STRING="Release" \
-D CMAKE_INSTALL_PREFIX:PATH="$aDestDir" \
-D BUILD_SHARED_LIBS:BOOL="OFF" \
-D FT_WITH_ZLIB:BOOL="OFF" \
-D FT_WITH_BZIP2:BOOL="OFF" \
-D FT_WITH_PNG:BOOL="OFF" \
-D FT_WITH_HARFBUZZ:BOOL="OFF" \
-D FT_WITH_BROTLI:BOOL="OFF" \
"$aFreeTypeSrc" 2>&1 | tee -a "$aLogFile"
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
make clean
echo Building...
make 2>&1 | tee -a "$aLogFile"
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
make install
echo Installing into $aDestDir...
make install 2>&1 | tee -a "$aLogFile"
popd
}
buildArchCmake arm64 iPhoneOS
buildArchCmake arm64 iPhoneSimulator
buildArchCmake x86_64 iPhoneSimulator
aTargName=ios
cp -rf ./${aFreeType}-src/include ${aFreeType}-${aTargName}/
cp ./${aFreeType}-src/docs/FTL.TXT ${aFreeType}-${aTargName}/
cp ./${aFreeType}-src/docs/GPLv2.TXT ${aFreeType}-${aTargName}/
cp ./${aFreeType}-src/docs/LICENSE.TXT ${aFreeType}-${aTargName}/
cp ./${aFreeType}-src/docs/CHANGES ${aFreeType}-${aTargName}/
cp ./${aFreeType}-src/docs/README ${aFreeType}-${aTargName}/
lipo -create -output ${aFreeType}-${aTargName}/lib/libfreetype.a ${aFreeType}-iPhoneOS-arm64-clang/lib/libfreetype.a
lipo -info ${aFreeType}-${aTargName}/lib/libfreetype.a
anArchName=${aFreeType}-${aTargName}.tar.bz2
rm ${aDestDir}/../${anArchName} &>/dev/null
pushd "./${aFreeType}-${aTargName}"
tar -jcf ${aScriptDir}/${anArchName} *
popd
aTargName=iPhoneSimulator
cp -rf ./${aFreeType}-src/include ${aFreeType}-${aTargName}/
cp ./${aFreeType}-src/docs/FTL.TXT ${aFreeType}-${aTargName}/
cp ./${aFreeType}-src/docs/GPLv2.TXT ${aFreeType}-${aTargName}/
cp ./${aFreeType}-src/docs/LICENSE.TXT ${aFreeType}-${aTargName}/
cp ./${aFreeType}-src/docs/CHANGES ${aFreeType}-${aTargName}/
cp ./${aFreeType}-src/docs/README ${aFreeType}-${aTargName}/
lipo -create -output ${aFreeType}-${aTargName}/lib/libfreetype.a ${aFreeType}-iPhoneSimulator-arm64-clang/lib/libfreetype.a ${aFreeType}-iPhoneSimulator-x86_64-clang/lib/libfreetype.a
lipo -info ${aFreeType}-${aTargName}/lib/libfreetype.a
anArchName=${aFreeType}-${aTargName}.tar.bz2
rm ${aDestDir}/../${anArchName} &>/dev/null
pushd "./${aFreeType}-${aTargName}"
tar -jcf ${aScriptDir}/${anArchName} *
popd

View File

@@ -0,0 +1,50 @@
#!/bin/bash
aFreeType=freetype-2.10.4
export MACOSX_DEPLOYMENT_TARGET=10.10
rm -r -f ${aFreeType}-macos
mkdir -p ${aFreeType}-macos/lib
function buildArch {
anArch=$1
pushd ./${aFreeType}-src
./configure CFLAGS="-mmacosx-version-min=10.10 -arch $anArch" LDFLAGS="-Wl,-install_name,@executable_path/../Frameworks/libfreetype.6.dylib" --enable-shared --enable-static
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
make clean
make
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
rm -r -f ../${aFreeType}-macos-$anArch
mkdir -p ../${aFreeType}-macos-$anArch/lib
cp -rf ./include ../${aFreeType}-macos-$anArch/
cp ./docs/FTL.TXT ../${aFreeType}-macos-$anArch/
cp ./docs/GPLv2.TXT ../${aFreeType}-macos-$anArch/
cp ./docs/LICENSE.TXT ../${aFreeType}-macos-$anArch/
cp ./docs/CHANGES ../${aFreeType}-macos-$anArch/
cp ./docs/README ../${aFreeType}-macos-$anArch/
cp ./objs/.libs/libfreetype.a ../${aFreeType}-macos-$anArch/lib/
cp ./objs/.libs/libfreetype.6.dylib ../${aFreeType}-macos-$anArch/lib/
cp ./objs/.libs/libfreetype.la ../${aFreeType}-macos-$anArch/lib/
#cp ./objs/.libs/libfreetype.dylib ../${aFreeType}-macos-$anArch/lib/
ln -s libfreetype.6.dylib ../${aFreeType}-macos-$anArch/lib/libfreetype.dylib
popd
}
for anArchIter in x86_64 arm64
do
buildArch $anArchIter
done
cp -rf ./${aFreeType}-src/include ${aFreeType}-macos/
cp ./${aFreeType}-src/docs/FTL.TXT ${aFreeType}-macos/
cp ./${aFreeType}-src/docs/GPLv2.TXT ${aFreeType}-macos/
cp ./${aFreeType}-src/docs/LICENSE.TXT ${aFreeType}-macos/
cp ./${aFreeType}-src/docs/CHANGES ${aFreeType}-macos/
cp ./${aFreeType}-src/docs/README ${aFreeType}-macos/
lipo -create -output ${aFreeType}-macos/lib/libfreetype.a ${aFreeType}-macos-x86_64/lib/libfreetype.a ${aFreeType}-macos-arm64/lib/libfreetype.a
lipo -create -output ${aFreeType}-macos/lib/libfreetype.6.dylib ${aFreeType}-macos-x86_64/lib/libfreetype.6.dylib ${aFreeType}-macos-arm64/lib/libfreetype.6.dylib
ln -s libfreetype.6.dylib ${aFreeType}-macos/lib/libfreetype.dylib
lipo -info ${aFreeType}-macos/lib/libfreetype.a
lipo -info ${aFreeType}-macos/lib/libfreetype.6.dylib

View File

@@ -20,13 +20,13 @@ export aRapidJson=
export aDraco=
# build stages to perform
export toSimulator=0
export isStatic=1
export toCMake=1
export toClean=1
export toMake=1
export toInstall=1
export toPack=0
export toPackFat=0
export toDebug=0
export BUILD_ModelingData=ON
@@ -41,25 +41,13 @@ export USE_RAPIDJSON=OFF
export USE_DRACO=OFF
export IPHONEOS_DEPLOYMENT_TARGET=8.0
#export anAbiList="iPhoneOS|arm64 iPhoneSimulator|arm64 iPhoneSimulator|x86_64"
export anAbiList="iPhoneOS|arm64"
export anAbi=arm64
#export anAbi=x86_64
if [[ -f "${aScriptDir}/ios_custom.sh" ]]; then
source "${aScriptDir}/ios_custom.sh"
fi
anOcctVerSuffix=`grep -e "#define OCC_VERSION_DEVELOPMENT" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
anOcctVersion=`grep -e "#define OCC_VERSION_COMPLETE" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
aGitBranch=`git symbolic-ref --short HEAD`
YEAR=$(date +"%Y")
MONTH=$(date +"%m")
DAY=$(date +"%d")
aRevision=-${YEAR}-${MONTH}-${DAY}
#aRevision=-${aGitBranch}
set -o pipefail
aBuildType="Release"
aBuildTypePrefix=
if [[ $toDebug == 1 ]]; then
@@ -70,52 +58,59 @@ aLibType="Shared"
if [[ $isStatic == 1 ]]; then
aLibType="Static"
fi
aPlatformAndCompiler=ios-${anAbi}${aBuildTypePrefix}-clang
aPlatformSdk="iphoneos"
aSysRoot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk"
if [[ $toSimulator == 1 ]]; then
#anAbi=x86_64
aPlatformAndCompiler=ios-simulator64-${anAbi}${aBuildTypePrefix}-clang
aPlatformSdk="iphonesimulator"
aSysRoot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"
fi
function buildArch {
anAbi=$1
aPlatformSdk=$2
aWorkDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}-make"
aDestDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}"
aLogFile="${aCasSrc}/${aBuildRoot}/build-${aPlatformAndCompiler}.log"
aPlatformAndCompiler=${aPlatformSdk}-${anAbi}${aBuildTypePrefix}-clang
if [[ $toCMake == 1 ]] && [[ $toClean == 1 ]]; then
rm -r -f "$aWorkDir"
rm -r -f "$aDestDir"
fi
mkdir -p "$aWorkDir"
mkdir -p "$aDestDir"
rm -f "$aLogFile"
aWorkDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}-make"
aDestDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}"
aLogFile="${aCasSrc}/${aBuildRoot}/build-${aPlatformAndCompiler}.log"
anOcctVerSuffix=`grep -e "#define OCC_VERSION_DEVELOPMENT" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
anOcctVersion=`grep -e "#define OCC_VERSION_COMPLETE" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
aGitBranch=`git symbolic-ref --short HEAD`
if [[ $toCMake == 1 ]] && [[ $toClean == 1 ]]; then
rm -r -f "$aWorkDir"
rm -r -f "$aDestDir"
# include some information about OCCT into archive
echo \<pre\>> "${aWorkDir}/VERSION.html"
git status >> "${aWorkDir}/VERSION.html"
git log -n 100 >> "${aWorkDir}/VERSION.html"
echo \</pre\>>> "${aWorkDir}/VERSION.html"
pushd "$aWorkDir"
aTimeZERO=$SECONDS
set -o pipefail
function logDuration {
if [[ $1 == 1 ]]; then
aDur=$(($4 - $3))
echo $2 time: $aDur sec>> "$aLogFile"
fi
mkdir -p "$aWorkDir"
mkdir -p "$aDestDir"
rm -f "$aLogFile"
}
# include some information about OCCT into archive
echo \<pre\>> "${aWorkDir}/VERSION.html"
git status >> "${aWorkDir}/VERSION.html"
git log -n 100 >> "${aWorkDir}/VERSION.html"
echo \</pre\>>> "${aWorkDir}/VERSION.html"
pushd "$aWorkDir"
aTimeZERO=$SECONDS
function logDuration {
if [[ $1 == 1 ]]; then
aDur=$(($4 - $3))
echo $2 time: $aDur sec>> "$aLogFile"
fi
}
aSysRoot="/Applications/Xcode.app/Contents/Developer/Platforms/${aPlatformSdk}.platform/Developer/SDKs/${aPlatformSdk}.sdk"
# (re)generate Make files
if [[ $toCMake == 1 ]]; then
echo Configuring OCCT for iOS...
cmake -G "Unix Makefiles" \
# (re)generate Make files
if [[ $toCMake == 1 ]]; then
echo Configuring OCCT for iOS...
cmake -G "Unix Makefiles" \
-D CMAKE_SYSTEM_NAME="iOS" \
-D CMAKE_OSX_ARCHITECTURES:STRING="$anAbi" \
-D CMAKE_OSX_DEPLOYMENT_TARGET:STRING="$IPHONEOS_DEPLOYMENT_TARGET" \
-D CMAKE_OSX_SYSROOT:PATH="$aSysRoot" \
-D ENABLE_VISIBILITY:BOOL="TRUE" \
-D CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS:BOOL="OFF" \
-D CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS:BOOL="OFF" \
-D CMAKE_BUILD_TYPE:STRING="$aBuildType" \
@@ -150,118 +145,57 @@ function buildArch {
-D BUILD_MODULE_DataExchange:BOOL="${BUILD_DataExchange}" \
-D BUILD_MODULE_Draw:BOOL="OFF" \
-D BUILD_DOC_Overview:BOOL="OFF" \
"$aCasSrc" 2>&1 | tee -a "$aLogFile"
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
fi
aTimeGEN=$SECONDS
logDuration $toCMake "Generation" $aTimeZERO $aTimeGEN
# clean up from previous build
if [[ $toClean == 1 ]]; then
make clean
fi
# build the project
if [[ $toMake == 1 ]]; then
echo Building...
make -j $aNbJobs 2>&1 | tee -a "$aLogFile"
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
fi
aTimeBUILD=$SECONDS
logDuration $toMake "Building" $aTimeGEN $aTimeBUILD
logDuration $toMake "Total building" $aTimeZERO $aTimeBUILD
# install the project
if [[ $toInstall == 1 ]]; then
echo Installing OCCT into $aDestDir...
make install 2>&1 | tee -a "$aLogFile"
cp -f "$aWorkDir/VERSION.html" "$aDestDir/VERSION.html"
echo Platform: ${aPlatformSdk} ABI: ${anAbi} Build: ${aBuildType} IPHONEOS_DEPLOYMENT_TARGET: ${IPHONEOS_DEPLOYMENT_TARGET} > "$aDestDir/build_target.txt"
fi
aTimeINSTALL=$SECONDS
logDuration $toInstall "Install" $aTimeBUILD $aTimeINSTALL
# create an archive
if [[ $toPack == 1 ]]; then
anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aPlatformAndCompiler}.tar.bz2
echo Creating an archive ${aCasSrc}/${aBuildRoot}/${anArchName}...
rm ${aDestDir}/../${anArchName} &>/dev/null
pushd "$aDestDir"
tar -jcf ${aDestDir}/../${anArchName} *
popd
fi
aTimePACK=$SECONDS
logDuration $toPack "Packing archive" $aTimeINSTALL $aTimePACK
# finished
DURATION=$(($aTimePACK - $aTimeZERO))
echo Total time: $DURATION sec
logDuration 1 "Total" $aTimeZERO $aTimePACK
popd
}
for anArchIter in $anAbiList
do
IFS="|" read -r aPlatform anArch <<< "$anArchIter"
echo Platform: ${aPlatform} ABI: ${anArch} Build: ${aBuildType}
buildArch $anArch $aPlatform
done
# create a FAT archive
if [[ $toPackFat == 1 ]]; then
for aPlatIter in iPhoneOS iPhoneSimulator
do
aSuffixFat=${aPlatIter}${aBuildTypePrefix}-clang
aFatDir="${aCasSrc}/${aBuildRoot}/${aSuffixFat}"
# merge per-arch builds into fat builds
hasPlatform=0
for anArchIter in $anAbiList
do
IFS="|" read -r aPlatform anArch <<< "$anArchIter"
if [[ $aPlatIter != ${aPlatform} ]]; then
continue
fi
aSuffixThin=${aPlatform}-${anArch}${aBuildTypePrefix}-clang
anArchDir="${aCasSrc}/${aBuildRoot}/${aSuffixThin}"
if [[ $hasPlatform == 0 ]]; then
hasPlatform=1
echo Packing FAT archive for platform: ${aPlatform}
rm -r -f "$aFatDir"
mkdir -p "$aFatDir"
rsync -r --exclude '*.a' "$anArchDir/" "$aFatDir"
rm -f "$aFatDir/build_target.txt"
for aLibIter in $anArchDir/lib/*.a; do
aLibName=`basename $aLibIter`
lipo "$anArchDir/lib/$aLibName" -output "$aFatDir/lib/$aLibName" -create
done
else
for aLibIter in $aFatDir/lib/*.a; do
aLibName=`basename $aLibIter`
lipo "$aFatDir/lib/$aLibName" "$anArchDir/lib/$aLibName" -output "$aFatDir/lib/$aLibName" -create
#lipo -info "$aFatDir/lib/$aLibName"
done
fi
cat "$anArchDir/build_target.txt" >> "$aFatDir/build_target.txt"
done
# create an archive
for anArchIter in $anAbiList
do
IFS="|" read -r aPlatform anArch <<< "$anArchIter"
if [[ $aPlatIter != ${aPlatform} ]]; then
continue
fi
anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aSuffixFat}.tar.bz2
echo Creating an archive ${aCasSrc}/${aBuildRoot}/${anArchName}...
rm ${aFatDir}/../${anArchName} &>/dev/null
pushd "$aFatDir"
tar -jcf ${aFatDir}/../${anArchName} *
popd
break
done
done
"$aCasSrc" 2>&1 | tee -a "$aLogFile"
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
fi
aTimeGEN=$SECONDS
logDuration $toCMake "Generation" $aTimeZERO $aTimeGEN
# clean up from previous build
if [[ $toClean == 1 ]]; then
make clean
fi
# build the project
if [[ $toMake == 1 ]]; then
echo Building...
make -j $aNbJobs 2>&1 | tee -a "$aLogFile"
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
fi
aTimeBUILD=$SECONDS
logDuration $toMake "Building" $aTimeGEN $aTimeBUILD
logDuration $toMake "Total building" $aTimeZERO $aTimeBUILD
# install the project
if [[ $toInstall == 1 ]]; then
echo Installing OCCT into $aDestDir...
make install 2>&1 | tee -a "$aLogFile"
cp -f "$aWorkDir/VERSION.html" "$aDestDir/VERSION.html"
fi
aTimeINSTALL=$SECONDS
logDuration $toInstall "Install" $aTimeBUILD $aTimeINSTALL
# create an archive
if [[ $toPack == 1 ]]; then
YEAR=$(date +"%Y")
MONTH=$(date +"%m")
DAY=$(date +"%d")
aRevision=-${YEAR}-${MONTH}-${DAY}
#aRevision=-${aGitBranch}
anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aPlatformAndCompiler}.tar.bz2
echo Creating an archive ${aCasSrc}/${aBuildRoot}/${anArchName}...
rm ${aDestDir}/../${anArchName} &>/dev/null
pushd "$aDestDir"
tar -jcf ${aDestDir}/../${anArchName} *
popd
fi
aTimePACK=$SECONDS
logDuration $toPack "Packing archive" $aTimeINSTALL $aTimePACK
# finished
DURATION=$(($aTimePACK - $aTimeZERO))
echo Total time: $DURATION sec
logDuration 1 "Total" $aTimeZERO $aTimePACK
popd

View File

@@ -1,4 +1,4 @@
# environment configuration template for ios_build.sh (to be renamed as ios_custom_env.sh)
# environment configuration template for macos_build.sh (to be renamed as macos_custom_env.sh)
export PATH=/Applications/CMake.app/Contents/bin:$PATH
export aFreeType="$aSrcRoot/../3rdparty/freetype-2.10.4-ios"
export aFreeImage="$aSrcRoot/../3rdparty/freeimage-3.18-ios"
@@ -6,13 +6,13 @@ export aRapidJson="$aSrcRoot/../3rdparty/rapidjson-1.1.0"
export aDraco="$aSrcRoot/../3rdparty/draco-1.4.1-ios"
# Uncomment to customize building steps
#export toSimulator=0
#export isStatic=0
#export toCMake=1
#export toClean=1
#export toMake=1
#export toInstall=1
#export toPack=0
#export toPackFat=1
#export toDebug=0
#export BUILD_ModelingData=ON
@@ -26,5 +26,5 @@ export aDraco="$aSrcRoot/../3rdparty/draco-1.4.1-ios"
#export USE_FREEIMAGE=ON
#export IPHONEOS_DEPLOYMENT_TARGET=8.0
#export anAbiList="iPhoneOS|arm64 iPhoneSimulator|arm64 iPhoneSimulator|x86_64"
#export anAbiList="iPhoneOS|arm64"
#export anAbi=arm64
#export anAbi=x86_64

View File

@@ -0,0 +1,105 @@
#!/bin/bash
# This is helpful script to perform building of liblzma for Android platform
# http://tukaani.org/xz/
anNdkRoot=/home/develop/android/android-ndk-r12b
anNdkArm32=/home/develop/android/android15-armv7a
anNdkArm64=/home/develop/android/android21-aarch64
anNdkx86=/home/develop/android/android15-x86
anNdkx86_64=/home/develop/android/android21-x86_64
#$anNdkRoot/build/tools/make-standalone-toolchain.sh --platform=android-15 --install-dir=$anNdkArm32 --ndk-dir=$anNdkRoot --toolchain=arm-linux-androideabi-4.9
#$anNdkRoot/build/tools/make-standalone-toolchain.sh --platform=android-21 --install-dir=$anNdkArm64 --ndk-dir=$anNdkRoot --toolchain=aarch64-linux-android-4.9
#$anNdkRoot/build/tools/make-standalone-toolchain.sh --platform=android-15 --install-dir=$anNdkx86 --ndk-dir=$anNdkRoot --toolchain=x86-4.9
#$anNdkRoot/build/tools/make-standalone-toolchain.sh --platform=android-21 --install-dir=$anNdkx86_64 --ndk-dir=$anNdkRoot --toolchain=x86_64-4.9
# go to the script directory
aScriptPath=${BASH_SOURCE%/*}
if [ -d "$aScriptPath" ]; then
cd "$aScriptPath"
fi
# define number of jobs from available CPU cores
aNbJobs="$(getconf _NPROCESSORS_ONLN)"
set -o pipefail
aPathBak="$PATH"
anXzRoot="$PWD"
aCFlagsArmv7a="-O2 -march=armv7-a -mfloat-abi=softfp"
aCFlagsArmv8a="-O2 -march=armv8-a"
aCFlagsx86="-O2 -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32"
aCFlagsx86_64="-O2 -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel"
OUTPUT_FOLDER="$anXzRoot/install/liblzma-android"
rm -f -r "$OUTPUT_FOLDER"
mkdir -p "$OUTPUT_FOLDER/include"
mkdir -p "$OUTPUT_FOLDER/libs/armeabi-v7a"
mkdir -p "$OUTPUT_FOLDER/libs/x86"
mkdir -p "$OUTPUT_FOLDER/libs/arm64-v8a"
mkdir -p "$OUTPUT_FOLDER/libs/x86_64"
cp -f "$anXzRoot/COPYING" "$OUTPUT_FOLDER"
cp -f "$anXzRoot/README" "$OUTPUT_FOLDER"
cp -f "$anXzRoot/src/liblzma/api/lzma.h" "$OUTPUT_FOLDER/include"
cp -f -r "$anXzRoot/src/liblzma/api/lzma" "$OUTPUT_FOLDER/include"
echo "Output directory: $OUTPUT_FOLDER"
# armv7a
export "PATH=$anNdkArm32/bin:$aPathBak"
export "CC=arm-linux-androideabi-gcc"
export "CXX=arm-linux-androideabi-g++"
export "CFLAGS=$aCFlagsArmv7a"
export "CXXFLAGS=$aCFlagsArmv7a"
./configure --host arm-linux-androideabi 2>&1 | tee $OUTPUT_FOLDER/config-armv7a.log
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
make clean
make -j$aNbJobs
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
cp -f "$anXzRoot/src/liblzma/.libs/liblzma.so" "$OUTPUT_FOLDER/libs/armeabi-v7a"
cp -f "$anXzRoot/src/liblzma/.libs/liblzma.a" "$OUTPUT_FOLDER/libs/armeabi-v7a"
# x86
export "PATH=$anNdkx86/bin:$aPathBak"
export "CC=i686-linux-android-gcc"
export "CXX=i686-linux-android-g++"
export "CFLAGS=$aCFlagsx86"
export "CXXFLAGS=$aCFlagsx86"
./configure --host i686-linux-android 2>&1 | tee $OUTPUT_FOLDER/config-x86.log
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
make clean
make -j$aNbJobs
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
cp -f "$anXzRoot/src/liblzma/.libs/liblzma.so" "$OUTPUT_FOLDER/libs/x86"
cp -f "$anXzRoot/src/liblzma/.libs/liblzma.a" "$OUTPUT_FOLDER/libs/x86"
# armv8a
export "PATH=$anNdkArm64/bin:$aPathBak"
export "CC=aarch64-linux-android-gcc"
export "CXX=aarch64-linux-android-g++"
export "CFLAGS=$aCFlagsArmv8a"
export "CXXFLAGS=$aCFlagsArmv8a"
./configure --host aarch64-linux-android 2>&1 | tee $OUTPUT_FOLDER/config-aarch64.log
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
make clean
make -j$aNbJobs
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
cp -f "$anXzRoot/src/liblzma/.libs/liblzma.so" "$OUTPUT_FOLDER/libs/arm64-v8a"
cp -f "$anXzRoot/src/liblzma/.libs/liblzma.a" "$OUTPUT_FOLDER/libs/arm64-v8a"
# x86_64
export "PATH=$anNdkx86_64/bin:$aPathBak"
export "CC=x86_64-linux-android-gcc"
export "CXX=x86_64-linux-android-g++"
export "CFLAGS=$aCFlagsx86_64"
export "CXXFLAGS=$aCFlagsx86_64"
./configure --host x86_64-linux-android 2>&1 | tee $OUTPUT_FOLDER/config-x86_64.log
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
make clean
make -j$aNbJobs
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
cp -f "$anXzRoot/src/liblzma/.libs/liblzma.so" "$OUTPUT_FOLDER/libs/x86_64"
cp -f "$anXzRoot/src/liblzma/.libs/liblzma.a" "$OUTPUT_FOLDER/libs/x86_64"
export "PATH=$aPathBak"
rm $OUTPUT_FOLDER/../liblzma-android.7z &>/dev/null
7za a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on $OUTPUT_FOLDER/../liblzma-android.7z $OUTPUT_FOLDER

View File

@@ -0,0 +1,51 @@
#!/bin/bash
# This is helpful script to perform building of liblzma for macOS platform
# http://tukaani.org/xz/
# go to the script directory
aScriptPath=${BASH_SOURCE%/*}
if [ -d "$aScriptPath" ]; then
cd "$aScriptPath"
fi
# define number of jobs from available CPU cores
aNbJobs="$(getconf _NPROCESSORS_ONLN)"
set -o pipefail
anXzRoot="$PWD"
export MACOSX_DEPLOYMENT_TARGET=10.10
OUTPUT_FOLDER="$anXzRoot/work/liblzma-macos"
rm -f -r "$OUTPUT_FOLDER"
mkdir -p "$OUTPUT_FOLDER/include"
mkdir -p "$OUTPUT_FOLDER/lib"
cp -f "$anXzRoot/COPYING" "$OUTPUT_FOLDER"
cp -f "$anXzRoot/README" "$OUTPUT_FOLDER"
cp -f "$anXzRoot/src/liblzma/api/lzma.h" "$OUTPUT_FOLDER/include"
cp -f -r "$anXzRoot/src/liblzma/api/lzma" "$OUTPUT_FOLDER/include"
echo "Output directory: $OUTPUT_FOLDER"
# x86_64
./configure CFLAGS="-O2 -arch x86_64" CXXFLAGS="-O2 -arch x86_64" 2>&1 | tee $OUTPUT_FOLDER/config-x86_64.log
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
make clean
make -j$aNbJobs
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
#cp -f "$anXzRoot/src/liblzma/.libs/liblzma.so" "$OUTPUT_FOLDER/libs/x86"
cp -f "$anXzRoot/src/liblzma/.libs/liblzma.a" "$OUTPUT_FOLDER/lib/liblzma-x86_64.a"
# armv8a
./configure CFLAGS="-O2 -arch arm64" CXXFLAGS="-O2 -arch arm64" 2>&1 | tee $OUTPUT_FOLDER/config-arm64.log
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
make clean
make -j$aNbJobs
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
#cp -f "$anXzRoot/src/liblzma/.libs/liblzma.so" "$OUTPUT_FOLDER/libs/arm64-v8a"
cp -f "$anXzRoot/src/liblzma/.libs/liblzma.a" "$OUTPUT_FOLDER/lib/liblzma-arm64.a"
lipo -create -output "$OUTPUT_FOLDER/lib/liblzma.a" "$OUTPUT_FOLDER/lib/liblzma-x86_64.a" "$OUTPUT_FOLDER/lib/liblzma-arm64.a"
lipo -info "$OUTPUT_FOLDER/lib/liblzma.a"
#rm $OUTPUT_FOLDER/../liblzma-macos.7z &>/dev/null
#7za a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on $OUTPUT_FOLDER/../liblzma-macos.7z $OUTPUT_FOLDER

View File

@@ -20,13 +20,11 @@ export aRapidJson=
export aDraco=
# build stages to perform
export isStatic=0
export toCMake=1
export toClean=1
export toMake=1
export toInstall=1
export toPack=0
export toPackFat=0
export toDebug=0
export BUILD_ModelingData=ON
@@ -36,92 +34,72 @@ export BUILD_ApplicationFramework=ON
export BUILD_DataExchange=ON
export BUILD_Draw=ON
export USE_FREETYPE=ON
export USE_FREEIMAGE=ON
export USE_RAPIDJSON=OFF
export USE_DRACO=OFF
export MACOSX_DEPLOYMENT_TARGET=10.10
#export anAbiList="arm64 x86_64"
export anAbiList="x86_64"
aPlatform="macos"
#export anAbi=arm64
export anAbi=x86_64
if [[ -f "${aScriptDir}/macos_custom.sh" ]]; then
source "${aScriptDir}/macos_custom.sh"
fi
anOcctVerSuffix=`grep -e "#define OCC_VERSION_DEVELOPMENT" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
anOcctVersion=`grep -e "#define OCC_VERSION_COMPLETE" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
aGitBranch=`git symbolic-ref --short HEAD`
YEAR=$(date +"%Y")
MONTH=$(date +"%m")
DAY=$(date +"%d")
aRevision=-${YEAR}-${MONTH}-${DAY}
#aRevision=-${aGitBranch}
set -o pipefail
aBuildType="Release"
aBuildTypePrefix=
if [[ $toDebug == 1 ]]; then
aBuildType="Debug"
aBuildTypePrefix="-debug"
fi
aLibType="Shared"
aLibExt="dylib"
if [[ $isStatic == 1 ]]; then
aLibType="Static"
aLibExt="a"
aPlatformAndCompiler=mac-${anAbi}${aBuildTypePrefix}-clang
aWorkDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}-make"
aDestDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}"
aLogFile="${aCasSrc}/${aBuildRoot}/build-${aPlatformAndCompiler}.log"
if [[ $toCMake == 1 ]] && [[ $toClean == 1 ]]; then
rm -r -f "$aWorkDir"
rm -r -f "$aDestDir"
fi
mkdir -p "$aWorkDir"
mkdir -p "$aDestDir"
rm -f "$aLogFile"
function buildArch {
anAbi=$1
anOcctVerSuffix=`grep -e "#define OCC_VERSION_DEVELOPMENT" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
anOcctVersion=`grep -e "#define OCC_VERSION_COMPLETE" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
aGitBranch=`git symbolic-ref --short HEAD`
aPlatformAndCompiler=${aPlatform}-${anAbi}${aBuildTypePrefix}-clang
# include some information about OCCT into archive
echo \<pre\>> "${aWorkDir}/VERSION.html"
git status >> "${aWorkDir}/VERSION.html"
git log -n 100 >> "${aWorkDir}/VERSION.html"
echo \</pre\>>> "${aWorkDir}/VERSION.html"
aWorkDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}-make"
aDestDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}"
aLogFile="${aCasSrc}/${aBuildRoot}/build-${aPlatformAndCompiler}.log"
pushd "$aWorkDir"
if [[ $toCMake == 1 ]] && [[ $toClean == 1 ]]; then
rm -r -f "$aWorkDir"
rm -r -f "$aDestDir"
aTimeZERO=$SECONDS
set -o pipefail
function logDuration {
if [[ $1 == 1 ]]; then
aDur=$(($4 - $3))
echo $2 time: $aDur sec>> "$aLogFile"
fi
mkdir -p "$aWorkDir"
mkdir -p "$aDestDir"
rm -f "$aLogFile"
}
# include some information about OCCT into archive
echo \<pre\>> "${aWorkDir}/VERSION.html"
git status >> "${aWorkDir}/VERSION.html"
git log -n 100 >> "${aWorkDir}/VERSION.html"
echo \</pre\>>> "${aWorkDir}/VERSION.html"
pushd "$aWorkDir"
aTimeZERO=$SECONDS
function logDuration {
if [[ $1 == 1 ]]; then
aDur=$(($4 - $3))
echo $2 time: $aDur sec>> "$aLogFile"
fi
}
# (re)generate Make files
if [[ $toCMake == 1 ]]; then
echo Configuring OCCT for macOS...
cmake -G "Unix Makefiles" \
-D CMAKE_OSX_ARCHITECTURES:STRING="$anAbi" \
# (re)generate Make files
if [[ $toCMake == 1 ]]; then
echo Configuring OCCT for macOS...
cmake -G "Unix Makefiles" \
-D CMAKE_BUILD_TYPE:STRING="$aBuildType" \
-D BUILD_LIBRARY_TYPE:STRING="$aLibType" \
-D BUILD_LIBRARY_TYPE:STRING="Shared" \
-D CMAKE_OSX_ARCHITECTURES:STRING="$anAbi" \
-D INSTALL_DIR:PATH="$aDestDir" \
-D INSTALL_DIR_INCLUDE:STRING="inc" \
-D INSTALL_DIR_LIB:STRING="lib" \
-D INSTALL_DIR_RESOURCE:STRING="src" \
-D INSTALL_NAME_DIR:STRING="@executable_path/../Frameworks" \
-D USE_FREETYPE:BOOL="$USE_FREETYPE" \
-D 3RDPARTY_FREETYPE_DIR:PATH="$aFreeType" \
-D 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="$aFreeType/include" \
-D 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="$aFreeType/include" \
@@ -147,122 +125,57 @@ function buildArch {
-D BUILD_MODULE_DataExchange:BOOL="${BUILD_DataExchange}" \
-D BUILD_MODULE_Draw:BOOL="${BUILD_Draw}" \
-D BUILD_DOC_Overview:BOOL="OFF" \
"$aCasSrc" 2>&1 | tee -a "$aLogFile"
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
fi
aTimeGEN=$SECONDS
logDuration $toCMake "Generation" $aTimeZERO $aTimeGEN
"$aCasSrc" 2>&1 | tee -a "$aLogFile"
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
fi
aTimeGEN=$SECONDS
logDuration $toCMake "Generation" $aTimeZERO $aTimeGEN
# clean up from previous build
if [[ $toClean == 1 ]]; then
make clean
fi
# clean up from previous build
if [[ $toClean == 1 ]]; then
make clean
fi
# build the project
if [[ $toMake == 1 ]]; then
echo Building OCCT...
make -j $aNbJobs 2>&1 | tee -a "$aLogFile"
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
fi
aTimeBUILD=$SECONDS
logDuration $toMake "Building" $aTimeGEN $aTimeBUILD
logDuration $toMake "Total building" $aTimeZERO $aTimeBUILD
# build the project
if [[ $toMake == 1 ]]; then
echo Building OCCT...
make -j $aNbJobs 2>&1 | tee -a "$aLogFile"
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
fi
aTimeBUILD=$SECONDS
logDuration $toMake "Building" $aTimeGEN $aTimeBUILD
logDuration $toMake "Total building" $aTimeZERO $aTimeBUILD
# install the project
if [[ $toInstall == 1 ]]; then
echo Installing OCCT into $aDestDir...
make install 2>&1 | tee -a "$aLogFile"
cp -f "$aWorkDir/VERSION.html" "$aDestDir/VERSION.html"
echo Platform: macOS ABI: ${anAbi} Build: ${aBuildType} MACOSX_DEPLOYMENT_TARGET: ${MACOSX_DEPLOYMENT_TARGET} > "$aDestDir/build_target.txt"
fi
aTimeINSTALL=$SECONDS
logDuration $toInstall "Install" $aTimeBUILD $aTimeINSTALL
# install the project
if [[ $toInstall == 1 ]]; then
echo Installing OCCT into $aDestDir...
make install 2>&1 | tee -a "$aLogFile"
cp -f "$aWorkDir/VERSION.html" "$aDestDir/VERSION.html"
fi
aTimeINSTALL=$SECONDS
logDuration $toInstall "Install" $aTimeBUILD $aTimeINSTALL
# create an archive
if [[ $toPack == 1 ]]; then
anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aPlatformAndCompiler}.tar.bz2
echo Creating an archive ${aCasSrc}/${aBuildRoot}/${anArchName}...
rm ${aDestDir}/../${anArchName} &>/dev/null
pushd "$aDestDir"
tar -jcf ${aDestDir}/../${anArchName} *
popd
fi
aTimePACK=$SECONDS
logDuration $toPack "Packing archive" $aTimeINSTALL $aTimePACK
# create an archive
if [[ $toPack == 1 ]]; then
YEAR=$(date +"%Y")
MONTH=$(date +"%m")
DAY=$(date +"%d")
aRevision=-${YEAR}-${MONTH}-${DAY}
#aRevision=-${aGitBranch}
# finished
DURATION=$(($aTimePACK - $aTimeZERO))
echo Total time: $DURATION sec
logDuration 1 "Total" $aTimeZERO $aTimePACK
popd
}
for anArchIter in $anAbiList
do
echo Platform: macOS ABI: ${anArchIter} Build: ${aBuildType}
buildArch $anArchIter
done
# create a FAT archive
if [[ $toPackFat == 1 ]]; then
aSuffixFat=${aPlatform}${aBuildTypePrefix}-clang
aFatDir="${aCasSrc}/${aBuildRoot}/${aSuffixFat}"
# merge per-arch builds into fat builds
hasPlatform=0
for anArchIter in $anAbiList
do
aSuffixThin=${aPlatform}-${anArchIter}${aBuildTypePrefix}-clang
anArchDir="${aCasSrc}/${aBuildRoot}/${aSuffixThin}"
if [[ $hasPlatform == 0 ]]; then
hasPlatform=1
echo Packing FAT archive
rm -r -f "$aFatDir"
mkdir -p "$aFatDir"
if [[ $isStatic == 1 ]]; then
rsync -r -l --exclude '*.a' "$anArchDir/" "$aFatDir"
else
rsync -r -l --exclude '*.dylib' "$anArchDir/" "$aFatDir"
fi
rm -f "$aFatDir/build_target.txt"
if [[ -L "$anArchDir/bin/DRAWEXE" ]]; then
aDrawExe=$(readlink "$anArchDir/bin/DRAWEXE")
rm $aFatDir/bin/$aDrawExe
lipo "$anArchDir/bin/$aDrawExe" -output "$aFatDir/bin/$aDrawExe" -create
fi
for aLibIter in $anArchDir/lib/*.$aLibExt; do
aLibName=`basename $aLibIter`
if [[ -L "$anArchDir/lib/$aLibName" ]]; then
cp -a "$anArchDir/lib/$aLibName" "$aFatDir/lib/"
else
lipo "$anArchDir/lib/$aLibName" -output "$aFatDir/lib/$aLibName" -create
fi
done
else
if [[ -L "$anArchDir/bin/DRAWEXE" ]]; then
aDrawExe=$(readlink "$anArchDir/bin/DRAWEXE")
lipo "$aFatDir/bin/$aDrawExe" "$anArchDir/bin/$aDrawExe" -output "$aFatDir/bin/$aDrawExe" -create
fi
for aLibIter in $aFatDir/lib/*.$aLibExt; do
aLibName=`basename $aLibIter`
if [[ ! -L "$anArchDir/lib/$aLibName" ]]; then
lipo "$aFatDir/lib/$aLibName" "$anArchDir/lib/$aLibName" -output "$aFatDir/lib/$aLibName" -create
#lipo -info "$aFatDir/lib/$aLibName"
fi
done
fi
cat "$anArchDir/build_target.txt" >> "$aFatDir/build_target.txt"
done
# create an archive
anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aSuffixFat}.tar.bz2
anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aPlatformAndCompiler}.tar.bz2
echo Creating an archive ${aCasSrc}/${aBuildRoot}/${anArchName}...
rm ${aFatDir}/../${anArchName} &>/dev/null
pushd "$aFatDir"
tar -jcf ${aFatDir}/../${anArchName} *
rm ${aDestDir}/../${anArchName} &>/dev/null
pushd "$aDestDir"
tar -jcf ${aDestDir}/../${anArchName} *
popd
fi
aTimePACK=$SECONDS
logDuration $toPack "Packing archive" $aTimeINSTALL $aTimePACK
# finished
DURATION=$(($aTimePACK - $aTimeZERO))
echo Total time: $DURATION sec
logDuration 1 "Total" $aTimeZERO $aTimePACK
popd

View File

@@ -12,7 +12,6 @@ export aDraco="$aSrcRoot/../3rdparty/draco-1.4.1-macos"
#export toMake=1
#export toInstall=1
#export toPack=1
#export toPackFat=1
#export BUILD_ModelingData=ON
#export BUILD_ModelingAlgorithms=ON
@@ -26,6 +25,5 @@ export aDraco="$aSrcRoot/../3rdparty/draco-1.4.1-macos"
#export USE_FREEIMAGE=ON
#export MACOSX_DEPLOYMENT_TARGET=10.10
#export anAbiList=arm64
#export anAbiList=x86_64
#export anAbiList="arm64 x86_64"
#export anAbi=arm64
#export anAbi=x86_64

View File

@@ -0,0 +1,60 @@
#!/bin/bash
# This is helpful script to perform building of Tcl for Android platform
# https://www.tcl.tk/software/tcltk/download.html
#$HOME/develop/android-ndk-r12b/build/tools/make-standalone-toolchain.sh --platform=android-15 --install-dir=$HOME/develop/android15-armv7a --ndk-dir=$HOME/develop/android-ndk-r12b --toolchain=arm-linux-androideabi-4.9
#$HOME/develop/android-ndk-r12b/build/tools/make-standalone-toolchain.sh --platform=android-21 --install-dir=$HOME/develop/android21-aarch64 --ndk-dir=$HOME/develop/android-ndk-r12b --toolchain=aarch64-linux-android-4.9
#$HOME/develop/android-ndk-r12b/build/tools/make-standalone-toolchain.sh --platform=android-15 --install-dir=$HOME/develop/android15-x86 --ndk-dir=$HOME/develop/android-ndk-r12b --toolchain=x86-4.9
ANDROID_ROOT="/home/develop/android"
# go to the script directory
aScriptPath=${BASH_SOURCE%/*}
if [ -d "$aScriptPath" ]; then
cd "$aScriptPath"
fi
# define number of jobs from available CPU cores
aNbJobs="$(getconf _NPROCESSORS_ONLN)"
set -o pipefail
aPathBak="$PATH"
aTclRoot="$PWD"
OUTPUT_FOLDER="$aTclRoot/install/tcl-android"
rm -f -r "$OUTPUT_FOLDER"
mkdir -p "$OUTPUT_FOLDER"
cp -f "$aTclRoot/license.terms" "$OUTPUT_FOLDER"
cp -f "$aTclRoot/README.md" "$OUTPUT_FOLDER"
echo "Output directory: $OUTPUT_FOLDER"
set -o pipefail
function buildArch {
anAbi=$1
anArch=$2
aToolPath=$3
aCFlags=$4
export "PATH=$ANDROID_ROOT/$aToolPath/bin:$aPathBak"
export "CC=$anArch-gcc"
export "AR=$anArch-ar"
export "RANLIB=$anArch-ranlib"
export "CFLAGS=$aCFlags"
pushd "$aTclRoot/unix"
./configure --build x86_64-linux --host $anArch --prefix=${OUTPUT_FOLDER} --libdir=${OUTPUT_FOLDER}/libs/$anAbi --bindir=${OUTPUT_FOLDER}/bins/$anAbi 2>&1 | tee $OUTPUT_FOLDER/config-$anAbi.log
aResult=$?; if [[ $aResult != 0 ]]; then echo "FAILED configure $anAbi"; exit $aResult; fi
make clean
make -j$aNbJobs
aResult=$?; if [[ $aResult != 0 ]]; then echo "FAILED make $anAbi"; exit $aResult; fi
make install
popd
export "PATH=$aPathBak"
}
buildArch "arm64-v8a" "aarch64-linux-android" "android21-aarch64" "-O2 -march=armv8-a"
buildArch "armeabi-v7a" "arm-linux-androideabi" "android15-armv7a" "-O2 -march=armv7-a -mfloat-abi=softfp"
buildArch "x86" "i686-linux-android" "android15-x86" "-O2 -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32"
buildArch "x86_64" "x86_64-linux-android" "android21-x86_64" "-O2 -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel"
rm $OUTPUT_FOLDER/../tcl-android.7z &>/dev/null
7za a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on $OUTPUT_FOLDER/../tcl-android.7z $OUTPUT_FOLDER

View File

@@ -0,0 +1,46 @@
#!/bin/bash
# This is helpful script to perform building of Tcl for WebAssembly platform
# https://www.tcl.tk/software/tcltk/download.html
EMSDK_ROOT="/home/develop/wasm/emsdk"
# go to the script directory
aScriptPath=${BASH_SOURCE%/*}
if [ -d "$aScriptPath" ]; then
cd "$aScriptPath"
fi
# define number of jobs from available CPU cores
aNbJobs="$(getconf _NPROCESSORS_ONLN)"
set -o pipefail
aPathBak="$PATH"
aTclRoot="$PWD"
OUTPUT_FOLDER="$aTclRoot/install/tcl-wasm32"
rm -f -r "$OUTPUT_FOLDER"
mkdir -p "$OUTPUT_FOLDER"
cp -f "$aTclRoot/license.terms" "$OUTPUT_FOLDER"
cp -f "$aTclRoot/README.md" "$OUTPUT_FOLDER"
echo "Output directory: $OUTPUT_FOLDER"
. "${EMSDK_ROOT}/emsdk_env.sh"
#export "PATH=$EMSDK_ROOT/upstream/bin:$aPathBak"
#export "CC=emcc"
#export "AR=llvm-ar"
#export "RANLIB=llvm-ranlib"
#export "CFLAGS=$aCFlags"
pushd "$aTclRoot/unix"
#./configure --build x86_64-linux --host wasm32 --prefix=${OUTPUT_FOLDER} 2>&1 | tee $OUTPUT_FOLDER/config-wasm32.log
emconfigure ./configure --prefix=${OUTPUT_FOLDER} --enable-shared=no 2>&1 | tee $OUTPUT_FOLDER/config-wasm32.log
aResult=$?; if [[ $aResult != 0 ]]; then echo "FAILED configure"; exit $aResult; fi
emmake make clean
emmake make -j$aNbJobs
aResult=$?; if [[ $aResult != 0 ]]; then echo "FAILED make"; exit $aResult; fi
emmake make install
popd
export "PATH=$aPathBak"
rm $OUTPUT_FOLDER/../tcl-wasm32.7z &>/dev/null
7za a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on $OUTPUT_FOLDER/../tcl-wasm32.7z $OUTPUT_FOLDER

View File

@@ -23,8 +23,6 @@ if "%VCVER%" == "vc8" (
call "%VS141COMNTOOLS%/vsvars32.bat" > nul
) else if "%VCVER%" == "vc142" (
call "%VS142COMNTOOLS%/vsvars32.bat" > nul
) else if "%VCVER%" == "vc143" (
call "%VS143COMNTOOLS%/vsvars32.bat" > nul
) else (
echo Error: wrong VS identifier
exit /B

View File

@@ -74,10 +74,6 @@ if not "%DevEnvDir%" == "" (
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
set "DevEnvDir=%%i\Common7\IDE\"
)
) else if /I "%VCFMT%" == "vc143" (
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[17.0,17.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
set "DevEnvDir=%%i\Common7\IDE\"
)
) else if /I "%VCFMT%" == "gcc" (
rem MinGW
) else (
@@ -111,11 +107,6 @@ if /I "%VCFMT%" == "vc9" (
set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
)
set "VCPlatformToolSet=v142"
) else if /I "%VCFMT%" == "vc143" (
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[17.0,17.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
)
set "VCPlatformToolSet=v142"
) else if /I "%VCFMT%" == "gcc" (
rem MinGW
) else (
@@ -135,7 +126,6 @@ if ["%ARCH%"] == ["64"] set VCARCH=amd64
if /I ["%1"] == ["vc141"] set "VCVER=vc14"
if /I ["%1"] == ["vc142"] set "VCVER=vc14"
if /I ["%1"] == ["vc143"] set "VCVER=vc14"
if exist "%CASROOT%\custom.bat" (
call "%CASROOT%\custom.bat" %VCVER% %ARCH% %CASDEB%

View File

@@ -7,7 +7,6 @@ if exist "%~dp0custom.bat" (
call "@INSTALL_DIR_ABSOLUTE@\@INSTALL_DIR_SCRIPT@\env.bat" %1 %2 %3
if /I ["%1"] == ["vc141"] set "VCVER=vc141"
if /I ["%1"] == ["vc142"] set "VCVER=vc142"
if /I ["%1"] == ["vc143"] set "VCVER=vc143"
set "BIN_DIR=win%ARCH%\%VCVER%\bind"
set "LIB_DIR=win%ARCH%\%VCVER%\libd"

View File

@@ -23,8 +23,6 @@ if "%VCVER%" == "vc8" (
call "%VS141COMNTOOLS%/vsvars32.bat" > nul
) else if "%VCVER%" == "vc142" (
call "%VS142COMNTOOLS%/vsvars32.bat" > nul
) else if "%VCVER%" == "vc143" (
call "%VS143COMNTOOLS%/vsvars32.bat" > nul
) else (
echo Error: wrong VS identifier
exit /B

View File

@@ -100,7 +100,7 @@
<ProgramDataBaseFileName>.\..\..\..\win32\__VCVER__\obj\__TKNAM__/</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<FloatingPointModel>Precise</FloatingPointModel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
__VCMPL32__
@@ -148,7 +148,7 @@
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<FloatingPointModel>Precise</FloatingPointModel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
@@ -196,7 +196,7 @@
<ProgramDataBaseFileName>.\..\..\..\win64\__VCVER__\obj\__TKNAM__/</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<FloatingPointModel>Precise</FloatingPointModel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
__VCMPL64__
@@ -244,7 +244,7 @@
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<FloatingPointModel>Precise</FloatingPointModel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>

View File

@@ -95,7 +95,7 @@
<ProgramDataBaseFileName>.\..\..\..\win32\__VCVER__\obj\__XQTNAM__/</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL32__
</ClCompile>
<ResourceCompile>
@@ -140,7 +140,7 @@
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL32__
</ClCompile>
@@ -185,7 +185,7 @@
<ProgramDataBaseFileName>.\..\..\..\win64\__VCVER__\obj\__XQTNAM__/</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL64__
</ClCompile>
<ResourceCompile>
@@ -229,7 +229,7 @@
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL64__
</ClCompile>

View File

@@ -22,7 +22,6 @@ samples/samples.md
samples/ocaf.md
samples/ocaf_func.md
samples/draw_scripts.md
samples/ais_object.md
samples/novice_guide.md
tutorial/tutorial.md

View File

@@ -2,48 +2,60 @@
==============================================
@tableofcontents
On Windows, the easiest way to install third-party libraries is to download archive with pre-built binaries from https://dev.opencascade.org/resources/download/3rd-party-components.
On Linux and macOS, it is recommended to use the version installed in the system natively.
On Windows, the easiest way to install third-party libraries is to download archive with pre-built binaries from https://opencascade.com/content/3rd-party-components.
On Linux and OS X, it is recommended to use the version installed in the system natively.
@section dev_guides__building_3rdparty_win_1 Windows
This section presents guidelines for building third-party products used by Open CASCADE Technology (OCCT) and samples on Windows platform.
It is assumed that you are already familiar with MS Visual Studio / Visual C++.
This document presents guidelines for building third-party products used by Open CASCADE Technology (OCCT) and samples on Windows platform. It is assumed that you are already familiar with MS Visual Studio / Visual C++.
You need to use the same version of MS Visual Studio for building all third-party products and OCCT itself, in order to receive a consistent set of runtime binaries.
You need to use the same version of MS Visual Studio for building all third-party products and OCCT itself, in order to receive a consistent set of run-time binaries.
It is recommended to create a separate new folder on your workstation, where you will unpack the downloaded archives of the third-party products, and where you will build these products (for example, `c:/occ3rdparty`).
Further in this document, this folder is referred to as `3rdparty`.
The links for downloading the third-party products are available at https://opencascade.com/content/3rd-party-components.
There are two types of third-party products used by OCCT:
* Mandatory products:
* Tcl/Tk 8.5 -- 8.6;
* FreeType 2.4.10 -- 2.5.3.
* Optional products:
* TBB 3.x -- 4.x;
* FreeImage 3.14.1 -- 3.16.0;
* VTK 6.1.0.
It is recommended to create a separate new folder on your workstation, where you will unpack the downloaded archives of the third-party products, and where you will build these products (for example, *c:\\occ3rdparty*).
Further in this document, this folder is referred to as *3rdparty*.
@subsection dev_guides__building_3rdparty_win_2 Tcl/Tk
Tcl/Tk is required for DRAW test harness.
**Installation from sources: Tcl**
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
1. In the `win` sub-directory, edit file `buildall.vc.bat`:
1. In the *win* sub-directory, edit file *buildall.vc.bat*:
* Edit the line `"call ... vcvars32.bat"` to have correct path to the version of Visual Studio to be used for building, for instance:
* Edit the line "call ... vcvars32.bat" to have correct path to the version of Visual Studio to be used for building, for instance:
call "%VS80COMNTOOLS%\vsvars32.bat"
If you are building 64-bit version, set environment accordingly, e.g.:
call "%VS80COMNTOOLS%\..\..\VC\vcvarsall.bat" amd64
* Define variable `INSTALLDIR` pointing to directory where Tcl/Tk will be installed, e.g.:
* Define variable *INSTALLDIR* pointing to directory where Tcl/Tk will be installed, e.g.:
set INSTALLDIR=D:\OCCT\3rdparty\tcltk-86-32
* Add option `install` to the first command line calling `nmake`:
* Add option *install* to the first command line calling *nmake*:
nmake -nologo -f makefile.vc release htmlhelp install %1
* Remove second call to `nmake` (building statically linked executable)
* Remove second call to *nmake* (building statically linked executable)
2. Edit file `rules.vc` replacing line
2. Edit file *rules.vc* replacing line
SUFX = tsgx
@@ -53,18 +65,21 @@ Download the necessary archive from https://www.tcl.tk/software/tcltk/download.h
This is to avoid extra prefix 't' in the library name, which is not recognized by default by OCCT build tools.
3. By default, Tcl uses dynamic version of run-time library (MSVCRT), which must be installed on the system where Tcl will be used.
You may wish to link Tcl library with static version of run-time to avoid this dependency.
For that:
* Edit file `makefile.vc` replacing strings `"crt = -MD"` by `"crt = -MT"`
* Edit file *makefile.vc* replacing strings "crt = -MD" by "crt = -MT"
* Edit source file `tclMain.c` (located in folder `generic`) commenting out forward declaration of function `isatty()`.
* Edit source file *tclMain.c* (located in folder *generic*) commenting out forward declaration of function *isatty()*.
4. In the command prompt, run `buildall.vc.bat`<br>
You might need to run this script twice to have `tclsh` executable installed; check subfolder `bin` of specified installation path to verify this.
5. For convenience of use, we recommend making a copy of `tclsh` executable created in subfolder `bin` of `INSTALLDIR` and named with Tcl version number suffix, as `tclsh.exe` (with no suffix)
4. In the command prompt, run *buildall.vc.bat*
You might need to run this script twice to have *tclsh* executable installed; check subfolder *bin* of specified installation path to verify this.
5. For convenience of use, we recommend making a copy of *tclsh* executable created in subfolder *bin* of *INSTALLDIR* and named with Tcl version number suffix, as *tclsh.exe* (with no suffix)
> cd D:\OCCT\3rdparty\tcltk-86-32\bin
> cp tclsh86.exe tclsh.exe
@@ -72,154 +87,190 @@ Download the necessary archive from https://www.tcl.tk/software/tcltk/download.h
**Installation from sources: Tk**
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
Apply the same steps as described for building Tcl above, with the same `INSTALLDIR`.
Note that Tk produces its own executable, called `wish`.
You might need to edit default value of `TCLDIR` variable defined in `buildall.vc.bat` (should be not necessary if you unpack both Tcl and Tk sources in the same folder).
Apply the same steps as described for building Tcl above, with the same INSTALLDIR.
Note that Tk produces its own executable, called *wish*.
You might need to edit default value of *TCLDIR* variable defined in *buildall.vc.bat* (should be not necessary if you unpack both Tcl and Tk sources in the same folder).
@subsection dev_guides__building_3rdparty_win_2_2 FreeType
FreeType is required for text display in a 3D viewer.
You can download its sources from https://freetype.org/
FreeType is required for text display in a 3D viewer. You can download its sources from https://sourceforge.net/projects/freetype/files/
1. Unpack the downloaded archive of FreeType product into the `3rdparty` folder.
As a result, you will get a folder named, for example, `3rdparty/freetype-2.4.10`.
Further in this document, this folder is referred to as `freetype`.
### The building procedure
2. Open the solution file `freetype/builds/win32/vc20xx/freetype.sln` in Visual Studio.
Here `vc20xx` stands for your version of Visual Studio.
1. Unpack the downloaded archive of FreeType product into the *3rdparty* folder. As a result, you will get a folder named, for example, *3rdparty\\freetype-2.4.10*. Further in this document, this folder is referred to as *freetype*.
2. Open the solution file *freetype\\builds\\win32\\vc20xx\\freetype.sln* in Visual Studio. Here *vc20xx* stands for your version of Visual Studio.
3. Select the configuration to build: either `Debug` or `Release`.
3. Select the configuration to build: either Debug or Release.
4. Build the `freetype` project.<br>
As a result, you will get a `freetype` import library (`.lib`) in the `freetype/obj/win32/vc20xx` folder.
4. Build the *freetype* project.
5. If you build FreeType for a 64 bit platform, select in the main menu `Build - Configuration Manager`
and add `x64` platform to the solution configuration by copying the settings from `Win32` platform:
As a result, you will get a freetype import library (.lib) in the *freetype\\obj\\win32\\vc20xx* folder.
5. If you build FreeType for a 64 bit platform, select in the main menu **Build - Configuration Manager** and add *x64* platform to the solution configuration by copying the settings from Win32 platform:
@figure{/build/build_3rdparty/images/3rdparty_image001.png}
Update the value of the Output File for `x64` configuration:
Update the value of the Output File for x64 configuration:
@figure{/build/build_3rdparty/images/3rdparty_image003.png}
Build the `freetype` project.<br>
As a result, you will obtain a 64 bit import library (`.lib`) file in the `freetype/x64/vc20xx` folder.
To build FreeType as a dynamic library (`.dll`) follow steps 6, 7 and 8 of this procedure.
Build the *freetype* project.
6. Open menu Project-> Properties-> Configuration Properties-> General and change option `Configuration Type` to `Dynamic Library (.dll)`.
7. Edit file `freetype/include/freetype/config/ftoption.h`:<br>
in line 255, uncomment the definition of macro `FT_EXPORT` and change it as follows:
As a result, you will obtain a 64 bit import library (.lib) file in the *freetype\\x64\\vc20xx* folder.
#define FT_EXPORT(x) __declspec(dllexport) x
To build FreeType as a dynamic library (.dll) follow steps 6, 7 and 8 of this procedure.
8. Build the `freetype` project.<br>
As a result, you will obtain the files of the import library (`.lib`) and the dynamic library (`.dll`) in folders `freetype/objs/release` or `freetype/objs/debug`.
If you build for a 64 bit platform, follow step 5 of the procedure.
6. Open menu Project-> Properties-> Configuration Properties-> General and change option **Configuration Type** to *Dynamic Library (.dll)*.
7. Edit file *freetype\\include\\freetype\\config\\ftoption.h*:
in line 255, uncomment the definition of macro *FT_EXPORT* and change it as follows:
To facilitate the use of FreeType libraries in OCCT with minimal adjustment of build procedures,
it is recommended to copy the include files and libraries of FreeType into a separate folder, named according to the pattern `freetype-compiler-bitness-building mode`, where:
* `compiler` is `vc8` or `vc9` or `vc10` or `vc11`;
* `bitness` is `32` or `64`;
* `building mode` is `opt` (for `Release`) or `deb` (for `Debug`).
#define FT_EXPORT(x) __declspec(dllexport) x
8. Build the *freetype* project.
As a result, you will obtain the files of the import library (.lib) and the dynamic library (.dll) in folders <i>freetype \\objs\\release</i> or <i>\\objs\\debug </i>.
If you build for a 64 bit platform, follow step 5 of the procedure.
To facilitate the use of FreeType libraries in OCCT with minimal adjustment of build procedures, it is recommended to copy the include files and libraries of FreeType into a separate folder, named according to the pattern: *freetype-compiler-bitness-building mode*, where:
* **compiler** is *vc8* or *vc9* or *vc10* or *vc11*;
* **bitness** is *32* or *64*;
* **building mode** is *opt* (for Release) or *deb* (for Debug).
The *include* subfolder should be copied as is, while libraries should be renamed to *freetype.lib* and *freetype.dll* (suffixes removed) and placed to subdirectories *lib *and *bin*, respectively. If the Debug configuration is built, the Debug libraries should be put into subdirectories *libd* and *bind*.
The `include` subfolder should be copied as is, while libraries should be renamed to `freetype.lib` and `freetype.dll` (suffixes removed) and placed to subdirectories `lib` and `bin`, respectively.
If the `Debug` configuration is built, the Debug libraries should be put into subdirectories `libd` and `bind`.
@subsection dev_guides__building_3rdparty_win_3_1 TBB
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0.
Go to the **Download** page, find the release version you need (e.g. `oneTBB 2021.5.0`) and pick the archive for Windows platform.
To install, unpack the downloaded archive of TBB product (`oneapi-tbb-2021.5.0-win.zip`)
This third-party product is installed with binaries
from the archive that can be downloaded from https://github.com/intel/tbb.
Go to the **Download** page, find the release version you need (e.g. *tbb30_018oss*) and pick the archive for Windows platform.
Unpack the downloaded archive of TBB product into the `3rdparty` folder.
Unpack the downloaded archive of TBB product into the *3rdparty* folder.
Further in this document, this folder is referred to as `tbb`.
Further in this document, this folder is referred to as *tbb*.
@subsection dev_guides__building_3rdparty_win_3_3 FreeImage
This third-party product should be built as a dynamically loadable library (`.dll` file).
You can download its sources from
This third-party product should be built as a dynamically loadable library (.dll file).
You can download its sources from
https://sourceforge.net/projects/freeimage/files/Source%20Distribution/
1. Unpack the downloaded archive of FreeImage product into `3rdparty` folder.<br>
As a result, you should have a folder named `3rdparty/FreeImage`.
Rename it according to the rule: `freeimage-platform-compiler-building mode`, where
### The building procedure:
* `platform` is `win32` or `win64`;
* `compiler` is `vc8` or `vc9` or `vc10` or `vc11`;
* `building mode` is *opt* (for release) or `deb` (for debug)
1. Unpack the downloaded archive of FreeImage product into *3rdparty* folder.
As a result, you should have a folder named *3rdparty\\FreeImage*.
Rename it according to the rule: *freeimage-platform-compiler-building mode*, where
* **platform** is *win32* or *win64*;
* **compiler** is *vc8* or *vc9* or *vc10* or *vc11*;
* **building mode** is *opt* (for release) or *deb* (for debug)
Further in this document, this folder is referred to as `freeimage`.
Further in this document, this folder is referred to as *freeimage*.
2. Open the solution file `freeimage/FreeImage.*.sln` in your Visual Studio.<br>
If you use a Visual Studio version higher than VC++ 2008, apply conversion of the workspace.
Such conversion should be suggested automatically by Visual Studio.
2. Open the solution file *freeimage\\FreeImage.*.sln* in your Visual Studio.
If you use a Visual Studio version higher than VC++ 2008, apply conversion of the workspace.
Such conversion should be suggested automatically by Visual Studio.
3. Select a configuration to build.
3. Select a configuration to build.
- Choose `Release` if you are building Release binaries.
- Choose `Debug` if you are building Debug binaries.
- Choose **Release** if you are building Release binaries.
- Choose **Debug** if you are building Debug binaries.
*Note:*
If you want to build a debug version of FreeImage binaries then you need to rename the following files in FreeImage projects:
*Note:*
If you want to build a debug version of FreeImage binaries then you need to rename the following files in FreeImage and FreeimagePlus projects:
Project -> Properties -> Configuration Properties -> Linker -> General -> Output File
FreeImage*d*.dll to FreeImage.dll
FreeImage*d*.dll to FreeImage.dll
FreeImagePlus*d*.dll to FreeImagePlus.dll
Project -> Properties -> Configuration Properties -> Linker -> Debugging-> Generate Program Database File
FreeImage*d*.pdb to FreeImage.pdb
FreeImage*d*.pdb to FreeImage.pdb
FreeImagePlus*d*.pdb to FreeImagePlus.pdb
Project -> Properties -> Configuration Properties -> Linker -> Advanced-Import Library
FreeImage*d*.lib to FreeImage.lib
FreeImage*d*.lib to FreeImage.lib
FreeImagePlus*d*.lib to FreeImagePlus.lib
Project -> Properties -> Configuration Properties -> Build Events -> Post -> Build Event -> Command Line
Project -> Properties -> Configuration Properties -> Build Events -> Post -> Build Event -> Command Line
FreeImage*d*.dll to FreeImage.dll
FreeImage*d*.lib to FreeImage.lib
FreeImage*d*.dll to FreeImage.dll
FreeImage*d*.lib to FreeImage.lib
FreeImagePlus*d*.dll to FreeImagePlus.dll
FreeImagePlus*d*.lib to FreeImagePlus.lib
Additionally, rename in project FreeImagePlus
Additionally, rename in project FreeImagePlus
Project -> Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies
Project -> Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies
from FreeImage*d*.lib to FreeImage.lib
from FreeImage*d*.lib to FreeImage.lib
4. Select a platform to build.
4. Select a platform to build.
- Choose `Win32` if you are building for a 32 bit platform.
- Choose `x64` if you are building for a 64 bit platform.
- Choose *Win32* if you are building for a 32 bit platform.
- Choose *x64* if you are building for a 64 bit platform.
5. Start the building process.<br>
As a result, you should have the library files of FreeImage product in `freeimage/Dist` folder (`FreeImage.dll` and `FreeImage.lib`).
5. Start the building process.
As a result, you should have the library files of FreeImage product in *freeimage\\Dist* folder (*FreeImage.dll* and *FreeImage.lib*) and in *freeimage\\Wrapper\\FreeImagePlus\\dist* folder (*FreeImagePlus.dll* and *FreeImagePlus.lib*).
@subsection dev_guides__building_3rdparty_win_3_4 VTK
VTK Integration Services component provides adaptation functionality for visualization of OCCT topological shapes by means of VTK library.
VTK is an open-source, freely available software system for 3D computer graphics, image processing and visualization. VTK Integration Services component provides adaptation functionality for visualization of OCCT topological shapes by means of VTK library.
1. Download the necessary archive from https://www.vtk.org/VTK/resources/software.html and unpack it into `3rdparty` folder.<br>
As a result, you will get a folder named, for example, `3rdparty/VTK-6.1.0`.
Further in this document, this folder is referred to as `VTK`.
### The building procedure:
1. Download the necessary archive from https://www.vtk.org/VTK/resources/software.html and unpack it into *3rdparty* folder.
As a result, you will get a folder named, for example, <i>3rdparty\VTK-6.1.0.</i>
Further in this document, this folder is referred to as *VTK*.
2. Use CMake to generate VS projects for building the library:
- Start CMake-GUI and select `VTK` folder as source path, and the folder of your choice for VS project and intermediate build data.
- Start CMake-GUI and select VTK folder as source path, and the folder of your choice for VS project and intermediate build data.
- Click **Configure**.
- Select the VS version to be used from the ones you have installed (we recommend using VS 2015) and the architecture (32 or 64-bit).
- Generate VS projects with default CMake options. The open solution `VTK.sln` will be generated in the build folder.
- Generate VS projects with default CMake options. The open solution *VTK.sln* will be generated in the build folder.
3. Build project VTK in Release mode.
@section build_3rdparty_linux Linux
This section presents additional guidelines for building third-party products used by Open CASCADE Technology and samples on Linux platform.
This document presents additional guidelines for building third-party
products used by Open CASCADE Technology and samples on Linux platform.
The links for downloading the third-party products are available on the web site at
https://opencascade.com/content/3rd-party-components.
There are two types of third-party products, which are necessary to build OCCT:
* Mandatory products:
* Tcl/Tk 8.5 - 8.6;  
* FreeType 2.4.10 - 2.5.3;
* Optional products:
* TBB 3.x - 4.x;
* FreeImage 3.14.1 - 3.16.0;
* VTK 6.1.0.
@subsection dev_guides__building_3rdparty_linux_4 Installation From Official Repositories
**Debian-based distributives**
All 3rd-party products required for building of OCCT could be installed from official repositories.
You may install them from console using apt-get utility:
All 3rd-party products required for building of OCCT could be installed
from official repositories. You may install them from console using apt-get utility:
sudo apt-get install tcllib tklib tcl-dev tk-dev libfreetype-dev libx11-dev libgl1-mesa-dev libfreeimage-dev
sudo apt-get install rapidjson-dev libdraco-dev
@@ -228,148 +279,148 @@ Building is possible with C++ compliant compiler:
sudo apt-get install g++
@subsection dev_guides__building_3rdparty_linux_2_1 Tcl/Tk
@subsection dev_guides__building_3rdparty_linux_2_1 Tcl/Tk
Tcl/Tk is required for DRAW test harness.
Tcl/Tk is required for DRAW test harness.
**Installation from sources: Tcl**
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
1. Enter the `unix` sub-directory of the directory where the Tcl source files are located (`TCL_SRC_DIR`).
cd TCL_SRC_DIR/unix
2. Run the `configure` command:
configure --enable-gcc --enable-shared --enable-threads --prefix=TCL_INSTALL_DIR
For a 64 bit platform also add `--enable-64bit` option to the command line.
3. If the configure command has finished successfully, start the building process:
make
4. If building is finished successfully, start the installation of Tcl.
All binary and service files of the product will be copied to the directory defined by `TCL_INSTALL_DIR`
make install
**Installation from sources: Tk**
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
1. Enter the `unix` sub-directory of the directory where the Tk source files are located (`TK_SRC_DIR`)
1. Enter the unix sub-directory of the directory where the Tcl source files are located <i>(TCL_SRC_DIR)</i>.
cd TK_SRC_DIR/unix
cd TCL_SRC_DIR/unix
2. Run the `configure` command, where `TCL_LIB_DIR` is `TCL_INSTALL_DIR/lib`.
2. Run the *configure* command:
configure --enable-gcc --enable-shared --enable-threads --with-tcl=TCL_LIB_DIR --prefix=TK_INSTALL_DIR
configure --enable-gcc --enable-shared --enable-threads --prefix=TCL_INSTALL_DIR
For a 64 bit platform also add `--enable-64bit` option to the command line.
For a 64 bit platform also add <i>--enable-64bit</i> option to the command line.
3. If the configure command has finished successfully, start the building process:
make
3. If the configure command has finished successfully, start the building process:
4. If building is finished successfully, start the installation of Tcl.
All binary and service files of the product will be copied to the directory defined by *TCL_INSTALL_DIR*
make
make install
4. If the building has finished successfully, start the installation of Tk.
All binary and service files of the product will be copied
to the directory defined by `TK_INSTALL_DIR` (usually it is `TCL_INSTALL_DIR`)
**Installation from sources: Tk**
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
1. Enter the unix sub-directory of the directory where the Tk source files are located <i>(TK_SRC_DIR)</i>
make install
cd TK_SRC_DIR/unix
2. Run the configure command, where <i>TCL_LIB_DIR</i> is *TCL_INSTALL_DIR/lib*.
configure --enable-gcc --enable-shared --enable-threads --with-tcl=TCL_LIB_DIR --prefix=TK_INSTALL_DIR
For a 64 bit platform also add <i>--enable-64bit</i> option to the command line.
3. If the configure command has finished successfully, start the building process:
make
4. If the building has finished successfully, start the installation of Tk.
All binary and service files of the product will be copied
to the directory defined by *TK_INSTALL_DIR* (usually it is *TCL_INSTALL_DIR*)
make install
@subsection dev_guides__building_3rdparty_linux_2_2 FreeType
FreeType is required for text display in the 3D viewer.
Download the necessary archive from https://freetype.org/ and unpack it.
1. Enter the directory where the source files of FreeType are located (`FREETYPE_SRC_DIR`).
FreeType is required for text display in the 3D viewer.
Download the necessary archive from https://sourceforge.net/projects/freetype/files/ and unpack it.
1. Enter the directory where the source files of FreeType are located <i>(FREETYPE_SRC_DIR)</i>.
cd FREETYPE_SRC_DIR
2. Run the `configure` command:
2. Run the *configure* command:
configure --prefix=FREETYPE_INSTALL_DIR
configure --prefix=FREETYPE_INSTALL_DIR
For a 64 bit platform also add <i>CFLAGS='-m64 -fPIC' CPPFLAGS='-m64 -fPIC'</i> option to the command line.
3. If the *configure* command has finished successfully, start the building process:
For a 64 bit platform also add `CFLAGS='-m64 -fPIC' CPPFLAGS='-m64 -fPIC'` option to the command line.
make
3. If the `configure` command has finished successfully, start the building process:
make
4. If the building has finished successfully, start the installation of FreeType.
All binary and service files of the product will be copied to the directory defined by `FREETYPE_INSTALL_DIR`
make install
4. If the building has finished successfully, start the installation of FreeType.
All binary and service files of the product will be copied to the directory defined by *FREETYPE_INSTALL_DIR*
make install
@subsection dev_guides__building_3rdparty_linux_3_1 TBB
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0.
Go to the **Download** page, find the release version you need (e.g. `oneTBB 2021.5.0`) and pick the archive for Linux platform.
To install, unpack the downloaded archive of TBB product (`oneapi-tbb-2021.5.0-lin.tgz`).
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/intel/tbb.
Go to the **Download** page, find the release version you need and pick the archive for Linux platform.
To install, unpack the downloaded archive of TBB product.
@subsection dev_guides__building_3rdparty_linux_3_3 FreeImage
Download the necessary archive from https://sourceforge.net/projects/freeimage/files/Source%20Distribution/ and unpack it.
The directory with unpacked sources is further referred to as `FREEIMAGE_SRC_DIR`.
Download the necessary archive from https://sourceforge.net/projects/freeimage/files/Source%20Distribution/
and unpack it. The directory with unpacked sources is further referred to as *FREEIMAGE_SRC_DIR*.
1. Modify *FREEIMAGE_SRC_DIR/Source/OpenEXR/Imath/ImathMatrix.h*:
In line 60 insert the following:
1. Modify `FREEIMAGE_SRC_DIR/Source/OpenEXR/Imath/ImathMatrix.h`:<br>
In line 60 insert the following:
#include string.h
#include string.h
2. Enter the directory where the source files of FreeImage are located <i>(FREEIMAGE_SRC_DIR)</i>.
cd FREEIMAGE_SRC_DIR
2. Enter the directory where the source files of FreeImage are located (`FREEIMAGE_SRC_DIR`).
3. Run the building process
make
cd FREEIMAGE_SRC_DIR
4. Run the installation process
3. Run the building process
make
4. Run the installation process
a. If you have the permission to write into directories `/usr/include` and `/usr/lib`, run the following command:
make install
b. If you do not have this permission, you need to modify file `FREEIMAGE_SRC_DIR/Makefile.gnu`:
a. If you have the permission to write into directories <i>/usr/include</i> and <i>/usr/lib</i>, run the following command:
make install
b. If you do not have this permission, you need to modify file *FREEIMAGE_SRC_DIR/Makefile.gnu*:
Change lines 7-9 from:
DESTDIR ?= /
INCDIR ?= $(DESTDIR)/usr/include
INSTALLDIR ?= $(DESTDIR)/usr/lib
DESTDIR ?= /
INCDIR ?= $(DESTDIR)/usr/include
INSTALLDIR ?= $(DESTDIR)/usr/lib
to:
DESTDIR ?= $(DESTDIR)
INCDIR ?= $(DESTDIR)/include
INSTALLDIR ?= $(DESTDIR)/lib
Change lines 65-67 from:
install -m 644 -o root -g root $(HEADER) $(INCDIR)
install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
to:
DESTDIR ?= $(DESTDIR)
INCDIR ?= $(DESTDIR)/include
INSTALLDIR ?= $(DESTDIR)/lib
Change lines 65-67 from:
install -m 644 -o root -g root $(HEADER) $(INCDIR)
install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
to:
install -m 755 $(HEADER) $(INCDIR)
install -m 755 $(STATICLIB) $(INSTALLDIR)
install -m 755 $(HEADER) $(INCDIR)
install -m 755 $(STATICLIB) $(INSTALLDIR)
install -m 755 $(SHAREDLIB) $(INSTALLDIR)
Change line 70 from:
Change line 70 from: 
ldconfig
to:
\#ldconfig
\#ldconfig
Then run the installation process by the following command:
Then run the installation process by the following command:
make DESTDIR=FREEIMAGE_INSTALL_DIR install
make DESTDIR=FREEIMAGE_INSTALL_DIR install
5. Clean temporary files
@@ -377,180 +428,201 @@ The directory with unpacked sources is further referred to as `FREEIMAGE_SRC_DI
@subsection dev_guides__building_3rdparty_linux_3_4 VTK
You can download VTK sources from https://www.vtk.org/VTK/resources/software.html
### The building procedure:
Download the necessary archive from https://www.vtk.org/VTK/resources/software.html and unpack it.
1. Install or build `cmake` product from the source file.
2. Start `cmake` in GUI mode with the directory where the source files of *VTK* are located:
1. Install or build *cmake* product from the source file.
2. Start *cmake* in GUI mode with the directory where the source files of *VTK* are located:
ccmake VTK_SRC_DIR
* Press `[c]` to make the initial configuration
* Define the necessary options in `VTK_INSTALL_PREFIX`
* Press `[c]` to make the final configuration
* Press `[g]` to generate `Makefile` and exit
* Press <i>[c]</i> to make the initial configuration
* Define the necessary options in *VTK_INSTALL_PREFIX*
* Press <i>[c]</i> to make the final configuration
* Press <i>[g]</i> to generate Makefile and exit
3. Start the building of VTK:
make
4. Start the installation of VTK. Binaries will be installed according to the `VTK_INSTALL_PREFIX` option.
4. Start the installation of VTK. Binaries will be installed according to the *VTK_INSTALL_PREFIX* option.
make install
@section build_3rdparty_macos Mac OS X
This section presents additional guidelines for building third-party products
used by Open CASCADE Technology and samples on Mac OS X platform (10.6.4 and later).
This document presents additional guidelines for building third-party products
used by Open CASCADE Technology and samples on Mac OS X platform (10.6.4 and later).
@subsection dev_guides__building_3rdparty_osx_2_1 Tcl/Tk
The links for downloading the third-party products are available at https://opencascade.com/content/3rd-party-components.
Tcl/Tk is required for DRAW test harness.
There are two types of third-party products, which are necessary to build OCCT:
* Mandatory products:
* Tcl/Tk 8.5 - 8.6;
* FreeType 2.4.10 - 2.5.3.
* Optional products:
* TBB 3.x - 4.x;
* FreeImage 3.14.1 - 3.16.0
**Installation from sources: Tcl**
@subsection dev_guides__building_3rdparty_osx_2_1 Tcl/Tk 8.5
Tcl/Tk is required for DRAW test harness. Version 8.5 or 8.6 can be used with OCCT.
**Installation from sources: Tcl 8.5**
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
1. Enter the `macosx` sub-directory of the directory where the Tcl source files are located (`TCL_SRC_DIR`).
1. Enter the *macosx* sub-directory of the directory where the Tcl source files are located <i>(TCL_SRC_DIR)</i>.
cd TCL_SRC_DIR/macosx
cd TCL_SRC_DIR/macosx
2. Run the `configure` command
2. Run the *configure* command
configure --enable-gcc --enable-shared --enable-threads --prefix=TCL_INSTALL_DIR
configure --enable-gcc --enable-shared --enable-threads --prefix=TCL_INSTALL_DIR
For a 64 bit platform also add `--enable-64bit` option to the command line.
For a 64 bit platform also add <i>--enable-64bit</i> option to the command line.
3. If the `configure` command has finished successfully, start the building process
3. If the *configure* command has finished successfully, start the building process
make
make
4. If building is finished successfully, start the installation of Tcl.
All binary and service files of the product will be copied to the directory defined by *TCL_INSTALL_DIR*.
4. If building is finished successfully, start the installation of Tcl.
All binary and service files of the product will be copied to the directory defined by `TCL_INSTALL_DIR`.
make install
make install
**Installation from sources: Tk**
**Installation from sources: Tk 8.5**
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
1. Enter the `macosx` sub-directory of the directory where the source files of Tk are located (`TK_SRC_DIR`).
1. Enter the *macosx* sub-directory of the directory where the source files of Tk are located <i>(TK_SRC_DIR)</i>.
cd TK_SRC_DIR/macosx
cd TK_SRC_DIR/macosx
2. Run the `configure` command, where `TCL_LIB_DIR` is `TCL_INSTALL_DIR/lib`
2. Run the *configure* command, where TCL_LIB_DIR is TCL_INSTALL_DIR/lib
configure --enable-gcc --enable-shared --enable-threads --with-tcl=TCL_LIB_DIR --prefix=TK_INSTALL_DIR
configure --enable-gcc --enable-shared --enable-threads --with-tcl=TCL_LIB_DIR --prefix=TK_INSTALL_DIR
For a 64 bit platform also add `--enable-64bit` option to the command line.
For a 64 bit platform also add <i>--enable-64bit</i> option to the command line.
3. If the `configure` command has finished successfully, start the building process:
3. If the *configure* command has finished successfully, start the building process:
make
make
4. If the building has finished successfully, start the installation of Tk.
All binary and service files of the product will be copied to the directory defined by `TK_INSTALL_DIR` (usually it is `TCL_INSTALL_DIR`).
4. If the building has finished successfully, start the installation of Tk. All binary and service files of the product will be copied to the directory defined by *TK_INSTALL_DIR* (usually it is TCL_INSTALL_DIR)
make install
make install
@subsection dev_guides__building_3rdparty_osx_2_2 FreeType
@subsection dev_guides__building_3rdparty_osx_2_2 FreeType 2.4.10
FreeType is required for text display in the 3D viewer.
FreeType is required for text display in the 3D viewer.
Download the necessary archive from https://freetype.org/ and unpack it.
Download the necessary archive from https://sourceforge.net/projects/freetype/files/ and unpack it.
1. Enter the directory where the source files of FreeType are located (`FREETYPE_SRC_DIR`).
1. Enter the directory where the source files of FreeType are located <i>(FREETYPE_SRC_DIR)</i>.
cd FREETYPE_SRC_DIR
cd FREETYPE_SRC_DIR
2. Run the `configure` command
2. Run the *configure* command
configure --prefix=FREETYPE_INSTALL_DIR
configure --prefix=FREETYPE_INSTALL_DIR
For a 64 bit platform also add <i>CFLAGS='-m64 -fPIC' CPPFLAGS='-m64 -fPIC'</i> option to the command line.
For a 64 bit platform also add `CFLAGS='-m64 -fPIC' CPPFLAGS='-m64 -fPIC'` option to the command line.
3. If the *configure* command has finished successfully, start the building process
3. If the `configure` command has finished successfully, start the building process
make
make
4. If building has finished successfully, start the installation of FreeType.
All binary and service files of the product will be copied to the directory defined by *FREETYPE_INSTALL_DIR*.
4. If building has finished successfully, start the installation of FreeType.
All binary and service files of the product will be copied to the directory defined by `FREETYPE_INSTALL_DIR`.
make install
@subsection dev_guides__building_3rdparty_osx_3_1 TBB 3.x or 4.x
make install
This third-party product is installed with binaries from the archive
that can be downloaded from https://github.com/intel/tbb.
Go to the **Download** page, find the release version you need (e.g. *tbb30_018oss*)
and pick the archive for Mac OS X platform.
To install, unpack the downloaded archive of TBB 3.0 product (*tbb30_018oss_osx.tgz*).
@subsection dev_guides__building_3rdparty_osx_3_1 TBB
@subsection dev_guides__building_3rdparty_osx_3_3 FreeImage 3.14.1 or 3.15.x
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0.
Go to the **Download** page, find the release version you need (e.g. `oneTBB 2021.5.0`) and pick the archive for Mac OS X platform.
To install, unpack the downloaded archive of TBB product (`oneapi-tbb-2021.5.0-mac.tgz`).
@subsection dev_guides__building_3rdparty_osx_3_3 FreeImage
Download the necessary archive from
Download the necessary archive from
https://sourceforge.net/projects/freeimage/files/Source%20Distribution/
and unpack it. The directory with unpacked sources is further referred to as `FREEIMAGE_SRC_DIR`.
and unpack it. The directory with unpacked sources is further referred to as *FREEIMAGE_SRC_DIR*.
Note that for building FreeImage on Mac OS X 10.7 you should replace `Makefile.osx`
in `FREEIMAGE_SRC_DIR` by the corrected file, which you can find in attachment to issue [`#22811`](https://tracker.dev.opencascade.org/file_download.php?file_id=6937&type=bug) in OCCT Mantis bug tracker.
Note that for building FreeImage on Mac OS X 10.7 you should replace *Makefile.osx*
in *FREEIMAGE_SRC_DIR* by the corrected file, which you can find in attachment to issue #22811 in OCCT Mantis bug tracker
(https://tracker.dev.opencascade.org/file_download.php?file_id=6937&type=bug).
1. If you build FreeImage 3.15.x you can skip this step.
1. If you build FreeImage 3.15.x you can skip this step.
Modify <i>FREEIMAGE_SRC_DIR/Source/OpenEXR/Imath/ImathMatrix.h:</i>
In line 60 insert the following:
Modify `FREEIMAGE_SRC_DIR/Source/OpenEXR/Imath/ImathMatrix.h:`<br>
In line 60 insert the following:
#include string.h
#include string.h
Modify <i>FREEIMAGE_SRC_DIR/Source/FreeImage/PluginTARGA.cpp:</i>
In line 320 replace:
Modify `FREEIMAGE_SRC_DIR/Source/FreeImage/PluginTARGA.cpp`:<br>
In line 320 replace:
SwapShort(value);
SwapShort(value);
with:
with:
SwapShort(&value);
SwapShort(&value);
2. Enter the directory where the source files of FreeImage are located <i>(FREEIMAGE_SRC_DIR)</i>.
2. Enter the directory where the source files of FreeImage are located (`FREEIMAGE_SRC_DIR`).
cd FREEIMAGE_SRC_DIR
cd FREEIMAGE_SRC_DIR
3. Run the building process
make
make
4. Run the installation process
4. Run the installation process
1. If you have the permission to write into <i>/usr/local/include</i> and <i>/usr/local/lib</i> directories, run the following command:
1. If you have the permission to write into `/usr/local/include` and `/usr/local/lib` directories, run the following command:
make install
make install
2. If you do not have this permission, you need to modify file *FREEIMAGE_SRC_DIR/Makefile.osx*:
2. If you do not have this permission, you need to modify file `FREEIMAGE_SRC_DIR/Makefile.osx`:<br>
Change line 49 from:
Change line 49 from:   
PREFIX ?= /usr/local
to:
PREFIX ?= $(PREFIX)
PREFIX ?= $(PREFIX)
  Change lines 65-69 from:
  Change lines 65-69 from:
install -d -m 755 -o root -g wheel $(INCDIR) $(INSTALLDIR)
install -m 644 -o root -g wheel $(HEADER) $(INCDIR)
install -m 644 -o root -g wheel $(SHAREDLIB) $(STATICLIB) $(INSTALLDIR)
ranlib -sf $(INSTALLDIR)/$(STATICLIB)
ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(LIBNAME)
to:
install -d -m 755 -o root -g wheel $(INCDIR) $(INSTALLDIR)
install -m 644 -o root -g wheel $(HEADER) $(INCDIR)
install -m 644 -o root -g wheel $(SHAREDLIB) $(STATICLIB) $(INSTALLDIR)
ranlib -sf $(INSTALLDIR)/$(STATICLIB)
ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(LIBNAME)
to:
install -d $(INCDIR) $(INSTALLDIR)
install -m 755 $(HEADER) $(INCDIR)
install -m 755 $(STATICLIB) $(INSTALLDIR)
install -m 755 $(SHAREDLIB) $(INSTALLDIR)
ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
install -d $(INCDIR) $(INSTALLDIR)
install -m 755 $(HEADER) $(INCDIR)
install -m 755 $(STATICLIB) $(INSTALLDIR)
install -m 755 $(SHAREDLIB) $(INSTALLDIR)
ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)
Then run the installation process by the following command:
make PREFIX=FREEIMAGE_INSTALL_DIR install
5. Clean temporary files
Then run the installation process by the following command:
make PREFIX=FREEIMAGE_INSTALL_DIR install
5. Clean temporary files
make clean

View File

@@ -17,7 +17,7 @@ On Linux and macOS we recommend to use libraries maintained by distributive deve
@section build_occt_win_cmake Building with CMake tool
This chapter describes the [CMake](https://cmake.org/download/)-based build process, which is now suggested as a standard way to produce the binaries of Open CASCADE Technology from sources.
OCCT requires CMake version 3.1 or later.
OCCT requires CMake version 2.8.12 or later.
CMake is a tool that generates the actual project files for the selected target build system (e.g. Unix makefiles) or IDE (e.g. Visual Studio 2010).
Here we describe the build procedure on the example of Windows platform with Visual Studio 2010.
@@ -113,7 +113,6 @@ The following table gives the full list of environment variables used at the con
| BUILD_PATCH | Path | Points to the directory recognized as a "patch" for OCCT. If specified, the files from this directory take precedence over the corresponding native OCCT sources. This way you are able to introduce patches to Open CASCADE Technology not affecting the original source distribution |
| BUILD_WITH_DEBUG | Boolean | Enables extended messages of many OCCT algorithms, usually printed to cout. These include messages on internal errors and special cases encountered, timing, etc. |
| BUILD_ENABLE_FPE_SIGNAL_HANDLER | Boolean | Enable/Disable the floating point exceptions (FPE) during DRAW execution only. Corresponding environment variable (CSF_FPE) can be changed manually in custom.bat/sh scripts without regeneration by CMake. |
| BUILD_CPP_STANDARD | String | Employ corresponding c++ standard (C++11, C++14, ..C++23) for building OCCT |
| CMAKE_CONFIGURATION_TYPES | String | Semicolon-separated CMake configurations |
| INSTALL_DIR | Path | Points to the installation directory. *INSTALL_DIR* is a synonym of *CMAKE_INSTALL_PREFIX*. The user can specify both *INSTALL_DIR* or *CMAKE_INSTALL_PREFIX* |
| INSTALL_DIR_BIN | Path | Relative path to the binaries installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_BIN}) |
@@ -325,7 +324,6 @@ The environment is defined in the file *custom.sh* (on Linux and macOS) or *cust
| vc141-uwp | 2017 (15) | UWP (Universal Windows Platform) | vc14-uwp |
| vc142 | 2019 (16) | Desktop (Windows API) | vc14 |
| vc142-uwp | 2019 (16) | UWP (Universal Windows Platform) | vc14-uwp |
| vc143 | 2022 (17) | Desktop (Windows API) | vc14 |
Alternatively, you can launch **genconf**, a GUI tool allowing to configure build options interactively.
That tool will analyze your environment and propose you to choose available options:

View File

@@ -341,7 +341,7 @@ The tables below describe the recommended software configurations for which OCCT
| OS | Compiler |
| --------- | ----------- |
| Windows | Microsoft Visual Studio: 2015 Update 3, 2017 <sup>1</sup>, 2019, 2022 <br>, LLVM (ClangCL), GCC 4.3+ (Mingw-w64)|
| Windows | Microsoft Visual Studio: 2013 Update 5, 2015 Update 3, 2017 <sup>1</sup>, 2019, 2022 <br>, LLVM (ClangCL), GCC 4.3+ (Mingw-w64)|
| Linux | GNU gcc 4.3+ <br> LLVM CLang 3.6+ |
| OS X / macOS | XCode 6 or newer |
| Android | NDK r12, GNU gcc 4.9 or newer |
@@ -359,8 +359,8 @@ https://dev.opencascade.org/resources/download/3rd-party-components
| Component | Where to find | Used for | Purpose |
| --------- | ------------- | -------- | -------------------- |
| CMake 3.1+ | https://cmake.org/ | Configuration | Build from sources |
| Intel oneTBB 2021.5.0 | https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0 | All | Parallelization of algorithms (alternative to built-in thread pool) |
| CMake 2.8+ | https://cmake.org/ | Configuration | Build from sources |
| Intel TBB 4.x or later | https://oneapi-src.github.io/oneTBB/ | All | Parallelization of algorithms (alternative to built-in thread pool) |
| OpenGL 3.3+, OpenGL ES 2.0+ | System | Visualization | Required for using 3D Viewer |
| OpenVR 1.10+ | https://github.com/ValveSoftware/openvr | Visualization | VR (Virtual Reality) support in 3D Viewer |
| FreeType 2.4+ | https://www.freetype.org/download.html | Visualization | Text rendering in 3D Viewer |
@@ -462,7 +462,7 @@ To run any Open CASCADE Technology application you need to set the environment v
You can define the environment variables with env.bat script located in the
$CASROOT folder. This script accepts two arguments to be used:
the version of Visual Studio (vc12 -- vc143) and the architecture (win32 or win64).
the version of Visual Studio (vc12 -- vc142) and the architecture (win32 or win64).
The additional environment settings necessary for compiling OCCT libraries and samples
by Microsoft Visual Studio can be set using script custom.bat located in the same folder.
@@ -572,7 +572,8 @@ FreeType 2 is released under two open-source licenses: BSD-like FreeType License
It is a library that helps you to take advantage of multi-core processor performance without having to be a threading expert.
Threading Building Blocks is not just a threads-replacement library. It represents a higher-level, task-based parallelism that
abstracts platform details and threading mechanisms for scalability and performance.
Intel oneTBB 2021.5.0 is available under Apache 2.0 license (https://www.threadingbuildingblocks.org).
TBB version 2017 is available under Apache 2.0 license, while older versions
until 4.4 are available under GPLv2 license with the runtime exception (https://www.threadingbuildingblocks.org).
**OpenGL** is an industry standard API for 3D graphics used by OCCT for
implementation of 3D viewer. OpenGL specification is developed by the

View File

@@ -1,911 +0,0 @@
AIS: Custom Presentation {#tutorials__ais_object}
========
@tableofcontents
@section intro Getting Started
OCCT provides a strong set of built-in Interactive Objects for rapid application development,
but the real power and flexibility of **Application Interactive Services** (@c AIS) could be revealed by subclassing and implementing custom presentations.
In this tutorial we will focus on the development of a custom @c AIS_InteractiveObject and show the basics step by step.
Let's start from the very beginning and try subclassing @c AIS_InteractiveObject object:
~~~~{.cpp}
class MyAisObject : public AIS_InteractiveObject
{
DEFINE_STANDARD_RTTI_INLINE(MyAisObject, AIS_InteractiveObject)
public:
MyAisObject() {}
public:
virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode) override {}
virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode) override {}
virtual bool AcceptDisplayMode (const Standard_Integer theMode) const override
{ return true; }
};
~~~~
@c DEFINE_STANDARD_RTTI_INLINE() macro will register the new class within the OCCT Run-Time Type Information (RTTI) system.
This step is optional (you may skip it if you are not going to use methods like @c Standard_Transient::DynamicType() in application code), but it is a common practice while subclassing OCCT classes.
The @c AIS_InteractiveObject interface defines only a couple of pure virtual methods - @c @::Compute() defining an object presentation and @c @::ComputeSelection() defining a selectable (pickable) volume.
Selection and presentation are two independent mechanisms in **AIS**. Presentation rendering is done with help of OpenGL or a similar low-level graphics library, while selection doesn't depend on a graphic driver at all.
Providing an empty implementation of these two methods would be enough for adding the object to @c AIS_InteractiveContext (@c @::Display()), but obviously nothing will appear on the screen.
@section prs_builders Presentation builders
To go ahead, we need to define some presentation of our object.
OCCT provides a set of presentation building tools for common elements like arrows, shapes, boxes, etc.
These tools could be found within @c Prs3d, @c StdPrs and @c DsgPrs packages:
- **Prs3d**
provides builders for simple geometric elements.
- @c Prs3d_Arrow, @c Prs3d_BndBox, @c Prs3d_Point, @c Prs3d_Text, @c Prs3d_ToolCylinder, @c Prs3d_ToolDisk, @c Prs3d_ToolSector, @c Prs3d_ToolSphere, @c Prs3d_ToolTorus
- **StdPrs**
provides builders for analytical geometry and B-Rep shapes (@c TopoDS_Shape).
- @c StdPrs_WFShape, @c StdPrs_ShadedShape, @c StdPrs_BRepTextBuilder
- **DsgPrs**
provides builders for datums, dimensions and relations.
Presentation builders are reusable bricks for constructing @c AIS objects.
Standard OCCT interactive objects highly rely on them, so that you may easily replicate @c AIS_Shape presentation for displaying a shape with just a couple of lines calling @c StdPrs_ShadedShape:
~~~~{.cpp}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (100.0, 100.0);
StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer);
}
...
Handle(AIS_InteractiveContext) theCtx;
Handle(MyAisObject) aPrs = new MyAisObject();
theCtx->Display (aPrs, true);
~~~~
@figure{ais_object_step1_shaded.png,"@c StdPrs_ShadedShape presentation builder.",409} height=409px
@c PrsMgr_PresentableObject::Compute() method takes three arguments:
- **Presentation Manager** (@c PrsMgr_PresentationManager).
Rarely used parameter, but might be necessary for some advanced use cases.
- **Presentation** (@c Prs3d_Presentation or @c Graphic3d_Structure).
Defines the structure to fill in with presentation elements.
- **Display Mode** (integer number).
Specifies the display mode to compute.
**0** is a default display mode, if not overridden by @c AIS_InteractiveObject::SetDisplayMode() or by @c AIS_InteractiveContext::Display().
For each supported display mode, the **Presentation Manager** creates a dedicated @c Prs3d_Presentation and stores it within the object itself as a list of presentations @c PrsMgr_PresentableObject::Presentations().
It is a good practice to reject unsupported display modes within @c @::Compute() method:
~~~~{.cpp}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
if (theMode != 0) { return; } // reject non-zero display modes
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (100.0, 100.0);
StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer);
}
~~~~
This wouldn't, however, prevent application from displaying the object with another display mode like this:
~~~~{.cpp}
Handle(AIS_InteractiveContext) theCtx;
Handle(MyAisObject) aPrs = new MyAisObject();
theCtx->Display (aPrs, 100, -1, true);
~~~~
The code above will display @c MyAisObject with display mode equal to 100, and after @c @::Compute() modifications nothing will be displayed on the screen.
@c AIS will still create a presentation with specified display mode, but it will be empty - method @c @::AcceptDisplayMode() could be overridden to disallow even creation of an empty presentation:
~~~~{.cpp}
bool MyAisObject::AcceptDisplayMode (const Standard_Integer theMode) const
{
return theMode == 0; // reject non-zero display modes
}
~~~~
@c AIS_InteractiveContext::Display() checks if requested display mode is actually supported by the object, and uses default display mode (_**0**_) if it is not.
@c StdPrs_ShadedShape prepares a shaded (triangulated) presentation of a shape, while @c StdPrs_WFShape creates a wireframe presentation with B-Rep wire boundaries:
~~~~{.cpp}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
if (!AcceptDisplayMode (theMode)) { return; }
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (100.0, 100.0);
StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer); // add shading
StdPrs_WFShape::Add (thePrs, aShape, myDrawer); // add wireframe
}
~~~~
@figure{ais_object_step1_shaded_wf.png,"Result of @c StdPrs_ShadedShape + @c StdPrs_WFShape presentation builders.",409} height=409px
Presentation builders take the @c Prs3d_Drawer object defining various attributes - material of shaded shape, number of isolines in wireframe mode, tessellation quality, line colors and many others.
@c PrsMgr_PresentableObject defines @c myDrawer property with default attributes.
@c StdPrs makes it easy to display topological shapes.
With the help of @c Prs3d tools we may display elements like arrows, boxes or text labels.
Let's extend our presentation with a second **display mode 1** showing a bounding box using @c Prs3d_BndBox builder:
~~~~{.cpp}
bool MyAisObject::AcceptDisplayMode (const Standard_Integer theMode) const
{
return theMode == 0 || theMode == 1;
}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (100.0, 100.0);
if (theMode == 0)
{
StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer);
StdPrs_WFShape::Add (thePrs, aShape, myDrawer); // add wireframe
}
else if (theMode == 1)
{
Bnd_Box aBox;
BRepBndLib::Add (aShape, aBox);
Prs3d_BndBox::Add (thePrs, aBox, myDrawer);
}
}
~~~~
Now, displaying an object with **display mode 1** will show a box:
~~~~{.cpp}
Handle(AIS_InteractiveContext) theCtx;
Handle(MyAisObject) aPrs = new MyAisObject();
theCtx->Display (aPrs, 1, 0, true);
~~~~
@figure{ais_object_step1_bndbox.png,"@c Prs3d_BndBox presentation builder.",409} height=409px
@c AIS disallows activating multiple display modes at the same time, so that these presentation modes should be alternatives to each other.
But @c AIS may use non-active display mode for highlighting purposes - like wireframe (@c AIS_Wireframe) presentation displayed on top of shaded (@c AIS_Shaded) presentation for selected @c AIS_Shape objects.
Let's define a dedicated enumeration for display modes supported by our interactive object and setup the 1st (@c MyDispMode_Highlight) display mode for highlighting with help of @c PrsMgr_PresentableObject::SetHilightMode():
~~~~{.cpp}
class MyAisObject : public AIS_InteractiveObject
{
public:
enum MyDispMode { MyDispMode_Main = 0, MyDispMode_Highlight = 1 };
...
MyAisObject::MyAisObject()
{
SetDisplayMode (MyDispMode_Main); // main (active) display mode
SetHilightMode (MyDispMode_Highlight); // auxiliary (highlighting) mode
}
...
Handle(AIS_InteractiveContext) theCtx;
Handle(MyAisObject) aPrs = new MyAisObject();
theCtx->Display (aPrs, MyAisObject::MyDispMode_Main, 0, false);
theCtx->HilightWithColor (aPrs, aPrs->HilightAttributes(), false);
theCtx->CurrentViewer()->Redraw();
~~~~
@figure{ais_object_step1_highlight.png,"Highlighting by color (left) and highlighting by another display mode (right).",818} height=409px
In this particular use case we've used the method @c AIS_InteractiveContext::HilightWithColor() instead of @c @::SetSelected() - just because our object is not selectable yet and @c @::SetSelected() wouldn't work.
Highlighted presentation appears on the screen with modulated color (see left screenshot above).
Using a dedicated display mode for highlighting (right screenshot above) allows customizing presentation in selected / highlighted states.
@section prim_arrays Primitive arrays
@c Prs3d_Presentation might be filled in by the following **primitives**:
- **Triangles**
- @c Graphic3d_ArrayOfTriangles
- @c Graphic3d_ArrayOfTriangleFans
- @c Graphic3d_ArrayOfTriangleStrips
- **Lines**
- @c Graphic3d_ArrayOfSegments
- @c Graphic3d_ArrayOfPolylines
- **Points** or **Markers**
- @c Graphic3d_ArrayOfPoints
This triplet of primitives is what graphics hardware is capable of rendering, so that it could be transferred directly to low-level graphics libraries in the form of *Vertex Buffer Objects* (VBO).
Each **primitive array** consists of an array of vertex attributes (_**position**, **normal**, **texture coordinates**, **vertex colors**_, etc.) and optional **array of indices**.
The latter one avoids duplicating vertices shared between connected elements (triangles, polylines) in attributes array.
@c Graphic3d_ArrayOfPrimitives and it's subclasses provide a convenient interface for filling in primitive arrays:
- Constructor takes a number of vertices, number of edges (indices) and a bitmask of optional vertex attributes.
- @c Graphic3d_ArrayOfPrimitives::AddVertex() appends a vertex with specified attributes to the end of the array (within the range specified at construction time).
- @c Graphic3d_ArrayOfPrimitives::AddEdges() appends indices, starting with 1.
Each line segment is defined by two consequential edges, each triangle is defined by three consequential edges.
Let's extend our sample and display a cylinder section contour defined by array of indexed segments (e.g. a polyline of four vertices):
~~~~{.cpp}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
const double aRadius = 100.0, aHeight = 100.0;
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (aRadius, aHeight);
if (theMode == MyDispMode_Main)
{
StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer);
//StdPrs_WFShape::Add (thePrs, aShape, myDrawer);
Handle(Graphic3d_ArrayOfSegments) aSegs = new Graphic3d_ArrayOfSegments (4, 4 * 2, Graphic3d_ArrayFlags_None);
aSegs->AddVertex (gp_Pnt (0.0, -aRadius, 0.0));
aSegs->AddVertex (gp_Pnt (0.0, -aRadius, aHeight));
aSegs->AddVertex (gp_Pnt (0.0, aRadius, aHeight));
aSegs->AddVertex (gp_Pnt (0.0, aRadius, 0.0));
aSegs->AddEdges (1, 2);
aSegs->AddEdges (2, 3);
aSegs->AddEdges (3, 4);
aSegs->AddEdges (4, 1);
Handle(Graphic3d_Group) aGroupSegs = thePrs->NewGroup();
aGroupSegs->SetGroupPrimitivesAspect (myDrawer->WireAspect()->Aspect());
aGroupSegs->AddPrimitiveArray (aSegs);
}
else if (theMode == MyDispMode_Highlight) { ... }
}
~~~~
@figure{ais_object_step2_segments.png,"Displaying @c Graphic3d_ArrayOfSegments.",409} height=409px
The process is quite straightforward:
- Create a new @c Graphic3d_Group using @c Prs3d_Presentation::NewGroup();
- Specify presentation aspects using @c Graphic3d_Group::SetGroupPrimitivesAspect();
- Create and add an array of primitives using @c Graphic3d_Group::AddPrimitiveArray().
Standard presentation builders like @c StdPrs_ShadedShape / @c StdPrs_WFShape internally do exactly the same thing - a tessellated representation of a shape is added to presentation in form of triangles (shaded),
line segments (wireframe and free edges) and markers (free shape vertices).
A single @c Graphic3d_Group normally defines just a single primitive array, but it is technically possible adding more arrays to the same group @c Graphic3d_Group::AddPrimitiveArray()
and with different aspects @c Graphic3d_Group::SetPrimitivesAspect(), which might be considered in advanced scenarios.
Method @c Graphic3d_Group::AddText() allows adding text labels to a presentation.
Internally, text labels are rendered as an array of textured triangles using texture atlas created from a font, but this complex logic is hidden from the user.
@section prim_aspects Primitive aspects
@c Graphic3d_Aspects is a class defining **display properties** of a primitive array (@c Graphic3d_Group::SetGroupPrimitivesAspect()) -
_**material**, **shading model**, **color**, **texture maps**, **blending mode**, **line width**_ and others.
There are also subclasses @c Graphic3d_AspectFillArea3d (triangles), @c Graphic3d_AspectLine3d (lines), @c Graphic3d_AspectMarker3d (markers)
and @c Graphic3d_AspectText3d (text labels) defined as specializations for a specific primitive array type.
These subclasses exist for historical reasons and are treated by renderers in exactly the same way.
It is technically possible to create transient aspects directly within @c @::Compute() method like this:
~~~~{.cpp}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
Handle(Graphic3d_Aspects) anAspects = new Graphic3d_Aspects();
anAspects->SetShadingModel (Graphic3d_TypeOfShadingModel_Unlit);
anAspects->SetColor (Quantity_NOC_RED);
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
aGroup->SetGroupPrimitivesAspect (anAspects);
...
}
~~~~
While this code would work as expected, but prevents further dynamic updates of presentation aspects without recomputing entire presentation.
Instead, it is preferred taking attributes from @c PrsMgr_PresentableObject::myDrawer / @c @::Attributes() or storing custom attributes as class fields.
@c Prs3d_Drawer defines a set of attributes used by @c AIS presentation builders, but the same parameters might be used by a custom builder as well.
It is also preferred preallocating attributes in the class constructor.
This would allow changing attributes without recomputing the entire presentation - just by calling @c PrsMgr_PresentableObject::SynchronizeAspects() after modifications.
Our custom object uses @c myDrawer->ShadingAspect() and @c myDrawer->WireAspect() aspects, so let's initialize them explicitly - assign silver material for shading and green color to line segments:
~~~~{.cpp}
MyAisObject::MyAisObject()
{
SetHilightMode (MyDispMode_Highlight);
myDrawer->SetupOwnShadingAspect();
myDrawer->ShadingAspect()->SetMaterial (Graphic3d_NameOfMaterial_Silver);
myDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_GREEN, Aspect_TOL_SOLID, 2.0));
}
~~~~
@section quadric_builders Quadric builders
Previously, we've used @c StdPrs_ShadedShape for displaying cylinder geometry.
The @c Prs3d package provides a simpler way for displaying geometry like cylinders, spheres and toruses - based on the @c Prs3d_ToolQuadric interface.
This interface allows bypassing creation of a complex B-Rep (@c TopoDS_Shape) definition of a simple geometry, and to avoid using general-purpose tessellators like @c BRepMesh.
> This difference could be negligible for a small number of such objects, but might become considerable for larger amounts.
> The B-Rep definition of a valid cylinder includes 2 unique @c TopoDS_Vertex, 3 @c TopoDS_Edge, 3 @c TopoDS_Wire, 3 @c TopoDS_Face, 1 @c TopoDS_Shell and 1 @c TopoDS_Solid.
> Internally each @c TopoDS_Edge also defines curves (@c Geom_Curve as well as 2D parametric @c Geom2d_Curve) and each @c TopoDS_Face defines analytical surface (@c Geom_Surface).
> Meshing such geometry with the help of @c BRepMesh is much more complicated than one may think.
> A plenty of data structures (memory!) and computations (time!) for displaying a geometry that could be triangulated by a simple for loop.
@c Prs3d_ToolQuadric solves this problem by creating a triangulation for such kinds of shapes in a straight-forward way.
Let's try using @c Prs3d_ToolCylinder in our sample:
~~~~{.cpp}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
const double aRadius = 100.0, aHeight = 100.0;
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (aRadius, aHeight);
if (theMode == MyDispMode_Main)
{
//StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer); // add shading
//StdPrs_WFShape::Add (thePrs, aShape, myDrawer); // add wireframe
Handle(Graphic3d_ArrayOfTriangles) aTris =
Prs3d_ToolCylinder::Create (aRadius, aRadius, aHeight, 10, 10, gp_Trsf());
Handle(Graphic3d_Group) aGroupTris = thePrs->NewGroup();
aGroupTris->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
aGroupTris->AddPrimitiveArray (aTris);
...
}
...
}
~~~~
@figure{ais_object_step3_quadrics_10.png,"@c Prs3d_ToolCylinder (10 slices).",409} height=409px
Well... that looks a little bit edgy.
Quadric builder creates a triangulation taking the following parameters:
- Geometry parameters.
(in case of a cylinder - base radius, top radius and height).
- Number of subdivisions along U (slices) and V (stacks) parameters.
In some cases only one parametric scope matters.
- Transformation @c gp_Trsf to apply
(original geometry is defined within some reference coordinate system).
Let's increase number of subdivisions from _10_ to _25_:
~~~~{.cpp}
Handle(Graphic3d_ArrayOfTriangles) aTris =
Prs3d_ToolCylinder::Create (aRadius, aRadius, aHeight, 25, 25, gp_Trsf());
~~~~
@figure{ais_object_step3_quadrics_25.png,"@c Prs3d_ToolCylinder (25 slices).",409} height=409px
It looks much better now! Note that @c Prs3d_ToolCylinder could be used for building both cones and cylinders depending on top/bottom radius definition.
There is one issue though - our cylinder doesn't have top and bottom anymore!
To fix this problem we will use one more quadric builder @c Prs3d_ToolDisk:
~~~~{.cpp}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
const double aRadius = 100.0, aHeight = 100.0;
if (theMode == MyDispMode_Main)
{
Prs3d_ToolCylinder aCyl (aRadius, aRadius, aHeight, 25, 25);
Prs3d_ToolDisk aDisk (0.0, aRadius, 25, 1);
Handle(Graphic3d_ArrayOfTriangles) aTris =
new Graphic3d_ArrayOfTriangles (aCyl.VerticesNb() + 2 * aDisk.VerticesNb(),
3 * (aCyl.TrianglesNb() + 2 * aDisk.TrianglesNb()),
Graphic3d_ArrayFlags_VertexNormal);
aCyl .FillArray (aTris, gp_Trsf());
aDisk.FillArray (aTris, gp_Trsf());
gp_Trsf aDisk2Trsf;
aDisk2Trsf.SetTransformation (gp_Ax3 (gp_Pnt (0.0, 0.0, aHeight), -gp::DZ(), gp::DX()), gp::XOY());
aDisk.FillArray (aTris, aDisk2Trsf);
Handle(Graphic3d_Group) aGroupTris = thePrs->NewGroup();
aGroupTris->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
aGroupTris->AddPrimitiveArray (aTris);
aGroupTris->SetClosed (true);
...
}
}
~~~~
Now our cylinder looks solid! The sample above merges two triangulations into a single one instead of appending each primitive array individually.
This looks like a minor difference, but it might have a _dramatic impact on performance_ in case of a large scene,
as each `Graphic3d_ArrayOfPrimitives` is mapped into a dedicated draw call at graphic driver (OpenGL) level.
@figure{ais_object_step3_quadrics_fin.png,"@c Prs3d_ToolCylinder + @c Prs3d_ToolDisk.",409} height=409px
As an exercise, let's try computing a triangulation for cylinder disk without help of @c Prs3d_ToolDisk builder:
~~~~{.cpp}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
const double aRadius = 100.0, aHeight = 100.0;
if (theMode == MyDispMode_Main)
{
const int aNbSlices = 25;
Prs3d_ToolCylinder aCyl (aRadius, aRadius, aHeight, aNbSlices, aNbSlices);
Handle(Graphic3d_ArrayOfTriangles) aTris =
new Graphic3d_ArrayOfTriangles (aCyl.VerticesNb(),
3 * (aCyl.TrianglesNb()),
Graphic3d_ArrayFlags_VertexNormal);
aCyl.FillArray (aTris, gp_Trsf());
Handle(Graphic3d_ArrayOfTriangles) aTris2 =
new Graphic3d_ArrayOfTriangles (aNbSlices + 1, aNbSlices * 3, Graphic3d_ArrayFlags_VertexNormal);
aTris2->AddVertex (gp_Pnt (0.0, 0.0, aHeight), -gp::DZ());
for (int aSliceIter = 0; aSliceIter < aNbSlices; ++aSliceIter)
{
double anAngle = M_PI * 2.0 * double(aSliceIter) / double(aNbSlices);
aTris2->AddVertex (gp_Pnt (Cos (anAngle) * aRadius, Sin (anAngle) * aRadius, aHeight), -gp::DZ());
}
for (int aSliceIter = 0; aSliceIter < aNbSlices; ++aSliceIter)
{
aTris2->AddEdges (1, aSliceIter + 2, aSliceIter + 1 < aNbSlices ? (aSliceIter + 3) : 2);
}
Handle(Graphic3d_Group) aGroupTris = thePrs->NewGroup();
aGroupTris->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
aGroupTris->AddPrimitiveArray (aTris);
aGroupTris->AddPrimitiveArray (aTris2);
...
}
}
~~~~
@figure{ais_object_step3_quadrics_disk.png,"Manually triangulated disk.",409} height=409px
The disk is here, but it has a strange color - like it is not affected by lighting.
This happens when vertex normals are defined incorrectly.
In our case we defined disk normal as @c -DZ (see the second argument of @c Graphic3d_ArrayOfTriangles::AddVertex()),
but normal direction should be also aligned to triangulation winding rule.
Graphic driver defines the front side of triangle using clockwise order of triangle nodes, and normal should be defined for a front side of triangle - e.g. it should be @c gp::DZ() in our case.
After reversing vertex normal direction, cylinder looks exactly like when @c Prs3d_ToolDisk was used.
Front / back face orientation might be displayed using different material based on @c Graphic3d_Aspects::SetDistinguish() flag and @c @::FrontMaterial() / @c @::BackMaterial() setup.
@section ais_selection Computing selection
In the first part of the tutorial we have created a custom @c AIS object @c MyAisObject computing presentation by implementing the @c PrsMgr_PresentableObject::Compute() interface.
In this part we will extend our object with interactive capabilities and make it selectable through implementing @c SelectMgr_SelectableObject interface.
Let's do the first step and put into @c @::ComputeSelection() method some logic.
This method should fill in the @c SelectMgr_Selection argument with @c SelectMgr_SensitiveEntity entities defining selectable elements - triangulations, polylines, points and their composition.
@c Select3D_SensitiveBox is probably the simplest way to define selectable volume - by it's bounding box:
~~~~{.cpp}
void MyAisObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode)
{
const double aRadius = 100.0, aHeight = 100.0;
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (aRadius, aHeight);
Bnd_Box aBox;
BRepBndLib::Add (aShape, aBox);
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (this);
Handle(Select3D_SensitiveBox) aSensBox = new Select3D_SensitiveBox (anOwner, aBox);
theSel->Add (aSensBox);
}
~~~~
@c SelectMgr_EntityOwner is a key object in selection logic - it serves as an identifier of a pickable object or it's part.
You may see this object in methods like @c AIS_InteractiveContext::DetectedOwner(), **Owners** are stored within the list of selection objects @c AIS_Selection
and it received by methods like @c AIS_InteractiveContext::SetSelected() and @c AIS_InteractiveContext::AddOrRemoveSelected().
From the Selector's point of view, @c AIS_InteractiveObject is just a drawer for @c SelectMgr_EntityOwner.
The _**0th selection mode**_ normally defines a single Owner of the entire object.
To make a composite object selectable as whole, we add to Selection as many SensitiveEntity as necessary referring to the same Owner.
It might look confusing from first glance, that @c SelectMgr_SensitiveEntity stores @c SelectMgr_EntityOwner as a class field, and not in the opposite way
(@c SelectMgr_EntityOwner doesn't store the list of @c SelectMgr_SensitiveEntity defining it's picking volume).
For local selection (selection of object parts) we create individual Owners for each part and add SensitiveEntity to Selection in the same way.
Owner may store an additional identifier as a class field, like @c StdSelect_BRepOwner stores @c TopoDS_Shape as an identifier of picked sub-shape with @c AIS_Shape object.
In a similar way as @c StdPrs_ShadedShape is a **presentation builder** for @c TopoDS_Shape, the @c StdSelect_BRepSelectionTool can be seen as a standard **selection builder** for shapes:
~~~~{.cpp}
void MyAisObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode)
{
const double aRadius = 100.0, aHeight = 100.0;
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (aRadius, aHeight);
Standard_Real aDefl = StdPrs_ToolTriangulatedShape::GetDeflection (aShape, myDrawer);
StdSelect_BRepSelectionTool::Load (theSel, this, aShape, TopAbs_SHAPE, aDefl,
myDrawer->DeviationAngle(),
myDrawer->IsAutoTriangulation());
}
~~~~
Internally, @c StdSelect_BRepSelectionTool iterates over sub-shapes and appends to the Selection (@c theSel) entities like @c Select3D_SensitiveTriangulation (for faces) and @c Select3D_SensitiveCurve (for edges).
Previously, we have used @c Prs3d_ToolCylinder to triangulate a cylinder, so let's try to construct @c Select3D_SensitivePrimitiveArray from the same triangulation:
~~~~{.cpp}
void MyAisObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode)
{
const double aRadius = 100.0, aHeight = 100.0;
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (this);
Handle(Graphic3d_ArrayOfTriangles) aTris =
Prs3d_ToolCylinder::Create (aRadius, aRadius, aHeight, 25, 25, gp_Trsf());
Handle(Select3D_SensitivePrimitiveArray) aSensTri =
new Select3D_SensitivePrimitiveArray (anOwner);
aSensTri->InitTriangulation (aTris->Attributes(), aTris->Indices(),
TopLoc_Location());
theSel->Add (aSensTri);
}
~~~~
Selection is computed independently from presentation, so that they don't have to match each other.
But inconsistency between presentation and selection might confuse a user, when he will not be able to pick an object clearly displayed under the mouse cursor.
These issues might happen, for example, when selection uses tessellated representation of the same geometry computed with different parameters (different number of subdivisions, or different deflection parameters).
As in case of @c @::Compute(), it makes sense defining some enumeration of **selection modes** supported by specific object and reject unsupported ones to avoid unexpected behavior:
~~~~{.cpp}
void MyAisObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode)
{
if (theMode != 0) { return; }
...
}
~~~~
Unlike display modes, @c AIS_InteractiveContext allows activating an arbitrary combination of selection modes.
A user should be careful to activate only the modes that actually make sense and may work together.
Selection mode to activate could be specified while displaying the object (passing _**-1**_ instead of _**0**_ would display an object with deactivated selection):
~~~~{.cpp}
Handle(AIS_InteractiveContext) theCtx;
Handle(MyAisObject) aPrs = new MyAisObject();
theCtx->Display (aPrs, MyAisObject::MyDispMode_Main, 0, false);
~~~~
Later on @c AIS_InteractiveContext::SetSelectionModeActive(), or it's wrappers @c AIS_InteractiveContext::Activate() and @c AIS_InteractiveContext::Deactivate(),
could be used to enable or disable desired selection modes one by one.
@section sel_owner_highlight Highlighting selection owner
As has been mentioned in the previous section, @c SelectMgr_EntityOwner is a key object which can be used as an identifier of selectable part(s).
Naturally, you might want to subclass it to put some application-specific ids for identification of selected parts.
But there are more things you may do with the Owner class like customized highlighting.
Let's start from the beginning and define a custom Owner class:
~~~~{.cpp}
class MyAisOwner : public SelectMgr_EntityOwner
{
DEFINE_STANDARD_RTTI_INLINE(MyAisOwner, SelectMgr_EntityOwner)
public:
MyAisOwner (const Handle(MyAisObject)& theObj, int thePriority = 0)
: SelectMgr_EntityOwner (theObj, thePriority) {}
virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode) override
{ base_type::HilightWithColor (thePrsMgr, theStyle, theMode); }
virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Standard_Integer theMode) override
{ base_type::Unhilight (thePrsMgr, theMode); }
protected:
Handle(Prs3d_Presentation) myPrs;
};
~~~~
@c SelectMgr_EntityOwner doesn't define any pure virtual methods, and can be instanced straight ahead, like it was done within @c MyAisObject::ComputeSelection() implementation above.
Let's revert usage of a dedicated display mode for highlighting (remove @c SetHilightMode() in @c MyAisObject constructor) and use our new class @c MyAisOwner within @c @::ComputeSelection():
~~~~{.cpp}
MyAisObject::MyAisObject()
{
//SetHilightMode (MyDispMode_Highlight);
myDrawer->SetupOwnShadingAspect();
...
}
void MyAisObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode)
{
const double aRadius = 100.0, aHeight = 100.0;
Handle(MyAisOwner) anOwner = new MyAisOwner (this);
...
}
~~~~
The further logic creating sensitive entities and filling in Selection could be left as is.
Substitution of @c SelectMgr_EntityOwner with @c MyAisOwner currently doesn't change behavior and we see highlighting of the entire object through color modulation.
This is because default implementation of @c SelectMgr_EntityOwner for highlighting logic looks like this (simplified):
~~~~{.cpp}
void SelectMgr_EntityOwner::HilightWithColor (
const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode)
{
const Graphic3d_ZLayerId aHiLayer =
theStyle->ZLayer() != Graphic3d_ZLayerId_UNKNOWN
? theStyle->ZLayer()
: mySelectable->ZLayer();
thePrsMgr->Color (mySelectable, theStyle, theMode, NULL, aHiLayer);
}
~~~~
@figure{ais_object_step4_highlight1.png,"Default behavior of @c SelectMgr_EntityOwner::HilightWithColor().",409} height=409px
Now, let's override the @c SelectMgr_EntityOwner::HilightWithColor() method and display a bounding box presentation:
~~~~{.cpp}
void MyAisOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode)
{
if (myPrs.IsNull())
{
myPrs = new Prs3d_Presentation (thePrsMgr->StructureManager());
MyAisObject* anObj = dynamic_cast<MyAisObject*> (mySelectable);
anObj->Compute (thePrsMgr, myPrs, MyAisObject::MyDispMode_Highlight);
}
if (!thePrsMgr->IsImmediateModeOn())
{
myPrs->Display();
}
}
~~~~
@c SelectMgr_EntityOwner::HilightWithColor() doesn't receive a presentation to fill in as an argument; highlight presentation should be manually created and even explicitly displayed on the screen.
To avoid code duplication, the code above reuses @c MyAisObject::Compute() already implementing computation of highlight presentation.
@figure{ais_object_step4_highlight2.png,"Result of custom implementation @c MyAisOwner::HilightWithColor().",409} height=409px
The visual result of the selected object looks exactly the same as when we've used a dedicated highlight mode.
One thing became broken, though - highlighting remains displayed even after clearing selection.
To fix this issue, we need implementing @c SelectMgr_EntityOwner::Unhilight() and hide our custom presentation explicitly:
~~~~{.cpp}
void MyAisOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Standard_Integer theMode)
{
if (!myPrs.IsNull()) { myPrs->Erase(); }
}
~~~~
Another problem is that the object is no longer dynamically highlighted.
To fix that we need to handle @c PrsMgr_PresentationManager::IsImmediateModeOn() specifically.
Within this mode turned ON, presentation should be displayed on the screen with help of @c PrsMgr_PresentationManager::AddToImmediateList() method
(it will be cleared from the screen automatically on the next mouse movement):
~~~~{.cpp}
void MyAisOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode)
{
if (myPrs.IsNull())
{
myPrs = new Prs3d_Presentation (thePrsMgr->StructureManager());
MyAisObject* anObj = dynamic_cast<MyAisObject*> (mySelectable);
anObj->Compute (thePrsMgr, myPrs, MyAisObject::MyDispMode_Highlight);
}
if (thePrsMgr->IsImmediateModeOn())
{
Handle(Prs3d_PresentationShadow) aShadow =
new Prs3d_PresentationShadow (thePrsMgr->StructureManager(), myPrs);
aShadow->SetZLayer (Graphic3d_ZLayerId_Top);
aShadow->Highlight (theStyle);
thePrsMgr->AddToImmediateList (aShadow);
}
else
{
myPrs->Display();
}
}
~~~~
We may create two dedicated presentations for dynamic highlighting or reuse existing one for both cases with help of a transient object @c Prs3d_PresentationShadow.
Let's go further and make dynamic highlighting a little bit more interesting - by drawing a surface normal at the point where mouse picked the object:
~~~~{.cpp}
void MyAisOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode)
{
MyAisObject* anObj = dynamic_cast<MyAisObject*> (mySelectable);
if (thePrsMgr->IsImmediateModeOn())
{
Handle(StdSelect_ViewerSelector) aSelector =
anObj->InteractiveContext()->MainSelector();
SelectMgr_SortCriterion aPickPnt;
for (int aPickIter = 1; aPickIter <= aSelector->NbPicked(); ++aPickIter)
{
if (aSelector->Picked (aPickIter) == this)
{
aPickPnt = aSelector->PickedData (aPickIter);
break;
}
}
Handle(Prs3d_Presentation) aPrs = mySelectable->GetHilightPresentation (thePrsMgr);
aPrs->SetZLayer (Graphic3d_ZLayerId_Top);
aPrs->Clear();
Handle(Graphic3d_Group) aGroup = aPrs->NewGroup();
aGroupPnt->SetGroupPrimitivesAspect (theStyle->ArrowAspect()->Aspect());
gp_Trsf aTrsfInv = mySelectable->LocalTransformation().Inverted();
gp_Dir aNorm (aPickPnt.Normal.x(), aPickPnt.Normal.y(), aPickPnt.Normal.z());
Handle(Graphic3d_ArrayOfTriangles) aTris =
Prs3d_Arrow::DrawShaded (gp_Ax1(aPickPnt.Point, aNorm).Transformed (aTrsfInv),
1.0, 15.0,
3.0, 4.0, 10);
aGroupPnt->AddPrimitiveArray (aTris);
thePrsMgr->AddToImmediateList (aPrs);
}
}
~~~~
Code above does not store our new highlight presentation as a property of @c MyAisOwner, and instead uses @c SelectMgr_SelectableObject::GetHilightPresentation() method
to create a presentation stored directly inside of our interactive object.
Next trick is passing through the last picking results in @c StdSelect_ViewerSelector.
Dynamic highlighting is expected to be called right after picking, so that highlighted Owner should be always found in picking results.
@c StdSelect_ViewerSelector::Picked() returns entities in the descending order of their distance from picking ray origin (mouse cursor);
normally our Owner should be the very first one in this list when no selection filters are assigned to @c AIS_InteractiveContext.
@c SelectMgr_SortCriterion provides us useful information like 3D point on detected object lying on the picking ray, and surface normal direction at this point (actually, it would be a normal to a picked triangle),
which we display as an arrow with help of @c Prs3d_Arrow presentation builder.
@figure{ais_object_step4_highlight3.png,"Surface normal on mouse over.",409} height=409px
Result looks pretty nice on the screenshot, but has interaction problems - once displayed, an arrow is no longer updated with further mouse movements.
But this behavior is not a bug - @c AIS calls @c MyAisOwner::HilightWithColor() only when picking Owner changes to avoid unnecessary Viewer updates.
To override this behavior, we may override @c SelectMgr_EntityOwner::IsForcedHilight() option:
~~~~{.cpp}
class MyAisOwner : public SelectMgr_EntityOwner
{
...
virtual bool IsForcedHilight() const override { return true; }
};
~~~~
This solves the problem within our specific use case.
Keep in mind that most objects don't need updating highlight presentation on every mouse move;
overriding this flag everywhere would be a waste of resources and may cause performance issues - use it sparingly.
@section highlight_apporaches Highlighting approaches
@c AIS provides one more alternative to handle presentation highlighting, which is managed by option @c SelectMgr_SelectableObject::IsAutoHilight().
By default, this option is turned ON and redirects highlighting logic to @c SelectMgr_EntityOwner::HilightWithColor() demonstrated in the previous section.
Turning this option OFF redirects highlighting logic to the interactive object itself @c SelectMgr_SelectableObject::HilightSelected().
Apart from moving the logic from Owner to Interactive Object, this approach allows handling highlighting of all selected Owners within the same Object at once and sharing a common presentation
instead of per-Owner presentation - improving performance and reducing memory utilization in case of a large number of small selectable elements, like mesh nodes in @c MeshVS_Mesh object.
The further optimization of such a scenario would be using a single Owner for the entire Object
storing the list of selected elements within the Owner itself - as utilized by @c AIS_PointCloud object for highlighting individual points.
We wouldn't describe these advanced techniques here in detail - let's just summarize main highlighting approaches available in @c AIS:
- Highlighting of a main presentation of Interactive Object (active display mode)
filled in by @c PrsMgr_PresentableObject::Compute()
and displayed with color modulation by @c AIS logic.
- Example: @c AIS_TextLabel.
- Highlighting of a secondary presentation of Interactive Object
filled in by @c PrsMgr_PresentableObject::Compute()
and displayed with color modulation by @c AIS logic.
- Example: @c AIS_Shape, displayed in @c AIS_Shaded display mode and highlighted using @c AIS_Wireframe display mode (default behavior).
See also @c PrsMgr_PresentableObject::SetHilightMode().
- Highlight presentation stored within a custom @c SelectMgr_EntityOwner
and managed by @c SelectMgr_EntityOwner::HilightWithColor().
- Example: @c StdSelect_BRepOwner for selection of sub-shapes.
- Custom highlight presentation stored within Interactive Object itself
(see @c SelectMgr_SelectableObject::GetHilightPresentation() / @c @::GetSelectPresentation() methods).
- Filled in by @c SelectMgr_EntityOwner::HilightWithColor()
with @c SelectMgr_SelectableObject::IsAutoHilight() turned ON.<br>
Example: @c AIS_PointCloud.
- Filled in by @c SelectMgr_SelectableObject::HilightSelected()
with @c SelectMgr_SelectableObject::IsAutoHilight() turned OFF.<br>
Example: @c MeshVS_Mesh.
- Main presentation of Interactive Object (active display mode)
filled in by @c PrsMgr_PresentableObject::Compute()
and manually updated (recomputed or modified aspects) on highlight events.
- Example: @c AIS_Manipulator.
The number of options looks overwhelming but in general, it is better to stick to the simplest approach working for you and consider alternatives only when you have to.
@section mouse_click Mouse click
Dynamic highlighting is only one of scenarios where @c SelectMgr_EntityOwner could be useful.
Another feature is an interface for handling a mouse click @c SelectMgr_EntityOwner @c @::HandleMouseClick().
This interface is useful for defining some user interface elements like buttons, and most likely your application will use a more comprehensive GUI framework for this purpose instead of @c AIS.
But let's have some fun and make our object to change a color on each mouse click:
~~~~{.cpp}
class MyAisOwner : public SelectMgr_EntityOwner
{
...
virtual bool HandleMouseClick (const Graphic3d_Vec2i& thePoint,
Aspect_VKeyMouse theButton,
Aspect_VKeyFlags theModifiers,
bool theIsDoubleClick) override;
};
bool MyAisOwner::HandleMouseClick (const Graphic3d_Vec2i& thePoint,
Aspect_VKeyMouse theButton,
Aspect_VKeyFlags theModifiers,
bool theIsDoubleClick)
{
static math_BullardGenerator aRandGen;
Quantity_Color aRandColor (float(aRandGen.NextInt() % 256) / 255.0f,
float(aRandGen.NextInt() % 256) / 255.0f,
float(aRandGen.NextInt() % 256) / 255.0f,
Quantity_TOC_sRGB);
mySelectable->Attributes()->ShadingAspect()->SetColor(aRandColor);
mySelectable->SynchronizeAspects();
return true;
}
~~~~
Looks pretty simple. Now let's make things more interesting and launch some simple object animation on each click.
We use a couple of global (@c static) variables in our sample for simplicity - don't do that in a real production code.
~~~~{.cpp}
class MyAisOwner : public SelectMgr_EntityOwner
{
...
void SetAnimation (const Handle(AIS_Animation)& theAnim)
{ myAnim = theAnim; }
...
Handle(AIS_Animation) myAnim;
};
bool MyAisOwner::HandleMouseClick (const Graphic3d_Vec2i& thePoint,
Aspect_VKeyMouse theButton,
Aspect_VKeyFlags theModifiers,
bool theIsDoubleClick)
{
static bool isFirst = true;
isFirst = !isFirst;
MyAisObject* anObj = dynamic_cast<MyAisObject*> (mySelectable);
gp_Trsf aTrsfTo;
aTrsfTo.SetRotation (gp_Ax1 (gp::Origin(), gp::DX()),
isFirst ? M_PI * 0.5 : -M_PI * 0.5);
gp_Trsf aTrsfFrom = anObj->LocalTransformation();
Handle(AIS_AnimationObject) anAnim =
new AIS_AnimationObject ("MyAnim", anObj->InteractiveContext(),
anObj, aTrsfFrom, aTrsfTo);
anAnim->SetOwnDuration (2.0);
myAnim->Clear();
myAnim->Add (anAnim);
myAnim->StartTimer (0.0, 1.0, true);
return true;
}
~~~~
Animation is a complex topic that is worth a dedicated article - let's not go too deep in detail here.
To perform animation in a non-interrupted way, it should be handled by some class like @c AIS_ViewController, which is responsible for managing user input events and for 3D viewer updates.
To utilize it, you need adding a custom object animation to @c AIS_ViewController::ObjectsAnimation() or adding custom view animation to @c AIS_ViewController::ViewAnimation().
Somewhere in application this might look like this:
~~~~{.cpp}
Handle(AIS_InteractiveContext) theCtx;
Handle(AIS_ViewController) theViewCtrl;
Handle(MyAisObject) aPrs = new MyAisObject();
aPrs->SetAnimation (theViewCtrl->ObjectsAnimation());
theCtx->Display (aPrs, MyAisObject::MyDispMode_Main, 0, false);
~~~~
@section final Final result
The final sample could be seen by calling @c QATutorialAisObject command from Draw Harness plugin @c QAcommands (@c TKQADraw toolkit):
~~~~
pload VISUALIZATION QAcommands
vinit View1
QATutorialAisObject p
vfit
~~~~
You may also take a look onto source code of this command at @c src/QADraw/QADraw_Tutorials.cxx if you have some problems following the tutorial.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

View File

@@ -1,76 +1,82 @@
OCAF: Usage Tutorial {#samples__ocaf}
========
## Getting Started
At the beginning of your development, you first define an application class by inheriting from the Application abstract class.
You only have to create and determine the resources of the application for specifying the format of your documents (you generally use the standard one) and their file extension.
Then, you design the application data model by organizing attributes you choose among those provided with OCAF.
You can specialize these attributes using the User attribute. For example, if you need a reflection coefficient,
you aggregate a User attribute identified as a reflection coefficient
with a Real attribute containing the value of the coefficient (as such, you don't define a new class).
If you need application specific data not provided with OCAF, for example, to incorporate a finite element model in the data structure,
you define a new attribute class containing the mesh, and you include its persistent homologue in a new file format.
Once you have implemented the commands which create and modify the data structure according to your specification, OCAF provides you, without any additional programming:
* Persistent reference to any data, including geometric elements - several documents can be linked with such reference;
* Document-View association;
* Ready-to-use functions such as:
* Undo-redo;
* Save and open application data.
Finally, you develop the application's graphical user interface using the toolkit of your choice, for example:
* KDE Qt or GNOME GTK+ on Linux;
* Microsoft Foundation Classes (MFC) on Windows Motif on Sun;
* Other commercial products such as Ilog Views.
You can also implement the user interface in the Java language using the Swing-based Java Application Desktop component (JAD) provided with OCAF.
## Getting Started
At the beginning of your development, you first define an application class by inheriting from the Application abstract class.
You only have to create and determine the resources of the application
for specifying the format of your documents (you generally use the standard one) and their file extension.
Then, you design the application data model by organizing attributes you choose among those provided with OCAF.
You can specialize these attributes using the User attribute. For example, if you need a reflection coefficient,
you aggregate a User attribute identified as a reflection coefficient
with a Real attribute containing the value of the coefficient (as such, you don't define a new class).
If you need application specific data not provided with OCAF, for example,
to incorporate a finite element model in the data structure,
you define a new attribute class containing the mesh,
and you include its persistent homologue in a new file format.
Once you have implemented the commands which create and modify the data structure
according to your specification, OCAF provides you, without any additional programming:
* Persistent reference to any data, including geometric elements â€" several documents can be linked with such reference;
* Document-View association;
* Ready-to-use functions such as :
* Undo-redo;
* Save and open application data.
Finally, you develop the application's graphical user interface using the toolkit of your choice, for example:
* KDE Qt or GNOME GTK+ on Linux;
* Microsoft Foundation Classes (MFC) on Windows Motif on Sun;
* Other commercial products such as Ilog Views.
You can also implement the user interface in the Java language using
the Swing-based Java Application Desktop component (JAD) provided with OCAF.
## An example of OCAF usage
To create a useful OCAF-based application, it is necessary to redefine two deferred methods: <i>Formats</i> and <i>ResourcesName</i>
To create a useful OCAF-based application, it is necessary to redefine two deferred methods: <i> Formats</i> and <i> ResourcesName</i>
In the <i>Formats</i> method, add the format of the documents, which need to be read by the application and may have been built in other applications.
In the <i> Formats </i> method, add the format of the documents, which need to be read by the application and may have been built in other applications.
For example:
~~~~{.cpp}
~~~~
void myApplication::Formats(TColStd_SequenceOfExtendedString& Formats)
{
Formats.Append(TCollection_ExtendedString ("OCAF-myApplication"));
}
~~~~
In the <i>ResourcesName</i> method, you only define the name of the resource file.
This file contains several definitions for the saving and opening mechanisms associated with each format and calling of the plug-in file.
In the <i> ResourcesName</i> method, you only define the name of the resource file. This
file contains several definitions for the saving and opening mechanisms associated
with each format and calling of the plug-in file.
~~~~{.cpp}
~~~~
Standard_CString myApplication::ResourcesName()
{
return Standard_CString ("Resources");
}
~~~~
To obtain the saving and opening mechanisms, it is necessary to set two environment variables: <i>CSF_PluginDefaults</i>, which defines the path of the plug-in file,
and <i>CSF_ResourcesDefault</i>, which defines the resource file:
To obtain the saving and opening mechanisms, it is necessary to set two environment variables: <i> CSF_PluginDefaults</i>, which defines the path of the plug-in file, and <i> CSF_ResourcesDefault</i>, which defines the resource file:
~~~~{.cpp}
SetEnvironmentVariable ("CSF_ResourcesDefaults", myDirectory);
SetEnvironmentVariable ("CSF_PluginDefaults", myDirectory);
~~~~
SetEnvironmentVariable ( "CSF_ResourcesDefaults",myDirectory);
SetEnvironmentVariable ( "CSF_PluginDefaults",myDirectory);
~~~~
The plugin and the resource files of the application will be located in <i>myDirector</i>.
The plugin and the resource files of the application will be located in <i> myDirector</i>.
The name of the plugin file must be <i>Plugin</i>.
### Resource File
The resource file describes the documents (type and extension) and the type of data that the application can manipulate
The resource file describes the documents (type and extension) and
the type of data that the application can manipulate
by identifying the storage and retrieval drivers appropriate for this data.
Each driver is unique and identified by a GUID generated, for example, with the <i>uuidgen</i> tool in Windows.
Each driver is unique and identified by a GUID generated, for example, with the <i> uuidgen </i> tool in Windows.
Five drivers are required to use all standard attributes provided within OCAF:
@@ -80,7 +86,8 @@ Five drivers are required to use all standard attributes provided within OCAF:
* the attribute storage driver (47b0b826-d931-11d1-b5da-00a0c9064368)
* the attribute retrieval driver (47b0b827-d931-11d1-b5da-00a0c9064368)
These drivers are provided as plug-ins and are located in the <i>PappStdPlugin</i> library.
These drivers are provided as plug-ins and are located in the <i> PappStdPlugin</i> library.
For example, this is a resource file, which declares a new model document OCAF-MyApplication:
@@ -97,11 +104,12 @@ OCAF-MyApplication.AttributeRetrievalPlugin: 47b0b827-d931-11d1-b5da-00a0c906436
### Plugin File
The plugin file describes the list of required plug-ins to run the application and the libraries in which plug-ins are located.
The plugin file describes the list of required plug-ins to run the application and the
libraries in which plug-ins are located.
You need at least the <i>FWOSPlugin</i> and the plug-in drivers to run an OCAF application.
You need at least the <i> FWOSPlugin</i> and the plug-in drivers to run an OCAF application.
The syntax of each item is <i>Identification.Location Library_Name</i>, where:
The syntax of each item is <i> Identification.Location Library_Name, </i> where:
* Identification is GUID.
* Location defines the location of the Identification (where its definition is found).
* Library_Name is the name (and path to) the library, where the plug-in is located.
@@ -117,414 +125,412 @@ ad696002-5b34-11d1-b5ba-00a0c9064368.Location: PAppStdPlugin
47b0b826-d931-11d1-b5da-00a0c9064368.Location: PAppStdPlugin
47b0b827-d931-11d1-b5da-00a0c9064368.Location: PAppStdPlugin
~~~~
## Implementation of Attribute Transformation in a HXX file
~~~~{.cpp}
#include <TDF_Attribute.hxx>
~~~~
\#include <TDF_Attribute.hxx>
#include <gp_Ax3.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <gp_Trsf.hxx>
\#include <gp_Ax3.hxx>
\#include <gp_Pnt.hxx>
\#include <gp_Vec.hxx>
\#include <gp_Trsf.hxx>
//! This attribute implements a transformation data container
class MyPackage_Transformation : public TDF_Attribute
{
public: //!@ name Static methods
public:
//!@ name Static methods
//! The method returns a unique GUID of this attribute.
//! By means of this GUID this attribute may be identified
//! among other attributes attached to the same label.
//! The method returns a unique GUID of this attribute.
//! By means of this GUID this attribute may be identified
//! among other attributes attached to the same label.
Standard_EXPORT static const Standard_GUID& GetID ();
//! Finds or creates the attribute attached to <theLabel>.
//! The found or created attribute is returned.
//! Finds or creates the attribute attached to <theLabel>.
//! The found or created attribute is returned.
Standard_EXPORT static Handle(MyPackage_Transformation) Set (const TDF_Label theLabel);
public: //!@ name Methods for access to the attribute data
//!@ name Methods for access to the attribute data
//! The method returns the transformation.
Standard_EXPORT gp_Trsf Get () const;
//! The method returns the transformation.
Standard_EXPORT gp_Trsf Get () const;
//!@ name Methods for setting the data of transformation
public: //!@ name Methods for setting the data of transformation
//! The method defines a rotation type of transformation.
Standard_EXPORT void SetRotation (const gp_Ax1& theAxis, Standard_Real theAngle);
//! The method defines a rotation type of transformation.
Standard_EXPORT void SetRotation (const gp_Ax1& theAxis, Standard_Real theAngle);
//! The method defines a translation type of transformation.
Standard_EXPORT void SetTranslation (const gp_Vec& theVector);
//! The method defines a translation type of transformation.
Standard_EXPORT void SetTranslation (const gp_Vec& theVector);
//! The method defines a point mirror type of transformation (point symmetry).
Standard_EXPORT void SetMirror (const gp_Pnt& thePoint);
//! The method defines a point mirror type of transformation (point symmetry).
Standard_EXPORT void SetMirror (const gp_Pnt& thePoint);
//! The method defines an axis mirror type of transformation (axial symmetry).
Standard_EXPORT void SetMirror (const gp_Ax1& theAxis);
//! The method defines an axis mirror type of transformation (axial symmetry).
Standard_EXPORT void SetMirror (const gp_Ax1& theAxis);
//! The method defines a point mirror type of transformation (planar symmetry).
Standard_EXPORT void SetMirror (const gp_Ax2& thePlane);
//! The method defines a point mirror type of transformation (planar symmetry).
Standard_EXPORT void SetMirror (const gp_Ax2& thePlane);
//! The method defines a scale type of transformation.
Standard_EXPORT void SetScale (const gp_Pnt& thePoint, Standard_Real theScale);
//! The method defines a scale type of transformation.
Standard_EXPORT void SetScale (const gp_Pnt& thePoint, Standard_Real theScale);
//! The method defines a complex type of transformation from one coordinate system to another.
Standard_EXPORT void SetTransformation (const gp_Ax3& theCoordinateSystem1, const gp_Ax3& theCoordinateSystem2);
Standard_EXPORT void SetTransformation (const gp_Ax3& theCoordinateSystem1, const gp_Ax3& theCoordinateSystem2);
public: //!@ name Overridden methods from TDF_Attribute
//!@ name Overridden methods from TDF_Attribute
//! The method returns a unique GUID of the attribute.
//! By means of this GUID this attribute may be identified among other attributes attached to the same label.
Standard_EXPORT const Standard_GUID& ID () const;
//! The method returns a unique GUID of the attribute.
//! By means of this GUID this attribute may be identified among other attributes attached to the same label.
Standard_EXPORT const Standard_GUID& ID () const;
//! The method is called on Undo / Redo.
//! It copies the content of theAttribute into this attribute (copies the fields).
Standard_EXPORT void Restore (const Handle(TDF_Attribute)& theAttribute);
//! The method is called on Undo / Redo.
//! It copies the content of theAttribute into this attribute (copies the fields).
Standard_EXPORT void Restore (const Handle(TDF_Attribute)& theAttribute);
//! It creates a new instance of this attribute.
//! It is called on Copy / Paste, Undo / Redo.
//! It creates a new instance of this attribute.
//! It is called on Copy / Paste, Undo / Redo.
Standard_EXPORT Handle(TDF_Attribute) NewEmpty () const;
//! The method is called on Copy / Paste.
//! It copies the content of this attribute into theAttribute (copies the fields).
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& theAttribute, const Handle(TDF_RelocationTable)& theRelocationTable);
//! The method is called on Copy / Paste.
//! It copies the content of this attribute into theAttribute (copies the fields).
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& theAttribute, const Handle(TDF_RelocationTable)& theRelocationTable);
//! Prints the content of this attribute into the stream.
//! Prints the content of this attribute into the stream.
Standard_EXPORT Standard_OStream& Dump(Standard_OStream& theOS);
public: //!@ name Constructor
//!@ name Constructor
//! The C++ constructor of this attribute class.
//! Usually it is never called outside this class.
//! Usually it is never called outside this class.
Standard_EXPORT MyPackage_Transformation();
private:
gp_TrsfForm myType;
// Axes (Ax1, Ax2, Ax3)
// Axes (Ax1, Ax2, Ax3)
gp_Ax1 myAx1;
gp_Ax2 myAx2;
gp_Ax3 myFirstAx3;
gp_Ax3 mySecondAx3;
// Scalar values
// Scalar values
Standard_Real myAngle;
Standard_Real myScale;
// Points
// Points
gp_Pnt myFirstPoint;
gp_Pnt mySecondPoint;
};
};
~~~~
## Implementation of Attribute Transformation in a CPP file
~~~~{.cpp}
#include <MyPackage_Transformation.hxx>
\#include <MyPackage_Transformation.hxx>
//=======================================================================
//function : GetID
//purpose : The method returns a unique GUID of this attribute.
// By means of this GUID this attribute may be identified
// among other attributes attached to the same label.
//=======================================================================
const Standard_GUID& MyPackage_Transformation::GetID()
{
static Standard_GUID ID("4443368E-C808-4468-984D-B26906BA8573");
return ID;
}
//=======================================================================
//function : Set
//purpose : Finds or creates the attribute attached to <theLabel>.
// The found or created attribute is returned.
//=======================================================================
Handle(MyPackage_Transformation) MyPackage_Transformation::Set(const TDF_Label& theLabel)
{
Handle(MyPackage_Transformation) T;
if (!theLabel.FindAttribute(MyPackage_Transformation::GetID(), T))
{
T = new MyPackage_Transformation();
theLabel.AddAttribute(T);
}
return T;
}
//=======================================================================
//function : Get
//purpose : The method returns the transformation.
//=======================================================================
gp_Trsf MyPackage_Transformation::Get() const
{
gp_Trsf transformation;
switch (myType)
{
case gp_Identity:
{
break;
}
case gp_Rotation:
{
transformation.SetRotation(myAx1, myAngle);
break;
}
case gp_Translation:
{
transformation.SetTranslation(myFirstPoint, mySecondPoint);
break;
}
case gp_PntMirror:
{
transformation.SetMirror(myFirstPoint);
break;
}
case gp_Ax1Mirror:
{
transformation.SetMirror(myAx1);
break;
}
case gp_Ax2Mirror:
{
transformation.SetMirror(myAx2);
break;
}
case gp_Scale:
{
transformation.SetScale(myFirstPoint, myScale);
break;
}
case gp_CompoundTrsf:
{
transformation.SetTransformation(myFirstAx3, mySecondAx3);
break;
}
case gp_Other:
{
break;
}
}
return transformation;
}
//=======================================================================
//function : SetRotation
//purpose : The method defines a rotation type of transformation.
//=======================================================================
void MyPackage_Transformation::SetRotation(const gp_Ax1& theAxis, const Standard_Real theAngle)
{
Backup();
myType = gp_Rotation;
myAx1 = theAxis;
myAngle = theAngle;
}
//=======================================================================
//function : SetTranslation
//purpose : The method defines a translation type of transformation.
//=======================================================================
void MyPackage_Transformation::SetTranslation(const gp_Vec& theVector)
{
Backup();
myType = gp_Translation;
myFirstPoint.SetCoord(0, 0, 0);
mySecondPoint.SetCoord(theVector.X(), theVector.Y(), theVector.Z());
}
//=======================================================================
//function : SetMirror
//purpose : The method defines a point mirror type of transformation
// (point symmetry).
//=======================================================================
void MyPackage_Transformation::SetMirror(const gp_Pnt& thePoint)
{
Backup();
myType = gp_PntMirror;
myFirstPoint = thePoint;
}
//=======================================================================
//function : SetMirror
//purpose : The method defines an axis mirror type of transformation
// (axial symmetry).
//=======================================================================
void MyPackage_Transformation::SetMirror(const gp_Ax1& theAxis)
{
Backup();
myType = gp_Ax1Mirror;
myAx1 = theAxis;
}
//=======================================================================
//function : SetMirror
//purpose : The method defines a point mirror type of transformation
// (planar symmetry).
//=======================================================================
void MyPackage_Transformation::SetMirror(const gp_Ax2& thePlane)
{
Backup();
myType = gp_Ax2Mirror;
myAx2 = thePlane;
}
//=======================================================================
//function : SetScale
//purpose : The method defines a scale type of transformation.
//=======================================================================
void MyPackage_Transformation::SetScale(const gp_Pnt& thePoint, const Standard_Real theScale)
{
Backup();
myType = gp_Scale;
myFirstPoint = thePoint;
myScale = theScale;
}
//=======================================================================
//function : SetTransformation
//purpose : The method defines a complex type of transformation
// from one coordinate system to another.
//=======================================================================
void MyPackage_Transformation::SetTransformation(const gp_Ax3& theCoordinateSystem1,
const gp_Ax3& theCoordinateSystem2)
{
Backup();
myFirstAx3 = theCoordinateSystem1;
mySecondAx3 = theCoordinateSystem2;
}
//=======================================================================
//function : ID
//purpose : The method returns a unique GUID of the attribute.
// By means of this GUID this attribute may be identified
// among other attributes attached to the same label.
//=======================================================================
const Standard_GUID& MyPackage_Transformation::ID() const
{
return GetID();
}
//=======================================================================
//function : Restore
//purpose : The method is called on Undo / Redo.
// It copies the content of <theAttribute>
// into this attribute (copies the fields).
//=======================================================================
void MyPackage_Transformation::Restore(const Handle(TDF_Attribute)& theAttribute)
{
Handle(MyPackage_Transformation) theTransformation = Handle(MyPackage_Transformation)::DownCast(theAttribute);
myType = theTransformation->myType;
myAx1 = theTransformation->myAx1;
myAx2 = theTransformation->myAx2;
myFirstAx3 = theTransformation->myFirstAx3;
mySecondAx3 = theTransformation->mySecondAx3;
myAngle = theTransformation->myAngle;
myScale = theTransformation->myScale;
myFirstPoint = theTransformation->myFirstPoint;
mySecondPoint = theTransformation->mySecondPoint;
}
//=======================================================================
//function : NewEmpty
//purpose : It creates a new instance of this attribute.
// It is called on Copy / Paste, Undo / Redo.
//=======================================================================
Handle(TDF_Attribute) MyPackage_Transformation::NewEmpty() const
{
return new MyPackage_Transformation();
}
//=======================================================================
//function : Paste
//purpose : The method is called on Copy / Paste.
// It copies the content of this attribute into
// <theAttribute> (copies the fields).
//=======================================================================
void MyPackage_Transformation::Paste(const Handle(TDF_Attribute)& theAttribute,
const Handle(TDF_RelocationTable)& ) const
{
Handle(MyPackage_Transformation) theTransformation = Handle(MyPackage_Transformation)::DownCast(theAttribute);
theTransformation->myType = myType;
theTransformation->myAx1 = myAx1;
theTransformation->myAx2 = myAx2;
theTransformation->myFirstAx3 = myFirstAx3;
theTransformation->mySecondAx3 = mySecondAx3;
theTransformation->myAngle = myAngle;
theTransformation->myScale = myScale;
theTransformation->myFirstPoint = myFirstPoint;
theTransformation->mySecondPoint = mySecondPoint;
}
//=======================================================================
//function : Dump
//purpose : Prints the content of this attribute into the stream.
//=======================================================================
Standard_OStream& MyPackage_Transformation::Dump(Standard_OStream& anOS) const
{
anOS = "Transformation: ";
switch (myType)
{
case gp_Identity:
{
anOS = "gp_Identity";
break;
}
case gp_Rotation:
{
anOS = "gp_Rotation";
break;
}
case gp_Translation:
{
anOS = "gp_Translation";
break;
}
case gp_PntMirror:
{
anOS = "gp_PntMirror";
break;
}
case gp_Ax1Mirror:
{
anOS = "gp_Ax1Mirror";
break;
}
case gp_Ax2Mirror:
{
anOS = "gp_Ax2Mirror";
break;
}
case gp_Scale:
{
anOS = "gp_Scale";
break;
}
case gp_CompoundTrsf:
{
anOS = "gp_CompoundTrsf";
break;
}
case gp_Other:
{
anOS = "gp_Other";
break;
}
}
return anOS;
}
//=======================================================================
//function : GetID
//purpose : The method returns a unique GUID of this attribute.
// By means of this GUID this attribute may be identified
// among other attributes attached to the same label.
//function : MyPackage_Transformation
//purpose : A constructor.
//=======================================================================
const Standard_GUID& MyPackage_Transformation::GetID()
{
static Standard_GUID ID("4443368E-C808-4468-984D-B26906BA8573");
return ID;
}
MyPackage_Transformation::MyPackage_Transformation():myType(gp_Identity){
//=======================================================================
//function : Set
//purpose : Finds or creates the attribute attached to <theLabel>.
// The found or created attribute is returned.
//=======================================================================
Handle(MyPackage_Transformation) MyPackage_Transformation::Set(const TDF_Label& theLabel)
{
Handle(MyPackage_Transformation) T;
if (!theLabel.FindAttribute(MyPackage_Transformation::GetID(), T))
{
T = new MyPackage_Transformation();
theLabel.AddAttribute(T);
}
return T;
}
//=======================================================================
//function : Get
//purpose : The method returns the transformation.
//=======================================================================
gp_Trsf MyPackage_Transformation::Get() const
{
gp_Trsf transformation;
switch (myType)
{
case gp_Identity:
{
break;
}
case gp_Rotation:
{
transformation.SetRotation(myAx1, myAngle);
break;
}
case gp_Translation:
{
transformation.SetTranslation(myFirstPoint, mySecondPoint);
break;
}
case gp_PntMirror:
{
transformation.SetMirror(myFirstPoint);
break;
}
case gp_Ax1Mirror:
{
transformation.SetMirror(myAx1);
break;
}
case gp_Ax2Mirror:
{
transformation.SetMirror(myAx2);
break;
}
case gp_Scale:
{
transformation.SetScale(myFirstPoint, myScale);
break;
}
case gp_CompoundTrsf:
{
transformation.SetTransformation(myFirstAx3, mySecondAx3);
break;
}
case gp_Other:
{
break;
}
}
return transformation;
}
//=======================================================================
//function : SetRotation
//purpose : The method defines a rotation type of transformation.
//=======================================================================
void MyPackage_Transformation::SetRotation(const gp_Ax1& theAxis, const Standard_Real theAngle)
{
Backup();
myType = gp_Rotation;
myAx1 = theAxis;
myAngle = theAngle;
}
//=======================================================================
//function : SetTranslation
//purpose : The method defines a translation type of transformation.
//=======================================================================
void MyPackage_Transformation::SetTranslation(const gp_Vec& theVector)
{
Backup();
myType = gp_Translation;
myFirstPoint.SetCoord(0, 0, 0);
mySecondPoint.SetCoord(theVector.X(), theVector.Y(), theVector.Z());
}
//=======================================================================
//function : SetMirror
//purpose : The method defines a point mirror type of transformation
// (point symmetry).
//=======================================================================
void MyPackage_Transformation::SetMirror(const gp_Pnt& thePoint)
{
Backup();
myType = gp_PntMirror;
myFirstPoint = thePoint;
}
//=======================================================================
//function : SetMirror
//purpose : The method defines an axis mirror type of transformation
// (axial symmetry).
//=======================================================================
void MyPackage_Transformation::SetMirror(const gp_Ax1& theAxis)
{
Backup();
myType = gp_Ax1Mirror;
myAx1 = theAxis;
}
//=======================================================================
//function : SetMirror
//purpose : The method defines a point mirror type of transformation
// (planar symmetry).
//=======================================================================
void MyPackage_Transformation::SetMirror(const gp_Ax2& thePlane)
{
Backup();
myType = gp_Ax2Mirror;
myAx2 = thePlane;
}
//=======================================================================
//function : SetScale
//purpose : The method defines a scale type of transformation.
//=======================================================================
void MyPackage_Transformation::SetScale(const gp_Pnt& thePoint, const Standard_Real theScale)
{
Backup();
myType = gp_Scale;
myFirstPoint = thePoint;
myScale = theScale;
}
//=======================================================================
//function : SetTransformation
//purpose : The method defines a complex type of transformation
// from one coordinate system to another
//=======================================================================
void MyPackage_Transformation::SetTransformation (const gp_Ax3& theCoordinateSystem1,
const gp_Ax3& theCoordinateSystem2)
{
Backup();
myFirstAx3 = theCoordinateSystem1;
mySecondAx3 = theCoordinateSystem2;
}
//=======================================================================
//function : ID
//purpose : The method returns a unique GUID of the attribute.
// By means of this GUID this attribute may be identified
// among other attributes attached to the same label.
//=======================================================================
const Standard_GUID& MyPackage_Transformation::ID() const
{
return GetID();
}
//=======================================================================
//function : Restore
//purpose : The method is called on Undo / Redo.
// It copies the content of <theAttribute>
// into this attribute (copies the fields).
//=======================================================================
void MyPackage_Transformation::Restore(const Handle(TDF_Attribute)& theAttribute)
{
Handle(MyPackage_Transformation) theTransformation = Handle(MyPackage_Transformation)::DownCast(theAttribute);
myType = theTransformation->myType;
myAx1 = theTransformation->myAx1;
myAx2 = theTransformation->myAx2;
myFirstAx3 = theTransformation->myFirstAx3;
mySecondAx3 = theTransformation->mySecondAx3;
myAngle = theTransformation->myAngle;
myScale = theTransformation->myScale;
myFirstPoint = theTransformation->myFirstPoint;
mySecondPoint = theTransformation->mySecondPoint;
}
//=======================================================================
//function : NewEmpty
//purpose : It creates a new instance of this attribute.
// It is called on Copy / Paste, Undo / Redo.
//=======================================================================
Handle(TDF_Attribute) MyPackage_Transformation::NewEmpty() const
{
return new MyPackage_Transformation();
}
//=======================================================================
//function : Paste
//purpose : The method is called on Copy / Paste.
// It copies the content of this attribute into
// <theAttribute> (copies the fields).
//=======================================================================
void MyPackage_Transformation::Paste (const Handle(TDF_Attribute)& theAttribute,
const Handle(TDF_RelocationTable)& ) const
{
Handle(MyPackage_Transformation) theTransformation = Handle(MyPackage_Transformation)::DownCast(theAttribute);
theTransformation->myType = myType;
theTransformation->myAx1 = myAx1;
theTransformation->myAx2 = myAx2;
theTransformation->myFirstAx3 = myFirstAx3;
theTransformation->mySecondAx3 = mySecondAx3;
theTransformation->myAngle = myAngle;
theTransformation->myScale = myScale;
theTransformation->myFirstPoint = myFirstPoint;
theTransformation->mySecondPoint = mySecondPoint;
}
//=======================================================================
//function : Dump
//purpose : Prints the content of this attribute into the stream.
//=======================================================================
Standard_OStream& MyPackage_Transformation::Dump(Standard_OStream& theOS) const
{
anOS << "Transformation: ";
switch (myType)
{
case gp_Identity:
{
anOS << "gp_Identity";
break;
}
case gp_Rotation:
{
anOS << "gp_Rotation";
break;
}
case gp_Translation:
{
anOS << "gp_Translation";
break;
}
case gp_PntMirror:
{
anOS << "gp_PntMirror";
break;
}
case gp_Ax1Mirror:
{
anOS << "gp_Ax1Mirror";
break;
}
case gp_Ax2Mirror:
{
anOS << "gp_Ax2Mirror";
break;
}
case gp_Scale:
{
anOS << "gp_Scale";
break;
}
case gp_CompoundTrsf:
{
anOS << "gp_CompoundTrsf";
break;
}
case gp_Other:
{
anOS << "gp_Other";
break;
}
}
return anOS;
}
//=======================================================================
//function : MyPackage_Transformation
//purpose : A constructor.
//=======================================================================
MyPackage_Transformation::MyPackage_Transformation()
: myType (gp_Identity)
{
//
}
~~~~
## Implementation of typical actions with standard OCAF attributes.
## Implementation of typical actions with standard OCAF attributes.
There are four sample files provided in the directory 'OpenCasCade/ros/samples/ocafsamples'.
They present typical actions with OCAF services (mainly for newcomers).
There are four sample files provided in the directory 'OpenCasCade/ros/samples/ocafsamples'. They present typical actions with OCAF services (mainly for newcomers).
The method *Sample()* of each file is not dedicated for execution 'as is', it is rather a set of logical actions using some OCAF services.
### TDataStd_Sample.cxx
@@ -543,7 +549,7 @@ This sample contains templates for typical actions with the following standard O
- TDataXtd_Constraint attribute management;
- TDataStd_Directory attribute management;
- TDataStd_TreeNode attribute management.
### TDocStd_Sample.cxx
This sample contains template for the following typical actions:
- creating application;
@@ -554,7 +560,7 @@ This sample contains template for the following typical actions:
- closing a document;
- opening the document stored in the file;
- copying content of a document to another document with possibility to update the copy in the future.
### TPrsStd_Sample.cxx
This sample contains template for the following typical actions:
- starting with data framework;
@@ -571,7 +577,7 @@ This sample contains template for the following typical actions:
- updating and displaying presentation of the attribute to be displayed;
- setting a color to the displayed attribute;
- getting transparency of the displayed attribute;
- modify attribute;
- modify attribute;
- updating presentation of the attribute in viewer.
### TNaming_Sample.cxx
@@ -585,3 +591,4 @@ The following scenario is used:
- creating a Fillet (using the selected edges) and pushing the result as a modification of Box1;
- creating a Cut (Box1, Box2) as a modification of Box1 and push it in DF;
- recovering the result from DF.

View File

@@ -14,8 +14,6 @@
<br>A set of code snippets performing typical actions with @ref occt_user_guides__ocaf "OCAF" services for newcomers.
* @ref samples__ocaf_func
<br>A simple example dedicated to the usage of "Function Mechanism" of @ref occt_user_guides__ocaf "OCCT Application Framework".
* @ref tutorials__ais_object
<br>A programming tutorial teaching how to compute presentation within AIS_InteractiveObject subclass for displaying in @ref occt_user_guides__visualization "OCCT 3D Viewer".
- @subpage samples__projects
* @ref samples_qt_iesample
<br>A cross-platform multi-document 3D Viewer sample with CAD import / export functionality based on **Qt Widgets** framework.
@@ -46,7 +44,6 @@
- @subpage occt__tutorial
- @subpage samples__ocaf
- @subpage samples__ocaf_func
- @subpage tutorials__ais_object
@page samples__projects Sample Projects
- @subpage samples_qt_iesample

View File

@@ -7,8 +7,6 @@ Upgrade from older OCCT versions {#occt__upgrade}
This document provides technical details on changes made in particular versions of OCCT. It can help to upgrade user applications based on previous versions of OCCT to newer ones.
@ref upgrade_occt770 "SEEK TO THE LAST CHAPTER (UPGRADE TO 7.7.0)"
@subsection upgrade_intro_precautions Precautions
Back-up your code before the upgrade.
@@ -26,6 +24,7 @@ The automatic upgrade tool is provided as is, without warranty of any kind, and
It is your responsibility to ensure that the changes you made in your code are correct.
When you upgrade the code by an automatic script, make sure to carefully review the introduced changes at each step before committing them.
@section upgrade_65 Upgrade to OCCT 6.5.0
Porting of user applications from an earlier OCCT version to version 6.5 requires taking into account the following major changes:
@@ -2300,10 +2299,6 @@ void Perform(const Handle(Adaptor3d_CurveOnSurface)& theCurveOnSurface,
Building OCCT now requires C++11-compliant compiler, so that some legacy compilers (Visual Studio 2010 and 2012) are no more supported.
It is recommended using Visual Studio 2015 or newer for building OCCT on Windows platform.
@subsection upgrade_770_removed_features Removed features
* One of the constructors of the BRepExtrema_DistanceSS class (the one without deflection parameter) has been removed as excessive. The remaining constructor has to be used instead.
@subsection upgrade_occt770_parallel_flag_removed Removed parameter theIsParallel from Put/Compute/Perform
theIsParallel parameter has been removed from Put/Compute/Perform from the next classes:
@@ -2326,20 +2321,3 @@ aValidateEdge.Process();
`Prs3d_Drawer` getters no more implicitly create "default" aspects.
If specific property has not been set before to this drawer instance nor to linked drawer instance, then NULL property will be returned.
Make sure to set property beforehand or to call `SetOwn*` / `SetupOwn*` methods to derive from defaults.
@subsection upgrade_occt770_opengl OpenGL functions
Applications extending OCCT 3D Viewer and calling OpenGL functions directly (like @c @::glEnable(), e.g. using global namespace) might be affected by changes in `OpenGl_GlFunctions.hxx`.
This header, as well as `OpenGl_GlCore20.hxx` and similar, no more include system OpenGL / OpenGL ES headers to define function table.
Application code calling OpenGL functions directly should be changed to either use `OpenGl_Context::core11fwd` (as designed)
or to include system OpenGL headers in advance (with help of `OpenGl_GlNative.hxx`).
@subsection upgrade_occt770_tooltriangulatedshape StdPrs_ToolTriangulatedShape
Method `StdPrs_ToolTriangulatedShape::Normal()` has been removed.
Please use `BRepLib_ToolTriangulatedShape::ComputeNormals()` to fill in normal attributes in triangulation and fetch them directly using `Poly_Triangulation::Normal()`.
@subsection upgrade_occt770_shapeproximity BRepExtrema_ShapeProximity
A new way of using the `BRepExtrema_ShapeProximity` class was provided for computing a proximity value between two shapes.
If at initialization of the `BRepExtrema_ShapeProximity` class the *theTolerance* parameter is not defined (Precision::Infinite() by default), the proximity value will be computed.

View File

@@ -2044,47 +2044,43 @@ Creates a *MeshVS_Mesh* object based on STL file data. The object will be displa
meshfromstl mesh myfile.stl
~~~~
@subsubsection occt_draw_4_5_2 vsetdispmode
@subsubsection occt_draw_4_5_2 meshdispmode
Syntax:
~~~~{.php}
vsetdispmode meshname displaymode
meshdispmode meshname displaymode
~~~~
Changes the display mode of object **meshname**. The **displaymode** is integer (`MeshVS_DisplayModeFlags`), which can be:
* *1* for *wireframe*,
Changes the display mode of object **meshname**. The **displaymode** is integer, which can be:
* *1* for *wireframe*,
* *2* for *shading* mode, or
* *3* for *shrink* mode.
* *3* for *shrink* mode.
**Example:**
**Example:**
~~~~{.php}
vinit
meshfromstl mesh myfile.stl
vsetdispmode mesh 2
vinit
meshfromstl mesh myfile.stl
meshdispmode mesh 2
~~~~
@subsubsection occt_draw_4_5_3 vselmode
@subsubsection occt_draw_4_5_3 meshselmode
Syntax:
~~~~{.php}
vselmode meshname selectionmode {on|off}
meshselmode meshname selectionmode
~~~~
Changes the selection mode of object **meshname**.
The *selectionmode* is integer OR-combination of mode flags (`MeshVS_SelectionModeFlags`). The basic flags are the following:
* *0* -- selection of mesh as whole;
Changes the selection mode of object **meshname**. The *selectionmode* is integer OR-combination of mode flags. The basic flags are the following:
* *1* -- node selection;
* *2* -- 0D elements (not supported in STL);
* *4* -- links (not supported in STL);
* *8* -- faces;
* *16* -- volumes (not supported in STL);
* *256* -- groups (not supported in STL).
**Example:**
* *2* -- 0D elements (not supported in STL);
* *4* -- links (not supported in STL);
* *8* -- faces.
**Example:**
~~~~{.php}
vinit
meshfromstl mesh myfile.stl
vselmode mesh 1
vinit
meshfromstl mesh myfile.stl
meshselmode mesh 1
~~~~
@subsubsection occt_draw_4_5_4 meshshadcolor
@@ -2095,11 +2091,11 @@ meshshadcolor meshname red green blue
~~~~
Changes the face interior color of object **meshname**. The *red*, *green* and *blue* are real values between *0* and *1*.
**Example:**
**Example:**
~~~~{.php}
vinit
meshfromstl mesh myfile.stl
vinit
meshfromstl mesh myfile.stl
meshshadcolormode mesh 0.5 0.5 0.5
~~~~
@@ -2111,11 +2107,11 @@ meshlinkcolor meshname red green blue
~~~~
Changes the color of face borders for object **meshname**. The *red*, *green* and *blue* are real values between *0* and *1*.
**Example:**
**Example:**
~~~~{.php}
vinit
meshfromstl mesh myfile.stl
vinit
meshfromstl mesh myfile.stl
meshlinkcolormode mesh 0.5 0.5 0.5
~~~~
@@ -2123,37 +2119,39 @@ meshlinkcolormode mesh 0.5 0.5 0.5
Syntax:
~~~~{.php}
meshmat meshname material [transparency]
meshmat meshname material
~~~~
Changes the material of object **meshname**.
*material* is represented with an integer value as follows (equivalent to enumeration *Graphic3d_NameOfMaterial*):
* *0 -- BRASS*,
* *1 -- BRONZE*,
* *2 -- COPPER*,
* *3 -- GOLD*,
* *4 -- PEWTER*,
* *5 -- PLASTER*,
* *6 -- PLASTIC*,
* *7 -- SILVER*,
* *8 -- STEEL*,
* *9 -- STONE*,
* *10 -- SHINY_PLASTIC*,
* *11 -- SATIN*,
* *12 -- METALIZED*,
* *13 -- NEON_GNC*,
* *14 -- CHROME*,
* *15 -- ALUMINIUM*,
* *16 -- OBSIDIAN*,
* *17 -- NEON_PHC*,
* *18 -- JADE*.
*material* is represented with an integer value as follows (equivalent to enumeration *Graphic3d_NameOfMaterial*):
* *0 -- BRASS,*
* *1 -- BRONZE,*
* *2 -- COPPER,*
* *3 -- GOLD,*
* *4 -- PEWTER,*
* *5 -- PLASTER,*
* *6 -- PLASTIC,*
* *7 -- SILVER,*
* *8 -- STEEL,*
* *9 -- STONE,*
* *10 -- SHINY_PLASTIC,*
* *11 -- SATIN,*
* *12 -- METALIZED,*
* *13 -- NEON_GNC,*
* *14 -- CHROME,*
* *15 -- ALUMINIUM,*
* *16 -- OBSIDIAN,*
* *17 -- NEON_PHC,*
* *18 -- JADE,*
* *19 -- DEFAULT,*
* *20 -- UserDefined*
**Example:**
**Example:**
~~~~{.php}
vinit
meshfromstl mesh myfile.stl
meshmat mesh 18
vinit
meshfromstl mesh myfile.stl
meshmat mesh JADE
~~~~
@subsubsection occt_draw_4_5_7 meshshrcoef
@@ -2163,14 +2161,12 @@ Syntax:
meshshrcoef meshname shrinkcoefficient
~~~~
Changes the value of shrink coefficient used in the shrink mode.
In the shrink mode the face is shown as a congruent part of a usual face, so that *shrinkcoefficient* controls the value of this part.
The *shrinkcoefficient* is a positive real number.
**Example:**
Changes the value of shrink coefficient used in the shrink mode. In the shrink mode the face is shown as a congruent part of a usual face, so that *shrinkcoefficient* controls the value of this part. The *shrinkcoefficient* is a positive real number.
**Example:**
~~~~{.php}
vinit
meshfromstl mesh myfile.stl
vinit
meshfromstl mesh myfile.stl
meshshrcoef mesh 0.05
~~~~
@@ -2182,12 +2178,11 @@ meshshow meshname
~~~~
Displays **meshname** in the viewer (if it is erased).
The same as calling `vdisplay`.
**Example:**
~~~~{.php}
vinit
meshfromstl mesh myfile.stl
vinit
meshfromstl mesh myfile.stl
meshshow mesh
~~~~
@@ -2198,13 +2193,12 @@ Syntax:
meshhide meshname
~~~~
Hides **meshname** in the viewer.
The same as calling `verase`.
Hides **meshname** in the viewer.
**Example:**
**Example:**
~~~~{.php}
vinit
meshfromstl mesh myfile.stl
vinit
meshfromstl mesh myfile.stl
meshhide mesh
~~~~
@@ -2215,7 +2209,7 @@ Syntax:
meshhidesel meshname
~~~~
Hides only selected entities. The other part of **meshname** remains visible.
Hides only selected entities. The other part of **meshname** remains visible.
@subsubsection occt_draw_4_5_11 meshshowsel
@@ -2224,7 +2218,7 @@ Syntax:
meshshowsel meshname
~~~~
Shows only selected entities. The other part of **meshname** becomes invisible.
Shows only selected entities. The other part of **meshname** becomes invisible.
@subsubsection occt_draw_4_5_12 meshshowall
@@ -2233,22 +2227,22 @@ Syntax:
meshshowall meshname
~~~~
Changes the state of all entities to visible for **meshname**.
Changes the state of all entities to visible for **meshname**.
@subsubsection occt_draw_4_5_13 vremove
@subsubsection occt_draw_4_5_13 meshdelete
Syntax:
~~~~{.php}
vremove meshname
meshdelete meshname
~~~~
Deletes MeshVS_Mesh object **meshname**.
Deletes MeshVS_Mesh object **meshname**.
**Example:**
**Example:**
~~~~{.php}
vinit
meshfromstl mesh myfile.stl
vremove mesh
vinit
meshfromstl mesh myfile.stl
meshdelete mesh
~~~~
@subsection occt_draw_4_6 VIS Viewer commands

View File

@@ -1331,7 +1331,7 @@ Therefore if the user of *NCollection* does not specify any allocator as a param
Nevertheless, it is possible to define a custom *Allocator* type to manage the memory in the most optimal or convenient way for this algorithm.
As one possible choice, the class *NCollection_IncAllocator* is included.
Unlike *NCollection_BaseAllocator*, the memory is allocated in big blocks (about 12kB) and the allocator keeps track of the amount of occupied memory.
Unlike *NCollection_BaseAllocator*, the memory is allocated in big blocks (about 20kB) and the allocator keeps track of the amount of occupied memory.
The method *Allocate* just increments the pointer to non-occupied memory and returns its previous value.
Memory is only released in the destructor of *NCollection_IncAllocator*, the method *Free* is empty.
If used properly, this Allocator can greatly improve the performance of specific algorithms.

View File

@@ -165,9 +165,7 @@ if (!Interface_Static::SetIVal ("read.maxprecision.mode",1))
Default value is *Preferred (0)*.
<h4>read.maxprecision.val</h4>
defines the maximum allowable tolerance (in internal units, which are specified in xstep.cascade.unit) of the shape.
It should be not less than the basis value of tolerance set in processor (either Resolution from the file or *read.precision.val*).
Actually, the maximum between *read.maxprecision.val* and basis tolerance is used to define maximum allowed tolerance.
defines the maximum allowable tolerance (in mm) of the shape. It should be not less than the basis value of tolerance set in processor (either Resolution from the file or *read.precision.val*). Actually, the maximum between *read.maxprecision.val* and basis tolerance is used to define maximum allowed tolerance.
Read this parameter with:
~~~~{.cpp}
Standard_Real rp = Interface_Static::RVal("read.maxprecision.val");

File diff suppressed because it is too large Load Diff

View File

@@ -1007,25 +1007,6 @@ Standard_Integer aNbOffsetSurfaces = aCheckContents.NbOffsetSurf();
Handle(TopTools_HSequenceOfShape) aSeqFaces = aCheckContents.OffsetSurfaceSec();
~~~~
@subsubsection occt_shg_3_2_4 Analysis of shape underlined geometry
Class *ShapeAnalysis_CanonicalRecognition* provides tools that analyze geometry of shape and explore the possibility of converting geometry into a canonical form.
Canonical forms for curves are lines, circles and ellipses.
Canonical forms for surfaces are planar, cylindrical, conical and spherical surfaces.
Recognition and converting into canonical form is performed according to maximal deviation criterium: maximal distance between initial and canonical geometrical objects must be less, than given value.
Analysis of curves is allowed for following shapes:
* edge - algorithm checks 3d curve of edge
* wire - algorithm checks 3d curves of all edges in order to convert them in the same analytical curve
Analysis of surfaces is allowed for following shapes:
* face - algorithm checks surface of face
* shell - algorithm checks surfaces of all faces in order to convert them in the same analytical surface
* edge - algorithm checks all surfaces that are shared by given edge in order convert one of them in analytical surface, which most close to the input sample surface.
* wire - the same as for edge, but algorithm checks all edges of wire in order to find analytical surface, which most close to the input sample surface.
@section occt_shg_4 Upgrading
Upgrading tools are intended for adaptation of shapes for better use by Open CASCADE Technology or for customization to particular needs, i.e. for export to another system.

View File

@@ -94,7 +94,6 @@ The types of STEP representation entities that are recognized are:
* geometrically_bounded_wireframe_shape_representation
* geometrically_bounded_surface_shape_representation
* hybrid representations (shape_representation containing models of different type)
* tessellated_shape_representation
@subsubsection occt_step_2_2_3 Topological entities
The types of STEP topological entities that can be translated are:
@@ -113,7 +112,6 @@ The types of STEP geometrical entities that can be translated are:
* directions
* curves
* surfaces
* triangulations
For further information see 2.4 Mapping STEP entities to Open CASCADE Technology shapes.
@@ -184,9 +182,7 @@ By default this value is 0.0001.
The value given to this parameter is a basic value for ShapeHealing algorithms and the processor. It does its best to reach it. Under certain circumstances, the value you give may not be attached to all of the entities concerned at the end of processing. STEP-to-OpenCASCADE translation does not improve the quality of the geometry in the original STEP file. This means that the value you enter may be impossible to attach to all shapes with the given quality of the geometry in the STEP file.
<h4>read.maxprecision.val</h4>
Defines the maximum allowed tolerance (in internal units, which are specified in xstep.cascade.unit) of the shape.
It should be not less than the basic value of tolerance set in the processor (either the uncertainty from the file or *read.precision.val*).
Actually, the maximum between *read.maxprecision.val* and the basis tolerance is used to define the maximum allowed tolerance.
Defines the maximum allowed tolerance (in mm) of the shape. It should be not less than the basic value of tolerance set in the processor (either the uncertainty from the file or *read.precision.val*). Actually, the maximum between *read.maxprecision.val* and the basis tolerance is used to define the maximum allowed tolerance.
Read this parameter with:
~~~~{.cpp}
@@ -339,7 +335,7 @@ Specifies preferred type of representation of the shape of the product, in case
* 4 (GBSSR) -- Prefer GEOMETRICALLY_BOUNDED_SURFACE_SHAPE_REPRESENTATION
* 5 (FBSR) -- Prefer FACETTED_BREP_SHAPE_REPRESENTATION
* 6 (EBWSR) -- Prefer EDGE_BASED_WIREFRAME_SHAPE_REPRESENTATION
* 7 (GBWSR) -- Prefer GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION
* 7 (GBWSR) -- Prefer GEOMETRICALLY_BOUNDED_WIREFRAME _SHAPE_REPRESENTATION
When this option is not equal to 1, for products with multiple representations the representation having a type closest to the selected one in this list will be translated.
@@ -449,34 +445,6 @@ of for each of the two "AXIS2_PLACEMENT_3D" entities referenced by it. as follow
}
~~~~
<h4>read.step.tessellated:</h4>
Boolean flag regulating translation of entities that define tessellated geometry:
* TESSELLATED_SHAPE_REPRESENTATION
* TESSELLATED_SHELL
* TESSELLATED_SOLID
* TRIANGULATED_FACE
* COMPLEX_TRIANGULATED_FACE
Tesselated geometry is attached to shapes as objects of <i>Poly_Triangulation</i> type using STEP links.
* 0 (Off) -- do not translate
* 1 (On) -- translate
* 2 (OnNoBRep) - tessellation is read only for entities for which there is no BRep representation
Read this parameter with:
~~~~{.cpp}
Standard_Integer ic = Interface_Static::IVal("read.step.tessellated");
~~~~
Modify this parameter with:
~~~~{.cpp}
if(!Interface_Static::SetIVal("read.step.tessellated",1))
.. error ..
~~~~
Default value is 0 (On).
@subsubsection occt_step_2_3_4 Performing the STEP file translation
Perform the translation according to what you want to translate. You can choose either root entities (all or selected by the number of root), or select any entity by its number in the STEP file. There is a limited set of types of entities that can be used as starting entities for translation. Only the following entities are recognized as transferable:
@@ -494,11 +462,6 @@ Perform the translation according to what you want to translate. You can choose
* subtypes of face_surface (including advanced_face)
* subtypes of shape_representation_relationship
* context_dependent_shape_representation
* tessellated_shape_representation
* tessellated_shell
* tessellated_solid
* triangulated_face
* complex_triangulated_face
The following methods are used for translation:
@@ -718,10 +681,6 @@ Not all entities defining the assembly structure in the STEP file are translated
| | quasi_uniform_surface | Geom_BSplineSurface | |
| | rectangular_composite_surface | TopoDS_Compound | Contains *TopoDS_Faces* |
| | curve_bounded_surface | TopoDS_Face | |
| Tessellations | tessellated_shell | TopoDS_Shell | |
| | tessellated_solid | TopoDS_Solid | |
| | triangulated_face | TopoDS_Face | Contains *Poly_Triangulation* |
| | complex_triangulated_face | TopoDS_Face | Contains *Poly_Triangulation* |
@subsection occt_step_2_5 Tolerance management
@@ -784,7 +743,6 @@ The following default tolerances are used when creating shapes and how they are
* *StepToTopoDS_TranslatePolyLoop* constructs *TopoDS_Edges* in *TopoDS_Wire* with help of class *StepToTopoDS_TranslateEdge*. Their tolerances are not modified inside this method.
* *StepToTopoDS_TranslateFace* constructs *TopoDS_Face* with the initial value of tolerance. *TopoDS_Wire* on *TopoDS_Face* is constructed with the help of classes *StepToTopoDS_TranslatePolyLoop, StepToTopoDS_TranslateEdgeLoop* or *StepToTopoDS_TranslateVertexLoop*.
* *StepToTopoDS_TranslateShell* calls *StepToTopoDS_TranslateFace::Init* for each face. This class does not modify the tolerance value.
* *StepToTopoDS_TranslateSolid* calls *StepToTopoDS_TranslateFace::Init* for each face. This class does not modify the tolerance value.
* *StepToTopoDS_TranslateCompositeCurve* constructs *TopoDS_Edges* in *TopoDS_Wire* with help of class *BRepAPI_MakeEdge* and have a tolerance 10-7. Pcurves from a STEP file are translated if they are present and if *read.surfacecurve.mode* is not -3. The connection between segments of a composite curve (edges in the wire) is provided by calling method *ShapeFix_Wire::FixConnected()\** with a precision equal to the initial value of tolerance.
* *StepToTopoDS_TranslateCurveBoundedSurface* constructs *TopoDS_Face* with tolerance *Precision::Confusion()*. *TopoDS_Wire* on *TopoDS_Face* is constructed with the help of class *StepToTopoDS_TranslateCompositeCurve*. Missing pcurves are computed using projection algorithm with the help of method *ShapeFix_Face::FixPcurves()*. For resulting face method *ShapeFix::SameParameter()* is called. It calls standard *BRepLib::SameParameter* for each edge in each wire, which can either increase or decrease the tolerances of the edges and vertices. *SameParameter* writes the tolerance corresponding to the real deviation of pcurves from 3D curve which can be less or greater than the tolerance in a STEP file.
* *StepToTopoDS_Builder* a high level class. Its methods perform translation with the help of the classes listed above. If the value of *read.maxprecision.mode* is set to 1 then the tolerance of subshapes of the resulting shape is limited by 0 and *read.maxprecision.val*. Else this class does not change the tolerance value.
@@ -1011,34 +969,6 @@ if(!Interface_Static::SetIVal("write.step.vertex.mode",1))
~~~~
Default value is 0.
<h4>write.step.tessellated:</h4>
Boolean flag regulating writing of entities that define tessellated geometry:
* TESSELLATED_SHAPE_REPRESENTATION
* TESSELLATED_SHELL
* TESSELLATED_SOLID
* TRIANGULATED_FACE
Tesselated geometry is taken as objects of <i>Poly_Triangulation type</i> from the active <i>TopoDS_Face</i> triangulation.
* 0 (Off) -- do not write
* 1 (On) -- write
* 2 (OnNoBRep) - tessellation is written only for entities for which there is no BRep representation
Read this parameter with:
~~~~{.cpp}
Standard_Integer ic = Interface_Static::IVal("write.step.tessellated");
~~~~
Modify this parameter with:
~~~~{.cpp}
if(!Interface_Static::SetIVal("write.step.tessellated",1))
.. error ..
~~~~
Default value is 2 (OnNoBep).
@subsubsection occt_step_3_3_3 Performing the Open CASCADE Technology shape translation
An OCCT shape can be translated to STEP using one of the following models (shape_representations):
* manifold_solid_brep (advanced_brep_shape_representation)
@@ -1162,7 +1092,6 @@ The table below describes STEP entities, which are created when the assembly str
| | Geom_ToroidalSurface | toroidal_surface or degenerate_toroidal_surface | *degenerate_toroidal_surface* is produced if the minor radius is greater then the major one |
| | Geom_BezierSurface | b_spline_surface_with_knots | |
| | Geom_BsplineSurface | b_spline_surface_with_knots or rational_b_spline_surface | *rational_b_spline_surface* is produced if *Geom_BSplineSurface* is a rational Bspline |
| Triangulations | Poly_Triangulation | *triangulated_face* is produced for face active triangulation | |
@subsection occt_step_3_5 Tolerance management

File diff suppressed because it is too large Load Diff

View File

@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>IE_WPF_D3D</RootNamespace>
<AssemblyName>IE_WPF_D3D</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>

View File

@@ -1,3 +1,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

View File

@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>IE_WPF_WinForms</RootNamespace>
<AssemblyName>IE_WPF_WinForms</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>

View File

@@ -1,3 +1,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

View File

@@ -27,7 +27,7 @@
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>

View File

@@ -35,4 +35,4 @@
</providers>
</roleManager>
</system.web>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

View File

@@ -25,7 +25,6 @@
#include <AIS_InteractiveObject.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <TopoDS_Face.hxx>
#include <TColGeom_SequenceOfCurve.hxx>

View File

@@ -26,7 +26,9 @@
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <gp_Pnt.hxx>
#include <Graphic3d_Texture2D.hxx>
#include <Graphic3d_Texture1D.hxx>
#include <Graphic3d_Texture1Dsegment.hxx>
#include <Graphic3d_Texture2Dmanual.hxx>
#include <Image_AlienPixMap.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <TopoDS_Edge.hxx>
@@ -79,7 +81,7 @@ void Sample2D_Image::SetContext (const Handle(AIS_InteractiveContext)& theContex
this->Set(TopoDS_Shape(myFace));
myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
Handle(Graphic3d_Texture2D) aTexture = new Graphic3d_Texture2D (myFilename);
Handle(Graphic3d_Texture2Dmanual) aTexture = new Graphic3d_Texture2Dmanual(myFilename);
aTexture->DisableModulate();
myDrawer->ShadingAspect()->Aspect()->SetTextureMap (aTexture);
myDrawer->ShadingAspect()->Aspect()->SetTextureMapOn();

View File

@@ -24,7 +24,6 @@
#include <AIS_InteractiveObject.hxx>
#include <Graphic3d_ArrayOfPoints.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
//! AIS AIS interactive object for sample 2D marker
class Sample2D_Markers : public AIS_InteractiveObject

View File

@@ -4,6 +4,7 @@ project(glfw-occt-demo)
set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/adm/cmake" ${CMAKE_MODULE_PATH})
set(CMAKE_CXX_STANDARD 11)
set(APP_VERSION_MAJOR 1)
set(APP_VERSION_MINOR 0)
set(APP_TARGET glfwocct)

View File

@@ -39,9 +39,9 @@ elseif (DEFINED CMAKE_COMPILER_IS_GNUCC)
set (MY_COMPILER gcc)
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
set (MY_COMPILER gcc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set (MY_COMPILER clang)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Ii][Nn][Tt][Ee][Ll]")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
set (MY_COMPILER icc)
else()
set (MY_COMPILER ${CMAKE_GENERATOR})

View File

@@ -37,7 +37,7 @@ list(APPEND aLibDeps lib_FreeType)
# system libraries
list(APPEND aLibDeps EGL GLESv2 log android)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -frtti -fexceptions -fpermissive")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -frtti -fexceptions -fpermissive")
add_library(TKJniSample SHARED ${SOURCE_FILES})
target_link_libraries(TKJniSample ${aLibDeps})

View File

@@ -1,10 +1,4 @@
# Caution! Be careful, when increase minimal cmake version:
# using of newer version may leads (by default) to applying
# of some new policies. It may break compilation.
# For canceling of applying new policies use:
# cmake_policy(PUSH) before `cmake_minimum_required`
# and cmake_policy(POP) after.
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
cmake_minimum_required (VERSION 2.6)
project (Geometry)

View File

@@ -1,10 +1,4 @@
# Caution! Be careful, when increase minimal cmake version:
# using of newer version may leads (by default) to applying
# of some new policies. It may break compilation.
# For canceling of applying new policies use:
# cmake_policy(PUSH) before `cmake_minimum_required`
# and cmake_policy(POP) after.
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
cmake_minimum_required (VERSION 2.6)
project (Modeling)

View File

@@ -1,10 +1,4 @@
# Caution! Be careful, when increase minimal cmake version:
# using of newer version may leads (by default) to applying
# of some new policies. It may break compilation.
# For canceling of applying new policies use:
# cmake_policy(PUSH) before `cmake_minimum_required`
# and cmake_policy(POP) after.
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
cmake_minimum_required (VERSION 2.6)
project (ImportExport)

View File

@@ -1,10 +1,4 @@
# Caution! Be careful, when increase minimal cmake version:
# using of newer version may leads (by default) to applying
# of some new policies. It may break compilation.
# For canceling of applying new policies use:
# cmake_policy(PUSH) before `cmake_minimum_required`
# and cmake_policy(POP) after.
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
cmake_minimum_required (VERSION 2.6)
project (HLR)

View File

@@ -1,10 +1,4 @@
# Caution! Be careful, when increase minimal cmake version:
# using of newer version may leads (by default) to applying
# of some new policies. It may break compilation.
# For canceling of applying new policies use:
# cmake_policy(PUSH) before `cmake_minimum_required`
# and cmake_policy(POP) after.
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
cmake_minimum_required (VERSION 2.6)
project (mfcsample)

View File

@@ -221,7 +221,7 @@ Handle(TopTools_HSequenceOfShape) Translate::importModel( const int format, cons
shapes = importSTEP( file );
break;
}
} catch ( const Standard_Failure& ) {
} catch ( Standard_Failure ) {
shapes.Nullify();
}
return shapes;
@@ -256,7 +256,7 @@ bool Translate::exportModel( const int format, const QString& file, const Handle
case FormatSTL: return exportSTL ( file, shapes );
case FormatVRML: return exportVRML( file, shapes );
}
} catch ( const Standard_Failure& ) {
} catch ( Standard_Failure ) {
//
}
return false;
@@ -528,26 +528,26 @@ bool Translate::exportSTL( const QString& file, const Handle(TopTools_HSequenceO
if ( shapes.IsNull() || shapes->IsEmpty() )
return false;
TopoDS_Compound res;
BRep_Builder builder;
builder.MakeCompound( res );
TopoDS_Compound res;
BRep_Builder builder;
builder.MakeCompound( res );
for ( int i = 1; i <= shapes->Length(); i++ )
{
TopoDS_Shape shape = shapes->Value( i );
if ( shape.IsNull() )
{
myInfo = QObject::tr( "INF_TRANSLATE_ERROR_INVALIDSHAPE" );
return false;
for ( int i = 1; i <= shapes->Length(); i++ )
{
TopoDS_Shape shape = shapes->Value( i );
if ( shape.IsNull() )
{
myInfo = QObject::tr( "INF_TRANSLATE_ERROR_INVALIDSHAPE" );
return false;
}
builder.Add( res, shape );
}
builder.Add( res, shape );
}
StlAPI_Writer writer;
const TCollection_AsciiString anUtf8Path (file.toUtf8().data());
writer.Write( res, anUtf8Path.ToCString() );
StlAPI_Writer writer;
const TCollection_AsciiString anUtf8Path (file.toUtf8().data());
writer.Write( res, anUtf8Path.ToCString() );
return true;
}
@@ -557,26 +557,26 @@ bool Translate::exportVRML( const QString& file, const Handle(TopTools_HSequence
if ( shapes.IsNull() || shapes->IsEmpty() )
return false;
TopoDS_Compound res;
BRep_Builder builder;
builder.MakeCompound( res );
TopoDS_Compound res;
BRep_Builder builder;
builder.MakeCompound( res );
for ( int i = 1; i <= shapes->Length(); i++ )
{
TopoDS_Shape shape = shapes->Value( i );
if ( shape.IsNull() )
{
myInfo = QObject::tr( "INF_TRANSLATE_ERROR_INVALIDSHAPE" );
return false;
for ( int i = 1; i <= shapes->Length(); i++ )
{
TopoDS_Shape shape = shapes->Value( i );
if ( shape.IsNull() )
{
myInfo = QObject::tr( "INF_TRANSLATE_ERROR_INVALIDSHAPE" );
return false;
}
builder.Add( res, shape );
}
builder.Add( res, shape );
}
VrmlAPI_Writer writer;
const TCollection_AsciiString anUtf8Path (file.toUtf8().data());
writer.Write( res, anUtf8Path.ToCString() );
VrmlAPI_Writer writer;
const TCollection_AsciiString anUtf8Path (file.toUtf8().data());
writer.Write( res, anUtf8Path.ToCString() );
return true;
}

View File

@@ -7,7 +7,6 @@ if exist "%~dp0custom.bat" (
call "%CASROOT%\env.bat" %1 %2 %3
if /I ["%1"] == ["vc141"] set "VCVER=vc141"
if /I ["%1"] == ["vc142"] set "VCVER=vc142"
if /I ["%1"] == ["vc143"] set "VCVER=vc143"
set "BIN_DIR=win%ARCH%\%VCVER%\bind"
set "LIB_DIR=win%ARCH%\%VCVER%\libd"

View File

@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.2)
project(occt-webgl-sample)
set(CMAKE_CXX_STANDARD 11)
set(APP_VERSION_MAJOR 1)
set(APP_VERSION_MINOR 0)
set(APP_TARGET occt-webgl-sample)

View File

@@ -251,9 +251,7 @@ void AIS_Animation::Stop()
myState = AnimationState_Stopped;
if (!myTimer.IsNull())
{
const Standard_Real anElapsedTime = ElapsedTime();
myTimer->Stop();
myTimer->Seek (Min (Duration(), anElapsedTime));
}
for (NCollection_Sequence<Handle(AIS_Animation)>::Iterator anIter (myAnimations); anIter.More(); anIter.Next())

View File

@@ -14,6 +14,8 @@
#include <AIS_AnimationCamera.hxx>
#include <Graphic3d_Camera.hxx>
#include <Precision.hxx>
#include <V3d_View.hxx>
IMPLEMENT_STANDARD_RTTIEXT(AIS_AnimationCamera, AIS_Animation)

View File

@@ -15,6 +15,8 @@
#include <AIS_AnimationObject.hxx>
#include <AIS_InteractiveContext.hxx>
#include <TopLoc_Location.hxx>
#include <V3d_Viewer.hxx>
#include <V3d_View.hxx>
IMPLEMENT_STANDARD_RTTIEXT(AIS_AnimationObject, AIS_Animation)

View File

@@ -22,6 +22,7 @@
#include <Quantity_NameOfColor.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <SelectMgr_Filter.hxx>
class SelectMgr_EntityOwner;

View File

@@ -36,6 +36,8 @@
#include <SelectMgr_Selection.hxx>
#include <Standard_NumericError.hxx>
#include <StdPrs_Curve.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TopoDS.hxx>
#include <UnitsAPI.hxx>
IMPLEMENT_STANDARD_RTTIEXT(AIS_Axis,AIS_InteractiveObject)

View File

@@ -17,9 +17,12 @@
// <g_design>
#include <AIS_BadEdgeFilter.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <Standard_Type.hxx>
#include <StdSelect_BRepOwner.hxx>
#include <TopoDS_Edge.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfIntegerListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
IMPLEMENT_STANDARD_RTTIEXT(AIS_BadEdgeFilter,SelectMgr_Filter)

View File

@@ -18,10 +18,12 @@
#define _AIS_BadEdgeFilter_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TopTools_DataMapOfIntegerListOfShape.hxx>
#include <Standard_Integer.hxx>
#include <SelectMgr_Filter.hxx>
#include <Standard_Boolean.hxx>
#include <TopAbs_ShapeEnum.hxx>
class SelectMgr_EntityOwner;
class TopoDS_Edge;

View File

@@ -18,6 +18,7 @@
#include <AIS_C0RegularityFilter.hxx>
#include <BRep_Tool.hxx>
#include <GeomAbs_Shape.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <Standard_Type.hxx>
#include <StdSelect_BRepOwner.hxx>
#include <TopExp.hxx>

View File

@@ -18,9 +18,11 @@
#define _AIS_C0RegularityFilter_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TopTools_MapOfShape.hxx>
#include <SelectMgr_Filter.hxx>
#include <Standard_Boolean.hxx>
#include <TopAbs_ShapeEnum.hxx>
class TopoDS_Shape;
class SelectMgr_EntityOwner;

View File

@@ -18,6 +18,7 @@
#include <AIS_GraphicTool.hxx>
#include <Aspect_TypeOfLine.hxx>
#include <GC_MakeArcOfCircle.hxx>
#include <Geom_Circle.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <Graphic3d_AspectLine3d.hxx>
@@ -27,11 +28,12 @@
#include <Prs3d_Presentation.hxx>
#include <Quantity_Color.hxx>
#include <Select3D_SensitiveCircle.hxx>
#include <Select3D_SensitivePoly.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <Standard_Type.hxx>
#include <StdPrs_DeflectionCurve.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TopoDS.hxx>
IMPLEMENT_STANDARD_RTTIEXT(AIS_Circle,AIS_InteractiveObject)
@@ -42,9 +44,9 @@ IMPLEMENT_STANDARD_RTTIEXT(AIS_Circle,AIS_InteractiveObject)
AIS_Circle::AIS_Circle(const Handle(Geom_Circle)& aComponent):
AIS_InteractiveObject(PrsMgr_TOP_AllView),
myComponent(aComponent),
myUStart (0.0),
myUEnd (2.0 * M_PI),
myCircleIsArc (Standard_False),
myUStart(0.),
myUEnd(2*M_PI),
myCircleIsArc(Standard_False),
myIsFilledCircleSens (Standard_False)
{
}
@@ -61,7 +63,7 @@ AIS_Circle::AIS_Circle(const Handle(Geom_Circle)& theComponent,
myComponent (theComponent),
myUStart (theUStart),
myUEnd (theUEnd),
myCircleIsArc (Abs (Abs (theUEnd - theUStart) - 2.0 * M_PI) > gp::Resolution()),
myCircleIsArc (Standard_True),
myIsFilledCircleSens (theIsFilledCircleSens)
{
}
@@ -208,14 +210,14 @@ void AIS_Circle::UnsetWidth()
//function : ComputeCircle
//purpose :
//=======================================================================
void AIS_Circle::ComputeCircle (const Handle(Prs3d_Presentation)& thePresentation)
void AIS_Circle::ComputeCircle( const Handle(Prs3d_Presentation)& aPresentation)
{
GeomAdaptor_Curve curv(myComponent);
Standard_Real prevdev = myDrawer->DeviationCoefficient();
myDrawer->SetDeviationCoefficient (1.e-5);
StdPrs_DeflectionCurve::Add (thePresentation, curv, myDrawer);
myDrawer->SetDeviationCoefficient (prevdev);
myDrawer->SetDeviationCoefficient(1.e-5);
StdPrs_DeflectionCurve::Add(aPresentation,curv,myDrawer);
myDrawer->SetDeviationCoefficient(prevdev);
}
@@ -224,13 +226,13 @@ void AIS_Circle::ComputeCircle (const Handle(Prs3d_Presentation)& thePresentatio
//purpose :
//=======================================================================
void AIS_Circle::ComputeArc (const Handle(Prs3d_Presentation)& thePresentation)
void AIS_Circle::ComputeArc( const Handle(Prs3d_Presentation)& aPresentation)
{
GeomAdaptor_Curve curv(myComponent, myUStart, myUEnd);
GeomAdaptor_Curve curv(myComponent,myUStart,myUEnd);
Standard_Real prevdev = myDrawer->DeviationCoefficient();
myDrawer->SetDeviationCoefficient (1.e-5);
StdPrs_DeflectionCurve::Add (thePresentation, curv, myDrawer);
myDrawer->SetDeviationCoefficient (prevdev);
myDrawer->SetDeviationCoefficient(1.e-5);
StdPrs_DeflectionCurve::Add(aPresentation,curv,myDrawer);
myDrawer->SetDeviationCoefficient(prevdev);
}
//=======================================================================
@@ -238,25 +240,27 @@ void AIS_Circle::ComputeArc (const Handle(Prs3d_Presentation)& thePresentation)
//purpose :
//=======================================================================
void AIS_Circle::ComputeCircleSelection (const Handle(SelectMgr_Selection)& theSelection)
void AIS_Circle::ComputeCircleSelection(const Handle(SelectMgr_Selection)& aSelection)
{
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner(this);
Handle(Select3D_SensitiveCircle) aCirc = new Select3D_SensitiveCircle (anOwner,
myComponent->Circ(),
myIsFilledCircleSens);
theSelection->Add (aCirc);
Handle(SelectMgr_EntityOwner) eown = new SelectMgr_EntityOwner(this);
Handle(Select3D_SensitiveCircle) seg = new Select3D_SensitiveCircle (eown,
myComponent->Circ(),
myIsFilledCircleSens);
aSelection->Add(seg);
}
//=======================================================================
//function : ComputeArcSelection
//purpose :
//=======================================================================
void AIS_Circle::ComputeArcSelection (const Handle(SelectMgr_Selection)& theSelection)
void AIS_Circle::ComputeArcSelection(const Handle(SelectMgr_Selection)& aSelection)
{
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner(this);
Handle(Select3D_SensitivePoly) aSeg = new Select3D_SensitivePoly (anOwner,
myComponent->Circ(),
myUStart, myUEnd,
myIsFilledCircleSens);
theSelection->Add (aSeg);
Handle(SelectMgr_EntityOwner) eown = new SelectMgr_EntityOwner(this);
Handle(Select3D_SensitiveCircle) seg = new Select3D_SensitiveCircle (eown,
myComponent->Circ(),
myUStart, myUEnd,
myIsFilledCircleSens);
aSelection->Add(seg);
}

View File

@@ -17,18 +17,26 @@
#include <AIS_InteractiveContext.hxx>
#include <Aspect_TypeOfColorScaleData.hxx>
#include <Aspect_TypeOfColorScalePosition.hxx>
#include <Aspect_Window.hxx>
#include <Geom_Line.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <Graphic3d_ArrayOfPolygons.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_AspectText3d.hxx>
#include <Graphic3d_GraphicDriver.hxx>
#include <Graphic3d_ArrayOfTriangles.hxx>
#include <Graphic3d_Text.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <Prs3d_Text.hxx>
#include <Prs3d_TextAspect.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <Select3D_SensitiveBox.hxx>
#include <Select3D_SensitiveSegment.hxx>
#include <StdPrs_Curve.hxx>
#include <V3d_Viewer.hxx>
#include <V3d_View.hxx>
IMPLEMENT_STANDARD_RTTIEXT(AIS_ColorScale, AIS_InteractiveObject)

View File

@@ -19,21 +19,28 @@
#include <BRep_Builder.hxx>
#include <BRepTools.hxx>
#include <BRepMesh_IncrementalMesh.hxx>
#include <gp_Pnt2d.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_ArrayOfTriangles.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_Group.hxx>
#include <Graphic3d_StructureManager.hxx>
#include <Graphic3d_Texture2Dmanual.hxx>
#include <Precision.hxx>
#include <Prs3d.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_IsoAspect.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <PrsMgr_PresentationManager.hxx>
#include <Standard_ErrorHandler.hxx>
#include <StdSelect_BRepSelectionTool.hxx>
#include <StdPrs_ShadedShape.hxx>
#include <StdPrs_ToolTriangulatedShape.hxx>
#include <StdPrs_WFShape.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Iterator.hxx>

Some files were not shown because too many files have changed in this diff Show More