0025114: CMake-based build tools for OCCT 7.0
authoribs <ibs@opencascade.com>
Thu, 2 Jul 2015 15:17:54 +0000 (18:17 +0300)
committerabv <abv@opencascade.com>
Sun, 12 Jul 2015 10:57:22 +0000 (13:57 +0300)
All CMake meta-projects for OCCT are put to OCCT code (including fragments previously generated by WOK).

"/bigobj" compiler flag added to TKQADraw because of the size of its object file

[GeomToStep & Graphic3d] private headers are included from current dir of including source file

159 files changed:
.gitignore
CMakeLists.txt
adm/MODULES [new file with mode: 0644]
adm/RESOURCES [new file with mode: 0644]
adm/cmake/3rdparty_macro.cmake [new file with mode: 0644]
adm/cmake/BuildToolkit.cmake [new file with mode: 0644]
adm/cmake/freeimage.cmake [new file with mode: 0644]
adm/cmake/freeimageplus.cmake [new file with mode: 0644]
adm/cmake/freetype.cmake [new file with mode: 0644]
adm/cmake/gl2ps.cmake [new file with mode: 0644]
adm/cmake/glx.cmake [new file with mode: 0644]
adm/cmake/occt_defs_flags.cmake [new file with mode: 0644]
adm/cmake/occt_gendoc.cmake [new file with mode: 0644]
adm/cmake/occt_macros.cmake [new file with mode: 0644]
adm/cmake/opencl.cmake [new file with mode: 0644]
adm/cmake/tbb.cmake [new file with mode: 0644]
adm/cmake/tcl.cmake [new file with mode: 0644]
adm/cmake/vtk.cmake [new file with mode: 0644]
adm/templates/3rdparty_macro.cmake [deleted file]
adm/templates/custom.bat.in
adm/templates/custom.sh.in
adm/templates/draw.bat
adm/templates/env.build.bat.in [new file with mode: 0644]
adm/templates/env.build.sh.in [new file with mode: 0644]
adm/templates/freeimage.cmake [deleted file]
adm/templates/freeimageplus.cmake [deleted file]
adm/templates/freetype.cmake [deleted file]
adm/templates/gl2ps.cmake [deleted file]
adm/templates/glx.cmake [deleted file]
adm/templates/occt_defs_flags.cmake [deleted file]
adm/templates/occt_macros.cmake [deleted file]
adm/templates/opencl.cmake [deleted file]
adm/templates/tbb.cmake [deleted file]
adm/templates/tcl.cmake [deleted file]
adm/templates/vtk.cmake [deleted file]
samples/mfc/standard/01_Geometry/CMakeLists.txt
samples/mfc/standard/02_Modeling/CMakeLists.txt
samples/mfc/standard/03_Viewer2d/CMakeLists.txt
samples/mfc/standard/04_Viewer3d/CMakeLists.txt
samples/mfc/standard/05_ImportExport/CMakeLists.txt
samples/mfc/standard/06_Ocaf/CMakeLists.txt
samples/mfc/standard/07_Triangulation/CMakeLists.txt
samples/mfc/standard/08_HLR/CMakeLists.txt
samples/mfc/standard/09_Animation/CMakeLists.txt
samples/mfc/standard/10_Convert/CMakeLists.txt
samples/mfc/standard/mfcsample/CMakeLists.txt
src/Aspect/EXTERNLIB [deleted file]
src/Aspect/FILES
src/BRepMesh/EXTERNLIB [deleted file]
src/BRepMesh/FILES
src/CDF/EXTERNLIB [deleted file]
src/CDF/FILES
src/Cocoa/EXTERNLIB [deleted file]
src/Cocoa/FILES
src/DDataStd/EXTERNLIB [deleted file]
src/DDataStd/FILES
src/DRAWEXE/CMakeLists.txt [new file with mode: 0644]
src/Draw/EXTERNLIB [deleted file]
src/Draw/FILES
src/FWOSPlugin/CMakeLists.txt [new file with mode: 0644]
src/Font/EXTERNLIB [deleted file]
src/Font/FILES
src/GeomToStep/GeomToStep_MakeAxis1Placement.cxx
src/GeomToStep/GeomToStep_MakeBSplineCurveWithKnots.cxx
src/GeomToStep/GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve.cxx
src/GeomToStep/GeomToStep_MakeCircle.cxx
src/GeomToStep/GeomToStep_MakeEllipse.cxx
src/GeomToStep/GeomToStep_MakeLine.cxx
src/GeomToStep/GeomToStep_MakePolyline.cxx
src/GeomToStep/GeomToStep_MakeVector.cxx
src/Graphic3d/Graphic3d_CStructure.cxx
src/Graphic3d/Graphic3d_Group.cxx
src/Graphic3d/Graphic3d_Structure.cxx
src/Graphic3d/Graphic3d_Structure.pxx
src/Graphic3d/Graphic3d_StructureManager.cxx
src/IVtkDraw/EXTERNLIB [deleted file]
src/IVtkDraw/FILES
src/IVtkTools/EXTERNLIB [deleted file]
src/IVtkTools/FILES
src/IVtkVTK/EXTERNLIB [deleted file]
src/IVtkVTK/FILES
src/Image/EXTERNLIB [deleted file]
src/Image/FILES
src/OSD/EXTERNLIB [deleted file]
src/OSD/FILES
src/OpenGl/EXTERNLIB [deleted file]
src/OpenGl/FILES
src/QABugs/EXTERNLIB [deleted file]
src/QABugs/FILES
src/QADraw/EXTERNLIB [deleted file]
src/QADraw/FILES
src/STEPConstruct/EXTERNLIB [deleted file]
src/STEPConstruct/FILES
src/Standard/EXTERNLIB [deleted file]
src/Standard/FILES
src/TKBO/CMakeLists.txt [new file with mode: 0644]
src/TKBRep/CMakeLists.txt [new file with mode: 0644]
src/TKBin/CMakeLists.txt [new file with mode: 0644]
src/TKBinL/CMakeLists.txt [new file with mode: 0644]
src/TKBinTObj/CMakeLists.txt [new file with mode: 0644]
src/TKBinXCAF/CMakeLists.txt [new file with mode: 0644]
src/TKBool/CMakeLists.txt [new file with mode: 0644]
src/TKCAF/CMakeLists.txt [new file with mode: 0644]
src/TKCDF/CMakeLists.txt [new file with mode: 0644]
src/TKDCAF/CMakeLists.txt [new file with mode: 0644]
src/TKDraw/CMakeLists.txt [new file with mode: 0644]
src/TKFeat/CMakeLists.txt [new file with mode: 0644]
src/TKFillet/CMakeLists.txt [new file with mode: 0644]
src/TKG2d/CMakeLists.txt [new file with mode: 0644]
src/TKG3d/CMakeLists.txt [new file with mode: 0644]
src/TKGeomAlgo/CMakeLists.txt [new file with mode: 0644]
src/TKGeomBase/CMakeLists.txt [new file with mode: 0644]
src/TKHLR/CMakeLists.txt [new file with mode: 0644]
src/TKIGES/CMakeLists.txt [new file with mode: 0644]
src/TKIVtk/CMakeLists.txt [new file with mode: 0644]
src/TKIVtkDraw/CMakeLists.txt [new file with mode: 0644]
src/TKLCAF/CMakeLists.txt [new file with mode: 0644]
src/TKMath/CMakeLists.txt [new file with mode: 0644]
src/TKMesh/CMakeLists.txt [new file with mode: 0644]
src/TKMeshVS/CMakeLists.txt [new file with mode: 0644]
src/TKOffset/CMakeLists.txt [new file with mode: 0644]
src/TKOpenGl/CMakeLists.txt [new file with mode: 0644]
src/TKPrim/CMakeLists.txt [new file with mode: 0644]
src/TKQADraw/CMakeLists.txt [new file with mode: 0644]
src/TKSTEP/CMakeLists.txt [new file with mode: 0644]
src/TKSTEP209/CMakeLists.txt [new file with mode: 0644]
src/TKSTEPAttr/CMakeLists.txt [new file with mode: 0644]
src/TKSTEPBase/CMakeLists.txt [new file with mode: 0644]
src/TKSTL/CMakeLists.txt [new file with mode: 0644]
src/TKService/CMakeLists.txt [new file with mode: 0644]
src/TKShHealing/CMakeLists.txt [new file with mode: 0644]
src/TKTObj/CMakeLists.txt [new file with mode: 0644]
src/TKTObjDRAW/CMakeLists.txt [new file with mode: 0644]
src/TKTopAlgo/CMakeLists.txt [new file with mode: 0644]
src/TKTopTest/CMakeLists.txt [new file with mode: 0644]
src/TKV3d/CMakeLists.txt [new file with mode: 0644]
src/TKVRML/CMakeLists.txt [new file with mode: 0644]
src/TKViewerTest/CMakeLists.txt [new file with mode: 0644]
src/TKVoxel/CMakeLists.txt [new file with mode: 0644]
src/TKXCAF/CMakeLists.txt [new file with mode: 0644]
src/TKXDEDRAW/CMakeLists.txt [new file with mode: 0644]
src/TKXDEIGES/CMakeLists.txt [new file with mode: 0644]
src/TKXDESTEP/CMakeLists.txt [new file with mode: 0644]
src/TKXMesh/CMakeLists.txt [new file with mode: 0644]
src/TKXSBase/CMakeLists.txt [new file with mode: 0644]
src/TKXSDRAW/CMakeLists.txt [new file with mode: 0644]
src/TKXml/CMakeLists.txt [new file with mode: 0644]
src/TKXmlL/CMakeLists.txt [new file with mode: 0644]
src/TKXmlTObj/CMakeLists.txt [new file with mode: 0644]
src/TKXmlXCAF/CMakeLists.txt [new file with mode: 0644]
src/TKernel/CMakeLists.txt [new file with mode: 0644]
src/V3d/EXTERNLIB [deleted file]
src/V3d/FILES
src/ViewerTest/EXTERNLIB [deleted file]
src/ViewerTest/FILES
src/Visual3d/EXTERNLIB [deleted file]
src/Visual3d/FILES
src/Xw/EXTERNLIB [deleted file]
src/Xw/FILES

index 022baf3..51b72b1 100644 (file)
@@ -28,7 +28,6 @@ Release
 /adm/lin
 /adm/mac
 /adm/make
-/adm/cmake
 *.vcproj*user
 *.csproj*user
 *.ncb
index 0a9ecf1..daf1252 100644 (file)
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 2.8.10 FATAL_ERROR)
+cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
 
 set (CMAKE_SUPPRESS_REGENERATION TRUE)
 
@@ -28,16 +28,48 @@ project (OCCT)
 # Solution folder property
 set_property (GLOBAL PROPERTY USE_FOLDERS ON)
 
+# Generate documentation
+# Overview and User Guides
+set (DOC_GENERATE_OVERVIEW OFF CACHE BOOL "Generate Overview and User Guides")
+if (NOT DOC_OVERVIEW_OUTPUT_FORMAT)
+  set (DOC_OVERVIEW_OUTPUT_FORMAT "html" CACHE STRING "Output format of Overview and User Guides" FORCE)
+  SET_PROPERTY (CACHE DOC_OVERVIEW_OUTPUT_FORMAT PROPERTY STRINGS html chm pdf)
+endif()
+# class Reference Manual
+set (DOC_GENERATE_REFMAN OFF CACHE BOOL "Generate class Reference Manual")
+
+# Tests
+set (TESTS_RUN OFF CACHE BOOL "Run tests or not")
+set (TESTS_INSTALL OFF CACHE BOOL "Copy tests to folder install")
+set (TESTS_SHAPES_DIR "" CACHE PATH "Directory that will contain shapes for tests" )
+
+# Find Bison and Flex executables to rebuild *.yacc and *.lex files if it is necessary (BUILD_BISON_FLEX_FILES is ON)
+set (BUILD_BISON_FLEX_FILES OFF CACHE BOOL "Build *.yacc/*.lex files")
+if (${BUILD_BISON_FLEX_FILES})
+  foreach (aTool BISON FLEX)
+    list (APPEND CMAKE_PROGRAM_PATH ${BUILD_BISON_FLEX_DIR})
+    find_package (${aTool})
+    if (NOT ${${aTool}_FOUND})
+      message ("Warning : set BUILD_BISON_FLEX_DIR directory")
+      set (BUILD_BISON_FLEX_DIR "" CACHE PATH "Filepath to BISON and FLEX executables")
+      set (BUILD_BISON_FLEX_FILES OFF)
+    endif()
+  endforeach()
+endif()
+
+# group include files in folder install
+set (INSTALL_GROUP_INC ON CACHE BOOL "In include files grouped in install folder")
+
+# copy samples to install directory
+set (INSTALL_SAMPLES OFF CACHE BOOL "Copy samples to install directory")
+
 set (CMAKE_BUILD_TYPE ${BUILD_CONFIGURATION} CACHE INTERNAL "Build type of OCCT" FORCE )
 
 # install dir of the built project
 set (INSTALL_DIR "" CACHE PATH "Directory that will contain install files of OCCT" )
 set (CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE )
 
-# whether install test bundle or not
-set (INSTALL_TESTS OFF CACHE BOOL "Is tests copy to install directory")
-
-set (BUILD_PATCH_DIR "" CACHE PATH "directory with OCCT patch")
+set (BUILD_PATCH_DIR "" CACHE PATH "directory with occt patch")
 
 # the list of being built toolkits
 set (BUILD_TOOLKITS "" CACHE STRING "Toolkits are also included in OCCT")
@@ -58,34 +90,68 @@ set (USE_VTK OFF CACHE BOOL "Is VTK used or not")
 if (NOT DEFINED ANDROID)
   set (USE_GL2PS OFF CACHE BOOL "Is gl2ps used or not")
   set (USE_TBB OFF CACHE BOOL "Is tbb used or not")
-  set (USE_OPENCL OFF CACHE BOOL "Is OpenCL used or not")
+  #set (USE_OPENCL OFF CACHE BOOL "Is OpenCL used or not")
 endif()
 
 # macro: include patched file if it exists
 macro (OCCT_INCLUDE_CMAKE_FILE BEING_INCLUDED_FILE)
   if (NOT "${BUILD_PATCH_DIR}" STREQUAL "" AND EXISTS "${BUILD_PATCH_DIR}/${BEING_INCLUDED_FILE}.cmake")
-    include(${BUILD_PATCH_DIR}/${BEING_INCLUDED_FILE}.cmake)
+    include (${BUILD_PATCH_DIR}/${BEING_INCLUDED_FILE}.cmake)
   else()
-    include(${BEING_INCLUDED_FILE}.cmake)
+    include (${BEING_INCLUDED_FILE}.cmake)
   endif()
 endmacro()
 
 # include occt macros
-OCCT_INCLUDE_CMAKE_FILE ("adm/templates/occt_macros")
+OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
 
 # BUILD_POSTFIX variable is used by all toolkit cmakelists.txt projects
 OCCT_MAKE_BUILD_POSTFIX()
 
 # include the patched or original list of modules
-OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_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)
 
-# include the list of being used toolkits. USED_TOOLKITS variable
-OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_toolkits")
+foreach (MODULE ${OCCT_MODULES})
+  set (BUILD_${MODULE} ON CACHE BOOL "include ${MODULE}")
+endforeach()
+
+if (NOT USE_VTK)
+  list (REMOVE_ITEM Visualization_TOOLKITS TKIVtk)
+  list (REMOVE_ITEM Draw_TOOLKITS TKIVtkDraw)
+endif()
+
+# accumulate used toolkits (first level) in USED_TOOLKITS variable
+list (APPEND USED_TOOLKITS ${BUILD_TOOLKITS})
+
+foreach (MODULE ${OCCT_MODULES})
+  if (BUILD_${MODULE})
+    list (APPEND USED_TOOLKITS ${${MODULE}_TOOLKITS})
+  endif()
+endforeach()
+
+# DRAWEXE excluded when library build is static
+if (NOT BUILD_SHARED_LIBS)
+  list (REMOVE_ITEM USED_TOOLKITS DRAWEXE)
+  message (STATUS "Info: DRAWEXE is not included due to ${BUILD_LIBRARY_TYPE} build library type")
+endif()
+
+# accumulate all used toolkits
+list (REMOVE_DUPLICATES USED_TOOLKITS)
+set (RAW_USED_TOOLKIT)
+foreach(USED_TOOLKIT ${USED_TOOLKITS})
+  OCCT_TOOLKIT_FULL_DEP (${USED_TOOLKIT} TOOLKIT_FULL_DEPS)
+  list (APPEND RAW_USED_TOOLKIT ${USED_TOOLKIT} ${TOOLKIT_FULL_DEPS})
+endforeach()
+
+list (REMOVE_DUPLICATES RAW_USED_TOOLKIT)
+set (USED_TOOLKITS ${RAW_USED_TOOLKIT})
 
 # include the patched or original list of definitions and flags
-OCCT_INCLUDE_CMAKE_FILE ("adm/templates/occt_defs_flags")
+OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_defs_flags")
 
-OCCT_INCLUDE_CMAKE_FILE ("adm/templates/3rdparty_macro")
+OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/3rdparty_macro")
 
 set (3RDPARTY_DIR_LABEL "The directory containing required 3rdparty products")
 if (NOT DEFINED 3RDPARTY_DIR)
@@ -108,7 +174,7 @@ OCCT_IS_PRODUCT_REQUIRED(CSF_TclLibs USE_TCL)
 
 if ("${USE_TCL}" STREQUAL ON)
   message (STATUS "Info: tcl is used by OCCT")
-  OCCT_INCLUDE_CMAKE_FILE ("adm/templates/tcl")
+  OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tcl")
 else()
   OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TCL")
   OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TK")
@@ -119,7 +185,7 @@ OCCT_IS_PRODUCT_REQUIRED(CSF_FREETYPE USE_FREETYPE)
 
 if ("${USE_FREETYPE}" STREQUAL ON)
   message (STATUS "Info: freetype is used by OCCT")
-  OCCT_INCLUDE_CMAKE_FILE ("adm/templates/freetype")
+  OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freetype")
 else()
   OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREETYPE")
   OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2")
@@ -129,20 +195,20 @@ endif()
 # VTK
 if (USE_VTK)
   add_definitions (-DHAVE_VTK)
-  OCCT_INCLUDE_CMAKE_FILE ("adm/templates/vtk")
+  OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/vtk")
 endif()
 
 # GLX
 if (USE_GLX)
   add_definitions (-DMACOSX_USE_GLX)
-  OCCT_INCLUDE_CMAKE_FILE ("adm/templates/glx")
+  OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/glx")
 endif()
 
 # FREEIMAGE
 if (USE_FREEIMAGE)
   add_definitions (-DHAVE_FREEIMAGE)
-  OCCT_INCLUDE_CMAKE_FILE ("adm/templates/freeimage")
-  OCCT_INCLUDE_CMAKE_FILE ("adm/templates/freeimageplus")
+  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")
@@ -153,27 +219,27 @@ endif()
 # GL2PS
 if (USE_GL2PS)
   add_definitions (-DHAVE_GL2PS)
-  OCCT_INCLUDE_CMAKE_FILE ("adm/templates/gl2ps")
+  OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gl2ps")
 else()
   OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GL2PS")
   OCCT_CHECK_AND_UNSET ("INSTALL_GL2PS")
 endif()
 
 # OPENCL
-if (USE_OPENCL)
-  add_definitions (-DHAVE_OPENCL)
-  OCCT_INCLUDE_CMAKE_FILE ("adm/templates/opencl")
-else()
-  OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_OPENCL")
-  OCCT_CHECK_AND_UNSET ("3RDPARTY_OPENCL_ADDITIONAL_PATH_FOR_HEADER")
-  OCCT_CHECK_AND_UNSET ("3RDPARTY_OPENCL_ADDITIONAL_PATH_FOR_LIB")
-  OCCT_CHECK_AND_UNSET ("INSTALL_OPENCL")
-endif()
+#if (USE_OPENCL)
+#  add_definitions (-DHAVE_OPENCL)
+#  OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/opencl")
+#else()
+#  OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_OPENCL")
+#  OCCT_CHECK_AND_UNSET ("3RDPARTY_OPENCL_ADDITIONAL_PATH_FOR_HEADER")
+#  OCCT_CHECK_AND_UNSET ("3RDPARTY_OPENCL_ADDITIONAL_PATH_FOR_LIB")
+#  OCCT_CHECK_AND_UNSET ("INSTALL_OPENCL")
+#endif()
 
 # TBB
 if (USE_TBB)
   add_definitions (-DHAVE_TBB)
-  OCCT_INCLUDE_CMAKE_FILE ("adm/templates/tbb")
+  OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tbb")
 else()
   OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB")
   OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBBMALLOC")
@@ -201,21 +267,43 @@ if (3RDPARTY_LIBRARY_DIRS)
   link_directories (${3RDPARTY_LIBRARY_DIRS})
 endif()
 
+# Get all used variables: OS_WITH_BIT, COMPILER, BUILD_POSTFIX
 OCCT_MAKE_BUILD_POSTFIX()
+OCCT_MAKE_OS_WITH_BITNESS()
+OCCT_MAKE_COMPILER_SHORT_NAME()
 
 # build directories
-set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out/lib${BUILD_POSTFIX})
-set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out/lib${BUILD_POSTFIX})
-set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out/bin${BUILD_POSTFIX})
+string (TOUPPER "${BUILD_CONFIGURATION}" TAIL_OF_OUTPUT_VARNAME)
+
+set (OUTPUT_LIBRARY_DIR ${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BUILD_POSTFIX})
+set (OUTPUT_BINARY_DIR ${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BUILD_POSTFIX})
+
+set ("CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${TAIL_OF_OUTPUT_VARNAME}" "${OUTPUT_LIBRARY_DIR}")
+set ("CMAKE_RUNTIME_OUTPUT_DIRECTORY_${TAIL_OF_OUTPUT_VARNAME}" "${OUTPUT_BINARY_DIR}")
+set ("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${TAIL_OF_OUTPUT_VARNAME}" "${OUTPUT_LIBRARY_DIR}")
+
+if (WIN32)
+  set ("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${TAIL_OF_OUTPUT_VARNAME}" "${OUTPUT_BINARY_DIR}")
+endif()
 
 if ("${INSTALL_DIR}" STREQUAL "")
   message (FATAL_ERROR "INSTALL_DIR variable is empty. It's required to define installation directory")
 else()
+
   # inc,data,tests DIRECTORY
-  install (DIRECTORY "${CMAKE_SOURCE_DIR}/inc"          DESTINATION  "${INSTALL_DIR}")
+  file (GLOB DIRS RELATIVE ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/*)
+  foreach(CDIR ${DIRS})
+    file(GLOB HFiles "${CMAKE_SOURCE_DIR}/src/${CDIR}/*.[hgl]xx" "${CMAKE_SOURCE_DIR}/src/${CDIR}/*.h")
+    set (GROUP_CDIR "")
+    if (INSTALL_GROUP_INC)
+      set (GROUP_CDIR ${CDIR})
+    endif()
+    install(FILES ${HFiles} DESTINATION "${INSTALL_DIR}/inc/${GROUP_CDIR}")
+  endforeach(CDIR)
+
   install (DIRECTORY "${CMAKE_SOURCE_DIR}/data"         DESTINATION  "${INSTALL_DIR}")
   install (DIRECTORY "${CMAKE_SOURCE_DIR}/samples/tcl"  DESTINATION  "${INSTALL_DIR}/samples")
-  if (INSTALL_TESTS)
+  if (TESTS_INSTALL)
     install (DIRECTORY "${CMAKE_SOURCE_DIR}/tests" DESTINATION  "${INSTALL_DIR}" )
   endif()
 
@@ -223,15 +311,25 @@ else()
   if (NOT "${BUILD_PATCH_DIR}" STREQUAL "")
     if (EXISTS "${BUILD_PATCH_DIR}/inc")
       install (DIRECTORY "${BUILD_PATCH_DIR}/inc" DESTINATION  "${INSTALL_DIR}" )
+    else()
+      file (GLOB DIRS RELATIVE ${BUILD_PATCH_DIR}/src ${BUILD_PATCH_DIR}/src/*)
+      foreach(CDIR ${DIRS})
+        file(GLOB HFiles "${BUILD_PATCH_DIR}/src/${CDIR}/*.[hgl]xx" "${BUILD_PATCH_DIR}/src/${CDIR}/*.h")
+        if (INSTALL_GROUP_INC)
+          install(FILES ${HFiles} DESTINATION "${INSTALL_DIR}/inc/${CDIR}")
+        else()
+          install(FILES ${HFiles} DESTINATION "${INSTALL_DIR}/inc")
+        endif()
+      endforeach(CDIR)
     endif()
 
     if (EXISTS "${BUILD_PATCH_DIR}/data")
       install (DIRECTORY "${BUILD_PATCH_DIR}/data"  DESTINATION  "${INSTALL_DIR}" )
     endif()
 
-    if (INSTALL_TESTS)
+    if (TESTS_INSTALL)
       if (EXISTS "${BUILD_PATCH_DIR}/tests")
-        install (DIRECTORY "${BUILD_PATCH_DIR}/tests" DESTINATION  "${INSTALL_DIR}" )
+        install (DIRECTORY "${BUILD_PATCH_DIR}/tests" DESTINATION "${INSTALL_DIR}" )
       endif()
     endif()
   endif()
@@ -242,29 +340,48 @@ else()
     set (SCRIPT_EXT sh)
   endif()
 
+  # Creation of "START_TESTS" project
+  if (TESTS_RUN AND TESTS_INSTALL)
+    #set(BUILD_TESTING ON)
+    #enable_testing ()
+    #add_test(NAME RUN_TESTS COMMAND ${INSTALL_DIR}/draw.${SCRIPT_EXT} -c testgrid -overwrite -outdir ${INSTALL_DIR}/TestResults)
+    add_custom_target(START_TESTS ${INSTALL_DIR}/draw.${SCRIPT_EXT} -c testgrid -overwrite -outdir ${INSTALL_DIR}/TestResults DEPENDS INSTALL)
+  endif()
+
+  # Creation of "GenerateDocumentation" project
+  if (DOC_GENERATE_OVERVIEW OR DOC_GENERATE_REFMAN)
+    OCCT_INCLUDE_CMAKE_FILE("adm/cmake/occt_gendoc")
+    if(DOC_GENERATE_OVERVIEW)
+      gendoc(-overview -${DOC_OVERVIEW_OUTPUT_FORMAT})
+    endif()
+    if(DOC_GENERATE_REFMAN)
+      gendoc(-refman -html)
+    endif()
+  endif()
+
+
   # DRAW.BAT or DRAW.SH
-  IF(NOT "${BUILD_PATCH_DIR}" STREQUAL "" AND EXISTS "${BUILD_PATCH_DIR}/adm/templates/draw.${SCRIPT_EXT}")
+  if (NOT "${BUILD_PATCH_DIR}" STREQUAL "" AND EXISTS "${BUILD_PATCH_DIR}/adm/templates/draw.${SCRIPT_EXT}")
     install(FILES "${BUILD_PATCH_DIR}/adm/templates/draw.${SCRIPT_EXT}" DESTINATION  "${INSTALL_DIR}" PERMISSIONS
             OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE)
-  ELSE()
+  else()
     install(FILES "${CMAKE_SOURCE_DIR}/adm/templates/draw.${SCRIPT_EXT}" DESTINATION  "${INSTALL_DIR}" PERMISSIONS
             OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE)
-  ENDIF()
-
-  # set compiler short name
-  OCCT_MAKE_COMPILER_SHORT_NAME()
-
-  OCCT_MAKE_COMPILER_BITNESS()
+  endif()
+  OCCT_COPY_FILE_OR_DIR ("adm/templates/draw.${SCRIPT_EXT}" "${CMAKE_BINARY_DIR}")
 
-  SET(SUB_CUSTOM "custom_${COMPILER}_${COMPILER_BITNESS}_${BUILD_POSTFIX}.${SCRIPT_EXT}")
+  set (SUB_CUSTOM "custom_${COMPILER}_${COMPILER_BITNESS}.${SCRIPT_EXT}")
+  if ("${BUILD_CONFIGURATION}" STREQUAL "Debug")
+    set (SUB_CUSTOM "custom_${COMPILER}_${COMPILER_BITNESS}_${BUILD_POSTFIX}.${SCRIPT_EXT}")
+  endif()
 
   if (WIN32)
-    SET (ADDITIONAL_CUSTOM_CONTENT "\nif exist \"%~dp0${SUB_CUSTOM}\" (\n  call \"%~dp0${SUB_CUSTOM}\" %1 %2 %3 \n)")
+    set (ADDITIONAL_CUSTOM_CONTENT "\nif exist \"%~dp0${SUB_CUSTOM}\" (\n  call \"%~dp0${SUB_CUSTOM}\" %1 %2 %3 \n)")
   else()
-    SET (ADDITIONAL_CUSTOM_CONTENT "\nif [ -e \"\${aScriptPath}/${SUB_CUSTOM}\" ]; then\n  source \"\${aScriptPath}/${SUB_CUSTOM}\" \"\${COMPILER}\" \"\${WOKSTATION}\${ARCH}\" \"\${CASDEB}\" \nfi")
+    set (ADDITIONAL_CUSTOM_CONTENT "\nif [ -e \"\${aScriptPath}/${SUB_CUSTOM}\" ]; then\n  source \"\${aScriptPath}/${SUB_CUSTOM}\" \"\${COMPILER}\" \"\${WOKSTATION}\${ARCH}\" \"\${CASDEB}\" \nfi")
   endif()
 
-  # change custom.bat/sh
+   # change custom.bat/sh
   if (EXISTS "${INSTALL_DIR}/custom.${SCRIPT_EXT}")
     file (READ "${INSTALL_DIR}/custom.${SCRIPT_EXT}" CUSTOM_CONTENT)
 
@@ -275,68 +392,49 @@ else()
     OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.${SCRIPT_EXT}.main" "custom.${SCRIPT_EXT}" "${INSTALL_DIR}")
   endif()
 
+
   # write current custom.bat/sh
   OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.${SCRIPT_EXT}.in" "${SUB_CUSTOM}" "${INSTALL_DIR}")
 
   if (BUILD_MFC_SAMPLES)
     OCCT_INSTALL_FILE_OR_DIR ("adm/templates/sample.bat" "${INSTALL_DIR}")
+    OCCT_COPY_FILE_OR_DIR ("adm/templates/sample.bat" "${CMAKE_BINARY_DIR}")
   endif()
 
-  OCCT_CONFIGURE_AND_INSTALL ("adm/templates/env.${SCRIPT_EXT}.in" "env.${SCRIPT_EXT}" "${INSTALL_DIR}")
+  OCCT_CONFIGURE ("adm/templates/env.build.${SCRIPT_EXT}.in" "env.${SCRIPT_EXT}")
+  OCCT_CONFIGURE ("adm/templates/env.${SCRIPT_EXT}.in" "env.install.${SCRIPT_EXT}")
+  install(FILES "${CMAKE_BINARY_DIR}/env.install.${SCRIPT_EXT}" DESTINATION  "${INSTALL_DIR}" RENAME "env.${SCRIPT_EXT}")
 endif()
 
 # RESOURCES
-OCCT_INSTALL_FILE_OR_DIR ("src/DrawResources"          "${INSTALL_DIR}/src")
-OCCT_INSTALL_FILE_OR_DIR ("src/StdResource"            "${INSTALL_DIR}/src")
-OCCT_INSTALL_FILE_OR_DIR ("src/SHMessage"              "${INSTALL_DIR}/src")
-OCCT_INSTALL_FILE_OR_DIR ("src/Textures"               "${INSTALL_DIR}/src")
-OCCT_INSTALL_FILE_OR_DIR ("src/Shaders"                "${INSTALL_DIR}/src")
-OCCT_INSTALL_FILE_OR_DIR ("src/XSMessage"              "${INSTALL_DIR}/src")
-OCCT_INSTALL_FILE_OR_DIR ("src/XSTEPResource"          "${INSTALL_DIR}/src")
-OCCT_INSTALL_FILE_OR_DIR ("src/XmlOcafResource"        "${INSTALL_DIR}/src")
-
-OCCT_INSTALL_FILE_OR_DIR ("src/UnitsAPI/Lexi_Expr.dat" "${INSTALL_DIR}/src/UnitsAPI")
-OCCT_INSTALL_FILE_OR_DIR ("src/UnitsAPI/Units.dat"     "${INSTALL_DIR}/src/UnitsAPI")
-OCCT_INSTALL_FILE_OR_DIR ("src/TObj/TObj.msg"          "${INSTALL_DIR}/src/TObj")
-
-
-#Toolkits uses variables: INSTALL_DIR, OS_WITH_BIT, COMPILER, BUILD_POSTFIX
-OCCT_MAKE_OS_WITH_BITNESS()
-
-# consider for patch existence
-set (IS_PATCH_CURRENT "NO")
-set (TK_ROOT_DIR ${CMAKE_SOURCE_DIR})
-if (NOT "${BUILD_PATCH_DIR}" STREQUAL "")
-  set (IS_PATCH_CURRENT "YES")
-  set (TK_ROOT_DIR ${BUILD_PATCH_DIR})
-endif()
+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}/src/${RESOURCE_FOLDER}")
+  else()
+    OCCT_INSTALL_FILE_OR_DIR ("src/${RESOURCE}" "${INSTALL_DIR}/src")
+  endif()
+endforeach()
 
 # include patched toolkit projects or original ones
-set (UNSUBDIRS "")
-if (NOT "${BUILD_PATCH_DIR}" STREQUAL "" AND EXISTS "${BUILD_PATCH_DIR}/adm/cmake/occt_inc_toolkits.cmake")
-  set (TK_ROOT_DIR ${BUILD_PATCH_DIR})
-  include (${BUILD_PATCH_DIR}/adm/cmake/occt_inc_toolkits.cmake)
-else()
-  set (IS_PATCH_CURRENT "NO")
-  set (TK_ROOT_DIR ${CMAKE_SOURCE_DIR})
-  include (adm/cmake/occt_inc_toolkits.cmake)
-endif()
-
-# include some required original occt_inc_toolkits
-if (NOT "${UNSUBDIRS}" STREQUAL "")
-  set (IS_PATCH_CURRENT "NO")
-  # add required subdirs
-  foreach (UNSUBDIR ${UNSUBDIRS})
-    add_subdirectory (${CMAKE_SOURCE_DIR}/${UNSUBDIR})
-  endforeach()
-endif()
+foreach (USED_TOOLKIT ${USED_TOOLKITS})
+  if (NOT "${BUILD_PATCH_DIR}" STREQUAL "" AND EXISTS "${BUILD_PATCH_DIR}/src/${USED_TOOLKIT}")
+    add_subdirectory(${BUILD_PATCH_DIR}/src/${USED_TOOLKIT})
+  elseif (EXISTS "${CMAKE_SOURCE_DIR}/src/${USED_TOOLKIT}")
+    add_subdirectory (${CMAKE_SOURCE_DIR}/src/${USED_TOOLKIT})
+  else()
+    message (STATUS "${USED_TOOLKIT} is not included")
+  endif()
+endforeach()
 
 # samples do not support patch usage
-IF (BUILD_MFC_SAMPLES)
-  SET (OCCT_ROOT ${CMAKE_SOURCE_DIR})
+if (BUILD_MFC_SAMPLES)
+  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)
+  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)
@@ -349,4 +447,8 @@ IF (BUILD_MFC_SAMPLES)
   add_subdirectory(samples/mfc/standard/08_HLR)
   add_subdirectory(samples/mfc/standard/09_Animation)
   add_subdirectory(samples/mfc/standard/10_Convert)
-ENDIF()
+endif()
+
+if (INSTALL_SAMPLES)
+  OCCT_INSTALL_FILE_OR_DIR ("samples" "${INSTALL_DIR}")
+endif()
diff --git a/adm/MODULES b/adm/MODULES
new file mode 100644 (file)
index 0000000..5666474
--- /dev/null
@@ -0,0 +1,7 @@
+FoundationClasses TKernel TKMath
+ModelingData TKG2d TKG3d TKGeomBase TKBRep
+ModelingAlgorithms TKGeomAlgo TKTopAlgo TKPrim TKBO TKBool TKHLR TKFillet TKOffset TKFeat TKMesh TKXMesh TKShHealing
+Visualization TKService TKV3d TKOpenGl TKMeshVS TKVoxel TKIVtk
+ApplicationFramework TKCDF TKLCAF TKCAF TKBinL TKXmlL TKBin TKXml FWOSPlugin TKTObj TKBinTObj TKXmlTObj
+DataExchange TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF
+Draw TKDraw TKTopTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE
\ No newline at end of file
diff --git a/adm/RESOURCES b/adm/RESOURCES
new file mode 100644 (file)
index 0000000..a16bc80
--- /dev/null
@@ -0,0 +1,11 @@
+DrawResources
+StdResource
+SHMessage
+Textures
+Shaders
+XSMessage
+XSTEPResource
+XmlOcafResource
+UnitsAPI/Lexi_Expr.dat
+UnitsAPI/Units.dat
+TObj/TObj.msg
\ No newline at end of file
diff --git a/adm/cmake/3rdparty_macro.cmake b/adm/cmake/3rdparty_macro.cmake
new file mode 100644 (file)
index 0000000..bd97520
--- /dev/null
@@ -0,0 +1,202 @@
+#
+
+# include occt macros. compiler_bitness, os_wiht_bit, compiler and build_postfix
+OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
+
+macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_NAME LIBRARY_NAME_DEBUG)
+
+  OCCT_MAKE_BUILD_POSTFIX()
+
+  # define 3RDPARTY_${PRODUCT_NAME}_DIR variable is it isn't defined
+  if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_DIR)
+    set (3RDPARTY_${PRODUCT_NAME}_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME}")
+  endif()
+
+  # search for product directory inside 3RDPARTY_DIR directory
+  if (NOT 3RDPARTY_${PRODUCT_NAME}_DIR AND 3RDPARTY_DIR)
+    FIND_PRODUCT_DIR ("${3RDPARTY_DIR}" "${PRODUCT_NAME}" ${PRODUCT_NAME}_DIR_NAME)
+    if (${PRODUCT_NAME}_DIR_NAME)
+      message (STATUS "Info: ${PRODUCT_NAME}: ${${PRODUCT_NAME}_DIR_NAME} folder is used")
+      set (3RDPARTY_${PRODUCT_NAME}_DIR "${3RDPARTY_DIR}/${${PRODUCT_NAME}_DIR_NAME}" CACHE PATH "The directory containing ${PRODUCT_NAME}" FORCE)
+    endif()
+  endif()
+
+  if (NOT DEFINED INSTALL_${PRODUCT_NAME})
+    set (INSTALL_${PRODUCT_NAME} OFF CACHE BOOL "Is ${PRODUCT_NAME} required to be copied into install directory")
+  endif()
+
+  # search for include directory
+  if (NOT 3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}")
+    set (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR "3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR-NOTFOUND" CACHE FILEPATH "The directory containing the headers of the ${PRODUCT_NAME}" FORCE)
+    find_path (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR ${HEADER_NAME} PATHS
+                                                                    "${3RDPARTY_${PRODUCT_NAME}_DIR}/include"
+                                                                    ${3RDPARTY_${PRODUCT_NAME}_ADDITIONAL_PATH_FOR_HEADER}
+                                                                   NO_DEFAULT_PATH)
+    find_path (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR ${HEADER_NAME})
+  endif()
+
+  if (NOT 3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}")
+    set (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR "" CACHE FILEPATH "The directory containing the headers of the ${PRODUCT_NAME}" FORCE)
+  endif()
+
+  if (NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR)
+    set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "" CACHE FILEPATH "${PRODUCT_NAME} library" FORCE)
+  elseif (3RDPARTY_${PRODUCT_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
+    get_filename_component(3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_TMP "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" PATH)
+    if (NOT "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}" STREQUAL "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_TMP}")
+      set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "" CACHE FILEPATH "${PRODUCT_NAME} library" FORCE)
+    endif()
+  endif()
+
+  # search for library
+  if (NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
+    set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "3RDPARTY_${PRODUCT_NAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "${PRODUCT_NAME} library" FORCE)
+
+    # first of all, search for debug version of a library if build type is debug
+    if (DEFINED IS_BUILD_DEBUG)
+      find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY ${LIBRARY_NAME_DEBUG}
+                                                     PATHS
+                                                      "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}"
+                                                      "${3RDPARTY_${PRODUCT_NAME}_DIR}/lib"
+                                                      "${3RDPARTY_${PRODUCT_NAME}_DIR}/libd"
+                                                      ${3RDPARTY_${PRODUCT_NAME}_ADDITIONAL_PATH_FOR_LIB}
+                                                     NO_DEFAULT_PATH)
+      # second search if previous one do not find anything
+      find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY ${LIBRARY_NAME_DEBUG})
+    endif()
+
+    # if build type is release or debug version of library isn't found - search for release version of one
+    if (NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
+      set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "3RDPARTY_${PRODUCT_NAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "${PRODUCT_NAME} library" FORCE)
+
+      if (DEFINED IS_BUILD_DEBUG)
+        message (STATUS "Warning: debug version of ${PRODUCT_NAME} library isn't found (${LIBRARY_NAME_DEBUG}) in ${3RDPARTY_${PRODUCT_NAME}_DIR}/lib(d). Search for release one")
+      endif()
+
+      find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY ${LIBRARY_NAME} PATHS
+                                                                      "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}"
+                                                                      "${3RDPARTY_${PRODUCT_NAME}_DIR}/lib"
+                                                                      ${3RDPARTY_${PRODUCT_NAME}_ADDITIONAL_PATH_FOR_LIB}
+                                                                     NO_DEFAULT_PATH)
+      # second search if previous one do not find anything
+      find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY ${LIBRARY_NAME})
+    endif()
+  endif()
+
+  if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR)
+    set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "" CACHE FILEPATH "The directory containing ${PRODUCT_NAME} library" FORCE)
+  endif()
+
+  # library path
+  if (3RDPARTY_${PRODUCT_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
+    get_filename_component (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" PATH)
+    set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}" CACHE FILEPATH "The directory containing ${PRODUCT_NAME} library" FORCE)
+  endif()
+
+  # search for shared library (just for win case)
+  if (WIN32)
+    set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
+
+    if (NOT 3RDPARTY_${PRODUCT_NAME}_DLL_DIR)
+      set (3RDPARTY_${PRODUCT_NAME}_DLL "" CACHE FILEPATH "${PRODUCT_NAME} shared library" FORCE)
+    elseif (3RDPARTY_${PRODUCT_NAME}_DLL AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
+      get_filename_component(3RDPARTY_${PRODUCT_NAME}_DLL_DIR_TMP "${3RDPARTY_${PRODUCT_NAME}_DLL}" PATH)
+      if (NOT "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}" STREQUAL "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR_TMP}")
+        set (3RDPARTY_${PRODUCT_NAME}_DLL "" CACHE FILEPATH "${PRODUCT_NAME} shared library" FORCE)
+      endif()
+    endif()
+
+    if (NOT 3RDPARTY_${PRODUCT_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
+      set (3RDPARTY_${PRODUCT_NAME}_DLL "3RDPARTY_${PRODUCT_NAME}_DLL-NOTFOUND" CACHE FILEPATH "${PRODUCT_NAME} shared library" FORCE)
+
+      if (DEFINED IS_BUILD_DEBUG)
+        find_library (3RDPARTY_${PRODUCT_NAME}_DLL "${LIBRARY_NAME_DEBUG}"
+                                                   PATHS
+                                                    "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}"
+                                                    "${3RDPARTY_${PRODUCT_NAME}_DIR}/bin"
+                                                    "${3RDPARTY_${PRODUCT_NAME}_DIR}/bind"
+                                                    ${3RDPARTY_${PRODUCT_NAME}_ADDITIONAL_PATH_FOR_DLL}
+                                                   NO_DEFAULT_PATH)
+
+        # second search if previous one do not find anything
+        find_library (3RDPARTY_${PRODUCT_NAME}_DLL "${LIBRARY_NAME_DEBUG}")
+      endif()
+
+      if (NOT 3RDPARTY_${PRODUCT_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
+        set (3RDPARTY_${PRODUCT_NAME}_DLL "3RDPARTY_${PRODUCT_NAME}_DLL-NOTFOUND" CACHE FILEPATH "${PRODUCT_NAME} shared library" FORCE)
+
+        if (DEFINED IS_BUILD_DEBUG)
+          message (STATUS "Warning: debug version of ${PRODUCT_NAME} dll isn't found (${LIBRARY_NAME_DEBUG}) in ${3RDPARTY_${PRODUCT_NAME}_DIR}/bin(d). Search for release one")
+        endif()
+
+        find_library (3RDPARTY_${PRODUCT_NAME}_DLL "${LIBRARY_NAME}" PATHS
+                                                                      "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}"
+                                                                      "${3RDPARTY_${PRODUCT_NAME}_DIR}/bin"
+                                                                      ${3RDPARTY_${PRODUCT_NAME}_ADDITIONAL_PATH_FOR_DLL}
+                                                                     NO_DEFAULT_PATH)
+
+        # second search if previous one do not find anything
+        find_library (3RDPARTY_${PRODUCT_NAME}_DLL "${LIBRARY_NAME}")
+      endif()
+    endif()
+
+    if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_DLL_DIR)
+      set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "" CACHE FILEPATH "The directory containing ${PRODUCT_NAME} shared library" FORCE)
+    endif()
+
+    # shared library path
+    if (3RDPARTY_${PRODUCT_NAME}_DLL AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
+      get_filename_component (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL}" PATH)
+      set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}" CACHE FILEPATH "The directory containing ${PRODUCT_NAME} shared library" FORCE)
+    endif()
+  endif()
+
+  if (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}")
+    list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}")
+  else()
+    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR)
+  endif()
+
+  if (3RDPARTY_${PRODUCT_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
+    list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
+  else()
+    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR)
+  endif()
+
+  if (WIN32)
+    if (NOT 3RDPARTY_${PRODUCT_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
+      list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_DLL_DIR)
+    endif()
+  endif()
+
+  set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "")
+
+  if (INSTALL_${PRODUCT_NAME})
+    OCCT_MAKE_OS_WITH_BITNESS()
+    OCCT_MAKE_COMPILER_SHORT_NAME()
+    OCCT_MAKE_BUILD_POSTFIX()
+
+    if (WIN32)
+      install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}"     DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BUILD_POSTFIX}")
+    else()
+      get_filename_component(ABS_PATH ${3RDPARTY_${PRODUCT_NAME}_LIBRARY} REALPATH)
+      if ("${PRODUCT_NAME}" STREQUAL "FREEIMAGE")
+        get_filename_component(FREEIMLIB ${3RDPARTY_${PRODUCT_NAME}_LIBRARY} NAME)
+        install (FILES "${ABS_PATH}" DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BUILD_POSTFIX}" RENAME ${FREEIMLIB}.3)
+      endif()
+      if("${PRODUCT_NAME}" STREQUAL "GL2PS")
+        get_filename_component(GL2PSLIB ${3RDPARTY_${PRODUCT_NAME}_LIBRARY} NAME)
+        install (FILES "${ABS_PATH}" DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BUILD_POSTFIX}" RENAME ${GL2PSLIB}.1)
+      endif()
+    endif()
+  else()
+    # the library directory for using by the executable
+    if (WIN32)
+      set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
+    else()
+      set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
+    endif()
+  endif()
+
+  mark_as_advanced (3RDPARTY_${PRODUCT_NAME}_LIBRARY 3RDPARTY_${PRODUCT_NAME}_DLL)
+endmacro()
diff --git a/adm/cmake/BuildToolkit.cmake b/adm/cmake/BuildToolkit.cmake
new file mode 100644 (file)
index 0000000..eb85d47
--- /dev/null
@@ -0,0 +1,96 @@
+# Get all used packages from toolkit
+foreach (MODULE ${TOOLKIT_MODULES})
+  if (WIN32)
+    list (APPEND PRECOMPILED_DEFS "-D__${MODULE}_DLL")
+  endif()
+  list (APPEND COMPILER_DIRECTORIES "${OCCT_SOURCE_DIR}/src/${MODULE}")
+endforeach()
+string (REGEX REPLACE ";" " " PRECOMPILED_DEFS "${PRECOMPILED_DEFS}")
+
+# Get from toolkits EXTERNLIB all used libs
+OCCT_TOOLKIT_DEP (${PROJECT_NAME} ${PROJECT_NAME}_DEPS)
+foreach (DEP ${${PROJECT_NAME}_DEPS})
+  IS_OCCT_TOOLKIT (${DEP} OCCT_MODULES FOUND_TOOLKIT)
+  if ("${FOUND_TOOLKIT}" STREQUAL "ON")
+    list ( APPEND USED_LIBS "${DEP}" )
+  endif()
+endforeach()
+
+# Get all source files from used packages
+foreach (CDIR ${COMPILER_DIRECTORIES})
+  get_filename_component (CDirName ${CDIR} NAME)
+  set (CDIR_files)
+  file (STRINGS "${CDIR}/FILES" FLEX_Files REGEX ".+[.]lex")
+  file (STRINGS "${CDIR}/FILES" BISON_Files REGEX ".+[.]yacc")
+  file (STRINGS "${CDIR}/FILES" CFiles REGEX ".+[.]c")
+  file (STRINGS "${CDIR}/FILES" MFiles REGEX ".+[.]mm")
+
+  # Generate Flex and Bison files
+  if (${BUILD_BISON_FLEX_FILES})
+    list (LENGTH FLEX_Files FLength)
+    list (LENGTH BISON_Files BLength)
+    list (SORT FLEX_Files)
+    list (SORT BISON_Files)
+    if (${FLength} EQUAL ${BLength} AND NOT ${FLength} EQUAL 0)
+      math (EXPR FLength "${FLength} - 1")
+      foreach (FileIndex RANGE ${FLength})
+        list (GET FLEX_Files ${FileIndex} FLEX_File)
+        list (GET BISON_Files ${FileIndex} BISON_File)
+        get_filename_component (FLEX_Name ${FLEX_File} NAME_WE)
+        get_filename_component (BISON_Name ${BISON_File} NAME_WE)
+        string (COMPARE EQUAL ${FLEX_Name} ${BISON_Name} isEQUAL)
+        if (EXISTS "${FLEX_File}" AND EXISTS "${BISON_File}" AND ${isEQUAL})
+          BISON_TARGET (Parser_${BISON_Name} ${BISON_File} ${CDIR}/${BISON_Name}.tab.c)
+          FLEX_TARGET (Scanner_${FLEX_Name} ${FLEX_File} ${CDIR}/lex.${FLEX_Name}.c)
+          ADD_FLEX_BISON_DEPENDENCY (Scanner_${FLEX_Name} Parser_${BISON_Name})
+          list (APPEND CDIR_files ${BISON_Parser_${BISON_Name}_OUTPUTS} ${FLEX_Scanner_${FLEX_Name}_OUTPUTS})
+        endif()
+      endforeach()
+    endif()
+  endif()
+
+  list (APPEND CDIR_files ${CFiles})
+  if (APPLE)
+    list ( APPEND CDIR_files ${MFiles})
+  endif()
+
+  foreach (CFile ${CDIR_files})
+    list (APPEND USED_SRCFILES ${CDIR}/${CFile} )
+    SOURCE_GROUP (${CDirName} FILES ${CDIR}/${CFile})
+  endforeach()
+endforeach()
+
+list (APPEND COMPILER_DIRECTORIES "${OCCT_SOURCE_DIR}/src")
+list (FIND USED_TOOLKITS ${PROJECT_NAME} isFOUND)
+
+OCCT_MAKE_BUILD_POSTFIX()
+
+# Create project for toolkit
+if ("${USED_TOOLKITS}" STREQUAL "" OR NOT ${isFOUND} EQUAL -1)
+  foreach (MODULE ${OCCT_MODULES})
+    list (FIND ${MODULE}_TOOLKITS ${PROJECT_NAME} isFOUND)
+    if (NOT ${isFOUND} EQUAL -1)
+      set (CURRENT_MODULE ${MODULE})
+    endif()
+  endforeach()
+  if (isEXE)
+    add_executable (${PROJECT_NAME} ${USED_SRCFILES})
+    install (TARGETS ${PROJECT_NAME} DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BUILD_POSTFIX}")
+  else()
+    add_library (${PROJECT_NAME} ${USED_SRCFILES})
+    install (TARGETS ${PROJECT_NAME}
+             RUNTIME DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BUILD_POSTFIX}"
+             ARCHIVE DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BUILD_POSTFIX}"
+             LIBRARY DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BUILD_POSTFIX}")
+    if (MSVC)
+      install (FILES  ${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BUILD_POSTFIX}/${PROJECT_NAME}.pdb
+               CONFIGURATIONS Debug
+               DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BUILD_POSTFIX}")
+    endif()
+  endif()
+
+  set_property (TARGET ${PROJECT_NAME} PROPERTY FOLDER "Modules/${CURRENT_MODULE}")
+  set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}")
+  include_directories (${COMPILER_DIRECTORIES})
+  target_link_libraries (${PROJECT_NAME} ${USED_LIBS})
+endif()
\ No newline at end of file
diff --git a/adm/cmake/freeimage.cmake b/adm/cmake/freeimage.cmake
new file mode 100644 (file)
index 0000000..b1cbf34
--- /dev/null
@@ -0,0 +1,3 @@
+#freeimage
+
+THIRDPARTY_PRODUCT("FREEIMAGE" "FreeImage.h" "freeimage" "freeimaged")
\ No newline at end of file
diff --git a/adm/cmake/freeimageplus.cmake b/adm/cmake/freeimageplus.cmake
new file mode 100644 (file)
index 0000000..3afd905
--- /dev/null
@@ -0,0 +1,9 @@
+#freeimageplus
+
+if (WIN32)
+  if (3RDPARTY_FREEIMAGE_DIR AND NOT 3RDPARTY_FREEIMAGEPLUS_DIR)
+    set (3RDPARTY_FREEIMAGEPLUS_DIR "${3RDPARTY_FREEIMAGE_DIR}" CACHE PATH "The directory containing freeimageplus" FORCE)
+  endif()
+
+  THIRDPARTY_PRODUCT("FREEIMAGEPLUS" "FreeImagePlus.h" "freeimageplus" "freeimageplusd")
+endif()
\ No newline at end of file
diff --git a/adm/cmake/freetype.cmake b/adm/cmake/freetype.cmake
new file mode 100644 (file)
index 0000000..4d98077
--- /dev/null
@@ -0,0 +1,235 @@
+# freetype
+
+if (NOT DEFINED INSTALL_FREETYPE)
+  set (INSTALL_FREETYPE OFF CACHE BOOL "Is freetype required to be copied into install directory")
+endif()
+
+if (NOT DEFINED 3RDPARTY_FREETYPE_DIR)
+  set (3RDPARTY_FREETYPE_DIR "" CACHE PATH "The directory containing freetype")
+endif()
+
+# store ENV{FREETYPE_DIR}
+SET (CACHED_FREETYPE_DIR $ENV{FREETYPE_DIR})
+
+# include occt macros. compiler_bitness, os_wiht_bit, compiler and build_postfix
+OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
+
+OCCT_MAKE_COMPILER_SHORT_NAME()
+OCCT_MAKE_COMPILER_BITNESS()
+
+if (NOT ENV{FREETYPE_DIR})
+  # search for freetype in user defined directory
+  if (NOT 3RDPARTY_FREETYPE_DIR AND 3RDPARTY_DIR)
+    FIND_PRODUCT_DIR("${3RDPARTY_DIR}" FREETYPE FREETYPE_DIR_NAME)
+    if (FREETYPE_DIR_NAME)
+      set (3RDPARTY_FREETYPE_DIR "${3RDPARTY_DIR}/${FREETYPE_DIR_NAME}" CACHE PATH "The directory containing freetype" FORCE)
+    endif()
+  endif()
+
+  if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
+    set (ENV{FREETYPE_DIR} "${3RDPARTY_FREETYPE_DIR}")
+  endif()
+endif()
+
+if (NOT DEFINED 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build)
+  set (3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build  "" CACHE FILEPATH "the path of ft2build.h")
+endif()
+
+if (NOT DEFINED 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2)
+  set (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 "" CACHE FILEPATH "the path of freetype2")
+endif()
+
+if (NOT DEFINED 3RDPARTY_FREETYPE_LIBRARY OR NOT 3RDPARTY_FREETYPE_LIBRARY_DIR)
+  set (3RDPARTY_FREETYPE_LIBRARY               "" CACHE FILEPATH "freetype library")
+endif()
+
+if (NOT DEFINED 3RDPARTY_FREETYPE_LIBRARY_DIR)
+  set (3RDPARTY_FREETYPE_LIBRARY_DIR           "" CACHE FILEPATH "The directory containing freetype library")
+endif()
+
+if (WIN32)
+  if (NOT DEFINED 3RDPARTY_FREETYPE_DLL OR NOT 3RDPARTY_FREETYPE_DLL_DIR)
+    set (3RDPARTY_FREETYPE_DLL                   "" CACHE FILEPATH "freetype shared library")
+  endif()
+endif()
+
+if (WIN32)
+  if (NOT DEFINED 3RDPARTY_FREETYPE_DLL_DIR)
+    set (3RDPARTY_FREETYPE_DLL_DIR               "" CACHE FILEPATH "The directory containing freetype shared library")
+  endif()
+endif()
+
+find_package(Freetype)
+
+# ft2build header
+if (FREETYPE_INCLUDE_DIR_ft2build AND EXISTS "${FREETYPE_INCLUDE_DIR_ft2build}")
+  if (NOT 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build)
+    set (3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build  "${FREETYPE_INCLUDE_DIR_ft2build}" CACHE FILEPATH "the path of ft2build.h" FORCE)
+  endif()
+endif()
+
+if (NOT FREETYPE_INCLUDE_DIR_freetype2 OR NOT EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}")
+  # cmake (version is < 3.0) doesn't find ftheader.h of freetype (version is >= 2.5.1)
+  # do search taking into account freetype structure of 2.5.1 version
+  find_path (FREETYPE_INCLUDE_DIR_freetype2 NAMES
+                                             freetype/config/ftheader.h
+                                             config/ftheader.h
+                                           HINTS
+                                             ENV FREETYPE_DIR
+                                           PATHS
+                                             /usr/X11R6
+                                             /usr/local/X11R6
+                                             /usr/local/X11
+                                             /usr/freeware
+                                           PATH_SUFFIXES include/freetype2 include freetype2
+                                           NO_DEFAULT_PATH)
+  find_path (FREETYPE_INCLUDE_DIR_freetype2 NAMES freetype/config/ftheader.h config/ftheader.h)
+elseif (FREETYPE_INCLUDE_DIR_freetype2 OR EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}")
+  if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
+    get_filename_component (3RDPARTY_FREETYPE_DIR_ABS "${3RDPARTY_FREETYPE_DIR}" ABSOLUTE)
+    get_filename_component (FREETYPE_INCLUDE_DIR_freetype2_ABS "${FREETYPE_INCLUDE_DIR_freetype2}" ABSOLUTE)
+
+    string (REGEX MATCH "${3RDPARTY_FREETYPE_DIR_ABS}" DOES_PATH_CONTAIN "${FREETYPE_INCLUDE_DIR_freetype2_ABS}")
+
+    if (NOT DOES_PATH_CONTAIN) # if cmake found freetype2 at different place from 3RDPARTY_FREETYPE_DIR
+      # search for freetype2 in 3RDPARTY_FREETYPE_DIR and if it will be found - replace freetyp2 path by new one
+      set (TMP_FREETYPE2 "TMP_FREETYPE2-NOTFOUND" CACHE FILEPATH "" FORCE)
+      find_path (TMP_FREETYPE2 NAMES freetype/config/ftheader.h config/ftheader.h
+                               PATHS "${3RDPARTY_FREETYPE_DIR}"
+                               PATH_SUFFIXES include/freetype2 include freetype2
+                               NO_DEFAULT_PATH)
+
+      if (TMP_FREETYPE2 OR NOT EXISTS "${TMP_FREETYPE2}")
+        set (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 "${TMP_FREETYPE2}" CACHE FILEPATH "the path of freetype2" FORCE)
+
+        # hide and remove TMP_FREETYPE2
+        mark_as_advanced (TMP_FREETYPE2)
+        unset (TMP_FREETYPE2)
+      endif()
+    endif()
+  endif()
+endif()
+
+# return ENV{FREETYPE_DIR}
+SET (ENV{FREETYPE_DIR} ${CACHED_FREETYPE_DIR})
+
+# freetype2 header
+if (FREETYPE_INCLUDE_DIR_freetype2 AND EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}")
+  if (NOT 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2)
+    set (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 "${FREETYPE_INCLUDE_DIR_freetype2}" CACHE FILEPATH "the path of freetype2" FORCE)
+  endif()
+endif()
+
+if (NOT 3RDPARTY_FREETYPE_LIBRARY_DIR)
+  set (3RDPARTY_FREETYPE_LIBRARY "" CACHE FILEPATH "freetype library" FORCE)
+elseif (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
+  get_filename_component(3RDPARTY_FREETYPE_LIBRARY_DIR_TMP "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
+  if (NOT "${3RDPARTY_FREETYPE_LIBRARY_DIR}" STREQUAL "${3RDPARTY_FREETYPE_LIBRARY_DIR_TMP}")
+    set (3RDPARTY_FREETYPE_LIBRARY "" CACHE FILEPATH "freetype library" FORCE)
+  endif()
+endif()
+
+if (WIN32)
+  if (NOT 3RDPARTY_FREETYPE_DLL_DIR)
+    set (3RDPARTY_FREETYPE_DLL "" CACHE FILEPATH "freetype shared library" FORCE)
+  elseif (3RDPARTY_FREETYPE_DLL AND EXISTS "${3RDPARTY_FREETYPE_DLL}")
+    get_filename_component(3RDPARTY_FREETYPE_DLL_DIR_TMP "${3RDPARTY_FREETYPE_DLL}" PATH)
+    if (NOT "${3RDPARTY_FREETYPE_DLL_DIR}" STREQUAL "${3RDPARTY_FREETYPE_DLL_DIR_TMP}")
+      set (3RDPARTY_FREETYPE_DLL "" CACHE FILEPATH "freetype shared library" FORCE)
+    endif()
+  endif()
+endif()
+
+# freetype library
+if (FREETYPE_LIBRARY AND EXISTS "${FREETYPE_LIBRARY}")
+  if (NOT 3RDPARTY_FREETYPE_LIBRARY)
+    set (3RDPARTY_FREETYPE_LIBRARY "${FREETYPE_LIBRARY}" CACHE FILEPATH "freetype library" FORCE)
+  endif()
+
+  if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
+    get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
+    set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE FILEPATH "The directory containing freetype library" FORCE)
+  endif()
+
+  if (WIN32)
+    set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
+
+    if (NOT 3RDPARTY_FREETYPE_DLL OR NOT EXISTS "${3RDPARTY_FREETYPE_DLL}")
+      get_filename_component (FREETYPE_LIBRARY_PARENT_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" PATH) # parent of the library directory
+
+      set (3RDPARTY_FREETYPE_DLL "3RDPARTY_FREETYPE_DLL-NOTFOUND" CACHE FILEPATH "freetype shared library" FORCE)
+      find_library (3RDPARTY_FREETYPE_DLL freetype PATHS "${FREETYPE_LIBRARY_PARENT_DIR}/bin" NO_DEFAULT_PATH)
+    endif()
+
+    if (3RDPARTY_FREETYPE_DLL AND EXISTS "${3RDPARTY_FREETYPE_DLL}")
+      get_filename_component (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL}" PATH)
+      set (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL_DIR}" CACHE FILEPATH "The directory containing freetype shared library" FORCE)
+    endif()
+  endif()
+endif()
+
+
+if (NOT 3RDPARTY_FREETYPE_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
+  set (3RDPARTY_FREETYPE_LIBRARY_DIR "" CACHE FILEPATH "The directory containing freetype library" FORCE)
+endif()
+
+if (WIN32)
+  if (NOT 3RDPARTY_FREETYPE_DLL_DIR OR NOT EXISTS "${3RDPARTY_FREETYPE_DLL_DIR}")
+    set (3RDPARTY_FREETYPE_DLL_DIR "" CACHE FILEPATH "The directory containing shared freetype library" FORCE)
+  endif()
+endif()
+
+# include found paths to common variables
+if (3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build)
+  list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build}")
+else()
+  list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build)
+endif()
+
+if (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2)
+  list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2}")
+else()
+  list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2)
+endif()
+
+if (3RDPARTY_FREETYPE_LIBRARY)
+  list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
+else()
+  list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_LIBRARY_DIR)
+endif()
+
+if (WIN32)
+  if (NOT 3RDPARTY_FREETYPE_DLL OR NOT EXISTS "${3RDPARTY_FREETYPE_DLL}")
+    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_DLL_DIR)
+  endif()
+endif()
+
+if (INSTALL_FREETYPE)
+
+  OCCT_MAKE_OS_WITH_BITNESS()
+  OCCT_MAKE_BUILD_POSTFIX()
+
+  if (WIN32)
+    install (FILES "${3RDPARTY_FREETYPE_DLL}"     DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BUILD_POSTFIX}")
+  else()
+    get_filename_component(ABS_PATH ${3RDPARTY_FREETYPE_LIBRARY} REALPATH)
+    get_filename_component(FREETYPELIB ${3RDPARTY_FREETYPE_LIBRARY} NAME)
+    install (FILES "${ABS_PATH}" DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BUILD_POSTFIX}" RENAME ${FREETYPELIB}.6)
+  endif()
+
+  set (USED_3RDPARTY_FREETYPE_DIR "")
+else()
+  # the library directory for using by the executable
+  if (WIN32)
+    set (USED_3RDPARTY_FREETYPE_DIR ${3RDPARTY_FREETYPE_DLL_DIR})
+  else()
+    set (USED_3RDPARTY_FREETYPE_DIR ${3RDPARTY_FREETYPE_LIBRARY_DIR})
+  endif()
+endif()
+
+# unset all redundant variables
+OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_ft2build)
+OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_freetype2)
+OCCT_CHECK_AND_UNSET(FREETYPE_LIBRARY)
+
+mark_as_advanced (3RDPARTY_FREETYPE_LIBRARY 3RDPARTY_FREETYPE_DLL)
\ No newline at end of file
diff --git a/adm/cmake/gl2ps.cmake b/adm/cmake/gl2ps.cmake
new file mode 100644 (file)
index 0000000..d9d59ec
--- /dev/null
@@ -0,0 +1,3 @@
+#GL2PS
+
+THIRDPARTY_PRODUCT("GL2PS" "gl2ps.h" "gl2ps" "gl2psd")
\ No newline at end of file
diff --git a/adm/cmake/glx.cmake b/adm/cmake/glx.cmake
new file mode 100644 (file)
index 0000000..2965557
--- /dev/null
@@ -0,0 +1,3 @@
+# glx
+
+THIRDPARTY_PRODUCT("GLX" "GL/glx.h" "GL" "GLd")
\ No newline at end of file
diff --git a/adm/cmake/occt_defs_flags.cmake b/adm/cmake/occt_defs_flags.cmake
new file mode 100644 (file)
index 0000000..a857f9f
--- /dev/null
@@ -0,0 +1,70 @@
+
+if (MSVC)
+  add_definitions(/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)
+    add_definitions(/arch:SSE2)
+  endif()
+endif()
+
+add_definitions (-DCSFDB)
+if (WIN32)
+  add_definitions (/DWNT -wd4996)
+elseif (APPLE)
+  add_definitions (-fexceptions -fPIC -DOCC_CONVERT_SIGNALS -DHAVE_WOK_CONFIG_H -DHAVE_CONFIG_H)
+else()
+  add_definitions (-fexceptions -fPIC -DOCC_CONVERT_SIGNALS -DHAVE_WOK_CONFIG_H -DHAVE_CONFIG_H -DLIN)
+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 (WIN32)
+  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -EHa")
+endif()
+
+# remove DEBUG flag if it exists
+string (REGEX MATCH "-DDEBUG" IS_DEBUG_CXX "${CMAKE_CXX_FLAGS_DEBUG}")
+if (IS_DEBUG_CXX)
+  message (STATUS "-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 "-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, -Wall 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)
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
+endif()
+
+if (DEFINED CMAKE_COMPILER_IS_GNUCXX OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang")
+  set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
+endif()
+
+set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNo_Exception")
+set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNo_Exception")
+
+set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEB")
+set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEB")
\ No newline at end of file
diff --git a/adm/cmake/occt_gendoc.cmake b/adm/cmake/occt_gendoc.cmake
new file mode 100644 (file)
index 0000000..21dd3ca
--- /dev/null
@@ -0,0 +1,1325 @@
+# ==========================================================================#
+# Brief:  This script compiles OCCT documents from *.md files to HTML pages #
+# ==========================================================================#
+
+# ======================================
+#  Common functions
+# ======================================
+
+# Print single line or print the line to the file
+function(puts theLine)
+  if(${ARGC} EQUAL 1)
+    message(STATUS "${theLine}")
+  elseif(${ARGC} EQUAL 2)
+    file(APPEND ${ARGV0} "${ARGV1}\n")
+  endif()
+endfunction()
+
+# Print CMake Error, stop processing and generation
+function(error theLine)
+  message(FATAL_ERROR "${theLine}")
+endfunction()
+
+# Prints help message
+function (OCCDoc_PrintHelpMessage)
+  puts("Usage: gendoc [-h] {-refman|-overview} [-html|-pdf|-chm] [-m=<list of modules>|-ug=<list of docs>] [-v] [-s=<search_mode>] [-mathjax=<path>]")
+  puts("")
+  puts("Options are:")
+  puts("")
+  puts("choice of documentation to be generated:")
+  puts("  -overview          : To generate Overview and User Guides")
+  puts("                       (cannot be used with -refman)")
+  puts("  -refman            : To generate class Reference Manual")
+  puts("                       (cannot be used with -overview)")
+  puts("")
+  puts("choice of output format:")
+  puts("  -html              : To generate HTML files")
+  puts("                       (default, cannot be used with -pdf or -chm)")
+  puts("  -pdf               : To generate PDF files")
+  puts("                       (cannot be used with -refman, -html, or -chm)")
+  puts("  -chm               : To generate CHM files")
+  puts("                       (cannot be used with -html or -pdf)")
+  puts("")
+  puts("additional options:")
+  puts("  -m=<modules_list>  : List of OCCT modules (separated with comma),")
+  puts("                       for generation of Reference Manual")
+  puts("  -ug=<docs_list>    : List of MarkDown documents (separated with comma),")
+  puts("                       to use for generation of Overview / User Guides")
+  puts("  -mathjax=<path>    : To use local or alternative copy of MathJax")
+  puts("  -s=<search_mode>   : Specifies the Search mode of HTML documents")
+  puts("                       Can be: none | local | server | external")
+  puts("  -h                 : Prints this help message")
+  puts("  -v                 : Enables more verbose output")
+endfunction()
+
+# A command for User Documentation compilation
+function (gendoc)
+  # Parameters
+  set (DOC_TYPE "REFMAN")
+  set (GEN_MODE "HTML_ONLY")
+  set (DOCFILES)
+  set (MODULES)
+  set (DOCLABEL "")
+  set (VERB_MODE "NO")
+  set (SEARCH_MODE "none")
+  set (MATHJAX_LOCATION "http://cdn.mathjax.org/mathjax/latest")
+  set (mathjax_js_name "MathJax.js")
+  set (DOCTYPE_COMBO_FLAG 0)
+  set (GENMODE_COMBO_FLAG 0)
+  set (GENERATE_PRODUCTS_REFMAN "NO")
+
+  #available_docfiles;   # The full list of md files for HTML or CHM generation
+  #available_pdf;        # The full list of md files for PDF generation
+  #args_names
+  #args_values
+
+  # Load list of docfiles
+  OCCDoc_LoadFilesList()
+
+  # Parse CL arguments
+  OCCDoc_ParseArguments(${ARGV})
+
+  # Print help message if no arguments provided
+  separate_arguments(args_names)
+  list(LENGTH args_names length)
+  if (${length} EQUAL 0)
+    OCCDoc_PrintHelpMessage()
+    return()
+  endif()
+
+  list(FIND args_names "pdf" FIND_pdf)
+  list(FIND args_names "chm" FIND_chm)
+  list(FIND args_names "ug"  FIND_ug)
+  list(FIND args_names "m"  FIND_m)
+  list(FIND args_names "refman" FIND_refman)
+  list(FIND args_names "overview" FIND_overview)
+  foreach (arg_n ${args_names})
+    if ("${arg_n}" STREQUAL "h")
+      OCCDoc_PrintHelpMessage()
+      return()
+    elseif ("${arg_n}" STREQUAL "html")
+      if(${FIND_refman} EQUAL -1 AND ${FIND_overview} EQUAL -1 )
+        error("Error: Please specify -refman or -overview argument.")
+      endif()
+      if(${FIND_refman} EQUAL -1)
+        if (NOT ${GENMODE_COMBO_FLAG} EQUAL 1)
+          set (GEN_MODE "HTML_ONLY")
+          set (GENMODE_COMBO_FLAG 1)
+        else()
+          error("Error: Options -html, -pdf and -chm can not be combined.")
+        endif()
+      endif()
+    elseif ("${arg_n}" STREQUAL "chm")
+      if(${FIND_refman} EQUAL -1 AND ${FIND_overview} EQUAL -1 )
+        error("Error: Please specify -refman or -overview argument.")
+      endif()
+      if(${FIND_refman} EQUAL -1)
+        if(NOT ${GENMODE_COMBO_FLAG} EQUAL 1)
+          set (GEN_MODE "CHM_ONLY")
+          set (GENMODE_COMBO_FLAG 1)
+        else()
+          error("Error: Options -html, -pdf and -chm cannot be combined.")
+        endif()
+      endif()
+    elseif ("${arg_n}" STREQUAL "pdf")
+      if(${FIND_refman} EQUAL -1 AND ${FIND_overview} EQUAL -1 )
+        error("Error: Please specify -refman or -overview argument.")
+      endif()
+      if(${FIND_refman} EQUAL -1)
+        if (NOT ${GENMODE_COMBO_FLAG} EQUAL 1)
+          set (GEN_MODE "PDF_ONLY")
+          set (GENMODE_COMBO_FLAG 1)
+        else()
+          error("Error: Options -html, -pdf and -chm cannot be combined.")
+        endif()
+      endif()
+    elseif ("${arg_n}" STREQUAL "overview")
+      if (NOT ${DOCTYPE_COMBO_FLAG} EQUAL 1)
+        set (DOC_TYPE "OVERVIEW")
+        set (DOCTYPE_COMBO_FLAG 1)
+      else()
+        error("Error: Options -refman and -overview cannot be combined.")
+      endif()
+      # Print ignored options
+      if ( NOT ${FIND_m} EQUAL -1 )
+        puts ("Info: The following options will be ignored:")
+        puts ("  * -m")
+      endif()
+      puts ("")
+    elseif ("${arg_n}" STREQUAL "refman")
+      if (NOT ${DOCTYPE_COMBO_FLAG} EQUAL 1)
+        set (DOC_TYPE "REFMAN")
+        set (DOCTYPE_COMBO_FLAG 1)
+        if ( EXISTS "${PRODUCTS_SOURCE_DIR}/src/VAS/Products.tcl")
+          set (GENERATE_PRODUCTS_REFMAN "YES")
+        endif()
+      else()
+        error("Error: Options -refman and -overview cannot be combined.")
+      endif()
+      # Print ignored options
+      if (NOT ${FIND_pdf} EQUAL -1 OR NOT ${FIND_chm} EQUAL -1 OR NOT ${FIND_ug} EQUAL -1)
+        puts ("Info: The following options will be ignored:")
+        if (NOT ${FIND_pdf} EQUAL -1)
+          puts ("  * -pdf")
+        endif()
+        if (NOT ${FIND_chm} EQUAL -1)
+          puts ("  * -chm")
+        endif()
+        if (NOT ${FIND_ug} EQUAL -1)
+          puts ("  * -ug")
+        endif()
+        puts("")
+      endif()
+      if ( "${GENERATE_PRODUCTS_REFMAN}" STREQUAL "YES")
+        if (${FIND_m} EQUAL -1)
+          error("Error: Cannot generate Reference Manual for the whole set of OCC Products.")
+        endif()
+      endif()
+    elseif ("${arg_n}" STREQUAL "v")
+      set (VERB_MODE "YES")
+    elseif ("${arg_n}" STREQUAL "ug")
+      if(${FIND_refman} EQUAL -1)
+        list(FIND args_names "ug" curIndex)
+        list(GET args_values ${curIndex} curValue)
+        if ( NOT "${curValue}" STREQUAL "NULL")
+          string(REPLACE "," " " curValue "${curValue}")
+          separate_arguments(curValue)
+          set (DOCFILES ${curValue})
+        else()
+          error("Error in argument ug.")
+        endif()
+        # Check if all chosen docfiles are correct
+        foreach (docfile ${DOCFILES})
+          if(${FIND_pdf} EQUAL -1)
+            # Check to generate HTMLs
+            list(FIND available_docfiles "${docfile}" FIND_doc)
+            if (${FIND_doc} EQUAL -1)
+              error("Error: File \"${docfile}\" is not presented in the list of available docfiles.")
+            endif()
+          else()
+            # Check to generate PDFs
+            list(FIND available_pdf "${docfile}" FIND_doc)
+            if ( ${FIND_doc} EQUAL -1)
+              error("Error: File \"${docfile}\" is not presented in the list of generic PDFs.")
+            endif()
+          endif()
+        endforeach()
+      endif()
+    elseif ("${arg_n}" STREQUAL "m")
+      if (${FIND_overview} EQUAL -1)
+        list(FIND args_names "m" curIndex)
+        list(GET args_values ${curIndex} curValue)
+        if ( NOT "${curValue}" STREQUAL "NULL")
+          string(REPLACE "," " " curValue "${curValue}")
+          separate_arguments(curValue)
+          set(MODULES ${curValue})
+        else()
+          error("Error in argument m.")
+        endif()
+      endif()
+    elseif ("${arg_n}" STREQUAL "s")
+      if (${FIND_pdf} EQUAL -1)
+        list(FIND args_names "s" curIndex)
+        list(GET args_values ${curIndex} curValue)
+        if ( NOT "${curValue}" STREQUAL "NULL")
+          string(REPLACE "," " " curValue "${curValue}")
+          separate_arguments(curValue)
+          set (SEARCH_MODE ${curValue})
+        else()
+          error("Error in argument s.")
+        endif()
+      endif()
+    elseif ("${arg_n}" STREQUAL "mathjax")
+      if (NOT ${FIND_pdf} EQUAL -1)
+        list(FIND args_names "mathjax" curIndex)
+        list(GET args_values ${curIndex} curValue)
+        string(REPLACE "," " " curValue "${curValue}")
+        separate_arguments(curValue)
+        set (possible_mathjax_loc ${curValue})
+        if (EXISTS "${possible_mathjax_loc}/${mathjax_js_name}")
+          set (MATHJAX_LOCATION ${curValue})
+          puts ("${MATHJAX_LOCATION}")
+        else()
+          puts ("Warning: ${mathjax_js_name} is not found in ${possible_mathjax_loc}.")
+          puts ("         MathJax will be used from ${MATHJAX_LOCATION}")
+        endif()
+      else()
+        puts("Warning: MathJax is not used with pdf and will be ignored.")
+      endif()
+    else()
+      OCCDoc_PrintHelpMessage()
+      error("Wrong argument: ${arg_n}")
+    endif()
+  endforeach()
+
+  # Check the existence of the necessary tools
+  find_program(DOC_DOXYGEN_PATH "doxygen")
+  if ("${DOC_DOXYGEN_PATH}" STREQUAL "DOC_DOXYGEN_PATH-NOTFOUND")
+    error(" Aborting... Could not find Doxygen, check DOC_DOXYGEN_PATH variable")
+  endif()
+
+  if("${DOC_TYPE}" STREQUAL "REFMAN")
+    find_program(DOC_GRAPHVIZ_PATH "dot")
+    if ("${DOC_GRAPHVIZ_PATH}" STREQUAL "DOC_GRAPHVIZ_PATH-NOTFOUND")
+      puts("Warning: Could not find Dot Part of Graphviz software. Doxygen will skip generation of class diagrams in Reference Manual, check DOC_GRAPHVIZ_PATH variable")
+    endif()
+  endif()
+
+  if (WIN32)
+    if ("${GEN_MODE}" STREQUAL "CHM_ONLY")
+      find_program(DOC_HHC_PATH "hhc")
+      if("${DOC_HHC_PATH}" STREQUAL "DOC_HHC_PATH-NOTFOUND")
+        error(" Aborting... Could not find HHC, check DOC_HHC_PATH variable")
+      endif()
+    endif()
+  endif()
+
+  if ("${GEN_MODE}" STREQUAL "PDF_ONLY")
+    find_program(DOC_INKSCAPE_PATH "inkscape")
+    if("${DOC_INKSCAPE_PATH}" STREQUAL "DOC_INKSCAPE_PATH-NOTFOUND")
+      puts ("Warning: Could not find Inkscape, check DOC_INKSCAPE_PATH variable.")
+      puts ("\tSVG images will be lost in PDF documents.")
+    endif()
+    find_program(DOC_PDFLATEX_PATH "pdflatex")
+    if("${DOC_PDFLATEX_PATH}" STREQUAL "DOC_PDFLATEX_PATH-NOTFOUND")
+      error(" Aborting... Could not find PDFLATEX, check DOC_PDFLATEX_PATH variable")
+    endif()
+  endif()
+
+  # If we do not specify list for docfiles with -m argument,
+  # we assume that we have to generate all docfiles
+  list(LENGTH DOCFILES DOCFILES_length)
+  if (${DOCFILES_length} EQUAL 0)
+    if (NOT "${GEN_MODE}" STREQUAL "PDF_ONLY")
+      set (DOCFILES ${available_docfiles})
+    else()
+      set (DOCFILES ${available_pdf})
+    endif()
+  endif()
+
+  OCCDoc_GetRootDir(ROOTDIR)
+
+  # Clean logfiles
+  set (OUTDIR  "${ROOTDIR}/doc")
+  set (DOXYLOG "${OUTDIR}/doxygen_warnings_and_errors.log")
+  set (PDFLOG  "${OUTDIR}/pdflatex_warnings_and_errors.log")
+
+  file(REMOVE "${PDFLOG}")
+  file(REMOVE "${DOXYLOG}")
+
+  # Start main activities
+  if (NOT "${GEN_MODE}" STREQUAL "PDF_ONLY")
+    OCCDoc_Main(${DOC_TYPE} DOCFILES MODULES ${GEN_MODE} ${VERB_MODE} ${SEARCH_MODE} ${MATHJAX_LOCATION} ${GENERATE_PRODUCTS_REFMAN} available_docfiles available_pdf)
+  else()
+    puts ("Generating OCCT User Guides in PDF format...")
+    foreach (pdf ${DOCFILES})
+      puts ("Info: Processing file ${pdf}")
+      # Some values are hardcoded because they are related only to PDF generation
+      separate_arguments(pdf)
+      OCCDoc_Main("OVERVIEW" pdf "" "PDF_ONLY" ${VERB_MODE} "none" ${MATHJAX_LOCATION} "NO" available_docfiles available_pdf)
+    endforeach()
+    string(TIMESTAMP time "%Y-%m-%d %H:%M")
+    puts ("${time} Generation completed.")
+    puts ("PDF files are generated in \n\t${OUTDIR}/pdf")
+  endif()
+endfunction()
+
+# Main procedure for documents compilation
+function (OCCDoc_Main docType docfiles modules generatorMode verboseMode searchMode mathjaxLocation generateProductsRefman the_available_docfiles the_available_pdf)
+  set(docfiles ${${docfiles}})
+  set(modules ${${modules}})
+  set(available_docfiles ${${the_available_docfiles}})
+  set(available_pdf ${${the_available_pdf}})
+
+  if ("${generateProductsRefman}" STREQUAL "YES")
+    set (ROOTDIR "${PRODUCTS_SOURCE_DIR}")
+  else()
+    set (ROOTDIR "${OCCT_SOURCE_DIR}")
+  endif()
+
+  OCCDoc_GetDoxDir(INDIR)
+  set (OUTDIR     "${ROOTDIR}/doc")
+  set (PDFDIR     "${OUTDIR}/pdf")
+  set (UGDIR      "${PDFDIR}/user_guides")
+  set (DGDIR      "${PDFDIR}/dev_guides")
+  set (TAGFILEDIR "${OUTDIR}/refman")
+  set (HTMLDIR    "${OUTDIR}/overview/html")
+  set (LATEXDIR   "${OUTDIR}/overview/latex")
+  set (DOXYFILE   "${OUTDIR}/OCCT.cfg")
+
+  # Create or cleanup the output folders
+  if (NOT "${generateProductsRefman}" STREQUAL "YES")
+    foreach(dir ${OUTDIR} ${HTMLDIR} ${PDFDIR} ${UGDIR} ${DGDIR})
+      if (NOT EXISTS "${dir}")
+        file(MAKE_DIRECTORY "${dir}")
+      endif()
+    endforeach()
+    if (EXISTS "${LATEXDIR}")
+      file(REMOVE_RECURSE "${LATEXDIR}")
+    endif()
+    file(MAKE_DIRECTORY "${LATEXDIR}")
+  endif()
+  if ("${docType}" STREQUAL "REFMAN")
+    if (NOT EXISTS "${TAGFILEDIR}")
+      file(MAKE_DIRECTORY "${TAGFILEDIR}")
+    endif()
+  endif()
+
+  # is MathJax HLink?
+  set (mathjax_relative_location "${mathjaxLocation}")
+  if (IS_DIRECTORY "${mathjaxLocation}")
+    if ( "${generatorMode}" STREQUAL "HTML_ONLY")
+      # related path
+      file(RELATIVE_PATH mathjax_relative_location ${HTMLDIR} ${mathjaxLocation})
+    elseif ("${generatorMode}" STREQUAL "CHM_ONLY")
+      # absolute path
+      set (mathjax_relative_location ${mathjaxLocation})
+    endif()
+  endif()
+
+  if ( "${generateProductsRefman}" STREQUAL "YES")
+    set (DOCDIR "${OUTDIR}/refman")
+    puts ("Generating OCC Products Reference Manual")
+  else()
+    if ( "${docType}" STREQUAL "REFMAN")
+      set (DOCDIR "${OUTDIR}/refman")
+      puts ("Generating Open CASCADE Reference Manual")
+    elseif ("${docType}" STREQUAL "OVERVIEW")
+      set (DOCDIR "${OUTDIR}/overview")
+      set (FORMAT "")
+      if ( "${generatorMode}" STREQUAL "HTML_ONLY" OR "${generatorMode}" STREQUAL "CHM_ONLY")
+        if ( "${generatorMode}" STREQUAL "HTML_ONLY")
+          set (FORMAT " in HTML format...")
+        elseif ( "${generatorMode}" STREQUAL "CHM_ONLY")
+          set (FORMAT " in CHM format...")
+        endif()
+        puts ("Generating OCCT User Guides${FORMAT}")
+      endif()
+    else()
+      error("Error: Invalid documentation type: ${docType}. Can not process.")
+    endif()
+  endif()
+
+  # Generate Doxyfile
+  string(TIMESTAMP time "%Y-%m-%d %H:%M")
+  puts ("${time} Generating Doxyfile...")
+
+  OCCDoc_MakeDoxyfile(${docType} ${DOCDIR} ${TAGFILEDIR} ${DOXYFILE} ${generatorMode} docfiles modules ${verboseMode} ${searchMode} ${mathjax_relative_location})
+
+  # Run doxygen tool
+  string(TIMESTAMP starttimestamp "%Y-%m-%d %H:%M")
+  if ("${generatorMode}" STREQUAL "HTML_ONLY" OR "${docType}" STREQUAL "REFMAN")
+    puts("${starttimestamp} Generating HTML files...")
+    # Copy index file to provide fast access to HTML documentation
+    file(COPY "${INDIR}/resources/index.html" DESTINATION "${DOCDIR}")
+  elseif ("${generatorMode}" STREQUAL "CHM_ONLY")
+    puts ("${starttimestamp} Generating CHM file...")
+  elseif ("${generatorMode}" STREQUAL "PDF_ONLY")
+    puts ("${starttimestamp} Generating PDF file...")
+  endif()
+  execute_process(COMMAND ${DOC_DOXYGEN_PATH} ${DOXYFILE}
+                  OUTPUT_FILE ${OUTDIR}/doxygen_out.log
+                  ERROR_FILE ${OUTDIR}/doxygen_warnings_and_errors.log
+                 )
+  # Start Post Processing
+  string(TIMESTAMP curtime "%Y-%m-%d %H:%M")
+  if( "${docType}" STREQUAL "REFMAN")
+    # Post Process generated HTML pages and draw dependency graphs
+    OCCDoc_PostProcessor(${DOCDIR})
+    if (${isOK} EQUAL 0)
+      puts ("${curtime} Generation completed.")
+      puts ("Info: doxygen log file is located in:")
+      puts ("\t${OUTDIR}/doxygen_out.log.")
+      puts ("Reference Manual is generated in \n\t${DOCDIR}")
+    endif()
+  elseif ("${docType}" STREQUAL "OVERVIEW")
+    # Start PDF generation routine
+    if ("${generatorMode}" STREQUAL "PDF_ONLY")
+      # Prepare a list of TeX files, generated by Doxygen
+      file(GLOB TEXFILES RELATIVE "${LATEXDIR}" "${LATEXDIR}/*.tex")
+      list(REMOVE_ITEM TEXFILES "refman.tex")
+      if ("${verboseMode}" STREQUAL "YES")
+        puts ("Info: Preprocessing generated TeX files...")
+      endif()
+
+      OCCDoc_ProcessTex(TEXFILES ${LATEXDIR} ${verboseMode})
+
+      if ("${verboseMode}" STREQUAL "YES")
+        puts ("Info: Converting SVG images to PNG format...")
+      endif()
+
+      if (NOT "${DOC_INKSCAPE_PATH}" STREQUAL "DOC_INKSCAPE_PATH-NOTFOUND")
+        OCCDoc_ProcessSvg(${LATEXDIR} ${verboseMode})
+      endif()
+
+      if ("${verboseMode}" STREQUAL "YES")
+        puts ("Info: Generating PDF file from TeX files...")
+      endif()
+      foreach (TEX ${TEXFILES})
+        # Rewrite existing REFMAN.tex file...
+        get_filename_component(TEX ${TEX} NAME_WE)
+        if ("${verboseMode}" STREQUAL "YES")
+          puts ("Info: Generating PDF file from ${TEX}...")
+        endif()
+
+        OCCDoc_MakeRefmanTex(${TEX} ${LATEXDIR} ${verboseMode} available_pdf)
+
+        if ("${verboseMode}" STREQUAL "YES")
+          # ...and use it to generate PDF from TeX...
+          if (WIN32)
+            puts ("Info: Executing ${LATEXDIR}/make.bat...")
+          else()
+            puts ("Info: Executing ${LATEXDIR}/Makefile...")
+          endif()
+        endif()
+        set (PDFLOG "${OUTDIR}/pdflatex_warnings_and_errors.log")
+
+        if (WIN32)
+
+          execute_process(COMMAND ${LATEXDIR}/make.bat
+                  OUTPUT_FILE ${OUTDIR}/pdflatex_out.log
+                  WORKING_DIRECTORY ${LATEXDIR}
+                  ERROR_FILE ${OUTDIR}/pdflatex_warnings_and_errors.log
+                 )
+        else()
+          execute_process(COMMAND make -f ${LATEXDIR}/Makefile
+                  OUTPUT_FILE ${OUTDIR}/pdflatex_out.log
+                  WORKING_DIRECTORY ${LATEXDIR}
+                  ERROR_FILE ${OUTDIR}/pdflatex_warnings_and_errors.log
+                 )
+          # Small workaround for *nix stations
+          execute_process(COMMAND ${DOC_PDFLATEX_PATH} ${LATEXDIR}/refman.tex
+                  WORKING_DIRECTORY ${LATEXDIR}
+                  OUTPUT_FILE ${OUTDIR}/pdflatex_out.log
+                  ERROR_FILE ${OUTDIR}/pdflatex_warnings_and_errors.log
+                 )
+        endif()
+
+        if (NOT EXISTS "${LATEXDIR}/refman.pdf")
+          error("Fatal: PDFLaTeX failed to create output file, stopping!\n\tCheck \"${OUTDIR}/pdflatex_warnings_and_errors.log\" log file")
+        endif()
+
+        set (destFolder "${PDFDIR}")
+        string(REGEX MATCHALL "([a-zA-Z]+)" parsed_string ${TEX})
+        list(FIND parsed_string "tutorial" isTUTORIAL)
+        list(FIND parsed_string "user" isUSER)
+        list(FIND parsed_string "dev" isDEV)
+
+        if (NOT ${isTUTORIAL} EQUAL -1)
+          string(REPLACE "occt__" "occt_" TEX ${TEX})
+          set (destFolder ${PDFDIR})
+        elseif (NOT ${isUSER} EQUAL -1)
+          string(REPLACE "user_guides__" "" TEX ${TEX})
+          set (destFolder ${UGDIR})
+        elseif (NOT ${isDEV} EQUAL -1)
+          string(REPLACE "dev_guides__" "" TEX ${TEX})
+          set (destFolder ${DGDIR})
+        endif()
+        file (RENAME "${LATEXDIR}/refman.pdf" "${destFolder}/${TEX}.pdf")
+      endforeach()
+    elseif ( "${generatorMode}" STREQUAL "CHM_ONLY" )
+      file (RENAME "${OUTDIR}/overview.chm" "${OUTDIR}/occt_overview.chm")
+    endif()
+    if ( "${generatorMode}" STREQUAL "HTML_ONLY" )
+      puts ("HTML documentation is generated in \n\t${DOCDIR}")
+    endif()
+    if ( "${generatorMode}" STREQUAL "CHM_ONLY" )
+      puts ("Generated CHM documentation is in \n\t${OUTDIR}/overview.chm")
+    endif()
+
+    puts ("")
+  endif()
+
+  file(GLOB_RECURSE deleteList "${OUTDIR}/*.tmp")
+  foreach(file ${deleteList})
+    file (REMOVE ${file})
+  endforeach()
+endfunction()
+
+# Generates Doxygen configuration file for Overview documentation
+function (OCCDoc_MakeDoxyfile docType outDir tagFileDir doxyFileName generatorMode DocFilesList ModulesList verboseMode searchMode mathjaxLocation)
+  set(DocFilesList ${${DocFilesList}})
+  set(ModulesList ${${ModulesList}})
+  OCCDoc_GetDoxDir(inputDir)
+  set (TEMPLATES_DIR ${inputDir}/resources)
+  OCCDoc_DetectCasVersion(occt_version)
+  # Delete existent doxyfile
+  file (REMOVE "${doxyFileName}")
+
+  # Copy specific template to the target folder
+  if ( "${docType}" STREQUAL "REFMAN")
+    configure_file("${TEMPLATES_DIR}/occt_rm.doxyfile" "${doxyFileName}" COPYONLY)
+  elseif ("${docType}" STREQUAL "OVERVIEW")
+    if ("${generatorMode}" STREQUAL "HTML_ONLY" OR "${generatorMode}" STREQUAL "CHM_ONLY")
+      configure_file("${TEMPLATES_DIR}/occt_ug_html.doxyfile" "${doxyFileName}" COPYONLY)
+    elseif ("${generatorMode}" STREQUAL "PDF_ONLY")
+      configure_file("${TEMPLATES_DIR}/occt_ug_pdf.doxyfile" "${doxyFileName}" COPYONLY)
+    else()
+      error("Error: Unknown generation mode")
+    endif()
+  else()
+    error("Error: Cannot generate unknown document type")
+  endif()
+
+  # Write specific options
+  if ("${docType}" STREQUAL "REFMAN")
+    GET_OCCT_MODULES(modules)
+    if (NOT "${ModulesList}" STREQUAL "")
+      # Detect invalid names of modules
+      foreach (module ${ModulesList})
+        list(FIND modules "${module}" isFound)
+        if (${isFound} EQUAL -1)
+          error("Error: No module ${module} is known. Aborting...")
+        endif()
+      endforeach()
+      set (modules "${ModulesList}")
+    endif()
+
+    # Set context
+    list(LENGTH modules length)
+    if (${length} EQUAL 1)
+      set (title "OCCT ${modules}")
+      set (name "${modules}")
+    else()
+      set (title "Open CASCADE Technology")
+      set (name "OCCT")
+    endif()
+
+    # Get list of header files in the specified modules
+    set (filelist)
+    foreach (module ${modules})
+      foreach (tk ${${module}_TOOLKITS})
+        OCCDoc_GetPackagesList(${tk} ${tk}_PACKAGES)
+        foreach (pk ${${tk}_PACKAGES})
+          OCCDoc_GetRootDir(theRoot)
+          file(GLOB INC_FILES "${theRoot}/src/${pk}/*.[hg]*")
+          set(TEMP_INC_FILES)
+          foreach (INC_FILE ${INC_FILES})
+            string(FIND "${INC_FILE}" "/Handle_" isFound)
+            if(${isFound} EQUAL -1)
+              list(APPEND TEMP_INC_FILES "${INC_FILE}")
+            endif()
+          endforeach()
+          list(APPEND filelist "${TEMP_INC_FILES}")
+        endforeach()
+      endforeach()
+    endforeach()
+
+    puts (${doxyFileName} "PROJECT_NAME           = \"${title}\"")
+    puts (${doxyFileName} "PROJECT_NUMBER         = ${occt_version}")
+    puts (${doxyFileName} "OUTPUT_DIRECTORY       = ${outDir}/.")
+    puts (${doxyFileName} "GENERATE_TAGFILE       = ${outDir}/${name}.tag")
+
+    if ("${searchMode}" STREQUAL "none")
+      puts (${doxyFileName} "SEARCHENGINE           = NO")
+      puts (${doxyFileName} "SERVER_BASED_SEARCH    = NO")
+      puts (${doxyFileName} "EXTERNAL_SEARCH        = NO")
+    else()
+      puts (${doxyFileName} "SEARCHENGINE           = YES")
+      if ("${searchMode}" STREQUAL "local")
+        puts (${doxyFileName} "SERVER_BASED_SEARCH    = NO")
+        puts (${doxyFileName} "EXTERNAL_SEARCH        = NO")
+      elseif ("${searchMode}" STREQUAL "server")
+        puts (${doxyFileName} "SERVER_BASED_SEARCH    = YES")
+        puts (${doxyFileName} "EXTERNAL_SEARCH        = NO")
+      elseif ("${searchMode}" STREQUAL "external")
+        puts (${doxyFileName} "SERVER_BASED_SEARCH    = YES")
+        puts (${doxyFileName} "EXTERNAL_SEARCH        = YES")
+      else()
+        error("Error: Wrong search engine type: ${searchMode}.")
+      endif()
+    endif()
+    if(EXISTS "${DOC_GRAPHVIZ_PATH}")
+      set(DOT_PATH "${DOC_GRAPHVIZ_PATH}")
+    endif()
+    puts (${doxyFileName} "DOTFILE_DIRS             = ${outDir}/html")
+    puts (${doxyFileName} "DOT_PATH                 = ${DOT_PATH}")
+    puts (${doxyFileName} "INCLUDE_PATH             = ${INSTALL_DIR}/inc")
+    # list of files to generate
+    OCCDoc_MakeMainPage(${outDir} "${outDir}/${name}.dox" modules)
+    set (mainpage "${outDir}/${name}.dox")
+    puts (${doxyFileName} "")
+    puts (${doxyFileName} "INPUT    = ${mainpage} \\")
+    foreach (header ${filelist})
+      puts (${doxyFileName} "               ${header} \\")
+    endforeach()
+
+    puts (${doxyFileName} "MATHJAX_FORMAT         = HTML-CSS")
+    puts (${doxyFileName} "MATHJAX_RELPATH        = ${mathjaxLocation}")
+
+    puts (${doxyFileName} "")
+
+  elseif ( "${docType}" STREQUAL "OVERVIEW")
+    # Add common options for generation of Overview and User Guides
+    puts (${doxyFileName} "PROJECT_NUMBER         = ${occt_version}")
+    puts (${doxyFileName} "OUTPUT_DIRECTORY       = ${outDir}/.")
+    puts (${doxyFileName} "PROJECT_LOGO           = ${inputDir}/resources/occ_logo.png")
+
+    set (PARAM_INPUT "INPUT                 =")
+    set (PARAM_IMAGEPATH "IMAGE_PATH        = ${inputDir}/resources/ ")
+    foreach (docFile ${DocFilesList})
+      set (NEW_IMG_PATH "${inputDir}/${docFile}")
+      OCCDoc_GetRootDir(theRoot)
+      if (NOT "${NEW_IMG_PATH}" STREQUAL "${theRoot}")
+        get_filename_component(img_string ${NEW_IMG_PATH} DIRECTORY)
+        set (img_string "${img_string}/images")
+        if (EXISTS ${img_string})
+          set(PARAM_IMAGEPATH "${PARAM_IMAGEPATH} ${img_string}")
+        endif()
+      endif()
+      set(PARAM_INPUT "${PARAM_INPUT} ${inputDir}/${docFile}")
+    endforeach()
+    puts (${doxyFileName} ${PARAM_INPUT})
+    puts (${doxyFileName} ${PARAM_IMAGEPATH})
+
+    # Add document type-specific options
+    if ( "${generatorMode}" STREQUAL "HTML_ONLY")
+      # generate tree view
+      puts (${doxyFileName} "GENERATE_TREEVIEW      = YES")
+
+      # Set a reference to a TAGFILE
+      if (NOT "${tagFileDir}" STREQUAL "")
+        if (EXISTS "${tagFileDir}/OCCT.tag")
+          set (tagPath ${tagFileDir})
+          puts (${doxyFileName} "TAGFILES               = ${tagFileDir}/OCCT.tag=../../refman/html")
+        endif()
+      endif()
+      # HTML Search engine options
+      string(TOLOWER "${searchMode}" searchMode)
+      if ("${searchMode}" STREQUAL "none")
+        puts (${doxyFileName} "SEARCHENGINE           = NO")
+        puts (${doxyFileName} "SERVER_BASED_SEARCH    = NO")
+        puts (${doxyFileName} "EXTERNAL_SEARCH        = NO")
+      else()
+        puts (${doxyFileName} "SEARCHENGINE           = YES")
+        if ("${searchMode}" STREQUAL "local")
+          puts (${doxyFileName} "SERVER_BASED_SEARCH    = NO")
+          puts (${doxyFileName} "EXTERNAL_SEARCH        = NO")
+        elseif ("${searchMode}" STREQUAL "server")
+          puts (${doxyFileName} "SERVER_BASED_SEARCH    = YES")
+          puts (${doxyFileName} "EXTERNAL_SEARCH        = NO")
+        elseif ("${searchMode}" STREQUAL "external")
+          puts (${doxyFileName} "SERVER_BASED_SEARCH    = YES")
+          puts (${doxyFileName} "EXTERNAL_SEARCH        = YES")
+        else()
+          error("Error: Wrong search engine type: ${searchMode}.")
+        endif()
+      endif()
+    elseif ( "${generatorMode}" STREQUAL "CHM_ONLY")
+      # specific options for CHM file generation
+      if(EXISTS "${DOC_HHC_PATH}")
+        set(HHC_LOCATION "${DOC_HHC_PATH}")
+      endif()
+      puts (${doxyFileName} "GENERATE_TREEVIEW      = NO")
+      puts (${doxyFileName} "SEARCHENGINE           = NO")
+      puts (${doxyFileName} "GENERATE_HTMLHELP      = YES")
+      puts (${doxyFileName} "CHM_FILE               = ../../overview.chm")
+      puts (${doxyFileName} "HHC_LOCATION           = \"${HHC_LOCATION}\"")
+      puts (${doxyFileName} "DISABLE_INDEX          = YES")
+    endif()
+
+    # Formula options
+    puts (${doxyFileName} "MATHJAX_RELPATH        = ${mathjaxLocation}")
+  endif()
+endfunction()
+
+# Parses arguments line like "-arg1=val1 -arg2=val2 ..." to array args_names and map args_values
+function (OCCDoc_ParseArguments)
+  #args_names
+  #args_values
+  set (args_names)
+  set (args_values)
+
+  separate_arguments(ARGV)
+
+  string(REGEX MATCHALL "^[a-zA-Z]+$" single_var "${ARGV}")
+  string(REGEX MATCHALL "^[a-zA-Z]+[=].*$" multi_var "${ARGV}")
+
+  separate_arguments(ARGV)
+  foreach (arg ${ARGV})
+    STRING(FIND "${arg}" "=" equalChar)
+    STRING(FIND "${arg}" "-" firstChar)
+    if(NOT "${firstChar}" EQUAL 0)
+      error("Error in argument \"${arg}\".")
+    endif()
+    if(NOT "${equalChar}" EQUAL -1)
+      math(EXPR valueChar "${equalChar} + 1")
+      math(EXPR nameChar "${equalChar} - 1")
+      string(SUBSTRING "${arg}" "${valueChar}" -1 aValue)
+      string(SUBSTRING "${arg}" 1 "${nameChar}" aName)
+    else()
+      string(SUBSTRING "${arg}" 1 -1 aName)
+      set(aValue "NULL")
+    endif()
+    list(APPEND args_names "${aName}")
+    list(APPEND args_values "${aValue}")
+  endforeach()
+  set (args_names ${args_names} PARENT_SCOPE)
+  set (args_values ${args_values} PARENT_SCOPE)
+  set (isOK 0 PARENT_SCOPE)
+endfunction()
+
+# Returns script parent folder
+function (OCCDoc_GetDoxDir result)
+  if (BUILD_PATCH_DIR AND EXISTS "${BUILD_PATCH_DIR}/dox")
+    set (filePATH ${BUILD_PATCH_DIR})
+  elseif (EXISTS "${CMAKE_SOURCE_DIR}/dox")
+    set (filePATH ${CMAKE_SOURCE_DIR})
+  endif()
+  set(${result} "${filePATH}/dox" PARENT_SCOPE)
+endfunction()
+
+# Returns OCCT root dir
+function (OCCDoc_GetOCCTRootDir result)
+  OCCDoc_GetDoxDir(path)
+  get_filename_component(path "${path}" DIRECTORY)
+  set(${result} "${path}" PARENT_SCOPE)
+endfunction()
+
+# Returns root dir
+function (OCCDoc_GetRootDir result)
+  OCCDoc_GetOCCTRootDir(path)
+  set(${result} "${path}" PARENT_SCOPE)
+endfunction()
+
+# Returns OCCT source dir
+function (OCCDoc_GetSourceDir result)
+  OCCDoc_GetRootDir(theRoot)
+  set(${result} "${theRoot}/src" PARENT_SCOPE)
+endfunction()
+
+# Returns OCCT version string from file Standard_Version.hxx (if available)
+function (OCCDoc_DetectCasVersion theVersion)
+  set (occt_ver 6.7.0)
+  set (occt_ver_add "")
+  OCCDoc_GetSourceDir(filename)
+  set(filename "${filename}/Standard/Standard_Version.hxx")
+  if(EXISTS "${filename}")
+    foreach (var OCC_VERSION_COMPLETE OCC_VERSION_DEVELOPMENT)
+      file (STRINGS "${filename}" ${var} REGEX "^#define ${var} .*")
+      STRING(REGEX REPLACE ".*${var} .*\"([^ ]+)\".*" "\\1" ${var} "${${var}}" )
+    endforeach()
+    if(NOT "${OCC_VERSION_DEVELOPMENT}" STREQUAL "")
+      set(${theVersion} "${OCC_VERSION_COMPLETE}.${OCC_VERSION_DEVELOPMENT}" PARENT_SCOPE)
+    else()
+      set(${theVersion} "${OCC_VERSION_COMPLETE}" PARENT_SCOPE)
+    endif()
+  endif()
+endfunction()
+
+# Convert SVG files to PDF format to allow including them to PDF
+# (requires InkScape to be in PATH)
+function (OCCDoc_ProcessSvg latexDir verboseMode)
+  file(GLOB aFILES "${latexDir}/*.svg")
+  foreach (file ${aFILES})
+    if ("${verboseMode}" STREQUAL "YES")
+      puts ("Info: Converting file ${file}...")
+    endif()
+    get_filename_component(aDir ${file} DIRECTORY )
+    get_filename_component(aName ${file} NAME_WE )
+    set (pdffile "${aDir}/${aName}.pdf")
+    execute_process(COMMAND ${DOC_INKSCAPE_PATH} -z -D --file=${file} --export-pdf=${pdffile}
+        WORKING_DIRECTORY ${LATEXDIR}
+        OUTPUT_FILE ${OUTDIR}/inkscape_out.log
+        ERROR_FILE ${OUTDIR}/inkscape_warnings_and_errors.log
+    )
+  endforeach()
+endfunction()
+
+# ==============================================
+# Reference Manual-specific functions
+# ==============================================
+
+# Finds dependencies between all modules
+function (OCCDoc_CreateModulesDependencyGraph dir filename modules mpageprefix)
+  set(modules ${${modules}})
+  #module_dependency
+  set (file "${dir}/${filename}.dot")
+  file(REMOVE ${file})
+  puts (${file} "digraph ${filename}")
+  puts (${file} "{")
+  foreach (mod ${modules})
+    if ( NOT "${mod}" STREQUAL "")
+      string(TOLOWER "${mpageprefix}${mod}.html" aLowerString)
+      puts (${file} "\t${mod} [ URL = \"${aLowerString}\" ]")
+      foreach (mod_depend ${${mod}_DEPS})
+        puts (${file} "\t${mod_depend} -> ${mod} [ dir = \"back\", color = \"midnightblue\", style = \"solid\" ]")
+      endforeach()
+    endif()
+  endforeach()
+  puts (${file} "}")
+endfunction()
+
+# Finds dependencies between all toolkits in module
+function(OCCDoc_CreateModuleToolkitsDependencyGraph dir filename modulename tpageprefix)
+  #toolkits_in_module
+  #toolkit_dependency
+  #toolkit_parent_module
+  set (file "${dir}/${filename}.dot")
+  file(REMOVE ${file})
+  puts (${file} "digraph ${filename}")
+  puts (${file} "{")
+  foreach (tk ${${modulename}_TOOLKITS})
+    string(TOLOWER "${tpageprefix}${tk}.html" LowerString)
+    OCC_GetUnitType("${tk}" theType)
+    if("${theType}" STREQUAL "t")
+      puts (${file} "\t${tk} [ URL = \"${LowerString}\"]")
+      foreach (tkd ${${tk}_DEPS})
+        IS_OCCT_TOOLKIT(${tkd})
+        OCC_GetUnitType("${tkd}" theType)
+        if("${theType}" STREQUAL "t")
+          if(NOT ${isFOUND} EQUAL -1)
+            if("${isFOUND}" STREQUAL "${modulename}")
+              puts (${file} "\t${tkd} -> ${tk} [ dir = \"back\", color = \"midnightblue\", style = \"solid\" ]")
+            endif()
+          endif()
+        endif()
+      endforeach()
+    endif()
+  endforeach()
+  puts (${file} "}")
+endfunction()
+
+# Finds dependencies between the current toolkit and other toolkits
+function(OCCDoc_CreateToolkitDependencyGraph dir filename toolkitname tpageprefix)
+  #toolkit_dependency
+  set (file "${dir}/${filename}.dot")
+  file(REMOVE ${file})
+  puts(${file} "digraph ${filename}")
+  puts(${file} "{")
+  string(TOLOWER "${tpageprefix}${toolkitname}.html" LowerString)
+  puts(${file} "\t${toolkitname} [ URL = \"${LowerString}\", shape = box ]")
+  foreach (tkd ${${toolkitname}_DEPS})
+    string(TOLOWER "${tpageprefix}${tkd}.html" LowerString)
+    puts(${file} "\t${tkd} [ URL = \"${LowerString}\"\ , shape = box ]")
+    puts(${file} "\t${toolkitname} -> ${tkd} [ color = \"midnightblue\", style = \"solid\" ]")
+  endforeach()
+  list(LENGTH ${toolkitname}_DEPS length)
+  if (${length} GREATER 1)
+    puts(${file} "\taspect = 1")
+  endif()
+  puts(${file} "}")
+endfunction()
+
+# Fills arrays of modules, toolkits, dependency of modules/toolkits etc
+function (OCCDoc_LoadData)
+  #toolkits_in_module
+  #toolkit_dependency
+  #toolkit_parent_module
+  #module_dependency
+  GET_OCCT_MODULES(modules)
+  set(MODULES ${modules} PARENT_SCOPE)
+  foreach (mod ${modules})
+    set(${mod}_TOOLKITS "${${mod}_TOOLKITS}" PARENT_SCOPE)
+    foreach (tk ${${mod}_TOOLKITS})
+      OCCT_TOOLKIT_DEP(${tk})
+      foreach (dtk ${${tk}_DEPS})
+        IS_OCCT_TOOLKIT(${dtk})
+        if(${isFOUND} EQUAL -1)
+          list(REMOVE_ITEM ${tk}_DEPS ${dtk})
+        endif()
+      endforeach()
+      set(${tk}_DEPS ${${tk}_DEPS} PARENT_SCOPE)
+    endforeach()
+  endforeach()
+
+  # Get modules dependency
+  foreach (mod ${modules})
+    set(${mod}_DEPS)
+    foreach (tk ${${mod}_TOOLKITS})
+      foreach(dtk ${${tk}_DEPS})
+        IS_OCCT_TOOLKIT(${dtk})
+        if(NOT ${isFOUND} EQUAL -1)
+          if(NOT "${mod}" STREQUAL "${isFOUND}")
+            list(APPEND ${mod}_DEPS "${isFOUND}")
+          endif()
+        endif()
+      endforeach()
+    endforeach()
+    list(LENGTH ${mod}_DEPS length)
+    if(NOT ${length} EQUAL 0)
+      list(REMOVE_DUPLICATES ${mod}_DEPS)
+    endif()
+    set(${mod}_DEPS ${${mod}_DEPS} PARENT_SCOPE)
+  endforeach()
+endfunction()
+
+# Returns list of packages of the given toolkit
+function (OCCDoc_GetExternLibList theToolkit theExternLibs)
+  OCCDoc_GetRootDir(theRoot)
+  # Open file with list of packages of the given toolkit
+  file(READ "${theRoot}/src/${theToolkit}/EXTERNLIB" CONTENT)
+  set(${theExternLibs} ${CONTENT} PARENT_SCOPE)
+endfunction()
+
+# Returns list of packages of the given toolkit
+function (OCC_GetUnitType theName theResult)
+  OCCDoc_GetRootDir(theRoot)
+  # Open file with list of packages of the given toolkit
+  set(aType "")
+  if(EXISTS "${theRoot}/adm/UDLIST")
+    file(STRINGS "${theRoot}/adm/UDLIST" CONTENT REGEX ". ${theName}")
+  endif()
+  string(SUBSTRING "${CONTENT}" 0 1 aType)
+  set(${theResult} "${aType}" PARENT_SCOPE)
+endfunction()
+
+# Returns list of packages of the given toolkit
+function (OCCDoc_GetPackagesList theToolkit thePackages)
+  OCCDoc_GetRootDir(theRoot)
+  # Open file with list of packages of the given toolkit
+  set(CONTENT "")
+  if(EXISTS "${theRoot}/src/${theToolkit}/PACKAGES")
+    file(STRINGS "${theRoot}/src/${theToolkit}/PACKAGES" CONTENT)
+  endif()
+  set(${thePackages} "${CONTENT}" PARENT_SCOPE)
+endfunction()
+
+# Function to get toolkits dependencies from file src/TOOLKIT_NAME/EXTERNLIB.
+# Creates <TOOLKIT_NAME>_DEPS variable to store them.
+function (OCCT_TOOLKIT_DEP TOOLKIT_NAME)
+  if (BUILD_PATCH_DIR AND EXISTS "${BUILD_PATCH_DIR}/src/${TOOLKIT_NAME}/EXTERNLIB")
+    set (MODULE_PATH_PREFIX ${BUILD_PATCH_DIR})
+  elseif (EXISTS "${CMAKE_SOURCE_DIR}/src/${TOOLKIT_NAME}/EXTERNLIB")
+    set (MODULE_PATH_PREFIX ${CMAKE_SOURCE_DIR})
+  else()
+    RETURN()
+  endif()
+  file (STRINGS "${MODULE_PATH_PREFIX}/src/${TOOLKIT_NAME}/EXTERNLIB" CONTENT)
+  set (${TOOLKIT_NAME}_DEPS ${CONTENT} PARENT_SCOPE)
+endfunction()
+
+# Function to determine if TOOLKIT is OCC toolkit
+# Creates "isFOUND" variable to store result
+function (IS_OCCT_TOOLKIT TOOLKIT_NAME)
+  set (isFOUND -1 PARENT_SCOPE)
+  GET_OCCT_MODULES(MODULES)
+  foreach(MODULE ${MODULES})
+    set(TOOLKITS ${${MODULE}_TOOLKITS})
+    list(FIND TOOLKITS ${TOOLKIT_NAME} isOK)
+    if (NOT ${isOK} EQUAL -1)
+      set (isFOUND "${MODULE}" PARENT_SCOPE)
+      return()
+    endif()
+  endforeach(MODULE)
+endfunction()
+
+# Function to get list of modules and toolkits from file adm/MODULES.
+# Creates list <${MODULES_LIST}> to store list of MODULES and
+# <NAME_OF_MODULE>_TOOLKITS foreach module to store its toolkits.
+function (GET_OCCT_MODULES MODULES_LIST)
+  set (MODULE_PATH_POSTFIX "/adm/MODULES")
+  if (BUILD_PATCH_DIR AND EXISTS "${BUILD_PATCH_DIR}${MODULE_PATH_POSTFIX}")
+    set (MODULE_PATH_PREFIX "${BUILD_PATCH_DIR}")
+  elseif (EXISTS "${CMAKE_SOURCE_DIR}${MODULE_PATH_POSTFIX}")
+    set (MODULE_PATH_PREFIX "${CMAKE_SOURCE_DIR}")
+  else()
+    RETURN()
+  endif()
+
+  file (STRINGS "${MODULE_PATH_PREFIX}${MODULE_PATH_POSTFIX}" CONTENT)
+
+  set (${MODULES_LIST})
+  foreach (CONTENT_LINE ${CONTENT})
+    string (REPLACE " " ";" CONTENT_LINE ${CONTENT_LINE})
+    list (GET CONTENT_LINE 0 NAME_OF_MODULE)
+    list (REMOVE_AT CONTENT_LINE 0)
+    list (APPEND ${MODULES_LIST} ${NAME_OF_MODULE})
+    set (${NAME_OF_MODULE}_TOOLKITS "${CONTENT_LINE}" PARENT_SCOPE)
+  endforeach()
+
+  set (${MODULES_LIST} ${${MODULES_LIST}} PARENT_SCOPE)
+endfunction()
+
+# Gets contents of the given html node (for Post-processing)
+function(OCCDoc_GetNodeContents node props html theResult)
+  set (openTag "<${node}${props}>")
+  set (closingTag "</${node}>")
+  string(FIND "${html}" "${openTag}" start)
+  if (${start} EQUAL -1)
+    set(theResult "" PARENT_SCOPE)
+    return()
+  endif()
+  string(LENGTH "${openTag}" length)
+  math(EXPR start "${start} + ${length}")
+  string(SUBSTRING "${html}" ${start} -1 html)
+  string(FIND "${html}" "${closingTag}" start)
+  if (${start} EQUAL -1)
+    set(theResult "" PARENT_SCOPE)
+    return()
+  endif()
+  math(EXPR start "${start} - 1")
+  string(SUBSTRING "${html}" 0 ${start} theResult)
+  set(theResult "" PARENT_SCOPE)
+endfunction()
+
+# Generates main page file describing module structure
+function (OCCDoc_MakeMainPage outDir outFile inModules)
+  set(inModules "${${inModules}}")
+  #env
+  set (module_prefix "module_")
+  set (toolkit_prefix "toolkit_")
+  set (package_prefix "package_")
+
+  if (NOT EXISTS "${outDir}/html")
+    file(MAKE_DIRECTORY "${outDir}/html")
+  endif()
+
+  OCCDoc_LoadData()
+  # Main page: list of modules
+  separate_arguments(inModules)
+  list(LENGTH inModules length)
+  if (NOT ${length} EQUAL 1)
+    puts (${outFile} "/**")
+    puts (${outFile} "\\mainpage Open CASCADE Technology")
+    foreach (mod ${inModules})
+      string(TOLOWER "${module_prefix}${mod}" LowerString)
+      puts (${outFile} "\\li \\subpage ${LowerString}")
+    endforeach()
+    OCCDoc_CreateModulesDependencyGraph("${outDir}/html" "schema_all_modules" inModules ${module_prefix})
+    # insert modules relationship diagramm
+    puts (${outFile} "\\dotfile schema_all_modules")
+    puts (${outFile} "**/")
+  endif()
+
+  # One page per module: list of toolkits
+  set (toolkits)
+  foreach (mod ${inModules})
+    puts (${outFile} "/**")
+    if (${length} EQUAL 1)
+        puts (${outFile} "\\mainpage OCCT Module ${mod}")
+    else()
+        string(TOLOWER "module_${mod}" LowerString)
+        puts (${outFile} "\\page ${LowerString} Module ${mod}")
+    endif()
+    list(SORT ${mod}_TOOLKITS)
+    foreach (tk ${${mod}_TOOLKITS})
+      OCC_GetUnitType("${tk}" theType)
+      if("${theType}" STREQUAL "t")
+        list(APPEND toolkits ${tk})
+        string(TOLOWER "${toolkit_prefix}${tk}" LowerString)
+        puts (${outFile} "\\li \\subpage ${LowerString}")
+      endif()
+    endforeach()
+    OCCDoc_CreateModuleToolkitsDependencyGraph("${outDir}/html" "schema_${mod}" ${mod} ${toolkit_prefix})
+    puts (${outFile} "\\dotfile schema_${mod}")
+    puts (${outFile} "**/")
+  endforeach()
+
+  # One page per toolkit: list of packages
+  set (packages)
+  foreach (tk ${toolkits})
+    puts (${outFile} "/**")
+    string(TOLOWER "toolkit_${tk}" LowerString)
+    puts (${outFile} "\\page ${LowerString} Toolkit ${tk}")
+    OCCDoc_GetPackagesList(${tk} ${tk}_PACKAGES)
+    list(SORT ${tk}_PACKAGES)
+    foreach (pk ${${tk}_PACKAGES})
+      list(APPEND packages ${pk})
+      string(TOLOWER "${package_prefix}${pk}" LowerString)
+      puts (${outFile} "\\li \\subpage ${LowerString}")
+    endforeach()
+    OCCDoc_CreateToolkitDependencyGraph("${outDir}/html" "schema_${tk}" "${tk}" "${toolkit_prefix}")
+    puts (${outFile} "\\dotfile schema_${tk}")
+    puts (${outFile} "**/")
+  endforeach()
+
+  # One page per package: list of classes
+  foreach (pk ${packages})
+    puts (${outFile} "/**")
+    string(TOLOWER "${package_prefix}${pk}" LowerString)
+    puts (${outFile} "\\page ${LowerString} Package ${pk}")
+    file(GLOB INC_FILES RELATIVE "${theRoot}/src/${pk}" "${theRoot}/src/${pk}/*.hxx")
+    foreach (hdr ${INC_FILES})
+      string(FIND "${hdr}" "Handle_" isHandle)
+      if(NOT ${isHandle} EQUAL 0)
+        string(LENGTH "${hdr}" length)
+        math(EXPR length "${length} - 4")
+        string(SUBSTRING "${hdr}" 0 ${length} aName)
+        puts (${outFile} "\\li \\subpage ${aName}")
+      endif()
+    endforeach()
+    puts (${outFile} "**/")
+  endforeach()
+endfunction()
+
+# Parses generated files to add a navigation path
+function(OCCDoc_PostProcessor outDir)
+  string(TIMESTAMP time "%Y-%m-%d %H:%M")
+  puts("${time} Post-process is started ...")
+  set(outDir "${outDir}/html")
+  file(GLOB files "${outDir}/package_*")
+  list(LENGTH files length)
+  if (NOT ${length} EQUAL 0)
+    list(SORT files)
+    foreach(f ${files})
+      file(READ ${f} packageFile)
+      OCCDoc_GetNodeContents("div" " id=\"nav-path\" class=\"navpath\"" "${packageFile}" navPath)
+      OCCDoc_GetNodeContents("div" " class=\"title\"" "${packageFile}" packageName)
+      get_filename_component(packageFileName "${f}" NAME)
+      # add package link to nav path
+      string(REPLACE "</ul>" "" navPath "${navPath}")
+      set (navPath "${navPath}  <li class=\"navelem\"><a class=\"el\" href=\"${packageFileName}\">${packageName}</a>      </li>\n    </ul>")
+      # get list of files to update
+      OCCDoc_GetNodeContents("div" " class=\"textblock\"" "${packageFile}" listContents)
+      OCCDoc_GetNodeContents("ul" "" "${listContents}" listContents)
+      foreach(line ${listContents})
+        STRING(REGEX REPLACE ".*href=\"([^\"]+)\".*" "\\1" classFileName "${test}" )
+        if (NOT "${classFileName}" STREQUAL "${line}")
+          # check if anchor is there
+          string(FIND "${classFileName}" "#" anchorPos)
+          if (NOT ${anchorPos} EQUAL -1)
+            math(EXPR anchorPos "${anchorPos} - 1")
+            string(SUBSTRING "${classFileName}" 0 ${anchorPos} classFileName)
+          endif()
+
+          # read class file
+          set (classFilePnt "${outDir}/${classFileName}")
+          file(READ ${classFilePnt} classFile)
+
+          # find position of content block
+          string(FIND "${classFile}" "<div class=\"header\">" contentPos)
+          math(EXPR contentPos "${contentPos} - 1")
+          string(SUBSTRING "${classFile}" 0 ${contentPos} navPart)
+
+          # position where to insert nav path
+          string(FIND "${navPart}" "</div>" posToInsert REVERSE)
+          math(EXPR posToInsert "${posToInsert} - 1")
+          string(SUBSTRING "${classFile}" 0 ${posToInsert} prePart)
+          string(SUBSTRING "${classFile}" ${posToInsert} -1 postPart)
+          list(APPEND newClassFile "${prePart}" "  <div id=\"nav-path\" class=\"navpath\">" "${navPath}" "\n" "  </div>" "\n" "${postPart}")
+
+          # write updated content
+          file(WRITE ${classFilePnt} "${newClassFile}")
+          file(APPEND ${classFilePnt} "${classFile}")
+        endif()
+      endforeach()
+    endforeach()
+  else()
+    puts ("no files found")
+  endif()
+endfunction()
+
+# ======================================
+#  User Guides-specific functions
+# ======================================
+
+# Loads a list of docfiles from file FILES.txt
+function(OCCDoc_LoadFilesList)
+  OCCDoc_GetDoxDir(INPUTDIR)
+
+  #available_docfiles
+  set (available_docfiles "")
+  # Read data from file
+  if ( EXISTS "${INPUTDIR}/FILES_HTML.txt" )
+    file (STRINGS "${INPUTDIR}/FILES_HTML.txt" available_docfiles REGEX "^[^#]+")
+  else()
+    error("File FILES_HTML.txt was not found on this computer.\nAborting...")
+  endif()
+  set(available_docfiles "${available_docfiles}" PARENT_SCOPE)
+
+  #available_pdf
+  set(available_pdf "")
+  # Read data from file
+  if ( EXISTS "${INPUTDIR}/FILES_PDF.txt" )
+    file (STRINGS "${INPUTDIR}/FILES_PDF.txt" available_pdf REGEX "^[^#]+")
+  else()
+    error("File FILES_PDF.txt was not found on this computer.\nAborting...")
+  endif()
+  set(available_pdf "${available_pdf}" PARENT_SCOPE)
+endfunction()
+
+# Writes new TeX file for conversion from tex to pdf for a specific doc
+function(OCCDoc_MakeRefmanTex fileName latexDir verboseMode latexFilesList)
+  set(latexFilesList ${${latexFilesList}})
+  if ( "${verboseMode}" STREQUAL "YES")
+    puts ("Info: Making refman.tex file for ${fileName}...")
+  endif()
+  set (DOCNAME "${latexDir}/refman.tex")
+  if (EXISTS ${DOCNAME})
+    file(REMOVE ${DOCNAME})
+  endif()
+
+  # Copy template file to latex folder
+  OCCDoc_GetDoxDir(temp_path)
+
+  configure_file("${temp_path}/resources/occt_pdf_template.tex" "${DOCNAME}" COPYONLY)
+
+  # Get templatized data
+  file(READ ${DOCNAME} texfile_loaded)
+
+  # Replace dummy values
+  OCCDoc_DetectCasVersion(casVersion)
+
+  # Get name of the document
+  set (docLabel "")
+  foreach (aFileName ${latexFilesList})
+    # Find the file in FILES_PDF.txt
+    string(REPLACE "/" ";" parsedFileName "${aFileName}")
+    separate_arguments(parsedFileName)
+    string(FIND "${fileName}" "__" aFirst)
+    math(EXPR aFirst "${aFirst} + 2")
+    string(SUBSTRING "${fileName}" ${aFirst} -1 newfileName)
+    list(FIND parsedFileName "${newfileName}.md" isFOUND)
+    if (NOT ${isFOUND} EQUAL -1)
+      OCCDoc_GetDoxDir(temp_path)
+      set (filepath "${temp_path}/${aFileName}")
+      if (EXISTS ${filepath})
+        file(STRINGS "${filepath}" MDFile LIMIT_COUNT 1)
+        string(REPLACE "{" ";" MDFile "${MDFile}")
+        separate_arguments(MDFile)
+        list(GET MDFile 0 label)
+        set (docLabel "${label}")
+        break()
+      endif()
+    endif()
+  endforeach()
+  string(TIMESTAMP curYear "%Y")
+  string(REPLACE "DEFDOCLABEL" "${docLabel}" texfile_loaded "${texfile_loaded}")
+  string(REPLACE "DEFCASVERSION" "${casVersion}" texfile_loaded "${texfile_loaded}")
+  string(REPLACE "DEFFILENAME" "${fileName}" texfile_loaded "${texfile_loaded}")
+  string(REPLACE "DEFYEAR" "${curYear}" texfile_loaded "${texfile_loaded}")
+  # Get data
+  file(WRITE ${DOCNAME} "${texfile_loaded}")
+endfunction()
+
+# Postprocesses generated TeX files
+function(OCCDoc_ProcessTex texFiles latexDir verboseMode)
+  set(texFiles ${${texFiles}})
+  foreach (TEX ${texFiles})
+    if ("${verboseMode}" STREQUAL "YES")
+      puts("Info: Preprocessing file ${TEX}...")
+    endif()
+
+    if (NOT EXISTS ${latexDir}/${TEX})
+      error("Error: file ${TEX} does not exist.")
+    endif()
+
+    file(STRINGS "${latexDir}/${TEX}" IN_F)
+    set(TEMP_LIST)
+    foreach(line ${IN_F})
+      string(FIND "${line}" "\\includegraphics" includegraphicsPos)
+      string(FIND "${line}" "\\subsection" subsectionPos)
+      string(FIND "${line}" "\\subsubsection" subsubsectionPos)
+      string(FIND "${line}" "\\paragraph" paragraphPos)
+
+      if (NOT ${includegraphicsPos} EQUAL -1)
+        # replace svg extension by pdf
+        string(REPLACE ".svg" ".pdf" line "${line}")
+        # Center images in TeX files
+        set(line "\\begin{center}\n ${line}\n\\end{center}")
+      elseif (NOT ${subsectionPos} EQUAL -1)
+          # Replace \subsection with \section tag
+          string(REPLACE "\\\\subsection" "\\\\section" line "${line}")
+      elseif (NOT ${subsubsectionPos} EQUAL -1)
+          # Replace \subsubsection with \subsection tag
+          string(REPLACE "\\\\subsubsection" "\\\\subsection" line "${line}")
+      elseif (NOT ${paragraphPos} EQUAL -1)
+          # Replace \paragraph with \subsubsection tag
+          string(REPLACE "\\\\paragraph" "\\\\subsubsection" line "${line}")
+      endif()
+      list(APPEND TEMP_LIST "${line}")
+    endforeach()
+    file(WRITE "${latexDir}/${TEX}" ${TEMP_LIST})
+  endforeach()
+endfunction()
diff --git a/adm/cmake/occt_macros.cmake b/adm/cmake/occt_macros.cmake
new file mode 100644 (file)
index 0000000..a8e94c5
--- /dev/null
@@ -0,0 +1,295 @@
+#
+macro (OCCT_CHECK_AND_UNSET VARNAME)
+  if (DEFINED ${VARNAME})
+    unset (${VARNAME} CACHE)
+  endif()
+endmacro()
+
+macro (OCCT_CHECK_AND_UNSET_GROUP VARNAME)
+  OCCT_CHECK_AND_UNSET ("${VARNAME}_DIR")
+
+  OCCT_CHECK_AND_UNSET ("${VARNAME}_INCLUDE_DIR")
+
+  OCCT_CHECK_AND_UNSET ("${VARNAME}_LIBRARY")
+  OCCT_CHECK_AND_UNSET ("${VARNAME}_LIBRARY_DIR")
+
+  if (WIN32)
+    OCCT_CHECK_AND_UNSET ("${VARNAME}_DLL")
+    OCCT_CHECK_AND_UNSET ("${VARNAME}_DLL_DIR")
+  endif()
+endmacro()
+
+# BUILD_POSTFIX, IS_BUILD_DEBUG variables
+macro (OCCT_MAKE_BUILD_POSTFIX)
+  if ("${BUILD_CONFIGURATION}" STREQUAL "Debug")
+    set (BUILD_POSTFIX "d")
+    set (IS_BUILD_DEBUG "")
+  else()
+    set (BUILD_POSTFIX "")
+    OCCT_CHECK_AND_UNSET (IS_BUILD_DEBUG)
+  endif()
+endmacro()
+
+# COMPILER_BITNESS variable
+macro (OCCT_MAKE_COMPILER_BITNESS)
+  math (EXPR COMPILER_BITNESS "32 + 32*(${CMAKE_SIZEOF_VOID_P}/8)")
+endmacro()
+
+# OS_WITH_BIT
+macro (OCCT_MAKE_OS_WITH_BITNESS)
+
+  OCCT_MAKE_COMPILER_BITNESS()
+
+  if (WIN32)
+    set (OS_WITH_BIT "win${COMPILER_BITNESS}")
+  elseif(APPLE)
+    set (OS_WITH_BIT "mac${COMPILER_BITNESS}")
+  else()
+    set (OS_WITH_BIT "lin${COMPILER_BITNESS}")
+  endif()
+endmacro()
+
+# COMPILER variable
+macro (OCCT_MAKE_COMPILER_SHORT_NAME)
+  if (MSVC)
+    if (MSVC70)
+      set (COMPILER vc7)
+    elseif (MSVC80)
+      set (COMPILER vc8)
+    elseif (MSVC90)
+      set (COMPILER vc9)
+    elseif (MSVC10)
+      set (COMPILER vc10)
+    elseif (MSVC11)
+      set (COMPILER vc11)
+    elseif (MSVC12)
+      set (COMPILER vc12)
+    endif()
+  elseif (DEFINED CMAKE_COMPILER_IS_GNUCC)
+    set (COMPILER gcc)
+  elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
+    set (COMPILER gxx)
+  elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+    set (COMPILER clang)
+  elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
+    set (COMPILER icc)
+  else()
+    set (COMPILER ${CMAKE_GENERATOR})
+    string (REGEX REPLACE " " "" COMPILER ${COMPILER})
+  endif()
+endmacro()
+
+function (SUBDIRECTORY_NAMES MAIN_DIRECTORY RESULT)
+  file (GLOB SUB_ITEMS "${MAIN_DIRECTORY}/*")
+
+  foreach (ITEM ${SUB_ITEMS})
+    if (IS_DIRECTORY "${ITEM}")
+      get_filename_component (ITEM_NAME "${ITEM}" NAME)
+      list (APPEND LOCAL_RESULT "${ITEM_NAME}")
+    endif()
+  endforeach()
+  set (${RESULT} ${LOCAL_RESULT} PARENT_SCOPE)
+endfunction()
+
+function (FIND_PRODUCT_DIR ROOT_DIR PRODUCT_NAME RESULT)
+  OCCT_MAKE_COMPILER_SHORT_NAME()
+  OCCT_MAKE_COMPILER_BITNESS()
+
+  string (TOLOWER "${PRODUCT_NAME}" lower_PRODUCT_NAME)
+
+  list (APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*${COMPILER}.*${COMPILER_BITNESS}")
+  list (APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*[0-9.]+.*${COMPILER}.*${COMPILER_BITNESS}")
+  list (APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*[0-9.]+.*${COMPILER_BITNESS}")
+  list (APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*[0-9.]+")
+  list (APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}")
+
+  SUBDIRECTORY_NAMES ("${ROOT_DIR}" SUBDIR_NAME_LIST)
+
+  foreach (SEARCH_TEMPLATE ${SEARCH_TEMPLATES})
+    if (LOCAL_RESULT)
+      BREAK()
+    endif()
+
+    foreach (SUBDIR_NAME ${SUBDIR_NAME_LIST})
+      string (TOLOWER "${SUBDIR_NAME}" lower_SUBDIR_NAME)
+
+      string (REGEX MATCH "${SEARCH_TEMPLATE}" DUMMY_VAR "${lower_SUBDIR_NAME}")
+      if (DUMMY_VAR)
+        list (APPEND LOCAL_RESULT ${SUBDIR_NAME})
+      endif()
+    endforeach()
+  endforeach()
+
+  if (LOCAL_RESULT)
+    list (LENGTH "${LOCAL_RESULT}" LOC_LEN)
+    math (EXPR LAST_ELEMENT_INDEX "${LOC_LEN}-1")
+    list (GET LOCAL_RESULT ${LAST_ELEMENT_INDEX} DUMMY)
+    set (${RESULT} ${DUMMY} PARENT_SCOPE)
+  endif()
+endfunction()
+
+macro (OCCT_INSTALL_FILE_OR_DIR BEING_INSTALLED_OBJECT DESTINATION_PATH)
+  if (BUILD_PATCH_DIR AND EXISTS "${BUILD_PATCH_DIR}/${BEING_INSTALLED_OBJECT}")
+    if (IS_DIRECTORY "${BUILD_PATCH_DIR}/${BEING_INSTALLED_OBJECT}")
+      # first of all, install original files
+      install (DIRECTORY "${CMAKE_SOURCE_DIR}/${BEING_INSTALLED_OBJECT}" DESTINATION  "${DESTINATION_PATH}")
+
+      # secondly, rewrite original files with patched ones
+      install (DIRECTORY "${BUILD_PATCH_DIR}/${BEING_INSTALLED_OBJECT}" DESTINATION  "${DESTINATION_PATH}")
+    else()
+      install (FILES     "${BUILD_PATCH_DIR}/${BEING_INSTALLED_OBJECT}" DESTINATION  "${DESTINATION_PATH}")
+    endif()
+  else()
+    if (IS_DIRECTORY "${CMAKE_SOURCE_DIR}/${BEING_INSTALLED_OBJECT}")
+      install (DIRECTORY "${CMAKE_SOURCE_DIR}/${BEING_INSTALLED_OBJECT}" DESTINATION  "${DESTINATION_PATH}")
+    else()
+      install (FILES     "${CMAKE_SOURCE_DIR}/${BEING_INSTALLED_OBJECT}" DESTINATION  "${DESTINATION_PATH}")
+    endif()
+  endif()
+endmacro()
+
+macro (OCCT_CONFIGURE_AND_INSTALL BEING_CONGIRUGED_FILE FINAL_NAME DESTINATION_PATH)
+  if (BUILD_PATCH_DIR AND EXISTS "${BUILD_PATCH_DIR}/${BEING_CONGIRUGED_FILE}")
+    configure_file("${BUILD_PATCH_DIR}/${BEING_CONGIRUGED_FILE}" "${FINAL_NAME}" @ONLY)
+  else()
+    configure_file("${CMAKE_SOURCE_DIR}/${BEING_CONGIRUGED_FILE}" "${FINAL_NAME}" @ONLY)
+  endif()
+
+  install(FILES "${OCCT_BINARY_DIR}/${FINAL_NAME}" DESTINATION  "${DESTINATION_PATH}")
+endmacro()
+
+macro (OCCT_COPY_FILE_OR_DIR BEING_COPIED_OBJECT DESTINATION_PATH)
+  # first of all, copy original files
+  file (COPY "${CMAKE_SOURCE_DIR}/${BEING_COPIED_OBJECT}" DESTINATION  "${DESTINATION_PATH}")
+
+  if (BUILD_PATCH_DIR AND EXISTS "${BUILD_PATCH_DIR}/${BEING_COPIED_OBJECT}")
+    # secondly, rewrite original files with patched ones
+    file (COPY "${BUILD_PATCH_DIR}/${BEING_COPIED_OBJECT}" DESTINATION  "${DESTINATION_PATH}")
+  endif()
+endmacro()
+
+macro (OCCT_CONFIGURE BEING_CONGIRUGED_FILE FINAL_NAME)
+  if (BUILD_PATCH_DIR AND EXISTS "${BUILD_PATCH_DIR}/${BEING_CONGIRUGED_FILE}")
+    configure_file("${BUILD_PATCH_DIR}/${BEING_CONGIRUGED_FILE}" "${FINAL_NAME}" @ONLY)
+  else()
+    configure_file("${CMAKE_SOURCE_DIR}/${BEING_CONGIRUGED_FILE}" "${FINAL_NAME}" @ONLY)
+  endif()
+endmacro()
+
+function (OCCT_IS_PRODUCT_REQUIRED CSF_VAR_NAME USE_PRODUCT)
+  set (${USE_PRODUCT} OFF PARENT_SCOPE)
+
+  if (NOT USED_TOOLKITS)
+    message(STATUS "Warning: the list of being used toolkits is empty")
+  else()
+    foreach (USED_TOOLKIT ${USED_TOOLKITS})
+      if (BUILD_PATCH_DIR AND EXISTS "${BUILD_PATCH_DIR}/src/${USED_TOOLKIT}/EXTERNLIB")
+        file (READ "${BUILD_PATCH_DIR}/src/${USED_TOOLKIT}/EXTERNLIB" FILE_CONTENT)
+      elseif (EXISTS "${CMAKE_SOURCE_DIR}/src/${USED_TOOLKIT}/EXTERNLIB")
+        file (READ "${CMAKE_SOURCE_DIR}/src/${USED_TOOLKIT}/EXTERNLIB" FILE_CONTENT)
+      endif()
+
+      string (REGEX MATCH "${CSF_VAR_NAME}" DOES_FILE_CONTAIN "${FILE_CONTENT}")
+
+      if (DOES_FILE_CONTAIN)
+        set (${USE_PRODUCT} ON PARENT_SCOPE)
+        break()
+      endif()
+    endforeach()
+  endif()
+endfunction()
+
+function (FILE_TO_LIST FILE_NAME FILE_CONTENT)
+  set (LOCAL_FILE_CONTENT)
+  if (BUILD_PATCH_DIR AND EXISTS "${BUILD_PATCH_DIR}/${FILE_NAME}")
+    file (STRINGS "${BUILD_PATCH_DIR}/${FILE_NAME}" LOCAL_FILE_CONTENT)
+  elseif (EXISTS "${CMAKE_SOURCE_DIR}/${FILE_NAME}")
+    file (STRINGS "${CMAKE_SOURCE_DIR}/${FILE_NAME}" LOCAL_FILE_CONTENT)
+  endif()
+
+  set (${FILE_CONTENT} ${LOCAL_FILE_CONTENT} PARENT_SCOPE)
+endfunction()
+
+# Function to determine if TOOLKIT is OCCT toolkit
+function (IS_OCCT_TOOLKIT TOOLKIT_NAME MODULES IS_TOOLKIT_FOUND)
+  set (${IS_TOOLKIT_FOUND} OFF PARENT_SCOPE)
+  foreach (MODULE ${${MODULES}})
+    set (TOOLKITS ${${MODULE}_TOOLKITS})
+    list (FIND TOOLKITS ${TOOLKIT_NAME} FOUND)
+
+    if (NOT ${FOUND} EQUAL -1)
+      set (${IS_TOOLKIT_FOUND} ON PARENT_SCOPE)
+    endif()
+  endforeach(MODULE)
+endfunction()
+
+# TOOLKIT_DEPS is defined with dependencies from file src/TOOLKIT_NAME/EXTERNLIB.
+# CSF_ variables are ignored
+function (OCCT_TOOLKIT_DEP TOOLKIT_NAME TOOLKIT_DEPS)
+  FILE_TO_LIST ("src/${TOOLKIT_NAME}/EXTERNLIB" FILE_CONTENT)
+
+  #list (APPEND LOCAL_TOOLKIT_DEPS ${TOOLKIT_NAME})
+  set (LOCAL_TOOLKIT_DEPS)
+  foreach (FILE_CONTENT_LINE ${FILE_CONTENT})
+    string (REGEX MATCH "^TK" TK_FOUND ${FILE_CONTENT_LINE})
+    if ("${FILE_CONTENT_LINE}" STREQUAL "DRAWEXE" OR NOT "${TK_FOUND}" STREQUAL "")
+      list (APPEND LOCAL_TOOLKIT_DEPS ${FILE_CONTENT_LINE})
+    endif()
+  endforeach()
+
+  set (${TOOLKIT_DEPS} ${LOCAL_TOOLKIT_DEPS} PARENT_SCOPE)
+endfunction()
+
+# TOOLKIT_FULL_DEPS is defined with complete dependencies (all levels)
+function (OCCT_TOOLKIT_FULL_DEP TOOLKIT_NAME TOOLKIT_FULL_DEPS)
+  # first level dependencies are stored in LOCAL_TOOLKIT_FULL_DEPS
+  OCCT_TOOLKIT_DEP (${TOOLKIT_NAME} LOCAL_TOOLKIT_FULL_DEPS)
+
+  list (LENGTH LOCAL_TOOLKIT_FULL_DEPS LIST_LENGTH)
+  set (LIST_INDEX 0)
+  while (LIST_INDEX LESS LIST_LENGTH)
+    list (GET LOCAL_TOOLKIT_FULL_DEPS ${LIST_INDEX} CURRENT_TOOLKIT)
+    OCCT_TOOLKIT_DEP (${CURRENT_TOOLKIT} CURRENT_TOOLKIT_DEPS)
+
+    # append toolkits are not contained
+    foreach (CURRENT_TOOLKIT_DEP ${CURRENT_TOOLKIT_DEPS})
+      set (CURRENT_TOOLKIT_DEP_FOUND OFF)
+      foreach (LOCAL_TOOLKIT_FULL_DEP ${LOCAL_TOOLKIT_FULL_DEPS})
+        if ("${CURRENT_TOOLKIT_DEP}" STREQUAL "${LOCAL_TOOLKIT_FULL_DEP}")
+          set (CURRENT_TOOLKIT_DEP_FOUND ON)
+          break()
+        endif()
+      endforeach()
+      if ("${CURRENT_TOOLKIT_DEP_FOUND}" STREQUAL "OFF")
+        list (APPEND LOCAL_TOOLKIT_FULL_DEPS ${CURRENT_TOOLKIT_DEP})
+      endif()
+    endforeach()
+
+    # increment the list index
+    MATH(EXPR LIST_INDEX "${LIST_INDEX}+1")
+
+    # calculate new length
+    list (LENGTH LOCAL_TOOLKIT_FULL_DEPS LIST_LENGTH)
+  endwhile()
+
+  set (${TOOLKIT_FULL_DEPS} ${LOCAL_TOOLKIT_FULL_DEPS} PARENT_SCOPE)
+endfunction()
+
+# Function to get list of modules and toolkits from file adm/MODULES.
+# Creates list <$MODULE_LIST> to store list of MODULES and
+# <NAME_OF_MODULE>_TOOLKITS foreach module to store its toolkits.
+function (OCCT_MODULES_AND_TOOLKITS MODULE_LIST)
+  FILE_TO_LIST ("adm/MODULES" FILE_CONTENT)
+
+  foreach (CONTENT_LINE ${FILE_CONTENT})
+    string (REPLACE " " ";" CONTENT_LINE ${CONTENT_LINE})
+    list (GET CONTENT_LINE 0 MODULE_NAME)
+    list (REMOVE_AT CONTENT_LINE 0)
+    list (APPEND ${MODULE_LIST} ${MODULE_NAME})
+    # (!) REMOVE THE LINE BELOW (implicit variables)
+    set (${MODULE_NAME}_TOOLKITS ${CONTENT_LINE} PARENT_SCOPE)
+  endforeach()
+
+  set (${MODULE_LIST} ${${MODULE_LIST}} PARENT_SCOPE)
+endfunction()
+
diff --git a/adm/cmake/opencl.cmake b/adm/cmake/opencl.cmake
new file mode 100644 (file)
index 0000000..59bcbcd
--- /dev/null
@@ -0,0 +1,27 @@
+#OpenCl
+
+SET (3RDPARTY_OPENCL_ADDITIONAL_PATH_FOR_HEADER $ENV{AMDAPPSDKROOT}/include
+                                                  $ENV{INTELOCLSDKROOT}/include
+                                                  $ENV{NVSDKCOMPUTE_ROOT}/OpenCL/common/inc
+                                                  $ENV{ATISTREAMSDKROOT}/include)
+
+
+IF(${COMPILER_BITNESS} STREQUAL 32)
+  SET (3RDPARTY_OPENCL_ADDITIONAL_PATH_FOR_LIB $ENV{AMDAPPSDKROOT}/lib/x86
+                                               $ENV{INTELOCLSDKROOT}/lib/x86
+                                               $ENV{NVSDKCOMPUTE_ROOT}/OpenCL/common/lib/Win32
+                                               $ENV{ATISTREAMSDKROOT}/lib/x86)
+ELSEIF(${COMPILER_BITNESS} STREQUAL 64)
+  SET (3RDPARTY_OPENCL_ADDITIONAL_PATH_FOR_LIB $ENV{AMDAPPSDKROOT}/lib/x86_64
+                                               $ENV{INTELOCLSDKROOT}/lib/x64
+                                               $ENV{NVSDKCOMPUTE_ROOT}/OpenCL/common/lib/x64
+                                               $ENV{ATISTREAMSDKROOT}/lib/x86_64)
+ENDIF()
+
+THIRDPARTY_PRODUCT("OPENCL" "CL/cl.h" "OpenCL" "OpenCLd")
+
+# if CL/cl.h isn't found (and 3RDPARTY_OPENCL_INCLUDE_DIR isn't defined)
+# then try to find OpenCL/cl.h (all other variable won't be changed)
+IF(NOT 3RDPARTY_OPENCL_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_OPENCL_INCLUDE_DIR}")
+  THIRDPARTY_PRODUCT("OPENCL" "OpenCL/cl.h" "OpenCL" "OpenCLd")
+ENDIF()
\ No newline at end of file
diff --git a/adm/cmake/tbb.cmake b/adm/cmake/tbb.cmake
new file mode 100644 (file)
index 0000000..67bb90e
--- /dev/null
@@ -0,0 +1,266 @@
+# tbb
+
+OCCT_MAKE_BUILD_POSTFIX()
+
+if (NOT DEFINED INSTALL_TBB)
+  set (INSTALL_TBB OFF CACHE BOOL "Is tbb required to be copied into install directory")
+endif()
+
+# tbb directory
+if (NOT DEFINED 3RDPARTY_TBB_DIR)
+  set (3RDPARTY_TBB_DIR "" CACHE PATH "The directory containing tbb")
+endif()
+
+# tbb include directory
+if (NOT DEFINED 3RDPARTY_TBB_INCLUDE_DIR)
+  set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of the tbb")
+endif()
+
+# tbb library file (with absolute path)
+if (NOT DEFINED 3RDPARTY_TBB_LIBRARY OR NOT 3RDPARTY_TBB_LIBRARY_DIR)
+  set (3RDPARTY_TBB_LIBRARY "" CACHE FILEPATH "tbb library" FORCE)
+endif()
+
+# tbb library directory
+if (NOT DEFINED 3RDPARTY_TBB_LIBRARY_DIR)
+  set (3RDPARTY_TBB_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tbb library")
+endif()
+
+# tbb malloc library file (with absolute path)
+if (NOT DEFINED 3RDPARTY_TBBMALLOC_LIBRARY OR NOT 3RDPARTY_TBBMALLOC_LIBRARY_DIR)
+  set (3RDPARTY_TBBMALLOC_LIBRARY "" CACHE FILEPATH "tbb malloc library" FORCE)
+endif()
+
+# tbb malloc library directory
+if (NOT DEFINED 3RDPARTY_TBBMALLOC_LIBRARY_DIR)
+  set (3RDPARTY_TBBMALLOC_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tbb malloc library")
+endif()
+
+# tbb shared library (with absolute path)
+if (WIN32)
+  if (NOT DEFINED 3RDPARTY_TBB_DLL OR NOT 3RDPARTY_TBB_DLL_DIR)
+    set (3RDPARTY_TBB_DLL "" CACHE FILEPATH "tbb shared library" FORCE)
+  endif()
+endif()
+
+# tbb shared library directory
+if (WIN32 AND NOT DEFINED 3RDPARTY_TBB_DLL_DIR)
+  set (3RDPARTY_TBB_DLL_DIR "" CACHE FILEPATH "The directory containing tbb shared library")
+endif()
+
+# tbb malloc shared library (with absolute path)
+if (WIN32)
+  if (NOT DEFINED 3RDPARTY_TBBMALLOC_DLL OR NOT 3RDPARTY_TBBMALLOC_DLL_DIR)
+    set (3RDPARTY_TBBMALLOC_DLL "" CACHE FILEPATH "tbb malloc shared library" FORCE)
+  endif()
+endif()
+
+# tbb malloc shared library directory
+if (WIN32 AND NOT DEFINED 3RDPARTY_TBBMALLOC_DLL_DIR)
+  set (3RDPARTY_TBBMALLOC_DLL_DIR "" CACHE FILEPATH "The directory containing tbb malloc shared library")
+endif()
+
+# include occt macros. compiler_bitness, os_wiht_bit, compiler and build_postfix
+OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
+
+# search for product directory inside 3RDPARTY_DIR directory
+if (NOT 3RDPARTY_TBB_DIR AND 3RDPARTY_DIR)
+  FIND_PRODUCT_DIR ("${3RDPARTY_DIR}" "TBB" TBB_DIR_NAME)
+  if (TBB_DIR_NAME)
+    message (STATUS "Info: TBB: ${TBB_DIR_NAME} folder is used")
+    set (3RDPARTY_TBB_DIR "${3RDPARTY_DIR}/${TBB_DIR_NAME}" CACHE PATH "The directory containing tbb" FORCE)
+  endif()
+endif()
+
+OCCT_MAKE_COMPILER_BITNESS()
+
+if (${COMPILER_BITNESS} STREQUAL 32)
+  set (TBB_ARCH_NAME ia32)
+else()
+  set (TBB_ARCH_NAME intel64)
+endif()
+
+# search for include directory in defined 3rdparty directory
+if (NOT 3RDPARTY_TBB_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_TBB_INCLUDE_DIR}")
+  set (3RDPARTY_TBB_INCLUDE_DIR "3RDPARTY_TBB_INCLUDE_DIR-NOTFOUND" CACHE FILEPATH "The directory containing the headers of tbb" FORCE)
+  find_path (3RDPARTY_TBB_INCLUDE_DIR tbb/tbb.h PATHS "${3RDPARTY_TBB_DIR}/include" NO_DEFAULT_PATH)
+  find_path (3RDPARTY_TBB_INCLUDE_DIR tbb/tbb.h PATHS "${3RDPARTY_TBB_DIR}/include")
+endif()
+
+if (NOT 3RDPARTY_TBB_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_TBB_INCLUDE_DIR}")
+  set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE FILEPATH "The directory containing the headers of tbb" FORCE)
+endif()
+
+OCCT_MAKE_COMPILER_SHORT_NAME()
+
+# TBB_COMPILER_FOLER
+#if (WIN32)
+  set (TBB_COMPILER_FOLER ${COMPILER})
+#else()
+#  set (TBB_COMPILER_FOLER ${COMPILER})
+#endif()
+
+OCCT_MAKE_BUILD_POSTFIX()
+
+# search for tbb and tbb malloc library in defined 3rdparty directory
+foreach (LIBRARY_NAME TBB TBBMALLOC)
+  if (NOT WIN32)
+    file (GLOB TBB_SUBDIRS RELATIVE ${3RDPARTY_TBB_DIR}/lib/${TBB_ARCH_NAME}/ ${3RDPARTY_TBB_DIR}/lib/${TBB_ARCH_NAME}/*)
+    list (SORT TBB_SUBDIRS)
+    list (REVERSE TBB_SUBDIRS)
+    list (LENGTH TBB_SUBDIRS TBB_SUBDIRS_LENGTH)
+    set (TBB_SUBDIR_FIRST "")
+    if (${TBB_SUBDIRS_LENGTH})
+      list (GET TBB_SUBDIRS 0 TBB_SUBDIR_FIRST)
+      set (3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_TBB_DIR}/lib/${TBB_ARCH_NAME}/${TBB_SUBDIR_FIRST}")
+    endif()
+  endif()
+  if (NOT 3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR)
+    set (3RDPARTY_${LIBRARY_NAME}_LIBRARY "" CACHE FILEPATH "${LIBRARY_NAME} library" FORCE)
+  elseif (3RDPARTY_${LIBRARY_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${LIBRARY_NAME}_LIBRARY}")
+    get_filename_component(3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR_TMP "${3RDPARTY_${LIBRARY_NAME}_LIBRARY}" PATH)
+    if (NOT "${3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR}" STREQUAL "${3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR_TMP}")
+      set (3RDPARTY_${LIBRARY_NAME}_LIBRARY "" CACHE FILEPATH "${LIBRARY_NAME} library" FORCE)
+    endif()
+  endif()
+
+  if (NOT 3RDPARTY_${LIBRARY_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${LIBRARY_NAME}_LIBRARY}")
+    set (3RDPARTY_${LIBRARY_NAME}_LIBRARY "3RDPARTY_${LIBRARY_NAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "Path to library of ${LIBRARY_NAME}" FORCE)
+
+    # first of all, search for debug version of a library if build type is debug
+    if (DEFINED IS_BUILD_DEBUG)
+      find_library (3RDPARTY_${LIBRARY_NAME}_LIBRARY ${LIBRARY_NAME}_debug
+                                                     PATHS
+                                                      "${3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR}"
+                                                      "${3RDPARTY_TBB_DIR}/libd/${TBB_ARCH_NAME}/${TBB_COMPILER_FOLER}"
+                                                      "${3RDPARTY_TBB_DIR}/lib/${TBB_ARCH_NAME}/${TBB_COMPILER_FOLER}"
+                                                     NO_DEFAULT_PATH)
+
+      # second search if previous one do not find anything
+      find_library (3RDPARTY_${LIBRARY_NAME}_LIBRARY ${LIBRARY_NAME}_debug)
+    endif()
+
+    # if build type is release or debug version of library isn't found - search for release version of one
+    if (NOT 3RDPARTY_${LIBRARY_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${LIBRARY_NAME}_LIBRARY}")
+      set (3RDPARTY_${LIBRARY_NAME}_LIBRARY "3RDPARTY_${LIBRARY_NAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "Path to library of ${LIBRARY_NAME}" FORCE)
+
+      if (DEFINED IS_BUILD_DEBUG)
+        message (STATUS "Warning: debug version of ${LIBRARY_NAME} library isn't found (${LIBRARY_NAME}_debug) in ${3RDPARTY_TBB_DIR}/lib(d). Search for release one")
+      endif()
+
+      string (TOLOWER "${LIBRARY_NAME}" lower_LIBRARY_NAME)
+      find_library (3RDPARTY_${LIBRARY_NAME}_LIBRARY ${lower_LIBRARY_NAME}
+                                                     PATHS
+                                                      "${3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR}"
+                                                      "${3RDPARTY_TBB_DIR}/lib/${TBB_ARCH_NAME}/${TBB_COMPILER_FOLER}"
+                                                     NO_DEFAULT_PATH)
+
+      # second search if previous one do not find anything
+      find_library (3RDPARTY_${LIBRARY_NAME}_LIBRARY ${LIBRARY_NAME})
+    endif()
+  endif()
+
+  if (NOT 3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR}")
+    get_filename_component(3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${LIBRARY_NAME}_LIBRARY}" PATH)
+  endif()
+  set (3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR}" CACHE FILEPATH "The directory containing ${LIBRARY_NAME} library" FORCE)
+
+  # search for dll in defined 3rdparty directory (just for win case)
+  if (WIN32)
+    set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
+
+    if (NOT 3RDPARTY_${LIBRARY_NAME}_DLL_DIR)
+      set (3RDPARTY_${LIBRARY_NAME}_DLL "" CACHE FILEPATH "${LIBRARY_NAME} shared library" FORCE)
+    elseif (3RDPARTY_${LIBRARY_NAME}_DLL AND EXISTS "${3RDPARTY_${LIBRARY_NAME}_DLL}")
+      get_filename_component(3RDPARTY_${LIBRARY_NAME}_DLL_DIR_TMP "${3RDPARTY_${LIBRARY_NAME}_DLL}" PATH)
+      if (NOT "${3RDPARTY_${LIBRARY_NAME}_DLL_DIR}" STREQUAL "${3RDPARTY_${LIBRARY_NAME}_DLL_DIR_TMP}")
+        set (3RDPARTY_${LIBRARY_NAME}_DLL "" CACHE FILEPATH "${LIBRARY_NAME} shared library" FORCE)
+      endif()
+    endif()
+
+    if (NOT 3RDPARTY_${LIBRARY_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${LIBRARY_NAME}_DLL}")
+      set (3RDPARTY_${LIBRARY_NAME}_DLL "3RDPARTY_${LIBRARY_NAME}_DLL-NOTFOUND" CACHE FILEPATH "Path to shared library of ${LIBRARY_NAME}" FORCE)
+
+      if (DEFINED IS_BUILD_DEBUG)
+        find_library (3RDPARTY_${LIBRARY_NAME}_DLL ${LIBRARY_NAME}_debug
+                                       PATHS
+                                        "${3RDPARTY_${LIBRARY_NAME}_DLL_DIR}"
+                                        "${3RDPARTY_TBB_DIR}/bind/${TBB_ARCH_NAME}/${TBB_COMPILER_FOLER}"
+                                        "${3RDPARTY_TBB_DIR}/bin/${TBB_ARCH_NAME}/${TBB_COMPILER_FOLER}"
+                                       NO_DEFAULT_PATH)
+
+        # second search if previous one do not find anything
+        find_library (3RDPARTY_${LIBRARY_NAME}_DLL ${LIBRARY_NAME}_debug)
+      endif()
+
+      if (NOT 3RDPARTY_${LIBRARY_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${LIBRARY_NAME}_DLL}")
+        set (3RDPARTY_${LIBRARY_NAME}_DLL "3RDPARTY_${LIBRARY_NAME}_DLL-NOTFOUND" CACHE FILEPATH "Path to shared library of ${LIBRARY_NAME}" FORCE)
+
+        if (DEFINED IS_BUILD_DEBUG)
+          message (STATUS "Warning: debug version of ${LIBRARY_NAME} dll isn't found (${LIBRARY_NAME}_debug) in ${3RDPARTY_TBB_DIR}/bin(d). Search for release one")
+        endif()
+
+        find_library (3RDPARTY_${LIBRARY_NAME}_DLL ${LIBRARY_NAME}
+                                                   PATHS
+                                                    "${3RDPARTY_${LIBRARY_NAME}_DLL_DIR}"
+                                                    "${3RDPARTY_TBB_DIR}/bin/${TBB_ARCH_NAME}/${TBB_COMPILER_FOLER}"
+                                                   NO_DEFAULT_PATH)
+
+        # second search if previous one do not find anything
+        find_library (3RDPARTY_${LIBRARY_NAME}_DLL ${LIBRARY_NAME})
+      endif()
+    endif()
+
+    if (NOT 3RDPARTY_${LIBRARY_NAME}_DLL_DIR OR NOT EXISTS "${3RDPARTY_${LIBRARY_NAME}_DLL_DIR}")
+      get_filename_component(3RDPARTY_${LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${LIBRARY_NAME}_DLL}" PATH)
+      set (3RDPARTY_${LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${LIBRARY_NAME}_DLL_DIR}" CACHE FILEPATH "The directory containing ${LIBRARY_NAME} shared library" FORCE)
+    endif()
+  endif() # end dll search
+endforeach() # end tbb / tbbmalloc
+
+# include found paths to common variables
+if (3RDPARTY_TBB_INCLUDE_DIR AND EXISTS "${3RDPARTY_TBB_INCLUDE_DIR}")
+  list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TBB_INCLUDE_DIR}")
+else()
+  list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_INCLUDE_DIR)
+endif()
+
+foreach (LIBRARY_NAME TBB TBBMALLOC)
+  if (3RDPARTY_${LIBRARY_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${LIBRARY_NAME}_LIBRARY}")
+    list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR}")
+  else()
+    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR)
+  endif()
+
+  if (WIN32)
+    if (NOT 3RDPARTY_${LIBRARY_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${LIBRARY_NAME}_DLL}")
+      list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${LIBRARY_NAME}_DLL_DIR)
+    endif()
+  endif()
+endforeach()
+
+# install tbb
+if (INSTALL_TBB)
+  OCCT_MAKE_OS_WITH_BITNESS()
+  OCCT_MAKE_COMPILER_SHORT_NAME()
+
+  if (WIN32)
+    install (FILES ${3RDPARTY_TBB_DLL} ${3RDPARTY_TBBMALLOC_DLL} DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BUILD_POSTFIX}")
+  else()
+    get_filename_component(TBBLIB ${3RDPARTY_TBB_LIBRARY} NAME)
+    get_filename_component(TBBMALLOCLIB ${3RDPARTY_TBBMALLOC_LIBRARY} NAME)
+    install (FILES ${3RDPARTY_TBB_LIBRARY}.2 DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BUILD_POSTFIX}" RENAME ${TBBLIB}.2)
+    install (FILES ${3RDPARTY_TBBMALLOC_LIBRARY}.2 DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BUILD_POSTFIX}" RENAME ${TBBMALLOCLIB}.2)
+  endif()
+
+  set (USED_3RDPARTY_TBB_DIR "")
+else()
+  # the library directory for using by the executable
+  if (WIN32)
+    set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_DLL_DIR})
+  else()
+    set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR})
+  endif()
+endif()
+
+mark_as_advanced (3RDPARTY_TBB_LIBRARY 3RDPARTY_TBBMALLOC_LIBRARY 3RDPARTY_TBB_DLL 3RDPARTY_TBBMALLOC_DLL)
diff --git a/adm/cmake/tcl.cmake b/adm/cmake/tcl.cmake
new file mode 100644 (file)
index 0000000..9fe2a41
--- /dev/null
@@ -0,0 +1,346 @@
+# tcl
+
+if (NOT DEFINED INSTALL_TCL)
+  set (INSTALL_TCL OFF CACHE BOOL "Is tcl lib required to be copied into install directory")
+endif()
+
+# tcl directory
+if (NOT DEFINED 3RDPARTY_TCL_DIR)
+  set (3RDPARTY_TCL_DIR "" CACHE PATH "The directory containing tcl")
+endif()
+
+# tcl include directory
+if (NOT DEFINED 3RDPARTY_TCL_INCLUDE_DIR)
+  set (3RDPARTY_TCL_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of tcl")
+endif()
+
+# tk include directory
+if (NOT DEFINED 3RDPARTY_TK_INCLUDE_DIR)
+  set (3RDPARTY_TK_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of tk")
+endif()
+
+# tcl library file (with absolute path)
+if (NOT DEFINED 3RDPARTY_TCL_LIBRARY OR NOT 3RDPARTY_TCL_LIBRARY_DIR)
+  set (3RDPARTY_TCL_LIBRARY "" CACHE FILEPATH "tcl library"  FORCE)
+endif()
+
+# tcl library directory
+if (NOT DEFINED 3RDPARTY_TCL_LIBRARY_DIR)
+  set (3RDPARTY_TCL_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tcl library")
+endif()
+
+# tk library file (with absolute path)
+if (NOT DEFINED 3RDPARTY_TK_LIBRARY OR NOT 3RDPARTY_TK_LIBRARY_DIR)
+  set (3RDPARTY_TK_LIBRARY "" CACHE FILEPATH "tk library" FORCE)
+endif()
+
+# tk library directory
+if (NOT DEFINED 3RDPARTY_TK_LIBRARY_DIR)
+  set (3RDPARTY_TK_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tk library")
+endif()
+
+# tcl shared library (with absolute path)
+if (WIN32)
+  if (NOT DEFINED 3RDPARTY_TCL_DLL OR NOT 3RDPARTY_TCL_DLL_DIR)
+    set (3RDPARTY_TCL_DLL "" CACHE FILEPATH "tcl shared library" FORCE)
+  endif()
+endif()
+
+# tcl shared library directory
+if (WIN32 AND NOT DEFINED 3RDPARTY_TCL_DLL_DIR)
+  set (3RDPARTY_TCL_DLL_DIR "" CACHE FILEPATH "The directory containing tcl shared library")
+endif()
+
+# tk shared library (with absolute path)
+if (WIN32)
+  if (NOT DEFINED 3RDPARTY_TK_DLL OR NOT 3RDPARTY_TK_DLL_DIR)
+    set (3RDPARTY_TK_DLL "" CACHE FILEPATH "tk shared library" FORCE)
+  endif()
+endif()
+
+# tk shared library directory
+if (WIN32 AND NOT DEFINED 3RDPARTY_TK_DLL_DIR)
+  set (3RDPARTY_TK_DLL_DIR "" CACHE FILEPATH "The directory containing tk shared library")
+endif()
+
+# search for tcl in user defined directory
+if (NOT 3RDPARTY_TCL_DIR AND 3RDPARTY_DIR)
+  FIND_PRODUCT_DIR("${3RDPARTY_DIR}" tcl TCL_DIR_NAME)
+  if (TCL_DIR_NAME)
+    set (3RDPARTY_TCL_DIR "${3RDPARTY_DIR}/${TCL_DIR_NAME}" CACHE PATH "The directory containing tcl" FORCE)
+  endif()
+endif()
+
+# define paths for default engine
+if (3RDPARTY_TCL_DIR AND EXISTS "${3RDPARTY_TCL_DIR}")
+  set (TCL_INCLUDE_PATH "${3RDPARTY_TCL_DIR}/include")
+endif()
+
+# check tcl/tk include dir, library dir and shared library dir
+macro (DIR_SUBDIR_FILE_FIT LIBNAME)
+  if (3RDPARTY_TCL_DIR AND EXISTS "${3RDPARTY_TCL_DIR}")
+    # tcl/tk include dir
+    if (3RDPARTY_${LIBNAME}_INCLUDE_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_INCLUDE_DIR}")
+      string (REGEX MATCH "${3RDPARTY_TCL_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_INCLUDE_DIR}")
+      if (NOT DOES_PATH_CONTAIN)
+        set (3RDPARTY_${LIBNAME}_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of ${LIBNAME}" FORCE)
+      endif()
+    else()
+      set (3RDPARTY_${LIBNAME}_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of ${LIBNAME}" FORCE)
+    endif()
+
+    # tcl/tk library dir
+    if (3RDPARTY_${LIBNAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
+
+      string (REGEX MATCH "${3RDPARTY_TCL_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
+      if (NOT DOES_PATH_CONTAIN)
+        set (3RDPARTY_${LIBNAME}_LIBRARY_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} library" FORCE)
+      endif()
+    else()
+      set (3RDPARTY_${LIBNAME}_LIBRARY_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} library" FORCE)
+    endif()
+
+    # tcl/tk shared library dir
+    if (WIN32)
+      if (3RDPARTY_${LIBNAME}_DLL_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_DLL_DIR}")
+        string (REGEX MATCH "${3RDPARTY_TCL_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_DLL_DIR}")
+        if (NOT DOES_PATH_CONTAIN)
+          set (3RDPARTY_${LIBNAME}_DLL_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} shared library" FORCE)
+        endif()
+      else()
+        set (3RDPARTY_${LIBNAME}_DLL_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} shared library" FORCE)
+      endif()
+    endif()
+  endif()
+
+  # check tcl/tk library
+  if (3RDPARTY_${LIBNAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
+    if (3RDPARTY_${LIBNAME}_LIBRARY AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY}")
+      string (REGEX MATCH "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_LIBRARY}")
+
+      if (NOT DOES_PATH_CONTAIN)
+        set (3RDPARTY_${LIBNAME}_LIBRARY "" CACHE FILEPATH "${LIBNAME} library" FORCE)
+      endif()
+    else()
+      set (3RDPARTY_${LIBNAME}_LIBRARY "" CACHE FILEPATH "${LIBNAME} library" FORCE)
+    endif()
+  else()
+    set (3RDPARTY_${LIBNAME}_LIBRARY "" CACHE FILEPATH "${LIBNAME} library" FORCE)
+  endif()
+
+  # check tcl/tk shared library
+  if (WIN32)
+    if (3RDPARTY_${LIBNAME}_DLL_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_DLL_DIR}")
+      if (3RDPARTY_${LIBNAME}_DLL AND EXISTS "${3RDPARTY_${LIBNAME}_DLL}")
+        string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DLL_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_DLL}")
+
+        if (NOT DOES_PATH_CONTAIN)
+          set (3RDPARTY_${LIBNAME}_DLL "" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
+        endif()
+      else()
+        set (3RDPARTY_${LIBNAME}_DLL "" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
+      endif()
+    else()
+      set (3RDPARTY_${LIBNAME}_DLL "" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
+    endif()
+  endif()
+endmacro()
+
+
+DIR_SUBDIR_FILE_FIT(TCL)
+DIR_SUBDIR_FILE_FIT(TK)
+
+
+# use default (CMake) TCL search
+find_package(TCL)
+
+foreach (LIBNAME TCL TK)
+  string (TOLOWER "${LIBNAME}" LIBNAME_L)
+
+  # tcl/tk include dir
+  if (NOT 3RDPARTY_${LIBNAME}_INCLUDE_DIR)
+    if (${LIBNAME}_INCLUDE_PATH AND EXISTS "${${LIBNAME}_INCLUDE_PATH}")
+      set (3RDPARTY_${LIBNAME}_INCLUDE_DIR "${${LIBNAME}_INCLUDE_PATH}" CACHE FILEPATH "The directory containing headers of ${LIBNAME}" FORCE)
+    endif()
+  endif()
+
+  # tcl/tk dir and library
+  if (NOT 3RDPARTY_${LIBNAME}_LIBRARY)
+    if (${LIBNAME}_LIBRARY AND EXISTS "${${LIBNAME}_LIBRARY}")
+      set (3RDPARTY_${LIBNAME}_LIBRARY "${${LIBNAME}_LIBRARY}" CACHE FILEPATH "${LIBNAME} library" FORCE)
+
+      if (NOT 3RDPARTY_${LIBNAME}_LIBRARY_DIR)
+        get_filename_component (3RDPARTY_${LIBNAME}_LIBRARY_DIR "${3RDPARTY_${LIBNAME}_LIBRARY}" PATH)
+        set (3RDPARTY_${LIBNAME}_LIBRARY_DIR "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}" CACHE FILEPATH "The directory containing ${LIBNAME} library" FORCE)
+      endif()
+    endif()
+  endif()
+
+
+  if (WIN32)
+    if (NOT 3RDPARTY_${LIBNAME}_DLL)
+        set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
+
+        set (DLL_FOLDER_FOR_SEARCH "")
+        if (3RDPARTY_${LIBNAME}_DLL_DIR)
+          set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_${LIBNAME}_DLL_DIR}")
+        elseif (3RDPARTY_TCL_DIR)
+          set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
+        elseif (3RDPARTY_${LIBNAME}_LIBRARY_DIR)
+          get_filename_component (3RDPARTY_${LIBNAME}_LIBRARY_DIR_PARENT "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}" PATH)
+          set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_${LIBNAME}_LIBRARY_DIR_PARENT}/bin")
+        endif()
+
+        set (3RDPARTY_${LIBNAME}_DLL "3RDPARTY_${LIBNAME}_DLL-NOTFOUND" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
+        find_library (3RDPARTY_${LIBNAME}_DLL NAMES ${LIBNAME_L}86 ${LIBNAME_L}85
+                                              PATHS "${DLL_FOLDER_FOR_SEARCH}"
+                                              NO_DEFAULT_PATH)
+    endif()
+  endif()
+
+  DIR_SUBDIR_FILE_FIT(${LIBNAME})
+
+
+  # tcl/tk dir and library
+  if (NOT 3RDPARTY_${LIBNAME}_LIBRARY)
+    set (3RDPARTY_${LIBNAME}_LIBRARY "3RDPARTY_${LIBNAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "${LIBNAME} library" FORCE)
+    find_library (3RDPARTY_${LIBNAME}_LIBRARY NAMES ${LIBNAME_L}8.6 ${LIBNAME_L}86 ${LIBNAME_L}8.5 ${LIBNAME_L}85
+                                              PATHS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}"
+                                              NO_DEFAULT_PATH)
+
+    # search in another place if previous search doesn't find anything
+    find_library (3RDPARTY_${LIBNAME}_LIBRARY NAMES ${LIBNAME_L}8.6 ${LIBNAME_L}86 ${LIBNAME_L}8.5 ${LIBNAME_L}85
+                                              PATHS "${3RDPARTY_TCL_DIR}/lib"
+                                              NO_DEFAULT_PATH)
+
+
+    if (NOT 3RDPARTY_${LIBNAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY}")
+      set (3RDPARTY_${LIBNAME}_LIBRARY "" CACHE FILEPATH "${LIBNAME} library" FORCE)
+    endif()
+
+    if (NOT 3RDPARTY_${LIBNAME}_LIBRARY_DIR AND 3RDPARTY_${LIBNAME}_LIBRARY)
+      get_filename_component (3RDPARTY_${LIBNAME}_LIBRARY_DIR "${3RDPARTY_${LIBNAME}_LIBRARY}" PATH)
+      set (3RDPARTY_${LIBNAME}_LIBRARY_DIR "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}" CACHE FILEPATH "The directory containing ${LIBNAME} library" FORCE)
+    endif()
+  endif()
+
+  set (3RDPARTY_${LIBNAME}_LIBRARY_VERSION "")
+  if (3RDPARTY_${LIBNAME}_LIBRARY AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY}")
+    get_filename_component (${LIBNAME}_LIBRARY_NAME "${3RDPARTY_${LIBNAME}_LIBRARY}" NAME)
+    string(REGEX REPLACE "^.*${LIBNAME_L}([0-9]\\.*[0-9]).*$" "\\1" ${LIBNAME}_LIBRARY_VERSION "${${LIBNAME}_LIBRARY_NAME}")
+
+    if (NOT "${${LIBNAME}_LIBRARY_VERSION}" STREQUAL "${${LIBNAME}_LIBRARY_NAME}")
+      set (3RDPARTY_${LIBNAME}_LIBRARY_VERSION "${${LIBNAME}_LIBRARY_VERSION}")
+    else() # if the version isn't found - seek other library with 8.6 or 8.5 version in the same dir
+      message (STATUS "Info: ${LIBNAME} version isn't found")
+    endif()
+  endif()
+
+
+  set (3RDPARTY_${LIBNAME}_LIBRARY_VERSION_WITH_DOT "")
+  if (3RDPARTY_${LIBNAME}_LIBRARY_VERSION)
+    string (REGEX REPLACE "^.*([0-9])[^0-9]*[0-9].*$" "\\1" 3RDPARTY_${LIBNAME}_MAJOR_VERSION "${3RDPARTY_${LIBNAME}_LIBRARY_VERSION}")
+    string (REGEX REPLACE "^.*[0-9][^0-9]*([0-9]).*$" "\\1" 3RDPARTY_${LIBNAME}_MINOR_VERSION "${3RDPARTY_${LIBNAME}_LIBRARY_VERSION}")
+    set (3RDPARTY_${LIBNAME}_LIBRARY_VERSION_WITH_DOT "${3RDPARTY_${LIBNAME}_MAJOR_VERSION}.${3RDPARTY_${LIBNAME}_MINOR_VERSION}")
+  endif()
+
+  if (WIN32)
+    if (NOT 3RDPARTY_${LIBNAME}_DLL)
+        set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
+
+        set (DLL_FOLDER_FOR_SEARCH "")
+        if (3RDPARTY_${LIBNAME}_DLL_DIR)
+          set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_${LIBNAME}_DLL_DIR}")
+        elseif (3RDPARTY_TCL_DIR)
+          set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
+        else()
+          get_filename_component (3RDPARTY_${LIBNAME}_LIBRARY_DIR_PARENT "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}" PATH)
+          set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_${LIBNAME}_LIBRARY_DIR_PARENT}/bin")
+        endif()
+
+        set (3RDPARTY_${LIBNAME}_DLL "3RDPARTY_${LIBNAME}_DLL-NOTFOUND" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
+        find_library (3RDPARTY_${LIBNAME}_DLL NAMES ${LIBNAME_L}${3RDPARTY_${LIBNAME}_LIBRARY_VERSION}
+                                              PATHS "${DLL_FOLDER_FOR_SEARCH}"
+                                              NO_DEFAULT_PATH)
+
+        if (NOT 3RDPARTY_${LIBNAME}_DLL OR NOT EXISTS "${3RDPARTY_${LIBNAME}_DLL}")
+          set (3RDPARTY_${LIBNAME}_DLL "" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
+        endif()
+
+        if (NOT 3RDPARTY_${LIBNAME}_DLL_DIR AND 3RDPARTY_${LIBNAME}_DLL)
+          get_filename_component (3RDPARTY_${LIBNAME}_DLL_DIR "${3RDPARTY_${LIBNAME}_DLL}" PATH)
+          set (3RDPARTY_${LIBNAME}_DLL_DIR "${3RDPARTY_${LIBNAME}_DLL_DIR}" CACHE FILEPATH "The directory containing ${LIBNAME} shared library" FORCE)
+        endif()
+    endif()
+  endif()
+
+  # include found paths to common variables
+  if (3RDPARTY_${LIBNAME}_INCLUDE_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_INCLUDE_DIR}")
+    list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_${LIBNAME}_INCLUDE_DIR}")
+  else()
+    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${LIBNAME}_INCLUDE_DIR)
+  endif()
+
+  if (3RDPARTY_${LIBNAME}_LIBRARY AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY}")
+    list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
+  else()
+    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${LIBNAME}_LIBRARY_DIR})
+  endif()
+
+  if (WIN32)
+    if (NOT 3RDPARTY_${LIBNAME}_DLL OR NOT EXISTS "${3RDPARTY_${LIBNAME}_DLL}")
+      list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${LIBNAME}_DLL_DIR)
+    endif()
+  endif()
+endforeach()
+
+# install tcltk
+if (INSTALL_TCL)
+  # include occt macros. compiler_bitness, os_wiht_bit, compiler and build_postfix
+  OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
+
+  OCCT_MAKE_OS_WITH_BITNESS()
+  OCCT_MAKE_COMPILER_SHORT_NAME()
+  OCCT_MAKE_BUILD_POSTFIX()
+
+  if (WIN32)
+    install (FILES ${3RDPARTY_TCL_DLL} ${3RDPARTY_TK_DLL} DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BUILD_POSTFIX}")
+       install (FILES ${3RDPARTY_TCL_DLL_DIR}/zlib1.dll DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BUILD_POSTFIX}")
+  else()
+       get_filename_component(ABS_PATH ${3RDPARTY_TCL_LIBRARY} REALPATH)
+    install (FILES ${ABS_PATH} DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BUILD_POSTFIX}")
+       get_filename_component(ABS_PATH ${3RDPARTY_TK_LIBRARY} REALPATH)
+       install (FILES ${ABS_PATH} DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BUILD_POSTFIX}")
+  endif()
+
+  if (TCL_TCLSH_VERSION)
+    # tcl is required to install in lib folder (without ${BUILD_POSTFIX})
+    install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl8"                    DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
+    install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl${TCL_TCLSH_VERSION}" DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
+    install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tk${TCL_TCLSH_VERSION}"  DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
+  else()
+    message (STATUS "\nWarning: tclX.X and tkX.X subdirs won't be copyied during the installation process.")
+    message (STATUS "Try seeking tcl within another folder by changing 3RDPARTY_TCL_DIR variable.")
+  endif()
+
+  set (USED_3RDPARTY_TCL_DIR "")
+else()
+  # the library directory for using by the executable
+  if (WIN32)
+    set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_DLL_DIR})
+  else()
+    set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_LIBRARY_DIR})
+  endif()
+endif()
+
+mark_as_advanced (3RDPARTY_TCL_LIBRARY 3RDPARTY_TK_LIBRARY 3RDPARTY_TCL_DLL 3RDPARTY_TK_DLL)
+
+# unset all redundant variables
+#TCL
+OCCT_CHECK_AND_UNSET (TCL_LIBRARY)
+OCCT_CHECK_AND_UNSET (TCL_INCLUDE_PATH)
+OCCT_CHECK_AND_UNSET (TCL_TCLSH)
+#TK
+OCCT_CHECK_AND_UNSET (TK_LIBRARY)
+OCCT_CHECK_AND_UNSET (TK_INCLUDE_PATH)
+OCCT_CHECK_AND_UNSET (TK_WISH)
diff --git a/adm/cmake/vtk.cmake b/adm/cmake/vtk.cmake
new file mode 100644 (file)
index 0000000..e0f8674
--- /dev/null
@@ -0,0 +1,165 @@
+# vtk
+
+if (NOT DEFINED INSTALL_VTK)
+  set (INSTALL_VTK OFF CACHE BOOL "Is vtk required to be copied into install directory")
+endif()
+
+# vtk directory
+if (NOT DEFINED 3RDPARTY_VTK_DIR)
+  set (3RDPARTY_VTK_DIR "" CACHE PATH "The directory containing vtk")
+endif()
+
+# vtk include directory
+if (NOT DEFINED 3RDPARTY_VTK_INCLUDE_DIR)
+  set (3RDPARTY_VTK_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of vtk")
+endif()
+
+# vtk library directory
+if (NOT DEFINED 3RDPARTY_VTK_LIBRARY_DIR)
+  set (3RDPARTY_VTK_LIBRARY_DIR "" CACHE FILEPATH "The directory containing vtk library")
+endif()
+
+# vtk dll directory
+if (WIN32 AND NOT DEFINED 3RDPARTY_VTK_DLL_DIR)
+  set (3RDPARTY_VTK_DLL_DIR "" CACHE FILEPATH "The directory containing VTK dll")
+endif()
+
+# search for vtk in user defined directory
+if (NOT 3RDPARTY_VTK_DIR AND 3RDPARTY_DIR)
+  FIND_PRODUCT_DIR("${3RDPARTY_DIR}" vtk VTK_DIR_NAME)
+  if (VTK_DIR_NAME)
+    set (3RDPARTY_VTK_DIR "${3RDPARTY_DIR}/${VTK_DIR_NAME}" CACHE PATH "The directory containing vtk product" FORCE)
+  endif()
+endif()
+
+# find installed vtk
+find_package(VTK QUIET)
+
+# find native vtk
+if (NOT VTK_FOUND)
+  find_package(VTK QUIET PATHS "${3RDPARTY_VTK_DIR}")
+endif()
+
+if (NOT VTK_FOUND AND NOT 3RDPARTY_VTK_DIR OR NOT EXISTS "${3RDPARTY_VTK_DIR}")
+  message(SEND_ERROR "VTK not found. Set the 3RDPARTY_VTK_DIR cmake cache entry to the directory containing VTK.")
+  set (3RDPARTY_VTK_DIR "3RDPARTY_VTK_DIR-NOTFOUND" CACHE PATH "The directory containing vtk product" FORCE)
+endif()
+
+OCCT_MAKE_BUILD_POSTFIX()
+set(VTK_VERSION "")
+if (3RDPARTY_VTK_DIR AND EXISTS "${3RDPARTY_VTK_DIR}")
+  get_filename_component(3RDPARTY_VTK_DIR_NAME "${3RDPARTY_VTK_DIR}" NAME)
+  string(REGEX MATCH "^VTK-([0-9].[0-9])" VTK_VERSION "${3RDPARTY_VTK_DIR_NAME}")
+  set(VTK_VERSION "${CMAKE_MATCH_1}")
+  if (NOT 3RDPARTY_VTK_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_VTK_INCLUDE_DIR}")
+    set (3RDPARTY_VTK_INCLUDE_DIR "${3RDPARTY_VTK_DIR}/include/vtk-${VTK_VERSION}" CACHE FILEPATH "The directory containing includes of VTK" FORCE)
+  endif()
+  if (NOT 3RDPARTY_VTK_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_VTK_LIBRARY_DIR}")
+    if(EXISTS "${3RDPARTY_VTK_DIR}/lib${BUILD_POSTFIX}")
+      set (3RDPARTY_VTK_LIBRARY_DIR "${3RDPARTY_VTK_DIR}/lib${BUILD_POSTFIX}" CACHE FILEPATH "The directory containing libs of VTK" FORCE)
+    else()
+         if (NOT "${BUILD_POSTFIX}" STREQUAL "" AND EXISTS "${3RDPARTY_VTK_DIR}/lib")
+           set (3RDPARTY_VTK_LIBRARY_DIR "${3RDPARTY_VTK_DIR}/lib" CACHE FILEPATH "The directory containing libs of VTK" FORCE)
+      endif()
+       endif()
+  endif()
+  if(3RDPARTY_VTK_LIBRARY_DIR)
+    list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_VTK_LIBRARY_DIR}")
+  endif()
+endif()
+
+# vtk libraries
+# lib
+set (VTK_LIBRARY_NAMES vtkCommonCore-${VTK_VERSION}.lib vtkCommonDataModel-${VTK_VERSION}.lib vtkCommonExecutionModel-${VTK_VERSION}.lib
+                       vtkCommonMath-${VTK_VERSION}.lib vtkCommonTransforms-${VTK_VERSION}.lib vtkRenderingCore-${VTK_VERSION}.lib
+                       vtkRenderingOpenGL-${VTK_VERSION}.lib vtkFiltersGeneral-${VTK_VERSION}.lib vtkIOCore-${VTK_VERSION}.lib
+                       vtkIOImage-${VTK_VERSION}.lib vtkImagingCore-${VTK_VERSION}.lib vtkInteractionStyle-${VTK_VERSION}.lib )
+
+#dll
+set (VTK_DLL_NAMES vtkCommonComputationalGeometry-${VTK_VERSION}.dll
+                   vtkCommonCore-${VTK_VERSION}.dll
+                   vtkCommonDataModel-${VTK_VERSION}.dll
+                   vtkCommonExecutionModel-${VTK_VERSION}.dll
+                   vtkCommonMath-${VTK_VERSION}.dll
+                   vtkCommonMisc-${VTK_VERSION}.dll
+                   vtkCommonSystem-${VTK_VERSION}.dll
+                   vtkCommonTransforms-${VTK_VERSION}.dll
+                   vtkDICOMParser-${VTK_VERSION}.dll
+                   vtkFiltersCore-${VTK_VERSION}.dll
+                   vtkFiltersExtraction-${VTK_VERSION}.dll
+                   vtkFiltersGeneral-${VTK_VERSION}.dll
+                   vtkFiltersGeometry-${VTK_VERSION}.dll
+                   vtkFiltersSources-${VTK_VERSION}.dll
+                   vtkFiltersStatistics-${VTK_VERSION}.dll
+                   vtkIOCore-${VTK_VERSION}.dll
+                   vtkIOImage-${VTK_VERSION}.dll
+                   vtkImagingCore-${VTK_VERSION}.dll
+                   vtkImagingFourier-${VTK_VERSION}.dll
+                   vtkImagingHybrid-${VTK_VERSION}.dll
+                   vtkInteractionStyle-${VTK_VERSION}.dll
+                   vtkRenderingCore-${VTK_VERSION}.dll
+                   vtkRenderingOpenGL-${VTK_VERSION}.dll
+                   vtkalglib-${VTK_VERSION}.dll
+                   vtkjpeg-${VTK_VERSION}.dll
+                   vtkmetaio-${VTK_VERSION}.dll
+                   vtkpng-${VTK_VERSION}.dll
+                   vtksys-${VTK_VERSION}.dll
+                   vtktiff-${VTK_VERSION}.dll
+                   vtkzlib-${VTK_VERSION}.dll )
+
+# search for dll directory
+if (WIN32)
+  if (NOT 3RDPARTY_VTK_DLL_DIR OR NOT EXISTS "${3RDPARTY_VTK_DLL_DIR}")
+    if(EXISTS "${3RDPARTY_VTK_DIR}/bin${BUILD_POSTFIX}")
+      set (3RDPARTY_VTK_DLL_DIR "${3RDPARTY_VTK_DIR}/bin${BUILD_POSTFIX}" CACHE FILEPATH "The directory containing dll of VTK" FORCE)
+    else()
+         if (NOT "${BUILD_POSTFIX}" STREQUAL "" AND EXISTS "${3RDPARTY_VTK_DIR}/bin")
+           set (3RDPARTY_VTK_DLL_DIR "${3RDPARTY_VTK_DIR}/bin" CACHE FILEPATH "The directory containing dll of VTK" FORCE)
+      endif()
+       endif()
+  endif()
+endif()
+
+OCCT_CHECK_AND_UNSET(VTK_DIR)
+
+if (3RDPARTY_VTK_INCLUDE_DIR AND EXISTS "${3RDPARTY_VTK_INCLUDE_DIR}")
+  list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_VTK_INCLUDE_DIR}")
+else()
+  list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_INCLUDE_DIR)
+endif()
+
+if (INSTALL_VTK)
+  OCCT_MAKE_OS_WITH_BITNESS()
+  OCCT_MAKE_COMPILER_SHORT_NAME()
+  if (WIN32)
+    if(3RDPARTY_VTK_DLL_DIR AND EXISTS "${3RDPARTY_VTK_DLL_DIR}")
+      set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
+      foreach(VTK_DLL_NAME ${VTK_DLL_NAMES})
+        set (3RDPARTY_VTK_DLL "3RDPARTY_VTK_DLL-NOTFOUND" CACHE FILEPATH "VTK shared library" FORCE)
+        find_library(3RDPARTY_VTK_DLL "${VTK_DLL_NAME}" PATHS "${3RDPARTY_VTK_DLL_DIR}" NO_DEFAULT_PATH)
+        if (NOT 3RDPARTY_VTK_DLL OR NOT EXISTS "${3RDPARTY_VTK_DLL}")
+          list (APPEND 3RDPARTY_NOT_INCLUDED "${3RDPARTY_VTK_DLL}")
+        else()
+          install (FILES ${3RDPARTY_VTK_DLL} DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BUILD_POSTFIX}")
+        endif()
+      endforeach()
+      OCCT_CHECK_AND_UNSET(3RDPARTY_VTK_DLL)
+    endif()
+  else ()
+    foreach(VTK_DLL_NAME ${VTK_DLL_NAMES})
+      string(REPLACE ".dll" ".so.1" VTK_DLL_NAME "${VTK_DLL_NAME}")
+      install(FILES "${3RDPARTY_VTK_LIBRARY_DIR}/lib${VTK_DLL_NAME}" DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BUILD_POSTFIX}" RENAME "lib${VTK_DLL_NAME}")
+    endforeach()
+  endif()
+
+  set (USED_3RDPARTY_VTK_DIR "")
+else()
+  # the library directory for using by the executable
+  if (WIN32)
+    set (USED_3RDPARTY_VTK_DIR ${3RDPARTY_VTK_DLL_DIR})
+  else()
+    set (USED_3RDPARTY_VTK_DIR ${3RDPARTY_VTK_LIBRARY_DIR})
+  endif()
+endif()
+
+mark_as_advanced (VTK_INCLUDE_DIRS VTK_LIBRARY_DIRS VTK_DIR)
diff --git a/adm/templates/3rdparty_macro.cmake b/adm/templates/3rdparty_macro.cmake
deleted file mode 100644 (file)
index 9e47a49..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-#
-
-# include occt macros. compiler_bitness, os_wiht_bit, compiler and build_postfix
-OCCT_INCLUDE_CMAKE_FILE ("adm/templates/occt_macros")
-
-macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_NAME LIBRARY_NAME_DEBUG)
-
-  OCCT_MAKE_BUILD_POSTFIX()
-
-  # define 3RDPARTY_${PRODUCT_NAME}_DIR variable is it isn't defined
-  if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_DIR)
-    set (3RDPARTY_${PRODUCT_NAME}_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME}")
-  endif()
-
-  # search for product directory inside 3RDPARTY_DIR directory
-  if (NOT 3RDPARTY_${PRODUCT_NAME}_DIR AND 3RDPARTY_DIR)
-    FIND_PRODUCT_DIR ("${3RDPARTY_DIR}" "${PRODUCT_NAME}" ${PRODUCT_NAME}_DIR_NAME)
-    if (${PRODUCT_NAME}_DIR_NAME)
-      message (STATUS "Info: ${PRODUCT_NAME}: ${${PRODUCT_NAME}_DIR_NAME} folder is used")
-      set (3RDPARTY_${PRODUCT_NAME}_DIR "${3RDPARTY_DIR}/${${PRODUCT_NAME}_DIR_NAME}" CACHE PATH "The directory containing ${PRODUCT_NAME}" FORCE)
-    endif()
-  endif()
-
-  if (NOT DEFINED INSTALL_${PRODUCT_NAME})
-    set (INSTALL_${PRODUCT_NAME} OFF CACHE BOOL "Is ${PRODUCT_NAME} required to be copied into install directory")
-  endif()
-
-  # search for include directory
-  if (NOT 3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}")
-    set (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR "3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR-NOTFOUND" CACHE FILEPATH "The directory containing the headers of the ${PRODUCT_NAME}" FORCE)
-    find_path (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR ${HEADER_NAME} PATHS
-                                                                    "${3RDPARTY_${PRODUCT_NAME}_DIR}/include"
-                                                                    ${3RDPARTY_${PRODUCT_NAME}_ADDITIONAL_PATH_FOR_HEADER}
-                                                                   NO_DEFAULT_PATH)
-    find_path (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR ${HEADER_NAME})
-  endif()
-  
-  if (NOT 3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}")
-    set (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR "" CACHE FILEPATH "The directory containing the headers of the ${PRODUCT_NAME}" FORCE)
-  endif()
-
-  if (NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR)
-    set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "" CACHE FILEPATH "${PRODUCT_NAME} library" FORCE)
-  elseif (3RDPARTY_${PRODUCT_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
-    get_filename_component(3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_TMP "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" PATH)
-    if (NOT "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}" STREQUAL "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_TMP}")
-      set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "" CACHE FILEPATH "${PRODUCT_NAME} library" FORCE)
-    endif()
-  endif()
-
-  # search for library
-  if (NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
-    set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "3RDPARTY_${PRODUCT_NAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "${PRODUCT_NAME} library" FORCE)
-
-    # first of all, search for debug version of a library if build type is debug
-    if (DEFINED IS_BUILD_DEBUG)
-      find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY ${LIBRARY_NAME_DEBUG}
-                                                     PATHS 
-                                                      "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}"
-                                                      "${3RDPARTY_${PRODUCT_NAME}_DIR}/lib"
-                                                      "${3RDPARTY_${PRODUCT_NAME}_DIR}/libd"
-                                                      ${3RDPARTY_${PRODUCT_NAME}_ADDITIONAL_PATH_FOR_LIB}
-                                                     NO_DEFAULT_PATH)
-      # second search if previous one do not find anything
-      find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY ${LIBRARY_NAME_DEBUG})
-    endif()
-
-    # if build type is release or debug version of library isn't found - search for release version of one
-    if (NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
-      set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "3RDPARTY_${PRODUCT_NAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "${PRODUCT_NAME} library" FORCE)
-
-      if (DEFINED IS_BUILD_DEBUG)
-        message (STATUS "Warning: debug version of ${PRODUCT_NAME} library isn't found (${LIBRARY_NAME_DEBUG}) in ${3RDPARTY_${PRODUCT_NAME}_DIR}/lib(d). Search for release one")
-      endif()
-
-      find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY ${LIBRARY_NAME} PATHS 
-                                                                      "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}"
-                                                                      "${3RDPARTY_${PRODUCT_NAME}_DIR}/lib"
-                                                                      ${3RDPARTY_${PRODUCT_NAME}_ADDITIONAL_PATH_FOR_LIB}
-                                                                     NO_DEFAULT_PATH)
-      # second search if previous one do not find anything
-      find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY ${LIBRARY_NAME})
-    endif()
-  endif()
-  
-  if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR)
-    set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "" CACHE FILEPATH "The directory containing ${PRODUCT_NAME} library" FORCE)
-  endif()
-  
-  # library path
-  if (3RDPARTY_${PRODUCT_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
-    get_filename_component (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" PATH)
-    set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}" CACHE FILEPATH "The directory containing ${PRODUCT_NAME} library" FORCE)
-  endif()
-  
-  # search for shared library (just for win case)
-  if (WIN32)
-    set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
-    
-    if (NOT 3RDPARTY_${PRODUCT_NAME}_DLL_DIR)
-      set (3RDPARTY_${PRODUCT_NAME}_DLL "" CACHE FILEPATH "${PRODUCT_NAME} shared library" FORCE)
-    elseif (3RDPARTY_${PRODUCT_NAME}_DLL AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
-      get_filename_component(3RDPARTY_${PRODUCT_NAME}_DLL_DIR_TMP "${3RDPARTY_${PRODUCT_NAME}_DLL}" PATH)
-      if (NOT "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}" STREQUAL "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR_TMP}")
-        set (3RDPARTY_${PRODUCT_NAME}_DLL "" CACHE FILEPATH "${PRODUCT_NAME} shared library" FORCE)
-      endif()
-    endif()
-
-    if (NOT 3RDPARTY_${PRODUCT_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
-      set (3RDPARTY_${PRODUCT_NAME}_DLL "3RDPARTY_${PRODUCT_NAME}_DLL-NOTFOUND" CACHE FILEPATH "${PRODUCT_NAME} shared library" FORCE)
-
-      if (DEFINED IS_BUILD_DEBUG)
-        find_library (3RDPARTY_${PRODUCT_NAME}_DLL "${LIBRARY_NAME_DEBUG}"
-                                                   PATHS
-                                                    "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}"
-                                                    "${3RDPARTY_${PRODUCT_NAME}_DIR}/bin"
-                                                    "${3RDPARTY_${PRODUCT_NAME}_DIR}/bind"
-                                                    ${3RDPARTY_${PRODUCT_NAME}_ADDITIONAL_PATH_FOR_DLL}
-                                                   NO_DEFAULT_PATH)
-        
-        # second search if previous one do not find anything
-        find_library (3RDPARTY_${PRODUCT_NAME}_DLL "${LIBRARY_NAME_DEBUG}")
-      endif()
-
-      if (NOT 3RDPARTY_${PRODUCT_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
-        set (3RDPARTY_${PRODUCT_NAME}_DLL "3RDPARTY_${PRODUCT_NAME}_DLL-NOTFOUND" CACHE FILEPATH "${PRODUCT_NAME} shared library" FORCE)
-
-        if (DEFINED IS_BUILD_DEBUG)
-          message (STATUS "Warning: debug version of ${PRODUCT_NAME} dll isn't found (${LIBRARY_NAME_DEBUG}) in ${3RDPARTY_${PRODUCT_NAME}_DIR}/bin(d). Search for release one")
-        endif()
-
-        find_library (3RDPARTY_${PRODUCT_NAME}_DLL "${LIBRARY_NAME}" PATHS
-                                                                      "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}"
-                                                                      "${3RDPARTY_${PRODUCT_NAME}_DIR}/bin"
-                                                                      ${3RDPARTY_${PRODUCT_NAME}_ADDITIONAL_PATH_FOR_DLL}
-                                                                     NO_DEFAULT_PATH)
-        
-        # second search if previous one do not find anything
-        find_library (3RDPARTY_${PRODUCT_NAME}_DLL "${LIBRARY_NAME}")
-      endif()
-    endif()
-    
-    if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_DLL_DIR)
-      set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "" CACHE FILEPATH "The directory containing ${PRODUCT_NAME} shared library" FORCE)
-    endif()
-    
-    # shared library path
-    if (3RDPARTY_${PRODUCT_NAME}_DLL AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
-      get_filename_component (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL}" PATH)
-      set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}" CACHE FILEPATH "The directory containing ${PRODUCT_NAME} shared library" FORCE)
-    endif()
-  endif()
-  
-  if (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}")
-    list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}")
-  else()
-    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR)
-  endif()
-
-  if (3RDPARTY_${PRODUCT_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
-    list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
-  else()
-    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR)
-  endif()
-
-  if (WIN32)
-    if (NOT 3RDPARTY_${PRODUCT_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
-      list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_DLL_DIR)
-    endif()
-  endif()
-
-  if (INSTALL_${PRODUCT_NAME})
-    OCCT_MAKE_OS_WITH_BITNESS()
-    OCCT_MAKE_COMPILER_SHORT_NAME()
-    OCCT_MAKE_BUILD_POSTFIX()
-
-    if (WIN32)
-      install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}"     DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BUILD_POSTFIX}")
-    else()
-      install (FILES "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BUILD_POSTFIX}")
-    endif()
-
-    set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "")
-  else()
-    # the library directory for using by the executable
-    if (WIN32)
-      set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
-    else()
-      set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
-    endif()
-  endif()
-  
-  mark_as_advanced (3RDPARTY_${PRODUCT_NAME}_LIBRARY 3RDPARTY_${PRODUCT_NAME}_DLL)
-endmacro()
\ No newline at end of file
index 4ad4e2b..bcf6361 100644 (file)
@@ -10,6 +10,7 @@ if "%VCVER%" == "@COMPILER@" (
       set "GL2PS_DIR=@USED_3RDPARTY_GL2PS_DIR@"
       set "TBB_DIR=@USED_3RDPARTY_TBB_DIR@"
       set "VTK_DIR=@USED_3RDPARTY_VTK_DIR@"
+      set "CSF_TestDataPath=@TESTS_SHAPES_DIR@"
     )
   ) 
 )
index 28209d2..14a3c84 100644 (file)
@@ -9,6 +9,7 @@ if [ "$COMPILER" == "@COMPILER@" ]; then
       export GL2PS_DIR="@USED_3RDPARTY_GL2PS_DIR@"
       export TBB_DIR="@USED_3RDPARTY_TBB_DIR@"
       export VTK_DIR="@USED_3RDPARTY_VTK_DIR@"
+      export CSF_TestDataPath="@TESTS_SHAPES_DIR@"
     fi
   fi
 fi
index 9f92bc1..cb57d10 100644 (file)
@@ -1,10 +1,10 @@
 @echo off
 
 rem Setup environment and launch DRAWEXE
-call "%~dp0env.bat" %1 %2 %3
+call "%~dp0env.bat"
 
 echo Hint: use "pload ALL" command to load standard commands
-"%CASROOT%/%BIN_TAIL%/DRAWEXE.exe"
+DRAWEXE.exe %*
 
 set "PATH=%ORIGIN_PATH%"
 
diff --git a/adm/templates/env.build.bat.in b/adm/templates/env.build.bat.in
new file mode 100644 (file)
index 0000000..201c341
--- /dev/null
@@ -0,0 +1,73 @@
+echo off
+
+set "SCRIPTROOT=%~dp0"
+set "SCRIPTROOT=%SCRIPTROOT:~0,-1%"
+
+set "CASROOT=@CMAKE_SOURCE_DIR@"
+
+set "VCVER=@COMPILER@"
+set "ARCH=@COMPILER_BITNESS@"
+set "CASDEB=@BUILD_POSTFIX@"
+
+if not ["%1"]    == [""]      set "VCVER=%1"
+if not ["%2"]    == [""]      set "ARCH=%2"
+if /I ["%ARCH%"] == ["win32"] set "ARCH=32"
+if /I ["%ARCH%"] == ["win64"] set "ARCH=64"
+if /I ["%3"]     == ["debug"] set "CASDEB=d"
+if /I ["%3"]     == ["d"]     set "CASDEB=d"
+
+if exist "%~dp0custom.bat" (
+  call "%~dp0custom.bat" %1 %2 %3
+)
+
+if ["%CASROOT%"] == [""] set "CASROOT=%SCRIPTROOT%"
+
+set "ORIGIN_PATH=%PATH%"
+
+if not ["%TCL_DIR%"] == [""]           set "PATH=%TCL_DIR%;%PATH%"
+if not ["%FREETYPE_DIR%"] == [""]      set "PATH=%FREETYPE_DIR%;%PATH%"
+if not ["%FREEIMAGE_DIR%"] == [""]     set "PATH=%FREEIMAGE_DIR%;%PATH%"
+if not ["%FREEIMAGEPLUS_DIR%"] == [""] set "PATH=%FREEIMAGEPLUS_DIR%;%PATH%"
+if not ["%GL2PS_DIR%"] == [""]         set "PATH=%GL2PS_DIR%;%PATH%"
+if not ["%TBB_DIR%"] == [""]           set "PATH=%TBB_DIR%;%PATH%"
+if not ["%VTK_DIR%"] == [""]           set "PATH=%VTK_DIR%;%PATH%"
+
+rem ----- Set path to 3rd party and OCCT libraries -----
+set "BIN_TAIL=win%ARCH%/%VCVER%/bin%CASDEB%"
+set "PATH=@CMAKE_BINARY_DIR@/%BIN_TAIL%;%PATH%"
+
+rem ----- Set envoronment variables used by OCCT -----
+set  CSF_LANGUAGE=us
+set  MMGT_CLEAR=1
+set  CSF_EXCEPTION_PROMPT=1
+set "CSF_SHMessage=%CASROOT%\src\SHMessage"
+set "CSF_MDTVTexturesDirectory=%CASROOT%\src\Textures"
+set "CSF_ShadersDirectory=%CASROOT%\src\Shaders"
+set "CSF_XSMessage=%CASROOT%\src\XSMessage"
+set "CSF_TObjMessage=%CASROOT%\src\TObj"
+set "CSF_StandardDefaults=%CASROOT%\src\StdResource"
+set "CSF_PluginDefaults=%CASROOT%\src\StdResource"
+set "CSF_XCAFDefaults=%CASROOT%\src\StdResource"
+set "CSF_TObjDefaults=%CASROOT%\src\StdResource"
+set "CSF_StandardLiteDefaults=%CASROOT%\src\StdResource"
+set "CSF_UnitsLexicon=%CASROOT%\src\UnitsAPI\Lexi_Expr.dat"
+set "CSF_UnitsDefinition=%CASROOT%\src\UnitsAPI\Units.dat"
+set "CSF_IGESDefaults=%CASROOT%\src\XSTEPResource"
+set "CSF_STEPDefaults=%CASROOT%\src\XSTEPResource"
+set "CSF_XmlOcafResource=%CASROOT%\src\XmlOcafResource"
+set "CSF_MIGRATION_TYPES=%CASROOT%\src\StdResource\MigrationSheet.txt"
+
+rem Draw Harness special stuff
+if exist "%CASROOT%\src\DrawResources" (
+  set "DRAWHOME=%CASROOT%\src\DrawResources"
+  set "CSF_DrawPluginDefaults=%CASROOT%\src\DrawResources"
+
+  if exist "%CASROOT%\src\DrawResources\DrawDefault" (
+    set "DRAWDEFAULT=%CASROOT%\src\DrawResources\DrawDefault"
+  )
+)
+
+if exist "%CASROOT%\src\DrawResourcesProducts" (
+  set "CSF_DrawPluginProductsDefaults=%CASROOT%\src\DrawResourcesProducts"
+)
+
diff --git a/adm/templates/env.build.sh.in b/adm/templates/env.build.sh.in
new file mode 100644 (file)
index 0000000..729835d
--- /dev/null
@@ -0,0 +1,119 @@
+#!/bin/bash
+
+aScriptPath=${BASH_SOURCE%/*}; if [ -d "${aScriptPath}" ]; then cd "$aScriptPath"; fi; aScriptPath="$PWD";
+
+export CASROOT="@CMAKE_SOURCE_DIR@"
+
+if [ "${CASROOT}" == "" ]; then
+  export CASROOT="${aScriptPath}"
+fi
+
+# Read script arguments
+shopt -s nocasematch
+export CASDEB="@BUILD_POSTFIX@";
+if [[ "$1" == "debug" ]]; then export CASDEB="d"; fi
+if [[ "$1" == "d" ]]; then export CASDEB="d"; fi
+shopt -u nocasematch
+
+export COMPILER="@COMPILER@"
+
+# ----- Set path to 3rd party and OCCT libraries -----
+anArch=`uname -m`
+if [ "$anArch" != "x86_64" ] && [ "$anArch" != "ia64" ]; then
+  export ARCH="32";
+else
+  export ARCH="64";
+fi
+
+aSystem=`uname -s`
+if [ "$aSystem" == "Darwin" ]; then
+  export WOKSTATION="mac";
+  export ARCH="64";
+else
+  export WOKSTATION="lin";
+fi
+
+# ----- Set local settings -----
+if [ -e "${aScriptPath}/custom.sh" ]; then
+  source "${aScriptPath}/custom.sh" "${COMPILER}" "${WOKSTATION}${ARCH}" "${CASDEB}"
+fi
+
+THRDPARTY_PATH=""
+if [ "$TCL_DIR" != "" ]; then
+  THRDPARTY_PATH="${TCL_DIR}:${THRDPARTY_PATH}"
+fi
+
+if [ "$FREETYPE_DIR" != "" ]; then
+  THRDPARTY_PATH="${FREETYPE_DIR}:${THRDPARTY_PATH}"
+fi
+
+if [ "$FREEIMAGE_DIR" != "" ]; then
+  THRDPARTY_PATH="${FREEIMAGE_DIR}:${THRDPARTY_PATH}"
+fi
+
+if [ "$GL2PS_DIR" != "" ]; then
+  THRDPARTY_PATH="${GL2PS_DIR}:${THRDPARTY_PATH}"
+fi
+
+if [ "$TBB_DIR" != "" ]; then
+  THRDPARTY_PATH="${TBB_DIR}:${THRDPARTY_PATH}"
+fi
+
+if [ "$VTK_DIR" != "" ]; then
+  THRDPARTY_PATH="${VTK_DIR}:${THRDPARTY_PATH}"
+fi
+
+BIN_PATH="${WOKSTATION}${ARCH}/${COMPILER}/bin${CASDEB}"
+LIBS_PATH="${WOKSTATION}${ARCH}/${COMPILER}/lib${CASDEB}"
+
+export PATH="@CMAKE_BINARY_DIR@/${BIN_PATH}:${PATH}"
+
+if [ "$LD_LIBRARY_PATH" != "" ]; then
+  export LD_LIBRARY_PATH="${CASROOT}/${LIBS_PATH}:${THRDPARTY_PATH}:${LD_LIBRARY_PATH}"
+else
+  export LD_LIBRARY_PATH="${CASROOT}/${LIBS_PATH}:${THRDPARTY_PATH}"
+fi
+
+if [ "$WOKSTATION" == "mac" ]; then
+  if [ "$DYLD_LIBRARY_PATH" != "" ]; then
+    export DYLD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${DYLD_LIBRARY_PATH}"
+  else
+    export DYLD_LIBRARY_PATH="${LD_LIBRARY_PATH}"
+  fi
+fi
+
+# ----- Set envoronment variables used by OCCT -----
+export CSF_LANGUAGE=us
+export MMGT_CLEAR=1
+export CSF_EXCEPTION_PROMPT=1
+export CSF_SHMessage="${CASROOT}/src/SHMessage"
+export CSF_MDTVTexturesDirectory="${CASROOT}/src/Textures"
+export CSF_ShadersDirectory="${CASROOT}/src/Shaders"
+export CSF_XSMessage="${CASROOT}/src/XSMessage"
+export CSF_TObjMessage="${CASROOT}/src/TObj"
+export CSF_StandardDefaults="${CASROOT}/src/StdResource"
+export CSF_PluginDefaults="${CASROOT}/src/StdResource"
+export CSF_XCAFDefaults="${CASROOT}/src/StdResource"
+export CSF_TObjDefaults="${CASROOT}/src/StdResource"
+export CSF_StandardLiteDefaults="${CASROOT}/src/StdResource"
+export CSF_UnitsLexicon="${CASROOT}/src/UnitsAPI/Lexi_Expr.dat"
+export CSF_UnitsDefinition="${CASROOT}/src/UnitsAPI/Units.dat"
+export CSF_IGESDefaults="${CASROOT}/src/XSTEPResource"
+export CSF_STEPDefaults="${CASROOT}/src/XSTEPResource"
+export CSF_XmlOcafResource="${CASROOT}/src/XmlOcafResource"
+export CSF_MIGRATION_TYPES="${CASROOT}/src/StdResource/MigrationSheet.txt"
+
+# Draw Harness special stuff
+if [ -e "${CASROOT}/src/DrawResources" ]; then
+  export DRAWHOME="${CASROOT}/src/DrawResources"
+  export CSF_DrawPluginDefaults="${CASROOT}/src/DrawResources"
+
+  if [ -e "${CASROOT}/src/DrawResources/DrawDefault" ]; then
+    export DRAWDEFAULT="${CASROOT}/src/DrawResources/DrawDefault"
+  fi
+fi
+
+if [ -e "${CASROOT}/src/DrawResourcesProducts" ]; then
+  export CSF_DrawPluginProductsDefaults="${CASROOT}/src/DrawResourcesProducts"
+fi
+
diff --git a/adm/templates/freeimage.cmake b/adm/templates/freeimage.cmake
deleted file mode 100644 (file)
index b1cbf34..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#freeimage
-
-THIRDPARTY_PRODUCT("FREEIMAGE" "FreeImage.h" "freeimage" "freeimaged")
\ No newline at end of file
diff --git a/adm/templates/freeimageplus.cmake b/adm/templates/freeimageplus.cmake
deleted file mode 100644 (file)
index 3afd905..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#freeimageplus
-
-if (WIN32)
-  if (3RDPARTY_FREEIMAGE_DIR AND NOT 3RDPARTY_FREEIMAGEPLUS_DIR)
-    set (3RDPARTY_FREEIMAGEPLUS_DIR "${3RDPARTY_FREEIMAGE_DIR}" CACHE PATH "The directory containing freeimageplus" FORCE)
-  endif()
-
-  THIRDPARTY_PRODUCT("FREEIMAGEPLUS" "FreeImagePlus.h" "freeimageplus" "freeimageplusd")
-endif()
\ No newline at end of file
diff --git a/adm/templates/freetype.cmake b/adm/templates/freetype.cmake
deleted file mode 100644 (file)
index 6f88830..0000000
+++ /dev/null
@@ -1,242 +0,0 @@
-# freetype
-
-if (NOT DEFINED INSTALL_FREETYPE)
-  set (INSTALL_FREETYPE OFF CACHE BOOL "Is freetype required to be copied into install directory")
-endif()
-
-if (NOT DEFINED 3RDPARTY_FREETYPE_DIR)
-  set (3RDPARTY_FREETYPE_DIR "" CACHE PATH "The directory containing freetype")
-endif()
-
-# store ENV{FREETYPE_DIR}
-SET (CACHED_FREETYPE_DIR $ENV{FREETYPE_DIR})
-
-# include occt macros. compiler_bitness, os_wiht_bit, compiler and build_postfix
-OCCT_INCLUDE_CMAKE_FILE ("adm/templates/occt_macros")
-
-OCCT_MAKE_COMPILER_SHORT_NAME()
-OCCT_MAKE_COMPILER_BITNESS()
-
-if (NOT ENV{FREETYPE_DIR})
-  # search for freetype in user defined directory
-  if (NOT 3RDPARTY_FREETYPE_DIR AND 3RDPARTY_DIR)
-    FIND_PRODUCT_DIR("${3RDPARTY_DIR}" FREETYPE FREETYPE_DIR_NAME)
-    if (FREETYPE_DIR_NAME)
-      set (3RDPARTY_FREETYPE_DIR "${3RDPARTY_DIR}/${FREETYPE_DIR_NAME}" CACHE PATH "The directory containing freetype" FORCE)
-    endif()
-  endif()
-
-  if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
-    set (ENV{FREETYPE_DIR} "${3RDPARTY_FREETYPE_DIR}")
-  endif()
-endif()
-
-if (NOT DEFINED 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build)
-  set (3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build  "" CACHE FILEPATH "the path of ft2build.h")
-endif()
-
-if (NOT DEFINED 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2)
-  set (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 "" CACHE FILEPATH "the path of freetype2")
-endif()
-
-if (NOT DEFINED 3RDPARTY_FREETYPE_LIBRARY OR NOT 3RDPARTY_FREETYPE_LIBRARY_DIR)
-  set (3RDPARTY_FREETYPE_LIBRARY               "" CACHE FILEPATH "freetype library")
-endif()
-
-if (NOT DEFINED 3RDPARTY_FREETYPE_LIBRARY_DIR)
-  set (3RDPARTY_FREETYPE_LIBRARY_DIR           "" CACHE FILEPATH "The directory containing freetype library")
-endif()
-
-if (WIN32)
-  if (NOT DEFINED 3RDPARTY_FREETYPE_DLL OR NOT 3RDPARTY_FREETYPE_DLL_DIR)
-    set (3RDPARTY_FREETYPE_DLL                   "" CACHE FILEPATH "freetype shared library")
-  endif()
-endif()
-
-if (WIN32)
-  if (NOT DEFINED 3RDPARTY_FREETYPE_DLL_DIR)
-    set (3RDPARTY_FREETYPE_DLL_DIR               "" CACHE FILEPATH "The directory containing freetype shared library")
-  endif()
-endif()
-
-message (STATUS "Info: CMake default freetype search start...")
-find_package(Freetype)
-message (STATUS "Info: CMake default freetype search end")
-
-# ft2build header
-if (FREETYPE_INCLUDE_DIR_ft2build AND EXISTS "${FREETYPE_INCLUDE_DIR_ft2build}")
-  if (NOT 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build)
-    set (3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build  "${FREETYPE_INCLUDE_DIR_ft2build}" CACHE FILEPATH "the path of ft2build.h" FORCE)
-  endif()
-endif()
-
-if (NOT FREETYPE_INCLUDE_DIR_freetype2 OR NOT EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}")
-  # cmake (version is < 3.0) doesn't find ftheader.h of freetype (version is >= 2.5.1)
-  # do search taking into account freetype structure of 2.5.1 version
-  message (STATUS "Info: CMake default search doesn't found FREETYPE_INCLUDE_DIR_freetype2")
-  find_path (FREETYPE_INCLUDE_DIR_freetype2 NAMES
-                                             freetype/config/ftheader.h
-                                             config/ftheader.h
-                                           HINTS
-                                             ENV FREETYPE_DIR
-                                           PATHS
-                                             /usr/X11R6
-                                             /usr/local/X11R6
-                                             /usr/local/X11
-                                             /usr/freeware
-                                           PATH_SUFFIXES include/freetype2 include freetype2
-                                           NO_DEFAULT_PATH)
-  find_path (FREETYPE_INCLUDE_DIR_freetype2 NAMES freetype/config/ftheader.h config/ftheader.h)
-  
-  if (NOT FREETYPE_INCLUDE_DIR_freetype2 OR NOT EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}")
-    message (STATUS "Info: FREETYPE_INCLUDE_DIR_freetype2 is NOT found by additional search")
-  else()
-    message (STATUS "Info: FREETYPE_INCLUDE_DIR_freetype2 is found by additional search")
-  endif()
-elseif (FREETYPE_INCLUDE_DIR_freetype2 OR EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}")
-  if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
-    get_filename_component (3RDPARTY_FREETYPE_DIR_ABS "${3RDPARTY_FREETYPE_DIR}" ABSOLUTE)
-    get_filename_component (FREETYPE_INCLUDE_DIR_freetype2_ABS "${FREETYPE_INCLUDE_DIR_freetype2}" ABSOLUTE)
-
-    string (REGEX MATCH "${3RDPARTY_FREETYPE_DIR_ABS}" DOES_PATH_CONTAIN "${FREETYPE_INCLUDE_DIR_freetype2_ABS}")
-
-    if (NOT DOES_PATH_CONTAIN) # if cmake found freetype2 at different place from 3RDPARTY_FREETYPE_DIR
-      # search for freetype2 in 3RDPARTY_FREETYPE_DIR and if it will be found - replace freetyp2 path by new one
-      set (TMP_FREETYPE2 "TMP_FREETYPE2-NOTFOUND" CACHE FILEPATH "" FORCE)
-      find_path (TMP_FREETYPE2 NAMES freetype/config/ftheader.h config/ftheader.h
-                               PATHS "${3RDPARTY_FREETYPE_DIR}"
-                               PATH_SUFFIXES include/freetype2 include freetype2
-                               NO_DEFAULT_PATH)
-
-      if (TMP_FREETYPE2 OR NOT EXISTS "${TMP_FREETYPE2}")
-        set (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 "${TMP_FREETYPE2}" CACHE FILEPATH "the path of freetype2" FORCE)
-        
-        # hide and remove TMP_FREETYPE2
-        mark_as_advanced (TMP_FREETYPE2)
-        unset (TMP_FREETYPE2)
-      endif()
-    endif()
-  endif()
-endif()
-
-# return ENV{FREETYPE_DIR}
-SET (ENV{FREETYPE_DIR} ${CACHED_FREETYPE_DIR})
-
-# freetype2 header
-if (FREETYPE_INCLUDE_DIR_freetype2 AND EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}")
-  if (NOT 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2)
-    set (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 "${FREETYPE_INCLUDE_DIR_freetype2}" CACHE FILEPATH "the path of freetype2" FORCE)
-  endif()
-endif()
-
-if (NOT 3RDPARTY_FREETYPE_LIBRARY_DIR)
-  set (3RDPARTY_FREETYPE_LIBRARY "" CACHE FILEPATH "freetype library" FORCE)
-elseif (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
-  get_filename_component(3RDPARTY_FREETYPE_LIBRARY_DIR_TMP "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
-  if (NOT "${3RDPARTY_FREETYPE_LIBRARY_DIR}" STREQUAL "${3RDPARTY_FREETYPE_LIBRARY_DIR_TMP}")
-    set (3RDPARTY_FREETYPE_LIBRARY "" CACHE FILEPATH "freetype library" FORCE)
-  endif()
-endif()
-
-if (WIN32)
-  if (NOT 3RDPARTY_FREETYPE_DLL_DIR)
-    set (3RDPARTY_FREETYPE_DLL "" CACHE FILEPATH "freetype shared library" FORCE)
-  elseif (3RDPARTY_FREETYPE_DLL AND EXISTS "${3RDPARTY_FREETYPE_DLL}")
-    get_filename_component(3RDPARTY_FREETYPE_DLL_DIR_TMP "${3RDPARTY_FREETYPE_DLL}" PATH)
-    if (NOT "${3RDPARTY_FREETYPE_DLL_DIR}" STREQUAL "${3RDPARTY_FREETYPE_DLL_DIR_TMP}")
-      set (3RDPARTY_FREETYPE_DLL "" CACHE FILEPATH "freetype shared library" FORCE)
-    endif()
-  endif()
-endif()
-
-# freetype library
-if (FREETYPE_LIBRARY AND EXISTS "${FREETYPE_LIBRARY}")
-  if (NOT 3RDPARTY_FREETYPE_LIBRARY)
-    set (3RDPARTY_FREETYPE_LIBRARY "${FREETYPE_LIBRARY}" CACHE FILEPATH "freetype library" FORCE)
-  endif()
-  
-  if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
-    get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
-    set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE FILEPATH "The directory containing freetype library" FORCE)
-  endif()
-
-  if (WIN32)
-    set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
-
-    if (NOT 3RDPARTY_FREETYPE_DLL OR NOT EXISTS "${3RDPARTY_FREETYPE_DLL}")
-      get_filename_component (FREETYPE_LIBRARY_PARENT_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" PATH) # parent of the library directory
-
-      set (3RDPARTY_FREETYPE_DLL "3RDPARTY_FREETYPE_DLL-NOTFOUND" CACHE FILEPATH "freetype shared library" FORCE)
-      find_library (3RDPARTY_FREETYPE_DLL freetype PATHS "${FREETYPE_LIBRARY_PARENT_DIR}/bin" NO_DEFAULT_PATH)
-    endif()
-    
-    if (3RDPARTY_FREETYPE_DLL AND EXISTS "${3RDPARTY_FREETYPE_DLL}")
-      get_filename_component (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL}" PATH)
-      set (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL_DIR}" CACHE FILEPATH "The directory containing freetype shared library" FORCE)
-    endif()
-  endif()
-endif()
-
-
-if (NOT 3RDPARTY_FREETYPE_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
-  set (3RDPARTY_FREETYPE_LIBRARY_DIR "" CACHE FILEPATH "The directory containing freetype library" FORCE)
-endif()
-
-if (WIN32)
-  if (NOT 3RDPARTY_FREETYPE_DLL_DIR OR NOT EXISTS "${3RDPARTY_FREETYPE_DLL_DIR}")
-    set (3RDPARTY_FREETYPE_DLL_DIR "" CACHE FILEPATH "The directory containing shared freetype library" FORCE)
-  endif()
-endif()
-
-# include found paths to common variables
-if (3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build)
-  list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build}")
-else()
-  list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build)
-endif()
-
-if (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2)
-  list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2}")
-else()
-  list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2)
-endif()
-
-if (3RDPARTY_FREETYPE_LIBRARY)
-  list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
-else()
-  list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_LIBRARY_DIR)
-endif()
-
-if (WIN32)
-  if (NOT 3RDPARTY_FREETYPE_DLL OR NOT EXISTS "${3RDPARTY_FREETYPE_DLL}")
-    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_DLL_DIR)
-  endif()
-endif()
-
-if (INSTALL_FREETYPE)
-
-  OCCT_MAKE_OS_WITH_BITNESS()
-  OCCT_MAKE_BUILD_POSTFIX()
-
-  if (WIN32)
-    install (FILES "${3RDPARTY_FREETYPE_DLL}"     DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BUILD_POSTFIX}")
-  else()
-    install (FILES "${3RDPARTY_FREETYPE_LIBRARY}" DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BUILD_POSTFIX}")
-  endif()
-
-  set (USED_3RDPARTY_FREETYPE_DIR "")
-else()
-  # the library directory for using by the executable
-  if (WIN32)
-    set (USED_3RDPARTY_FREETYPE_DIR ${3RDPARTY_FREETYPE_DLL_DIR})
-  else()
-    set (USED_3RDPARTY_FREETYPE_DIR ${3RDPARTY_FREETYPE_LIBRARY_DIR})
-  endif()
-endif()
-
-# unset all redundant variables
-OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_ft2build)
-OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_freetype2)
-OCCT_CHECK_AND_UNSET(FREETYPE_LIBRARY)
-
-mark_as_advanced (3RDPARTY_FREETYPE_LIBRARY 3RDPARTY_FREETYPE_DLL)
\ No newline at end of file
diff --git a/adm/templates/gl2ps.cmake b/adm/templates/gl2ps.cmake
deleted file mode 100644 (file)
index d9d59ec..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#GL2PS
-
-THIRDPARTY_PRODUCT("GL2PS" "gl2ps.h" "gl2ps" "gl2psd")
\ No newline at end of file
diff --git a/adm/templates/glx.cmake b/adm/templates/glx.cmake
deleted file mode 100644 (file)
index 2965557..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# glx
-
-THIRDPARTY_PRODUCT("GLX" "GL/glx.h" "GL" "GLd")
\ No newline at end of file
diff --git a/adm/templates/occt_defs_flags.cmake b/adm/templates/occt_defs_flags.cmake
deleted file mode 100644 (file)
index 9dd5574..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-
-if (MSVC)
-  add_definitions(/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)
-    add_definitions(/arch:SSE2)
-  endif()
-endif()
-
-add_definitions (-DCSFDB)
-if (WIN32)
-  add_definitions (/DWNT -wd4996)
-elseif (APPLE)
-  add_definitions (-fexceptions -fPIC -DOCC_CONVERT_SIGNALS -DHAVE_WOK_CONFIG_H -DHAVE_CONFIG_H)
-else()
-  add_definitions (-fexceptions -fPIC -DOCC_CONVERT_SIGNALS -DHAVE_WOK_CONFIG_H -DHAVE_CONFIG_H -DLIN)
-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 (WIN32)
-  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -EHa")
-endif()
-
-# remove DEBUG flag if it exists
-string (REGEX MATCH "-DDEBUG" IS_DEBUG_CXX "${CMAKE_CXX_FLAGS_DEBUG}")
-if (IS_DEBUG_CXX)
-  message (STATUS "-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 "-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, -Wall 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)
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
-endif()
-
-set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNo_Exception")
-set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNo_Exception")
-
-set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEB")
-set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEB")
\ No newline at end of file
diff --git a/adm/templates/occt_macros.cmake b/adm/templates/occt_macros.cmake
deleted file mode 100644 (file)
index 2492316..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-#
-
-macro (OCCT_CHECK_AND_UNSET VARNAME)
-  if (DEFINED ${VARNAME})
-    unset (${VARNAME} CACHE)
-  endif()
-endmacro()
-
-macro (OCCT_CHECK_AND_UNSET_GROUP VARNAME)
-  OCCT_CHECK_AND_UNSET ("${VARNAME}_DIR")
-
-  OCCT_CHECK_AND_UNSET ("${VARNAME}_INCLUDE_DIR")
-
-  OCCT_CHECK_AND_UNSET ("${VARNAME}_LIBRARY")
-  OCCT_CHECK_AND_UNSET ("${VARNAME}_LIBRARY_DIR")
-
-  OCCT_CHECK_AND_UNSET ("${VARNAME}_DLL")
-  OCCT_CHECK_AND_UNSET ("${VARNAME}_DLL_DIR")
-endmacro()
-
-# BUILD_POSTFIX, IS_BUILD_DEBUG variables
-macro (OCCT_MAKE_BUILD_POSTFIX)
-  if ("${BUILD_CONFIGURATION}" STREQUAL "Debug")
-    set (BUILD_POSTFIX "d")
-    set (IS_BUILD_DEBUG "")
-  else()
-    set (BUILD_POSTFIX "")
-    OCCT_CHECK_AND_UNSET (IS_BUILD_DEBUG)
-  endif()
-endmacro()
-
-# COMPILER_BITNESS variable
-macro (OCCT_MAKE_COMPILER_BITNESS)
-  math (EXPR COMPILER_BITNESS "32 + 32*(${CMAKE_SIZEOF_VOID_P}/8)")
-endmacro()
-
-# OS_WITH_BIT
-macro (OCCT_MAKE_OS_WITH_BITNESS)
-
-  OCCT_MAKE_COMPILER_BITNESS()
-
-  if (WIN32)
-    set (OS_WITH_BIT "win${COMPILER_BITNESS}")
-  elseif(APPLE)
-    set (OS_WITH_BIT "mac${COMPILER_BITNESS}")
-  else()
-    set (OS_WITH_BIT "lin${COMPILER_BITNESS}")
-  endif()
-endmacro()
-
-# COMPILER variable
-macro (OCCT_MAKE_COMPILER_SHORT_NAME)
-  if (MSVC)
-    if (MSVC70)
-      set (COMPILER vc7)
-    elseif (MSVC80)
-      set (COMPILER vc8)
-    elseif (MSVC90)
-      set (COMPILER vc9)
-    elseif (MSVC10)
-      set (COMPILER vc10)
-    elseif (MSVC11)
-      set (COMPILER vc11)
-    elseif (MSVC12)
-      set (COMPILER vc12)
-    endif()
-  elseif (DEFINED CMAKE_COMPILER_IS_GNUCC)
-    set (COMPILER gcc)
-  elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
-    set (COMPILER gxx)
-  elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
-    set (COMPILER clang)
-  elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
-    set (COMPILER icc)
-  else()
-    set (COMPILER ${CMAKE_GENERATOR})
-    string (REGEX REPLACE " " "" COMPILER ${COMPILER})
-  endif()
-endmacro()
-
-function (SUBDIRECTORY_NAMES MAIN_DIRECTORY RESULT)
-  file (GLOB SUB_ITEMS "${MAIN_DIRECTORY}/*")
-
-  foreach (ITEM ${SUB_ITEMS})
-    if (IS_DIRECTORY "${ITEM}")
-      get_filename_component (ITEM_NAME "${ITEM}" NAME)
-      list (APPEND LOCAL_RESULT "${ITEM_NAME}")
-    endif()
-  endforeach()
-  set (${RESULT} ${LOCAL_RESULT} PARENT_SCOPE)
-endfunction()
-
-function (FIND_PRODUCT_DIR ROOT_DIR PRODUCT_NAME RESULT)
-  OCCT_MAKE_COMPILER_SHORT_NAME()
-  OCCT_MAKE_COMPILER_BITNESS()
-
-  string (TOLOWER "${PRODUCT_NAME}" lower_PRODUCT_NAME)
-
-  list (APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*${COMPILER}.*${COMPILER_BITNESS}")
-  list (APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*[0-9.]+.*${COMPILER}.*${COMPILER_BITNESS}")
-  list (APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*[0-9.]+.*${COMPILER_BITNESS}")
-  list (APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*[0-9.]+")
-  list (APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}")
-
-  SUBDIRECTORY_NAMES ("${ROOT_DIR}" SUBDIR_NAME_LIST)
-
-  foreach (SEARCH_TEMPLATE ${SEARCH_TEMPLATES})
-    if (LOCAL_RESULT)
-      BREAK()
-    endif()
-
-    foreach (SUBDIR_NAME ${SUBDIR_NAME_LIST})
-      string (TOLOWER "${SUBDIR_NAME}" lower_SUBDIR_NAME)
-
-      string (REGEX MATCH "${SEARCH_TEMPLATE}" DUMMY_VAR "${lower_SUBDIR_NAME}")
-      if (DUMMY_VAR)
-        list (APPEND LOCAL_RESULT ${SUBDIR_NAME})
-      endif()
-    endforeach()
-  endforeach()
-
-  if (LOCAL_RESULT)
-    list (LENGTH "${LOCAL_RESULT}" LOC_LEN)
-    math (EXPR LAST_ELEMENT_INDEX "${LOC_LEN}-1")
-    list (GET LOCAL_RESULT ${LAST_ELEMENT_INDEX} DUMMY)
-    set (${RESULT} ${DUMMY} PARENT_SCOPE)
-  endif()
-endfunction()
-
-macro (OCCT_INSTALL_FILE_OR_DIR BEING_INSTALLED_OBJECT DESTINATION_PATH)
-  if (BUILD_PATCH_DIR AND EXISTS "${BUILD_PATCH_DIR}/${BEING_INSTALLED_OBJECT}")
-    if (IS_DIRECTORY "${BUILD_PATCH_DIR}/${BEING_INSTALLED_OBJECT}")
-      # first of all, install original files
-      install (DIRECTORY "${CMAKE_SOURCE_DIR}/${BEING_INSTALLED_OBJECT}" DESTINATION  "${DESTINATION_PATH}")
-
-      # secondly, rewrite original files with patched ones
-      install (DIRECTORY "${BUILD_PATCH_DIR}/${BEING_INSTALLED_OBJECT}" DESTINATION  "${DESTINATION_PATH}")
-    else()
-      install (FILES     "${BUILD_PATCH_DIR}/${BEING_INSTALLED_OBJECT}" DESTINATION  "${DESTINATION_PATH}")
-    endif()
-  else()
-    if (IS_DIRECTORY "${CMAKE_SOURCE_DIR}/${BEING_INSTALLED_OBJECT}")
-      install (DIRECTORY "${CMAKE_SOURCE_DIR}/${BEING_INSTALLED_OBJECT}" DESTINATION  "${DESTINATION_PATH}")
-    else()
-      install (FILES     "${CMAKE_SOURCE_DIR}/${BEING_INSTALLED_OBJECT}" DESTINATION  "${DESTINATION_PATH}")
-    endif()
-  endif()
-endmacro()
-
-macro (OCCT_CONFIGURE_AND_INSTALL BEING_CONGIRUGED_FILE FINAL_NAME DESTINATION_PATH)
-  if (BUILD_PATCH_DIR AND EXISTS "${BUILD_PATCH_DIR}/${BEING_CONGIRUGED_FILE}")
-    configure_file("${BUILD_PATCH_DIR}/${BEING_CONGIRUGED_FILE}" "${FINAL_NAME}" @ONLY)
-  else()
-    configure_file("${CMAKE_SOURCE_DIR}/${BEING_CONGIRUGED_FILE}" "${FINAL_NAME}" @ONLY)
-  endif()
-
-  install(FILES "${OCCT_BINARY_DIR}/${FINAL_NAME}" DESTINATION  "${DESTINATION_PATH}")
-endmacro()
-
-function (OCCT_IS_PRODUCT_REQUIRED CSF_VAR_NAME USE_PRODUCT)
-  set (${USE_PRODUCT} OFF PARENT_SCOPE)
-  
-  if (NOT USED_TOOLKITS)
-    message(STATUS "Warning: the list of being used toolkits is empty")
-  else()
-    foreach (USED_TOOLKIT ${USED_TOOLKITS})
-      if (BUILD_PATCH_DIR AND EXISTS "${BUILD_PATCH_DIR}/src/${USED_TOOLKIT}/EXTERNLIB")
-        file (READ "${BUILD_PATCH_DIR}/src/${USED_TOOLKIT}/EXTERNLIB" FILE_CONTENT)
-      elseif (EXISTS "${CMAKE_SOURCE_DIR}/src/${USED_TOOLKIT}/EXTERNLIB")
-        file (READ "${CMAKE_SOURCE_DIR}/src/${USED_TOOLKIT}/EXTERNLIB" FILE_CONTENT)
-      endif()
-
-      string (REGEX MATCH "${CSF_VAR_NAME}" DOES_FILE_CONTAIN "${FILE_CONTENT}")
-
-      if (DOES_FILE_CONTAIN)
-        set (${USE_PRODUCT} ON PARENT_SCOPE)
-        break()
-      endif()
-    endforeach()
-  endif()
-endfunction()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/adm/templates/opencl.cmake b/adm/templates/opencl.cmake
deleted file mode 100644 (file)
index 59bcbcd..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#OpenCl
-
-SET (3RDPARTY_OPENCL_ADDITIONAL_PATH_FOR_HEADER $ENV{AMDAPPSDKROOT}/include
-                                                  $ENV{INTELOCLSDKROOT}/include
-                                                  $ENV{NVSDKCOMPUTE_ROOT}/OpenCL/common/inc
-                                                  $ENV{ATISTREAMSDKROOT}/include)
-
-
-IF(${COMPILER_BITNESS} STREQUAL 32)
-  SET (3RDPARTY_OPENCL_ADDITIONAL_PATH_FOR_LIB $ENV{AMDAPPSDKROOT}/lib/x86
-                                               $ENV{INTELOCLSDKROOT}/lib/x86
-                                               $ENV{NVSDKCOMPUTE_ROOT}/OpenCL/common/lib/Win32
-                                               $ENV{ATISTREAMSDKROOT}/lib/x86)
-ELSEIF(${COMPILER_BITNESS} STREQUAL 64)
-  SET (3RDPARTY_OPENCL_ADDITIONAL_PATH_FOR_LIB $ENV{AMDAPPSDKROOT}/lib/x86_64
-                                               $ENV{INTELOCLSDKROOT}/lib/x64
-                                               $ENV{NVSDKCOMPUTE_ROOT}/OpenCL/common/lib/x64
-                                               $ENV{ATISTREAMSDKROOT}/lib/x86_64)
-ENDIF()
-
-THIRDPARTY_PRODUCT("OPENCL" "CL/cl.h" "OpenCL" "OpenCLd")
-
-# if CL/cl.h isn't found (and 3RDPARTY_OPENCL_INCLUDE_DIR isn't defined)
-# then try to find OpenCL/cl.h (all other variable won't be changed)
-IF(NOT 3RDPARTY_OPENCL_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_OPENCL_INCLUDE_DIR}")
-  THIRDPARTY_PRODUCT("OPENCL" "OpenCL/cl.h" "OpenCL" "OpenCLd")
-ENDIF()
\ No newline at end of file
diff --git a/adm/templates/tbb.cmake b/adm/templates/tbb.cmake
deleted file mode 100644 (file)
index 7b7da7b..0000000
+++ /dev/null
@@ -1,250 +0,0 @@
-# tbb
-
-OCCT_MAKE_BUILD_POSTFIX()
-
-if (NOT DEFINED INSTALL_TBB)
-  set (INSTALL_TBB OFF CACHE BOOL "Is tbb required to be copied into install directory")
-endif()
-
-# tbb directory
-if (NOT DEFINED 3RDPARTY_TBB_DIR)
-  set (3RDPARTY_TBB_DIR "" CACHE PATH "The directory containing tbb")
-endif()
-
-# tbb include directory
-if (NOT DEFINED 3RDPARTY_TBB_INCLUDE_DIR)
-  set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of the tbb")
-endif()
-
-# tbb library file (with absolute path)
-if (NOT DEFINED 3RDPARTY_TBB_LIBRARY OR NOT 3RDPARTY_TBB_LIBRARY_DIR)
-  set (3RDPARTY_TBB_LIBRARY "" CACHE FILEPATH "tbb library" FORCE)
-endif()
-
-# tbb library directory
-if (NOT DEFINED 3RDPARTY_TBB_LIBRARY_DIR)
-  set (3RDPARTY_TBB_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tbb library")
-endif()
-
-# tbb malloc library file (with absolute path)
-if (NOT DEFINED 3RDPARTY_TBBMALLOC_LIBRARY OR NOT 3RDPARTY_TBBMALLOC_LIBRARY_DIR)
-  set (3RDPARTY_TBBMALLOC_LIBRARY "" CACHE FILEPATH "tbb malloc library" FORCE)
-endif()
-
-# tbb malloc library directory
-if (NOT DEFINED 3RDPARTY_TBBMALLOC_LIBRARY_DIR)
-  set (3RDPARTY_TBBMALLOC_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tbb malloc library")
-endif()
-
-# tbb shared library (with absolute path)
-if (WIN32)
-  if (NOT DEFINED 3RDPARTY_TBB_DLL OR NOT 3RDPARTY_TBB_DLL_DIR)
-    set (3RDPARTY_TBB_DLL "" CACHE FILEPATH "tbb shared library" FORCE)
-  endif()
-endif()
-
-# tbb shared library directory
-if (WIN32 AND NOT DEFINED 3RDPARTY_TBB_DLL_DIR)
-  set (3RDPARTY_TBB_DLL_DIR "" CACHE FILEPATH "The directory containing tbb shared library")
-endif()
-
-# tbb malloc shared library (with absolute path)
-if (WIN32)
-  if (NOT DEFINED 3RDPARTY_TBBMALLOC_DLL OR NOT 3RDPARTY_TBBMALLOC_DLL_DIR)
-    set (3RDPARTY_TBBMALLOC_DLL "" CACHE FILEPATH "tbb malloc shared library" FORCE)
-  endif()
-endif()
-
-# tbb malloc shared library directory
-if (NOT DEFINED 3RDPARTY_TBBMALLOC_DLL_DIR)
-  set (3RDPARTY_TBBMALLOC_DLL_DIR "" CACHE FILEPATH "The directory containing tbb malloc shared library")
-endif()
-
-# include occt macros. compiler_bitness, os_wiht_bit, compiler and build_postfix
-OCCT_INCLUDE_CMAKE_FILE ("adm/templates/occt_macros")
-
-# search for product directory inside 3RDPARTY_DIR directory
-if (NOT 3RDPARTY_TBB_DIR AND 3RDPARTY_DIR)
-  FIND_PRODUCT_DIR ("${3RDPARTY_DIR}" "TBB" TBB_DIR_NAME)
-  if (TBB_DIR_NAME)
-    message (STATUS "Info: TBB: ${TBB_DIR_NAME} folder is used")
-    set (3RDPARTY_TBB_DIR "${3RDPARTY_DIR}/${TBB_DIR_NAME}" CACHE PATH "The directory containing tbb" FORCE)
-  endif()
-endif()
-
-OCCT_MAKE_COMPILER_BITNESS()
-
-if (${COMPILER_BITNESS} STREQUAL 32)
-  set (TBB_ARCH_NAME ia32)
-else()
-  set (TBB_ARCH_NAME intel64)
-endif()
-
-# search for include directory in defined 3rdparty directory
-if (NOT 3RDPARTY_TBB_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_TBB_INCLUDE_DIR}")
-  set (3RDPARTY_TBB_INCLUDE_DIR "3RDPARTY_TBB_INCLUDE_DIR-NOTFOUND" CACHE FILEPATH "The directory containing the headers of tbb" FORCE)
-  find_path (3RDPARTY_TBB_INCLUDE_DIR tbb/tbb.h PATHS "${3RDPARTY_TBB_DIR}/include")
-endif()
-
-if (NOT 3RDPARTY_TBB_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_TBB_INCLUDE_DIR}")
-  set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE FILEPATH "The directory containing the headers of tbb" FORCE)
-endif()
-
-OCCT_MAKE_COMPILER_SHORT_NAME()
-
-# TBB_COMPILER_FOLER
-#if (WIN32)
-  set (TBB_COMPILER_FOLER ${COMPILER})
-#else()
-#  set (TBB_COMPILER_FOLER ${COMPILER})
-#endif()
-
-OCCT_MAKE_BUILD_POSTFIX()
-
-# search for tbb and tbb malloc library in defined 3rdparty directory
-foreach (LIBRARY_NAME TBB TBBMALLOC)
-  if (NOT 3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR)
-    set (3RDPARTY_${LIBRARY_NAME}_LIBRARY "" CACHE FILEPATH "${LIBRARY_NAME} library" FORCE)
-  elseif (3RDPARTY_${LIBRARY_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${LIBRARY_NAME}_LIBRARY}")
-    get_filename_component(3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR_TMP "${3RDPARTY_${LIBRARY_NAME}_LIBRARY}" PATH)
-    if (NOT "${3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR}" STREQUAL "${3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR_TMP}")
-      set (3RDPARTY_${LIBRARY_NAME}_LIBRARY "" CACHE FILEPATH "${LIBRARY_NAME} library" FORCE)
-    endif()
-  endif()
-
-  if (NOT 3RDPARTY_${LIBRARY_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${LIBRARY_NAME}_LIBRARY}")
-    set (3RDPARTY_${LIBRARY_NAME}_LIBRARY "3RDPARTY_${LIBRARY_NAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "Path to library of ${LIBRARY_NAME}" FORCE)
-
-    # first of all, search for debug version of a library if build type is debug
-    if (DEFINED IS_BUILD_DEBUG)
-      find_library (3RDPARTY_${LIBRARY_NAME}_LIBRARY ${LIBRARY_NAME}_debug
-                                                     PATHS
-                                                      "${3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR}"
-                                                      "${3RDPARTY_TBB_DIR}/libd/${TBB_ARCH_NAME}/${TBB_COMPILER_FOLER}"
-                                                      "${3RDPARTY_TBB_DIR}/lib/${TBB_ARCH_NAME}/${TBB_COMPILER_FOLER}"
-                                                     NO_DEFAULT_PATH)
-
-      # second search if previous one do not find anything
-      find_library (3RDPARTY_${LIBRARY_NAME}_LIBRARY ${LIBRARY_NAME}_debug)
-    endif()
-
-    # if build type is release or debug version of library isn't found - search for release version of one
-    if (NOT 3RDPARTY_${LIBRARY_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${LIBRARY_NAME}_LIBRARY}")
-      set (3RDPARTY_${LIBRARY_NAME}_LIBRARY "3RDPARTY_${LIBRARY_NAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "Path to library of ${LIBRARY_NAME}" FORCE)
-
-      if (DEFINED IS_BUILD_DEBUG)
-        message (STATUS "Warning: debug version of ${LIBRARY_NAME} library isn't found (${LIBRARY_NAME}_debug) in ${3RDPARTY_TBB_DIR}/lib(d). Search for release one")
-      endif()
-
-      find_library (3RDPARTY_${LIBRARY_NAME}_LIBRARY ${LIBRARY_NAME}
-                                                     PATHS
-                                                      "${3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR}"
-                                                      "${3RDPARTY_TBB_DIR}/lib/${TBB_ARCH_NAME}/${TBB_COMPILER_FOLER}"
-                                                     NO_DEFAULT_PATH)
-
-      # second search if previous one do not find anything
-      find_library (3RDPARTY_${LIBRARY_NAME}_LIBRARY ${LIBRARY_NAME})
-    endif()
-  endif()
-
-  if (NOT 3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR}")
-    get_filename_component(3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${LIBRARY_NAME}_LIBRARY}" PATH)
-    set (3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR}" CACHE FILEPATH "The directory containing ${LIBRARY_NAME} library" FORCE)
-  endif()
-
-  # search for dll in defined 3rdparty directory (just for win case)
-  if (WIN32)
-    set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
-    
-    if (NOT 3RDPARTY_${LIBRARY_NAME}_DLL_DIR)
-      set (3RDPARTY_${LIBRARY_NAME}_DLL "" CACHE FILEPATH "${LIBRARY_NAME} shared library" FORCE)
-    elseif (3RDPARTY_${LIBRARY_NAME}_DLL AND EXISTS "${3RDPARTY_${LIBRARY_NAME}_DLL}")
-      get_filename_component(3RDPARTY_${LIBRARY_NAME}_DLL_DIR_TMP "${3RDPARTY_${LIBRARY_NAME}_DLL}" PATH)
-      if (NOT "${3RDPARTY_${LIBRARY_NAME}_DLL_DIR}" STREQUAL "${3RDPARTY_${LIBRARY_NAME}_DLL_DIR_TMP}")
-        set (3RDPARTY_${LIBRARY_NAME}_DLL "" CACHE FILEPATH "${LIBRARY_NAME} shared library" FORCE)
-      endif()
-    endif()
-
-    if (NOT 3RDPARTY_${LIBRARY_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${LIBRARY_NAME}_DLL}")
-      set (3RDPARTY_${LIBRARY_NAME}_DLL "3RDPARTY_${LIBRARY_NAME}_DLL-NOTFOUND" CACHE FILEPATH "Path to shared library of ${LIBRARY_NAME}" FORCE)
-
-      if (DEFINED IS_BUILD_DEBUG)
-        find_library (3RDPARTY_${LIBRARY_NAME}_DLL ${LIBRARY_NAME}_debug
-                                       PATHS
-                                        "${3RDPARTY_${LIBRARY_NAME}_DLL_DIR}"
-                                        "${3RDPARTY_TBB_DIR}/bind/${TBB_ARCH_NAME}/${TBB_COMPILER_FOLER}"
-                                        "${3RDPARTY_TBB_DIR}/bin/${TBB_ARCH_NAME}/${TBB_COMPILER_FOLER}"
-                                       NO_DEFAULT_PATH)
-
-        # second search if previous one do not find anything
-        find_library (3RDPARTY_${LIBRARY_NAME}_DLL ${LIBRARY_NAME}_debug)
-      endif()
-
-      if (NOT 3RDPARTY_${LIBRARY_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${LIBRARY_NAME}_DLL}")
-        set (3RDPARTY_${LIBRARY_NAME}_DLL "3RDPARTY_${LIBRARY_NAME}_DLL-NOTFOUND" CACHE FILEPATH "Path to shared library of ${LIBRARY_NAME}" FORCE)
-
-        if (DEFINED IS_BUILD_DEBUG)
-          message (STATUS "Warning: debug version of ${LIBRARY_NAME} dll isn't found (${LIBRARY_NAME}_debug) in ${3RDPARTY_TBB_DIR}/bin(d). Search for release one")
-        endif()
-
-        find_library (3RDPARTY_${LIBRARY_NAME}_DLL ${LIBRARY_NAME}
-                                                   PATHS
-                                                    "${3RDPARTY_${LIBRARY_NAME}_DLL_DIR}"
-                                                    "${3RDPARTY_TBB_DIR}/bin/${TBB_ARCH_NAME}/${TBB_COMPILER_FOLER}"
-                                                   NO_DEFAULT_PATH)
-
-        # second search if previous one do not find anything
-        find_library (3RDPARTY_${LIBRARY_NAME}_DLL ${LIBRARY_NAME})
-      endif()
-    endif()
-    
-    if (NOT 3RDPARTY_${LIBRARY_NAME}_DLL_DIR OR NOT EXISTS "${3RDPARTY_${LIBRARY_NAME}_DLL_DIR}")
-      get_filename_component(3RDPARTY_${LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${LIBRARY_NAME}_DLL}" PATH)
-      set (3RDPARTY_${LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${LIBRARY_NAME}_DLL_DIR}" CACHE FILEPATH "The directory containing ${LIBRARY_NAME} shared library" FORCE)
-    endif()
-  endif() # end dll search
-endforeach() # end tbb / tbbmalloc
-
-# include found paths to common variables
-if (3RDPARTY_TBB_INCLUDE_DIR AND EXISTS "${3RDPARTY_TBB_INCLUDE_DIR}")
-  list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TBB_INCLUDE_DIR}")
-else()
-  list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_INCLUDE_DIR)
-endif()
-
-foreach (LIBRARY_NAME TBB TBBMALLOC)
-  if (3RDPARTY_${LIBRARY_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${LIBRARY_NAME}_LIBRARY}")
-    list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR}")
-  else()
-    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${LIBRARY_NAME}_LIBRARY_DIR)
-  endif()
-
-  if (WIN32)
-    if (NOT 3RDPARTY_${LIBRARY_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${LIBRARY_NAME}_DLL}")
-      list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${LIBRARY_NAME}_DLL_DIR)
-    endif()
-  endif()
-endforeach()
-
-# install tbb
-if (INSTALL_TBB)
-  OCCT_MAKE_OS_WITH_BITNESS()
-  OCCT_MAKE_COMPILER_SHORT_NAME()
-
-  if (WIN32)
-    install (FILES ${3RDPARTY_TBB_DLL} ${3RDPARTY_TBBMALLOC_DLL} DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BUILD_POSTFIX}")
-  else()
-    install (FILES ${3RDPARTY_TBB_LIBRARY} ${3RDPARTY_TBBMALLOC_LIBRARY} DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BUILD_POSTFIX}")
-  endif()
-
-  set (USED_3RDPARTY_TBB_DIR "")
-else()
-  # the library directory for using by the executable
-  if (WIN32)
-    set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_DLL_DIR})
-  else()
-    set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR})
-  endif()
-endif()
-
-mark_as_advanced (3RDPARTY_TBB_LIBRARY 3RDPARTY_TBBMALLOC_LIBRARY 3RDPARTY_TBB_DLL 3RDPARTY_TBBMALLOC_DLL)
diff --git a/adm/templates/tcl.cmake b/adm/templates/tcl.cmake
deleted file mode 100644 (file)
index b5306f8..0000000
+++ /dev/null
@@ -1,342 +0,0 @@
-# tcl
-
-if (NOT DEFINED INSTALL_TCL)
-  set (INSTALL_TCL OFF CACHE BOOL "Is tcl lib required to be copied into install directory")
-endif()
-
-# tcl directory
-if (NOT DEFINED 3RDPARTY_TCL_DIR)
-  set (3RDPARTY_TCL_DIR "" CACHE PATH "The directory containing tcl")
-endif()
-
-# tcl include directory
-if (NOT DEFINED 3RDPARTY_TCL_INCLUDE_DIR)
-  set (3RDPARTY_TCL_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of tcl")
-endif()
-
-# tk include directory
-if (NOT DEFINED 3RDPARTY_TK_INCLUDE_DIR)
-  set (3RDPARTY_TK_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of tk")
-endif()
-
-# tcl library file (with absolute path)
-if (NOT DEFINED 3RDPARTY_TCL_LIBRARY OR NOT 3RDPARTY_TCL_LIBRARY_DIR)
-  set (3RDPARTY_TCL_LIBRARY "" CACHE FILEPATH "tcl library"  FORCE)
-endif()
-
-# tcl library directory
-if (NOT DEFINED 3RDPARTY_TCL_LIBRARY_DIR)
-  set (3RDPARTY_TCL_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tcl library")
-endif()
-
-# tk library file (with absolute path)
-if (NOT DEFINED 3RDPARTY_TK_LIBRARY OR NOT 3RDPARTY_TK_LIBRARY_DIR)
-  set (3RDPARTY_TK_LIBRARY "" CACHE FILEPATH "tk library" FORCE)
-endif()
-
-# tk library directory
-if (NOT DEFINED 3RDPARTY_TK_LIBRARY_DIR)
-  set (3RDPARTY_TK_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tk library")
-endif()
-
-# tcl shared library (with absolute path)
-if (WIN32)
-  if (NOT DEFINED 3RDPARTY_TCL_DLL OR NOT 3RDPARTY_TCL_DLL_DIR)
-    set (3RDPARTY_TCL_DLL "" CACHE FILEPATH "tcl shared library" FORCE)
-  endif()
-endif()
-
-# tcl shared library directory
-if (WIN32 AND NOT DEFINED 3RDPARTY_TCL_DLL_DIR)
-  set (3RDPARTY_TCL_DLL_DIR "" CACHE FILEPATH "The directory containing tcl shared library")
-endif()
-
-# tk shared library (with absolute path)
-if (WIN32)
-  if (NOT DEFINED 3RDPARTY_TK_DLL OR NOT 3RDPARTY_TK_DLL_DIR)
-    set (3RDPARTY_TK_DLL "" CACHE FILEPATH "tk shared library" FORCE)
-  endif()
-endif()
-
-# tk shared library directory
-if (WIN32 AND NOT DEFINED 3RDPARTY_TK_DLL_DIR)
-  set (3RDPARTY_TK_DLL_DIR "" CACHE FILEPATH "The directory containing tk shared library")
-endif()
-
-# search for tcl in user defined directory
-if (NOT 3RDPARTY_TCL_DIR AND 3RDPARTY_DIR)
-  FIND_PRODUCT_DIR("${3RDPARTY_DIR}" tcl TCL_DIR_NAME)
-  if (TCL_DIR_NAME)
-    set (3RDPARTY_TCL_DIR "${3RDPARTY_DIR}/${TCL_DIR_NAME}" CACHE PATH "The directory containing tcl" FORCE)
-  endif()
-endif()
-
-# define paths for default engine
-if (3RDPARTY_TCL_DIR AND EXISTS "${3RDPARTY_TCL_DIR}")
-  set (TCL_INCLUDE_PATH "${3RDPARTY_TCL_DIR}/include")
-endif()
-
-# check tcl/tk include dir, library dir and shared library dir
-macro (DIR_SUBDIR_FILE_FIT LIBNAME)
-  if (3RDPARTY_TCL_DIR AND EXISTS "${3RDPARTY_TCL_DIR}")
-    # tcl/tk include dir
-    if (3RDPARTY_${LIBNAME}_INCLUDE_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_INCLUDE_DIR}")
-      string (REGEX MATCH "${3RDPARTY_TCL_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_INCLUDE_DIR}")
-      if (NOT DOES_PATH_CONTAIN)
-        set (3RDPARTY_${LIBNAME}_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of ${LIBNAME}" FORCE)
-      endif()
-    else()
-      set (3RDPARTY_${LIBNAME}_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of ${LIBNAME}" FORCE)
-    endif()
-    
-    # tcl/tk library dir
-    if (3RDPARTY_${LIBNAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
-      
-      string (REGEX MATCH "${3RDPARTY_TCL_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
-      if (NOT DOES_PATH_CONTAIN)
-        set (3RDPARTY_${LIBNAME}_LIBRARY_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} library" FORCE)
-      endif()
-    else()
-      set (3RDPARTY_${LIBNAME}_LIBRARY_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} library" FORCE)
-    endif()
-
-    # tcl/tk shared library dir
-    if (WIN32)
-      if (3RDPARTY_${LIBNAME}_DLL_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_DLL_DIR}")
-        string (REGEX MATCH "${3RDPARTY_TCL_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_DLL_DIR}")
-        if (NOT DOES_PATH_CONTAIN)
-          set (3RDPARTY_${LIBNAME}_DLL_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} shared library" FORCE)
-        endif()
-      else()
-        set (3RDPARTY_${LIBNAME}_DLL_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} shared library" FORCE)
-      endif()
-    endif()
-  endif()
-
-  # check tcl/tk library
-  if (3RDPARTY_${LIBNAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
-    if (3RDPARTY_${LIBNAME}_LIBRARY AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY}")
-      string (REGEX MATCH "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_LIBRARY}")
-
-      if (NOT DOES_PATH_CONTAIN)
-        set (3RDPARTY_${LIBNAME}_LIBRARY "" CACHE FILEPATH "${LIBNAME} library" FORCE)
-      endif()
-    else()
-      set (3RDPARTY_${LIBNAME}_LIBRARY "" CACHE FILEPATH "${LIBNAME} library" FORCE)
-    endif()
-  else()
-    set (3RDPARTY_${LIBNAME}_LIBRARY "" CACHE FILEPATH "${LIBNAME} library" FORCE)
-  endif()
-
-  # check tcl/tk shared library
-  if (WIN32)
-    if (3RDPARTY_${LIBNAME}_DLL_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_DLL_DIR}")
-      if (3RDPARTY_${LIBNAME}_DLL AND EXISTS "${3RDPARTY_${LIBNAME}_DLL}")
-        string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DLL_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_DLL}")
-
-        if (NOT DOES_PATH_CONTAIN)
-          set (3RDPARTY_${LIBNAME}_DLL "" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
-        endif()
-      else()
-        set (3RDPARTY_${LIBNAME}_DLL "" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
-      endif()
-    else()
-      set (3RDPARTY_${LIBNAME}_DLL "" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
-    endif()
-  endif()
-endmacro()
-
-
-DIR_SUBDIR_FILE_FIT(TCL)
-DIR_SUBDIR_FILE_FIT(TK)
-
-
-# use default (CMake) TCL search
-find_package(TCL)
-
-foreach (LIBNAME TCL TK)
-  string (TOLOWER "${LIBNAME}" LIBNAME_L)
-
-  # tcl/tk include dir
-  if (NOT 3RDPARTY_${LIBNAME}_INCLUDE_DIR)
-    if (${LIBNAME}_INCLUDE_PATH AND EXISTS "${${LIBNAME}_INCLUDE_PATH}")
-      set (3RDPARTY_${LIBNAME}_INCLUDE_DIR "${${LIBNAME}_INCLUDE_PATH}" CACHE FILEPATH "The directory containing headers of ${LIBNAME}" FORCE)
-    endif()
-  endif()
-
-  # tcl/tk dir and library
-  if (NOT 3RDPARTY_${LIBNAME}_LIBRARY)
-    if (${LIBNAME}_LIBRARY AND EXISTS "${${LIBNAME}_LIBRARY}")
-      set (3RDPARTY_${LIBNAME}_LIBRARY "${${LIBNAME}_LIBRARY}" CACHE FILEPATH "${LIBNAME} library" FORCE)
-      
-      if (NOT 3RDPARTY_${LIBNAME}_LIBRARY_DIR)
-        get_filename_component (3RDPARTY_${LIBNAME}_LIBRARY_DIR "${3RDPARTY_${LIBNAME}_LIBRARY}" PATH)
-        set (3RDPARTY_${LIBNAME}_LIBRARY_DIR "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}" CACHE FILEPATH "The directory containing ${LIBNAME} library" FORCE)
-      endif()
-    endif()
-  endif()
-  
-
-  if (WIN32)
-    if (NOT 3RDPARTY_${LIBNAME}_DLL)
-        set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
-
-        set (DLL_FOLDER_FOR_SEARCH "")
-        if (3RDPARTY_${LIBNAME}_DLL_DIR)
-          set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_${LIBNAME}_DLL_DIR}")
-        elseif (3RDPARTY_TCL_DIR)
-          set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
-        elseif (3RDPARTY_${LIBNAME}_LIBRARY_DIR)
-          get_filename_component (3RDPARTY_${LIBNAME}_LIBRARY_DIR_PARENT "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}" PATH)
-          set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_${LIBNAME}_LIBRARY_DIR_PARENT}/bin")
-        endif()
-        
-        set (3RDPARTY_${LIBNAME}_DLL "3RDPARTY_${LIBNAME}_DLL-NOTFOUND" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
-        find_library (3RDPARTY_${LIBNAME}_DLL NAMES ${LIBNAME_L}86 ${LIBNAME_L}85
-                                              PATHS "${DLL_FOLDER_FOR_SEARCH}"
-                                              NO_DEFAULT_PATH)
-    endif()
-  endif()
-
-  DIR_SUBDIR_FILE_FIT(${LIBNAME})
-  
-
-  # tcl/tk dir and library
-  if (NOT 3RDPARTY_${LIBNAME}_LIBRARY)
-    set (3RDPARTY_${LIBNAME}_LIBRARY "3RDPARTY_${LIBNAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "${LIBNAME} library" FORCE)
-    find_library (3RDPARTY_${LIBNAME}_LIBRARY NAMES ${LIBNAME_L}8.6 ${LIBNAME_L}86 ${LIBNAME_L}8.5 ${LIBNAME_L}85
-                                              PATHS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}"
-                                              NO_DEFAULT_PATH)
-    
-    # search in another place if previous search doesn't find anything
-    find_library (3RDPARTY_${LIBNAME}_LIBRARY NAMES ${LIBNAME_L}8.6 ${LIBNAME_L}86 ${LIBNAME_L}8.5 ${LIBNAME_L}85 
-                                              PATHS "${3RDPARTY_TCL_DIR}/lib"
-                                              NO_DEFAULT_PATH)    
-    
-
-    if (NOT 3RDPARTY_${LIBNAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY}")
-      set (3RDPARTY_${LIBNAME}_LIBRARY "" CACHE FILEPATH "${LIBNAME} library" FORCE)
-    endif()
-    
-    if (NOT 3RDPARTY_${LIBNAME}_LIBRARY_DIR AND 3RDPARTY_${LIBNAME}_LIBRARY)
-      get_filename_component (3RDPARTY_${LIBNAME}_LIBRARY_DIR "${3RDPARTY_${LIBNAME}_LIBRARY}" PATH)
-      set (3RDPARTY_${LIBNAME}_LIBRARY_DIR "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}" CACHE FILEPATH "The directory containing ${LIBNAME} library" FORCE)
-    endif()
-  endif()
-
-  set (3RDPARTY_${LIBNAME}_LIBRARY_VERSION "")
-  if (3RDPARTY_${LIBNAME}_LIBRARY AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY}")
-    get_filename_component (${LIBNAME}_LIBRARY_NAME "${3RDPARTY_${LIBNAME}_LIBRARY}" NAME)
-    string(REGEX REPLACE "^.*${LIBNAME_L}([0-9]\\.*[0-9]).*$" "\\1" ${LIBNAME}_LIBRARY_VERSION "${${LIBNAME}_LIBRARY_NAME}")
-    
-    if (NOT "${${LIBNAME}_LIBRARY_VERSION}" STREQUAL "${${LIBNAME}_LIBRARY_NAME}")
-      set (3RDPARTY_${LIBNAME}_LIBRARY_VERSION "${${LIBNAME}_LIBRARY_VERSION}")
-    else() # if the version isn't found - seek other library with 8.6 or 8.5 version in the same dir
-      message (STATUS "Info: ${LIBNAME} version isn't found")
-    endif()
-  endif()
-  
-
-  set (3RDPARTY_${LIBNAME}_LIBRARY_VERSION_WITH_DOT "")
-  if (3RDPARTY_${LIBNAME}_LIBRARY_VERSION)
-    string (REGEX REPLACE "^.*([0-9])[^0-9]*[0-9].*$" "\\1" 3RDPARTY_${LIBNAME}_MAJOR_VERSION "${3RDPARTY_${LIBNAME}_LIBRARY_VERSION}")
-    string (REGEX REPLACE "^.*[0-9][^0-9]*([0-9]).*$" "\\1" 3RDPARTY_${LIBNAME}_MINOR_VERSION "${3RDPARTY_${LIBNAME}_LIBRARY_VERSION}")
-    set (3RDPARTY_${LIBNAME}_LIBRARY_VERSION_WITH_DOT "${3RDPARTY_${LIBNAME}_MAJOR_VERSION}.${3RDPARTY_${LIBNAME}_MINOR_VERSION}")
-  endif()
-
-  if (WIN32)
-    if (NOT 3RDPARTY_${LIBNAME}_DLL)
-        set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
-
-        set (DLL_FOLDER_FOR_SEARCH "")
-        if (3RDPARTY_${LIBNAME}_DLL_DIR)
-          set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_${LIBNAME}_DLL_DIR}")
-        elseif (3RDPARTY_TCL_DIR)
-          set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
-        else()
-          get_filename_component (3RDPARTY_${LIBNAME}_LIBRARY_DIR_PARENT "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}" PATH)
-          set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_${LIBNAME}_LIBRARY_DIR_PARENT}/bin")
-        endif()
-        
-        set (3RDPARTY_${LIBNAME}_DLL "3RDPARTY_${LIBNAME}_DLL-NOTFOUND" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
-        find_library (3RDPARTY_${LIBNAME}_DLL NAMES ${LIBNAME_L}${3RDPARTY_${LIBNAME}_LIBRARY_VERSION}
-                                              PATHS "${DLL_FOLDER_FOR_SEARCH}"
-                                              NO_DEFAULT_PATH)
-        
-        if (NOT 3RDPARTY_${LIBNAME}_DLL OR NOT EXISTS "${3RDPARTY_${LIBNAME}_DLL}")
-          set (3RDPARTY_${LIBNAME}_DLL "" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
-        endif()
-      
-        if (NOT 3RDPARTY_${LIBNAME}_DLL_DIR AND 3RDPARTY_${LIBNAME}_DLL)
-          get_filename_component (3RDPARTY_${LIBNAME}_DLL_DIR "${3RDPARTY_${LIBNAME}_DLL}" PATH)
-          set (3RDPARTY_${LIBNAME}_DLL_DIR "${3RDPARTY_${LIBNAME}_DLL_DIR}" CACHE FILEPATH "The directory containing ${LIBNAME} shared library" FORCE)
-        endif()
-    endif()
-  endif()
-  
-  # include found paths to common variables
-  if (3RDPARTY_${LIBNAME}_INCLUDE_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_INCLUDE_DIR}")
-    list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_${LIBNAME}_INCLUDE_DIR}")
-  else()
-    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${LIBNAME}_INCLUDE_DIR)
-  endif()
-
-  if (3RDPARTY_${LIBNAME}_LIBRARY AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY}")
-    list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
-  else()
-    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${LIBNAME}_LIBRARY_DIR})
-  endif()
-
-  if (WIN32)
-    if (NOT 3RDPARTY_${LIBNAME}_DLL OR NOT EXISTS "${3RDPARTY_${LIBNAME}_DLL}")
-      list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${LIBNAME}_DLL_DIR)
-    endif()
-  endif()
-endforeach()
-
-# install tcltk
-if (INSTALL_TCL)
-  # include occt macros. compiler_bitness, os_wiht_bit, compiler and build_postfix
-  OCCT_INCLUDE_CMAKE_FILE ("adm/templates/occt_macros")
-
-  OCCT_MAKE_OS_WITH_BITNESS()
-  OCCT_MAKE_COMPILER_SHORT_NAME()
-  OCCT_MAKE_BUILD_POSTFIX()
-
-  if (WIN32)
-    install (FILES ${3RDPARTY_TCL_DLL} ${3RDPARTY_TK_DLL} DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BUILD_POSTFIX}")
-  else()
-    install (FILES ${3RDPARTY_TCL_LIBRARY} ${3RDPARTY_TK_LIBRARY} DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BUILD_POSTFIX}")
-  endif()
-
-  if (TCL_TCLSH_VERSION)
-    # tcl is required to install in lib folder (without ${BUILD_POSTFIX})
-    install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl8"                    DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
-    install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl${TCL_TCLSH_VERSION}" DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
-    install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tk${TCL_TCLSH_VERSION}"  DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
-  else()
-    message (STATUS "\nWarning: tclX.X and tkX.X subdirs won't be copyied during the installation process.")
-    message (STATUS "Try seeking tcl within another folder by changing 3RDPARTY_TCL_DIR variable.")
-  endif()
-
-  set (USED_3RDPARTY_TCL_DIR "")
-else()
-  # the library directory for using by the executable
-  if (WIN32)
-    set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_DLL_DIR})
-  else()
-    set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_LIBRARY_DIR})
-  endif()
-endif()
-
-mark_as_advanced (3RDPARTY_TCL_LIBRARY 3RDPARTY_TK_LIBRARY 3RDPARTY_TCL_DLL 3RDPARTY_TK_DLL)
-
-# unset all redundant variables
-#TCL
-OCCT_CHECK_AND_UNSET (TCL_LIBRARY)
-OCCT_CHECK_AND_UNSET (TCL_INCLUDE_PATH)
-OCCT_CHECK_AND_UNSET (TCL_TCLSH)
-#TK
-OCCT_CHECK_AND_UNSET (TK_LIBRARY)
-OCCT_CHECK_AND_UNSET (TK_INCLUDE_PATH)
-OCCT_CHECK_AND_UNSET (TK_WISH)
diff --git a/adm/templates/vtk.cmake b/adm/templates/vtk.cmake
deleted file mode 100644 (file)
index 93c0635..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-# vtk
-
-if (NOT DEFINED INSTALL_VTK)
-  set (INSTALL_VTK OFF CACHE BOOL "Is vtk required to be copied into install directory")
-endif()
-
-# vtk directory
-if (NOT DEFINED 3RDPARTY_VTK_DIR)
-  set (3RDPARTY_VTK_DIR "" CACHE PATH "The directory containing vtk")
-endif()
-
-# vtk include directory
-if (NOT DEFINED 3RDPARTY_VTK_INCLUDE_DIR)
-  set (3RDPARTY_VTK_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of vtk")
-endif()
-
-# vtk library directory
-if (NOT DEFINED 3RDPARTY_VTK_LIBRARY_DIR)
-  set (3RDPARTY_VTK_LIBRARY_DIR "" CACHE FILEPATH "The directory containing vtk library")
-endif()
-
-# vtk dll directory
-if (WIN32 AND NOT DEFINED 3RDPARTY_VTK_DLL_DIR)
-  set (3RDPARTY_VTK_DLL_DIR "" CACHE FILEPATH "The directory containing VTK dll")
-endif()
-
-# search for vtk in user defined directory
-if (NOT 3RDPARTY_VTK_DIR AND 3RDPARTY_DIR)
-  FIND_PRODUCT_DIR("${3RDPARTY_DIR}" vtk VTK_DIR_NAME)
-  if (VTK_DIR_NAME)
-    set (3RDPARTY_VTK_DIR "${3RDPARTY_DIR}/${VTK_DIR_NAME}" CACHE PATH "The directory containing vtk product" FORCE)
-  endif()
-endif()
-
-# find installed vtk
-find_package(VTK QUIET)
-
-# find native vtk
-if (NOT VTK_FOUND)
-  find_package(VTK QUIET PATHS "${3RDPARTY_VTK_DIR}")
-endif()
-
-if (NOT VTK_FOUND AND NOT 3RDPARTY_VTK_DIR OR NOT EXISTS "${3RDPARTY_VTK_DIR}")
-  message(SEND_ERROR "VTK not found. Set the 3RDPARTY_VTK_DIR cmake cache entry to the directory containing VTK.")
-  set (3RDPARTY_VTK_DIR "3RDPARTY_VTK_DIR-NOTFOUND" CACHE PATH "The directory containing vtk product" FORCE)
-endif()
-
-OCCT_MAKE_BUILD_POSTFIX()
-set(VTK_VERSION "")
-if (3RDPARTY_VTK_DIR AND EXISTS "${3RDPARTY_VTK_DIR}")
-  get_filename_component(3RDPARTY_VTK_DIR_NAME "${3RDPARTY_VTK_DIR}" NAME)
-  string(REGEX MATCH "^VTK-([0-9].[0-9])" VTK_VERSION "${3RDPARTY_VTK_DIR_NAME}")
-  set(VTK_VERSION "${CMAKE_MATCH_1}")
-  if (NOT 3RDPARTY_VTK_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_VTK_INCLUDE_DIR}")
-    set (3RDPARTY_VTK_INCLUDE_DIR "${3RDPARTY_VTK_DIR}/include/vtk-${VTK_VERSION}" CACHE FILEPATH "The directory containing includes of VTK" FORCE)
-  endif()
-  if (NOT 3RDPARTY_VTK_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_VTK_LIBRARY_DIR}")
-    if(EXISTS "${3RDPARTY_VTK_DIR}/lib${BUILD_POSTFIX}")
-      set (3RDPARTY_VTK_LIBRARY_DIR "${3RDPARTY_VTK_DIR}/lib${BUILD_POSTFIX}" CACHE FILEPATH "The directory containing libs of VTK" FORCE)
-    else()
-         if (NOT "${BUILD_POSTFIX}" STREQUAL "" AND EXISTS "${3RDPARTY_VTK_DIR}/lib")
-           set (3RDPARTY_VTK_LIBRARY_DIR "${3RDPARTY_VTK_DIR}/lib" CACHE FILEPATH "The directory containing libs of VTK" FORCE)
-      endif()
-       endif()
-  endif()
-  if(3RDPARTY_VTK_LIBRARY_DIR)
-    list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_VTK_LIBRARY_DIR}")
-  endif()
-endif()
-
-# vtk libraries
-# lib
-set (VTK_LIBRARY_NAMES vtkCommonCore-${VTK_VERSION}.lib vtkCommonDataModel-${VTK_VERSION}.lib vtkCommonExecutionModel-${VTK_VERSION}.lib 
-                       vtkCommonMath-${VTK_VERSION}.lib vtkCommonTransforms-${VTK_VERSION}.lib vtkRenderingCore-${VTK_VERSION}.lib 
-                       vtkRenderingOpenGL-${VTK_VERSION}.lib vtkFiltersGeneral-${VTK_VERSION}.lib vtkIOCore-${VTK_VERSION}.lib 
-                       vtkIOImage-${VTK_VERSION}.lib vtkImagingCore-${VTK_VERSION}.lib vtkInteractionStyle-${VTK_VERSION}.lib )
-
-#dll
-set (VTK_DLL_NAMES vtkCommonComputationalGeometry-${VTK_VERSION}.dll
-                   vtkCommonCore-${VTK_VERSION}.dll
-                   vtkCommonDataModel-${VTK_VERSION}.dll
-                   vtkCommonExecutionModel-${VTK_VERSION}.dll
-                   vtkCommonMath-${VTK_VERSION}.dll
-                   vtkCommonMisc-${VTK_VERSION}.dll
-                   vtkCommonSystem-${VTK_VERSION}.dll
-                   vtkCommonTransforms-${VTK_VERSION}.dll
-                   vtkDICOMParser-${VTK_VERSION}.dll
-                   vtkFiltersCore-${VTK_VERSION}.dll
-                   vtkFiltersExtraction-${VTK_VERSION}.dll
-                   vtkFiltersGeneral-${VTK_VERSION}.dll
-                   vtkFiltersGeometry-${VTK_VERSION}.dll
-                   vtkFiltersSources-${VTK_VERSION}.dll
-                   vtkFiltersStatistics-${VTK_VERSION}.dll
-                   vtkIOCore-${VTK_VERSION}.dll
-                   vtkIOImage-${VTK_VERSION}.dll
-                   vtkImagingCore-${VTK_VERSION}.dll
-                   vtkImagingFourier-${VTK_VERSION}.dll
-                   vtkImagingHybrid-${VTK_VERSION}.dll
-                   vtkInteractionStyle-${VTK_VERSION}.dll
-                   vtkRenderingCore-${VTK_VERSION}.dll
-                   vtkRenderingOpenGL-${VTK_VERSION}.dll
-                   vtkalglib-${VTK_VERSION}.dll
-                   vtkjpeg-${VTK_VERSION}.dll
-                   vtkmetaio-${VTK_VERSION}.dll
-                   vtkpng-${VTK_VERSION}.dll
-                   vtksys-${VTK_VERSION}.dll
-                   vtktiff-${VTK_VERSION}.dll
-                   vtkzlib-${VTK_VERSION}.dll )
-
-# search for dll directory
-if (WIN32)
-  if (NOT 3RDPARTY_VTK_DLL_DIR OR NOT EXISTS "${3RDPARTY_VTK_DLL_DIR}")
-    if(EXISTS "${3RDPARTY_VTK_DIR}/bin${BUILD_POSTFIX}")
-      set (3RDPARTY_VTK_DLL_DIR "${3RDPARTY_VTK_DIR}/bin${BUILD_POSTFIX}" CACHE FILEPATH "The directory containing dll of VTK" FORCE)
-    else()
-         if (NOT "${BUILD_POSTFIX}" STREQUAL "" AND EXISTS "${3RDPARTY_VTK_DIR}/bin")
-           set (3RDPARTY_VTK_DLL_DIR "${3RDPARTY_VTK_DIR}/bin" CACHE FILEPATH "The directory containing dll of VTK" FORCE)
-      endif()
-       endif()
-  endif()
-endif() 
-
-OCCT_CHECK_AND_UNSET(VTK_DIR)
-
-if (3RDPARTY_VTK_INCLUDE_DIR AND EXISTS "${3RDPARTY_VTK_INCLUDE_DIR}")
-  list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_VTK_INCLUDE_DIR}")
-else()
-  list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_INCLUDE_DIR)
-endif()
-
-if (INSTALL_VTK)
-  OCCT_MAKE_OS_WITH_BITNESS()
-  OCCT_MAKE_COMPILER_SHORT_NAME()
-  if (WIN32)
-    if(3RDPARTY_VTK_DLL_DIR AND EXISTS "${3RDPARTY_VTK_DLL_DIR}")
-      set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
-      foreach(VTK_DLL_NAME ${VTK_DLL_NAMES})
-        set (3RDPARTY_VTK_DLL "3RDPARTY_VTK_DLL-NOTFOUND" CACHE FILEPATH "VTK shared library" FORCE)
-        find_library(3RDPARTY_VTK_DLL "${VTK_DLL_NAME}" PATHS "${3RDPARTY_VTK_DLL_DIR}" NO_DEFAULT_PATH)
-        if (NOT 3RDPARTY_VTK_DLL OR NOT EXISTS "${3RDPARTY_VTK_DLL}")
-          list (APPEND 3RDPARTY_NOT_INCLUDED "${3RDPARTY_VTK_DLL}")
-        else()
-          install (FILES ${3RDPARTY_VTK_DLL} DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BUILD_POSTFIX}")
-        endif()
-      endforeach()
-      OCCT_CHECK_AND_UNSET(3RDPARTY_VTK_DLL)
-    endif()
-  else ()
-    foreach(VTK_DLL_NAME ${VTK_DLL_NAMES})
-      string(REPLACE ".dll" ".so.1" VTK_DLL_NAME "${VTK_DLL_NAME}")
-      install(FILES "${3RDPARTY_VTK_LIBRARY_DIR}/lib${VTK_DLL_NAME}" DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BUILD_POSTFIX}" RENAME "lib${VTK_DLL_NAME}")
-    endforeach()
-  endif()
-
-  set (USED_3RDPARTY_VTK_DIR "")
-else()
-  # the library directory for using by the executable
-  if (WIN32)
-    set (USED_3RDPARTY_VTK_DIR ${3RDPARTY_VTK_DLL_DIR})
-  else()
-    set (USED_3RDPARTY_VTK_DIR ${3RDPARTY_VTK_LIBRARY_DIR})
-  endif()
-endif()
-
-mark_as_advanced (VTK_INCLUDE_DIRS VTK_LIBRARY_DIRS VTK_DIR)
index 051970a..b64cb78 100644 (file)
@@ -73,7 +73,7 @@ install (TARGETS Geometry RUNTIME DESTINATION "${INSTALL_DIR}/win${COMPILER_BITN
                           ARCHIVE DESTINATION "${INSTALL_DIR}/win${COMPILER_BITNESS}/${COMPILER}/lib${BUILD_POSTFIX}"
                           LIBRARY DESTINATION "${INSTALL_DIR}/win${COMPILER_BITNESS}/${COMPILER}/lib${BUILD_POSTFIX}")
 
-include_directories (${OCCT_ROOT}/inc
+include_directories (${CMAKE_SOURCE_DIR}/src
                      ${Geometry_SRC_DIR}
                      ${Geometry_ISESSION2D_DIR}
                      ${Geometry_RESOURCE_DIR}
index 7685dd5..f1d7835 100644 (file)
@@ -43,7 +43,7 @@ install (TARGETS Modeling RUNTIME DESTINATION "${INSTALL_DIR}/win${COMPILER_BITN
                           ARCHIVE DESTINATION "${INSTALL_DIR}/win${COMPILER_BITNESS}/${COMPILER}/lib${BUILD_POSTFIX}"
                           LIBRARY DESTINATION "${INSTALL_DIR}/win${COMPILER_BITNESS}/${COMPILER}/lib${BUILD_POSTFIX}")
 
-include_directories (${OCCT_ROOT}/inc
+include_directories (${CMAKE_SOURCE_DIR}/src
                      ${MFC_STANDARD_SAMPLES_DIR}/02_Modeling
                      ${Modeling_SRC_DIR}
                      ${MFC_STANDARD_SAMPLES_DIR}/Common)
index bf1b3bb..d27ceab 100644 (file)
@@ -39,7 +39,7 @@ install (TARGETS Viewer2d RUNTIME DESTINATION "${INSTALL_DIR}/win${COMPILER_BITN
                           ARCHIVE DESTINATION "${INSTALL_DIR}/win${COMPILER_BITNESS}/${COMPILER}/lib${BUILD_POSTFIX}"
                           LIBRARY DESTINATION "${INSTALL_DIR}/win${COMPILER_BITNESS}/${COMPILER}/lib${BUILD_POSTFIX}")
 
-include_directories (${OCCT_ROOT}/inc
+include_directories (${CMAKE_SOURCE_DIR}/src
                      ${MFC_STANDARD_SAMPLES_DIR}/03_Viewer2d
                      ${Viewer2d_SOURCE_DIR}
                      ${MFC_STANDARD_SAMPLES_DIR}/Common)
index 67c8092..1c69940 100644 (file)
@@ -67,7 +67,7 @@ install (TARGETS Viewer3d RUNTIME DESTINATION "${INSTALL_DIR}/win${COMPILER_BITN
                           ARCHIVE DESTINATION "${INSTALL_DIR}/win${COMPILER_BITNESS}/${COMPILER}/lib${BUILD_POSTFIX}"
                           LIBRARY DESTINATION "${INSTALL_DIR}/win${COMPILER_BITNESS}/${COMPILER}/lib${BUILD_POSTFIX}")
 
-include_directories (${OCCT_ROOT}/inc
+include_directories (${CMAKE_SOURCE_DIR}/src
                      ${Viewer3d_SRC_DIR}
                      ${MFC_STANDARD_SAMPLES_DIR}/Common)
 
index 5c47d36..366715b 100644 (file)
@@ -43,7 +43,7 @@ install (TARGETS ImportExport RUNTIME DESTINATION "${INSTALL_DIR}/win${COMPILER_
                               ARCHIVE DESTINATION "${INSTALL_DIR}/win${COMPILER_BITNESS}/${COMPILER}/lib${BUILD_POSTFIX}"
                               LIBRARY DESTINATION "${INSTALL_DIR}/win${COMPILER_BITNESS}/${COMPILER}/lib${BUILD_POSTFIX}")
 
-include_directories (${OCCT_ROOT}/inc
+include_directories (${CMAKE_SOURCE_DIR}/src
                      ${MFC_STANDARD_SAMPLES_DIR}/05_ImportExport
                      ${ImportExport_SRC_DIR}
                      ${MFC_STANDARD_SAMPLES_DIR}/Common)
index 4d70782..9b995dd 100644 (file)
@@ -59,7 +59,7 @@ install (TARGETS Ocaf RUNTIME DESTINATION "${INSTALL_DIR}/win${COMPILER_BITNESS}
                       ARCHIVE DESTINATION "${INSTALL_DIR}/win${COMPILER_BITNESS}/${COMPILER}/lib${BUILD_POSTFIX}"
                       LIBRARY DESTINATION "${INSTALL_DIR}/win${COMPILER_BITNESS}/${COMPILER}/lib${BUILD_POSTFIX}")
 
-include_directories (${OCCT_ROOT}/inc
+include_directories (${CMAKE_SOURCE_DIR}/src
                      ${MFC_STANDARD_SAMPLES_DIR}/06_Ocaf
                      ${Ocaf_SRC_DIR}
                      ${MFC_STANDARD_SAMPLES_DIR}/Common)
index b85e1cb..dfcc5dd 100644 (file)
@@ -45,7 +45,7 @@ install (TARGETS Triangulation RUNTIME DESTINATION "${INSTALL_DIR}/win${COMPILER
                                ARCHIVE DESTINATION "${INSTALL_DIR}/win${COMPILER_BITNESS}/${COMPILER}/lib${BUILD_POSTFIX}"
                                LIBRARY DESTINATION "${INSTALL_DIR}/win${COMPILER_BITNESS}/${COMPILER}/lib${BUILD_POSTFIX}")
 
-include_directories (${OCCT_ROOT}/inc
+include_directories (${CMAKE_SOURCE_DIR}/src
                      ${MFC_STANDARD_SAMPLES_DIR}/07_Triangulation
                      ${Triangulation_SRC_DIR}
                      ${MFC_STANDARD_SAMPLES_DIR}/Common)
index ed8853f..5bca499 100644 (file)
@@ -67,7 +67,7 @@ install (TARGETS HLR RUNTIME DESTINATION "${INSTALL_DIR}/win${COMPILER_BITNESS}/
                      ARCHIVE DESTINATION "${INSTALL_DIR}/win${COMPILER_BITNESS}/${COMPILER}/lib${BUILD_POSTFIX}"
                      LIBRARY DESTINATION "${INSTALL_DIR}/win${COMPILER_BITNESS}/${COMPILER}/lib${BUILD_POSTFIX}")
 
-include_directories (${OCCT_ROOT}/inc
+include_directories (${CMAKE_SOURCE_DIR}/src
                      ${HLR_RESOURCE_DIR}
                      ${HLR_SRC_DIR}
                      ${MFC_STANDARD_SAMPLES_DIR}/Common)
index 82e6d14..6f57c73 100644 (file)
@@ -50,7 +50,7 @@ install (TARGETS Animation RUNTIME DESTINATION "${INSTALL_DIR}/win${COMPILER_BIT
                            ARCHIVE DESTINATION "${INSTALL_DIR}/win${COMPILER_BITNESS}/${COMPILER}/lib${BUILD_POSTFIX}"
                            LIBRARY DESTINATION "${INSTALL_DIR}/win${COMPILER_BITNESS}/${COMPILER}/lib${BUILD_POSTFIX}")
 
-include_directories (${OCCT_ROOT}/inc
+include_directories (${CMAKE_SOURCE_DIR}/src
                      ${Animation_RESOURCE_DIR}
                      ${Animation_SRC_DIR}
                      ${MFC_STANDARD_SAMPLES_DIR}/Common)
index 8e6de1e..5fe5625 100644 (file)
@@ -67,7 +67,7 @@ install (TARGETS Convert RUNTIME DESTINATION "${INSTALL_DIR}/win${COMPILER_BITNE
                          ARCHIVE DESTINATION "${INSTALL_DIR}/win${COMPILER_BITNESS}/${COMPILER}/lib${BUILD_POSTFIX}"
                          LIBRARY DESTINATION "${INSTALL_DIR}/win${COMPILER_BITNESS}/${COMPILER}/lib${BUILD_POSTFIX}")
 
-include_directories (${OCCT_ROOT}/inc
+include_directories (${CMAKE_SOURCE_DIR}/src
                      ${Convert_SRC_DIR}
                      ${ISESSION_SUBDIR}
                      ${WNT_SUBDIR}
index f41d243..bc484a2 100644 (file)
@@ -142,7 +142,7 @@ install (TARGETS mfcsample RUNTIME DESTINATION "${INSTALL_DIR}/win${COMPILER_BIT
                            ARCHIVE DESTINATION "${INSTALL_DIR}/win${COMPILER_BITNESS}/${COMPILER}/lib${BUILD_POSTFIX}"
                            LIBRARY DESTINATION "${INSTALL_DIR}/win${COMPILER_BITNESS}/${COMPILER}/lib${BUILD_POSTFIX}")
 
-include_directories( ${OCCT_ROOT}/inc
+include_directories( ${CMAKE_SOURCE_DIR}/src
                      ${MFC_STANDARD_COMMON_SAMPLES_DIR}
                      ${COMMON_IE_DIR}
                      ${COMMON_ISESSION2D_DIR}
@@ -157,9 +157,7 @@ set (mfcsample_USED_LIBS  TKVRML
                           TKShHealing
                           TKSTEP
                           TKXSBase
-                          TKShapeSchema
                           FWOSPlugin
-                          PTKernel
                           TKBool
                           TKCAF
                           TKCDF
@@ -174,9 +172,7 @@ set (mfcsample_USED_LIBS  TKVRML
                           TKMath
                           TKOffset
                           TKOpenGl
-                          TKPCAF
                           TKPrim
-                          TKPShape
                           TKService
                           TKTopAlgo
                           TKMesh
diff --git a/src/Aspect/EXTERNLIB b/src/Aspect/EXTERNLIB
deleted file mode 100644 (file)
index 990b6d9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-CSF_XwLibs
index 9a4c62b..af1b456 100755 (executable)
@@ -71,4 +71,3 @@ Aspect_WindowDefinitionError.hxx
 Aspect_WindowError.hxx
 Aspect_XAtom.hxx
 Aspect_XWD.hxx
-EXTERNLIB
diff --git a/src/BRepMesh/EXTERNLIB b/src/BRepMesh/EXTERNLIB
deleted file mode 100755 (executable)
index 50eb2e2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-CSF_TBB
index b2b9adb..ec39094 100755 (executable)
@@ -53,4 +53,3 @@ BRepMesh_WireChecker.cxx
 BRepMesh_WireChecker.hxx
 BRepMesh_WireInterferenceChecker.cxx
 BRepMesh_WireInterferenceChecker.hxx
-EXTERNLIB
diff --git a/src/CDF/EXTERNLIB b/src/CDF/EXTERNLIB
deleted file mode 100755 (executable)
index e69de29..0000000
index 33996f6..f705681 100755 (executable)
@@ -26,4 +26,3 @@ CDF_Timer.cxx
 CDF_Timer.hxx
 CDF_TryStoreStatus.hxx
 CDF_TypeOfActivation.hxx
-EXTERNLIB
diff --git a/src/Cocoa/EXTERNLIB b/src/Cocoa/EXTERNLIB
deleted file mode 100755 (executable)
index 321718a..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-CSF_objc
-CSF_Appkit
-CSF_IOKit
index a8951ec..39258e3 100755 (executable)
@@ -2,4 +2,3 @@ Cocoa_LocalPool.hxx
 Cocoa_LocalPool.mm
 Cocoa_Window.hxx
 Cocoa_Window.mm
-EXTERNLIB
diff --git a/src/DDataStd/EXTERNLIB b/src/DDataStd/EXTERNLIB
deleted file mode 100755 (executable)
index 81ee523..0000000
+++ /dev/null
@@ -1 +0,0 @@
-TKDraw
index dfa0f32..e0cc97b 100755 (executable)
@@ -15,4 +15,3 @@ DDataStd_TreeBrowser.cxx
 DDataStd_TreeBrowser.hxx
 DDataStd_TreeBrowser.tcl
 DDataStd_TreeCommands.cxx
-EXTERNLIB
diff --git a/src/DRAWEXE/CMakeLists.txt b/src/DRAWEXE/CMakeLists.txt
new file mode 100644 (file)
index 0000000..ded5792
--- /dev/null
@@ -0,0 +1,9 @@
+project(DRAWEXE)
+
+set (isEXE TRUE)
+
+set (TOOLKIT_MODULES
+  DRAWEXE
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/Draw/EXTERNLIB b/src/Draw/EXTERNLIB
deleted file mode 100755 (executable)
index 7f11200..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-CSF_TclLibs
-CSF_TclTkLibs
-CSF_gdi32
-CSF_advapi32
-CSF_user32
-CSF_TBB
-CSF_objc
-CSF_Appkit
-CSF_IOKit
index 8a3c8ac..b4eb578 100755 (executable)
@@ -72,7 +72,6 @@ Draw_Window.cxx
 Draw_Window.hxx
 Draw_Window_1.mm
 DrawRessource.h
-EXTERNLIB
 init.cxx
 init.h
 MainWindow.cxx
diff --git a/src/FWOSPlugin/CMakeLists.txt b/src/FWOSPlugin/CMakeLists.txt
new file mode 100644 (file)
index 0000000..0cea167
--- /dev/null
@@ -0,0 +1,7 @@
+project(FWOSPlugin)
+
+set (TOOLKIT_MODULES
+  FWOSDriver
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/Font/EXTERNLIB b/src/Font/EXTERNLIB
deleted file mode 100644 (file)
index 026ed1b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-CSF_FREETYPE
index 5a7b10c..ecd9c6e 100644 (file)
@@ -1,4 +1,3 @@
-EXTERNLIB
 Font_BRepFont.cxx
 Font_BRepFont.hxx
 Font_FontAspect.hxx
index ecedc43..ac23ccb 100644 (file)
@@ -33,7 +33,7 @@
 //=============================================================================
 GeomToStep_MakeAxis1Placement::GeomToStep_MakeAxis1Placement( const gp_Ax1& A)
 {
-#include <GeomToStep_MakeAxis1Placement_gen.pxx>
+#include "GeomToStep_MakeAxis1Placement_gen.pxx"
 }
 //=============================================================================
 // Creation d' un axis1_placement de prostep a partir d' un Ax2d de gp
@@ -41,7 +41,7 @@ GeomToStep_MakeAxis1Placement::GeomToStep_MakeAxis1Placement( const gp_Ax1& A)
 
 GeomToStep_MakeAxis1Placement::GeomToStep_MakeAxis1Placement( const gp_Ax2d& A)
 {
-#include <GeomToStep_MakeAxis1Placement_gen.pxx>
+#include "GeomToStep_MakeAxis1Placement_gen.pxx"
 }
 
 //=============================================================================
@@ -54,7 +54,7 @@ GeomToStep_MakeAxis1Placement::GeomToStep_MakeAxis1Placement
 {
   gp_Ax1 A;
   A = Axis1->Ax1();
-#include<GeomToStep_MakeAxis1Placement_gen.pxx>
+#include "GeomToStep_MakeAxis1Placement_gen.pxx"
 }
 
 //=============================================================================
@@ -67,7 +67,7 @@ GeomToStep_MakeAxis1Placement::GeomToStep_MakeAxis1Placement
 {
   gp_Ax2d A;
   A = Axis1->Ax2d();
-#include<GeomToStep_MakeAxis1Placement_gen.pxx>
+#include "GeomToStep_MakeAxis1Placement_gen.pxx"
 }
 
 //=============================================================================
index aed3a1b..9997141 100644 (file)
@@ -41,7 +41,7 @@ GeomToStep_MakeBSplineCurveWithKnots::
                                                                      
 {
 #define Array1OfPnt_gen TColgp_Array1OfPnt
-#include <GeomToStep_MakeBSplineCurveWithKnots_gen.pxx>
+#include "GeomToStep_MakeBSplineCurveWithKnots_gen.pxx"
 #undef Array1OfPnt_gen
 }
 //=============================================================================
@@ -55,7 +55,7 @@ GeomToStep_MakeBSplineCurveWithKnots::
                                                                      
 {
 #define Array1OfPnt_gen TColgp_Array1OfPnt2d
-#include <GeomToStep_MakeBSplineCurveWithKnots_gen.pxx>
+#include "GeomToStep_MakeBSplineCurveWithKnots_gen.pxx"
 #undef Array1OfPnt_gen
 }
 
index 91a1cbe..edb9f4e 100644 (file)
@@ -41,7 +41,7 @@ GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve::
                                                                      
 {
 #define Array1OfPnt_gen TColgp_Array1OfPnt
-#include <GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve_gen.pxx>
+#include "GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve_gen.pxx"
 #undef Array1OfPnt_gen
 }
 //=============================================================================
@@ -55,7 +55,7 @@ GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve::
                                                                      
 {
 #define Array1OfPnt_gen TColgp_Array1OfPnt2d
-#include <GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve_gen.pxx>
+#include "GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve_gen.pxx"
 #undef Array1OfPnt_gen
 }
 
index f43fab9..0a19c5d 100644 (file)
@@ -34,7 +34,7 @@
 //=============================================================================
 GeomToStep_MakeCircle::GeomToStep_MakeCircle( const gp_Circ& C)
 {
-#include <GeomToStep_MakeCircle_gen.pxx>
+#include "GeomToStep_MakeCircle_gen.pxx"
 }
 
 
@@ -47,7 +47,7 @@ GeomToStep_MakeCircle::GeomToStep_MakeCircle( const Handle(Geom_Circle)& Cer)
 {
   gp_Circ C;
   C = Cer->Circ();
-#include <GeomToStep_MakeCircle_gen.pxx>
+#include "GeomToStep_MakeCircle_gen.pxx"
 }
 
 
index f7fabe6..e6a8a91 100644 (file)
@@ -34,7 +34,7 @@
 //=============================================================================
 GeomToStep_MakeEllipse::GeomToStep_MakeEllipse( const gp_Elips& E)
 {
-#include <GeomToStep_MakeEllipse_gen.pxx>
+#include "GeomToStep_MakeEllipse_gen.pxx"
 }
 
 
@@ -47,7 +47,7 @@ GeomToStep_MakeEllipse::GeomToStep_MakeEllipse( const Handle(Geom_Ellipse)& Cer)
 {
   gp_Elips E;
   E = Cer->Elips();
-#include <GeomToStep_MakeEllipse_gen.pxx>
+#include "GeomToStep_MakeEllipse_gen.pxx"
 }
 
 
index e3c3f88..99efdee 100644 (file)
@@ -36,7 +36,7 @@
 GeomToStep_MakeLine::GeomToStep_MakeLine( const gp_Lin& L)
 {
 #define Vec_gen gp_Vec
-#include <GeomToStep_MakeLine_gen.pxx>
+#include "GeomToStep_MakeLine_gen.pxx"
 #undef Vec_gen
 }
 
@@ -47,7 +47,7 @@ GeomToStep_MakeLine::GeomToStep_MakeLine( const gp_Lin& L)
 GeomToStep_MakeLine::GeomToStep_MakeLine( const gp_Lin2d& L)
 {
 #define Vec_gen gp_Vec2d
-#include <GeomToStep_MakeLine_gen.pxx>
+#include "GeomToStep_MakeLine_gen.pxx"
 #undef Vec_gen
 }
 
@@ -60,7 +60,7 @@ GeomToStep_MakeLine::GeomToStep_MakeLine ( const Handle(Geom_Line)& Gline)
   gp_Lin L;
   L = Gline->Lin();
 #define Vec_gen gp_Vec
-#include <GeomToStep_MakeLine_gen.pxx>
+#include "GeomToStep_MakeLine_gen.pxx"
 #undef Vec_gen
 }
 
@@ -73,7 +73,7 @@ GeomToStep_MakeLine::GeomToStep_MakeLine ( const Handle(Geom2d_Line)& Gline)
   gp_Lin2d L;
   L = Gline->Lin2d();
 #define Vec_gen gp_Vec2d
-#include <GeomToStep_MakeLine_gen.pxx>
+#include "GeomToStep_MakeLine_gen.pxx"
 #undef Vec_gen
 }
 
index ff92daa..88eeaae 100644 (file)
@@ -32,7 +32,7 @@
 GeomToStep_MakePolyline::GeomToStep_MakePolyline( const TColgp_Array1OfPnt& P)
 {
   gp_Pnt P1;
-#include <GeomToStep_MakePolyline_gen.pxx>
+#include "GeomToStep_MakePolyline_gen.pxx"
 }
 
 //=============================================================================
@@ -42,7 +42,7 @@ GeomToStep_MakePolyline::GeomToStep_MakePolyline( const TColgp_Array1OfPnt& P)
 GeomToStep_MakePolyline::GeomToStep_MakePolyline( const TColgp_Array1OfPnt2d& P)
 {
   gp_Pnt2d P1;
-#include <GeomToStep_MakePolyline_gen.pxx>
+#include "GeomToStep_MakePolyline_gen.pxx"
 }
 //=============================================================================
 // renvoi des valeurs
index 4e4f4bd..cab2ece 100644 (file)
@@ -35,7 +35,7 @@ GeomToStep_MakeVector::GeomToStep_MakeVector( const gp_Vec& V)
 {
   gp_Dir D = gp_Dir(V);
   Standard_Real lFactor = UnitsMethods::LengthFactor();
-#include <GeomToStep_MakeVector_gen.pxx>
+#include "GeomToStep_MakeVector_gen.pxx"
 }
 //=============================================================================
 // Creation d' un vector de prostep a partir d' un Vec2d de gp
@@ -45,7 +45,7 @@ GeomToStep_MakeVector::GeomToStep_MakeVector( const gp_Vec2d& V)
 {
   gp_Dir2d D = gp_Dir2d(V);
   Standard_Real lFactor = 1.;
-#include <GeomToStep_MakeVector_gen.pxx>
+#include "GeomToStep_MakeVector_gen.pxx"
 }
 
 //=============================================================================
@@ -59,7 +59,7 @@ GeomToStep_MakeVector::GeomToStep_MakeVector ( const Handle(Geom_Vector)&
   V = GVector->Vec();
   gp_Dir D = gp_Dir(V);
   Standard_Real lFactor = UnitsMethods::LengthFactor();
-#include <GeomToStep_MakeVector_gen.pxx>
+#include "GeomToStep_MakeVector_gen.pxx"
 }
 
 //=============================================================================
@@ -73,7 +73,7 @@ GeomToStep_MakeVector::GeomToStep_MakeVector ( const Handle(Geom2d_Vector)&
   V = GVector->Vec2d();
   gp_Dir2d D = gp_Dir2d(V);
   Standard_Real lFactor = 1.;
-#include <GeomToStep_MakeVector_gen.pxx>
+#include "GeomToStep_MakeVector_gen.pxx"
 }
 
 //=============================================================================
index d5a76a9..4153776 100644 (file)
@@ -14,7 +14,7 @@
 
 #include <Graphic3d_CStructure.hxx>
 
-#include <Graphic3d_Structure.pxx>
+#include "Graphic3d_Structure.pxx"
 #include <Graphic3d_StructureManager.hxx>
 #include <Graphic3d_TransModeFlags.hxx>
 
index 691e5d3..6e8cf95 100644 (file)
@@ -27,7 +27,7 @@
 #include <Graphic3d_GroupDefinitionError.hxx>
 #include <Graphic3d_ShaderProgram.hxx>
 #include <Graphic3d_Structure.hxx>
-#include <Graphic3d_Structure.pxx>
+#include "Graphic3d_Structure.pxx"
 #include <Graphic3d_StructureManager.hxx>
 #include <Graphic3d_TextureMap.hxx>
 #include <Graphic3d_TransModeFlags.hxx>
index 23d210a..dffbf40 100644 (file)
@@ -29,7 +29,7 @@
 #include <Graphic3d_MaterialAspect.hxx>
 #include <Graphic3d_PriorityDefinitionError.hxx>
 #include <Graphic3d_Structure.hxx>
-#include <Graphic3d_Structure.pxx>
+#include "Graphic3d_Structure.pxx"
 #include <Graphic3d_StructureDefinitionError.hxx>
 #include <Graphic3d_StructureManager.hxx>
 #include <Graphic3d_TextureMap.hxx>
index a9fb02e..41acdc7 100644 (file)
@@ -20,7 +20,7 @@
 #define Structure_MAX_PRIORITY 10
 #define Structure_MIN_PRIORITY 0
 
-#include <Graphic3d_StructureManager.pxx>
+#include "Graphic3d_StructureManager.pxx"
 
 // structures identifiers : possible range
        // check the value of View_IDMAX (must be < Structure_IDMIN)
index 66efb7d..f7fafe7 100644 (file)
@@ -30,7 +30,7 @@
 #include <Graphic3d_InitialisationError.hxx>
 #include <Graphic3d_Structure.hxx>
 #include <Graphic3d_StructureManager.hxx>
-#include <Graphic3d_StructureManager.pxx>
+#include "Graphic3d_StructureManager.pxx"
 #include <Standard_Transient.hxx>
 #include <Standard_Type.hxx>
 
@@ -38,7 +38,7 @@ static Standard_Boolean Initialisation = Standard_True;
 static int StructureManager_ArrayId[StructureManager_MAX];
 static Standard_Integer StructureManager_CurrentId = 0;
 
-#include <Graphic3d_Structure.pxx>
+#include "Graphic3d_Structure.pxx"
 #include <Graphic3d_MapIteratorOfMapOfStructure.hxx>
 
 Graphic3d_StructureManager::Graphic3d_StructureManager (const Handle(Graphic3d_GraphicDriver)& theDriver)
diff --git a/src/IVtkDraw/EXTERNLIB b/src/IVtkDraw/EXTERNLIB
deleted file mode 100644 (file)
index 72e05d5..0000000
+++ /dev/null
@@ -1 +0,0 @@
-CSF_VTK
\ No newline at end of file
index 6a15837..fe469fc 100644 (file)
@@ -1,4 +1,3 @@
-EXTERNLIB
 IVtkDraw.cxx
 IVtkDraw.hxx
 IVtkDraw_HighlightAndSelectionPipeline.cxx
diff --git a/src/IVtkTools/EXTERNLIB b/src/IVtkTools/EXTERNLIB
deleted file mode 100644 (file)
index 72e05d5..0000000
+++ /dev/null
@@ -1 +0,0 @@
-CSF_VTK
\ No newline at end of file
index d593017..b8207dd 100644 (file)
@@ -1,4 +1,3 @@
-EXTERNLIB
 IVtkTools.cxx
 IVtkTools.hxx
 IVtkTools_DisplayModeFilter.cxx
diff --git a/src/IVtkVTK/EXTERNLIB b/src/IVtkVTK/EXTERNLIB
deleted file mode 100644 (file)
index 72e05d5..0000000
+++ /dev/null
@@ -1 +0,0 @@
-CSF_VTK
\ No newline at end of file
index b167161..ce1dd91 100644 (file)
@@ -1,4 +1,3 @@
-EXTERNLIB
 IVtkVTK_ShapeData.cxx
 IVtkVTK_ShapeData.hxx
 IVtkVTK_View.cxx
diff --git a/src/Image/EXTERNLIB b/src/Image/EXTERNLIB
deleted file mode 100644 (file)
index 7e6a915..0000000
+++ /dev/null
@@ -1 +0,0 @@
-CSF_FreeImagePlus
index ceb31a0..6e8b75c 100755 (executable)
@@ -1,4 +1,3 @@
-EXTERNLIB
 Image_AlienPixMap.cxx
 Image_AlienPixMap.hxx
 Image_Color.hxx
diff --git a/src/OSD/EXTERNLIB b/src/OSD/EXTERNLIB
deleted file mode 100755 (executable)
index ca15c4d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-CSF_TBB
\ No newline at end of file
index a69a3ff..471e35a 100755 (executable)
@@ -1,4 +1,3 @@
-EXTERNLIB
 OSD.cxx
 OSD.hxx
 OSD_Chronometer.cxx
diff --git a/src/OpenGl/EXTERNLIB b/src/OpenGl/EXTERNLIB
deleted file mode 100755 (executable)
index 21580fc..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-CSF_user32
-CSF_gdi32
-CSF_opengl32
-CSF_glu32
-CSF_objc
-CSF_Appkit
-CSF_IOKit
-CSF_OpenGlLibs
-CSF_AviLibs
-CSF_FREETYPE
-CSF_GL2PS
index a8f1f5c..26c048d 100755 (executable)
@@ -1,4 +1,3 @@
-EXTERNLIB
 glext.h
 OpenGl_ArbDbg.hxx
 OpenGl_ArbFBO.hxx
diff --git a/src/QABugs/EXTERNLIB b/src/QABugs/EXTERNLIB
deleted file mode 100755 (executable)
index 50eb2e2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-CSF_TBB
index b169382..e771130 100644 (file)
@@ -1,4 +1,3 @@
-EXTERNLIB
 QABugs.cxx
 QABugs.hxx
 QABugs_1.cxx
diff --git a/src/QADraw/EXTERNLIB b/src/QADraw/EXTERNLIB
deleted file mode 100644 (file)
index d5607c1..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-CSF_TclLibs
-CSF_TclTkLibs
-CSF_gdi32
-CSF_advapi32
-CSF_user32
-
index 3e6d8bc..e7e616e 100755 (executable)
@@ -1,4 +1,3 @@
-EXTERNLIB
 QADraw.cxx
 QADraw.hxx
 QADraw_Additional.cxx
diff --git a/src/STEPConstruct/EXTERNLIB b/src/STEPConstruct/EXTERNLIB
deleted file mode 100755 (executable)
index 0a2e60e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-CSF_wsock32
index c01590c..95b83dc 100755 (executable)
@@ -1,4 +1,3 @@
-EXTERNLIB
 STEPConstruct.cxx
 STEPConstruct.hxx
 STEPConstruct_AP203Context.cxx
diff --git a/src/Standard/EXTERNLIB b/src/Standard/EXTERNLIB
deleted file mode 100755 (executable)
index cac894d..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-CSF_SOCKETLibs
-CSF_ThreadLibs
-CSF_kernel32
-CSF_TBB
index c6745bf..7e701fa 100755 (executable)
@@ -1,4 +1,3 @@
-EXTERNLIB
 Standard.cxx
 Standard.hxx
 Standard_AbortiveTransaction.hxx
diff --git a/src/TKBO/CMakeLists.txt b/src/TKBO/CMakeLists.txt
new file mode 100644 (file)
index 0000000..2751498
--- /dev/null
@@ -0,0 +1,12 @@
+project(TKBO)
+
+set (TOOLKIT_MODULES
+  IntTools
+  BRepAlgoAPI
+  BOPCol
+  BOPDS
+  BOPAlgo
+  BOPTools
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKBRep/CMakeLists.txt b/src/TKBRep/CMakeLists.txt
new file mode 100644 (file)
index 0000000..95b5b68
--- /dev/null
@@ -0,0 +1,14 @@
+project(TKBRep)
+
+set (TOOLKIT_MODULES
+  TopoDS
+  TopExp
+  TopTools
+  BRep
+  BRepLProp
+  BRepAdaptor
+  BRepTools
+  BinTools
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKBin/CMakeLists.txt b/src/TKBin/CMakeLists.txt
new file mode 100644 (file)
index 0000000..417665c
--- /dev/null
@@ -0,0 +1,10 @@
+project(TKBin)
+
+set (TOOLKIT_MODULES
+  BinDrivers
+  BinMDataXtd
+  BinMPrsStd
+  BinMNaming
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKBinL/CMakeLists.txt b/src/TKBinL/CMakeLists.txt
new file mode 100644 (file)
index 0000000..6db83a8
--- /dev/null
@@ -0,0 +1,12 @@
+project(TKBinL)
+
+set (TOOLKIT_MODULES
+  BinMDF
+  BinMDataStd
+  BinMFunction
+  BinMDocStd
+  BinObjMgt
+  BinLDrivers
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKBinTObj/CMakeLists.txt b/src/TKBinTObj/CMakeLists.txt
new file mode 100644 (file)
index 0000000..64b3de6
--- /dev/null
@@ -0,0 +1,7 @@
+project(TKBinTObj)
+
+set (TOOLKIT_MODULES
+  BinTObjDrivers
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKBinXCAF/CMakeLists.txt b/src/TKBinXCAF/CMakeLists.txt
new file mode 100644 (file)
index 0000000..9835abc
--- /dev/null
@@ -0,0 +1,8 @@
+project(TKBinXCAF)
+
+set (TOOLKIT_MODULES
+  BinXCAFDrivers
+  BinMXCAFDoc
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKBool/CMakeLists.txt b/src/TKBool/CMakeLists.txt
new file mode 100644 (file)
index 0000000..216f5cf
--- /dev/null
@@ -0,0 +1,13 @@
+project(TKBool)
+
+set (TOOLKIT_MODULES
+  TopOpeBRep
+  TopOpeBRepDS
+  TopOpeBRepBuild
+  TopOpeBRepTool
+  BRepAlgo
+  BRepFill
+  BRepProj
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKCAF/CMakeLists.txt b/src/TKCAF/CMakeLists.txt
new file mode 100644 (file)
index 0000000..024a17d
--- /dev/null
@@ -0,0 +1,10 @@
+project(TKCAF)
+
+set (TOOLKIT_MODULES
+  TDataXtd
+  TNaming
+  TPrsStd
+  AppStd
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKCDF/CMakeLists.txt b/src/TKCDF/CMakeLists.txt
new file mode 100644 (file)
index 0000000..6e33d7a
--- /dev/null
@@ -0,0 +1,11 @@
+project(TKCDF)
+
+set (TOOLKIT_MODULES
+  CDM
+  PCDM
+  CDF
+  UTL
+  LDOM
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKDCAF/CMakeLists.txt b/src/TKDCAF/CMakeLists.txt
new file mode 100644 (file)
index 0000000..1e8e0c3
--- /dev/null
@@ -0,0 +1,12 @@
+project(TKDCAF)
+
+set (TOOLKIT_MODULES
+  DDF
+  DDocStd
+  DNaming
+  DDataStd
+  DPrsStd
+  DrawDim
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKDraw/CMakeLists.txt b/src/TKDraw/CMakeLists.txt
new file mode 100644 (file)
index 0000000..e63ef73
--- /dev/null
@@ -0,0 +1,37 @@
+project(TKDraw)
+
+set (TOOLKIT_MODULES
+  Draw
+  DBRep
+  DrawTrSurf
+)
+
+if (WIN32)
+  list( APPEND USED_LIBS gdi32.lib )
+  list( APPEND USED_LIBS advapi32.lib )
+  list( APPEND USED_LIBS user32.lib )
+elseif(APPLE)
+  find_library(FRAMEWORKS_TCL NAMES Tcl)
+  list( APPEND USED_LIBS ${FRAMEWORKS_TCL} )
+  find_library(FRAMEWORKS_TK NAMES Tk)
+  list( APPEND USED_LIBS ${FRAMEWORKS_TK} )
+  if(USE_TBB)
+    list( APPEND USED_LIBS tbb )
+    list( APPEND USED_LIBS tbbmalloc )
+  endif()
+  list( APPEND USED_LIBS objc )
+  find_library(FRAMEWORKS_APPKIT NAMES Appkit)
+  list( APPEND USED_LIBS ${FRAMEWORKS_APPKIT} )
+  find_library(FRAMEWORKS_IOKIT NAMES IOKit)
+  list( APPEND USED_LIBS ${FRAMEWORKS_IOKIT} )
+else()
+  list( APPEND USED_LIBS tcl8.6 )
+  list( APPEND USED_LIBS X11 )
+  list( APPEND USED_LIBS tk8.6 )
+  if(USE_TBB)
+    list( APPEND USED_LIBS tbb )
+    list( APPEND USED_LIBS tbbmalloc )
+  endif()
+endif()
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKFeat/CMakeLists.txt b/src/TKFeat/CMakeLists.txt
new file mode 100644 (file)
index 0000000..4fc453b
--- /dev/null
@@ -0,0 +1,8 @@
+project(TKFeat)
+
+set (TOOLKIT_MODULES
+  LocOpe
+  BRepFeat
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKFillet/CMakeLists.txt b/src/TKFillet/CMakeLists.txt
new file mode 100644 (file)
index 0000000..b41e3ef
--- /dev/null
@@ -0,0 +1,15 @@
+project(TKFillet)
+
+set (TOOLKIT_MODULES
+  ChFiDS
+  ChFi2d
+  ChFi3d
+  ChFiKPart
+  Blend
+  BRepBlend
+  BlendFunc
+  BRepFilletAPI
+  FilletSurf
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKG2d/CMakeLists.txt b/src/TKG2d/CMakeLists.txt
new file mode 100644 (file)
index 0000000..0159004
--- /dev/null
@@ -0,0 +1,13 @@
+project(TKG2d)
+
+set (TOOLKIT_MODULES
+  Geom2d
+  LProp
+  TColGeom2d
+  Adaptor2d
+  Geom2dLProp
+  Geom2dAdaptor
+  GProp
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKG3d/CMakeLists.txt b/src/TKG3d/CMakeLists.txt
new file mode 100644 (file)
index 0000000..8bae786
--- /dev/null
@@ -0,0 +1,14 @@
+project(TKG3d)
+
+set (TOOLKIT_MODULES
+  Geom
+  TColGeom
+  GeomAdaptor
+  AdvApprox
+  GeomLProp
+  Adaptor3d
+  LProp3d
+  TopAbs
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKGeomAlgo/CMakeLists.txt b/src/TKGeomAlgo/CMakeLists.txt
new file mode 100644 (file)
index 0000000..9656677
--- /dev/null
@@ -0,0 +1,39 @@
+project(TKGeomAlgo)
+
+set (TOOLKIT_MODULES
+  Hatch
+  GeomInt
+  IntStart
+  IntWalk
+  IntImp
+  IntCurveSurface
+  IntSurf
+  IntPatch
+  Geom2dInt
+  IntImpParGen
+  IntRes2d
+  IntCurve
+  TopTrans
+  Intf
+  ApproxInt
+  GccAna
+  GccEnt
+  GccInt
+  HatchGen
+  Geom2dHatch
+  Law
+  AppBlend
+  Plate
+  GeomPlate
+  LocalAnalysis
+  GeomAPI
+  GeomFill
+  Geom2dAPI
+  Geom2dGcc
+  FairCurve
+  NLPlate
+  IntPolyh
+  TopClass
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKGeomBase/CMakeLists.txt b/src/TKGeomBase/CMakeLists.txt
new file mode 100644 (file)
index 0000000..979f1a2
--- /dev/null
@@ -0,0 +1,28 @@
+project(TKGeomBase)
+
+set (TOOLKIT_MODULES
+  ProjLib
+  GeomProjLib
+  GCPnts
+  CPnts
+  Approx
+  AppParCurves
+  FEmTool
+  AppCont
+  Extrema
+  IntAna
+  IntAna2d
+  GeomConvert
+  AdvApp2Var
+  GeomLib
+  Geom2dConvert
+  Hermit
+  BndLib
+  AppDef
+  GeomTools
+  GC
+  GCE2d
+  gce
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKHLR/CMakeLists.txt b/src/TKHLR/CMakeLists.txt
new file mode 100644 (file)
index 0000000..5d6f1dd
--- /dev/null
@@ -0,0 +1,14 @@
+project(TKHLR)
+
+set (TOOLKIT_MODULES
+  HLRTopoBRep
+  HLRBRep
+  HLRAlgo
+  HLRAppli
+  Intrv
+  TopBas
+  TopCnx
+  Contap
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKIGES/CMakeLists.txt b/src/TKIGES/CMakeLists.txt
new file mode 100644 (file)
index 0000000..f467514
--- /dev/null
@@ -0,0 +1,24 @@
+project(TKIGES)
+
+set (TOOLKIT_MODULES
+  IGESData
+  IGESFile
+  IGESBasic
+  IGESGraph
+  IGESGeom
+  IGESDimen
+  IGESDraw
+  IGESSolid
+  IGESDefs
+  IGESAppli
+  IGESConvGeom
+  IGESSelect
+  IGESToBRep
+  GeomToIGES
+  Geom2dToIGES
+  BRepToIGES
+  BRepToIGESBRep
+  IGESControl
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKIVtk/CMakeLists.txt b/src/TKIVtk/CMakeLists.txt
new file mode 100644 (file)
index 0000000..555d206
--- /dev/null
@@ -0,0 +1,19 @@
+project(TKIVtk)
+
+set (TOOLKIT_MODULES
+  IVtk
+  IVtkOCC
+  IVtkVTK
+  IVtkTools
+)
+
+if (WIN32)
+  list( APPEND USED_LIBS ${VTK_LIBRARY_NAMES} )
+else()
+  foreach(VTK_LIB_NAME ${VTK_LIBRARY_NAMES})
+    string(REPLACE ".lib" ".so.1" VTK_LIB_NAME ${VTK_LIB_NAME})
+    list( APPEND USED_LIBS "lib${VTK_LIB_NAME}")
+  endforeach()
+endif()
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKIVtkDraw/CMakeLists.txt b/src/TKIVtkDraw/CMakeLists.txt
new file mode 100644 (file)
index 0000000..fe1a10c
--- /dev/null
@@ -0,0 +1,16 @@
+project(TKIVtkDraw)
+
+set (TOOLKIT_MODULES
+  IVtkDraw
+)
+
+if (WIN32)
+  list( APPEND USED_LIBS ${VTK_LIBRARY_NAMES} )
+else()
+  foreach(VTK_LIB_NAME ${VTK_LIBRARY_NAMES})
+    string(REPLACE ".lib" ".so.1" VTK_LIB_NAME ${VTK_LIB_NAME})
+    list( APPEND USED_LIBS "lib${VTK_LIB_NAME}")
+  endforeach()
+endif()
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKLCAF/CMakeLists.txt b/src/TKLCAF/CMakeLists.txt
new file mode 100644 (file)
index 0000000..9c297d3
--- /dev/null
@@ -0,0 +1,11 @@
+project(TKLCAF)
+
+set (TOOLKIT_MODULES
+  TDF
+  TDataStd
+  TFunction
+  TDocStd
+  AppStdL
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKMath/CMakeLists.txt b/src/TKMath/CMakeLists.txt
new file mode 100644 (file)
index 0000000..1e9319a
--- /dev/null
@@ -0,0 +1,24 @@
+project(TKMath)
+
+set (TOOLKIT_MODULES
+  math
+  ElCLib
+  ElSLib
+  BSplCLib
+  BSplSLib
+  PLib
+  Precision
+  GeomAbs
+  Poly
+  CSLib
+  Convert
+  Bnd
+  BVH
+  gp
+  TColgp
+  TopLoc
+  Expr
+  ExprIntrp
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKMesh/CMakeLists.txt b/src/TKMesh/CMakeLists.txt
new file mode 100644 (file)
index 0000000..bb9d8a8
--- /dev/null
@@ -0,0 +1,14 @@
+project(TKMesh)
+
+set (TOOLKIT_MODULES
+  BRepMesh
+)
+
+if(NOT WIN32)
+  if(USE_TBB)
+    list( APPEND USED_LIBS tbb )
+    list( APPEND USED_LIBS tbbmalloc )
+  endif()
+endif()
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKMeshVS/CMakeLists.txt b/src/TKMeshVS/CMakeLists.txt
new file mode 100644 (file)
index 0000000..af9e7c2
--- /dev/null
@@ -0,0 +1,7 @@
+project(TKMeshVS)
+
+set (TOOLKIT_MODULES
+  MeshVS
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKOffset/CMakeLists.txt b/src/TKOffset/CMakeLists.txt
new file mode 100644 (file)
index 0000000..2e7a2a3
--- /dev/null
@@ -0,0 +1,10 @@
+project(TKOffset)
+
+set (TOOLKIT_MODULES
+  BRepOffsetAPI
+  Draft
+  BRepOffset
+  BiTgte
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKOpenGl/CMakeLists.txt b/src/TKOpenGl/CMakeLists.txt
new file mode 100644 (file)
index 0000000..bcb3ff3
--- /dev/null
@@ -0,0 +1,40 @@
+project(TKOpenGl)
+
+set (TOOLKIT_MODULES
+  OpenGl
+)
+
+if (WIN32)
+  list( APPEND USED_LIBS opengl32.lib )
+  list( APPEND USED_LIBS glu32.lib )
+  list( APPEND USED_LIBS user32.lib )
+  list( APPEND USED_LIBS gdi32.lib )
+  list( APPEND USED_LIBS ws2_32.lib )
+  list( APPEND USED_LIBS vfw32.lib )
+elseif(APPLE)
+  find_library(FRAMEWORKS_OPENGL NAMES OpenGL)
+  if(USE_GLX)
+    list( APPEND USED_LIBS GL )
+    list( APPEND USED_LIBS GLU )
+  else()
+    list( APPEND USED_LIBS ${FRAMEWORKS_OPENGL} )
+  endif()
+  list( APPEND USED_LIBS objc )
+  find_library(FRAMEWORKS_APPKIT NAMES Appkit)
+  list( APPEND USED_LIBS ${FRAMEWORKS_APPKIT} )
+  find_library(FRAMEWORKS_IOKIT NAMES IOKit)
+  list( APPEND USED_LIBS ${FRAMEWORKS_IOKIT} )
+  list( APPEND USED_LIBS freetype )
+else()
+  list( APPEND USED_LIBS GLU )
+  list( APPEND USED_LIBS GL )
+  list( APPEND USED_LIBS freetype )
+endif()
+
+if (NOT WIN32)
+  if(USE_GL2PS)
+    list( APPEND USED_LIBS gl2ps )
+  endif()
+endif()
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKPrim/CMakeLists.txt b/src/TKPrim/CMakeLists.txt
new file mode 100644 (file)
index 0000000..fc93473
--- /dev/null
@@ -0,0 +1,10 @@
+project(TKPrim)
+
+set (TOOLKIT_MODULES
+  BRepPrim
+  BRepSweep
+  Sweep
+  BRepPrimAPI
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKQADraw/CMakeLists.txt b/src/TKQADraw/CMakeLists.txt
new file mode 100644 (file)
index 0000000..78c03b0
--- /dev/null
@@ -0,0 +1,31 @@
+project(TKQADraw)
+
+set (TOOLKIT_MODULES
+  QABugs
+  QADNaming
+  QADraw
+  QANCollection
+  QANewBRepNaming
+  QANewDBRepNaming
+  QANewModTopOpe
+)
+
+if (WIN32)
+  list( APPEND USED_LIBS gdi32.lib )
+  list( APPEND USED_LIBS advapi32.lib )
+  list( APPEND USED_LIBS user32.lib )
+else()
+  if(USE_TBB)
+    list( APPEND USED_LIBS tbb )
+    list( APPEND USED_LIBS tbbmalloc )
+  endif()
+endif()
+
+if(MSVC)
+  # /bigobj is required for windows builds because of the size of
+  # some object files (CastImage for instance)
+  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
+  set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /bigobj")
+endif()
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKSTEP/CMakeLists.txt b/src/TKSTEP/CMakeLists.txt
new file mode 100644 (file)
index 0000000..dc02e34
--- /dev/null
@@ -0,0 +1,23 @@
+project(TKSTEP)
+
+set (TOOLKIT_MODULES
+  StepAP214
+  RWStepAP214
+  StepAP203
+  RWStepAP203
+  STEPConstruct
+  STEPEdit
+  GeomToStep
+  StepToGeom
+  StepToTopoDS
+  TopoDSToStep
+  STEPControl
+  STEPSelections
+  StepAP209
+)
+
+if (WIN32)
+  list( APPEND USED_LIBS wsock32.lib )
+endif()
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKSTEP209/CMakeLists.txt b/src/TKSTEP209/CMakeLists.txt
new file mode 100644 (file)
index 0000000..012c0a1
--- /dev/null
@@ -0,0 +1,10 @@
+project(TKSTEP209)
+
+set (TOOLKIT_MODULES
+  StepElement
+  StepFEA
+  RWStepElement
+  RWStepFEA
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKSTEPAttr/CMakeLists.txt b/src/TKSTEPAttr/CMakeLists.txt
new file mode 100644 (file)
index 0000000..9b2fa59
--- /dev/null
@@ -0,0 +1,10 @@
+project(TKSTEPAttr)
+
+set (TOOLKIT_MODULES
+  StepVisual
+  RWStepVisual
+  StepDimTol
+  RWStepDimTol
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKSTEPBase/CMakeLists.txt b/src/TKSTEPBase/CMakeLists.txt
new file mode 100644 (file)
index 0000000..8eb14e6
--- /dev/null
@@ -0,0 +1,14 @@
+project(TKSTEPBase)
+
+set (TOOLKIT_MODULES
+  StepBasic
+  RWStepBasic
+  StepRepr
+  RWStepRepr
+  StepGeom
+  RWStepGeom
+  StepShape
+  RWStepShape
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKSTL/CMakeLists.txt b/src/TKSTL/CMakeLists.txt
new file mode 100644 (file)
index 0000000..83f97dc
--- /dev/null
@@ -0,0 +1,10 @@
+project(TKSTL)
+
+set (TOOLKIT_MODULES
+  StlMesh
+  StlAPI
+  StlTransfer
+  RWStl
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKService/CMakeLists.txt b/src/TKService/CMakeLists.txt
new file mode 100644 (file)
index 0000000..4550dc4
--- /dev/null
@@ -0,0 +1,58 @@
+project(TKService)
+
+set (TOOLKIT_MODULES
+  Aspect
+  InterfaceGraphic
+  SelectBasics
+  Image
+  Cocoa
+  TColQuantity
+  Font
+)
+
+if (WIN32)
+  list( APPEND TOOLKIT_MODULES "WNT" )
+else()
+  list( APPEND TOOLKIT_MODULES "Xw" )
+endif()
+
+if (WIN32)
+  list( APPEND USED_LIBS opengl32.lib )
+  list( APPEND USED_LIBS glu32.lib )
+elseif(APPLE)
+  find_library(FRAMEWORKS_OPENGL NAMES OpenGL)
+  if(USE_GLX)
+    list( APPEND USED_LIBS GL )
+    list( APPEND USED_LIBS GLU )
+    find_package(X11 COMPONENTS X11 Xext Xmu Xi)
+    list( APPEND USED_LIBS ${X11_LIBRARIES} )
+    list( APPEND USED_LIBS ${X11_Xi_LIB} )
+    list( APPEND USED_LIBS ${X11_Xmu_LIB} )
+    list( APPEND USED_LIBS Xext )
+    list( APPEND USED_LIBS Xmu )
+    list( APPEND USED_LIBS Xi )
+  else()
+    list( APPEND USED_LIBS ${FRAMEWORKS_OPENGL} )
+  endif()
+  list( APPEND USED_LIBS objc )
+  find_library(FRAMEWORKS_APPKIT NAMES Appkit)
+  list( APPEND USED_LIBS ${FRAMEWORKS_APPKIT} )
+  find_library(FRAMEWORKS_IOKIT NAMES IOKit)
+  list( APPEND USED_LIBS ${FRAMEWORKS_IOKIT} )
+else()
+  list( APPEND USED_LIBS GLU )
+  list( APPEND USED_LIBS GL )
+  list( APPEND USED_LIBS X11 )
+  list( APPEND USED_LIBS Xext )
+  list( APPEND USED_LIBS Xmu )
+  list( APPEND USED_LIBS Xi )
+endif()
+
+if (NOT WIN32)
+  if(USE_FREEIMAGE)
+    list( APPEND USED_LIBS freeimage )
+  endif()
+  list( APPEND USED_LIBS freetype )
+endif()
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKShHealing/CMakeLists.txt b/src/TKShHealing/CMakeLists.txt
new file mode 100644 (file)
index 0000000..d9b87ef
--- /dev/null
@@ -0,0 +1,20 @@
+project(TKShHealing)
+
+set (TOOLKIT_MODULES
+  ShapeBuild
+  ShapeExtend
+  ShapeConstruct
+  ShapeCustom
+  ShapeAnalysis
+  ShapeFix
+  ShapeUpgrade
+  ShapeAlgo
+  ShapeProcess
+  ShapeProcessAPI
+)
+
+if (WIN32)
+  list( APPEND USED_LIBS wsock32.lib )
+endif()
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKTObj/CMakeLists.txt b/src/TKTObj/CMakeLists.txt
new file mode 100644 (file)
index 0000000..c3ea9eb
--- /dev/null
@@ -0,0 +1,7 @@
+project(TKTObj)
+
+set (TOOLKIT_MODULES
+  TObj
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKTObjDRAW/CMakeLists.txt b/src/TKTObjDRAW/CMakeLists.txt
new file mode 100644 (file)
index 0000000..77d83cd
--- /dev/null
@@ -0,0 +1,7 @@
+project(TKTObjDRAW)
+
+set (TOOLKIT_MODULES
+  TObjDRAW
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKTopAlgo/CMakeLists.txt b/src/TKTopAlgo/CMakeLists.txt
new file mode 100644 (file)
index 0000000..57767f1
--- /dev/null
@@ -0,0 +1,22 @@
+project(TKTopAlgo)
+
+set (TOOLKIT_MODULES
+  IntCurvesFace
+  MAT
+  MAT2d
+  Bisector
+  BRepMAT2d
+  BRepCheck
+  BRepBndLib
+  BRepExtrema
+  BRepClass
+  BRepClass3d
+  BRepLib
+  BRepGProp
+  BRepIntCurveSurface
+  BRepTopAdaptor
+  BRepBuilderAPI
+  BRepApprox
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKTopTest/CMakeLists.txt b/src/TKTopTest/CMakeLists.txt
new file mode 100644 (file)
index 0000000..23092d9
--- /dev/null
@@ -0,0 +1,17 @@
+project(TKTopTest)
+
+set (TOOLKIT_MODULES
+  TestTopOpeDraw
+  TestTopOpeTools
+  TestTopOpe
+  BRepTest
+  GeometryTest
+  HLRTest
+  MeshTest
+  GeomliteTest
+  DrawFairCurve
+  BOPTest
+  SWDRAW
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKV3d/CMakeLists.txt b/src/TKV3d/CMakeLists.txt
new file mode 100644 (file)
index 0000000..a6e4a4e
--- /dev/null
@@ -0,0 +1,37 @@
+project(TKV3d)
+
+set (TOOLKIT_MODULES
+  V3d
+  Graphic3d
+  Visual3d
+  Select3D
+  Prs3d
+  StdPrs
+  SelectMgr
+  PrsMgr
+  AIS
+  DsgPrs
+  StdSelect
+)
+
+if (WIN32)
+  list( APPEND USED_LIBS user32.lib )
+  list( APPEND USED_LIBS gdi32.lib )
+  list( APPEND USED_LIBS opengl32.lib )
+  list( APPEND USED_LIBS glu32.lib )
+elseif(APPLE)
+  find_library(FRAMEWORKS_OPENGL NAMES OpenGL)
+  if(USE_GLX)
+    list( APPEND USED_LIBS GL )
+    list( APPEND USED_LIBS GLU )
+  else()
+    list( APPEND USED_LIBS ${FRAMEWORKS_OPENGL} )
+  endif()
+  list( APPEND USED_LIBS freetype )
+else()
+  list( APPEND USED_LIBS GLU )
+  list( APPEND USED_LIBS GL )
+  list( APPEND USED_LIBS freetype )
+endif()
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKVRML/CMakeLists.txt b/src/TKVRML/CMakeLists.txt
new file mode 100644 (file)
index 0000000..4aca687
--- /dev/null
@@ -0,0 +1,10 @@
+project(TKVRML)
+
+set (TOOLKIT_MODULES
+  VrmlConverter
+  VrmlAPI
+  Vrml
+  VrmlData
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKViewerTest/CMakeLists.txt b/src/TKViewerTest/CMakeLists.txt
new file mode 100644 (file)
index 0000000..7ea8932
--- /dev/null
@@ -0,0 +1,39 @@
+project(TKViewerTest)
+
+set (TOOLKIT_MODULES
+  ViewerTest
+)
+
+if (WIN32)
+  list( APPEND USED_LIBS user32.lib )
+  list( APPEND USED_LIBS gdi32.lib )
+  list( APPEND USED_LIBS opengl32.lib )
+  list( APPEND USED_LIBS glu32.lib )
+elseif(APPLE)
+  find_library(FRAMEWORKS_TCL NAMES Tcl)
+  list( APPEND USED_LIBS ${FRAMEWORKS_TCL} )
+  find_library(FRAMEWORKS_TK NAMES Tk)
+  list( APPEND USED_LIBS ${FRAMEWORKS_TK} )
+  find_library(FRAMEWORKS_OPENGL NAMES OpenGL)
+  if(USE_GLX)
+    list( APPEND USED_LIBS GL )
+    list( APPEND USED_LIBS GLU )
+  else()
+    list( APPEND USED_LIBS ${FRAMEWORKS_OPENGL} )
+  endif()
+  list( APPEND USED_LIBS objc )
+  find_library(FRAMEWORKS_APPKIT NAMES Appkit)
+  list( APPEND USED_LIBS ${FRAMEWORKS_APPKIT} )
+  find_library(FRAMEWORKS_IOKIT NAMES IOKit)
+  list( APPEND USED_LIBS ${FRAMEWORKS_IOKIT} )
+  list( APPEND USED_LIBS freetype )
+else()
+  list( APPEND USED_LIBS tcl8.6 )
+  list( APPEND USED_LIBS X11 )
+  list( APPEND USED_LIBS tk8.6 )
+  list( APPEND USED_LIBS GLU )
+  list( APPEND USED_LIBS GL )
+  list( APPEND USED_LIBS freetype )
+endif()
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKVoxel/CMakeLists.txt b/src/TKVoxel/CMakeLists.txt
new file mode 100644 (file)
index 0000000..f0ceb8a
--- /dev/null
@@ -0,0 +1,7 @@
+project(TKVoxel)
+
+set (TOOLKIT_MODULES
+  Voxel
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKXCAF/CMakeLists.txt b/src/TKXCAF/CMakeLists.txt
new file mode 100644 (file)
index 0000000..39b457b
--- /dev/null
@@ -0,0 +1,9 @@
+project(TKXCAF)
+
+set (TOOLKIT_MODULES
+  XCAFApp
+  XCAFDoc
+  XCAFPrs
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKXDEDRAW/CMakeLists.txt b/src/TKXDEDRAW/CMakeLists.txt
new file mode 100644 (file)
index 0000000..0db7395
--- /dev/null
@@ -0,0 +1,7 @@
+project(TKXDEDRAW)
+
+set (TOOLKIT_MODULES
+  XDEDRAW
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKXDEIGES/CMakeLists.txt b/src/TKXDEIGES/CMakeLists.txt
new file mode 100644 (file)
index 0000000..f3724bc
--- /dev/null
@@ -0,0 +1,7 @@
+project(TKXDEIGES)
+
+set (TOOLKIT_MODULES
+  IGESCAFControl
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKXDESTEP/CMakeLists.txt b/src/TKXDESTEP/CMakeLists.txt
new file mode 100644 (file)
index 0000000..9ef2c04
--- /dev/null
@@ -0,0 +1,7 @@
+project(TKXDESTEP)
+
+set (TOOLKIT_MODULES
+  STEPCAFControl
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKXMesh/CMakeLists.txt b/src/TKXMesh/CMakeLists.txt
new file mode 100644 (file)
index 0000000..6b596cc
--- /dev/null
@@ -0,0 +1,7 @@
+project(TKXMesh)
+
+set (TOOLKIT_MODULES
+  XBRepMesh
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKXSBase/CMakeLists.txt b/src/TKXSBase/CMakeLists.txt
new file mode 100644 (file)
index 0000000..8deeba1
--- /dev/null
@@ -0,0 +1,22 @@
+project(TKXSBase)
+
+set (TOOLKIT_MODULES
+  Interface
+  Transfer
+  IFGraph
+  IFSelect
+  TransferBRep
+  XSControl
+  StepData
+  StepFile
+  HeaderSection
+  RWHeaderSection
+  APIHeaderSection
+  StepSelect
+  UnitsMethods
+  XSAlgo
+  LibCtl
+  MoniTool
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKXSDRAW/CMakeLists.txt b/src/TKXSDRAW/CMakeLists.txt
new file mode 100644 (file)
index 0000000..08da31b
--- /dev/null
@@ -0,0 +1,10 @@
+project(TKXSDRAW)
+
+set (TOOLKIT_MODULES
+  XSDRAW
+  XSDRAWIGES
+  XSDRAWSTEP
+  XSDRAWSTLVRML
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKXml/CMakeLists.txt b/src/TKXml/CMakeLists.txt
new file mode 100644 (file)
index 0000000..9f71165
--- /dev/null
@@ -0,0 +1,10 @@
+project(TKXml)
+
+set (TOOLKIT_MODULES
+  XmlDrivers
+  XmlMDataXtd
+  XmlMNaming
+  XmlMPrsStd
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKXmlL/CMakeLists.txt b/src/TKXmlL/CMakeLists.txt
new file mode 100644 (file)
index 0000000..3e492f3
--- /dev/null
@@ -0,0 +1,12 @@
+project(TKXmlL)
+
+set (TOOLKIT_MODULES
+  XmlLDrivers
+  XmlMDF
+  XmlMDataStd
+  XmlMDocStd
+  XmlMFunction
+  XmlObjMgt
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKXmlTObj/CMakeLists.txt b/src/TKXmlTObj/CMakeLists.txt
new file mode 100644 (file)
index 0000000..78f426a
--- /dev/null
@@ -0,0 +1,7 @@
+project(TKXmlTObj)
+
+set (TOOLKIT_MODULES
+  XmlTObjDrivers
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKXmlXCAF/CMakeLists.txt b/src/TKXmlXCAF/CMakeLists.txt
new file mode 100644 (file)
index 0000000..b87fc87
--- /dev/null
@@ -0,0 +1,8 @@
+project(TKXmlXCAF)
+
+set (TOOLKIT_MODULES
+  XmlXCAFDrivers
+  XmlMXCAFDoc
+)
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/TKernel/CMakeLists.txt b/src/TKernel/CMakeLists.txt
new file mode 100644 (file)
index 0000000..8ca64cd
--- /dev/null
@@ -0,0 +1,39 @@
+project(TKernel)
+
+set (TOOLKIT_MODULES
+  FSD
+  MMgt
+  OSD
+  Plugin
+  Quantity
+  Resource
+  Standard
+  StdFail
+  Storage
+  TColStd
+  TCollection
+  TShort
+  Units
+  UnitsAPI
+  Dico
+  NCollection
+  Message
+)
+
+if (WIN32)
+  list( APPEND USED_LIBS advapi32.lib )
+  list( APPEND USED_LIBS gdi32.lib )
+  list( APPEND USED_LIBS user32.lib )
+  list( APPEND USED_LIBS kernel32.lib )
+else()
+  if (NOT APPLE)
+    list( APPEND USED_LIBS pthread )
+    list( APPEND USED_LIBS rt )
+  endif()
+  if(USE_TBB)
+    list( APPEND USED_LIBS tbb )
+    list( APPEND USED_LIBS tbbmalloc )
+  endif()
+endif()
+
+include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake)
diff --git a/src/V3d/EXTERNLIB b/src/V3d/EXTERNLIB
deleted file mode 100644 (file)
index 7e6a915..0000000
+++ /dev/null
@@ -1 +0,0 @@
-CSF_FreeImagePlus
index c8df729..934151d 100755 (executable)
@@ -1,4 +1,3 @@
-EXTERNLIB
 V3d.cxx
 V3d.hxx
 V3d_AmbientLight.cxx
diff --git a/src/ViewerTest/EXTERNLIB b/src/ViewerTest/EXTERNLIB
deleted file mode 100755 (executable)
index 722430c..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-CSF_objc
-CSF_Appkit
-CSF_IOKit
-CSF_FREETYPE
index ac2aa53..a60d157 100755 (executable)
@@ -1,4 +1,3 @@
-EXTERNLIB
 ViewerTest.cxx
 ViewerTest.hxx
 ViewerTest_AutoUpdater.cxx
diff --git a/src/Visual3d/EXTERNLIB b/src/Visual3d/EXTERNLIB
deleted file mode 100755 (executable)
index b4113f8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-CSF_user32
index 1f82fc6..2df158c 100755 (executable)
@@ -1,4 +1,3 @@
-EXTERNLIB
 Visual3d_ClipDefinitionError.hxx
 Visual3d_ContextPick.cxx
 Visual3d_ContextPick.hxx
diff --git a/src/Xw/EXTERNLIB b/src/Xw/EXTERNLIB
deleted file mode 100755 (executable)
index b908e4e..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-CSF_XwLibs
-CSF_OpenGlLibs
index 14fceb9..1ab3878 100755 (executable)
@@ -1,3 +1,2 @@
-EXTERNLIB
 Xw_Window.cxx
 Xw_Window.hxx