mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-05 23:41:44 +00:00
Windows/MSVC + OCCT 7.0.0 (#124)
* Windows/MSVC build scripts: option to build and use official Open CASCADE instead of the community edition.
* Fix C4800 warnings ("'Standard_Boolean': forcing value to bool 'true' or 'false' (performance warning)") + unnecessary integer cast.
* build-deps.cmd: fix OCCT download
* Fix MSVC linking against OCCT 7.0.0. Example executables fail still, needs research.
* occt-V7_0_0-9059ca1_CMakeLists.txt: add_definitions(-DHAVE_NO_DLL) in order to fix static linking to OCCT. Mark IfcOpenShell patches in the OCCT patch files for clarity.
* Patch OCCT in order to fix compliaction when HAVE_NO_DLL is defind. Clean up IfcOpenSHell's linker warnings by defining HAVE_NO_DLL.
* CMakeLists.txt: remove linking to the newly added OCCT libs, these are not needed when HAVE_NO_DLL is defined.
* cmake/CMakeLists.txt: make add_debug_variants() function to handle filenames/paths also. Apply the coding conventions while at it. Fixes #123.
* Patch OCCT's OpenGl_PrimitiveArray.cxx and XCAFDoc_GeomTolerance.cxx in order to fix Debug build. Do not trigger OCCT rebuild each time build-deps.cmd is ran.
* build-deps.cmd: fix OCCT file patch copy.
* Non-MSVC compiler: use -Wextra, suppress/fix -Wignored-qualifiers warnings.
* build-deps.cmd: do not check return values of copy commands as they seem not to be fully reliable.
This commit is contained in:
committed by
Thomas Krijnen
parent
e064098f84
commit
64dc2ea95c
@@ -67,6 +67,7 @@ IF NOT EXIST %INSTALL_DIR%. mkdir %INSTALL_DIR%
|
||||
IF %VS_VER%==2008 set PATH=C:\Windows\Microsoft.NET\Framework\v3.5;%PATH%
|
||||
|
||||
:: User-configurable build options
|
||||
IF NOT DEFINED IFCOS_USE_OCCT set IFCOS_USE_OCCT=FALSE
|
||||
IF NOT DEFINED IFCOS_INSTALL_PYTHON set IFCOS_INSTALL_PYTHON=TRUE
|
||||
IF NOT DEFINED IFCOS_USE_PYTHON2 set IFCOS_USE_PYTHON2=FALSE
|
||||
IF NOT DEFINED IFCOS_NUM_BUILD_PROCS set IFCOS_NUM_BUILD_PROCS=%NUMBER_OF_PROCESSORS%
|
||||
@@ -102,6 +103,8 @@ IF %BUILD_CFG%==MinSizeRel call cecho.cmd 0 14 " WARNING: MinSizeRel build c
|
||||
call cecho.cmd 0 13 "* Build Type`t`t= %BUILD_TYPE%"
|
||||
echo - The used build type for the dependencies (Build, Rebuild, Clean).
|
||||
echo Defaults to Build if not specified. Rebuild/Clean also uninstalls Python (if it was installed by this script).
|
||||
call cecho.cmd 0 13 "* IFCOS_USE_OCCT`t= %IFCOS_USE_OCCT%"
|
||||
echo - Use the official Open CASCADE instead of the community edition.
|
||||
call cecho.cmd 0 13 "* IFCOS_INSTALL_PYTHON`t= %IFCOS_INSTALL_PYTHON%"
|
||||
echo - Download and install Python.
|
||||
echo Set to something other than TRUE if you wish to use an already installed version of Python.
|
||||
@@ -230,7 +233,86 @@ IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
call :InstallCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %DEBUG_OR_RELEASE%
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
|
||||
if %IFCOS_USE_OCCT%==FALSE goto :OCE
|
||||
:OCCT
|
||||
set OCC_INCLUDE_DIR=%INSTALL_DIR%\opencascade\inc>>"%~dp0\BuildDepsCache-%TARGET_ARCH%.txt"
|
||||
set OCC_LIBRARY_DIR=%INSTALL_DIR%\opencascade\win%ARCH_BITS%\lib>>"%~dp0\BuildDepsCache-%TARGET_ARCH%.txt"
|
||||
echo OCC_INCLUDE_DIR=%OCC_INCLUDE_DIR%>>"%~dp0\BuildDepsCache-%TARGET_ARCH%.txt"
|
||||
echo OCC_LIBRARY_DIR=%OCC_LIBRARY_DIR%>>"%~dp0\BuildDepsCache-%TARGET_ARCH%.txt"
|
||||
:: OCCT has many dependencies but FreeType is the only mandatory
|
||||
set DEPENDENCY_NAME=FreeType
|
||||
set DEPENDENCY_DIR=%DEPS_DIR%\freetype-2.6.5
|
||||
set FREETYPE_ZIP=ft265.zip
|
||||
cd "%DEPS_DIR%"
|
||||
call :DownloadFile http://download.savannah.gnu.org/releases/freetype/%FREETYPE_ZIP% "%DEPS_DIR%" %FREETYPE_ZIP%
|
||||
if not %ERRORLEVEL%==0 goto :Error
|
||||
call :ExtractArchive %FREETYPE_ZIP% "%DEPS_DIR%" "%DEPENDENCY_DIR%"
|
||||
if not %ERRORLEVEL%==0 goto :Error
|
||||
cd "%DEPENDENCY_DIR%"
|
||||
:: NOTE FreeType is built as a static library by default
|
||||
call :RunCMake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\freetype"
|
||||
if not %ERRORLEVEL%==0 goto :Error
|
||||
call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\freetype.sln" %BUILD_CFG%
|
||||
if not %ERRORLEVEL%==0 goto :Error
|
||||
call :InstallCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
|
||||
if not %ERRORLEVEL%==0 goto :Error
|
||||
|
||||
set DEPENDENCY_NAME=Open CASCADE 7.0.0
|
||||
set OCCT_FILENAME=occt-V7_0_0-9059ca1
|
||||
set DEPENDENCY_DIR=%DEPS_DIR%\%OCCT_FILENAME%
|
||||
cd "%DEPS_DIR%"
|
||||
call :DownloadFile "http://git.dev.opencascade.org/gitweb/?p=occt.git;a=snapshot;h=V7_0_0;sf=tgz" "%DEPS_DIR%" %OCCT_FILENAME%.tar.gz
|
||||
if not %ERRORLEVEL%==0 goto :Error
|
||||
call :ExtractArchive %OCCT_FILENAME%.tar.gz "%DEPS_DIR%" "%DEPENDENCY_DIR%"
|
||||
if not %ERRORLEVEL%==0 goto :Error
|
||||
call :ExtractArchive %OCCT_FILENAME%.tar "%DEPS_DIR%" "%DEPENDENCY_DIR%"
|
||||
if not %ERRORLEVEL%==0 goto :Error
|
||||
|
||||
:: Patching always blindly would trigger a rebuild each time
|
||||
findstr IfcOpenShell "%DEPENDENCY_DIR%\src\XCAFDoc\XCAFDoc_GeomTolerance.cxx">NUL
|
||||
if not %ERRORLEVEL%==0 (
|
||||
echo Patching %DEPENDENCY_NAME%'s CMake files
|
||||
REM OCCT insists on finding FreeType DLL even if using static FreeType build + define HAVE_NO_DLL
|
||||
copy /y "%~dp0patches\occt-V7_0_0-9059ca1_CMakeLists.txt" "%DEPENDENCY_DIR%\CMakeLists.txt"
|
||||
REM Patch OCCT to be built against the static MSVC run-time.
|
||||
copy /y "%~dp0patches\occt-V7_0_0-9059ca1_occt_defs_flags.cmake" "%DEPENDENCY_DIR%\adm\cmake\occt_defs_flags.cmake"
|
||||
REM OCCT tries to deploy PDBs from the bin directory even if static build is used.
|
||||
copy /y "%~dp0patches\occt-V7_0_0-9059ca1_occt_toolkit.cmake" "%DEPENDENCY_DIR%\adm\cmake\occt_toolkit.cmake"
|
||||
REM Defining HAVE_NO_DLL causes compilation errors due to Win32 GetObject and max macros
|
||||
copy /y "%~dp0patches\occt-V7_0_0-9059ca1_XCAFDoc_Dimension.cxx" "%DEPENDENCY_DIR%\src\XCAFDoc\XCAFDoc_Dimension.cxx"
|
||||
copy /y "%~dp0patches\occt-V7_0_0-9059ca1_OpenGl_PrimitiveArray.cxx" "%DEPENDENCY_DIR%\src\OpenGl\OpenGl_PrimitiveArray.cxx"
|
||||
copy /y "%~dp0patches\occt-V7_0_0-9059ca1_XCAFDoc_GeomTolerance.cxx" "%DEPENDENCY_DIR%\src\XCAFDoc\XCAFDoc_GeomTolerance.cxx"
|
||||
REM NOTE If adding a new patch, adjust the checks above and below accordingly
|
||||
)
|
||||
findstr IfcOpenShell "%DEPENDENCY_DIR%\src\XCAFDoc\XCAFDoc_GeomTolerance.cxx">NUL
|
||||
if not %ERRORLEVEL%==0 goto :Error
|
||||
|
||||
cd "%DEPENDENCY_DIR%"
|
||||
call :RunCMake -DINSTALL_DIR="%INSTALL_DIR%\opencascade" -DBUILD_LIBRARY_TYPE="Static" -DCMAKE_DEBUG_POSTFIX=d ^
|
||||
-DBUILD_MODULE_Draw=0 -D3RDPARTY_FREETYPE_DIR="%INSTALL_DIR%\freetype"
|
||||
if not %ERRORLEVEL%==0 goto :Error
|
||||
call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\OCCT.sln" %BUILD_CFG%
|
||||
if not %ERRORLEVEL%==0 goto :Error
|
||||
call :InstallCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
|
||||
if not %ERRORLEVEL%==0 goto :Error
|
||||
:: Use a single lib directory for for release and debug libraries as is done with OCE
|
||||
if not exist "%OCC_LIBRARY_DIR%". mkdir "%OCC_LIBRARY_DIR%"
|
||||
move /y "%INSTALL_DIR%\opencascade\win%ARCH_BITS%\vc%VC_VER%\libi\*.*" "%OCC_LIBRARY_DIR%"
|
||||
move /y "%INSTALL_DIR%\opencascade\win%ARCH_BITS%\vc%VC_VER%\libd\*.*" "%OCC_LIBRARY_DIR%"
|
||||
rmdir /s /q "%INSTALL_DIR%\opencascade\win%ARCH_BITS%\vc%VC_VER%"
|
||||
:: Removed unneeded bits
|
||||
rmdir /s /q "%INSTALL_DIR%\opencascade\data"
|
||||
rmdir /s /q "%INSTALL_DIR%\opencascade\samples"
|
||||
del "%INSTALL_DIR%\opencascade\*.bat"
|
||||
|
||||
goto :Python
|
||||
|
||||
:OCE
|
||||
set OCC_INCLUDE_DIR=%INSTALL_DIR%\oce\include\oce>>"%~dp0\BuildDepsCache-%TARGET_ARCH%.txt"
|
||||
set OCC_LIBRARY_DIR=%INSTALL_DIR%\oce\Win%ARCH_BITS%\lib>>"%~dp0\BuildDepsCache-%TARGET_ARCH%.txt"
|
||||
echo OCC_INCLUDE_DIR=%OCC_INCLUDE_DIR%>>"%~dp0\BuildDepsCache-%TARGET_ARCH%.txt"
|
||||
echo OCC_LIBRARY_DIR=%OCC_LIBRARY_DIR%>>"%~dp0\BuildDepsCache-%TARGET_ARCH%.txt"
|
||||
|
||||
set DEPENDENCY_NAME=Open CASCADE Community Edition
|
||||
set DEPENDENCY_DIR=%DEPS_DIR%\oce
|
||||
call :GitCloneOrPullRepository https://github.com/tpaviot/oce.git "%DEPENDENCY_DIR%"
|
||||
@@ -428,6 +510,8 @@ set RET=%ERRORLEVEL%
|
||||
popd
|
||||
exit /b %RET%
|
||||
|
||||
:: TODO add BuildCMakeProject which utilizes cmake --build
|
||||
|
||||
:: BuildSolution - Builds/Rebuilds/Cleans a solution using MSBuild
|
||||
:: Params: %1 solutioName, %2 configuration
|
||||
:BuildSolution
|
||||
@@ -438,6 +522,7 @@ exit /b %ERRORLEVEL%
|
||||
:: InstallCMakeProject - Builds the INSTALL project of CMake-based project
|
||||
:: Params: %1 buildDir, %2 == configuration
|
||||
:: NOTE the actual install dir is set during cmake run.
|
||||
:: TODO Utilize cmake --build --target INSTALL
|
||||
:InstallCMakeProject
|
||||
pushd %1
|
||||
call cecho.cmd 0 13 "Installing %2 %DEPENDENCY_NAME%. Please be patient, this will take a while."
|
||||
|
||||
@@ -0,0 +1,851 @@
|
||||
cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
|
||||
|
||||
set (CMAKE_SUPPRESS_REGENERATION TRUE)
|
||||
|
||||
set (CMAKE_CONFIGURATION_TYPES Release Debug RelWithDebInfo CACHE INTERNAL "" FORCE)
|
||||
|
||||
# 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")
|
||||
include (${BUILD_PATCH}/${BEING_INCLUDED_FILE}.cmake)
|
||||
else()
|
||||
include (${CMAKE_SOURCE_DIR}/${BEING_INCLUDED_FILE}.cmake)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# include variable description
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/vardescr")
|
||||
|
||||
# set type of OCCT libraries
|
||||
if (NOT BUILD_LIBRARY_TYPE)
|
||||
set (BUILD_LIBRARY_TYPE "Shared" CACHE STRING "${BUILD_LIBRARY_TYPE_DESCR}" FORCE)
|
||||
SET_PROPERTY(CACHE BUILD_LIBRARY_TYPE PROPERTY STRINGS Shared Static)
|
||||
endif()
|
||||
|
||||
if ("${BUILD_LIBRARY_TYPE}" STREQUAL "Shared")
|
||||
set (BUILD_SHARED_LIBS ON)
|
||||
else()
|
||||
unset (BUILD_SHARED_LIBS)
|
||||
endif()
|
||||
|
||||
# the name of the project
|
||||
project (OCCT)
|
||||
|
||||
# include occt macros
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
|
||||
|
||||
# Solution folder property
|
||||
set_property (GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
# get current OCCT version
|
||||
OCC_VERSION (OCC_VERSION_MAJOR OCC_VERSION_MINOR OCC_VERSION_MAINTENANCE OCC_VERSION_DEVELOPMENT OCC_VERSION_STRING_EXT)
|
||||
|
||||
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 (INSTALL_TEST_CASES OFF CACHE BOOL "${INSTALL_TEST_CASES_DESCR}")
|
||||
|
||||
# single-configuration generator
|
||||
set (SINGLE_GENERATOR OFF)
|
||||
if (CMAKE_BUILD_TYPE)
|
||||
set (SINGLE_GENERATOR ON)
|
||||
endif()
|
||||
|
||||
# a single-configuration generator like the Makefile generator defines CMAKE_BUILD_TYPE variable
|
||||
# check this variable and set if it's required
|
||||
if (DEFINED CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE) # single-configuration generator.
|
||||
set (CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
|
||||
endif()
|
||||
|
||||
# enable extended messages of many OCCT algorithms
|
||||
set (BUILD_WITH_DEBUG OFF CACHE BOOL "${BUILD_WITH_DEBUG_DESCR}")
|
||||
if (BUILD_WITH_DEBUG)
|
||||
add_definitions (-DOCCT_DEBUG)
|
||||
endif()
|
||||
|
||||
# copy samples to install directory
|
||||
set (INSTALL_SAMPLES OFF CACHE BOOL "${INSTALL_SAMPLES_DESCR}")
|
||||
|
||||
# install dir of the project
|
||||
if (NOT DEFINED INSTALL_DIR)
|
||||
# set default install directory for Windows
|
||||
if (WIN32 AND NOT DEFINED CMAKE_INSTALL_PREFIX)
|
||||
set (CMAKE_INSTALL_PREFIX "C:/opencascade-${OCC_VERSION_STRING_EXT}")
|
||||
endif()
|
||||
set (INSTALL_DIR "${CMAKE_INSTALL_PREFIX}" CACHE PATH "${INSTALL_DIR_DESCR}")
|
||||
else()
|
||||
file (TO_CMAKE_PATH "${INSTALL_DIR}" INSTALL_DIR)
|
||||
set (INSTALL_DIR "${INSTALL_DIR}" CACHE PATH "${INSTALL_DIR_DESCR}" FORCE)
|
||||
endif()
|
||||
|
||||
# choose a variant of the layout of the install paths
|
||||
if (NOT INSTALL_DIR_LAYOUT)
|
||||
if (WIN32)
|
||||
set (INSTALL_DIR_LAYOUT "Windows" CACHE STRING "${INSTALL_DIR_LAYOUT_DESCR}" FORCE)
|
||||
else()
|
||||
set (INSTALL_DIR_LAYOUT "Unix" CACHE STRING "${INSTALL_DIR_LAYOUT_DESCR}" FORCE)
|
||||
endif()
|
||||
SET_PROPERTY(CACHE INSTALL_DIR_LAYOUT PROPERTY STRINGS Windows Unix)
|
||||
endif()
|
||||
|
||||
# check INSTALL_DIR_LAYOUT changes and update INSTALL_DIR_* paths if necessary
|
||||
if (NOT DEFINED INSTALL_DIR_LAYOUT_PREV)
|
||||
set (INSTALL_DIR_LAYOUT_PREV "${INSTALL_DIR_LAYOUT}" CACHE INTERNAL "" FORCE)
|
||||
elseif (NOT "${INSTALL_DIR_LAYOUT_PREV}" STREQUAL "${INSTALL_DIR_LAYOUT}")
|
||||
set (INSTALL_DIR_LAYOUT_PREV "${INSTALL_DIR_LAYOUT}" CACHE INTERNAL "" FORCE)
|
||||
# The structure of install folder should be reset due to changed layout
|
||||
OCCT_CHECK_AND_UNSET_INSTALL_DIR_SUBDIRS ()
|
||||
|
||||
# Unset INSTALL_DIR_WITH_VERSION on windows
|
||||
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Windows")
|
||||
OCCT_CHECK_AND_UNSET (INSTALL_DIR_WITH_VERSION)
|
||||
else()
|
||||
if (NOT DEFINED INSTALL_DIR_WITH_VERSION)
|
||||
set (INSTALL_DIR_WITH_VERSION OFF CACHE BOOL "${INSTALL_DIR_WITH_VERSION_DESCR}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# check CMAKE_INSTALL_PREFIX changes and update INSTALL_DIR if necessary
|
||||
if (NOT DEFINED CMAKE_INSTALL_PREFIX_PREV)
|
||||
set (CMAKE_INSTALL_PREFIX_PREV "${CMAKE_INSTALL_PREFIX}" CACHE INTERNAL "" FORCE)
|
||||
elseif (NOT "${CMAKE_INSTALL_PREFIX_PREV}" STREQUAL "${CMAKE_INSTALL_PREFIX}")
|
||||
# CMAKE_INSTALL_PREFIX has been changed at previous step
|
||||
set (CMAKE_INSTALL_PREFIX_PREV "${CMAKE_INSTALL_PREFIX}" CACHE INTERNAL "" FORCE)
|
||||
|
||||
# INSTALL_DIR is required to be updated
|
||||
set (INSTALL_DIR "${CMAKE_INSTALL_PREFIX}" CACHE PATH "${INSTALL_DIR_DESCR}" FORCE)
|
||||
endif()
|
||||
|
||||
# check INSTALL_DIR changes and update CMAKE_INSTALL_PREFIX if necessary
|
||||
if (NOT DEFINED INSTALL_DIR_PREV)
|
||||
set (INSTALL_DIR_PREV "${INSTALL_DIR}" CACHE INTERNAL "" FORCE)
|
||||
elseif (NOT "${INSTALL_DIR_PREV}" STREQUAL "${INSTALL_DIR}")
|
||||
# INSTALL_DIR has been changed at previous step
|
||||
set (INSTALL_DIR_PREV "${INSTALL_DIR}" CACHE INTERNAL "" FORCE)
|
||||
|
||||
# sync CMAKE_INSTALL_PREFIX with INSTALL_DIR
|
||||
set (CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE)
|
||||
|
||||
# set CMAKE_INSTALL_PREFIX_PREV to avoid the reset of structure of the install folder
|
||||
set (CMAKE_INSTALL_PREFIX_PREV "${INSTALL_DIR}" CACHE INTERNAL "" FORCE)
|
||||
endif()
|
||||
|
||||
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
|
||||
if (NOT DEFINED INSTALL_DIR_WITH_VERSION_PREV)
|
||||
set (INSTALL_DIR_WITH_VERSION_PREV "${INSTALL_DIR_WITH_VERSION}" CACHE INTERNAL "" FORCE)
|
||||
elseif (NOT "${INSTALL_DIR_WITH_VERSION_PREV}" STREQUAL "${INSTALL_DIR_WITH_VERSION}")
|
||||
# INSTALL_DIR_WITH_VERSION has been changed at previous step
|
||||
set (INSTALL_DIR_WITH_VERSION_PREV "${INSTALL_DIR_WITH_VERSION}" CACHE INTERNAL "" FORCE)
|
||||
|
||||
OCCT_CHECK_AND_UNSET_INSTALL_DIR_SUBDIRS ()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# hide CMAKE_INSTALL_PREFIX from a user
|
||||
set (CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE)
|
||||
|
||||
set (BIN_LETTER "")
|
||||
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||
set (BIN_LETTER "d")
|
||||
elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
|
||||
set (BIN_LETTER "i")
|
||||
endif()
|
||||
|
||||
# Get all used variables: OS_WITH_BIT, COMPILER
|
||||
OCCT_MAKE_OS_WITH_BITNESS()
|
||||
OCCT_MAKE_COMPILER_SHORT_NAME()
|
||||
|
||||
# do not define INSTALL_DIR_BIN for win.
|
||||
# Leave library structure for win: <prefix>/win64/vc10/bin(d)
|
||||
if (NOT DEFINED INSTALL_DIR_BIN)
|
||||
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
|
||||
set (INSTALL_DIR_BIN "bin" CACHE PATH "${INSTALL_DIR_BIN_DESCR}")
|
||||
else()
|
||||
set (INSTALL_DIR_BIN "${OS_WITH_BIT}/${COMPILER}/bin" CACHE PATH "${INSTALL_DIR_BIN_DESCR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# define folder contaning all shell/batch scripts
|
||||
if (NOT DEFINED INSTALL_DIR_SCRIPT)
|
||||
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
|
||||
set (INSTALL_DIR_SCRIPT "${INSTALL_DIR_BIN}" CACHE PATH "${INSTALL_DIR_SCRIPT_DESCR}")
|
||||
else()
|
||||
set (INSTALL_DIR_SCRIPT "." CACHE PATH "${INSTALL_DIR_SCRIPT_DESCR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# place the libraries to <prefix>/lib folder for unix and leave old structure for windows
|
||||
if (NOT DEFINED INSTALL_DIR_LIB)
|
||||
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
|
||||
set (INSTALL_DIR_LIB "lib" CACHE PATH "${INSTALL_DIR_LIB_DESCR}")
|
||||
else()
|
||||
set (INSTALL_DIR_LIB "${OS_WITH_BIT}/${COMPILER}/lib" CACHE PATH "${INSTALL_DIR_LIB_DESCR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# OCCT headers: <prefix>/inc for windows,
|
||||
# <prefix>/include/opencascade-7.0.0 for unix
|
||||
if (NOT DEFINED INSTALL_DIR_INCLUDE)
|
||||
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
|
||||
set (INSTALL_DIR_INCLUDE "include/opencascade" CACHE PATH "${INSTALL_DIR_INCLUDE_DESCR}")
|
||||
if (INSTALL_DIR_WITH_VERSION)
|
||||
set (INSTALL_DIR_INCLUDE "include/opencascade-${OCC_VERSION_STRING_EXT}" CACHE PATH "${INSTALL_DIR_INCLUDE_DESCR}" FORCE)
|
||||
endif()
|
||||
else()
|
||||
set (INSTALL_DIR_INCLUDE "inc" CACHE PATH "${INSTALL_DIR_INCLUDE_DESCR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# OCCT resources: <prefix>/src for windows,
|
||||
# <prefix>/share/opencascade-7.0.0/resources for unix
|
||||
if (NOT DEFINED INSTALL_DIR_RESOURCE)
|
||||
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
|
||||
set (INSTALL_DIR_RESOURCE "share/opencascade/resources" CACHE PATH "${INSTALL_DIR_RESOURCE_DESCR}")
|
||||
if (INSTALL_DIR_WITH_VERSION)
|
||||
set (INSTALL_DIR_RESOURCE "share/opencascade-${OCC_VERSION_STRING_EXT}/resources" CACHE PATH "${INSTALL_DIR_RESOURCE_DESCR}" FORCE)
|
||||
endif()
|
||||
else()
|
||||
set (INSTALL_DIR_RESOURCE "src" CACHE PATH "${INSTALL_DIR_RESOURCE_DESCR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# OCCT data
|
||||
if (NOT DEFINED INSTALL_DIR_DATA)
|
||||
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
|
||||
set (INSTALL_DIR_DATA "share/opencascade/data" CACHE PATH "${INSTALL_DIR_DATA_DESCR}")
|
||||
if (INSTALL_DIR_WITH_VERSION)
|
||||
set (INSTALL_DIR_DATA "share/opencascade-${OCC_VERSION_STRING_EXT}/data" CACHE PATH "${INSTALL_DIR_DATA_DESCR}" FORCE)
|
||||
endif()
|
||||
else()
|
||||
set (INSTALL_DIR_DATA "data" CACHE PATH "${INSTALL_DIR_DATA_DESCR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# OCCT samples
|
||||
if (NOT DEFINED INSTALL_DIR_SAMPLES)
|
||||
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
|
||||
set (INSTALL_DIR_SAMPLES "share/opencascade/samples" CACHE PATH "${INSTALL_DIR_SAMPLES_DESCR}")
|
||||
if (INSTALL_DIR_WITH_VERSION)
|
||||
set (INSTALL_DIR_SAMPLES "share/opencascade-${OCC_VERSION_STRING_EXT}/samples" CACHE PATH "${INSTALL_DIR_SAMPLES_DESCR}" FORCE)
|
||||
endif()
|
||||
else()
|
||||
set (INSTALL_DIR_SAMPLES "samples" CACHE PATH "${INSTALL_DIR_SAMPLES_DESCR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# OCCT tests
|
||||
if (NOT DEFINED INSTALL_DIR_TESTS)
|
||||
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
|
||||
set (INSTALL_DIR_TESTS "share/opencascade/tests" CACHE PATH "${INSTALL_DIR_TESTS_DESCR}")
|
||||
if (INSTALL_DIR_WITH_VERSION)
|
||||
set (INSTALL_DIR_TESTS "share/opencascade-${OCC_VERSION_STRING_EXT}/tests" CACHE PATH "${INSTALL_DIR_TESTS_DESCR}" FORCE)
|
||||
endif()
|
||||
else()
|
||||
set (INSTALL_DIR_TESTS "tests" CACHE PATH "${INSTALL_DIR_TESTS_DESCR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# OCCT doc
|
||||
if (NOT DEFINED INSTALL_DIR_DOC)
|
||||
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
|
||||
set (INSTALL_DIR_DOC "share/doc/opencascade" CACHE PATH "${INSTALL_DIR_DOC_DESCR}")
|
||||
if (INSTALL_DIR_WITH_VERSION)
|
||||
set (INSTALL_DIR_DOC "share/doc/opencascade-${OCC_VERSION_STRING_EXT}" CACHE PATH "${INSTALL_DIR_DOC_DESCR}" FORCE)
|
||||
endif()
|
||||
else()
|
||||
set (INSTALL_DIR_DOC "doc" CACHE PATH "${INSTALL_DIR_DOC_DESCR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# define folder contaning CMake configuration files
|
||||
if (NOT DEFINED INSTALL_DIR_CMAKE)
|
||||
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
|
||||
if (INSTALL_DIR_WITH_VERSION)
|
||||
set (INSTALL_DIR_CMAKE "lib/cmake/opencascade-${OCC_VERSION_STRING_EXT}" CACHE PATH "${INSTALL_DIR_CMAKE_DESCR}")
|
||||
else()
|
||||
set (INSTALL_DIR_CMAKE "lib/cmake/opencascade" CACHE PATH "${INSTALL_DIR_CMAKE_DESCR}")
|
||||
endif()
|
||||
else()
|
||||
set (INSTALL_DIR_CMAKE "cmake" CACHE PATH "${INSTALL_DIR_CMAKE_DESCR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# install LICENSE_LGPL_21.txt and OCCT_LGPL_EXCEPTION.txt files
|
||||
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
|
||||
OCCT_INSTALL_FILE_OR_DIR ("LICENSE_LGPL_21.txt" "${INSTALL_DIR}/${INSTALL_DIR_DOC}")
|
||||
OCCT_INSTALL_FILE_OR_DIR ("OCCT_LGPL_EXCEPTION.txt" "${INSTALL_DIR}/${INSTALL_DIR_DOC}")
|
||||
else()
|
||||
OCCT_INSTALL_FILE_OR_DIR ("LICENSE_LGPL_21.txt" "${INSTALL_DIR}")
|
||||
OCCT_INSTALL_FILE_OR_DIR ("OCCT_LGPL_EXCEPTION.txt" "${INSTALL_DIR}")
|
||||
endif()
|
||||
|
||||
# a directory recognized as a 'patch' for OCCT
|
||||
set (BUILD_PATCH "" CACHE PATH "${BUILD_PATCH_DESCR}")
|
||||
|
||||
# the list of being built toolkits
|
||||
set (BUILD_ADDITIONAL_TOOLKITS "" CACHE STRING "${BUILD_ADDITIONAL_TOOLKITS_DESCR}")
|
||||
separate_arguments (BUILD_ADDITIONAL_TOOLKITS)
|
||||
|
||||
if (MSVC)
|
||||
set (BUILD_MODULE_MfcSamples OFF CACHE BOOL "${BUILD_MODULE_MfcSamples_DESCR}")
|
||||
endif()
|
||||
|
||||
# whether use optional 3rdparty or not
|
||||
if (APPLE)
|
||||
set (USE_GLX OFF CACHE BOOL "${USE_GLX_DESCR}")
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
set (USE_D3D OFF CACHE BOOL "${USE_D3D_DESCR}")
|
||||
endif()
|
||||
|
||||
# include the patched or original list of modules
|
||||
# list <MODULENAME>_TOOLKITS is created foreach module and contains its toolkits
|
||||
# list <OCCT_MODULES> will contain all modules
|
||||
OCCT_MODULES_AND_TOOLKITS (OCCT_MODULES)
|
||||
|
||||
foreach (OCCT_MODULE ${OCCT_MODULES})
|
||||
BUILD_MODULE (${OCCT_MODULE})
|
||||
endforeach()
|
||||
|
||||
if (ANDROID AND BUILD_MODULE_Draw)
|
||||
message (STATUS "Info. Draw module is turned off due to it is not supported on Android")
|
||||
set (BUILD_MODULE_Draw OFF CACHE BOOL "${BUILD_MODULE_Draw_DESCR}" FORCE)
|
||||
endif()
|
||||
|
||||
# Overview
|
||||
set (BUILD_DOC_Overview OFF CACHE BOOL "${BUILD_DOC_Overview_DESCR}")
|
||||
|
||||
if (NOT USE_D3D)
|
||||
list (REMOVE_ITEM Visualization_TOOLKITS TKD3DHost)
|
||||
endif()
|
||||
|
||||
# accumulate used toolkits (first level) in BUILD_TOOLKITS variable
|
||||
list (APPEND BUILD_TOOLKITS ${BUILD_ADDITIONAL_TOOLKITS})
|
||||
|
||||
foreach (OCCT_MODULE ${OCCT_MODULES})
|
||||
if (BUILD_MODULE_${OCCT_MODULE})
|
||||
list (APPEND BUILD_TOOLKITS ${${OCCT_MODULE}_TOOLKITS})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# DRAWEXE excluded when library build is static
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
list (REMOVE_ITEM BUILD_TOOLKITS DRAWEXE)
|
||||
message (STATUS "Info: DRAWEXE is not included due to ${BUILD_LIBRARY_TYPE} build library type")
|
||||
# IfcOpenShell begin
|
||||
add_definitions(-DHAVE_NO_DLL)
|
||||
# IfcOpenShell end
|
||||
endif()
|
||||
|
||||
# accumulate all used toolkits
|
||||
list (REMOVE_DUPLICATES BUILD_TOOLKITS)
|
||||
set (RAW_BUILD_TOOLKITS)
|
||||
foreach (BUILD_TOOLKIT ${BUILD_TOOLKITS})
|
||||
OCCT_TOOLKIT_FULL_DEP (${BUILD_TOOLKIT} TOOLKIT_FULL_DEPS)
|
||||
list (APPEND RAW_BUILD_TOOLKITS ${BUILD_TOOLKIT} ${TOOLKIT_FULL_DEPS})
|
||||
endforeach()
|
||||
|
||||
list (REMOVE_DUPLICATES RAW_BUILD_TOOLKITS)
|
||||
set (BUILD_TOOLKITS ${RAW_BUILD_TOOLKITS})
|
||||
|
||||
# include the patched or original list of definitions and flags
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_defs_flags")
|
||||
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/3rdparty_macro")
|
||||
|
||||
# search for TKIVtk and TKIVtkDraw in BUILD_TOOLKITS
|
||||
list (FIND BUILD_TOOLKITS TKIVtk CAN_USE_VTK)
|
||||
if (CAN_USE_VTK EQUAL -1)
|
||||
list (FIND BUILD_TOOLKITS TKIVtkDraw CAN_USE_VTK)
|
||||
endif()
|
||||
|
||||
if (NOT CAN_USE_VTK EQUAL -1)
|
||||
if (NOT DEFINED USE_VTK)
|
||||
set (USE_VTK OFF CACHE BOOL "${USE_VTK_DESCR}")
|
||||
endif()
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET (USE_VTK)
|
||||
endif()
|
||||
|
||||
# Rebuild *.yacc and *.lex files that are contained by TKMath toolkit
|
||||
list (FIND BUILD_TOOLKITS TKMath CAN_REBUILD_PDC_FOR_TKMATH)
|
||||
list (FIND BUILD_TOOLKITS StepFile CAN_REBUILD_PDC_FOR_STEPFILE)
|
||||
|
||||
if (NOT ${CAN_REBUILD_PDC_FOR_TKMATH} EQUAL -1 OR NOT ${CAN_REBUILD_PDC_FOR_STEPFILE} EQUAL -1)
|
||||
set (BUILD_YACCLEX OFF CACHE BOOL "${BUILD_YACCLEX_DESCR}")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET (BUILD_YACCLEX)
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_DIR)
|
||||
set (3RDPARTY_DIR "" CACHE PATH ${3RDPARTY_DIR_DESCR})
|
||||
get_filename_component (3RDPARTY_DIR "${3RDPARTY_DIR}" ABSOLUTE)
|
||||
else()
|
||||
file (TO_CMAKE_PATH "${3RDPARTY_DIR}" 3RDPARTY_DIR)
|
||||
set (3RDPARTY_DIR "${3RDPARTY_DIR}" CACHE PATH "${3RDPARTY_DIR_DESCR}" FORCE)
|
||||
endif()
|
||||
|
||||
# search for CSF_TclLibs variable in EXTERNLIB of each being used toolkit
|
||||
OCCT_IS_PRODUCT_REQUIRED (CSF_TclLibs USE_TCL)
|
||||
|
||||
if (USE_TCL)
|
||||
message (STATUS "Info: TCL is used by OCCT")
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tcl")
|
||||
|
||||
message (STATUS "Info: TK is used by OCCT")
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tk")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TCL")
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TK")
|
||||
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_TCL")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_TK")
|
||||
endif()
|
||||
|
||||
# search for CSF_FREETYPE variable in EXTERNLIB of each being used toolkit
|
||||
OCCT_IS_PRODUCT_REQUIRED (CSF_FREETYPE USE_FREETYPE)
|
||||
|
||||
if (USE_FREETYPE)
|
||||
message (STATUS "Info: Freetype is used by OCCT")
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freetype")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREETYPE")
|
||||
OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2")
|
||||
OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_FREETYPE")
|
||||
endif()
|
||||
|
||||
# VTK
|
||||
if (USE_VTK)
|
||||
add_definitions (-DHAVE_VTK)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/vtk")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_VTK")
|
||||
|
||||
if (NOT CAN_USE_VTK EQUAL -1)
|
||||
message (STATUS "Info: TKIVtk and TKIVtkDraw toolkits excluded due to VTK usage is disabled")
|
||||
|
||||
list (REMOVE_ITEM BUILD_TOOLKITS TKIVtk)
|
||||
list (REMOVE_ITEM BUILD_TOOLKITS TKIVtkDraw)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# D3D
|
||||
if (USE_D3D)
|
||||
add_definitions (-DHAVE_D3D)
|
||||
#if(MSVC_VERSION LESS 1700)
|
||||
#OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/d3d")
|
||||
#endif()
|
||||
endif()
|
||||
|
||||
# GLX
|
||||
if (USE_GLX)
|
||||
add_definitions (-DMACOSX_USE_GLX)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/glx")
|
||||
endif()
|
||||
|
||||
# FREEIMAGE
|
||||
# search for CSF_FREEIMAGE variable in EXTERNLIB of each being used toolkit
|
||||
OCCT_IS_PRODUCT_REQUIRED (CSF_FREEIMAGE CAN_USE_FREEIMAGE)
|
||||
OCCT_IS_PRODUCT_REQUIRED (CSF_FreeImagePlus CAN_USE_FREEIMAGEPLUS)
|
||||
|
||||
if (CAN_USE_FREEIMAGE OR CAN_USE_FREEIMAGEPLUS)
|
||||
set (USE_FREEIMAGE OFF CACHE BOOL "${USE_FREEIMAGE_DESCR}")
|
||||
|
||||
if (USE_FREEIMAGE)
|
||||
add_definitions (-DHAVE_FREEIMAGE)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freeimage")
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freeimageplus")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGE")
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGEPLUS")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGE")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGEPLUS")
|
||||
endif()
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET ("USE_FREEIMAGE")
|
||||
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGE")
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGEPLUS")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGE")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGEPLUS")
|
||||
endif()
|
||||
|
||||
# GL2PS
|
||||
# search for CSF_GL2PS variable in EXTERNLIB of each being used toolkit
|
||||
OCCT_IS_PRODUCT_REQUIRED (CSF_GL2PS CAN_USE_GL2PS)
|
||||
|
||||
if (NOT DEFINED ANDROID AND CAN_USE_GL2PS)
|
||||
set (USE_GL2PS OFF CACHE BOOL "${USE_GL2PS_DESCR}")
|
||||
|
||||
if (USE_GL2PS)
|
||||
add_definitions (-DHAVE_GL2PS)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gl2ps")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GL2PS")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_GL2PS")
|
||||
endif()
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET ("USE_GL2PS")
|
||||
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GL2PS")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_GL2PS")
|
||||
endif()
|
||||
|
||||
# TBB
|
||||
# search for CSF_TBB variable in EXTERNLIB of each being used toolkit
|
||||
OCCT_IS_PRODUCT_REQUIRED (CSF_TBB CAN_USE_TBB)
|
||||
|
||||
if (NOT DEFINED ANDROID AND CAN_USE_TBB)
|
||||
set (USE_TBB OFF CACHE BOOL "${USE_TBB_DESCR}")
|
||||
|
||||
if (USE_TBB)
|
||||
add_definitions (-DHAVE_TBB)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tbb")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB")
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBBMALLOC")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_TBB")
|
||||
endif()
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET ("USE_TBB")
|
||||
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB")
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBBMALLOC")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_TBB")
|
||||
endif()
|
||||
|
||||
# Doxygen
|
||||
if (BUILD_DOC_Overview)
|
||||
if (NOT DEFINED INSTALL_DOC_Overview)
|
||||
set (INSTALL_DOC_Overview OFF CACHE BOOL "${INSTALL_DOC_Overview_DESCR}")
|
||||
endif()
|
||||
|
||||
if (INSTALL_DOC_Overview)
|
||||
install (DIRECTORY "${CMAKE_BINARY_DIR}/doc/overview" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_DOC}")
|
||||
|
||||
# create overview.html only for windows
|
||||
if (WIN32 AND "${INSTALL_DIR_LAYOUT}" STREQUAL "Windows")
|
||||
OCCT_INSTALL_FILE_OR_DIR ("dox/resources/overview.html" "${INSTALL_DIR}/${INSTALL_DIR_DOC}/..")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/doxygen")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_DOC_Overview")
|
||||
|
||||
OCCT_CHECK_AND_UNSET ("3RDPARTY_DOXYGEN_EXECUTABLE")
|
||||
OCCT_CHECK_AND_UNSET ("3RDPARTY_DOT_EXECUTABLE")
|
||||
endif()
|
||||
|
||||
# bison
|
||||
if (BUILD_YACCLEX)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/bison")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET ("3RDPARTY_BISON_EXECUTABLE")
|
||||
endif()
|
||||
|
||||
# flex
|
||||
if (BUILD_YACCLEX)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/flex")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET ("3RDPARTY_FLEX_EXECUTABLE")
|
||||
endif()
|
||||
|
||||
string (REGEX REPLACE ";" " " 3RDPARTY_NOT_INCLUDED "${3RDPARTY_NOT_INCLUDED}")
|
||||
|
||||
# check all 3rdparty paths
|
||||
# IfcOpenShell begin
|
||||
#if (3RDPARTY_NOT_INCLUDED)
|
||||
# message (FATAL_ERROR "NOT FOUND: ${3RDPARTY_NOT_INCLUDED}" )
|
||||
#endif()
|
||||
# IfcOpenShell end
|
||||
|
||||
if (3RDPARTY_INCLUDE_DIRS)
|
||||
list (REMOVE_DUPLICATES 3RDPARTY_INCLUDE_DIRS)
|
||||
string (REGEX REPLACE ";" "\n\t" 3RDPARTY_INCLUDE_DIRS_WITH_ENDS "${3RDPARTY_INCLUDE_DIRS}")
|
||||
message (STATUS "Info: The directories of 3rdparty headers: \n\t${3RDPARTY_INCLUDE_DIRS_WITH_ENDS}")
|
||||
include_directories (${3RDPARTY_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
# include <cmake binary folder>/inc
|
||||
include_directories (${CMAKE_BINARY_DIR}/inc)
|
||||
|
||||
if (3RDPARTY_LIBRARY_DIRS)
|
||||
list (REMOVE_DUPLICATES 3RDPARTY_LIBRARY_DIRS)
|
||||
string (REGEX REPLACE ";" "\n\t" 3RDPARTY_LIBRARY_DIRS_WITH_ENDS "${3RDPARTY_LIBRARY_DIRS}")
|
||||
message (STATUS "Info: The directories of 3rdparty libraries: \n\t${3RDPARTY_LIBRARY_DIRS_WITH_ENDS}")
|
||||
link_directories (${3RDPARTY_LIBRARY_DIRS})
|
||||
endif()
|
||||
|
||||
# build directories
|
||||
if (SINGLE_GENERATOR)
|
||||
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BIN_LETTER}")
|
||||
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BIN_LETTER}")
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BIN_LETTER}")
|
||||
if (WIN32)
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BIN_LETTER}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
|
||||
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin")
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
|
||||
|
||||
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libi")
|
||||
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bini")
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libi")
|
||||
|
||||
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libd")
|
||||
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bind")
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libd")
|
||||
|
||||
if (WIN32)
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin")
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bini")
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bind")
|
||||
endif()
|
||||
|
||||
string(TIMESTAMP CURRENT_TIME "%H:%M:%S")
|
||||
message (STATUS "\nInfo: \(${CURRENT_TIME}\) Start collecting all OCCT header files into ${CMAKE_BINARY_DIR}/inc ...")
|
||||
|
||||
# collect all the headers to <binary dir>/inc folder
|
||||
COLLECT_AND_INSTALL_OCCT_HEADER_FILES ("${CMAKE_BINARY_DIR}" "${BUILD_TOOLKITS}")
|
||||
|
||||
string(TIMESTAMP CURRENT_TIME "%H:%M:%S")
|
||||
message (STATUS "Info: \(${CURRENT_TIME}\) End the collecting")
|
||||
|
||||
OCCT_INSTALL_FILE_OR_DIR ("data/" "${INSTALL_DIR}/${INSTALL_DIR_DATA}")
|
||||
|
||||
if (WIN32)
|
||||
set (SCRIPT_EXT bat)
|
||||
else()
|
||||
set (SCRIPT_EXT sh)
|
||||
endif()
|
||||
|
||||
# OCCT samples
|
||||
if (INSTALL_SAMPLES)
|
||||
OCCT_CONFIGURE ("adm/templates/env.samples.${SCRIPT_EXT}.in" "env.samples.${SCRIPT_EXT}")
|
||||
if (WIN32)
|
||||
OCCT_INSTALL_FILE_OR_DIR ("samples/CSharp" "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}")
|
||||
OCCT_INSTALL_FILE_OR_DIR ("samples/mfc" "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}")
|
||||
|
||||
install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}/CSharp" RENAME "env.${SCRIPT_EXT}")
|
||||
install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}/mfc/standard" RENAME "env.${SCRIPT_EXT}")
|
||||
endif()
|
||||
|
||||
OCCT_INSTALL_FILE_OR_DIR ("samples/java" "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}")
|
||||
OCCT_INSTALL_FILE_OR_DIR ("samples/ocafsamples" "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}")
|
||||
OCCT_INSTALL_FILE_OR_DIR ("samples/qt" "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}")
|
||||
|
||||
install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}/qt/FuncDemo" RENAME "env.${SCRIPT_EXT}")
|
||||
install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}/qt/IESample" RENAME "env.${SCRIPT_EXT}")
|
||||
install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}/qt/Tutorial" RENAME "env.${SCRIPT_EXT}")
|
||||
endif()
|
||||
|
||||
OCCT_INSTALL_FILE_OR_DIR ("samples/tcl" "${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}")
|
||||
|
||||
if (INSTALL_TEST_CASES)
|
||||
OCCT_INSTALL_FILE_OR_DIR ("tests/" "${INSTALL_DIR}/${INSTALL_DIR_TESTS}")
|
||||
endif()
|
||||
|
||||
# copy draw script to install script folder
|
||||
if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/adm/templates/draw.${SCRIPT_EXT}")
|
||||
install (FILES "${BUILD_PATCH}/adm/templates/draw.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}"
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE)
|
||||
else()
|
||||
install (FILES "${CMAKE_SOURCE_DIR}/adm/templates/draw.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}"
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE)
|
||||
endif()
|
||||
|
||||
# copy draw script to CMake binary folder
|
||||
OCCT_COPY_FILE_OR_DIR ("adm/templates/draw.${SCRIPT_EXT}" "${CMAKE_BINARY_DIR}")
|
||||
|
||||
set (SUB_CUSTOM_NAME "custom_${COMPILER}_${COMPILER_BITNESS}.${SCRIPT_EXT}")
|
||||
|
||||
if (WIN32)
|
||||
set (ADDITIONAL_CUSTOM_CONTENT "\nif exist \"%~dp0${SUB_CUSTOM_NAME}\" (\n call \"%~dp0${SUB_CUSTOM_NAME}\" %1 %2 %3 \n)")
|
||||
else()
|
||||
set (ADDITIONAL_CUSTOM_CONTENT "\nif [ -e \"\${aScriptPath}/${SUB_CUSTOM_NAME}\" ]; then\n source \"\${aScriptPath}/${SUB_CUSTOM_NAME}\" \"\$1\" \"\$2\" \nfi")
|
||||
endif()
|
||||
|
||||
# change custom.bat/sh
|
||||
if (EXISTS "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}/custom.${SCRIPT_EXT}")
|
||||
file (READ "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}/custom.${SCRIPT_EXT}" CUSTOM_CONTENT)
|
||||
|
||||
set (CUSTOM_CONTENT "${CUSTOM_CONTENT} ${ADDITIONAL_CUSTOM_CONTENT}")
|
||||
|
||||
file (WRITE "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}/custom.${SCRIPT_EXT}" "${CUSTOM_CONTENT}")
|
||||
else()
|
||||
OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.${SCRIPT_EXT}.main" "custom.${SCRIPT_EXT}" "custom.${SCRIPT_EXT}" "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}")
|
||||
endif()
|
||||
|
||||
# write current custom.bat/sh (for install directory)
|
||||
set (SUB_CUSTOM_BUILD_NAME "custom_${COMPILER}_${COMPILER_BITNESS}.install.${SCRIPT_EXT}")
|
||||
OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.install.${SCRIPT_EXT}.in" "${SUB_CUSTOM_BUILD_NAME}" "${SUB_CUSTOM_NAME}" "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}")
|
||||
|
||||
# write current custom.bat/sh (for build directory)
|
||||
OCCT_CONFIGURE ("adm/templates/custom.build.${SCRIPT_EXT}.in" "${SUB_CUSTOM_NAME}")
|
||||
|
||||
if (BUILD_MODULE_MfcSamples)
|
||||
OCCT_INSTALL_FILE_OR_DIR ("adm/templates/sample.bat" "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}")
|
||||
OCCT_COPY_FILE_OR_DIR ("adm/templates/sample.bat" "${CMAKE_BINARY_DIR}")
|
||||
endif()
|
||||
|
||||
# env script for draw in building environment
|
||||
OCCT_CONFIGURE ("adm/templates/env.${SCRIPT_EXT}.in" "env.${SCRIPT_EXT}")
|
||||
|
||||
# install env script
|
||||
install (FILES "${CMAKE_BINARY_DIR}/env.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}")
|
||||
|
||||
# copy DrawAppliInit from OCCT source to build directory
|
||||
if (NOT EXISTS "${CMAKE_BINARY_DIR}/DrawAppliInit")
|
||||
OCCT_COPY_FILE_OR_DIR (DrawAppliInit "${CMAKE_BINARY_DIR}")
|
||||
endif()
|
||||
|
||||
# RESOURCES
|
||||
FILE_TO_LIST ("adm/RESOURCES" RESOURCES)
|
||||
foreach(RESOURCE ${RESOURCES})
|
||||
get_filename_component(RESOURCE_FOLDER ${RESOURCE} DIRECTORY)
|
||||
if(NOT "${RESOURCE_FOLDER}" STREQUAL "")
|
||||
get_filename_component(RESOURCE_FOLDER ${RESOURCE_FOLDER} NAME)
|
||||
OCCT_INSTALL_FILE_OR_DIR ("src/${RESOURCE}" "${INSTALL_DIR}/${INSTALL_DIR_RESOURCE}/${RESOURCE_FOLDER}")
|
||||
else()
|
||||
OCCT_INSTALL_FILE_OR_DIR ("src/${RESOURCE}" "${INSTALL_DIR}/${INSTALL_DIR_RESOURCE}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# define CSF variable
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_csf")
|
||||
|
||||
# include patched toolkit projects or original ones
|
||||
foreach (BUILD_TOOLKIT ${BUILD_TOOLKITS})
|
||||
OCCT_ADD_SUBDIRECTORY ("src/${BUILD_TOOLKIT}")
|
||||
endforeach()
|
||||
|
||||
if (BUILD_DOC_Overview)
|
||||
OCCT_ADD_SUBDIRECTORY (dox)
|
||||
endif()
|
||||
|
||||
# patch DRAWEXE
|
||||
if (MSVC AND 3RDPARTY_DLL_DIRS)
|
||||
list (FIND BUILD_TOOLKITS DRAWEXE DRAWEXE_INDEX)
|
||||
if (${DRAWEXE_INDEX} GREATER -1)
|
||||
list (REMOVE_DUPLICATES 3RDPARTY_DLL_DIRS)
|
||||
set (3RDPARTY_DLL_DIRS_FOR_PATH "")
|
||||
|
||||
foreach (3RDPARTY_DLL_DIR ${3RDPARTY_DLL_DIRS})
|
||||
set (3RDPARTY_DLL_DIRS_FOR_PATH "${3RDPARTY_DLL_DIRS_FOR_PATH};${3RDPARTY_DLL_DIR}")
|
||||
endforeach()
|
||||
|
||||
OCCT_MAKE_COMPILER_BITNESS()
|
||||
set (X_COMPILER_BITNESS "x64")
|
||||
if ("${COMPILER_BITNESS}" STREQUAL "32")
|
||||
set (X_COMPILER_BITNESS "Win32")
|
||||
endif()
|
||||
|
||||
OCCT_CONFIGURE ("adm/templates/DRAWEXE.vcxproj.user.in" "${CMAKE_BINARY_DIR}/src/DRAWEXE/DRAWEXE.vcxproj.user")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# samples do not support patch usage
|
||||
if (BUILD_MODULE_MfcSamples)
|
||||
set (OCCT_ROOT ${CMAKE_SOURCE_DIR})
|
||||
|
||||
set (MFC_STANDARD_SAMPLES_DIR ${OCCT_ROOT}/samples/mfc/standard)
|
||||
set (COMMON_WINMAIN_FILE ${MFC_STANDARD_SAMPLES_DIR}/Common/Winmain.cpp)
|
||||
|
||||
add_subdirectory(samples/mfc/standard/mfcsample)
|
||||
add_subdirectory(samples/mfc/standard/01_Geometry)
|
||||
add_subdirectory(samples/mfc/standard/02_Modeling)
|
||||
add_subdirectory(samples/mfc/standard/03_Viewer2d)
|
||||
add_subdirectory(samples/mfc/standard/04_Viewer3d)
|
||||
add_subdirectory(samples/mfc/standard/05_ImportExport)
|
||||
add_subdirectory(samples/mfc/standard/06_Ocaf)
|
||||
add_subdirectory(samples/mfc/standard/07_Triangulation)
|
||||
add_subdirectory(samples/mfc/standard/08_HLR)
|
||||
add_subdirectory(samples/mfc/standard/09_Animation)
|
||||
add_subdirectory(samples/mfc/standard/10_Convert)
|
||||
endif()
|
||||
|
||||
# Prepare variables for configuration of OpenCASCADE cmake config file
|
||||
set (OCCT_MODULES_ENABLED)
|
||||
set (OCCT_LIBRARIES)
|
||||
set (SET_OpenCASCADE_MODULES_TOOLKITS "\n# List of available OpenCASCADE libraries for each module\n")
|
||||
foreach (OCCT_TOOLKIT ${BUILD_TOOLKITS})
|
||||
if (TARGET ${OCCT_TOOLKIT})
|
||||
|
||||
# get all libraries
|
||||
get_target_property (${OCCT_TOOLKIT}_TYPE ${OCCT_TOOLKIT} "TYPE")
|
||||
if ("${${OCCT_TOOLKIT}_TYPE}" STREQUAL "STATIC_LIBRARY" OR "${${OCCT_TOOLKIT}_TYPE}" STREQUAL "SHARED_LIBRARY" )
|
||||
list (APPEND OCCT_LIBRARIES ${OCCT_TOOLKIT})
|
||||
|
||||
# get all modules
|
||||
get_target_property (${OCCT_TOOLKIT}_MODULE ${OCCT_TOOLKIT} "MODULE")
|
||||
list (APPEND OCCT_MODULES_ENABLED ${${OCCT_TOOLKIT}_MODULE})
|
||||
list (APPEND OpenCASCADE_${${OCCT_TOOLKIT}_MODULE}_TOOLKITS ${OCCT_TOOLKIT})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
list (REMOVE_DUPLICATES OCCT_MODULES_ENABLED)
|
||||
|
||||
foreach (OCCT_MODULE ${OCCT_MODULES})
|
||||
if (BUILD_MODULE_${OCCT_MODULE})
|
||||
set (SET_OpenCASCADE_MODULES_TOOLKITS "${SET_OpenCASCADE_MODULES_TOOLKITS}set (OpenCASCADE_${OCCT_MODULE}_LIBRARIES ${OpenCASCADE_${OCCT_MODULE}_TOOLKITS})\n")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Add all targets to the build-tree export set
|
||||
export (TARGETS ${OCCT_LIBRARIES} FILE "${CMAKE_BINARY_DIR}/OpenCASCADETargets.cmake")
|
||||
|
||||
# Export the package for use from the build-tree
|
||||
# (this registers the build-tree with a global CMake-registry)
|
||||
export(PACKAGE OpenCASCADE)
|
||||
|
||||
if (CMAKE_BUILD_TYPE)
|
||||
set (SET_OpenCASCADE_BUILD_TYPE "set (OpenCASCADE_BUILD_TYPE \"${CMAKE_BUILD_TYPE}\")")
|
||||
endif()
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set (SET_OpenCASCADE_LINKER_FLAGS "set (OpenCASCADE_LINKER_FLAGS \"${CMAKE_SHARED_LINKER_FLAGS}\")")
|
||||
else()
|
||||
set (SET_OpenCASCADE_LINKER_FLAGS "set (OpenCASCADE_LINKER_FLAGS \"${CMAKE_STATIC_LINKER_FLAGS}\")")
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
set (SET_OpenCASCADE_WITH_D3D "set (OpenCASCADE_WITH_D3D ${USE_D3D})")
|
||||
endif()
|
||||
if (APPLE)
|
||||
set (SET_OpenCASCADE_WITH_GLX "set (OpenCASCADE_WITH_GLX ${USE_GLX})")
|
||||
endif()
|
||||
|
||||
if (NOT SINGLE_GENERATOR)
|
||||
OCCT_INSERT_CODE_FOR_TARGET()
|
||||
endif()
|
||||
|
||||
# Configure and install cmake config file
|
||||
configure_file("${CMAKE_SOURCE_DIR}/adm/templates/OpenCASCADEConfig.cmake.in" "OpenCASCADEConfig.cmake" @ONLY)
|
||||
install(FILES "${CMAKE_BINARY_DIR}/OpenCASCADEConfig.cmake" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_CMAKE}")
|
||||
|
||||
# Configure cmake version file
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file( ${CMAKE_BINARY_DIR}/OpenCASCADEConfigVersion.cmake
|
||||
VERSION ${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}
|
||||
COMPATIBILITY ExactVersion )
|
||||
|
||||
# Install cmake version file
|
||||
install (FILES "${CMAKE_BINARY_DIR}/OpenCASCADEConfigVersion.cmake" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_CMAKE}")
|
||||
|
||||
# Install the export set for use with the install-tree for each configuration
|
||||
foreach (OCCT_MODULE ${OCCT_MODULES})
|
||||
if (BUILD_MODULE_${OCCT_MODULE})
|
||||
install(EXPORT OpenCASCADE${OCCT_MODULE}Targets DESTINATION "${INSTALL_DIR_CMAKE}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Update generated OpenCASCADETargets-*.cmake files
|
||||
# to have correct paths to libraries depending on the configuration
|
||||
OCCT_UPDATE_TARGET_FILE ()
|
||||
@@ -0,0 +1,959 @@
|
||||
// Created on: 2011-07-13
|
||||
// Created by: Sergey ZERCHANINOV
|
||||
// Copyright (c) 2011-2013 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <OpenGl_AspectFace.hxx>
|
||||
#include <OpenGl_Context.hxx>
|
||||
#include <OpenGl_GraphicDriver.hxx>
|
||||
#include <OpenGl_IndexBuffer.hxx>
|
||||
#include <OpenGl_PointSprite.hxx>
|
||||
#include <OpenGl_PrimitiveArray.hxx>
|
||||
#include <OpenGl_ShaderManager.hxx>
|
||||
#include <OpenGl_ShaderProgram.hxx>
|
||||
#include <OpenGl_Structure.hxx>
|
||||
#include <OpenGl_VertexBufferCompat.hxx>
|
||||
#include <OpenGl_Workspace.hxx>
|
||||
#include <Graphic3d_TextureParams.hxx>
|
||||
#include <NCollection_AlignedAllocator.hxx>
|
||||
|
||||
// IfcOpenShell begin
|
||||
#ifdef GetObject
|
||||
#undef GetObject
|
||||
#endif
|
||||
#ifdef max
|
||||
#undef max
|
||||
#endif
|
||||
// IfcOpenShell end
|
||||
|
||||
namespace
|
||||
{
|
||||
//! Convert data type to GL info
|
||||
inline GLenum toGlDataType (const Graphic3d_TypeOfData theType,
|
||||
GLint& theNbComp)
|
||||
{
|
||||
switch (theType)
|
||||
{
|
||||
case Graphic3d_TOD_USHORT:
|
||||
theNbComp = 1;
|
||||
return GL_UNSIGNED_SHORT;
|
||||
case Graphic3d_TOD_UINT:
|
||||
theNbComp = 1;
|
||||
return GL_UNSIGNED_INT;
|
||||
case Graphic3d_TOD_VEC2:
|
||||
theNbComp = 2;
|
||||
return GL_FLOAT;
|
||||
case Graphic3d_TOD_VEC3:
|
||||
theNbComp = 3;
|
||||
return GL_FLOAT;
|
||||
case Graphic3d_TOD_VEC4:
|
||||
theNbComp = 4;
|
||||
return GL_FLOAT;
|
||||
case Graphic3d_TOD_VEC4UB:
|
||||
theNbComp = 4;
|
||||
return GL_UNSIGNED_BYTE;
|
||||
case Graphic3d_TOD_FLOAT:
|
||||
theNbComp = 1;
|
||||
return GL_FLOAT;
|
||||
}
|
||||
theNbComp = 0;
|
||||
return GL_NONE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//! Auxiliary template for VBO with interleaved attributes.
|
||||
template<class TheBaseClass, int NbAttributes>
|
||||
class OpenGl_VertexBufferT : public TheBaseClass
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! Create uninitialized VBO.
|
||||
OpenGl_VertexBufferT (const Graphic3d_Attribute* theAttribs,
|
||||
const Standard_Integer theStride)
|
||||
: Stride (theStride)
|
||||
{
|
||||
memcpy (Attribs, theAttribs, sizeof(Graphic3d_Attribute) * NbAttributes);
|
||||
}
|
||||
|
||||
//! Create uninitialized VBO.
|
||||
OpenGl_VertexBufferT (const Graphic3d_Buffer& theAttribs)
|
||||
: Stride (theAttribs.Stride)
|
||||
{
|
||||
memcpy (Attribs, theAttribs.AttributesArray(), sizeof(Graphic3d_Attribute) * NbAttributes);
|
||||
}
|
||||
|
||||
virtual bool HasColorAttribute() const
|
||||
{
|
||||
for (Standard_Integer anAttribIter = 0; anAttribIter < NbAttributes; ++anAttribIter)
|
||||
{
|
||||
const Graphic3d_Attribute& anAttrib = Attribs[anAttribIter];
|
||||
if (anAttrib.Id == Graphic3d_TOA_COLOR)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool HasNormalAttribute() const
|
||||
{
|
||||
for (Standard_Integer anAttribIter = 0; anAttribIter < NbAttributes; ++anAttribIter)
|
||||
{
|
||||
const Graphic3d_Attribute& anAttrib = Attribs[anAttribIter];
|
||||
if (anAttrib.Id == Graphic3d_TOA_NORM)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void BindPositionAttribute (const Handle(OpenGl_Context)& theGlCtx) const
|
||||
{
|
||||
if (!TheBaseClass::IsValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TheBaseClass::Bind (theGlCtx);
|
||||
GLint aNbComp;
|
||||
const GLubyte* anOffset = TheBaseClass::myOffset;
|
||||
for (Standard_Integer anAttribIter = 0; anAttribIter < NbAttributes; ++anAttribIter)
|
||||
{
|
||||
const Graphic3d_Attribute& anAttrib = Attribs[anAttribIter];
|
||||
const GLenum aDataType = toGlDataType (anAttrib.DataType, aNbComp);
|
||||
if (aDataType == GL_NONE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (anAttrib.Id == Graphic3d_TOA_POS)
|
||||
{
|
||||
TheBaseClass::bindAttribute (theGlCtx, Graphic3d_TOA_POS, aNbComp, aDataType, Stride, anOffset);
|
||||
break;
|
||||
}
|
||||
|
||||
anOffset += Graphic3d_Attribute::Stride (anAttrib.DataType);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void BindAllAttributes (const Handle(OpenGl_Context)& theGlCtx) const
|
||||
{
|
||||
if (!TheBaseClass::IsValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TheBaseClass::Bind (theGlCtx);
|
||||
GLint aNbComp;
|
||||
const GLubyte* anOffset = TheBaseClass::myOffset;
|
||||
for (Standard_Integer anAttribIter = 0; anAttribIter < NbAttributes; ++anAttribIter)
|
||||
{
|
||||
const Graphic3d_Attribute& anAttrib = Attribs[anAttribIter];
|
||||
const GLenum aDataType = toGlDataType (anAttrib.DataType, aNbComp);
|
||||
if (aDataType == GL_NONE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
TheBaseClass::bindAttribute (theGlCtx, anAttrib.Id, aNbComp, aDataType, Stride, anOffset);
|
||||
anOffset += Graphic3d_Attribute::Stride (anAttrib.DataType);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void UnbindAllAttributes (const Handle(OpenGl_Context)& theGlCtx) const
|
||||
{
|
||||
if (!TheBaseClass::IsValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
TheBaseClass::Unbind (theGlCtx);
|
||||
|
||||
for (Standard_Integer anAttribIter = 0; anAttribIter < NbAttributes; ++anAttribIter)
|
||||
{
|
||||
const Graphic3d_Attribute& anAttrib = Attribs[anAttribIter];
|
||||
TheBaseClass::unbindAttribute (theGlCtx, anAttrib.Id);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Graphic3d_Attribute Attribs[NbAttributes];
|
||||
Standard_Integer Stride;
|
||||
|
||||
};
|
||||
|
||||
// =======================================================================
|
||||
// function : clearMemoryGL
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_PrimitiveArray::clearMemoryGL (const Handle(OpenGl_Context)& theGlCtx) const
|
||||
{
|
||||
if (!myVboIndices.IsNull())
|
||||
{
|
||||
myVboIndices->Release (theGlCtx.operator->());
|
||||
myVboIndices.Nullify();
|
||||
}
|
||||
if (!myVboAttribs.IsNull())
|
||||
{
|
||||
myVboAttribs->Release (theGlCtx.operator->());
|
||||
myVboAttribs.Nullify();
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : initNormalVbo
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean OpenGl_PrimitiveArray::initNormalVbo (const Handle(OpenGl_Context)& theCtx) const
|
||||
{
|
||||
switch (myAttribs->NbAttributes)
|
||||
{
|
||||
case 1: myVboAttribs = new OpenGl_VertexBufferT<OpenGl_VertexBuffer, 1> (*myAttribs); break;
|
||||
case 2: myVboAttribs = new OpenGl_VertexBufferT<OpenGl_VertexBuffer, 2> (*myAttribs); break;
|
||||
case 3: myVboAttribs = new OpenGl_VertexBufferT<OpenGl_VertexBuffer, 3> (*myAttribs); break;
|
||||
case 4: myVboAttribs = new OpenGl_VertexBufferT<OpenGl_VertexBuffer, 4> (*myAttribs); break;
|
||||
case 5: myVboAttribs = new OpenGl_VertexBufferT<OpenGl_VertexBuffer, 5> (*myAttribs); break;
|
||||
case 6: myVboAttribs = new OpenGl_VertexBufferT<OpenGl_VertexBuffer, 6> (*myAttribs); break;
|
||||
case 7: myVboAttribs = new OpenGl_VertexBufferT<OpenGl_VertexBuffer, 7> (*myAttribs); break;
|
||||
case 8: myVboAttribs = new OpenGl_VertexBufferT<OpenGl_VertexBuffer, 8> (*myAttribs); break;
|
||||
case 9: myVboAttribs = new OpenGl_VertexBufferT<OpenGl_VertexBuffer, 9> (*myAttribs); break;
|
||||
case 10: myVboAttribs = new OpenGl_VertexBufferT<OpenGl_VertexBuffer, 10>(*myAttribs); break;
|
||||
}
|
||||
|
||||
if (!myVboAttribs->init (theCtx, 0, myAttribs->NbElements, myAttribs->Data(), GL_NONE, myAttribs->Stride))
|
||||
{
|
||||
TCollection_ExtendedString aMsg;
|
||||
aMsg += "VBO creation for Primitive Array has failed for ";
|
||||
aMsg += myAttribs->NbElements;
|
||||
aMsg += " vertices. Out of memory?";
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PERFORMANCE, 0, GL_DEBUG_SEVERITY_LOW, aMsg);
|
||||
|
||||
clearMemoryGL (theCtx);
|
||||
return Standard_False;
|
||||
}
|
||||
else if (myIndices.IsNull())
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
myVboIndices = new OpenGl_IndexBuffer();
|
||||
bool isOk = false;
|
||||
switch (myIndices->Stride)
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
isOk = myVboIndices->Init (theCtx, 1, myIndices->NbElements, reinterpret_cast<const GLushort*> (myIndices->Data()));
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
isOk = myVboIndices->Init (theCtx, 1, myIndices->NbElements, reinterpret_cast<const GLuint*> (myIndices->Data()));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
clearMemoryGL (theCtx);
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
if (!isOk)
|
||||
{
|
||||
TCollection_ExtendedString aMsg;
|
||||
aMsg += "VBO creation for Primitive Array has failed for ";
|
||||
aMsg += myIndices->NbElements;
|
||||
aMsg += " indices. Out of memory?";
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PERFORMANCE, 0, GL_DEBUG_SEVERITY_LOW, aMsg);
|
||||
clearMemoryGL (theCtx);
|
||||
return Standard_False;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : buildVBO
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean OpenGl_PrimitiveArray::buildVBO (const Handle(OpenGl_Context)& theCtx,
|
||||
const Standard_Boolean theToKeepData) const
|
||||
{
|
||||
bool isNormalMode = theCtx->ToUseVbo();
|
||||
clearMemoryGL (theCtx);
|
||||
if (myAttribs.IsNull()
|
||||
|| myAttribs->IsEmpty()
|
||||
|| myAttribs->NbElements < 1
|
||||
|| myAttribs->NbAttributes < 1
|
||||
|| myAttribs->NbAttributes > 10)
|
||||
{
|
||||
// vertices should be always defined - others are optional
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
if (isNormalMode
|
||||
&& initNormalVbo (theCtx))
|
||||
{
|
||||
if (!theCtx->caps->keepArrayData
|
||||
&& !theToKeepData)
|
||||
{
|
||||
myIndices.Nullify();
|
||||
myAttribs.Nullify();
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Handle(OpenGl_VertexBufferCompat) aVboAttribs;
|
||||
switch (myAttribs->NbAttributes)
|
||||
{
|
||||
case 1: aVboAttribs = new OpenGl_VertexBufferT<OpenGl_VertexBufferCompat, 1> (*myAttribs); break;
|
||||
case 2: aVboAttribs = new OpenGl_VertexBufferT<OpenGl_VertexBufferCompat, 2> (*myAttribs); break;
|
||||
case 3: aVboAttribs = new OpenGl_VertexBufferT<OpenGl_VertexBufferCompat, 3> (*myAttribs); break;
|
||||
case 4: aVboAttribs = new OpenGl_VertexBufferT<OpenGl_VertexBufferCompat, 4> (*myAttribs); break;
|
||||
case 5: aVboAttribs = new OpenGl_VertexBufferT<OpenGl_VertexBufferCompat, 5> (*myAttribs); break;
|
||||
case 6: aVboAttribs = new OpenGl_VertexBufferT<OpenGl_VertexBufferCompat, 6> (*myAttribs); break;
|
||||
case 7: aVboAttribs = new OpenGl_VertexBufferT<OpenGl_VertexBufferCompat, 7> (*myAttribs); break;
|
||||
case 8: aVboAttribs = new OpenGl_VertexBufferT<OpenGl_VertexBufferCompat, 8> (*myAttribs); break;
|
||||
case 9: aVboAttribs = new OpenGl_VertexBufferT<OpenGl_VertexBufferCompat, 9> (*myAttribs); break;
|
||||
case 10: aVboAttribs = new OpenGl_VertexBufferT<OpenGl_VertexBufferCompat, 10>(*myAttribs); break;
|
||||
}
|
||||
aVboAttribs->initLink (myAttribs, 0, myAttribs->NbElements, GL_NONE);
|
||||
if (!myIndices.IsNull())
|
||||
{
|
||||
Handle(OpenGl_VertexBufferCompat) aVboIndices = new OpenGl_VertexBufferCompat();
|
||||
switch (myIndices->Stride)
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
aVboIndices->initLink (myIndices, 1, myIndices->NbElements, GL_UNSIGNED_SHORT);
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
aVboIndices->initLink (myIndices, 1, myIndices->NbElements, GL_UNSIGNED_INT);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
myVboIndices = aVboIndices;
|
||||
}
|
||||
myVboAttribs = aVboAttribs;
|
||||
if (!theCtx->caps->keepArrayData
|
||||
&& !theToKeepData)
|
||||
{
|
||||
// does not make sense for compatibility mode
|
||||
//myIndices.Nullify();
|
||||
//myAttribs.Nullify();
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : drawArray
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_PrimitiveArray::drawArray (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const Graphic3d_Vec4* theFaceColors,
|
||||
const Standard_Boolean theHasVertColor) const
|
||||
{
|
||||
const Handle(OpenGl_Context)& aGlContext = theWorkspace->GetGlContext();
|
||||
const bool toHilight = (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) != 0;
|
||||
bool hasVColors = theHasVertColor && !toHilight;
|
||||
if (myVboAttribs.IsNull())
|
||||
{
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
if (myDrawMode == GL_POINTS)
|
||||
{
|
||||
// extreme compatibility mode - without sprites but with markers
|
||||
drawMarkers (theWorkspace);
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
myVboAttribs->BindAllAttributes (aGlContext);
|
||||
if (theHasVertColor && toHilight)
|
||||
{
|
||||
// disable per-vertex color
|
||||
OpenGl_VertexBuffer::unbindAttribute (aGlContext, Graphic3d_TOA_COLOR);
|
||||
}
|
||||
if (!myVboIndices.IsNull())
|
||||
{
|
||||
myVboIndices->Bind (aGlContext);
|
||||
GLubyte* anOffset = myVboIndices->GetDataOffset();
|
||||
if (!myBounds.IsNull())
|
||||
{
|
||||
// draw primitives by vertex count with the indices
|
||||
const size_t aStride = myVboIndices->GetDataType() == GL_UNSIGNED_SHORT ? sizeof(unsigned short) : sizeof(unsigned int);
|
||||
for (Standard_Integer aGroupIter = 0; aGroupIter < myBounds->NbBounds; ++aGroupIter)
|
||||
{
|
||||
const GLint aNbElemsInGroup = myBounds->Bounds[aGroupIter];
|
||||
if (theFaceColors != NULL) aGlContext->SetColor4fv (theFaceColors[aGroupIter]);
|
||||
glDrawElements (myDrawMode, aNbElemsInGroup, myVboIndices->GetDataType(), anOffset);
|
||||
anOffset += aStride * aNbElemsInGroup;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// draw one (or sequential) primitive by the indices
|
||||
glDrawElements (myDrawMode, myVboIndices->GetElemsNb(), myVboIndices->GetDataType(), anOffset);
|
||||
}
|
||||
myVboIndices->Unbind (aGlContext);
|
||||
}
|
||||
else if (!myBounds.IsNull())
|
||||
{
|
||||
GLint aFirstElem = 0;
|
||||
for (Standard_Integer aGroupIter = 0; aGroupIter < myBounds->NbBounds; ++aGroupIter)
|
||||
{
|
||||
const GLint aNbElemsInGroup = myBounds->Bounds[aGroupIter];
|
||||
if (theFaceColors != NULL) aGlContext->SetColor4fv (theFaceColors[aGroupIter]);
|
||||
glDrawArrays (myDrawMode, aFirstElem, aNbElemsInGroup);
|
||||
aFirstElem += aNbElemsInGroup;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (myDrawMode == GL_POINTS)
|
||||
{
|
||||
drawMarkers (theWorkspace);
|
||||
}
|
||||
else
|
||||
{
|
||||
glDrawArrays (myDrawMode, 0, myVboAttribs->GetElemsNb());
|
||||
}
|
||||
}
|
||||
|
||||
// bind with 0
|
||||
myVboAttribs->UnbindAllAttributes (aGlContext);
|
||||
|
||||
if (hasVColors)
|
||||
{
|
||||
theWorkspace->NamedStatus |= OPENGL_NS_RESMAT;
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : drawEdges
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_PrimitiveArray::drawEdges (const TEL_COLOUR* theEdgeColour,
|
||||
const Handle(OpenGl_Workspace)& theWorkspace) const
|
||||
{
|
||||
const Handle(OpenGl_Context)& aGlContext = theWorkspace->GetGlContext();
|
||||
if (myVboAttribs.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
if (aGlContext->core11 != NULL)
|
||||
{
|
||||
glDisable (GL_LIGHTING);
|
||||
}
|
||||
#endif
|
||||
|
||||
const OpenGl_AspectLine* anAspectLineOld = NULL;
|
||||
|
||||
anAspectLineOld = theWorkspace->SetAspectLine (theWorkspace->AspectFace (Standard_True)->AspectEdge());
|
||||
const OpenGl_AspectLine* anAspect = theWorkspace->AspectLine (Standard_True);
|
||||
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
|
||||
#endif
|
||||
|
||||
if (aGlContext->core20fwd != NULL)
|
||||
{
|
||||
aGlContext->ShaderManager()->BindProgram (anAspect, NULL, Standard_False, Standard_False, anAspect->ShaderProgramRes (aGlContext));
|
||||
}
|
||||
|
||||
/// OCC22236 NOTE: draw edges for all situations:
|
||||
/// 1) draw elements with GL_LINE style as edges from myPArray->bufferVBO[VBOEdges] indices array
|
||||
/// 2) draw elements from vertex array, when bounds defines count of primitive's vertices.
|
||||
/// 3) draw primitive's edges by vertexes if no edges and bounds array is specified
|
||||
myVboAttribs->BindPositionAttribute (aGlContext);
|
||||
|
||||
aGlContext->SetColor4fv (*(const OpenGl_Vec4* )theEdgeColour->rgb);
|
||||
aGlContext->SetTypeOfLine (anAspect->Type());
|
||||
aGlContext->SetLineWidth (anAspect->Width());
|
||||
|
||||
if (!myVboIndices.IsNull())
|
||||
{
|
||||
myVboIndices->Bind (aGlContext);
|
||||
GLubyte* anOffset = myVboIndices->GetDataOffset();
|
||||
|
||||
// draw primitives by vertex count with the indices
|
||||
if (!myBounds.IsNull())
|
||||
{
|
||||
const size_t aStride = myVboIndices->GetDataType() == GL_UNSIGNED_SHORT ? sizeof(unsigned short) : sizeof(unsigned int);
|
||||
for (Standard_Integer aGroupIter = 0; aGroupIter < myBounds->NbBounds; ++aGroupIter)
|
||||
{
|
||||
const GLint aNbElemsInGroup = myBounds->Bounds[aGroupIter];
|
||||
glDrawElements (myDrawMode, aNbElemsInGroup, myVboIndices->GetDataType(), anOffset);
|
||||
anOffset += aStride * aNbElemsInGroup;
|
||||
}
|
||||
}
|
||||
// draw one (or sequential) primitive by the indices
|
||||
else
|
||||
{
|
||||
glDrawElements (myDrawMode, myVboIndices->GetElemsNb(), myVboIndices->GetDataType(), anOffset);
|
||||
}
|
||||
myVboIndices->Unbind (aGlContext);
|
||||
}
|
||||
else if (!myBounds.IsNull())
|
||||
{
|
||||
GLint aFirstElem = 0;
|
||||
for (Standard_Integer aGroupIter = 0; aGroupIter < myBounds->NbBounds; ++aGroupIter)
|
||||
{
|
||||
const GLint aNbElemsInGroup = myBounds->Bounds[aGroupIter];
|
||||
glDrawArrays (myDrawMode, aFirstElem, aNbElemsInGroup);
|
||||
aFirstElem += aNbElemsInGroup;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
glDrawArrays (myDrawMode, 0, myAttribs->NbElements);
|
||||
}
|
||||
|
||||
// unbind buffers
|
||||
myVboAttribs->UnbindAttribute (aGlContext, Graphic3d_TOA_POS);
|
||||
|
||||
// restore line context
|
||||
theWorkspace->SetAspectLine (anAspectLineOld);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : drawMarkers
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_PrimitiveArray::drawMarkers (const Handle(OpenGl_Workspace)& theWorkspace) const
|
||||
{
|
||||
const OpenGl_AspectMarker* anAspectMarker = theWorkspace->AspectMarker (Standard_True);
|
||||
const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
|
||||
const Handle(OpenGl_PointSprite)& aSpriteNorm = anAspectMarker->SpriteRes (aCtx);
|
||||
if (!aSpriteNorm.IsNull()
|
||||
&& !aSpriteNorm->IsDisplayList())
|
||||
{
|
||||
// Textured markers will be drawn with the point sprites
|
||||
aCtx->SetPointSize (anAspectMarker->MarkerSize());
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
if (aCtx->core11 != NULL)
|
||||
{
|
||||
aCtx->core11fwd->glEnable (GL_ALPHA_TEST);
|
||||
aCtx->core11fwd->glAlphaFunc (GL_GEQUAL, 0.1f);
|
||||
}
|
||||
#endif
|
||||
|
||||
aCtx->core11fwd->glEnable (GL_BLEND);
|
||||
aCtx->core11fwd->glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
aCtx->core11fwd->glDrawArrays (myDrawMode, 0, !myVboAttribs.IsNull() ? myVboAttribs->GetElemsNb() : myAttribs->NbElements);
|
||||
|
||||
aCtx->core11fwd->glDisable (GL_BLEND);
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
if (aCtx->core11 != NULL)
|
||||
{
|
||||
aCtx->core11fwd->glDisable (GL_ALPHA_TEST);
|
||||
}
|
||||
#endif
|
||||
aCtx->SetPointSize (1.0f);
|
||||
return;
|
||||
}
|
||||
else if (anAspectMarker->Type() == Aspect_TOM_POINT)
|
||||
{
|
||||
aCtx->SetPointSize (anAspectMarker->MarkerSize());
|
||||
aCtx->core11fwd->glDrawArrays (myDrawMode, 0, !myVboAttribs.IsNull() ? myVboAttribs->GetElemsNb() : myAttribs->NbElements);
|
||||
aCtx->SetPointSize (1.0f);
|
||||
}
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
// Textured markers will be drawn with the glBitmap
|
||||
else if (anAspectMarker->Type() != Aspect_TOM_POINT
|
||||
&& !aSpriteNorm.IsNull())
|
||||
{
|
||||
/**if (!isHilight && (myPArray->vcolours != NULL))
|
||||
{
|
||||
for (Standard_Integer anIter = 0; anIter < myAttribs->NbElements; anIter++)
|
||||
{
|
||||
glColor4ubv (myPArray->vcolours[anIter].GetData());
|
||||
glRasterPos3fv (myAttribs->Value<Graphic3d_Vec3> (anIter).GetData());
|
||||
aSpriteNorm->DrawBitmap (theWorkspace->GetGlContext());
|
||||
}
|
||||
}
|
||||
else*/
|
||||
{
|
||||
for (Standard_Integer anIter = 0; anIter < myAttribs->NbElements; anIter++)
|
||||
{
|
||||
aCtx->core11->glRasterPos3fv (myAttribs->Value<Graphic3d_Vec3> (anIter).GetData());
|
||||
aSpriteNorm->DrawBitmap (theWorkspace->GetGlContext());
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : OpenGl_PrimitiveArray
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
OpenGl_PrimitiveArray::OpenGl_PrimitiveArray (const OpenGl_GraphicDriver* theDriver)
|
||||
|
||||
: myDrawMode (DRAW_MODE_NONE),
|
||||
myIsVboInit (Standard_False)
|
||||
{
|
||||
if (theDriver != NULL)
|
||||
{
|
||||
myUID = theDriver->GetNextPrimitiveArrayUID();
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : OpenGl_PrimitiveArray
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
OpenGl_PrimitiveArray::OpenGl_PrimitiveArray (const OpenGl_GraphicDriver* theDriver,
|
||||
const Graphic3d_TypeOfPrimitiveArray theType,
|
||||
const Handle(Graphic3d_IndexBuffer)& theIndices,
|
||||
const Handle(Graphic3d_Buffer)& theAttribs,
|
||||
const Handle(Graphic3d_BoundBuffer)& theBounds)
|
||||
|
||||
: myIndices (theIndices),
|
||||
myAttribs (theAttribs),
|
||||
myBounds (theBounds),
|
||||
myDrawMode (DRAW_MODE_NONE),
|
||||
myIsVboInit (Standard_False)
|
||||
{
|
||||
if (!myIndices.IsNull()
|
||||
&& myIndices->NbElements < 1)
|
||||
{
|
||||
// dummy index buffer?
|
||||
myIndices.Nullify();
|
||||
}
|
||||
|
||||
if (theDriver != NULL)
|
||||
{
|
||||
myUID = theDriver->GetNextPrimitiveArrayUID();
|
||||
#if defined (GL_ES_VERSION_2_0)
|
||||
const Handle(OpenGl_Context)& aCtx = theDriver->GetSharedContext();
|
||||
if (!aCtx.IsNull())
|
||||
{
|
||||
processIndices (aCtx);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
setDrawMode (theType);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ~OpenGl_PrimitiveArray
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
OpenGl_PrimitiveArray::~OpenGl_PrimitiveArray()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Release
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_PrimitiveArray::Release (OpenGl_Context* theContext)
|
||||
{
|
||||
myIsVboInit = Standard_False;
|
||||
if (!myVboIndices.IsNull())
|
||||
{
|
||||
if (theContext)
|
||||
{
|
||||
theContext->DelayedRelease (myVboIndices);
|
||||
}
|
||||
myVboIndices.Nullify();
|
||||
}
|
||||
if (!myVboAttribs.IsNull())
|
||||
{
|
||||
if (theContext)
|
||||
{
|
||||
theContext->DelayedRelease (myVboAttribs);
|
||||
}
|
||||
myVboAttribs.Nullify();
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Render
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
|
||||
{
|
||||
if (myDrawMode == DRAW_MODE_NONE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const OpenGl_AspectFace* anAspectFace = theWorkspace->AspectFace (Standard_True);
|
||||
const OpenGl_AspectLine* anAspectLine = theWorkspace->AspectLine (Standard_True);
|
||||
const OpenGl_AspectMarker* anAspectMarker = theWorkspace->AspectMarker (myDrawMode == GL_POINTS);
|
||||
|
||||
// create VBOs on first render call
|
||||
const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
|
||||
if (!myIsVboInit)
|
||||
{
|
||||
// compatibility - keep data to draw markers using display lists
|
||||
const Standard_Boolean toKeepData = myDrawMode == GL_POINTS
|
||||
&& !anAspectMarker->SpriteRes (aCtx).IsNull()
|
||||
&& anAspectMarker->SpriteRes (aCtx)->IsDisplayList();
|
||||
#if defined (GL_ES_VERSION_2_0)
|
||||
processIndices (aCtx);
|
||||
#endif
|
||||
buildVBO (aCtx, toKeepData);
|
||||
myIsVboInit = Standard_True;
|
||||
}
|
||||
|
||||
Tint aFrontLightingModel = anAspectFace->IntFront().color_mask;
|
||||
const TEL_COLOUR* anInteriorColor = &anAspectFace->IntFront().matcol;
|
||||
const TEL_COLOUR* anEdgeColor = &anAspectFace->AspectEdge()->Color();
|
||||
const TEL_COLOUR* aLineColor = myDrawMode == GL_POINTS ? &anAspectMarker->Color() : &anAspectLine->Color();
|
||||
|
||||
// Use highlight colors
|
||||
if (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT)
|
||||
{
|
||||
anEdgeColor = anInteriorColor = aLineColor = theWorkspace->HighlightColor;
|
||||
aFrontLightingModel = 0;
|
||||
}
|
||||
|
||||
const Standard_Boolean hasColorAttrib = !myVboAttribs.IsNull()
|
||||
&& myVboAttribs->HasColorAttribute();
|
||||
const Standard_Boolean isLightOn = aFrontLightingModel != 0
|
||||
&& !myVboAttribs.IsNull()
|
||||
&& myVboAttribs->HasNormalAttribute();
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
// manage FFP lighting
|
||||
if (aCtx->core11 != NULL)
|
||||
{
|
||||
if (!isLightOn)
|
||||
{
|
||||
glDisable (GL_LIGHTING);
|
||||
}
|
||||
else
|
||||
{
|
||||
glEnable (GL_LIGHTING);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// Temporarily disable environment mapping
|
||||
Handle(OpenGl_Texture) aTextureBack;
|
||||
if (myDrawMode <= GL_LINE_STRIP)
|
||||
{
|
||||
aTextureBack = theWorkspace->DisableTexture();
|
||||
}
|
||||
|
||||
if ((myDrawMode > GL_LINE_STRIP && anAspectFace->InteriorStyle() != Aspect_IS_EMPTY) ||
|
||||
(myDrawMode <= GL_LINE_STRIP))
|
||||
{
|
||||
const bool toHilight = (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) != 0;
|
||||
const Graphic3d_Vec4* aFaceColors = !myBounds.IsNull() && !toHilight && anAspectFace->InteriorStyle() != Aspect_IS_HIDDENLINE
|
||||
? myBounds->Colors
|
||||
: NULL;
|
||||
const Standard_Boolean hasVertColor = hasColorAttrib && !toHilight;
|
||||
if (aCtx->core20fwd != NULL)
|
||||
{
|
||||
switch (myDrawMode)
|
||||
{
|
||||
case GL_POINTS:
|
||||
{
|
||||
const Handle(OpenGl_PointSprite)& aSpriteNorm = anAspectMarker->SpriteRes (aCtx);
|
||||
if (!aSpriteNorm.IsNull()
|
||||
&& !aSpriteNorm->IsDisplayList())
|
||||
{
|
||||
const Handle(OpenGl_PointSprite)& aSprite = (toHilight && anAspectMarker->SpriteHighlightRes (aCtx)->IsValid())
|
||||
? anAspectMarker->SpriteHighlightRes (aCtx)
|
||||
: aSpriteNorm;
|
||||
theWorkspace->EnableTexture (aSprite);
|
||||
aCtx->ShaderManager()->BindProgram (anAspectMarker, aSprite, isLightOn, hasVertColor, anAspectMarker->ShaderProgramRes (aCtx));
|
||||
}
|
||||
else
|
||||
{
|
||||
aCtx->ShaderManager()->BindProgram (anAspectMarker, NULL, isLightOn, hasVertColor, anAspectMarker->ShaderProgramRes (aCtx));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GL_LINES:
|
||||
case GL_LINE_STRIP:
|
||||
{
|
||||
aCtx->ShaderManager()->BindProgram (anAspectLine, NULL, isLightOn, hasVertColor, anAspectLine->ShaderProgramRes (aCtx));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
const Handle(OpenGl_Texture)& aTexture = theWorkspace->ActiveTexture();
|
||||
const Standard_Boolean isLightOnFace = isLightOn
|
||||
&& (aTexture.IsNull()
|
||||
|| aTexture->GetParams()->IsModulate());
|
||||
aCtx->ShaderManager()->BindProgram (anAspectFace, aTexture, isLightOnFace, hasVertColor, anAspectFace->ShaderProgramRes (aCtx));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!theWorkspace->ActiveTexture().IsNull()
|
||||
&& myDrawMode != GL_POINTS) // transformation is not supported within point sprites
|
||||
{
|
||||
aCtx->SetTextureMatrix (theWorkspace->ActiveTexture()->GetParams());
|
||||
}
|
||||
|
||||
aCtx->SetColor4fv (*(const OpenGl_Vec4* )(myDrawMode <= GL_LINE_STRIP ? aLineColor->rgb : anInteriorColor->rgb));
|
||||
if (myDrawMode == GL_LINES
|
||||
|| myDrawMode == GL_LINE_STRIP)
|
||||
{
|
||||
aCtx->SetTypeOfLine (anAspectLine->Type());
|
||||
aCtx->SetLineWidth (anAspectLine->Width());
|
||||
}
|
||||
|
||||
drawArray (theWorkspace, aFaceColors, hasColorAttrib);
|
||||
}
|
||||
|
||||
if (myDrawMode <= GL_LINE_STRIP)
|
||||
{
|
||||
theWorkspace->EnableTexture (aTextureBack);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (anAspectFace->Edge()
|
||||
|| anAspectFace->InteriorStyle() == Aspect_IS_HIDDENLINE)
|
||||
{
|
||||
drawEdges (anEdgeColor, theWorkspace);
|
||||
|
||||
// restore OpenGL polygon mode if needed
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
if (anAspectFace->InteriorStyle() >= Aspect_IS_HATCH)
|
||||
{
|
||||
glPolygonMode (GL_FRONT_AND_BACK,
|
||||
anAspectFace->InteriorStyle() == Aspect_IS_POINT ? GL_POINT : GL_FILL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
aCtx->BindProgram (NULL);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : setDrawMode
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_PrimitiveArray::setDrawMode (const Graphic3d_TypeOfPrimitiveArray theType)
|
||||
{
|
||||
if (myAttribs.IsNull())
|
||||
{
|
||||
myDrawMode = DRAW_MODE_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (theType)
|
||||
{
|
||||
case Graphic3d_TOPA_POINTS:
|
||||
myDrawMode = GL_POINTS;
|
||||
break;
|
||||
case Graphic3d_TOPA_POLYLINES:
|
||||
myDrawMode = GL_LINE_STRIP;
|
||||
break;
|
||||
case Graphic3d_TOPA_SEGMENTS:
|
||||
myDrawMode = GL_LINES;
|
||||
break;
|
||||
case Graphic3d_TOPA_TRIANGLES:
|
||||
myDrawMode = GL_TRIANGLES;
|
||||
break;
|
||||
case Graphic3d_TOPA_TRIANGLESTRIPS:
|
||||
myDrawMode = GL_TRIANGLE_STRIP;
|
||||
break;
|
||||
case Graphic3d_TOPA_TRIANGLEFANS:
|
||||
myDrawMode = GL_TRIANGLE_FAN;
|
||||
break;
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
case Graphic3d_TOPA_POLYGONS:
|
||||
myDrawMode = GL_POLYGON;
|
||||
break;
|
||||
case Graphic3d_TOPA_QUADRANGLES:
|
||||
myDrawMode = GL_QUADS;
|
||||
break;
|
||||
case Graphic3d_TOPA_QUADRANGLESTRIPS:
|
||||
myDrawMode = GL_QUAD_STRIP;
|
||||
break;
|
||||
#else
|
||||
case Graphic3d_TOPA_POLYGONS:
|
||||
case Graphic3d_TOPA_QUADRANGLES:
|
||||
case Graphic3d_TOPA_QUADRANGLESTRIPS:
|
||||
#endif
|
||||
case Graphic3d_TOPA_UNDEFINED:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : processIndices
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean OpenGl_PrimitiveArray::processIndices (const Handle(OpenGl_Context)& theContext) const
|
||||
{
|
||||
if (myIndices.IsNull()
|
||||
|| theContext->hasUintIndex)
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
if (myIndices->NbElements > std::numeric_limits<GLushort>::max())
|
||||
{
|
||||
Handle(Graphic3d_Buffer) anAttribs = new Graphic3d_Buffer (new NCollection_AlignedAllocator (16));
|
||||
if (!anAttribs->Init (myIndices->NbElements, myAttribs->AttributesArray(), myAttribs->NbAttributes))
|
||||
{
|
||||
return Standard_False; // failed to initialize attribute array
|
||||
}
|
||||
|
||||
for (Standard_Integer anIdxIdx = 0; anIdxIdx < myIndices->NbElements; ++anIdxIdx)
|
||||
{
|
||||
const Standard_Integer anIndex = myIndices->Index (anIdxIdx);
|
||||
memcpy (anAttribs->ChangeData() + myAttribs->Stride * anIdxIdx,
|
||||
myAttribs->Data() + myAttribs->Stride * anIndex,
|
||||
myAttribs->Stride);
|
||||
}
|
||||
|
||||
myIndices.Nullify();
|
||||
myAttribs = anAttribs;
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : InitBuffers
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_PrimitiveArray::InitBuffers (const Handle(OpenGl_Context)& theContext,
|
||||
const Graphic3d_TypeOfPrimitiveArray theType,
|
||||
const Handle(Graphic3d_IndexBuffer)& theIndices,
|
||||
const Handle(Graphic3d_Buffer)& theAttribs,
|
||||
const Handle(Graphic3d_BoundBuffer)& theBounds)
|
||||
{
|
||||
// Release old graphic resources
|
||||
Release (theContext.operator->());
|
||||
|
||||
myIndices = theIndices;
|
||||
myAttribs = theAttribs;
|
||||
myBounds = theBounds;
|
||||
#if defined(GL_ES_VERSION_2_0)
|
||||
processIndices (theContext);
|
||||
#endif
|
||||
|
||||
setDrawMode (theType);
|
||||
}
|
||||
@@ -0,0 +1,424 @@
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <XCAFDoc_Dimension.hxx>
|
||||
|
||||
#include <TDF_RelocationTable.hxx>
|
||||
#include <TDF_ChildIterator.hxx>
|
||||
#include <XCAFDoc.hxx>
|
||||
#include <TDataStd_TreeNode.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <TColgp_HArray1OfPnt.hxx>
|
||||
#include <TDataStd_Integer.hxx>
|
||||
#include <TDataStd_IntegerArray.hxx>
|
||||
#include <TDataStd_Real.hxx>
|
||||
#include <TDataStd_RealArray.hxx>
|
||||
#include <TNaming_Builder.hxx>
|
||||
#include <TNaming_NamedShape.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <XCAFDimTolObjects_DimensionObject.hxx>
|
||||
#include <TNaming_Tool.hxx>
|
||||
#include <TDataStd_Name.hxx>
|
||||
|
||||
// IfcOpenShell begin
|
||||
#ifdef GetObject
|
||||
#undef GetObject
|
||||
#endif
|
||||
// IfcOpenShell end
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_Dimension,TDF_Attribute)
|
||||
|
||||
enum ChildLab
|
||||
{
|
||||
ChildLab_Type = 1,
|
||||
ChildLab_Value,
|
||||
ChildLab_Qualifier,
|
||||
ChildLab_Class,
|
||||
ChildLab_Dec,
|
||||
ChildLab_Modifiers,
|
||||
ChildLab_Path,
|
||||
ChildLab_Dir,
|
||||
ChildLab_Pnts,
|
||||
ChildLab_PlaneLoc,
|
||||
ChildLab_PlaneN,
|
||||
ChildLab_PlaneRef,
|
||||
ChildLab_PntText,
|
||||
ChildLab_Presentation
|
||||
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
//function : XCAFDoc_Dimension
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
XCAFDoc_Dimension::XCAFDoc_Dimension()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& XCAFDoc_Dimension::GetID()
|
||||
{
|
||||
static Standard_GUID DGTID ("58ed092c-44de-11d8-8776-001083004c77");
|
||||
//static Standard_GUID ID("efd212e9-6dfd-11d4-b9c8-0060b0ee281b");
|
||||
return DGTID;
|
||||
//return ID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(XCAFDoc_Dimension) XCAFDoc_Dimension::Set(const TDF_Label& theLabel)
|
||||
{
|
||||
Handle(XCAFDoc_Dimension) A;
|
||||
if (!theLabel.FindAttribute(XCAFDoc_Dimension::GetID(), A)) {
|
||||
A = new XCAFDoc_Dimension();
|
||||
theLabel.AddAttribute(A);
|
||||
}
|
||||
return A;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetObject
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void XCAFDoc_Dimension::SetObject (const Handle(XCAFDimTolObjects_DimensionObject)& theObject)
|
||||
{
|
||||
Backup();
|
||||
|
||||
//Label().ForForgetAllAttributes();
|
||||
TDF_ChildIterator anIter(Label());
|
||||
for(;anIter.More(); anIter.Next())
|
||||
{
|
||||
anIter.Value().ForgetAllAttributes();
|
||||
}
|
||||
Handle(TDataStd_Integer) aType = new TDataStd_Integer();
|
||||
Label().FindChild(ChildLab_Type).AddAttribute(aType);
|
||||
aType->Set(theObject->GetType());
|
||||
|
||||
if(!theObject->GetValues().IsNull())
|
||||
{
|
||||
Handle(TDataStd_RealArray) aVal = new TDataStd_RealArray();
|
||||
Label().FindChild(ChildLab_Value).AddAttribute(aVal);
|
||||
aVal->ChangeArray(theObject->GetValues());
|
||||
}
|
||||
|
||||
Handle(TDataStd_Integer) aQualifier = new TDataStd_Integer();
|
||||
Label().FindChild(ChildLab_Qualifier).AddAttribute(aQualifier);
|
||||
aQualifier->Set(theObject->GetQualifier());
|
||||
|
||||
Standard_Boolean aH;
|
||||
XCAFDimTolObjects_DimensionFormVariance aF;
|
||||
XCAFDimTolObjects_DimensionGrade aG;
|
||||
theObject->GetClassOfTolerance(aH,aF,aG);
|
||||
Handle(TColStd_HArray1OfInteger) anArrI;
|
||||
if(aF != XCAFDimTolObjects_DimensionFormVariance_None)
|
||||
{
|
||||
Handle(TDataStd_IntegerArray) aClass = new TDataStd_IntegerArray();
|
||||
Label().FindChild(ChildLab_Class).AddAttribute(aClass);
|
||||
anArrI = new TColStd_HArray1OfInteger(1,3);
|
||||
anArrI->SetValue(1,aH);
|
||||
anArrI->SetValue(2,aF);
|
||||
anArrI->SetValue(3,aG);
|
||||
aClass->ChangeArray(anArrI);
|
||||
}
|
||||
|
||||
Standard_Integer aL, aR;
|
||||
theObject->GetNbOfDecimalPlaces(aL, aR);
|
||||
if (aL > 0 || aR > 0)
|
||||
{
|
||||
Handle(TDataStd_IntegerArray) aDec = new TDataStd_IntegerArray();
|
||||
Label().FindChild(ChildLab_Dec).AddAttribute(aDec);
|
||||
anArrI = new TColStd_HArray1OfInteger(1,2);
|
||||
anArrI->SetValue(1,aL);
|
||||
anArrI->SetValue(2,aR);
|
||||
aDec->ChangeArray(anArrI);
|
||||
}
|
||||
|
||||
if(theObject->GetModifiers().Length() > 0)
|
||||
{
|
||||
Handle(TDataStd_IntegerArray) aModifiers = new TDataStd_IntegerArray();
|
||||
Label().FindChild(ChildLab_Modifiers).AddAttribute(aModifiers);
|
||||
anArrI = new TColStd_HArray1OfInteger(1,theObject->GetModifiers().Length());
|
||||
for(Standard_Integer i = 1; i <= theObject->GetModifiers().Length(); i++)
|
||||
anArrI->SetValue(i,theObject->GetModifiers().Value(i));
|
||||
aModifiers->ChangeArray(anArrI);
|
||||
}
|
||||
|
||||
if(!theObject->GetPath().IsNull())
|
||||
{
|
||||
TNaming_Builder tnBuild(Label().FindChild(ChildLab_Path));
|
||||
tnBuild.Generated(theObject->GetPath());
|
||||
}
|
||||
|
||||
Handle(TColStd_HArray1OfReal) anArrR;
|
||||
if(theObject->GetType() == XCAFDimTolObjects_DimensionType_Location_Oriented)
|
||||
{
|
||||
gp_Dir aD;
|
||||
theObject->GetDirection(aD);
|
||||
Handle(TDataStd_RealArray) aDir = new TDataStd_RealArray();
|
||||
Label().FindChild(ChildLab_Dir).AddAttribute(aDir);
|
||||
anArrR = new TColStd_HArray1OfReal(1,3);
|
||||
anArrR->SetValue(1,aD.X());
|
||||
anArrR->SetValue(2,aD.Y());
|
||||
anArrR->SetValue(3,aD.Z());
|
||||
aDir->ChangeArray(anArrR);
|
||||
}
|
||||
|
||||
Handle(TColgp_HArray1OfPnt) aP = theObject->GetPoints();
|
||||
if(!aP.IsNull() && aP->Length() > 0)
|
||||
{
|
||||
anArrR = new TColStd_HArray1OfReal(1,aP->Length() * 3);
|
||||
Handle(TDataStd_RealArray) aPnts;
|
||||
anArrR->SetValue(1,aP->Value(1).X());
|
||||
anArrR->SetValue(2,aP->Value(1).Y());
|
||||
anArrR->SetValue(3,aP->Value(1).Z());
|
||||
if (aP->Length() == 2) {
|
||||
anArrR->SetValue(4,aP->Value(2).X());
|
||||
anArrR->SetValue(5,aP->Value(2).Y());
|
||||
anArrR->SetValue(6,aP->Value(2).Z());
|
||||
}
|
||||
aPnts = new TDataStd_RealArray();
|
||||
Label().FindChild(ChildLab_Pnts).AddAttribute(aPnts);
|
||||
aPnts->ChangeArray(anArrR);
|
||||
}
|
||||
|
||||
if (theObject->HasPlane())
|
||||
{
|
||||
Handle(TDataStd_RealArray) aLoc = new TDataStd_RealArray();
|
||||
Handle(TDataStd_RealArray) aN = new TDataStd_RealArray();
|
||||
Handle(TDataStd_RealArray) aRAtt = new TDataStd_RealArray();
|
||||
gp_Ax2 anAx = theObject->GetPlane();
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aLocArr->SetValue(i, anAx.Location().Coord(i));
|
||||
aLoc->ChangeArray(aLocArr);
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aNArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aNArr->SetValue(i, anAx.Direction().Coord(i));
|
||||
aN->ChangeArray(aNArr);
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aRArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aRArr->SetValue(i, anAx.XDirection().Coord(i));
|
||||
aRAtt->ChangeArray(aRArr);
|
||||
|
||||
Label().FindChild(ChildLab_PlaneLoc).AddAttribute(aLoc);
|
||||
Label().FindChild(ChildLab_PlaneN).AddAttribute(aN);
|
||||
Label().FindChild(ChildLab_PlaneRef).AddAttribute(aRAtt);
|
||||
}
|
||||
|
||||
if (theObject->HasTextPoint())
|
||||
{
|
||||
Handle(TDataStd_RealArray) aLoc = new TDataStd_RealArray();
|
||||
gp_Pnt aPntText = theObject->GetPointTextAttach();
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aLocArr->SetValue(i, aPntText.Coord(i));
|
||||
aLoc->ChangeArray(aLocArr);
|
||||
|
||||
Label().FindChild(ChildLab_PntText).AddAttribute(aLoc);
|
||||
}
|
||||
|
||||
TopoDS_Shape aPresentation = theObject->GetPresentation();
|
||||
if( !aPresentation.IsNull())
|
||||
{
|
||||
TDF_Label aLPres = Label().FindChild( ChildLab_Presentation);
|
||||
TNaming_Builder tnBuild(aLPres);
|
||||
tnBuild.Generated(aPresentation);
|
||||
Handle(TCollection_HAsciiString) aName = theObject->GetPresentationName();
|
||||
if( !aName.IsNull() )
|
||||
{
|
||||
TCollection_ExtendedString str ( aName->String() );
|
||||
TDataStd_Name::Set ( aLPres, str );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetObject
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(XCAFDimTolObjects_DimensionObject) XCAFDoc_Dimension::GetObject() const
|
||||
{
|
||||
Handle(XCAFDimTolObjects_DimensionObject) anObj = new XCAFDimTolObjects_DimensionObject();
|
||||
|
||||
Handle(TDataStd_Integer) aType;
|
||||
if(Label().FindChild(ChildLab_Type).FindAttribute(TDataStd_Integer::GetID(), aType))
|
||||
{
|
||||
anObj->SetType((XCAFDimTolObjects_DimensionType)aType->Get());
|
||||
}
|
||||
|
||||
Handle(TDataStd_RealArray) aVal;
|
||||
if(Label().FindChild(ChildLab_Value).FindAttribute(TDataStd_RealArray::GetID(), aVal)
|
||||
&& !aVal->Array().IsNull())
|
||||
{
|
||||
anObj->SetValues(aVal->Array());
|
||||
}
|
||||
|
||||
Handle(TDataStd_Integer) aQualifier;
|
||||
if(Label().FindChild(ChildLab_Qualifier).FindAttribute(TDataStd_Integer::GetID(), aQualifier))
|
||||
{
|
||||
anObj->SetQualifier((XCAFDimTolObjects_DimensionQualifier)aQualifier->Get());
|
||||
}
|
||||
|
||||
Handle(TDataStd_IntegerArray) aClass;
|
||||
if(Label().FindChild(ChildLab_Class).FindAttribute(TDataStd_IntegerArray::GetID(), aClass)
|
||||
&& !aClass->Array().IsNull() && aClass->Array()->Length() > 0)
|
||||
{
|
||||
anObj->SetClassOfTolerance(aClass->Array()->Value(1), (XCAFDimTolObjects_DimensionFormVariance)aClass->Array()->Value(2), (XCAFDimTolObjects_DimensionGrade)aClass->Array()->Value(3));
|
||||
}
|
||||
|
||||
Handle(TDataStd_IntegerArray) aDec;
|
||||
if(Label().FindChild(ChildLab_Dec).FindAttribute(TDataStd_IntegerArray::GetID(), aDec)
|
||||
&& !aDec->Array().IsNull() && aDec->Array()->Length() > 0)
|
||||
{
|
||||
anObj->SetNbOfDecimalPlaces(aDec->Array()->Value(1), aDec->Array()->Value(2));
|
||||
}
|
||||
|
||||
Handle(TDataStd_IntegerArray) aModifiers;
|
||||
if(Label().FindChild(ChildLab_Modifiers).FindAttribute(TDataStd_IntegerArray::GetID(), aModifiers)
|
||||
&& !aModifiers->Array().IsNull())
|
||||
{
|
||||
XCAFDimTolObjects_DimensionModifiersSequence aM;
|
||||
for(Standard_Integer i = 1; i <= aModifiers->Array()->Length(); i++)
|
||||
aM.Append((XCAFDimTolObjects_DimensionModif)aModifiers->Array()->Value(i));
|
||||
anObj->SetModifiers(aM);
|
||||
}
|
||||
|
||||
Handle(TNaming_NamedShape) aShape;
|
||||
if(Label().FindChild(ChildLab_Path).FindAttribute(TNaming_NamedShape::GetID(), aShape)
|
||||
&& !aShape.IsNull())
|
||||
{
|
||||
anObj->SetPath(TopoDS::Edge(aShape->Get()));
|
||||
}
|
||||
|
||||
|
||||
Handle(TDataStd_RealArray) aDir;
|
||||
if(Label().FindChild(ChildLab_Dir).FindAttribute(TDataStd_RealArray::GetID(), aDir)
|
||||
&& !aDir->Array().IsNull() && aDir->Array()->Length() > 0)
|
||||
{
|
||||
gp_Dir aD(aDir->Array()->Value(1), aDir->Array()->Value(2), aDir->Array()->Value(3));
|
||||
anObj->SetDirection(aD);
|
||||
}
|
||||
|
||||
Handle(TDataStd_RealArray) aPnts;
|
||||
if(Label().FindChild(ChildLab_Pnts).FindAttribute(TDataStd_RealArray::GetID(), aPnts)
|
||||
&& !aPnts->Array().IsNull() && aPnts->Array()->Length() > 2)
|
||||
{
|
||||
Handle(TColgp_HArray1OfPnt) aP = new TColgp_HArray1OfPnt(1,aPnts->Array()->Length()/3);
|
||||
gp_Pnt aP1(aPnts->Array()->Value(1), aPnts->Array()->Value(2), aPnts->Array()->Value(3));
|
||||
aP->SetValue(1, aP1);
|
||||
if (aPnts->Array()->Length() == 6)
|
||||
{
|
||||
gp_Pnt aP2(aPnts->Array()->Value(4), aPnts->Array()->Value(5), aPnts->Array()->Value(6));
|
||||
aP->SetValue(2, aP2);
|
||||
}
|
||||
anObj->SetPoints(aP);
|
||||
}
|
||||
|
||||
Handle(TDataStd_RealArray) aLoc, aN, aR;
|
||||
if(Label().FindChild(ChildLab_PlaneLoc).FindAttribute(TDataStd_RealArray::GetID(), aLoc) && aLoc->Length() == 3 &&
|
||||
Label().FindChild(ChildLab_PlaneN).FindAttribute(TDataStd_RealArray::GetID(), aN) && aN->Length() == 3 &&
|
||||
Label().FindChild(ChildLab_PlaneRef).FindAttribute(TDataStd_RealArray::GetID(), aR) && aR->Length() == 3 )
|
||||
{
|
||||
gp_Pnt aL(aLoc->Value(aLoc->Lower()), aLoc->Value(aLoc->Lower()+1), aLoc->Value(aLoc->Lower()+2));
|
||||
gp_Dir aD(aN->Value(aN->Lower()), aN->Value(aN->Lower()+1), aN->Value(aN->Lower()+2));
|
||||
gp_Dir aDR(aR->Value(aR->Lower()), aR->Value(aR->Lower()+1), aR->Value(aR->Lower()+2));
|
||||
gp_Ax2 anAx(aL, aD, aDR);
|
||||
anObj->SetPlane(anAx);
|
||||
}
|
||||
|
||||
Handle(TDataStd_RealArray) aPntText;
|
||||
if(Label().FindChild(ChildLab_PntText).FindAttribute(TDataStd_RealArray::GetID(), aPntText) && aPntText->Length() == 3 )
|
||||
{
|
||||
gp_Pnt aP(aPntText->Value(aPntText->Lower()), aPntText->Value(aPntText->Lower()+1), aPntText->Value(aPntText->Lower()+2));
|
||||
anObj->SetPointTextAttach(aP);
|
||||
}
|
||||
|
||||
Handle(TNaming_NamedShape) aNS;
|
||||
TDF_Label aLPres = Label().FindChild( ChildLab_Presentation);
|
||||
if ( aLPres.FindAttribute(TNaming_NamedShape::GetID(), aNS) )
|
||||
{
|
||||
|
||||
TopoDS_Shape aPresentation = TNaming_Tool::GetShape(aNS);
|
||||
if( !aPresentation.IsNull())
|
||||
{
|
||||
|
||||
Handle(TDataStd_Name) aNameAtrr;
|
||||
Handle(TCollection_HAsciiString) aPresentName;
|
||||
if (aLPres.FindAttribute(TDataStd_Name::GetID(),aNameAtrr))
|
||||
{
|
||||
const TCollection_ExtendedString& aName = aNameAtrr->Get();
|
||||
|
||||
if( !aName.IsEmpty())
|
||||
aPresentName = new TCollection_HAsciiString(aName);
|
||||
}
|
||||
|
||||
anObj->SetPresentation(aPresentation, aPresentName);
|
||||
}
|
||||
}
|
||||
return anObj;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& XCAFDoc_Dimension::ID() const
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void XCAFDoc_Dimension::Restore(const Handle(TDF_Attribute)& /*With*/)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) XCAFDoc_Dimension::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_Dimension();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void XCAFDoc_Dimension::Paste(const Handle(TDF_Attribute)& /*Into*/,
|
||||
const Handle(TDF_RelocationTable)& /*RT*/) const
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,428 @@
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <XCAFDoc_GeomTolerance.hxx>
|
||||
|
||||
#include <TDF_RelocationTable.hxx>
|
||||
#include <TDF_ChildIterator.hxx>
|
||||
#include <XCAFDoc.hxx>
|
||||
#include <TDataStd_TreeNode.hxx>
|
||||
#include <TDataStd_Integer.hxx>
|
||||
#include <TDataStd_IntegerArray.hxx>
|
||||
#include <TDataStd_RealArray.hxx>
|
||||
#include <TDataStd_Real.hxx>
|
||||
#include <XCAFDimTolObjects_GeomToleranceObject.hxx>
|
||||
#include <TNaming_Tool.hxx>
|
||||
#include <TNaming_Builder.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <TDataStd_Name.hxx>
|
||||
|
||||
// IfcOpenShell begin
|
||||
#ifdef GetObject
|
||||
#undef GetObject
|
||||
#endif
|
||||
// IfcOpenShell end
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_GeomTolerance,TDF_Attribute)
|
||||
|
||||
enum ChildLab
|
||||
{
|
||||
ChildLab_Type = 1,
|
||||
ChildLab_TypeOfValue,
|
||||
ChildLab_Value,
|
||||
ChildLab_MatReqModif,
|
||||
ChildLab_ZoneModif,
|
||||
ChildLab_ValueOfZoneModif,
|
||||
ChildLab_Modifiers,
|
||||
ChildLab_aMaxValueModif,
|
||||
ChildLab_AxisLoc,
|
||||
ChildLab_AxisN,
|
||||
ChildLab_AxisRef,
|
||||
ChildLab_PlaneLoc,
|
||||
ChildLab_PlaneN,
|
||||
ChildLab_PlaneRef,
|
||||
ChildLab_Pnt,
|
||||
ChildLab_PntText,
|
||||
ChildLab_Presentation
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
//function : XCAFDoc_GeomTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
XCAFDoc_GeomTolerance::XCAFDoc_GeomTolerance()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& XCAFDoc_GeomTolerance::GetID()
|
||||
{
|
||||
static Standard_GUID DGTID ("58ed092f-44de-11d8-8776-001083004c77");
|
||||
//static Standard_GUID ID("efd212e9-6dfd-11d4-b9c8-0060b0ee281b");
|
||||
return DGTID;
|
||||
//return ID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(XCAFDoc_GeomTolerance) XCAFDoc_GeomTolerance::Set (const TDF_Label& theLabel)
|
||||
{
|
||||
Handle(XCAFDoc_GeomTolerance) A;
|
||||
if (!theLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), A)) {
|
||||
A = new XCAFDoc_GeomTolerance();
|
||||
theLabel.AddAttribute(A);
|
||||
}
|
||||
return A;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetObject
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void XCAFDoc_GeomTolerance::SetObject (const Handle(XCAFDimTolObjects_GeomToleranceObject)& theObject)
|
||||
{
|
||||
Backup();
|
||||
|
||||
//Label().ForForgetAllAttributes();
|
||||
TDF_ChildIterator anIter(Label());
|
||||
for(;anIter.More(); anIter.Next())
|
||||
{
|
||||
anIter.Value().ForgetAllAttributes();
|
||||
}
|
||||
|
||||
Handle(TDataStd_Integer) aType = new TDataStd_Integer();
|
||||
aType->Set(theObject->GetType());
|
||||
Label().FindChild(ChildLab_Type).AddAttribute(aType);
|
||||
|
||||
if(theObject->GetTypeOfValue() != XCAFDimTolObjects_GeomToleranceTypeValue_None)
|
||||
{
|
||||
Handle(TDataStd_Integer) aTypeOfValue = new TDataStd_Integer();
|
||||
aTypeOfValue->Set(theObject->GetTypeOfValue());
|
||||
Label().FindChild(ChildLab_TypeOfValue).AddAttribute(aTypeOfValue);
|
||||
}
|
||||
|
||||
Handle(TDataStd_Real) aValue = new TDataStd_Real();
|
||||
aValue->Set(theObject->GetValue());
|
||||
Label().FindChild(ChildLab_Value).AddAttribute(aValue);
|
||||
|
||||
Handle(TDataStd_Integer) aMatReqModif;
|
||||
if(theObject->GetMaterialRequirementModifier() != XCAFDimTolObjects_GeomToleranceMatReqModif_None)
|
||||
{
|
||||
Label().FindChild(ChildLab_MatReqModif).FindAttribute(TDataStd_Integer::GetID(), aMatReqModif);
|
||||
aMatReqModif = new TDataStd_Integer();
|
||||
Label().FindChild(ChildLab_MatReqModif).AddAttribute(aMatReqModif);
|
||||
aMatReqModif->Set(theObject->GetMaterialRequirementModifier());
|
||||
}
|
||||
|
||||
if(theObject->GetZoneModifier() != XCAFDimTolObjects_GeomToleranceZoneModif_None)
|
||||
{
|
||||
Handle(TDataStd_Integer) aZoneModif = new TDataStd_Integer();
|
||||
aZoneModif->Set(theObject->GetZoneModifier());
|
||||
Label().FindChild(ChildLab_ZoneModif).AddAttribute(aZoneModif);
|
||||
}
|
||||
|
||||
if(theObject->GetValueOfZoneModifier() > 0)
|
||||
{
|
||||
Handle(TDataStd_Real) aValueOfZoneModif = new TDataStd_Real();
|
||||
aValueOfZoneModif->Set(theObject->GetValueOfZoneModifier());
|
||||
Label().FindChild(ChildLab_ValueOfZoneModif).AddAttribute(aValueOfZoneModif);
|
||||
}
|
||||
|
||||
if(theObject->GetModifiers().Length() > 0)
|
||||
{
|
||||
Handle(TDataStd_IntegerArray) aModifiers = new TDataStd_IntegerArray();
|
||||
Handle(TColStd_HArray1OfInteger) anArr = new TColStd_HArray1OfInteger(1,theObject->GetModifiers().Length());
|
||||
for(Standard_Integer i = 1; i <= theObject->GetModifiers().Length(); i++)
|
||||
anArr->SetValue(i,theObject->GetModifiers().Value(i));
|
||||
aModifiers->ChangeArray(anArr);
|
||||
Label().FindChild(ChildLab_Modifiers).AddAttribute(aModifiers);
|
||||
}
|
||||
|
||||
if(theObject->GetMaxValueModifier() > 0)
|
||||
{
|
||||
Handle(TDataStd_Real) aMaxValueModif = new TDataStd_Real();
|
||||
aMaxValueModif->Set(theObject->GetMaxValueModifier());
|
||||
Label().FindChild(ChildLab_aMaxValueModif).AddAttribute(aMaxValueModif);
|
||||
}
|
||||
|
||||
if(theObject->HasAxis())
|
||||
{
|
||||
Handle(TDataStd_RealArray) aLoc = new TDataStd_RealArray();
|
||||
Handle(TDataStd_RealArray) aN = new TDataStd_RealArray();
|
||||
Handle(TDataStd_RealArray) aR = new TDataStd_RealArray();
|
||||
gp_Ax2 anAx = theObject->GetAxis();
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aLocArr->SetValue(i, anAx.Location().Coord(i));
|
||||
aLoc->ChangeArray(aLocArr);
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aNArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aNArr->SetValue(i, anAx.Direction().Coord(i));
|
||||
aN->ChangeArray(aNArr);
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aRArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aRArr->SetValue(i, anAx.XDirection().Coord(i));
|
||||
aR->ChangeArray(aRArr);
|
||||
|
||||
Label().FindChild(ChildLab_AxisLoc).AddAttribute(aLoc);
|
||||
Label().FindChild(ChildLab_AxisN).AddAttribute(aN);
|
||||
Label().FindChild(ChildLab_AxisRef).AddAttribute(aR);
|
||||
}
|
||||
|
||||
if (theObject->HasPlane())
|
||||
{
|
||||
Handle(TDataStd_RealArray) aLoc = new TDataStd_RealArray();
|
||||
Handle(TDataStd_RealArray) aN = new TDataStd_RealArray();
|
||||
Handle(TDataStd_RealArray) aR = new TDataStd_RealArray();
|
||||
gp_Ax2 anAx = theObject->GetPlane();
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aLocArr->SetValue(i, anAx.Location().Coord(i));
|
||||
aLoc->ChangeArray(aLocArr);
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aNArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aNArr->SetValue(i, anAx.Direction().Coord(i));
|
||||
aN->ChangeArray(aNArr);
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aRArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aRArr->SetValue(i, anAx.XDirection().Coord(i));
|
||||
aR->ChangeArray(aRArr);
|
||||
|
||||
Label().FindChild(ChildLab_PlaneLoc).AddAttribute(aLoc);
|
||||
Label().FindChild(ChildLab_PlaneN).AddAttribute(aN);
|
||||
Label().FindChild(ChildLab_PlaneRef).AddAttribute(aR);
|
||||
}
|
||||
|
||||
if (theObject->HasPoint())
|
||||
{
|
||||
Handle(TDataStd_RealArray) aLoc = new TDataStd_RealArray();
|
||||
gp_Pnt aPnt = theObject->GetPoint();
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aLocArr->SetValue(i, aPnt.Coord(i));
|
||||
aLoc->ChangeArray(aLocArr);
|
||||
|
||||
Label().FindChild(ChildLab_Pnt).AddAttribute(aLoc);
|
||||
}
|
||||
|
||||
if (theObject->HasPointText())
|
||||
{
|
||||
Handle(TDataStd_RealArray) aLoc = new TDataStd_RealArray();
|
||||
gp_Pnt aPntText = theObject->GetPointTextAttach();
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aLocArr->SetValue(i, aPntText.Coord(i));
|
||||
aLoc->ChangeArray(aLocArr);
|
||||
|
||||
Label().FindChild(ChildLab_PntText).AddAttribute(aLoc);
|
||||
}
|
||||
|
||||
TopoDS_Shape aPresentation = theObject->GetPresentation();
|
||||
if( !aPresentation.IsNull())
|
||||
{
|
||||
TDF_Label aLPres = Label().FindChild( ChildLab_Presentation);
|
||||
TNaming_Builder tnBuild(aLPres);
|
||||
tnBuild.Generated(aPresentation);
|
||||
Handle(TCollection_HAsciiString) aName = theObject->GetPresentationName();
|
||||
if( !aName.IsNull() )
|
||||
{
|
||||
TCollection_ExtendedString str ( aName->String() );
|
||||
TDataStd_Name::Set ( aLPres, str );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :GetObject
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(XCAFDimTolObjects_GeomToleranceObject) XCAFDoc_GeomTolerance::GetObject() const
|
||||
{
|
||||
Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = new XCAFDimTolObjects_GeomToleranceObject();
|
||||
|
||||
Handle(TDataStd_Integer) aType;
|
||||
if(Label().FindChild(ChildLab_Type).FindAttribute(TDataStd_Integer::GetID(), aType))
|
||||
{
|
||||
anObj->SetType((XCAFDimTolObjects_GeomToleranceType)aType->Get());
|
||||
}
|
||||
|
||||
Handle(TDataStd_Integer) aTypeOfValue;
|
||||
if(Label().FindChild(ChildLab_TypeOfValue).FindAttribute(TDataStd_Integer::GetID(), aTypeOfValue))
|
||||
{
|
||||
anObj->SetTypeOfValue((XCAFDimTolObjects_GeomToleranceTypeValue)aTypeOfValue->Get());
|
||||
}
|
||||
|
||||
Handle(TDataStd_Real) aValue;
|
||||
if(Label().FindChild(ChildLab_Value).FindAttribute(TDataStd_Real::GetID(), aValue))
|
||||
{
|
||||
anObj->SetValue(aValue->Get());
|
||||
}
|
||||
|
||||
Handle(TDataStd_Integer) aMatReqModif;
|
||||
if(Label().FindChild(ChildLab_MatReqModif).FindAttribute(TDataStd_Integer::GetID(), aMatReqModif))
|
||||
{
|
||||
anObj->SetMaterialRequirementModifier((XCAFDimTolObjects_GeomToleranceMatReqModif)aMatReqModif->Get());
|
||||
}
|
||||
|
||||
Handle(TDataStd_Integer) aZoneModif;
|
||||
if(Label().FindChild(ChildLab_ZoneModif).FindAttribute(TDataStd_Integer::GetID(), aZoneModif))
|
||||
{
|
||||
anObj->SetZoneModifier((XCAFDimTolObjects_GeomToleranceZoneModif)aZoneModif->Get());
|
||||
}
|
||||
|
||||
Handle(TDataStd_Real) aValueOfZoneModif;
|
||||
if(Label().FindChild(ChildLab_ValueOfZoneModif).FindAttribute(TDataStd_Real::GetID(), aValueOfZoneModif))
|
||||
{
|
||||
anObj->SetValueOfZoneModifier(aValueOfZoneModif->Get());
|
||||
}
|
||||
|
||||
Handle(TDataStd_IntegerArray) anArr;
|
||||
if(Label().FindChild(ChildLab_Modifiers).FindAttribute(TDataStd_IntegerArray::GetID(), anArr)
|
||||
&& !anArr->Array().IsNull())
|
||||
{
|
||||
XCAFDimTolObjects_GeomToleranceModifiersSequence aModifiers;
|
||||
for(Standard_Integer i = 1; i <= anArr->Length(); i++)
|
||||
aModifiers.Append((XCAFDimTolObjects_GeomToleranceModif)anArr->Value(i));
|
||||
anObj->SetModifiers(aModifiers);
|
||||
}
|
||||
|
||||
Handle(TDataStd_Real) aMaxValueModif;
|
||||
if(Label().FindChild(ChildLab_aMaxValueModif).FindAttribute(TDataStd_Real::GetID(), aMaxValueModif))
|
||||
{
|
||||
anObj->SetMaxValueModifier(aMaxValueModif->Get());
|
||||
}
|
||||
|
||||
Handle(TDataStd_RealArray) aLoc;
|
||||
Handle(TDataStd_RealArray) aN;
|
||||
Handle(TDataStd_RealArray) aR;
|
||||
if(Label().FindChild(ChildLab_AxisLoc).FindAttribute(TDataStd_RealArray::GetID(), aLoc) && aLoc->Length() == 3 &&
|
||||
Label().FindChild(ChildLab_AxisN).FindAttribute(TDataStd_RealArray::GetID(), aN) && aN->Length() == 3 &&
|
||||
Label().FindChild(ChildLab_AxisRef).FindAttribute(TDataStd_RealArray::GetID(), aR) && aR->Length() == 3 )
|
||||
{
|
||||
gp_Pnt aL(aLoc->Value(aLoc->Lower()), aLoc->Value(aLoc->Lower()+1), aLoc->Value(aLoc->Lower()+2));
|
||||
gp_Dir aD(aN->Value(aN->Lower()), aN->Value(aN->Lower()+1), aN->Value(aN->Lower()+2));
|
||||
gp_Dir aDR(aR->Value(aR->Lower()), aR->Value(aR->Lower()+1), aR->Value(aR->Lower()+2));
|
||||
gp_Ax2 anAx(aL, aD, aDR);
|
||||
anObj->SetAxis(anAx);
|
||||
}
|
||||
|
||||
if(Label().FindChild(ChildLab_PlaneLoc).FindAttribute(TDataStd_RealArray::GetID(), aLoc) && aLoc->Length() == 3 &&
|
||||
Label().FindChild(ChildLab_PlaneN).FindAttribute(TDataStd_RealArray::GetID(), aN) && aN->Length() == 3 &&
|
||||
Label().FindChild(ChildLab_PlaneRef).FindAttribute(TDataStd_RealArray::GetID(), aR) && aR->Length() == 3 )
|
||||
{
|
||||
gp_Pnt aL(aLoc->Value(aLoc->Lower()), aLoc->Value(aLoc->Lower()+1), aLoc->Value(aLoc->Lower()+2));
|
||||
gp_Dir aD(aN->Value(aN->Lower()), aN->Value(aN->Lower()+1), aN->Value(aN->Lower()+2));
|
||||
gp_Dir aDR(aR->Value(aR->Lower()), aR->Value(aR->Lower()+1), aR->Value(aR->Lower()+2));
|
||||
gp_Ax2 anAx(aL, aD, aDR);
|
||||
anObj->SetPlane(anAx);
|
||||
}
|
||||
|
||||
Handle(TDataStd_RealArray) aPnt;
|
||||
if(Label().FindChild(ChildLab_PlaneLoc).FindAttribute(TDataStd_RealArray::GetID(), aPnt) && aPnt->Length() == 3 )
|
||||
{
|
||||
gp_Pnt aP(aLoc->Value(aPnt->Lower()), aPnt->Value(aPnt->Lower()+1), aPnt->Value(aPnt->Lower()+2));
|
||||
anObj->SetPoint(aP);
|
||||
}
|
||||
|
||||
Handle(TDataStd_RealArray) aPntText;
|
||||
if(Label().FindChild(ChildLab_PntText).FindAttribute(TDataStd_RealArray::GetID(), aPntText) && aPntText->Length() == 3 )
|
||||
{
|
||||
gp_Pnt aP(aPntText->Value(aPntText->Lower()), aPntText->Value(aPntText->Lower()+1), aPntText->Value(aPntText->Lower()+2));
|
||||
anObj->SetPointTextAttach(aP);
|
||||
}
|
||||
|
||||
Handle(TNaming_NamedShape) aNS;
|
||||
TDF_Label aLPres = Label().FindChild( ChildLab_Presentation);
|
||||
if ( aLPres.FindAttribute(TNaming_NamedShape::GetID(), aNS) )
|
||||
{
|
||||
|
||||
TopoDS_Shape aPresentation = TNaming_Tool::GetShape(aNS);
|
||||
if( !aPresentation.IsNull())
|
||||
{
|
||||
Handle(TDataStd_Name) aNameAtrr;
|
||||
Handle(TCollection_HAsciiString) aPresentName;
|
||||
if (aLPres.FindAttribute(TDataStd_Name::GetID(),aNameAtrr))
|
||||
{
|
||||
const TCollection_ExtendedString& aName = aNameAtrr->Get();
|
||||
|
||||
if( !aName.IsEmpty())
|
||||
aPresentName = new TCollection_HAsciiString(aName);
|
||||
}
|
||||
|
||||
anObj->SetPresentation(aPresentation, aPresentName);
|
||||
}
|
||||
}
|
||||
|
||||
return anObj;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& XCAFDoc_GeomTolerance::ID() const
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void XCAFDoc_GeomTolerance::Restore(const Handle(TDF_Attribute)& /*With*/)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) XCAFDoc_GeomTolerance::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_GeomTolerance();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void XCAFDoc_GeomTolerance::Paste(const Handle(TDF_Attribute)& /*Into*/,
|
||||
const Handle(TDF_RelocationTable)& /*RT*/) const
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
##
|
||||
|
||||
if(FLAGS_ALREADY_INCLUDED)
|
||||
return()
|
||||
endif()
|
||||
set(FLAGS_ALREADY_INCLUDED 1)
|
||||
|
||||
# force option /fp:precise for Visual Studio projects.
|
||||
#
|
||||
# Note that while this option is default for MSVC compiler, Visual Studio
|
||||
# project can be switched later to use Intel Compiler (ICC).
|
||||
# Enforcing -fp:precise ensures that in such case ICC will use correct
|
||||
# option instead of its default -fp:fast which is harmful for OCCT.
|
||||
if (MSVC)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:precise")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /fp:precise")
|
||||
endif()
|
||||
|
||||
# set compiler short name and choose SSE2 option for appropriate MSVC compilers
|
||||
# ONLY for 32-bit
|
||||
if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
if (MSVC80 OR MSVC90 OR MSVC10)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:SSE2")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
|
||||
else()
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -fPIC")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexceptions -fPIC")
|
||||
add_definitions(-DOCC_CONVERT_SIGNALS)
|
||||
endif()
|
||||
|
||||
# enable structured exceptions for MSVC
|
||||
string (REGEX MATCH "EHsc" ISFLAG "${CMAKE_CXX_FLAGS}")
|
||||
if (ISFLAG)
|
||||
string (REGEX REPLACE "EHsc" "EHa" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
elseif (MSVC)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHa")
|
||||
endif()
|
||||
|
||||
# remove _WINDOWS flag if it exists
|
||||
string (REGEX MATCH "/D_WINDOWS" IS_WINDOWSFLAG "${CMAKE_CXX_FLAGS}")
|
||||
if (IS_WINDOWSFLAG)
|
||||
message (STATUS "Info: /D_WINDOWS has been removed from CMAKE_CXX_FLAGS")
|
||||
string (REGEX REPLACE "/D_WINDOWS" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
endif()
|
||||
|
||||
# remove WIN32 flag if it exists
|
||||
string (REGEX MATCH "/DWIN32" IS_WIN32FLAG "${CMAKE_CXX_FLAGS}")
|
||||
if (IS_WIN32FLAG)
|
||||
message (STATUS "Info: /DWIN32 has been removed from CMAKE_CXX_FLAGS")
|
||||
string (REGEX REPLACE "/DWIN32" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
endif()
|
||||
|
||||
# remove _WINDOWS flag if it exists
|
||||
string (REGEX MATCH "/D_WINDOWS" IS_WINDOWSFLAG "${CMAKE_C_FLAGS}")
|
||||
if (IS_WINDOWSFLAG)
|
||||
message (STATUS "Info: /D_WINDOWS has been removed from CMAKE_C_FLAGS")
|
||||
string (REGEX REPLACE "/D_WINDOWS" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
endif()
|
||||
|
||||
# remove WIN32 flag if it exists
|
||||
string (REGEX MATCH "/DWIN32" IS_WIN32FLAG "${CMAKE_C_FLAGS}")
|
||||
if (IS_WIN32FLAG)
|
||||
message (STATUS "Info: /DWIN32 has been removed from CMAKE_C_FLAGS")
|
||||
string (REGEX REPLACE "/DWIN32" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
endif()
|
||||
|
||||
# remove DEBUG flag if it exists
|
||||
string (REGEX MATCH "-DDEBUG" IS_DEBUG_CXX "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
if (IS_DEBUG_CXX)
|
||||
message (STATUS "Info: -DDEBUG has been removed from CMAKE_CXX_FLAGS_DEBUG")
|
||||
string (REGEX REPLACE "-DDEBUG" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
endif()
|
||||
|
||||
string (REGEX MATCH "-DDEBUG" IS_DEBUG_C "${CMAKE_C_FLAGS_DEBUG}")
|
||||
if (IS_DEBUG_C)
|
||||
message (STATUS "Info: -DDEBUG has been removed from CMAKE_C_FLAGS_DEBUG")
|
||||
string (REGEX REPLACE "-DDEBUG" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
|
||||
endif()
|
||||
# enable parallel compilation on MSVC 9 and above
|
||||
if (MSVC AND NOT MSVC70 AND NOT MSVC80)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||
endif()
|
||||
|
||||
# generate a single response file which enlist all of the object files
|
||||
SET(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1)
|
||||
SET(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1)
|
||||
# increase compiler warnings level (-W4 for MSVC, -Wextra for GCC)
|
||||
if (MSVC)
|
||||
if (CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
||||
string (REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
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}" STREQUAL "Clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
|
||||
if (BUILD_SHARED_LIBS)
|
||||
if (APPLE)
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
elseif(NOT WIN32)
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
endif()
|
||||
else()
|
||||
if (NOT ANDROID AND NOT MINGW)
|
||||
set (CMAKE_STATIC_LINKER_FLAGS "-lm ${CMAKE_SHARED_STATIC_FLAGS}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MINGW)
|
||||
set (CMAKE_CXX_FLAGS "-std=gnu++0x ${CMAKE_CXX_FLAGS}")
|
||||
add_definitions(-D_WIN32_WINNT=0x0501)
|
||||
# workaround bugs in mingw with vtable export
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--export-all-symbols")
|
||||
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang")
|
||||
set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
|
||||
endif()
|
||||
|
||||
# Optimize size of binaries
|
||||
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR MINGW)
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
|
||||
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")
|
||||
endif()
|
||||
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNo_Exception")
|
||||
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNo_Exception")
|
||||
|
||||
# IfcOpenShell begin
|
||||
if (MSVC)
|
||||
foreach(flag CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL
|
||||
CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
|
||||
if (${flag} MATCHES "/MD")
|
||||
string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
|
||||
endif()
|
||||
if (${flag} MATCHES "/MDd")
|
||||
string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
# IfcOpenShell end
|
||||
@@ -0,0 +1,220 @@
|
||||
# script for each OCCT toolkit
|
||||
|
||||
# parce PACKAGES file
|
||||
if ("${PROJECT_NAME}" STREQUAL DRAWEXE)
|
||||
set (USED_PACKAGES DRAWEXE)
|
||||
else()
|
||||
FILE_TO_LIST ("src/${PROJECT_NAME}/PACKAGES" USED_PACKAGES)
|
||||
endif()
|
||||
|
||||
set (PRECOMPILED_DEFS)
|
||||
|
||||
# Get all used packages from toolkit
|
||||
foreach (OCCT_PACKAGE ${USED_PACKAGES})
|
||||
|
||||
# TKService contains platform-dependent packages: Xw and WNT
|
||||
if ((WIN32 AND "${OCCT_PACKAGE}" STREQUAL "Xw") OR (NOT WIN32 AND "${OCCT_PACKAGE}" STREQUAL "WNT"))
|
||||
# do nothing
|
||||
else()
|
||||
|
||||
if (WIN32)
|
||||
list (APPEND PRECOMPILED_DEFS "-D__${OCCT_PACKAGE}_DLL")
|
||||
endif()
|
||||
|
||||
set (SOURCE_FILES)
|
||||
set (HEADER_FILES)
|
||||
|
||||
# Generate Flex and Bison files
|
||||
if (${BUILD_YACCLEX})
|
||||
|
||||
# flex files
|
||||
OCCT_ORIGIN_AND_PATCHED_FILES ("src/${OCCT_PACKAGE}" "*[.]lex" SOURCE_FILES_FLEX)
|
||||
list (LENGTH SOURCE_FILES_FLEX SOURCE_FILES_FLEX_LEN)
|
||||
|
||||
# bison files
|
||||
OCCT_ORIGIN_AND_PATCHED_FILES ("src/${OCCT_PACKAGE}" "*[.]yacc" SOURCE_FILES_BISON)
|
||||
list (LENGTH SOURCE_FILES_BISON SOURCE_FILES_BISON_LEN)
|
||||
|
||||
if (${SOURCE_FILES_FLEX_LEN} EQUAL ${SOURCE_FILES_BISON_LEN} AND NOT ${SOURCE_FILES_FLEX_LEN} EQUAL 0)
|
||||
|
||||
list (SORT SOURCE_FILES_FLEX)
|
||||
list (SORT SOURCE_FILES_BISON)
|
||||
|
||||
math (EXPR SOURCE_FILES_FLEX_LEN "${SOURCE_FILES_FLEX_LEN} - 1")
|
||||
foreach (FLEX_FILE_INDEX RANGE ${SOURCE_FILES_FLEX_LEN})
|
||||
|
||||
list (GET SOURCE_FILES_FLEX ${FLEX_FILE_INDEX} CURRENT_FLEX_FILE)
|
||||
get_filename_component (CURRENT_FLEX_FILE_NAME ${CURRENT_FLEX_FILE} NAME_WE)
|
||||
|
||||
list (GET SOURCE_FILES_BISON ${FLEX_FILE_INDEX} CURRENT_BISON_FILE)
|
||||
get_filename_component (CURRENT_BISON_FILE_NAME ${CURRENT_BISON_FILE} NAME_WE)
|
||||
|
||||
string (COMPARE EQUAL ${CURRENT_FLEX_FILE_NAME} ${CURRENT_BISON_FILE_NAME} ARE_FILES_EQUAL)
|
||||
|
||||
if (EXISTS "${CURRENT_FLEX_FILE}" AND EXISTS "${CURRENT_BISON_FILE}" AND ${ARE_FILES_EQUAL})
|
||||
set (BISON_OUTPUT_FILE ${CURRENT_BISON_FILE_NAME}.tab.c)
|
||||
set (FLEX_OUTPUT_FILE lex.${CURRENT_FLEX_FILE_NAME}.c)
|
||||
BISON_TARGET (Parser_${CURRENT_BISON_FILE_NAME} ${CURRENT_BISON_FILE} ${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/${BISON_OUTPUT_FILE} COMPILE_FLAGS "-p ${CURRENT_BISON_FILE_NAME}")
|
||||
FLEX_TARGET (Scanner_${CURRENT_FLEX_FILE_NAME} ${CURRENT_FLEX_FILE} ${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/${FLEX_OUTPUT_FILE} COMPILE_FLAGS "-P${CURRENT_FLEX_FILE_NAME}")
|
||||
ADD_FLEX_BISON_DEPENDENCY (Scanner_${CURRENT_FLEX_FILE_NAME} Parser_${CURRENT_BISON_FILE_NAME})
|
||||
|
||||
list (APPEND SOURCE_FILES ${BISON_OUTPUT_FILE} ${FLEX_OUTPUT_FILE})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# header files
|
||||
if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/src/${OCCT_PACKAGE}/FILES")
|
||||
file (STRINGS "${BUILD_PATCH}/src/${OCCT_PACKAGE}/FILES" HEADER_FILES_M REGEX ".+[.]h")
|
||||
file (STRINGS "${BUILD_PATCH}/src/${OCCT_PACKAGE}/FILES" HEADER_FILES_LXX REGEX ".+[.]lxx")
|
||||
file (STRINGS "${BUILD_PATCH}/src/${OCCT_PACKAGE}/FILES" HEADER_FILES_GXX REGEX ".+[.]gxx")
|
||||
|
||||
file (STRINGS "${BUILD_PATCH}/src/${OCCT_PACKAGE}/FILES" SOURCE_FILES_C REGEX ".+[.]c")
|
||||
if(APPLE)
|
||||
file (STRINGS "${BUILD_PATCH}/src/${OCCT_PACKAGE}/FILES" SOURCE_FILES_M REGEX ".+[.]mm")
|
||||
endif()
|
||||
else()
|
||||
file (STRINGS "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/FILES" HEADER_FILES_M REGEX ".+[.]h")
|
||||
file (STRINGS "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/FILES" HEADER_FILES_LXX REGEX ".+[.]lxx")
|
||||
file (STRINGS "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/FILES" HEADER_FILES_GXX REGEX ".+[.]gxx")
|
||||
|
||||
file (STRINGS "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/FILES" SOURCE_FILES_C REGEX ".+[.]c")
|
||||
if(APPLE)
|
||||
file (STRINGS "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/FILES" SOURCE_FILES_M REGEX ".+[.]mm")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list (APPEND HEADER_FILES ${HEADER_FILES_M} ${HEADER_FILES_LXX} ${SOURCE_FILES_GXX})
|
||||
list (APPEND SOURCE_FILES ${SOURCE_FILES_C})
|
||||
if(APPLE)
|
||||
list (APPEND SOURCE_FILES ${SOURCE_FILES_M})
|
||||
endif()
|
||||
|
||||
foreach(HEADER_FILE ${HEADER_FILES})
|
||||
if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/src/${OCCT_PACKAGE}/${HEADER_FILE}")
|
||||
message (STATUS "Info: consider patched file: ${BUILD_PATCH}/src/${OCCT_PACKAGE}/${HEADER_FILE}")
|
||||
list (APPEND USED_INCFILES "${BUILD_PATCH}/src/${OCCT_PACKAGE}/${HEADER_FILE}")
|
||||
SOURCE_GROUP ("Header Files\\${OCCT_PACKAGE}" FILES "${BUILD_PATCH}/src/${OCCT_PACKAGE}/${HEADER_FILE}")
|
||||
else()
|
||||
list (APPEND USED_INCFILES "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/${HEADER_FILE}")
|
||||
SOURCE_GROUP ("Header Files\\${OCCT_PACKAGE}" FILES "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/${HEADER_FILE}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
foreach(SOURCE_FILE ${SOURCE_FILES})
|
||||
if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/src/${OCCT_PACKAGE}/${SOURCE_FILE}")
|
||||
message (STATUS "Info: consider patched file: ${BUILD_PATCH}/src/${OCCT_PACKAGE}/${SOURCE_FILE}")
|
||||
list (APPEND USED_SRCFILES "${BUILD_PATCH}/src/${OCCT_PACKAGE}/${SOURCE_FILE}")
|
||||
SOURCE_GROUP ("Source Files\\${OCCT_PACKAGE}" FILES "${BUILD_PATCH}/src/${OCCT_PACKAGE}/${SOURCE_FILE}")
|
||||
else()
|
||||
list (APPEND USED_SRCFILES "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/${SOURCE_FILE}")
|
||||
SOURCE_GROUP ("Source Files\\${OCCT_PACKAGE}" FILES "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/${SOURCE_FILE}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endforeach()
|
||||
string (REGEX REPLACE ";" " " PRECOMPILED_DEFS "${PRECOMPILED_DEFS}")
|
||||
|
||||
set (USED_RCFILE "")
|
||||
if (MSVC)
|
||||
set (USED_RCFILE "${CMAKE_BINARY_DIR}/resources/${PROJECT_NAME}.rc")
|
||||
|
||||
if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/adm/templates/occt_toolkit.rc.in")
|
||||
configure_file("${APPLY_OCCT_PATCH_DIR}/adm/templates/occt_toolkit.rc.in" "${USED_RCFILE}" @ONLY)
|
||||
else()
|
||||
configure_file("${CMAKE_SOURCE_DIR}/adm/templates/occt_toolkit.rc.in" "${USED_RCFILE}" @ONLY)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set (CURRENT_MODULE)
|
||||
foreach (OCCT_MODULE ${OCCT_MODULES})
|
||||
list (FIND ${OCCT_MODULE}_TOOLKITS ${PROJECT_NAME} CURRENT_PROJECT_IS_BUILT)
|
||||
if (NOT ${CURRENT_PROJECT_IS_BUILT} EQUAL -1)
|
||||
set (CURRENT_MODULE ${OCCT_MODULE})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if (NOT SINGLE_GENERATOR)
|
||||
OCCT_INSERT_CODE_FOR_TARGET ()
|
||||
endif()
|
||||
|
||||
if ("${PROJECT_NAME}" STREQUAL "DRAWEXE")
|
||||
add_executable (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE})
|
||||
|
||||
install (TARGETS ${PROJECT_NAME}
|
||||
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}")
|
||||
else()
|
||||
add_library (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE})
|
||||
# IfcOpenShell begin
|
||||
# if (MSVC)
|
||||
# install (FILES ${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bind/${PROJECT_NAME}.pdb
|
||||
# CONFIGURATIONS Debug
|
||||
# DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}")
|
||||
# endif()
|
||||
# IfcOpenShell end
|
||||
install (TARGETS ${PROJECT_NAME}
|
||||
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}")
|
||||
endif()
|
||||
|
||||
if (CURRENT_MODULE)
|
||||
set_target_properties (${PROJECT_NAME} PROPERTIES FOLDER "Modules/${CURRENT_MODULE}")
|
||||
set_target_properties (${PROJECT_NAME} PROPERTIES MODULE "${CURRENT_MODULE}")
|
||||
endif()
|
||||
|
||||
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)
|
||||
|
||||
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 (USED_TOOLKITS_BY_CURRENT_PROJECT)
|
||||
set (USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT)
|
||||
|
||||
# parce EXTERNLIB file
|
||||
FILE_TO_LIST ("src/${PROJECT_NAME}/EXTERNLIB" USED_EXTERNLIB_AND_TOOLKITS)
|
||||
foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
|
||||
string (REGEX MATCH "^ *#" COMMENT_FOUND ${USED_ITEM})
|
||||
if (NOT COMMENT_FOUND)
|
||||
string (REGEX MATCH "^TK" TK_FOUND ${USED_ITEM})
|
||||
string (REGEX MATCH "^vtk" VTK_FOUND ${USED_ITEM})
|
||||
|
||||
if (NOT "${TK_FOUND}" STREQUAL "" OR NOT "${VTK_FOUND}" STREQUAL "")
|
||||
list (APPEND USED_TOOLKITS_BY_CURRENT_PROJECT ${USED_ITEM})
|
||||
else()
|
||||
string (REGEX MATCH "^CSF_" CSF_FOUND ${USED_ITEM})
|
||||
if ("${CSF_FOUND}" STREQUAL "")
|
||||
message (STATUS "Info: ${USED_ITEM} from ${PROJECT_NAME} skipped due to it is empty")
|
||||
else() # get CSF_ value
|
||||
set (CURRENT_CSF ${${USED_ITEM}})
|
||||
if (NOT "${CURRENT_CSF}" STREQUAL "")
|
||||
# prepare a list from a string with whitespaces
|
||||
separate_arguments (CURRENT_CSF)
|
||||
list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT ${CURRENT_CSF})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if (APPLE)
|
||||
list (FIND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT X11 IS_X11_FOUND)
|
||||
if (NOT ${IS_X11_FOUND} EQUAL -1)
|
||||
find_package (X11 COMPONENTS X11 Xext Xmu Xi)
|
||||
if (NOT X11_FOUND)
|
||||
message (STATUS "Warning: X11 is not found. It's required to install The XQuartz project: http://www.xquartz.org")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_link_libraries (${PROJECT_NAME} ${USED_TOOLKITS_BY_CURRENT_PROJECT} ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT})
|
||||
+18
-7
@@ -5,14 +5,15 @@ and its dependencies.
|
||||
|
||||
As a general guideline, `.cmd` files are non-standalone batch files that need to be run from command prompt or from
|
||||
another batch file, and/or while the Visual Studio environment variables set, and `.bat` files are standalone batch
|
||||
files that can also be invoked e.g. by double-clicking in the File Explorer. `.sh` files are for MSYS2 + MinGW compilation.
|
||||
files that can also be invoked e.g. by double-clicking in the File Explorer. `.sh` files are for MSYS2 + MinGW ("MSYS"
|
||||
hereafter) compilation.
|
||||
|
||||
Usage Instructions
|
||||
------------------
|
||||
### MSYS2 + MinGW
|
||||
|
||||
Building using MSYS2 + MinGW is very similar to using the Visual Studio batch files, but instead the shell scripts
|
||||
are used. Note that the MSYS2 + MinGW support is currently a bit experimental. It is advised to check out the contents
|
||||
Building using MSYS is very similar to using the Visual Studio batch files, but instead the shell scripts
|
||||
are used. Note that the MSYS support is currently a bit experimental. It is advised to check out the contents
|
||||
of the shell scripts before using them. Note that contrary to Visual Studio, with MinGW all of the dependencies are not
|
||||
built or used as static libaries. Currently Release build is used for all libraries.
|
||||
|
||||
@@ -62,6 +63,16 @@ required IfcOpenShell-Python parts are deployed to the `<PYTHONHOME>\Lib\site-pa
|
||||
**Note:** Currently all of the dependencies are build as static libraries against the static run-time allowing the
|
||||
developer to effortlessly deploy standalone IFCOS executables.
|
||||
|
||||
Using the official Open CASCADE release instead of community edition
|
||||
---------------------------------------------
|
||||
Before building the dependencies, enable the OCCT usage:
|
||||
```
|
||||
> set IFCOS_USE_OCCT=TRUE
|
||||
> buid-deps.cmd
|
||||
```
|
||||
|
||||
Please note that this option is not yet available in the MSYS build scripts.
|
||||
|
||||
Using an already existing Python installation
|
||||
---------------------------------------------
|
||||
|
||||
@@ -93,16 +104,16 @@ Directory Structure
|
||||
\---win
|
||||
| build-all.cmd - Runs all of the build scripts for IFCOS and it dependencies in a row without pauses
|
||||
| build-deps.cmd - Fetches and builds all needed dependencies for IFCOS using Visual Studio
|
||||
| build-deps.sh - Fetches and builds all needed dependencies for IFCOS using MSYS2 + MinGW
|
||||
| build-deps.sh - Fetches and builds all needed dependencies for IFCOS using MSYS
|
||||
| BuildDepsCache-<ARCH>.txt - Cache file created by build-deps.cmd
|
||||
| build-ifcopenshell.bat - Builds IFCOS using Visual Studio
|
||||
| build-ifcopenshell.sh - Builds IFCOS using MSYS2 + MinGW
|
||||
| build-ifcopenshell.sh - Builds IFCOS using MSYS
|
||||
| build-type-cfg.cmd - Utility file used by the build scripts
|
||||
| install-ifcopenshell.bat - Installs/deployes IFCOS using Visual Studio.
|
||||
| install-ifcopenshell.sh - Installs/deployes IFCOS using MSYS2 + MinGW.
|
||||
| install-ifcopenshell.sh - Installs/deployes IFCOS using MSYS.
|
||||
| readme.md - This file
|
||||
| run-cmake.bat - Sets environment variables for the dependencies and runs CMake for IFCOS using Visual Studio
|
||||
| run-cmake.sh - Sets environment variables for the dependencies and runs CMake for IFCOS using MSYS2 + MinGW
|
||||
| run-cmake.sh - Sets environment variables for the dependencies and runs CMake for IFCOS using MSYS
|
||||
| set-python-to-path.bat - Utility for setting PYTHONHOME (read from BuildDepsCache-<ARCH>.txt) to PATH
|
||||
| vs-cfg.cmd - Utility file used by the build scripts
|
||||
\---patches - Contains patches for the dependencies
|
||||
|
||||
+2
-2
@@ -62,8 +62,8 @@ set BOOST_ROOT=%DEPS_DIR%\boost
|
||||
set BOOST_LIBRARYDIR=%DEPS_DIR%\boost\stage\vs%VS_VER%-%VS_PLATFORM%\lib
|
||||
set ICU_INCLUDE_DIR=%INSTALL_DIR%\icu\include
|
||||
set ICU_LIBRARY_DIR=%INSTALL_DIR%\icu\lib
|
||||
set OCC_INCLUDE_DIR=%INSTALL_DIR%\oce\include\oce
|
||||
set OCC_LIBRARY_DIR=%INSTALL_DIR%\oce\Win%ARCH_BITS%\lib
|
||||
if not defined OCC_INCLUDE_DIR set OCC_INCLUDE_DIR=%INSTALL_DIR%\oce\include\oce
|
||||
if not defined OCC_LIBRARY_DIR set OCC_LIBRARY_DIR=%INSTALL_DIR%\oce\Win%ARCH_BITS%\lib
|
||||
set OPENCOLLADA_INCLUDE_DIR=%INSTALL_DIR%\OpenCOLLADA\include\opencollada
|
||||
set OPENCOLLADA_LIBRARY_DIR=%INSTALL_DIR%\OpenCOLLADA\lib\opencollada
|
||||
if not defined PY_VER_MAJOR_MINOR set PY_VER_MAJOR_MINOR=34
|
||||
|
||||
Reference in New Issue
Block a user