diff --git a/.github/workflows/CI_main.yml b/.github/workflows/CI_main.yml
index 0c4d214a..982b3697 100644
--- a/.github/workflows/CI_main.yml
+++ b/.github/workflows/CI_main.yml
@@ -3,20 +3,20 @@
# * *
# * Copyright (c) 2023 0penBrain. *
# * *
-# * This file is part of FreeCAD. *
+# * This file is part of ISIMPA. *
# * *
-# * FreeCAD is free software: you can redistribute it and/or modify it *
+# * ISIMPA is free software: you can redistribute it and/or modify it *
# * under the terms of the GNU Lesser General Public License as *
# * published by the Free Software Foundation, either version 2.1 of the *
# * License, or (at your option) any later version. *
# * *
-# * FreeCAD is distributed in the hope that it will be useful, but *
+# * ISIMPA is distributed in the hope that it will be useful, but *
# * WITHOUT ANY WARRANTY; without even the implied warranty of *
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
# * Lesser General Public License for more details. *
# * *
# * You should have received a copy of the GNU Lesser General Public *
-# * License along with FreeCAD. If not, see *
+# * License along with ISIMPA. If not, see *
# * . *
# * *
# ***************************************************************************
@@ -24,7 +24,7 @@
# This is the master workflow for CI of I-SIMPA.
# It (only) aims at properly organizing the sub-workflows.
-name: I-SIMPA master CI
+name: I-SIMPA main CI
on: [workflow_dispatch, push, pull_request]
diff --git a/.github/workflows/actions/windows/getCcache/action.yml b/.github/workflows/actions/windows/getCcache/action.yml
index f0a6ef5a..bd8e66aa 100644
--- a/.github/workflows/actions/windows/getCcache/action.yml
+++ b/.github/workflows/actions/windows/getCcache/action.yml
@@ -3,20 +3,20 @@
# * *
# * Copyright (c) 2023 0penBrain. *
# * *
-# * This file is part of FreeCAD. *
+# * This file is part of ISIMPA. *
# * *
-# * FreeCAD is free software: you can redistribute it and/or modify it *
+# * ISIMPA is free software: you can redistribute it and/or modify it *
# * under the terms of the GNU Lesser General Public License as *
# * published by the Free Software Foundation, either version 2.1 of the *
# * License, or (at your option) any later version. *
# * *
-# * FreeCAD is distributed in the hope that it will be useful, but *
+# * ISIMPA is distributed in the hope that it will be useful, but *
# * WITHOUT ANY WARRANTY; without even the implied warranty of *
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
# * Lesser General Public License for more details. *
# * *
# * You should have received a copy of the GNU Lesser General Public *
-# * License along with FreeCAD. If not, see *
+# * License along with ISIMPA. If not, see *
# * . *
# * *
# ***************************************************************************
diff --git a/.github/workflows/actions/windows/getLibpack/action.yml b/.github/workflows/actions/windows/getLibpack/action.yml
index f9bf9726..1d9431ab 100644
--- a/.github/workflows/actions/windows/getLibpack/action.yml
+++ b/.github/workflows/actions/windows/getLibpack/action.yml
@@ -3,20 +3,20 @@
# * *
# * Copyright (c) 2023 0penBrain. *
# * *
-# * This file is part of FreeCAD. *
+# * This file is part of ISIMPA. *
# * *
-# * FreeCAD is free software: you can redistribute it and/or modify it *
+# * ISIMPA is free software: you can redistribute it and/or modify it *
# * under the terms of the GNU Lesser General Public License as *
# * published by the Free Software Foundation, either version 2.1 of the *
# * License, or (at your option) any later version. *
# * *
-# * FreeCAD is distributed in the hope that it will be useful, but *
+# * ISIMPA is distributed in the hope that it will be useful, but *
# * WITHOUT ANY WARRANTY; without even the implied warranty of *
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
# * Lesser General Public License for more details. *
# * *
# * You should have received a copy of the GNU Lesser General Public *
-# * License along with FreeCAD. If not, see *
+# * License along with ISIMPA. If not, see *
# * . *
# * *
# ***************************************************************************
diff --git a/.github/workflows/sub_prepare.yml b/.github/workflows/sub_prepare.yml
index d0d10edf..a795d852 100644
--- a/.github/workflows/sub_prepare.yml
+++ b/.github/workflows/sub_prepare.yml
@@ -3,25 +3,25 @@
# * *
# * Copyright (c) 2023 0penBrain. *
# * *
-# * This file is part of FreeCAD. *
+# * This file is part of ISIMPA. *
# * *
-# * FreeCAD is free software: you can redistribute it and/or modify it *
+# * ISIMPA is free software: you can redistribute it and/or modify it *
# * under the terms of the GNU Lesser General Public License as *
# * published by the Free Software Foundation, either version 2.1 of the *
# * License, or (at your option) any later version. *
# * *
-# * FreeCAD is distributed in the hope that it will be useful, but *
+# * ISIMPA is distributed in the hope that it will be useful, but *
# * WITHOUT ANY WARRANTY; without even the implied warranty of *
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
# * Lesser General Public License for more details. *
# * *
# * You should have received a copy of the GNU Lesser General Public *
-# * License along with FreeCAD. If not, see *
+# * License along with ISIMPA. If not, see *
# * . *
# * *
# ***************************************************************************
-# This is the pre-check workflow for CI of FreeCAD.
+# This is the pre-check workflow for CI of ISIMPA.
# It aims at running some basic checks about the workflow run ...
# ... and gathering some data needed for the next steps.
diff --git a/.github/workflows/sub_wrapup.yml b/.github/workflows/sub_wrapup.yml
index 5d55edf1..f3b7b817 100644
--- a/.github/workflows/sub_wrapup.yml
+++ b/.github/workflows/sub_wrapup.yml
@@ -3,20 +3,20 @@
# * *
# * Copyright (c) 2023 0penBrain. *
# * *
-# * This file is part of FreeCAD. *
+# * This file is part of ISIMPA. *
# * *
-# * FreeCAD is free software: you can redistribute it and/or modify it *
+# * ISIMPA is free software: you can redistribute it and/or modify it *
# * under the terms of the GNU Lesser General Public License as *
# * published by the Free Software Foundation, either version 2.1 of the *
# * License, or (at your option) any later version. *
# * *
-# * FreeCAD is distributed in the hope that it will be useful, but *
+# * ISIMPA is distributed in the hope that it will be useful, but *
# * WITHOUT ANY WARRANTY; without even the implied warranty of *
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
# * Lesser General Public License for more details. *
# * *
# * You should have received a copy of the GNU Lesser General Public *
-# * License along with FreeCAD. If not, see *
+# * License along with ISIMPA. If not, see *
# * . *
# * *
# ***************************************************************************
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3f9e41e3..50a83dd3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,6 +9,11 @@ project (isimpa VERSION 1.3.4)
# a better way to load dependencies
include(cmake/CPM.cmake)
+# include helper functions/macros
+add_subdirectory(cMake/ISIMPA_Helpers)
+
+ISIMPALibpackChecks()
+
# convert path of a .lib file into a .dll file
# findboost does not store .dll locations
macro(LIB_TO_DLL LIBPATH DLL_PATH)
diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake
new file mode 100644
index 00000000..8a3490ce
--- /dev/null
+++ b/cmake/ConfigureChecks.cmake
@@ -0,0 +1,60 @@
+
+include(CheckIncludeFile)
+include(CheckIncludeFiles)
+include(CheckSymbolExists)
+include(CheckFunctionExists)
+include(CheckLibraryExists)
+include(CheckTypeSize)
+include(CheckCSourceCompiles)
+include(CheckIncludeFileCXX)
+include(CheckCXXSourceCompiles)
+
+check_include_file(GL/gl.h HAVE_GL_GL_H)
+
+# i/o streams
+check_include_file_cxx(istream HAVE_ISTREAM)
+check_include_file_cxx(ostream HAVE_OSTREAM)
+check_include_file_cxx(fstream HAVE_FSTREAM)
+check_include_file_cxx(sstream HAVE_SSTREAM)
+check_include_file_cxx(ios HAVE_IOS)
+check_include_file_cxx(iostream HAVE_IOSTREAM)
+check_include_file_cxx(iomanip HAVE_IOMANIP)
+
+include(TestForANSIStreamHeaders)
+IF(NOT CMAKE_NO_ANSI_STREAM_HEADERS)
+ SET(HAVE_STD_IOSTREAM 1)
+ SET(USE_STD_IOSTREAM 1)
+ENDIF(NOT CMAKE_NO_ANSI_STREAM_HEADERS)
+
+include(TestForSTDNamespace)
+IF(NOT CMAKE_NO_ANSI_STRING_STREAM)
+ SET(HAVE_NAMESPACES 1)
+ENDIF(NOT CMAKE_NO_ANSI_STRING_STREAM)
+
+SET(HAVE_QGLFORMAT_EQ_OP 1)
+SET(HAVE_QGLFORMAT_SETOVERLAY 1)
+SET(HAVE_QGLWIDGET_SETAUTOBUFFERSWAP 1)
+SET(HAVE_QT_KEYPAD_DEFINE 1)
+SET(HAVE_QWIDGET_SHOWFULLSCREEN 1)
+
+
+file(WRITE ${CMAKE_BINARY_DIR}/backtrace.cpp
+ "#include \n"
+ "#include \n\n"
+ "int main() {\n"
+ " void *callstack[128];\n"
+ " size_t nMaxFrames = sizeof(callstack) / sizeof(callstack[0]);\n"
+ " size_t nFrames = backtrace(callstack, nMaxFrames);\n"
+ " char **symbols = backtrace_symbols(callstack, nFrames);\n"
+ " return 0;\n"
+ "}"
+)
+
+try_compile(
+ RESULT_VAR
+ ${CMAKE_BINARY_DIR}
+ SOURCES
+ ${CMAKE_BINARY_DIR}/backtrace.cpp
+)
+
+SET(HAVE_BACKTRACE_SYMBOLS ${RESULT_VAR})
diff --git a/cmake/FindCoin3DDoc.cmake b/cmake/FindCoin3DDoc.cmake
new file mode 100644
index 00000000..70ae9e15
--- /dev/null
+++ b/cmake/FindCoin3DDoc.cmake
@@ -0,0 +1,70 @@
+# Try to find Coin3D Doc
+# If found, this will define
+#
+# COIN3D_DOC_FOUND - we have access to Coin3D doc, either locally
+# or on the net
+# COIN3D_DOC_TAGFILE - full name of the tag file
+# COIN3D_DOC_PATH - path to html Coin3D doc
+
+SET( COIN3D_DOC_FOUND "NO" )
+
+IF (COIN3D_FOUND)
+ IF (WIN32)
+ IF (CYGWIN)
+ # Not yet implemented
+ ELSE (CYGWIN)
+ # Not yet implemented
+ ENDIF (CYGWIN)
+ ELSE (WIN32)
+ IF(APPLE)
+ # Not yet implemented
+ ELSE(APPLE)
+ # Unix systems
+ find_path(COIN3D_DOC_PATH index.html
+ /usr/share/doc/libcoin80-doc/html
+ /usr/share/doc/coin/html
+ /usr/share/doc/Coin/html
+ )
+ IF( EXISTS ${COIN3D_DOC_PATH})
+ message(STATUS "Coin3D doc is installed")
+ find_file(COIN3D_DOC_TAGFILE NAMES coin.tag Coin.tag
+ PATHS ${COIN3D_DOC_PATH}
+ )
+ IF( EXISTS ${COIN3D_DOC_TAGFILE})
+ SET( COIN3D_DOC_FOUND "YES"
+ )
+ ELSE( EXISTS ${COIN3D_DOC_TAGFILE})
+ find_file(COIN3D_DOC_TAGFILE_GZ NAMES coin.tag.gz Coin.tag.gz
+ PATHS ${COIN3D_DOC_PATH}
+ )
+ IF( EXISTS ${COIN3D_DOC_TAGFILE_GZ})
+ message(STATUS " Found ${COIN3D_DOC_TAGFILE_GZ}")
+ message(STATUS " You should uncompress this file if you want to use it for source doc generation")
+ ENDIF( EXISTS ${COIN3D_DOC_TAGFILE_GZ})
+
+ ENDIF( EXISTS ${COIN3D_DOC_TAGFILE})
+
+ ELSE( EXISTS ${COIN3D_DOC_PATH})
+ #fallback: tries to use online coin doc
+ message(STATUS "Coin3D doc is not installed")
+ SET(COIN3D_DOC_PATH
+ http://doc.coin3d.org/Coin
+ )
+ find_file(COIN3D_DOC_TAGFILE coin.tag
+ ${CMAKE_BINARY_DIR}/src/Doc
+ )
+ IF( EXISTS ${COIN3D_DOC_TAGFILE})
+ SET( COIN3D_DOC_FOUND "YES" )
+ ENDIF( EXISTS ${COIN3D_DOC_TAGFILE})
+ ENDIF( EXISTS ${COIN3D_DOC_PATH})
+ ENDIF(APPLE)
+ ENDIF(WIN32)
+ENDIF(COIN3D_FOUND)
+
+if(COIN3D_DOC_FOUND)
+ message(STATUS " Tag file: ${COIN3D_DOC_TAGFILE}")
+ message(STATUS " Location: ${COIN3D_DOC_PATH}")
+endif(COIN3D_DOC_FOUND)
+
+# export for others
+SET( COIN3D_DOC_FOUND "${COIN3D_DOC_FOUND}" CACHE BOOL "Coin3d documentation available")
diff --git a/cmake/FindEigen3.cmake b/cmake/FindEigen3.cmake
new file mode 100644
index 00000000..eda81431
--- /dev/null
+++ b/cmake/FindEigen3.cmake
@@ -0,0 +1,65 @@
+# - Try to find Eigen3 lib
+#
+# This module supports requiring a minimum version, e.g. you can do
+# find_package(Eigen3 3.1.2)
+# to require version 3.1.2 or newer of Eigen3.
+#
+# Once done this will define
+#
+# EIGEN3_FOUND - system has eigen lib with correct version
+# EIGEN3_INCLUDE_DIR - the eigen include directory
+# EIGEN3_VERSION - eigen version
+
+# Copyright (c) 2006, 2007 Montel Laurent,
+# Copyright (c) 2008, 2009 Gael Guennebaud,
+# Copyright (c) 2009 Benoit Jacob
+# Redistribution and use is allowed according to the terms of the 2-clause BSD license.
+
+if(NOT Eigen3_FIND_VERSION)
+ set(Eigen3_FIND_VERSION_MAJOR 3)
+ set(Eigen3_FIND_VERSION_MINOR 0)
+ set(Eigen3_FIND_VERSION_PATCH 0)
+ set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
+endif(NOT Eigen3_FIND_VERSION)
+
+macro(_eigen3_check_version)
+ file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
+
+ string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")
+ set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
+ string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}")
+ set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
+ string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}")
+ set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")
+
+ set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
+ if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
+ set(EIGEN3_VERSION_OK FALSE)
+ message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "
+ "but at least version ${Eigen3_FIND_VERSION} is required")
+ else(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
+ set(EIGEN3_VERSION_OK TRUE)
+ endif(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
+endmacro(_eigen3_check_version)
+
+if (EIGEN3_INCLUDE_DIR)
+ # in cache already
+ _eigen3_check_version()
+ set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
+else (EIGEN3_INCLUDE_DIR)
+
+ find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
+ PATHS
+ ${CMAKE_INSTALL_PREFIX}/include
+ ${KDE4_INCLUDE_DIR}
+ PATH_SUFFIXES eigen3 eigen
+ )
+
+ if(EIGEN3_INCLUDE_DIR)
+ _eigen3_check_version()
+ endif(EIGEN3_INCLUDE_DIR)
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(Eigen3 REQUIRED_VARS EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK VERSION_VAR EIGEN3_VERSION)
+ mark_as_advanced(EIGEN3_INCLUDE_DIR)
+
+endif(EIGEN3_INCLUDE_DIR)
diff --git a/cmake/FindKDL.cmake b/cmake/FindKDL.cmake
new file mode 100644
index 00000000..65bd9ddf
--- /dev/null
+++ b/cmake/FindKDL.cmake
@@ -0,0 +1,58 @@
+# Locate KDL install directory
+
+# This module defines
+# KDL_INSTALL where to find include, lib, bin, etc.
+# KDL_FOUND, is set to true
+
+#INCLUDE (${PROJECT_SOURCE_DIR}/config/FindPkgConfig.cmake)
+
+IF ( CMAKE_PKGCONFIG_EXECUTABLE )
+
+ MESSAGE( STATUS "Detecting KDL" )
+
+ SET(ENV{PKG_CONFIG_PATH} "${KDL_INSTALL}/lib/pkgconfig/")
+ MESSAGE( "Looking for KDL in: ${KDL_INSTALL}")
+ PKGCONFIG( "orocos-kdl >= 0.99" KDL_FOUND KDL_INCLUDE_DIRS KDL_DEFINES KDL_LINK_DIRS KDL_LIBS )
+
+ IF( KDL_FOUND )
+ MESSAGE(" Includes in: ${KDL_INCLUDE_DIRS}")
+ MESSAGE(" Libraries in: ${KDL_LINK_DIRS}")
+ MESSAGE(" Libraries: ${KDL_LIBS}")
+ MESSAGE(" Defines: ${KDL_DEFINES}")
+
+ INCLUDE_DIRECTORIES( ${KDL_INCLUDE_DIRS} )
+ LINK_DIRECTORIES( ${KDL_LINK_DIRS})
+ #OROCOS_PKGCONFIG_INCPATH("${KDLTK_INCLUDE_DIRS}")
+ #OROCOS_PKGCONFIG_LIBS("${KDL_LIBS}")
+ #OROCOS_PKGCONFIG_LIBPATH("${KDL_LINK_DIRS}")
+
+ SET(ENV{PKG_CONFIG_PATH} "${KDL_INSTALL}/lib/pkgconfig/:${OROCOS_INSTALL}/lib/pkgconfig")
+ MESSAGE( "Looking for KDL Toolkit in: ${PKG_CONFIG_PATH}")
+ PKGCONFIG( "orocos-kdltk-${OROCOS_TARGET} >= 0.99" KDLTK_FOUND KDLTK_INCLUDE_DIRS KDLTK_DEFINES KDLTK_LINK_DIRS KDLTK_LIBS )
+ IF(KDLTK_FOUND)
+ INCLUDE_DIRECTORIES( ${KDLTK_INCLUDE_DIRS} )
+ LINK_DIRECTORIES( ${KDLTK_LINK_DIRS})
+ OROCOS_PKGCONFIG_INCPATH("${KDLTK_INCLUDE_DIRS}")
+ OROCOS_PKGCONFIG_LIBPATH("${KDLTK_LINK_DIRS}")
+ OROCOS_PKGCONFIG_LIBS("${KDLTK_LIBS}")
+ IF(CORBA_ENABLED)
+ SET(ENV{PKG_CONFIG_PATH} "${KDL_INSTALL}/lib/pkgconfig/:${OROCOS_INSTALL}/lib/pkgconfig")
+ MESSAGE("Looking for KDL Toolkit CORBA extension in ${PKG_CONFIG_PATH}")
+ PKGCONFIG( "orocos-kdltk-corba-${OROCOS_TARGET} >= 0.99" KDLTKCORBA_FOUND KDLTKCORBA_INCLUDE_DIRS KDLTKCORBA_DEFINES KDLTKCORBA_LINK_DIRS KDLTKCORBA_LIBS )
+ IF(KDLTKCORBA_FOUND)
+ INCLUDE_DIRECTORIES( ${KDLTKCORBA_INCLUDE_DIRS} )
+ LINK_DIRECTORIES( ${KDLTKCORBA_LINK_DIRS})
+ OROCOS_PKGCONFIG_INCPATH("${KDLTKCORBA_INCLUDE_DIRS}")
+ OROCOS_PKGCONFIG_LIBPATH("${KDLTKCORBA_LINK_DIRS}")
+ OROCOS_PKGCONFIG_LIBS("${KDLTKCORBA_LIBS}")
+ ENDIF ( KDLTKCORBA_FOUND )
+ ENDIF(CORBA_ENABLED)
+ ENDIF ( KDLTK_FOUND )
+ ENDIF ( KDL_FOUND )
+
+ELSE ( CMAKE_PKGCONFIG_EXECUTABLE )
+
+ # Can't find pkg-config -- have to search manually
+ MESSAGE( FATAL_ERROR "Can't find KDL without pkgconfig !")
+
+ENDIF ( CMAKE_PKGCONFIG_EXECUTABLE )
diff --git a/cmake/FindMEDFile.cmake b/cmake/FindMEDFile.cmake
new file mode 100644
index 00000000..13af50bc
--- /dev/null
+++ b/cmake/FindMEDFile.cmake
@@ -0,0 +1,70 @@
+# - Find MED file installation
+#
+# The following variable are set:
+# MEDFILE_INCLUDE_DIRS
+# MEDFILE_LIBRARIES
+# MEDFILE_C_LIBRARIES
+# MEDFILE_F_LIBRARIES
+# MEDFILE_VERSION
+#
+# The CMake (or environment) variable MEDFILE_ROOT_DIR can be set to
+# guide the detection and indicate a root directory to look into.
+#
+############################################################################
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+# ------
+
+MESSAGE(STATUS "Check for medfile (libmed and libmedc) ...")
+
+# ------
+
+SET(MEDFILE_ROOT_DIR $ENV{MEDFILE_ROOT_DIR} CACHE PATH "Path to the MEDFile.")
+IF(MEDFILE_ROOT_DIR)
+ LIST(APPEND CMAKE_PREFIX_PATH "${MEDFILE_ROOT_DIR}")
+ENDIF(MEDFILE_ROOT_DIR)
+
+FIND_PATH(MEDFILE_INCLUDE_DIRS med.h PATH_SUFFIXES med)
+FIND_FILE(meddotH med.h PATHS ${MEDFILE_INCLUDE_DIRS} NO_DEFAULT_PATH)
+IF(NOT meddotH)
+ MESSAGE(FATAL_ERROR "med.h not found, please install development header-files for libmedc")
+ENDIF(NOT meddotH)
+#FIND_PROGRAM(MDUMP mdump)
+FIND_LIBRARY(MEDFILE_C_LIBRARIES NAMES medC)
+FIND_LIBRARY(MEDFILE_F_LIBRARIES NAMES med)
+IF(MEDFILE_F_LIBRARIES)
+ SET(MEDFILE_LIBRARIES ${MEDFILE_C_LIBRARIES} ${MEDFILE_F_LIBRARIES})
+ELSE(MEDFILE_F_LIBRARIES)
+ SET(MEDFILE_LIBRARIES ${MEDFILE_C_LIBRARIES})
+ENDIF(MEDFILE_F_LIBRARIES)
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(MEDFile REQUIRED_VARS MEDFILE_INCLUDE_DIRS MEDFILE_LIBRARIES)
+
+IF(meddotH)
+ FILE(READ "${meddotH}" _med_h)
+ STRING(REGEX MATCH "define[ \t]+MED_MAJOR_NUM[ \t]+([0-9?])" _med_major_version_match "${_med_h}")
+ SET(MED_MAJOR_VERSION "${CMAKE_MATCH_1}")
+ STRING(REGEX MATCH "define[ \t]+MED_MINOR_NUM[ \t]+([0-9?])" _med_minor_version_match "${_med_h}")
+ SET(MED_MINOR_VERSION "${CMAKE_MATCH_1}")
+ STRING(REGEX MATCH "define[ \t]+MED_RELEASE_NUM[ \t]+([0-9?])" _med_release_version_match "${_med_h}")
+ SET(MED_RELEASE_VERSION "${CMAKE_MATCH_1}")
+ SET(MEDFILE_VERSION "${MED_MAJOR_VERSION}.${MED_MINOR_VERSION}.${MED_RELEASE_VERSION}")
+ENDIF()
diff --git a/cmake/FindMatplotlib.cmake b/cmake/FindMatplotlib.cmake
new file mode 100644
index 00000000..9c441e98
--- /dev/null
+++ b/cmake/FindMatplotlib.cmake
@@ -0,0 +1,45 @@
+# - Find the matplotlib libraries
+# This module finds IF matplotlib is installed, and sets the following variables
+# indicating where it is.
+#
+# MATPLOTLIB_FOUND - was matplotlib found
+# MATPLOTLIB_VERSION - the version of matplotlib found as a string
+# MATPLOTLIB_VERSION_MAJOR - the major version number of matplotlib
+# MATPLOTLIB_VERSION_MINOR - the minor version number of matplotlib
+# MATPLOTLIB_VERSION_PATCH - the patch version number of matplotlib
+# MATPLOTLIB_PATH_DIRS - path to the matplotlib include files
+
+IF(Python3_Interpreter_FOUND)
+ # Try to import matplotlib into Python interpreter. Python
+ # interpreter was found previously as required package, so
+ # don't take care about this.
+ execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
+ "import matplotlib as m; print(m.__version__); print(m.__path__[0]);"
+ RESULT_VARIABLE _MATPLOTLIB_SEARCH_SUCCESS
+ OUTPUT_VARIABLE _MATPLOTLIB_VALUES
+ ERROR_VARIABLE _MATPLOTLIB_ERROR_VALUE
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ IF(_MATPLOTLIB_SEARCH_SUCCESS MATCHES 0)
+ set(MATPLOTLIB_FOUND TRUE)
+
+ # Convert the process output into a list
+ string(REGEX REPLACE ";" "\\\\;" _MATPLOTLIB_VALUES ${_MATPLOTLIB_VALUES})
+ string(REGEX REPLACE "\n" ";" _MATPLOTLIB_VALUES ${_MATPLOTLIB_VALUES})
+ list(GET _MATPLOTLIB_VALUES 0 MATPLOTLIB_VERSION)
+ list(GET _MATPLOTLIB_VALUES 1 MATPLOTLIB_PATH_DIRS)
+
+ # Make sure all directory separators are '/'
+ string(REGEX REPLACE "\\\\" "/" MATPLOTLIB_PATH_DIRS ${MATPLOTLIB_PATH_DIRS})
+
+ # Get the major and minor version numbers
+ string(REGEX REPLACE "\\." ";" _MATPLOTLIB_VERSION_LIST ${MATPLOTLIB_VERSION})
+ list(GET _MATPLOTLIB_VERSION_LIST 0 MATPLOTLIB_VERSION_MAJOR)
+ list(GET _MATPLOTLIB_VERSION_LIST 1 MATPLOTLIB_VERSION_MINOR)
+ list(GET _MATPLOTLIB_VERSION_LIST 2 MATPLOTLIB_VERSION_PATCH)
+ ELSE()
+ set(MATPLOTLIB_FOUND FALSE)
+ ENDIF()
+ELSE()
+ set(MATPLOTLIB_FOUND FALSE)
+ENDIF()
diff --git a/cmake/FindNETGEN.cmake b/cmake/FindNETGEN.cmake
new file mode 100644
index 00000000..8162adfb
--- /dev/null
+++ b/cmake/FindNETGEN.cmake
@@ -0,0 +1,149 @@
+# Try to find nglib/netgen
+#
+# Optional input NETGENDATA is path to the netgen libsrc source tree - this is
+# required due to some headers not being installed by netgen.
+#
+# Once done this will define
+#
+# NGLIB_INCLUDE_DIR - where the nglib include directory can be found
+# NGLIB_LIBRARIES - Link this to use nglib
+# NETGEN_INCLUDE_DIRS - where the netgen include directories can be found
+# NETGEN_DEFINITIONS - C++ compiler defines required to use netgen/nglib
+#
+# See also: http://git.salome-platform.org/gitweb/?p=NETGENPLUGIN_SRC.git;a=summary
+
+
+find_package(Netgen CONFIG)
+IF (Netgen_FOUND)
+ set(NGLIB_INCLUDE_DIR ${NETGEN_INCLUDE_DIRS})
+ set(NGLIB_LIBRARIES nglib)
+ set(NETGEN_DEFINITIONS -DNO_PARALLEL_THREADS -DOCCGEOMETRY)
+ # for external smesh only the following two variables are needed:
+ set(NETGEN_FOUND True)
+ set(NETGEN_INCLUDE_DIRS ${NETGEN_INCLUDE_DIRS})
+
+ELSE ()
+
+ SET(NETGEN_DEFINITIONS -DNO_PARALLEL_THREADS -DOCCGEOMETRY)
+
+ IF (WIN32)
+ FIND_PATH(NGLIB_INCLUDE_DIR NAMES nglib.h PATHS ${NETGEN_INCLUDEDIR})
+ SET(NETGEN_LIBS nglib mesh occ interface)
+ SET(NGLIB_LIBRARIES "")
+ FOREACH (it ${NETGEN_LIBS})
+ FIND_LIBRARY(NGLIB ${it} PATHS ${NETGEN_LIBDIR})
+ FIND_LIBRARY(NGLIBD ${it}d PATHS ${NETGEN_LIBDIR})
+ IF (NGLIBD AND NGLIB)
+ SET(NG_LIB optimized ${NGLIB}
+ debug ${NGLIBD})
+ SET(NGLIB_LIBRARIES ${NGLIB_LIBRARIES} ${NG_LIB})
+ UNSET(NGLIB CACHE)
+ UNSET(NGLIBD CACHE)
+ ELSEIF (NGLIB)
+ SET(NGLIB_LIBRARIES ${NGLIB_LIBRARIES} ${NGLIB})
+ UNSET(NGLIB CACHE)
+ ENDIF ()
+ ENDFOREACH ()
+
+ IF (NOT NETGENDATA)
+ SET(NETGENDATA netgen)
+ ENDIF (NOT NETGENDATA)
+
+ ELSEIF (DEFINED MACPORTS_PREFIX OR DEFINED HOMEBREW_PREFIX)
+ IF (NETGEN_ROOT)
+ SET(NETGEN_INCLUDEDIR ${NETGEN_ROOT}/include)
+ SET(NETGEN_LIBDIR ${NETGEN_ROOT}/lib)
+ # allow to customize if NETGEN_ROOT is used
+ IF (NOT NETGENDATA)
+ SET(NETGENDATA ${NETGEN_ROOT}/libsrc)
+ ENDIF ()
+ ENDIF ()
+
+ FIND_PATH(NGLIB_INCLUDE_DIR NAMES nglib.h PATHS ${NETGEN_INCLUDEDIR} /usr/include /usr/include/netgen-mesher)
+ FIND_LIBRARY(NGLIB_LIBNGLIB nglib PATHS ${NETGEN_LIBDIR} /usr/lib /usr/lib64 /usr/local/lib)
+ SET(NGLIB_LIBRARIES ${NGLIB_LIBNGLIB})
+ FIND_LIBRARY(NGLIB_LIBMESH NAMES mesh ngmesh PATHS ${NETGEN_LIBDIR} /usr/lib /usr/lib64 /usr/local/lib)
+ IF (NGLIB_LIBMESH)
+ SET(NGLIB_LIBRARIES ${NGLIB_LIBRARIES} ${NGLIB_LIBMESH})
+ ENDIF ()
+ FIND_LIBRARY(NGLIB_LIBOCC NAMES occ ngocc PATHS ${NETGEN_LIBDIR} /usr/lib /usr/lib64 /usr/local/lib)
+ IF (NGLIB_LIBOCC)
+ SET(NGLIB_LIBRARIES ${NGLIB_LIBRARIES} ${NGLIB_LIBOCC})
+ ENDIF ()
+ FIND_LIBRARY(NGLIB_LIBINTERFACE NAMES interface nginterface PATHS ${NETGEN_LIBDIR} /usr/lib /usr/lib64 /usr/local/lib)
+ IF (NGLIB_LIBINTERFACE)
+ SET(NGLIB_LIBRARIES ${NGLIB_LIBRARIES} ${NGLIB_LIBINTERFACE})
+ ENDIF ()
+
+ IF (NOT NETGENDATA)
+ SET(NETGENDATA /usr/share/netgen/libsrc)
+ ENDIF ()
+ ENDIF ()
+
+ FIND_PATH(NETGEN_DIR_include NAMES mydefs.hpp NO_DEFAULT_PATH PATHS ${NGLIB_INCLUDE_DIR}/include ${NETGENDATA}/include ${NETGEN_INCLUDEDIR} ${NGLIB_INCLUDE_DIR})
+
+ IF (NOT NGLIB_INCLUDE_DIR AND NOT NETGEN_DIR_include)
+ MESSAGE(STATUS "Cannot find NETGEN header files.")
+ ELSEIF (NOT NETGEN_VERSION)
+ file(STRINGS ${NETGEN_DIR_include}/mydefs.hpp NETGEN_VERSION REGEX "#define PACKAGE_VERSION.*")
+ ENDIF ()
+
+ IF (NOT NGLIB_LIBRARIES)
+ MESSAGE(STATUS "Cannot find NETGEN library.")
+ ENDIF ()
+
+ IF (NGLIB_INCLUDE_DIR AND NGLIB_LIBRARIES)
+ SET(Netgen_FOUND TRUE)
+ SET(NETGEN_INCLUDE_DIRS ${NETGEN_DIR_include} ${NGLIB_INCLUDE_DIR})
+ LIST(REMOVE_DUPLICATES NETGEN_INCLUDE_DIRS)
+ ELSE ()
+ SET(Netgen_FOUND FALSE)
+ ENDIF ()
+ENDIF ()
+
+# Package-provided cMake file is not enough
+IF (Netgen_FOUND)
+ IF (NOT NETGEN_VERSION_MAJOR)
+ IF (NETGEN_VERSION)
+ string(REGEX MATCHALL "[0-9]+" NETGEN_VERSION_expr ${NETGEN_VERSION})
+ list(LENGTH NETGEN_VERSION_expr NETGEN_VERSION_COUNT)
+ list(GET NETGEN_VERSION_expr 0 NETGEN_VERSION_MAJOR)
+ IF (NETGEN_VERSION_COUNT GREATER 1)
+ list(GET NETGEN_VERSION_expr 1 NETGEN_VERSION_MINOR)
+ ELSE ()
+ set(NETGEN_VERSION_MINOR 0)
+ ENDIF ()
+ ELSE () # workaround for netgen 6.2 and newer. currently there is no easy way to detect the version
+ # better use "find_package(netgen CONFIG REQUIRED)"
+ set(NETGEN_VERSION_MAJOR 6)
+ set(NETGEN_VERSION_MINOR 2)
+ ENDIF ()
+ set(NETGEN_VERSION_PATCH 0)
+ ENDIF ()
+
+ MATH(EXPR NETGEN_VERSION_C "(${NETGEN_VERSION_MAJOR} << 16) + (${NETGEN_VERSION_MINOR} << 8) + (${NETGEN_VERSION_PATCH})")
+ MATH(EXPR NETGEN_VERSION_62 "(6 << 16) + (2 << 8)")
+ MATH(EXPR NETGEN_VERSION_62_2004 "(6 << 16) + (2 << 8) + (2004)")
+ IF (NOT NETGEN_VERSION_C LESS NETGEN_VERSION_62) # Version >= 6.2
+ IF (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ # Clang sometimes fails to include
+ include(CMakePushCheckState)
+ cmake_push_check_state(RESET)
+ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${NETGEN_CXX_FLAGS}")
+ check_cxx_source_compiles("#include \nint main(){}" CSTDIO_INCLUDE_TRY1)
+ IF (NOT CSTDIO_INCLUDE_TRY1)
+ # Ugly hack to make building gets function
+ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -U__cplusplus -D__cplusplus=201103L")
+ check_cxx_source_compiles("#include \nint main(){}" CSTDIO_INCLUDE_TRY2)
+ IF (NOT CSTDIO_INCLUDE_TRY2)
+ message(FATAL_ERROR "Cannot #include .")
+ ELSE ()
+ set(NETGEN_CXX_FLAGS "${NETGEN_CXX_FLAGS} -U__cplusplus -D__cplusplus=201103L")
+ ENDIF ()
+ ENDIF ()
+ cmake_pop_check_state()
+ ENDIF ()
+ ENDIF ()
+ MESSAGE(STATUS "Found NETGEN version ${NETGEN_VERSION_MAJOR}.${NETGEN_VERSION_MINOR}, calculated: ${NETGEN_VERSION_C}")
+ LIST(APPEND NETGEN_DEFINITIONS -DNETGEN_VERSION=${NETGEN_VERSION_C})
+ENDIF ()
diff --git a/cmake/FindOCC.cmake b/cmake/FindOCC.cmake
new file mode 100644
index 00000000..b8ff81c7
--- /dev/null
+++ b/cmake/FindOCC.cmake
@@ -0,0 +1,170 @@
+# Try to find OCE / OCC
+# Once done this will define
+#
+# OCC_FOUND - system has OCC - OpenCASCADE
+# OCC_INCLUDE_DIR - where the OCC include directory can be found
+# OCC_LIBRARY_DIR - where the OCC library directory can be found
+# OCC_LIBRARIES - Link this to use OCC
+# OCC_OCAF_LIBRARIES - Link this to use OCC OCAF framework
+
+# First try to find OpenCASCADE Community Edition
+if(NOT DEFINED OCE_DIR)
+ # Check for OSX needs to come first because UNIX evaluates to true on OSX
+ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ if(DEFINED MACPORTS_PREFIX)
+ find_package(OCE QUIET HINTS ${MACPORTS_PREFIX}/Library/Frameworks)
+ elseif(DEFINED HOMEBREW_PREFIX)
+ find_package(OCE QUIET HINTS ${HOMEBREW_PREFIX}/Cellar/oce/*)
+ endif()
+ elseif(UNIX)
+ set(OCE_DIR "/usr/local/share/cmake/")
+ elseif(WIN32)
+ set(OCE_DIR "c:/OCE-0.4.0/share/cmake")
+ endif()
+endif()
+
+if(${ISIMPA_USE_OCC_VARIANT} MATCHES "Community Edition")
+ find_package(OCE QUIET)
+endif()
+
+if(OCE_FOUND)
+ message(STATUS "-- OpenCASCADE Community Edition has been found.")
+ # Disable this define. For more details see bug #0001872
+ #add_definitions (-DHAVE_CONFIG_H)
+ set(OCC_INCLUDE_DIR ${OCE_INCLUDE_DIRS})
+ #set(OCC_LIBRARY_DIR ${OCE_LIBRARY_DIR})
+else(OCE_FOUND) #look for OpenCASCADE
+ # we first try to find opencascade directly:
+ if(NOT OCCT_CMAKE_FALLBACK)
+ find_package(OpenCASCADE CONFIG QUIET)
+ if(NOT (CMAKE_VERSION VERSION_LESS 3.6.0))
+ get_property(flags DIRECTORY PROPERTY COMPILE_DEFINITIONS)
+ # OCCT 7.5 adds this define that causes hundreds of compiler warnings with Qt5.x, so remove it again
+ list(FILTER flags EXCLUDE REGEX [[GL_GLEXT_LEGACY]])
+ set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS ${flags})
+ endif()
+ endif(NOT OCCT_CMAKE_FALLBACK)
+ if(OpenCASCADE_FOUND)
+ set(OCC_FOUND ${OpenCASCADE_FOUND})
+ set(OCC_INCLUDE_DIR ${OpenCASCADE_INCLUDE_DIR})
+ set(OCC_LIBRARY_DIR ${OpenCASCADE_LIBRARY_DIR})
+ set(OCC_LIBRARIES ${OpenCASCADE_LIBRARIES})
+ set(OCC_OCAF_LIBRARIES TKCAF TKXCAF)
+ else(OpenCASCADE_FOUND)
+ if(WIN32)
+ if(CYGWIN OR MINGW)
+ FIND_PATH(OCC_INCLUDE_DIR Standard_Version.hxx
+ /usr/include/opencascade
+ /usr/local/include/opencascade
+ /opt/opencascade/include
+ /opt/opencascade/inc
+ )
+ FIND_LIBRARY(OCC_LIBRARY TKernel
+ /usr/lib
+ /usr/local/lib
+ /opt/opencascade/lib
+ )
+ else(CYGWIN OR MINGW)
+ FIND_PATH(OCC_INCLUDE_DIR Standard_Version.hxx
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\SIM\\OCC\\2;Installation Path]/include"
+ )
+ FIND_LIBRARY(OCC_LIBRARY TKernel
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\SIM\\OCC\\2;Installation Path]/lib"
+ )
+ endif(CYGWIN OR MINGW)
+ else(WIN32)
+ FIND_PATH(OCC_INCLUDE_DIR Standard_Version.hxx
+ /usr/include/occt
+ /usr/include/opencascade
+ /usr/local/include/opencascade
+ /opt/opencascade/include
+ /opt/opencascade/inc
+ )
+ FIND_LIBRARY(OCC_LIBRARY TKernel
+ /usr/lib
+ /usr/local/lib
+ /opt/opencascade/lib
+ )
+ endif(WIN32)
+ if(OCC_LIBRARY)
+ GET_FILENAME_COMPONENT(OCC_LIBRARY_DIR ${OCC_LIBRARY} PATH)
+ IF(NOT OCC_INCLUDE_DIR)
+ FIND_PATH(OCC_INCLUDE_DIR Standard_Version.hxx
+ ${OCC_LIBRARY_DIR}/../inc
+ )
+ ENDIF()
+ endif(OCC_LIBRARY)
+ endif(OpenCASCADE_FOUND)
+endif(OCE_FOUND)
+
+if(OCC_INCLUDE_DIR)
+ file(STRINGS ${OCC_INCLUDE_DIR}/Standard_Version.hxx OCC_MAJOR
+ REGEX "#define OCC_VERSION_MAJOR.*"
+ )
+ string(REGEX MATCH "[0-9]+" OCC_MAJOR ${OCC_MAJOR})
+ file(STRINGS ${OCC_INCLUDE_DIR}/Standard_Version.hxx OCC_MINOR
+ REGEX "#define OCC_VERSION_MINOR.*"
+ )
+ string(REGEX MATCH "[0-9]+" OCC_MINOR ${OCC_MINOR})
+ file(STRINGS ${OCC_INCLUDE_DIR}/Standard_Version.hxx OCC_MAINT
+ REGEX "#define OCC_VERSION_MAINTENANCE.*"
+ )
+ string(REGEX MATCH "[0-9]+" OCC_MAINT ${OCC_MAINT})
+
+ set(OCC_VERSION_STRING "${OCC_MAJOR}.${OCC_MINOR}.${OCC_MAINT}")
+endif(OCC_INCLUDE_DIR)
+
+# handle the QUIETLY and REQUIRED arguments and set OCC_FOUND to TRUE if
+# all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OCC REQUIRED_VARS OCC_INCLUDE_DIR VERSION_VAR OCC_VERSION_STRING)
+
+if(OCC_FOUND)
+ set(OCC_LIBRARIES
+ TKFillet
+ TKMesh
+ TKernel
+ TKG2d
+ TKG3d
+ TKMath
+ TKShHealing
+ TKXSBase
+ TKBool
+ TKBO
+ TKBRep
+ TKTopAlgo
+ TKGeomAlgo
+ TKGeomBase
+ TKOffset
+ TKPrim
+ TKHLR
+ TKFeat
+ )
+ set(OCC_OCAF_LIBRARIES
+ TKBin
+ TKBinL
+ TKCAF
+ TKXCAF
+ TKLCAF
+ TKVCAF
+ TKCDF
+ TKMeshVS
+ TKService
+ TKV3d
+ )
+
+ if(NOT OCC_VERSION_STRING VERSION_LESS 7.5.0)
+ list(APPEND OCC_OCAF_LIBRARIES TKRWMesh)
+ endif(NOT OCC_VERSION_STRING VERSION_LESS 7.5.0)
+ if(OCC_VERSION_STRING VERSION_LESS 7.8.0)
+ list(APPEND OCC_LIBRARIES TKIGES TKSTL TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP)
+ list(APPEND OCC_OCAF_LIBRARIES TKXDESTEP TKXDEIGES)
+ else(OCC_VERSION_STRING VERSION_LESS 7.8.0)
+ list(APPEND OCC_LIBRARIES TKDESTEP TKDEIGES TKDEGLTF TKDESTL)
+ endif(OCC_VERSION_STRING VERSION_LESS 7.8.0)
+ message(STATUS "-- Found OCE/OpenCASCADE version: ${OCC_VERSION_STRING}")
+ message(STATUS "-- OCE/OpenCASCADE include directory: ${OCC_INCLUDE_DIR}")
+ message(STATUS "-- OCE/OpenCASCADE shared libraries directory: ${OCC_LIBRARY_DIR}")
+else(OCC_FOUND)
+ #message(SEND_ERROR "Neither OpenCASCADE Community Edition nor OpenCasCade were found: will not build CAD modules!")
+endif(OCC_FOUND)
diff --git a/cmake/FindOpenCV.cmake b/cmake/FindOpenCV.cmake
new file mode 100644
index 00000000..e5f2d37d
--- /dev/null
+++ b/cmake/FindOpenCV.cmake
@@ -0,0 +1,249 @@
+# - Try to find OpenCV library installation
+# See http://sourceforge.net/projects/opencvlibrary/
+#
+# The following variables are optionally searched for defaults
+# OpenCV_ROOT_DIR: Base directory of OpenCv tree to use.
+# OpenCV_FIND_REQUIRED_COMPONENTS : FIND_PACKAGE(OpenCV COMPONENTS ..)
+# compatible interface. typically CV CXCORE CVAUX HIGHGUI CVCAM .. etc.
+#
+# The following are set after configuration is done:
+# OpenCV_FOUND
+# OpenCV_INCLUDE_DIR
+# OpenCV_LIBRARIES
+# OpenCV_LINK_DIRECTORIES
+#
+# deprecated:
+# OPENCV_* uppercase replaced by case sensitive OpenCV_*
+# OPENCV_EXE_LINKER_FLAGS
+# OPENCV_INCLUDE_DIR : replaced by plural *_DIRS
+#
+# 2004/05 Jan Woetzel, Friso, Daniel Grest
+# 2006/01 complete rewrite by Jan Woetzel
+# 1006/09 2nd rewrite introducing ROOT_DIR and PATH_SUFFIXES
+# to handle multiple installed versions gracefully by Jan Woetzel
+#
+# tested with:
+# -OpenCV 0.97 (beta5a): MSVS 7.1, gcc 3.3, gcc 4.1
+# -OpenCV 0.99 (1.0rc1): MSVS 7.1
+#
+# www.mip.informatik.uni-kiel.de/~jw
+# --------------------------------
+
+
+MACRO(DBG_MSG _MSG)
+ # MESSAGE(STATUS "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}):\n${_MSG}")
+ENDMACRO(DBG_MSG)
+
+
+
+# required cv components with header and library if COMPONENTS unspecified
+IF (NOT OpenCV_FIND_COMPONENTS)
+ # default
+ SET(OpenCV_FIND_REQUIRED_COMPONENTS CV CXCORE CVAUX HIGHGUI )
+ IF (WIN32)
+ LIST(APPEND OpenCV_FIND_REQUIRED_COMPONENTS CVCAM ) # WIN32 only actually
+ ENDIF(WIN32)
+ENDIF (NOT OpenCV_FIND_COMPONENTS)
+
+
+# typical root dirs of installations, exactly one of them is used
+SET (OpenCV_POSSIBLE_ROOT_DIRS
+ "${OpenCV_ROOT_DIR}"
+ "$ENV{OpenCV_ROOT_DIR}"
+ "$ENV{OPENCV_DIR}" # only for backward compatibility deprecated by ROOT_DIR
+ "$ENV{OPENCV_HOME}" # only for backward compatibility
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Intel(R) Open Source Computer Vision Library_is1;Inno Setup: App Path]"
+ "$ENV{ProgramFiles}/OpenCV"
+ /usr/local
+ /usr
+ )
+
+
+# MIP Uni Kiel /opt/net network installation
+# get correct prefix for current gcc compiler version for gcc 3.x 4.x
+IF (${CMAKE_COMPILER_IS_GNUCXX})
+ IF (NOT OpenCV_FIND_QUIETLY)
+ MESSAGE(STATUS "Checking GNUCXX version 3/4 to determine OpenCV /opt/net/ path")
+ ENDIF (NOT OpenCV_FIND_QUIETLY)
+ EXEC_PROGRAM(${CMAKE_CXX_COMPILER} ARGS --version OUTPUT_VARIABLE CXX_COMPILER_VERSION)
+ IF (CXX_COMPILER_VERSION MATCHES ".*3\\.[0-9].*")
+ SET(IS_GNUCXX3 TRUE)
+ LIST(APPEND OpenCV_POSSIBLE_ROOT_DIRS /opt/net/gcc33/OpenCV )
+ ENDIF(CXX_COMPILER_VERSION MATCHES ".*3\\.[0-9].*")
+ IF (CXX_COMPILER_VERSION MATCHES ".*4\\.[0-9].*")
+ SET(IS_GNUCXX4 TRUE)
+ LIST(APPEND OpenCV_POSSIBLE_ROOT_DIRS /opt/net/gcc41/OpenCV )
+ ENDIF(CXX_COMPILER_VERSION MATCHES ".*4\\.[0-9].*")
+ENDIF (${CMAKE_COMPILER_IS_GNUCXX})
+
+#DBG_MSG("DBG (OpenCV_POSSIBLE_ROOT_DIRS=${OpenCV_POSSIBLE_ROOT_DIRS}")
+
+#
+# select exactly ONE OpenCV base directory/tree
+# to avoid mixing different version headers and libs
+#
+FIND_PATH(OpenCV_ROOT_DIR
+ NAMES
+ cv/include/cv.h # windows
+ include/opencv/cv.h # linux /opt/net
+ include/cv/cv.h
+ include/cv.h
+ PATHS ${OpenCV_POSSIBLE_ROOT_DIRS})
+DBG_MSG("OpenCV_ROOT_DIR=${OpenCV_ROOT_DIR}")
+
+
+# header include dir suffixes appended to OpenCV_ROOT_DIR
+SET(OpenCV_INCDIR_SUFFIXES
+ include
+ include/cv
+ include/opencv
+ cv/include
+ cxcore/include
+ cvaux/include
+ otherlibs/cvcam/include
+ otherlibs/highgui
+ otherlibs/highgui/include
+ otherlibs/_graphics/include
+ )
+
+# library linkdir suffixes appended to OpenCV_ROOT_DIR
+SET(OpenCV_LIBDIR_SUFFIXES
+ lib
+ OpenCV/lib
+ otherlibs/_graphics/lib
+ )
+#DBG_MSG("OpenCV_LIBDIR_SUFFIXES=${OpenCV_LIBDIR_SUFFIXES}")
+
+
+#
+# find incdir for each lib
+#
+FIND_PATH(OpenCV_CV_INCLUDE_DIR
+ NAMES cv.h
+ PATHS ${OpenCV_ROOT_DIR}
+ PATH_SUFFIXES ${OpenCV_INCDIR_SUFFIXES} )
+FIND_PATH(OpenCV_CXCORE_INCLUDE_DIR
+ NAMES cxcore.h
+ PATHS ${OpenCV_ROOT_DIR}
+ PATH_SUFFIXES ${OpenCV_INCDIR_SUFFIXES} )
+FIND_PATH(OpenCV_CVAUX_INCLUDE_DIR
+ NAMES cvaux.h
+ PATHS ${OpenCV_ROOT_DIR}
+ PATH_SUFFIXES ${OpenCV_INCDIR_SUFFIXES} )
+FIND_PATH(OpenCV_HIGHGUI_INCLUDE_DIR
+ NAMES highgui.h
+ PATHS ${OpenCV_ROOT_DIR}
+ PATH_SUFFIXES ${OpenCV_INCDIR_SUFFIXES} )
+FIND_PATH(OpenCV_CVCAM_INCLUDE_DIR
+ NAMES cvcam.h
+ PATHS ${OpenCV_ROOT_DIR}
+ PATH_SUFFIXES ${OpenCV_INCDIR_SUFFIXES} )
+
+#
+# find sbsolute path to all libraries
+# some are optionally, some may not exist on Linux
+#
+FIND_LIBRARY(OpenCV_CV_LIBRARY
+ NAMES cv opencv
+ PATHS ${OpenCV_ROOT_DIR}
+ PATH_SUFFIXES ${OpenCV_LIBDIR_SUFFIXES} )
+FIND_LIBRARY(OpenCV_CVAUX_LIBRARY
+ NAMES cvaux
+ PATHS ${OpenCV_ROOT_DIR} PATH_SUFFIXES ${OpenCV_LIBDIR_SUFFIXES} )
+FIND_LIBRARY(OpenCV_CVCAM_LIBRARY
+ NAMES cvcam
+ PATHS ${OpenCV_ROOT_DIR} PATH_SUFFIXES ${OpenCV_LIBDIR_SUFFIXES} )
+FIND_LIBRARY(OpenCV_CVHAARTRAINING_LIBRARY
+ NAMES cvhaartraining
+ PATHS ${OpenCV_ROOT_DIR} PATH_SUFFIXES ${OpenCV_LIBDIR_SUFFIXES} )
+FIND_LIBRARY(OpenCV_CXCORE_LIBRARY
+ NAMES cxcore
+ PATHS ${OpenCV_ROOT_DIR} PATH_SUFFIXES ${OpenCV_LIBDIR_SUFFIXES} )
+FIND_LIBRARY(OpenCV_CXTS_LIBRARY
+ NAMES cxts
+ PATHS ${OpenCV_ROOT_DIR} PATH_SUFFIXES ${OpenCV_LIBDIR_SUFFIXES} )
+FIND_LIBRARY(OpenCV_HIGHGUI_LIBRARY
+ NAMES highgui
+ PATHS ${OpenCV_ROOT_DIR} PATH_SUFFIXES ${OpenCV_LIBDIR_SUFFIXES} )
+FIND_LIBRARY(OpenCV_ML_LIBRARY
+ NAMES ml
+ PATHS ${OpenCV_ROOT_DIR} PATH_SUFFIXES ${OpenCV_LIBDIR_SUFFIXES} )
+FIND_LIBRARY(OpenCV_TRS_LIBRARY
+ NAMES trs
+ PATHS ${OpenCV_ROOT_DIR} PATH_SUFFIXES ${OpenCV_LIBDIR_SUFFIXES} )
+
+
+
+#
+# Logic selecting required libs and headers
+#
+SET(OpenCV_FOUND ON)
+DBG_MSG("OpenCV_FIND_REQUIRED_COMPONENTS=${OpenCV_FIND_REQUIRED_COMPONENTS}")
+FOREACH(NAME ${OpenCV_FIND_REQUIRED_COMPONENTS} )
+
+ # only good if header and library both found
+ IF (OpenCV_${NAME}_INCLUDE_DIR AND OpenCV_${NAME}_LIBRARY)
+ LIST(APPEND OpenCV_INCLUDE_DIRS ${OpenCV_${NAME}_INCLUDE_DIR} )
+ LIST(APPEND OpenCV_LIBRARIES ${OpenCV_${NAME}_LIBRARY} )
+ #DBG_MSG("appending for NAME=${NAME} ${OpenCV_${NAME}_INCLUDE_DIR} and ${OpenCV_${NAME}_LIBRARY}" )
+ ELSE (OpenCV_${NAME}_INCLUDE_DIR AND OpenCV_${NAME}_LIBRARY)
+ DBG_MSG("OpenCV component NAME=${NAME} not found! "
+ "\nOpenCV_${NAME}_INCLUDE_DIR=${OpenCV_${NAME}_INCLUDE_DIR} "
+ "\nOpenCV_${NAME}_LIBRARY=${OpenCV_${NAME}_LIBRARY} ")
+ SET(OpenCV_FOUND OFF)
+ ENDIF (OpenCV_${NAME}_INCLUDE_DIR AND OpenCV_${NAME}_LIBRARY)
+
+ENDFOREACH(NAME)
+
+DBG_MSG("OpenCV_INCLUDE_DIRS=${OpenCV_INCLUDE_DIRS}")
+DBG_MSG("OpenCV_LIBRARIES=${OpenCV_LIBRARIES}")
+
+# get the link directory for rpath to be used with LINK_DIRECTORIES:
+IF (OpenCV_CV_LIBRARY)
+ GET_FILENAME_COMPONENT(OpenCV_LINK_DIRECTORIES ${OpenCV_CV_LIBRARY} PATH)
+ENDIF (OpenCV_CV_LIBRARY)
+
+MARK_AS_ADVANCED(
+ OpenCV_ROOT_DIR
+ OpenCV_INCLUDE_DIRS
+ OpenCV_CV_INCLUDE_DIR
+ OpenCV_CXCORE_INCLUDE_DIR
+ OpenCV_CVAUX_INCLUDE_DIR
+ OpenCV_CVCAM_INCLUDE_DIR
+ OpenCV_HIGHGUI_INCLUDE_DIR
+ OpenCV_LIBRARIES
+ OpenCV_CV_LIBRARY
+ OpenCV_CXCORE_LIBRARY
+ OpenCV_CVAUX_LIBRARY
+ OpenCV_CVCAM_LIBRARY
+ OpenCV_CVHAARTRAINING_LIBRARY
+ OpenCV_CXTS_LIBRARY
+ OpenCV_HIGHGUI_LIBRARY
+ OpenCV_ML_LIBRARY
+ OpenCV_TRS_LIBRARY
+ )
+
+
+# be backward compatible:
+SET(OPENCV_LIBRARIES ${OpenCV_LIBRARIES} )
+SET(OPENCV_INCLUDE_DIR ${OpenCV_INCLUDE_DIRS} )
+SET(OPENCV_FOUND ${OpenCV_FOUND})
+
+
+
+# display help message
+IF(NOT OpenCV_FOUND)
+ # make FIND_PACKAGE friendly
+ IF(NOT OpenCV_FIND_QUIETLY)
+ IF(OpenCV_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR
+ "OpenCV required but some headers or libs not found. Please specify it's location with OpenCV_ROOT_DIR env. variable.")
+ ELSE(OpenCV_FIND_REQUIRED)
+ MESSAGE(STATUS
+ "ERROR: OpenCV was not found.")
+ ENDIF(OpenCV_FIND_REQUIRED)
+ ENDIF(NOT OpenCV_FIND_QUIETLY)
+ENDIF(NOT OpenCV_FOUND)
+
+
+
diff --git a/cmake/FindPyCXX.cmake b/cmake/FindPyCXX.cmake
new file mode 100644
index 00000000..e37b08ee
--- /dev/null
+++ b/cmake/FindPyCXX.cmake
@@ -0,0 +1,128 @@
+# Locate PyCXX headers and source files
+
+# This module defines
+# PYCXX_INCLUDE_DIR
+# PYCXX_SOURCE_DIR
+# PYCXX_FOUND
+# PYCXX_SOURCES
+# PYCXX_VERSION
+#
+# The PYCXX_*_DIR variables can be set to tell this module where
+# the files are.
+
+
+# There's no standard location for PyCXX.
+#
+# The authors' example is to put it in "~\" [sic].
+#
+# Ubuntu puts the includes into /usr/include/python2.7/CXX and sources into
+# /usr/share/python2.7/CXX.
+#
+# The Zultron Fedora RPM does the same as Ubuntu.
+
+set(PYCXX_FOUND "YES")
+
+# find the header directory
+if(PYCXX_INCLUDE_DIR)
+ # headers better be in there
+ if(NOT EXISTS "${PYCXX_INCLUDE_DIR}/CXX/Config.hxx")
+ if(PyCXX_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR
+ "PyCXX: could not find CXX/Config.hxx in PYCXX_INCLUDE_DIR "
+ "${PYCXX_INCLUDE_DIR}")
+ else(PyCXX_FIND_REQUIRED)
+ MESSAGE(WARNING
+ "PyCXX: could not find CXX/Config.hxx in PYCXX_INCLUDE_DIR "
+ "${PYCXX_INCLUDE_DIR}")
+ unset(PYCXX_FOUND)
+ endif(PyCXX_FIND_REQUIRED)
+ endif(NOT EXISTS "${PYCXX_INCLUDE_DIR}/CXX/Config.hxx")
+else(PYCXX_INCLUDE_DIR)
+ # check in 'standard' places
+ find_path(PYCXX_INCLUDE_DIR CXX/Config.hxx
+ ${PYTHON_INCLUDE_DIR}
+ "${CMAKE_CURRENT_LIST_DIR}/..")
+ if(NOT PYCXX_INCLUDE_DIR)
+ if(PyCXX_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR
+ "PyCXX not found; please set PYCXX_INCLUDE_DIR to "
+ "the location of CXX/Config.hxx")
+ else(PyCXX_FIND_REQUIRED)
+ MESSAGE(STATUS "PyCXX not found")
+ unset(PYCXX_FOUND)
+ endif(PyCXX_FIND_REQUIRED)
+ endif(NOT PYCXX_INCLUDE_DIR)
+endif(PYCXX_INCLUDE_DIR)
+
+# find the sources directory
+if(PYCXX_SOURCE_DIR)
+ # source directory specified, they'd better be there
+ if(NOT EXISTS "${PYCXX_SOURCE_DIR}/cxxextensions.c")
+ if(PyCXX_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR
+ "PyCXX: cxxextensions.c not found in PYCXX_SOURCE_DIR "
+ "${PYCXX_SOURCE_DIR}")
+ else(PyCXX_FIND_REQUIRED)
+ MESSAGE(WARNING
+ "PyCXX: cxxextensions.c not found in PYCXX_SOURCE_DIR "
+ "${PYCXX_SOURCE_DIR}")
+ unset(PYCXX_FOUND)
+ endif(PyCXX_FIND_REQUIRED)
+ endif(NOT EXISTS "${PYCXX_SOURCE_DIR}/cxxextensions.c")
+else(PYCXX_SOURCE_DIR)
+ # check in 'standard' places
+ find_path(PYCXX_SOURCE_DIR cxxextensions.c
+ "${PYCXX_INCLUDE_DIR}/CXX"
+ "${PYCXX_INCLUDE_DIR}/Src"
+ "${PYTHON_INCLUDE_DIR}/CXX"
+ "${PYTHON_INCLUDE_DIR}/Src"
+ "${CMAKE_CURRENT_LIST_DIR}/../Src"
+ "${CMAKE_CURRENT_LIST_DIR}/../CXX")
+ if(NOT PYCXX_SOURCE_DIR)
+ if(PyCXX_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR
+ "PyCXX not found; please set PYCXX_SOURCE_DIR to "
+ "the location of cxxextensions.c")
+ else(PyCXX_FIND_REQUIRED)
+ MESSAGE(STATUS "PyCXX not found")
+ unset(PYCXX_FOUND)
+ endif(PyCXX_FIND_REQUIRED)
+ endif(NOT PYCXX_SOURCE_DIR)
+endif(PYCXX_SOURCE_DIR)
+
+# Find PyCXX Version
+if(PYCXX_INCLUDE_DIR AND PYCXX_SOURCE_DIR)
+ file(READ ${PYCXX_INCLUDE_DIR}/CXX/Version.hxx PYCXX_VERSION_H)
+ foreach(item IN ITEMS MAJOR MINOR PATCH)
+ string(REGEX REPLACE
+ ".*#define[ \t]+PYCXX_VERSION_${item}[ \t]+([0-9]+).*"
+ "\\1" PYCXX_VERSION_${item}
+ "${PYCXX_VERSION_H}"
+ )
+ endforeach()
+ set(PYCXX_VERSION ${PYCXX_VERSION_MAJOR}.${PYCXX_VERSION_MINOR}.${PYCXX_VERSION_PATCH})
+endif()
+
+# see what we've got
+if(PYCXX_FOUND)
+ MESSAGE(STATUS "PyCXX found:")
+ MESSAGE(STATUS " Headers: ${PYCXX_INCLUDE_DIR}")
+ MESSAGE(STATUS " Sources: ${PYCXX_SOURCE_DIR}")
+ MESSAGE(STATUS " Version: ${PYCXX_VERSION}")
+
+ # Build the list of sources for convenience
+ set(PYCXX_SOURCES
+ ${PYCXX_SOURCE_DIR}/cxxextensions.c
+ ${PYCXX_SOURCE_DIR}/cxx_extensions.cxx
+ ${PYCXX_SOURCE_DIR}/cxxsupport.cxx
+ ${PYCXX_SOURCE_DIR}/IndirectPythonInterface.cxx
+ )
+
+ #set old 6.2 pycxx compatibility
+ list(APPEND PYCXX_SOURCES ${PYCXX_SOURCE_DIR}/cxx_exceptions.cxx)
+ add_definitions(-DPYCXX_6_2_COMPATIBILITY)
+ #end old compatibility
+else(PYCXX_FOUND)
+ MESSAGE(STATUS "PyCXX not found")
+endif(PYCXX_FOUND)
+
diff --git a/cmake/FindPySide2Tools.cmake b/cmake/FindPySide2Tools.cmake
new file mode 100644
index 00000000..b4ce0fa4
--- /dev/null
+++ b/cmake/FindPySide2Tools.cmake
@@ -0,0 +1,52 @@
+# Try to find PySide2 utilities, PYSIDE2UIC and PYSIDE2RCC:
+# PYSIDE_UIC_EXECUTABLE - Location of PYSIDE2UIC executable
+# PYSIDE_RCC_EXECUTABLE - Location of PYSIDE2RCC executable
+# PYSIDE_TOOLS_FOUND - PySide2 utilities found.
+
+if(WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ #pyside2 tools are often in same location as python interpreter
+ get_filename_component(PYTHON_BIN_DIR ${PYTHON_EXECUTABLE} PATH)
+ set(PYSIDE_BIN_DIR ${PYTHON_BIN_DIR})
+endif(WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+
+# Since Qt v5.14, pyside2-uic and pyside2-rcc are directly provided by Qt5Core uic and rcc, with '-g python' option
+# We test Qt5Core version to act accordingly
+
+FIND_PACKAGE(Qt5 COMPONENTS Core Widgets)
+
+IF(Qt5Core_VERSION VERSION_LESS 5.14)
+ # Legacy (< 5.14)
+ FIND_PROGRAM(PYSIDE2_UIC_EXECUTABLE NAMES python2-pyside2-uic pyside2-uic pyside2-uic-${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} pyuic5 HINTS ${PYSIDE_BIN_DIR})
+ FIND_PROGRAM(PYSIDE2_RCC_EXECUTABLE NAMES pyside2-rcc pyside2-rcc-${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} pyrcc5 HINTS ${PYSIDE_BIN_DIR})
+ set(UICOPTIONS "")
+ set(RCCOPTIONS "")
+ELSE()
+ # New (>= 5.14)
+ if (TARGET Qt::uic)
+ get_property(PYSIDE2_UIC_EXECUTABLE TARGET Qt::uic PROPERTY LOCATION)
+ set(UICOPTIONS "--generator=python")
+ endif()
+ if (TARGET Qt::rcc)
+ get_property(PYSIDE2_RCC_EXECUTABLE TARGET Qt::rcc PROPERTY LOCATION)
+ set(RCCOPTIONS "--generator=python" "--compress-algo=zlib" "--compress=1")
+ endif()
+ENDIF()
+
+set(PYSIDE_RCC_EXECUTABLE ${PYSIDE2_RCC_EXECUTABLE})
+set(PYSIDE_UIC_EXECUTABLE ${PYSIDE2_UIC_EXECUTABLE})
+set(PySideTools_VERSION 2)
+
+if(PYSIDE_RCC_EXECUTABLE AND PYSIDE_UIC_EXECUTABLE)
+ set(PYSIDE_TOOLS_FOUND TRUE)
+ if (NOT PySide2Tools_FIND_QUIETLY)
+ message(STATUS "Found PySide2 tools: ${PYSIDE_UIC_EXECUTABLE}, ${PYSIDE_RCC_EXECUTABLE}")
+ endif (NOT PySide2Tools_FIND_QUIETLY)
+else()
+ if(PySide2Tools_FIND_REQUIRED)
+ message(FATAL_ERROR "PySide2 tools could not be found, but are required.")
+ else(PySide2Tools_FIND_REQUIRED)
+ if (NOT PySide2Tools_FIND_QUIETLY)
+ message(STATUS "PySide2 tools: not found.")
+ endif (NOT PySide2Tools_FIND_QUIETLY)
+ endif(PySide2Tools_FIND_REQUIRED)
+endif()
diff --git a/cmake/FindPySide6.cmake b/cmake/FindPySide6.cmake
new file mode 100644
index 00000000..2b0a5806
--- /dev/null
+++ b/cmake/FindPySide6.cmake
@@ -0,0 +1,22 @@
+# The Qt for Python project officially recommends using pip to install PySide, so we expect to find PySide in the
+# site-packages directory. The library will be called "PySide6.abi3.*", and there will be an "include" directory inside
+# the site-packages/PySide6. Over time some distros may provide custom versions, so we also support using a more normal
+# cMake find_package() call
+
+find_package(PySide6 CONFIG QUIET)
+if(NOT PySide6_FOUND)
+ if(NOT PySide6_INCLUDE_DIR AND TARGET PySide6::pyside6)
+ get_property(PySide6_INCLUDE_DIR TARGET PySide6::pyside6 PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
+ endif()
+
+ if(NOT PySide6_INCLUDE_DIR)
+ find_pip_package(PySide6)
+ if (PySide6_FOUND)
+ set(PYSIDE_INCLUDE_DIR ${PySide6_INCLUDE_DIRS} CACHE INTERNAL "")
+ set(PYSIDE_LIBRARY ${PySide6_LIBRARIES} CACHE INTERNAL "")
+ set(PYSIDE_FOUND TRUE CACHE BOOL OFF)
+ set(PYSIDE_MAJOR_VERSION 6 CACHE INTERNAL 6)
+ endif()
+ endif()
+
+endif()
diff --git a/cmake/FindPySide6Tools.cmake b/cmake/FindPySide6Tools.cmake
new file mode 100644
index 00000000..2c4b8c02
--- /dev/null
+++ b/cmake/FindPySide6Tools.cmake
@@ -0,0 +1,32 @@
+# Try to find PYSIDE6 utilities, PYSIDE6UIC and PYSIDE6RCC:
+# PYSIDE_UIC_EXECUTABLE - Location of PYSIDE6UIC executable
+# PYSIDE_RCC_EXECUTABLE - Location of PYSIDE6RCC executable
+# PYSIDE_TOOLS_FOUND - PYSIDE6 utilities found.
+
+if (TARGET Qt6::uic)
+ get_target_property(PYSIDE6_UIC_EXECUTABLE Qt6::uic LOCATION)
+ set(UICOPTIONS "--generator=python")
+endif()
+if (TARGET Qt6::rcc)
+ get_target_property(PYSIDE6_RCC_EXECUTABLE Qt6::rcc LOCATION)
+ set(RCCOPTIONS "--generator=python" "--compress-algo=zlib" "--compress=1")
+endif()
+
+set(PYSIDE_RCC_EXECUTABLE ${PYSIDE6_RCC_EXECUTABLE})
+set(PYSIDE_UIC_EXECUTABLE ${PYSIDE6_UIC_EXECUTABLE})
+set(PySideTools_VERSION 6)
+
+if(PYSIDE_RCC_EXECUTABLE AND PYSIDE_UIC_EXECUTABLE)
+ set(PYSIDE_TOOLS_FOUND TRUE)
+ if (NOT PYSIDE6Tools_FIND_QUIETLY)
+ message(STATUS "Found PYSIDE6 tools: ${PYSIDE_UIC_EXECUTABLE}, ${PYSIDE_RCC_EXECUTABLE}")
+ endif ()
+else()
+ if(PYSIDE6Tools_FIND_REQUIRED)
+ message(FATAL_ERROR "PYSIDE6 tools could not be found, but are required.")
+ else()
+ if (NOT PYSIDE6Tools_FIND_QUIETLY)
+ message(STATUS "PYSIDE6 tools: not found.")
+ endif ()
+ endif()
+endif()
diff --git a/cmake/FindRift.cmake b/cmake/FindRift.cmake
new file mode 100644
index 00000000..8082e8da
--- /dev/null
+++ b/cmake/FindRift.cmake
@@ -0,0 +1,100 @@
+# Find OCULUS
+#
+# This module defines
+# OCULUS_FOUND
+# OCULUS_INCLUDE_DIRS
+# OCULUS_LIBRARIES
+#
+# Copyright (c) 2012 I-maginer
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+# http://www.gnu.org/copyleft/lesser.txt
+#
+
+# On a new cmake run, we do not need to be verbose
+IF(OCULUS_INCLUDE_DIR AND OCULUS_LIBRARY)
+ SET(OCULUS_FIND_QUIETLY FALSE)
+ENDIF()
+
+# If OCULUS_ROOT was defined in the environment, use it.
+if (NOT OCULUS_ROOT)
+ if(NOT "$ENV{OCULUS_ROOT}" STREQUAL "")
+ set(OCULUS_ROOT $ENV{OCULUS_ROOT})
+ else()
+ set(OCULUS_ROOT $ENV{SCOL_DEPENDENCIES_PATH}/oculus/LibOVR)
+ endif()
+endif()
+
+# concat all the search paths
+IF(OCULUS_ROOT)
+ SET(OCULUS_INCLUDE_SEARCH_DIRS
+ ${OCULUS_INCLUDE_SEARCH_DIRS}
+ ${OCULUS_ROOT}/include
+ )
+ SET(OCULUS_LIBRARY_SEARCH_RELEASE_DIRS
+ ${OCULUS_LIBRARY_SEARCH_DIRS}
+ ${OCULUS_ROOT}/Lib/x64/VS2012
+ )
+ SET(OCULUS_LIBRARY_SEARCH_DEBUG_DIRS
+ ${OCULUS_LIBRARY_SEARCH_DIRS}
+ ${OCULUS_ROOT}/Lib/x64/VS2012
+ )
+ENDIF()
+
+# log message
+IF (NOT OCULUS_FIND_QUIETLY)
+ MESSAGE(STATUS "Checking for OCULUS library")
+ENDIF()
+
+# Search for header files
+FIND_PATH(OCULUS_INCLUDE_DIR OVR.h
+ PATHS ${OCULUS_INCLUDE_SEARCH_DIRS})
+
+# Search for libraries files (release mode)
+FIND_LIBRARY(OCULUS_LIBRARY_RELEASE libovr64
+ PATHS ${OCULUS_LIBRARY_SEARCH_RELEASE_DIRS})
+
+# Search for libraries files (debug mode)
+FIND_LIBRARY(OCULUS_LIBRARY_DEBUG libovr64d
+ PATHS ${OCULUS_LIBRARY_SEARCH_DEBUG_DIRS})
+
+# Configure libraries for debug/release
+SET(OCULUS_INCLUDE_DIRS ${OCULUS_INCLUDE_DIR} CACHE PATH "Directory containing OCULUS header files")
+SET(OCULUS_LIBRARY debug ${OCULUS_LIBRARY_DEBUG} optimized ${OCULUS_LIBRARY_RELEASE})
+SET(OCULUS_LIBRARIES ${OCULUS_LIBRARY} CACHE STRING "OCULUS libraries files")
+
+#IF(OCULUS_INCLUDE_DIR AND OCULUS_LIBRARY)
+ SET(OCULUS_FOUND TRUE)
+#ENDIF()
+
+# Hide those variables in GUI
+SET(OCULUS_INCLUDE_DIR ${OCULUS_INCLUDE_DIR} CACHE INTERNAL "")
+SET(OCULUS_LIBRARY_RELEASE ${OCULUS_LIBRARY_RELEASE} CACHE INTERNAL "")
+SET(OCULUS_LIBRARY_DEBUG ${OCULUS_LIBRARY_DEBUG} CACHE INTERNAL "")
+SET(OCULUS_LIBRARY ${OCULUS_LIBRARY} CACHE INTERNAL "")
+
+# log find result
+IF(OCULUS_FOUND)
+ IF(NOT OCULUS_FIND_QUIETLY)
+ MESSAGE(STATUS " libraries: ${OCULUS_LIBRARIES}")
+ MESSAGE(STATUS " includes: ${OCULUS_INCLUDE_DIRS}")
+ ENDIF()
+ELSE(OCULUS_FOUND)
+ IF(NOT OCULUS_LIBRARIES)
+ MESSAGE(STATUS, "OCULUS library or one of it dependencies could not be found.")
+ ENDIF()
+ IF(NOT OCULUS_INCLUDE_DIRS)
+ MESSAGE(STATUS "OCULUS include files could not be found.")
+ ENDIF()
+ENDIF(OCULUS_FOUND)
\ No newline at end of file
diff --git a/cmake/FindSMESH.cmake b/cmake/FindSMESH.cmake
new file mode 100644
index 00000000..fa48982c
--- /dev/null
+++ b/cmake/FindSMESH.cmake
@@ -0,0 +1,70 @@
+# Try to find Salome SMESH
+# Once done this will define
+#
+# SMESH_FOUND - system has Salome SMESH
+# SMESH_INCLUDE_DIR - where the Salome SMESH include directory can be found
+# SMESH_LIBRARIES - Link this to use Salome SMESH
+#
+
+# SMESH needs VTK
+find_package(VTK REQUIRED)
+
+# If this definition is not set, linker errors will occur against SMESH on 64 bit machines.
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ add_definitions(-DSALOME_USE_64BIT_IDS)
+endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
+
+IF (CMAKE_COMPILER_IS_GNUCC)
+ FIND_PATH(SMESH_INCLUDE_DIR SMESH_Mesh.hxx
+ # These are default search paths, why specify them?
+ PATH_SUFFIXES smesh SMESH smesh/SMESH
+ )
+ FIND_LIBRARY(SMESH_LIBRARY SMESH)
+ELSE (CMAKE_COMPILER_IS_GNUCC)
+ # Not yet implemented
+ENDIF (CMAKE_COMPILER_IS_GNUCC)
+
+IF(SMESH_INCLUDE_DIR)
+ SET(SMESH_INC_ROOT "${SMESH_INCLUDE_DIR}/..")
+ # Append extra include dirs
+ SET(SMESH_INCLUDE_DIR
+ "${SMESH_INCLUDE_DIR};
+ ${SMESH_INC_ROOT}/Controls;
+ ${SMESH_INC_ROOT}/Driver;
+ ${SMESH_INC_ROOT}/DriverDAT;
+ ${SMESH_INC_ROOT}/DriverGMF;
+ ${SMESH_INC_ROOT}/DriverSTL;
+ ${SMESH_INC_ROOT}/DriverUNV;
+ ${SMESH_INC_ROOT}/Geom;
+ ${SMESH_INC_ROOT}/Kernel;
+ ${SMESH_INC_ROOT}/MEFISTO2;
+ ${SMESH_INC_ROOT}/MeshVSLink;
+ ${SMESH_INC_ROOT}/Netgen;
+ ${SMESH_INC_ROOT}/NETGENPlugin;
+ ${SMESH_INC_ROOT}/SMDS;
+ ${SMESH_INC_ROOT}/SMESHDS;
+ ${SMESH_INC_ROOT}/SMESHUtils;
+ ${SMESH_INC_ROOT}/StdMeshers;")
+ELSE(SMESH_INCLUDE_DIR)
+ message(FATAL_ERROR "SMESH include directories not found!")
+ENDIF(SMESH_INCLUDE_DIR)
+
+SET(SMESH_FOUND FALSE)
+IF(SMESH_LIBRARY)
+ SET(SMESH_FOUND TRUE)
+ GET_FILENAME_COMPONENT(SMESH_LIBRARY_DIR ${SMESH_LIBRARY} PATH)
+ set(SMESH_LIBRARIES
+ ${SMESH_LIBRARY_DIR}/libDriver.so
+ ${SMESH_LIBRARY_DIR}/libDriverDAT.so
+ ${SMESH_LIBRARY_DIR}/libDriverSTL.so
+ ${SMESH_LIBRARY_DIR}/libDriverUNV.so
+ ${SMESH_LIBRARY_DIR}/libSMDS.so
+ ${SMESH_LIBRARY_DIR}/libSMESH.so
+ ${SMESH_LIBRARY_DIR}/libSMESHDS.so
+ ${SMESH_LIBRARY_DIR}/libStdMeshers.so
+ )
+ set(EXTERNAL_SMESH_LIBS ${SMESH_LIBRARIES})
+ELSE(SMESH_LIBRARY)
+ message(FATAL_ERROR "SMESH libraries NOT FOUND!")
+ENDIF(SMESH_LIBRARY)
+
diff --git a/cmake/FindShiboken6.cmake b/cmake/FindShiboken6.cmake
new file mode 100644
index 00000000..a9fbaffd
--- /dev/null
+++ b/cmake/FindShiboken6.cmake
@@ -0,0 +1,28 @@
+# The Qt for Python project officially recommends using pip to install Shiboken, so we expect to find Shiboken in the
+# site-packages directory. ISIMPA also requires shiboken6_generator, so this find script also locates that package
+# and ensures the inclusion of its include directory when using the pip finding mechanism
+
+
+find_package(Shiboken6 CONFIG QUIET)
+if(NOT Shiboken6_FOUND)
+ if(NOT Shiboken6_INCLUDE_DIR AND TARGET Shiboken6::Shiboken6)
+ get_property(Shiboken6_INCLUDE_DIR TARGET Shiboken6::Shiboken6 PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
+ endif()
+ if(NOT Shiboken6_INCLUDE_DIR)
+ find_pip_package(Shiboken6)
+ if (Shiboken6_FOUND)
+ set(SHIBOKEN_LIBRARY ${Shiboken6_LIBRARIES} CACHE INTERNAL "")
+ set(SHIBOKEN_MAJOR_VERSION 6 CACHE INTERNAL 6)
+ set(SHIBOKEN_FOUND ON CACHE BOOL OFF)
+ endif()
+ # The include directory we actually want is part of shiboken6-generator
+ find_pip_package(shiboken6_generator)
+ if (shiboken6_generator_FOUND)
+ set(SHIBOKEN_INCLUDE_DIR ${shiboken6_generator_INCLUDE_DIRS} CACHE PATH "")
+ endif()
+ endif()
+else()
+ set(SHIBOKEN_INCLUDE_DIR ${Shiboken6_INCLUDE_DIRS} CACHE PATH "")
+ set(SHIBOKEN_LIBRARY ${Shiboken6_LIBRARIES} CACHE INTERNAL "")
+ set(SHIBOKEN_FOUND ON CACHE BOOL OFF)
+endif()
diff --git a/cmake/FindSpnav.cmake b/cmake/FindSpnav.cmake
new file mode 100644
index 00000000..a9d234f2
--- /dev/null
+++ b/cmake/FindSpnav.cmake
@@ -0,0 +1,29 @@
+# Find the spnav library and header.
+#
+# Sets the usual variables expected for find_package scripts:
+#
+# SPNAV_INCLUDE_DIR - header location
+# SPNAV_LIBRARIES - library to link against
+# SPNAV_FOUND - true if pugixml was found.
+
+IF(UNIX)
+
+ FIND_PATH(SPNAV_INCLUDE_DIR spnav.h)
+
+ FIND_LIBRARY(SPNAV_LIBRARY
+ NAMES
+ spnav libspnav
+ )
+
+# Support the REQUIRED and QUIET arguments, and set SPNAV_FOUND if found.
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Spnav DEFAULT_MSG SPNAV_LIBRARY
+ SPNAV_INCLUDE_DIR)
+
+if(SPNAV_FOUND)
+ set(SPNAV_LIBRARIES ${SPNAV_LIBRARY})
+endif()
+
+mark_as_advanced(SPNAV_LIBRARY SPNAV_INCLUDE_DIR)
+
+ENDIF(UNIX)
diff --git a/cmake/FreeCadMacros.cmake b/cmake/FreeCadMacros.cmake
new file mode 100644
index 00000000..fdf3d93d
--- /dev/null
+++ b/cmake/FreeCadMacros.cmake
@@ -0,0 +1,325 @@
+include (CheckCXXSourceRuns)
+
+# ================================================================================
+# == Macros, mostly for special targets ==========================================
+
+MACRO (fc_copy_sources target_name outpath)
+ if(BUILD_VERBOSE_GENERATION)
+ set(fc_details " (fc_copy_sources called from ${CMAKE_CURRENT_SOURCE_DIR})")
+ else()
+ set(fc_details "")
+ endif()
+ foreach(it ${ARGN})
+ get_filename_component(infile ${it} ABSOLUTE)
+ get_filename_component(outfile "${outpath}/${it}" ABSOLUTE)
+ add_file_dependencies("${infile}" "${outfile}")
+ ADD_CUSTOM_COMMAND(
+ COMMAND "${CMAKE_COMMAND}" -E copy "${infile}" "${outfile}"
+ OUTPUT "${outfile}"
+ COMMENT "Copying ${infile} to ${outfile}${fc_details}"
+ MAIN_DEPENDENCY "${infile}"
+ )
+ endforeach(it)
+ ADD_CUSTOM_COMMAND(
+ TARGET ${target_name}
+ DEPENDS ${ARGN}
+ )
+ENDMACRO(fc_copy_sources)
+
+MACRO (fc_copy_file_if_different inputfile outputfile)
+ if (EXISTS ${inputfile})
+ if (EXISTS ${outputfile})
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} -E compare_files ${inputfile}
+ ${outputfile}
+ RESULT_VARIABLE DIFFERENT_FILES
+ OUTPUT_QUIET
+ ERROR_QUIET
+ )
+
+ if (DIFFERENT_FILES)
+ execute_process(COMMAND "${CMAKE_COMMAND}" -E copy "${inputfile}"
+ "${outputfile}")
+ endif()
+ else()
+ execute_process(COMMAND "${CMAKE_COMMAND}" -E copy "${inputfile}"
+ "${outputfile}")
+ endif()
+ endif()
+ENDMACRO(fc_copy_file_if_different)
+
+MACRO (fc_target_copy_resource target_name inpath outpath)
+# Macro to copy a list of files into a nested directory structure
+# Arguments -
+# target_name - name of the target the files will be added to
+# inpath - name of the source directory
+# outpath - name of the destination directory
+# ARGN - a list of relative file names that will be copied
+#
+# If a relative file name is foo/bar.txt then the foo directory
+# part will be kept so that the destination file name will be
+# ${outpath}/foo/bar.txt
+#
+ if(BUILD_VERBOSE_GENERATION)
+ set(fc_details " (fc_target_copy_resource called from ${CMAKE_CURRENT_SOURCE_DIR})")
+ else()
+ set(fc_details "")
+ endif()
+ foreach(it ${ARGN})
+ get_filename_component(infile "${inpath}/${it}" ABSOLUTE)
+ get_filename_component(outfile "${outpath}/${it}" ABSOLUTE)
+ add_file_dependencies("${infile}" "${outfile}")
+ ADD_CUSTOM_COMMAND(
+ COMMAND "${CMAKE_COMMAND}" -E copy "${infile}" "${outfile}"
+ OUTPUT "${outfile}"
+ COMMENT "Copying ${infile} to ${outfile}${fc_details}"
+ MAIN_DEPENDENCY "${infile}"
+ )
+ endforeach(it)
+ ADD_CUSTOM_COMMAND(
+ TARGET ${target_name}
+ DEPENDS ${ARGN}
+ )
+ENDMACRO(fc_target_copy_resource)
+
+MACRO (fc_target_copy_resource_flat target_name inpath outpath)
+# Macro to copy a list of files into a flat directory structure
+# Arguments -
+# target_name - name of the target the files will be added to
+# inpath - name of the source directory
+# outpath - name of the destination directory
+# ARGN - a list of relative file names that will be copied
+#
+# If a relative file name is foo/bar.txt then the foo directory
+# part will be removed so that the destination file name will be
+# ${outpath}/bar.txt
+#
+ if(BUILD_VERBOSE_GENERATION)
+ set(fc_details " (fc_target_copy_resource_flat called from ${CMAKE_CURRENT_SOURCE_DIR})")
+ else()
+ set(fc_details "")
+ endif()
+ foreach(it ${ARGN})
+ get_filename_component(infile "${inpath}/${it}" ABSOLUTE)
+ get_filename_component(outfile "${it}" NAME)
+ get_filename_component(outfile "${outpath}/${outfile}" ABSOLUTE)
+ add_file_dependencies("${infile}" "${outfile}")
+ ADD_CUSTOM_COMMAND(
+ COMMAND "${CMAKE_COMMAND}" -E copy "${infile}" "${outfile}"
+ OUTPUT "${outfile}"
+ COMMENT "Copying ${infile} to ${outfile}${fc_details}"
+ MAIN_DEPENDENCY "${infile}"
+ )
+ endforeach(it)
+ ADD_CUSTOM_COMMAND(
+ TARGET ${target_name}
+ DEPENDS ${ARGN}
+ )
+ENDMACRO(fc_target_copy_resource_flat)
+
+# It would be a bit cleaner to generate these files in ${CMAKE_CURRENT_BINARY_DIR}
+
+macro(generate_from_xml BASE_NAME)
+ set(TOOL_PATH "${CMAKE_SOURCE_DIR}/src/Tools/generate.py")
+ file(TO_NATIVE_PATH "${TOOL_PATH}" TOOL_NATIVE_PATH)
+ file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${BASE_NAME}.xml" SOURCE_NATIVE_PATH)
+
+ set(SOURCE_CPP_PATH "${CMAKE_CURRENT_BINARY_DIR}/${BASE_NAME}.cpp" )
+
+ # BASE_NAME may include also a path name
+ GET_FILENAME_COMPONENT(OUTPUT_PATH "${SOURCE_CPP_PATH}" PATH)
+ file(TO_NATIVE_PATH "${OUTPUT_PATH}" OUTPUT_NATIVE_PATH)
+ if(NOT EXISTS "${SOURCE_CPP_PATH}")
+ # assures the source files are generated at least once
+ message(STATUS "${SOURCE_CPP_PATH}")
+ execute_process(COMMAND "${PYTHON_EXECUTABLE}" "${TOOL_NATIVE_PATH}" --outputPath "${OUTPUT_NATIVE_PATH}" "${SOURCE_NATIVE_PATH}"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+ )
+ endif()
+ add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${BASE_NAME}.h" "${CMAKE_CURRENT_BINARY_DIR}/${BASE_NAME}.cpp"
+ COMMAND ${PYTHON_EXECUTABLE} "${TOOL_NATIVE_PATH}" --outputPath "${OUTPUT_NATIVE_PATH}" ${BASE_NAME}.xml
+ MAIN_DEPENDENCY "${BASE_NAME}.xml"
+ DEPENDS
+ "${CMAKE_SOURCE_DIR}/src/Tools/generateTemplates/templateClassPyExport.py"
+ "${TOOL_PATH}"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+ COMMENT "Building ${BASE_NAME}.h/.cpp out of ${BASE_NAME}.xml"
+ )
+endmacro(generate_from_xml)
+
+macro(generate_from_py BASE_NAME OUTPUT_FILE)
+ set(TOOL_PATH "${CMAKE_SOURCE_DIR}/src/Tools/PythonToCPP.py")
+ file(TO_NATIVE_PATH "${TOOL_PATH}" TOOL_NATIVE_PATH)
+ file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${BASE_NAME}.py" SOURCE_NATIVE_PATH)
+ add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILE}"
+ COMMAND "${PYTHON_EXECUTABLE}" "${TOOL_NATIVE_PATH}" "${SOURCE_NATIVE_PATH}" "${OUTPUT_FILE}"
+ MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/${BASE_NAME}.py"
+ DEPENDS "${TOOL_PATH}"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+ COMMENT "Building files out of ${BASE_NAME}.py")
+endmacro(generate_from_py)
+
+macro(generate_from_any INPUT_FILE OUTPUT_FILE VARIABLE)
+ set(TOOL_PATH "${CMAKE_SOURCE_DIR}/src/Tools/PythonToCPP.py")
+ file(TO_NATIVE_PATH "${TOOL_PATH}" TOOL_NATIVE_PATH)
+ file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${INPUT_FILE}" SOURCE_NATIVE_PATH)
+ add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILE}"
+ COMMAND "${PYTHON_EXECUTABLE}" "${TOOL_NATIVE_PATH}" "${SOURCE_NATIVE_PATH}" "${OUTPUT_FILE}" "${VARIABLE}"
+ MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/${INPUT_FILE}"
+ DEPENDS "${TOOL_PATH}"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+ COMMENT "Building files out of ${INPUT_FILE}")
+endmacro(generate_from_any)
+
+
+
+MACRO(ADD_MSVC_PRECOMPILED_HEADER TargetName PrecompiledHeader PrecompiledSource SourcesVar)
+ IF(MSVC)
+ GET_FILENAME_COMPONENT(PrecompiledBasename ${PrecompiledHeader} NAME_WE)
+ IF(MSVC_IDE)
+ SET(PrecompiledBinary "$(IntDir)\\$(TargetName).pch")
+ ELSE(MSVC_IDE)
+ SET(PrecompiledBinary ${CMAKE_CURRENT_BINARY_DIR}/${TargetName}.pch)
+ ENDIF(MSVC_IDE)
+ SET(Sources ${${SourcesVar}})
+
+ SET_SOURCE_FILES_PROPERTIES(${PrecompiledSource}
+ PROPERTIES COMPILE_FLAGS "/Yc\"${PrecompiledHeader}\" /Fp\"${PrecompiledBinary}\""
+ OBJECT_OUTPUTS "${PrecompiledBinary}")
+ SET_SOURCE_FILES_PROPERTIES(${Sources}
+ PROPERTIES COMPILE_FLAGS "/Yu\"${PrecompiledHeader}\" /FI\"${PrecompiledBinary}\" /Fp\"${PrecompiledBinary}\""
+ OBJECT_DEPENDS "${PrecompiledBinary}")
+ # Add precompiled header to SourcesVar
+ LIST(APPEND ${SourcesVar} ${PrecompiledSource})
+ ENDIF(MSVC)
+ENDMACRO(ADD_MSVC_PRECOMPILED_HEADER)
+
+MACRO(GET_MSVC_PRECOMPILED_SOURCE PrecompiledSource SourcesVar)
+ IF(MSVC)
+ FOREACH (it ${ARGN})
+ GET_FILENAME_COMPONENT(file_ext ${it} EXT)
+ GET_FILENAME_COMPONENT(file_name ${it} NAME)
+ STRING(COMPARE EQUAL ${it} ${PrecompiledSource} pch)
+ IF (NOT pch)
+ # get c++ source files
+ STRING(REGEX MATCH "^(.cpp|.cc|.cxx)$" cpp_file ${file_ext})
+ # ignore any generated source files from Qt
+ STRING(REGEX MATCH "^(moc_|qrc_|ui_)" gen_file ${file_name})
+ IF(cpp_file AND NOT gen_file)
+ LIST(APPEND ${SourcesVar} ${it})
+ ENDIF(cpp_file AND NOT gen_file)
+ ENDIF(NOT pch)
+ ENDFOREACH (it)
+ ENDIF(MSVC)
+ENDMACRO(GET_MSVC_PRECOMPILED_SOURCE)
+
+# Macro to replace all the binary output locations. Takes 2 optional parameters.
+# ${ARGVN} is zero based so the 3rd element is ${ARGV2}. When the 3rd element is missing,
+# Runtime and Lib directories default to /bin and /lib. When present, the 3rd element
+# specifies both Runtime and Lib directories. 4th specifies linux install path.
+MACRO(SET_BIN_DIR ProjectName OutputName)
+ set_target_properties(${ProjectName} PROPERTIES OUTPUT_NAME ${OutputName})
+ if(${ARGC} GREATER 2)
+ # VS_IDE (and perhaps others) make Release and Debug subfolders. This removes them.
+ set_target_properties(${ProjectName} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}${ARGV2})
+ set_target_properties(${ProjectName} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}${ARGV2})
+ set_target_properties(${ProjectName} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}${ARGV2})
+ set_target_properties(${ProjectName} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}${ARGV2})
+ set_target_properties(${ProjectName} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}${ARGV2})
+ set_target_properties(${ProjectName} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}${ARGV2})
+ else(${ARGC} GREATER 2)
+ set_target_properties(${ProjectName} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
+ set_target_properties(${ProjectName} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/bin)
+ set_target_properties(${ProjectName} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/bin)
+ set_target_properties(${ProjectName} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
+ set_target_properties(${ProjectName} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/lib)
+ set_target_properties(${ProjectName} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/lib)
+ endif(${ARGC} GREATER 2)
+
+ if(WIN32)
+ set_target_properties(${ProjectName} PROPERTIES DEBUG_OUTPUT_NAME ${OutputName}_d)
+ else(WIN32)
+ # ISIMPABase, SMDS, Driver and MEFISTO2 libs don't depend on parts from CMAKE_INSTALL_LIBDIR
+ if(NOT ${ProjectName} MATCHES "^(ISIMPABase|SMDS|Driver|MEFISTO2)$")
+ if(${ARGC} STREQUAL 4)
+ set_property(TARGET ${ProjectName} APPEND PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${ARGV3})
+ elseif(NOT IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR})
+ set_property(TARGET ${ProjectName} APPEND PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
+ else()
+ set_property(TARGET ${ProjectName} APPEND PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_LIBDIR})
+ endif()
+ endif()
+ endif(WIN32)
+ENDMACRO(SET_BIN_DIR)
+
+# Set python prefix & suffix together
+MACRO(SET_PYTHON_PREFIX_SUFFIX ProjectName)
+ if(NOT MSVC)
+ set_target_properties(${ProjectName} PROPERTIES PREFIX "")
+ endif(NOT MSVC)
+
+ if(WIN32)
+ set_target_properties(${ProjectName} PROPERTIES SUFFIX ".pyd")
+ # 0000661: cmake build on Mac OS: dealing with dylib versus so
+ elseif(APPLE)
+ set_target_properties(${ProjectName} PROPERTIES SUFFIX ".so")
+ endif(WIN32)
+ENDMACRO(SET_PYTHON_PREFIX_SUFFIX)
+
+# Locate the include directory for a pip-installed package -- uses pip show to find the base pip
+# install directory, and then appends the package name and "/include" to the end
+macro(find_pip_package PACKAGE)
+ execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} -m pip show ${PACKAGE}
+ RESULT_VARIABLE FAILURE
+ OUTPUT_VARIABLE PRINT_OUTPUT
+ )
+ if(NOT FAILURE)
+ # Extract Name: and Location: lines and use them to construct the include directory
+ string(REPLACE "\n" ";" PIP_OUTPUT_LINES ${PRINT_OUTPUT})
+ foreach(LINE IN LISTS PIP_OUTPUT_LINES)
+ STRING(FIND "${LINE}" "Name: " NAME_STRING_LOCATION)
+ STRING(FIND "${LINE}" "Location: " LOCATION_STRING_LOCATION)
+ if(${NAME_STRING_LOCATION} EQUAL 0)
+ STRING(SUBSTRING "${LINE}" 6 -1 PIP_PACKAGE_NAME)
+ STRING(STRIP "${PIP_PACKAGE_NAME}" PIP_PACKAGE_NAME)
+ STRING(REPLACE "-" "_" PIP_PACKAGE_NAME "${PIP_PACKAGE_NAME}")
+ elseif(${LOCATION_STRING_LOCATION} EQUAL 0)
+ STRING(SUBSTRING "${LINE}" 9 -1 PIP_PACKAGE_LOCATION)
+ STRING(STRIP "${PIP_PACKAGE_LOCATION}" PIP_PACKAGE_LOCATION)
+ endif()
+ endforeach()
+ file(TO_CMAKE_PATH "${PIP_PACKAGE_LOCATION}" PIP_PACKAGE_LOCATION)
+ if(EXISTS "${PIP_PACKAGE_LOCATION}/${PIP_PACKAGE_NAME}/include")
+ set(INCLUDE_DIR "${PIP_PACKAGE_LOCATION}/${PIP_PACKAGE_NAME}/include")
+ endif()
+ # There are many different library naming schemes, but basically we are looking for things that look like
+ # PACKAGE*.lib/so or PACKAGE_d*.lib/so
+ if(WIN32)
+ file(GLOB OPT_LIBRARIES "${PIP_PACKAGE_LOCATION}/${PIP_PACKAGE_NAME}/${PIP_PACKAGE_NAME}.*.lib")
+ file(GLOB DEBUG_LIBRARIES "${PIP_PACKAGE_LOCATION}/${PIP_PACKAGE_NAME}/${PIP_PACKAGE_NAME}_d.*.lib")
+ else()
+ string(TOLOWER ${PIP_PACKAGE_NAME} PIP_LIB_NAME)
+ file(GLOB OPT_LIBRARIES "${PIP_PACKAGE_LOCATION}/${PIP_PACKAGE_NAME}/*${PIP_LIB_NAME}*.so.*")
+ endif()
+ if (OPT_LIBRARIES AND DEBUG_LIBRARIES)
+ set(${PACKAGE}_LIBRARIES optimized ${OPT_LIBRARIES} debug ${DEBUG_LIBRARIES} CACHE PATH "")
+ elseif(OPT_LIBRARIES)
+ set(${PACKAGE}_LIBRARIES ${OPT_LIBRARIES} CACHE PATH "")
+ elseif(DEBUG_LIBRARIES)
+ set(${PACKAGE}_LIBRARIES ${DEBUG_LIBRARIES} CACHE PATH "")
+ endif()
+ set(${PACKAGE}_INCLUDE_DIRS ${INCLUDE_DIR} CACHE PATH "")
+ set(${PACKAGE}_FOUND ON CACHE BOOL OFF)
+ message(STATUS "Found pip-installed ${PACKAGE} in ${PIP_PACKAGE_LOCATION}/${PIP_PACKAGE_NAME}")
+ endif()
+endmacro()
+
+function(target_compile_warn_error ProjectName)
+ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
+ target_compile_options(${ProjectName} PRIVATE -Werror)
+ endif()
+endfunction()
diff --git a/cmake/ISIMPA_Helpers/CMakeLists.txt b/cmake/ISIMPA_Helpers/CMakeLists.txt
new file mode 100644
index 00000000..dd2d1afa
--- /dev/null
+++ b/cmake/ISIMPA_Helpers/CMakeLists.txt
@@ -0,0 +1,8 @@
+file(GLOB ISIMPA_HELPER_CMAKE_FILES ./*.cmake)
+
+foreach(_CMAKE_FILE ${ISIMPA_HELPER_CMAKE_FILES})
+ get_filename_component(_FILENAME ${_CMAKE_FILE} NAME)
+ if (NOT _FILENAME IN_LIST _SKIP_FILES)
+ include(${_CMAKE_FILE})
+ endif()
+endforeach(_CMAKE_FILE ${ISIMPA_HELPER_CMAKE_FILES})
diff --git a/cmake/ISIMPA_Helpers/CreatePackagingTargets.cmake b/cmake/ISIMPA_Helpers/CreatePackagingTargets.cmake
new file mode 100644
index 00000000..de8b52c6
--- /dev/null
+++ b/cmake/ISIMPA_Helpers/CreatePackagingTargets.cmake
@@ -0,0 +1,41 @@
+macro(CreatePackagingTargets)
+ # ================================================================================
+ # == Packaging ===================================================================
+ #
+ #add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
+ add_custom_target(dist-git
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/Tools/makedist.py
+ --bindir=${CMAKE_BINARY_DIR}
+ --major=${PACKAGE_VERSION_MAJOR}
+ --minor=${PACKAGE_VERSION_MINOR}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+ add_custom_target(distdfsg-git
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/Tools/makedist.py
+ --bindir=${CMAKE_BINARY_DIR}
+ --major=${PACKAGE_VERSION_MAJOR}
+ --minor=${PACKAGE_VERSION_MINOR}
+ --dfsg
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX OR MINGW)
+ add_custom_target(distcheck-git
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/Tools/makedist.py
+ --bindir=${CMAKE_BINARY_DIR}
+ --major=${PACKAGE_VERSION_MAJOR}
+ --minor=${PACKAGE_VERSION_MINOR}
+ --check
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+ add_custom_target(distcheckdfsg-git
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/Tools/makedist.py
+ --bindir=${CMAKE_BINARY_DIR}
+ --major=${PACKAGE_VERSION_MAJOR}
+ --minor=${PACKAGE_VERSION_MINOR}
+ --dfsg
+ --check
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+ endif()
+
+endmacro(CreatePackagingTargets)
diff --git a/cmake/ISIMPA_Helpers/ISIMPALibpackChecks.cmake b/cmake/ISIMPA_Helpers/ISIMPALibpackChecks.cmake
new file mode 100644
index 00000000..33b303e6
--- /dev/null
+++ b/cmake/ISIMPA_Helpers/ISIMPALibpackChecks.cmake
@@ -0,0 +1,49 @@
+macro(ISIMPALibpackChecks)
+ # ==============================================================================
+
+ if(ISIMPA_LIBPACK_USE)
+
+ # checking for a unique file in LibPack location to make sure the right version of the LibPack is there
+ find_file(ISIMPA_LIBPACK_CHECKFILE_CLBUNDLER MANIFEST.db PATHS ${ISIMPA_LIBPACK_DIR} NO_DEFAULT_PATH NO_CACHE)
+ find_file(ISIMPA_LIBPACK_CHECKFILE_VERSION ISIMPA_LIBPACK_VERSION PATHS ${ISIMPA_LIBPACK_DIR} NO_DEFAULT_PATH NO_CACHE)
+
+ # don't show them in the GUI
+ set(ISIMPA_LIBPACK_CHECKFILE_CLBUNDLER "${ISIMPA_LIBPACK_CHECKFILE_CLBUNDLER}" CACHE INTERNAL "Find libpack")
+ set(ISIMPA_LIBPACK_CHECKFILE_VERSION "${ISIMPA_LIBPACK_CHECKFILE_VERSION}" CACHE INTERNAL "Find libpack v3+")
+
+ if (ISIMPA_LIBPACK_CHECKFILE_CLBUNDLER)
+ set(ISIMPA_LIBPACK_VERSION "CLbundler" CACHE STRING "Displays if the libpack has been found" FORCE)
+ message("Found LibPack v2 (CLBundler) via ${ISIMPA_LIBPACK_CHECKFILE_CLBUNDLER}")
+ include(cMake/UseLibPackCLbundler.cmake)
+ elseif (ISIMPA_LIBPACK_CHECKFILE_VERSION)
+ file(READ ${ISIMPA_LIBPACK_CHECKFILE_VERSION} ISIMPA_LIBPACK_VERSION)
+ set(ISIMPA_LIBPACK_VERSION "${ISIMPA_LIBPACK_VERSION}" CACHE STRING "Version of the LibPack, if found" FORCE)
+ message("Found LibPack " ${ISIMPA_LIBPACK_VERSION})
+ include(cMake/UseLibPack3.cmake)
+ else(ISIMPA_LIBPACK_CHECKFILE_CLBUNDLER)
+ set(ISIMPA_LIBPACK_VERSION "NOTFOUND" CACHE STRING "Displays if the libpack has been found" FORCE)
+ message(SEND_ERROR "Could not find LibPack in specified location:" ${ISIMPA_LIBPACK_DIR})
+ endif(ISIMPA_LIBPACK_CHECKFILE_CLBUNDLER)
+# -------------------------------- PyCXX --------------------------------
+
+ find_package(PyCXX REQUIRED)
+
+# -------------------------------- Swig ----------------------------------
+
+ find_package(SWIG)
+
+ if(NOT SWIG_FOUND)
+ message("==================================================\n"
+ "SWIG not found, don't build SWIG binding for pivy.\n"
+ "==================================================\n")
+ endif(NOT SWIG_FOUND)
+
+# -------------------------------- Salome SMESH --------------------------
+
+ if(NOT ISIMPA_USE_EXTERNAL_SMESH)
+ set(SMESH_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/3rdParty/salomesmesh/inc)
+ endif()
+
+ endif(ISIMPA_LIBPACK_USE)
+
+endmacro(ISIMPALibpackChecks)
diff --git a/cmake/ISIMPA_Helpers/InitializeFreeCADBuildOptions.cmake b/cmake/ISIMPA_Helpers/InitializeFreeCADBuildOptions.cmake
new file mode 100644
index 00000000..52bf69f1
--- /dev/null
+++ b/cmake/ISIMPA_Helpers/InitializeFreeCADBuildOptions.cmake
@@ -0,0 +1,200 @@
+macro(InitializeISIMPABuildOptions)
+ # ==============================================================================
+ # ================= All the options for the build process =================
+ # ==============================================================================
+
+ option(BUILD_FORCE_DIRECTORY "The build directory must be different to the source directory." OFF)
+ option(BUILD_GUI "Build ISIMPA Gui. Otherwise you have only the command line and the Python import module." ON)
+ option(ISIMPA_USE_EXTERNAL_ZIPIOS "Use system installed zipios++ instead of the bundled." OFF)
+ option(ISIMPA_USE_EXTERNAL_SMESH "Use system installed smesh instead of the bundled." OFF)
+ option(ISIMPA_USE_EXTERNAL_KDL "Use system installed orocos-kdl instead of the bundled." OFF)
+ option(ISIMPA_USE_EXTERNAL_FMT "Use system installed fmt library if available instead of fetching the source." ON)
+ option(ISIMPA_USE_EXTERNAL_ONDSELSOLVER "Use system installed OndselSolver instead of git submodule." OFF)
+ option(ISIMPA_USE_FREETYPE "Builds the features using FreeType libs" ON)
+ option(ISIMPA_BUILD_DEBIAN "Prepare for a build of a Debian package" OFF)
+ option(BUILD_WITH_CONDA "Set ON if you build ISIMPA with conda" OFF)
+ option(BUILD_DYNAMIC_LINK_PYTHON "If OFF extension-modules do not link against python-libraries" ON)
+ option(INSTALL_TO_SITEPACKAGES "If ON the ISIMPA root namespace (python) is installed into python's site-packages" ON)
+ option(OCCT_CMAKE_FALLBACK "disable usage of occt-config files" OFF)
+ if (WIN32 OR APPLE)
+ option(ISIMPA_USE_QT_FILEDIALOG "Use Qt's file dialog instead of the native one." OFF)
+ else()
+ option(ISIMPA_USE_QT_FILEDIALOG "Use Qt's file dialog instead of the native one." ON)
+ endif()
+
+ # == Win32 is default behaviour use the LibPack copied in Source tree ==========
+ if(MSVC)
+ option(ISIMPA_RELEASE_PDB "Create PDB files for Release version." ON)
+ option(ISIMPA_RELEASE_SEH "Enable Structured Exception Handling for Release version." ON)
+ option(ISIMPA_LIBPACK_USE "Use the LibPack to Build ISIMPA (only Win32 so far)." ON)
+ option(ISIMPA_USE_PCH "Activate precompiled headers where it's used." ON)
+
+ if (DEFINED ENV{ISIMPA_LIBPACK_DIR})
+ set(ISIMPA_LIBPACK_DIR $ENV{ISIMPA_LIBPACK_DIR} CACHE PATH "Directory of the ISIMPA LibPack")
+ message(STATUS "Found libpack env variable: ${ISIMPA_LIBPACK_DIR}")
+ else()
+ set(ISIMPA_LIBPACK_DIR ${CMAKE_SOURCE_DIR} CACHE PATH "Directory of the ISIMPA LibPack")
+ endif()
+
+ set(LIBPACK_FOUND OFF )
+ if (EXISTS ${ISIMPA_LIBPACK_DIR}/plugins/imageformats/qsvg.dll)
+ set(LIBPACK_FOUND ON )
+ set(COPY_LIBPACK_BIN_TO_BUILD OFF )
+ # Create install commands for dependencies for INSTALL target in ISIMPA solution
+ option(ISIMPA_INSTALL_DEPEND_DIRS "Create install dependency commands for the INSTALL target found
+ in the ISIMPA solution." ON)
+ # Copy libpack smaller dependency folders to build folder per user request - if non-existent at destination
+ if (NOT EXISTS ${CMAKE_BINARY_DIR}/bin/imageformats/qsvg.dll)
+ option(ISIMPA_COPY_DEPEND_DIRS_TO_BUILD "Copy smaller libpack dependency directories to build directory." OFF)
+ endif()
+ # Copy libpack 'bin' directory contents to build 'bin' per user request - only IF NOT EXISTS already
+ if (NOT EXISTS ${CMAKE_BINARY_DIR}/bin/DLLs)
+ set(COPY_LIBPACK_BIN_TO_BUILD ON )
+ option(ISIMPA_COPY_LIBPACK_BIN_TO_BUILD "Copy larger libpack dependency 'bin' folder to the build directory." OFF)
+ # Copy only the minimum number of files to get a working application
+ option(ISIMPA_COPY_PLUGINS_BIN_TO_BUILD "Copy plugins to the build directory." OFF)
+ endif()
+ else()
+ message(WARNING Could not locate ${ISIMPA_LIBPACK_DIR}/plugins/imageformats/qsvg.dll)
+ message("Libpack NOT found.\nIf you intend to use a Windows libpack, set the ISIMPA_LIBPACK_DIR to the libpack directory.")
+ message(STATUS "Visit: https://github.com/ISIMPA/ISIMPA-Libpack/releases/ for Windows libpack downloads.")
+ endif()
+ elseif(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
+ option(ISIMPA_WARN_ERROR "Make all warnings into errors. " OFF)
+ else(MSVC)
+ option(ISIMPA_LIBPACK_USE "Use the LibPack to Build ISIMPA (only Win32 so far)." OFF)
+ set(ISIMPA_LIBPACK_DIR "" CACHE PATH "Directory of the ISIMPA LibPack")
+ endif(MSVC)
+
+ ChooseQtVersion()
+
+ # https://blog.kitware.com/constraining-values-with-comboboxes-in-cmake-cmake-gui/
+ set(ISIMPA_USE_OCC_VARIANT "Community Edition" CACHE STRING "Official OpenCASCADE version or community edition")
+ set_property(CACHE ISIMPA_USE_OCC_VARIANT PROPERTY STRINGS
+ "Official Version"
+ "Community Edition"
+ )
+
+ configure_file(${CMAKE_SOURCE_DIR}/src/QtOpenGL.h.cmake ${CMAKE_BINARY_DIR}/src/QtOpenGL.h)
+
+ option(BUILD_DESIGNER_PLUGIN "Build and install the designer plugin" OFF)
+
+ if(APPLE)
+ option(ISIMPA_CREATE_MAC_APP "Create app bundle on install" OFF)
+
+ if(ISIMPA_CREATE_MAC_APP)
+ install(
+ DIRECTORY ${CMAKE_SOURCE_DIR}/src/MacAppBundle/ISIMPA.app/
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}.app
+ )
+
+ # It should be safe to assume we've got sed on OSX...
+ install(CODE "
+ execute_process(COMMAND
+ sed -i \"\" -e s/VERSION_STRING_FROM_CMAKE/${PACKAGE_VERSION}/
+ -e s/NAME_STRING_FROM_CMAKE/${PROJECT_NAME}/
+ ${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}.app/Contents/Info.plist)
+ ")
+
+ set(CMAKE_INSTALL_PREFIX
+ ${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}.app/Contents)
+ set(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib )
+ endif(ISIMPA_CREATE_MAC_APP)
+ set(CMAKE_MACOSX_RPATH TRUE )
+ endif(APPLE)
+
+ option(BUILD_FEM "Build the ISIMPA FEM module" ON)
+ option(BUILD_SANDBOX "Build the ISIMPA Sandbox module which is only for testing purposes" OFF)
+ option(BUILD_TEMPLATE "Build the ISIMPA template module which is only for testing purposes" OFF)
+ option(BUILD_ADDONMGR "Build the ISIMPA addon manager module" ON)
+ option(BUILD_BIM "Build the ISIMPA BIM module" ON)
+ option(BUILD_DRAFT "Build the ISIMPA draft module" ON)
+ option(BUILD_DRAWING "Build the ISIMPA drawing module" OFF)
+ option(BUILD_HELP "Build the ISIMPA help module" ON)
+ option(BUILD_IDF "Build the ISIMPA idf module" ON)
+ option(BUILD_IMPORT "Build the ISIMPA import module" ON)
+ option(BUILD_INSPECTION "Build the ISIMPA inspection module" ON)
+ option(BUILD_JTREADER "Build the ISIMPA jt reader module" OFF)
+ option(BUILD_MATERIAL "Build the ISIMPA material module" ON)
+ option(BUILD_MESH "Build the ISIMPA mesh module" ON)
+ option(BUILD_MESH_PART "Build the ISIMPA mesh part module" ON)
+ option(BUILD_FLAT_MESH "Build the ISIMPA flat mesh module" ON)
+ option(BUILD_OPENSCAD "Build the ISIMPA openscad module" ON)
+ option(BUILD_PART "Build the ISIMPA part module" ON)
+ option(BUILD_PART_DESIGN "Build the ISIMPA part design module" ON)
+ option(BUILD_CAM "Build the ISIMPA CAM module" ON)
+ option(BUILD_ASSEMBLY "Build the ISIMPA Assembly module" ON)
+ option(BUILD_PLOT "Build the ISIMPA plot module" ON)
+ option(BUILD_POINTS "Build the ISIMPA points module" ON)
+ option(BUILD_REVERSEENGINEERING "Build the ISIMPA reverse engineering module" ON)
+ option(BUILD_ROBOT "Build the ISIMPA robot module" ON)
+ option(BUILD_SHOW "Build the ISIMPA Show module (helper module for visibility automation)" ON)
+ option(BUILD_SKETCHER "Build the ISIMPA sketcher module" ON)
+ option(BUILD_SPREADSHEET "Build the ISIMPA spreadsheet module" ON)
+ option(BUILD_START "Build the ISIMPA start module" ON)
+ option(BUILD_TEST "Build the ISIMPA test module" ON)
+ option(BUILD_MEASURE "Build the ISIMPA Measure module" ON)
+ option(BUILD_TECHDRAW "Build the ISIMPA Technical Drawing module" ON)
+ option(BUILD_TUX "Build the ISIMPA Tux module" ON)
+ option(BUILD_WEB "Build the ISIMPA Web module" ON)
+ option(BUILD_SURFACE "Build the ISIMPA surface module" ON)
+ option(BUILD_VR "Build the ISIMPA Oculus Rift support (need Oculus SDK 4.x or higher)" OFF)
+ option(BUILD_CLOUD "Build the ISIMPA cloud module" OFF)
+ option(ENABLE_DEVELOPER_TESTS "Build the ISIMPA unit tests suit" ON)
+
+ if(MSVC)
+ set(ISIMPA_3DCONNEXION_SUPPORT "NavLib" CACHE STRING "Select version of the 3Dconnexion device integration")
+ set_property(CACHE ISIMPA_3DCONNEXION_SUPPORT PROPERTY STRINGS "NavLib" "Raw input")
+ else(MSVC)
+ set(ISIMPA_3DCONNEXION_SUPPORT "Raw input")
+ endif(MSVC)
+
+ if(MSVC)
+ option(BUILD_FEM_NETGEN "Build the ISIMPA FEM module with the NETGEN mesher" ON)
+ option(ISIMPA_USE_PCL "Build the features that use PCL libs" OFF) # 3/5/2021 current LibPack uses non-C++17 FLANN
+ option(ISIMPA_USE_3DCONNEXION "Use the 3D connexion SDK to support 3d mouse." ON)
+ elseif(APPLE)
+ find_library(3DCONNEXIONCLIENT_FRAMEWORK 3DconnexionClient)
+ if(IS_DIRECTORY ${3DCONNEXIONCLIENT_FRAMEWORK})
+ option(ISIMPA_USE_3DCONNEXION "Use the 3D connexion SDK to support 3d mouse." ON)
+ else(IS_DIRECTORY ${3DCONNEXIONCLIENT_FRAMEWORK})
+ option(ISIMPA_USE_3DCONNEXION "Use the 3D connexion SDK to support 3d mouse." OFF)
+ endif(IS_DIRECTORY ${3DCONNEXIONCLIENT_FRAMEWORK})
+ else(MSVC)
+ set(ISIMPA_USE_3DCONNEXION OFF )
+ endif(MSVC)
+ if(NOT MSVC)
+ option(BUILD_FEM_NETGEN "Build the ISIMPA FEM module with the NETGEN mesher" OFF)
+ option(ISIMPA_USE_PCL "Build the features that use PCL libs" OFF)
+ endif(NOT MSVC)
+
+ if(ISIMPA_3DCONNEXION_SUPPORT STREQUAL "NavLib" AND ISIMPA_USE_3DCONNEXION)
+ set(ISIMPA_USE_3DCONNEXION_NAVLIB ON)
+ set(ISIMPA_USE_3DCONNEXION OFF)
+ endif()
+
+ # if this is set override some options
+ if (ISIMPA_BUILD_DEBIAN)
+ set(ISIMPA_USE_EXTERNAL_ZIPIOS ON )
+ # A Debian package for SMESH doesn't exist
+ #set(ISIMPA_USE_EXTERNAL_SMESH ON )
+ endif (ISIMPA_BUILD_DEBIAN)
+
+ if(BUILD_FEM)
+ set(BUILD_SMESH ON )
+ endif()
+
+ # for Windows the minimum required cmake version is 3.4.3 to build the CAM module
+ if(WIN32 AND CMAKE_VERSION VERSION_LESS 3.4.3)
+ message(WARNING "Disable CAM, requires cmake >= 3.4.3 in order to build this module")
+ set(BUILD_CAM OFF )
+ endif()
+
+ # force build directory to be different to source directory
+ if (BUILD_FORCE_DIRECTORY)
+ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
+ message(FATAL_ERROR "The build directory (${CMAKE_BINARY_DIR}) must be different to the source directory (${CMAKE_SOURCE_DIR}).\n"
+ "Please choose another build directory! Or disable the option BUILD_FORCE_DIRECTORY.")
+ endif()
+ endif()
+endmacro(InitializeISIMPABuildOptions)
diff --git a/cmake/ISIMPA_Helpers/SetupBoost.cmake b/cmake/ISIMPA_Helpers/SetupBoost.cmake
new file mode 100644
index 00000000..0bb1343c
--- /dev/null
+++ b/cmake/ISIMPA_Helpers/SetupBoost.cmake
@@ -0,0 +1,31 @@
+macro(SetupBoost)
+# -------------------------------- Boost --------------------------------
+
+ set(_boost_TEST_VERSIONS ${Boost_ADDITIONAL_VERSIONS})
+
+ set (BOOST_COMPONENTS filesystem program_options regex system thread date_time)
+ find_package(Boost ${BOOST_MIN_VERSION}
+ COMPONENTS ${BOOST_COMPONENTS} REQUIRED)
+
+ if(UNIX AND NOT APPLE)
+ # Boost.Thread 1.67+ headers reference pthread_condattr_*
+ list(APPEND Boost_LIBRARIES pthread)
+ endif()
+
+ if(NOT Boost_FOUND)
+ set (NO_BOOST_COMPONENTS)
+ foreach (comp ${BOOST_COMPONENTS})
+ string(TOUPPER ${comp} uppercomp)
+ if (NOT Boost_${uppercomp}_FOUND)
+ list(APPEND NO_BOOST_COMPONENTS ${comp})
+ endif()
+ endforeach()
+ message(FATAL_ERROR "=============================================\n"
+ "Required components:\n"
+ " ${BOOST_COMPONENTS}\n"
+ "Not found, install the components:\n"
+ " ${NO_BOOST_COMPONENTS}\n"
+ "=============================================\n")
+ endif(NOT Boost_FOUND)
+
+endmacro(SetupBoost)
diff --git a/cmake/ISIMPA_Helpers/SetupDoxygen.cmake b/cmake/ISIMPA_Helpers/SetupDoxygen.cmake
new file mode 100644
index 00000000..a10829da
--- /dev/null
+++ b/cmake/ISIMPA_Helpers/SetupDoxygen.cmake
@@ -0,0 +1,12 @@
+macro(SetupDoxygen)
+# -------------------------------- Doxygen ----------------------------------
+
+ find_package(Doxygen)
+
+ if (NOT DOXYGEN_FOUND)
+ message("=====================================================\n"
+ "Doxygen not found, will not build documentation. \n"
+ "=====================================================\n")
+ endif(NOT DOXYGEN_FOUND)
+
+endmacro(SetupDoxygen)
diff --git a/cmake/ISIMPA_Helpers/SetupOpenGL.cmake b/cmake/ISIMPA_Helpers/SetupOpenGL.cmake
new file mode 100644
index 00000000..4ce39248
--- /dev/null
+++ b/cmake/ISIMPA_Helpers/SetupOpenGL.cmake
@@ -0,0 +1,16 @@
+macro(SetupOpenGL)
+# -------------------------------- OpenGL --------------------------------
+
+ find_package(OpenGL)
+ include(FindPackageMessage)
+ if(OPENGL_GLU_FOUND)
+ find_package_message(OPENGL_GLU
+ "Found OpenGLU: ${OPENGL_glu_LIBRARY}"
+ "[${OPENGL_glu_LIBRARY}][${OPENGL_INCLUDE_DIR}]")
+ else(OPENGL_GLU_FOUND)
+ message(FATAL_ERROR "======================\n"
+ "GLU library not found.\n"
+ "======================\n")
+ endif(OPENGL_GLU_FOUND)
+
+endmacro(SetupOpenGL)
diff --git a/cmake/ISIMPA_Helpers/SetupPybind11.cmake b/cmake/ISIMPA_Helpers/SetupPybind11.cmake
new file mode 100644
index 00000000..7edf9a67
--- /dev/null
+++ b/cmake/ISIMPA_Helpers/SetupPybind11.cmake
@@ -0,0 +1,10 @@
+macro(SetupPybind11)
+# -------------------------------- PyBind11 -----------------------------
+
+ # necessary for flat-mesh feature
+ option(ISIMPA_USE_PYBIND11 "Use pybind11" OFF)
+ if (ISIMPA_USE_PYBIND11)
+ find_package(pybind11 REQUIRED)
+ endif()
+
+endmacro(SetupPybind11)
diff --git a/cmake/ISIMPA_Helpers/SetupPython.cmake b/cmake/ISIMPA_Helpers/SetupPython.cmake
new file mode 100644
index 00000000..7cc27a11
--- /dev/null
+++ b/cmake/ISIMPA_Helpers/SetupPython.cmake
@@ -0,0 +1,21 @@
+macro(SetupPython)
+# -------------------------------- Python --------------------------------
+
+ find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
+
+ # For backwards compatibility with old CMake scripts
+ set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
+ set(PYTHON_LIBRARIES ${Python3_LIBRARIES})
+ set(PYTHON_INCLUDE_DIRS ${Python3_INCLUDE_DIRS})
+ set(PYTHON_LIBRARY_DIRS ${Python3_LIBRARY_DIRS})
+ set(PYTHON_VERSION_STRING ${Python3_VERSION})
+ set(PYTHON_VERSION_MAJOR ${Python3_VERSION_MAJOR})
+ set(PYTHON_VERSION_MINOR ${Python3_VERSION_MINOR})
+ set(PYTHON_VERSION_PATCH ${Python3_VERSION_PATCH})
+ set(PYTHONINTERP_FOUND ${Python3_Interpreter_FOUND})
+
+ if (${PYTHON_VERSION_STRING} VERSION_LESS "3.8")
+ message(FATAL_ERROR "To build I-SIMPA you need at least Python 3.8\n")
+ endif()
+
+endmacro(SetupPython)
diff --git a/cmake/ISIMPA_Helpers/SetupSwig.cmake b/cmake/ISIMPA_Helpers/SetupSwig.cmake
new file mode 100644
index 00000000..9319d88a
--- /dev/null
+++ b/cmake/ISIMPA_Helpers/SetupSwig.cmake
@@ -0,0 +1,12 @@
+macro(SetupSwig)
+# -------------------------------- Swig ----------------------------------
+
+ find_package(SWIG)
+
+ if (NOT SWIG_FOUND)
+ message("=====================================================\n"
+ "SWIG not found, will not build SWIG binding for pivy.\n"
+ "=====================================================\n")
+ endif(NOT SWIG_FOUND)
+
+endmacro(SetupSwig)
diff --git a/cmake/UseLibPack3.cmake b/cmake/UseLibPack3.cmake
new file mode 100644
index 00000000..cc7a1ddb
--- /dev/null
+++ b/cmake/UseLibPack3.cmake
@@ -0,0 +1,17 @@
+set(ENV{PATH} "${ISIMPA_LIBPACK_DIR};$ENV{PATH}")
+list(PREPEND CMAKE_PREFIX_PATH "${ISIMPA_LIBPACK_DIR}")
+
+set (Python3_EXECUTABLE ${ISIMPA_LIBPACK_DIR}/bin/python.exe)
+find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
+
+# Make sure we are using the shared versions of Boost here: the LibPack includes both
+set(Boost_USE_STATIC_LIBS OFF)
+find_package(Boost COMPONENTS system REQUIRED PATHS ${ISIMPA_LIBPACK_DIR}/lib/cmake NO_DEFAULT_PATH)
+
+set(OCE_DIR ${ISIMPA_LIBPACK_DIR}/lib/cmake CACHE PATH "" FORCE)
+
+set(SWIG_EXECUTABLE ${ISIMPA_LIBPACK_DIR}/bin/swig.exe CACHE FILEPATH "Swig" FORCE)
+
+set (HDF5_DIR ${ISIMPA_LIBPACK_DIR}/share/cmake)
+
+link_directories (${ISIMPA_LIBPACK_DIR}/lib)
diff --git a/cmake/UseLibPackCLbundler.cmake b/cmake/UseLibPackCLbundler.cmake
new file mode 100644
index 00000000..93c5b394
--- /dev/null
+++ b/cmake/UseLibPackCLbundler.cmake
@@ -0,0 +1,60 @@
+set(ENV{PATH} "${ISIMPA_LIBPACK_DIR};$ENV{PATH}")
+set(ENV{CMAKE_PREFIX_PATH} ${ISIMPA_LIBPACK_DIR})
+
+set(Boost_INCLUDE_DIR ${ISIMPA_LIBPACK_DIR}/include CACHE PATH "" FORCE)
+
+set(OCE_DIR ${ISIMPA_LIBPACK_DIR}/lib/cmake CACHE PATH "" FORCE)
+
+set(SWIG_EXECUTABLE ${ISIMPA_LIBPACK_DIR}/bin/swig/swig.exe CACHE FILEPATH "Swig" FORCE)
+
+
+# Set paths to cmake config files for each Qt module
+set(Qt5_ROOT_DIR ${ISIMPA_LIBPACK_DIR} CACHE PATH "")
+
+set (Qt5_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5 CACHE PATH "")
+set (Qt5AxBase_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5AxBase CACHE PATH "")
+set (Qt5AxContainer_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5AxContainer CACHE PATH "")
+set (Qt5AxServer_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5AxServer CACHE PATH "")
+set (Qt5Concurrent_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5Concurrent CACHE PATH "")
+set (Qt5Core_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5Core CACHE PATH "")
+set (Qt5DBus_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5DBus CACHE PATH "")
+set (Qt5Designer_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5Designer CACHE PATH "")
+set (Qt5Gui_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5Gui CACHE PATH "")
+set (Qt5Help_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5Help CACHE PATH "")
+set (Qt5LinguistTools_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5LinguistTools CACHE PATH "")
+set (Qt5Multimedia_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5Multimedia CACHE PATH "")
+set (Qt5MultimediaWidgets_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5MultimediaWidgets CACHE PATH "")
+set (Qt5Network_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5Network CACHE PATH "")
+set (Qt5OpenGL_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5OpenGL CACHE PATH "")
+set (Qt5OpenGLExtensions_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5OpenGLExtensions CACHE PATH "")
+set (Qt5PrintSupport_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5PrintSupport CACHE PATH "")
+set (Qt5Qml_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5Qml CACHE PATH "")
+set (Qt5Quick_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5Quick CACHE PATH "")
+set (Qt5QuickTest_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5QuickTest CACHE PATH "")
+set (Qt5QuickWidgets_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5QuickWidgets CACHE PATH "")
+set (Qt5Sql_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5Sql CACHE PATH "")
+set (Qt5Svg_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5Svg CACHE PATH "")
+set (Qt5Test_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5Test CACHE PATH "")
+set (Qt5UiPlugin_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5UiPlugin CACHE PATH "")
+set (Qt5UiTools_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5UiTools CACHE PATH "")
+set (Qt5Widgets_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5Widgets CACHE PATH "")
+set (Qt5Xml_DIR ${Qt5_ROOT_DIR}/lib/cmake/Qt5Xml CACHE PATH "")
+
+find_library(XercesC_LIBRARY_RELEASE xerces-c_3 "${ISIMPA_LIBPACK_DIR}/lib")
+find_library(XercesC_LIBRARY_DEBUG xerces-c_3D "${ISIMPA_LIBPACK_DIR}/lib")
+set (XercesC_LIBRARIES debug ${XercesC_LIBRARY_DEBUG} optimized ${XercesC_LIBRARY_RELEASE})
+set(XercesC_FOUND TRUE)
+
+find_library(COIN3D_LIBRARY_RELEASE coin4 "${ISIMPA_LIBPACK_DIR}/lib")
+find_library(COIN3D_LIBRARY_DEBUG coin4d "${ISIMPA_LIBPACK_DIR}/lib")
+set(COIN3D_LIBRARIES optimized ${COIN3D_LIBRARY_RELEASE}
+ debug ${COIN3D_LIBRARY_DEBUG})
+set(COIN3D_FOUND TRUE)
+
+set(NETGENDATA ${ISIMPA_LIBPACK_DIR}/include/netgen)
+
+if(ISIMPA_USE_FREETYPE)
+ set(FREETYPE_INCLUDE_DIR_freetype2 ${ISIMPA_LIBPACK_DIR}/include/freetype2)
+endif(ISIMPA_USE_FREETYPE)
+
+link_directories(${ISIMPA_LIBPACK_DIR}/lib)