FreeCAD WebAssembly development snapshot
Some checks failed
FreeCAD master CI / Prepare (push) Has been cancelled
FreeCAD master CI / Pixi (push) Has been cancelled
FreeCAD master CI / Ubuntu (push) Has been cancelled
FreeCAD master CI / Windows (push) Has been cancelled
FreeCAD master CI / Lint (push) Has been cancelled
FreeCAD master CI / WrapUp (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Stale Issues / stale (push) Has been cancelled
Some checks failed
FreeCAD master CI / Prepare (push) Has been cancelled
FreeCAD master CI / Pixi (push) Has been cancelled
FreeCAD master CI / Ubuntu (push) Has been cancelled
FreeCAD master CI / Windows (push) Has been cancelled
FreeCAD master CI / Lint (push) Has been cancelled
FreeCAD master CI / WrapUp (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Stale Issues / stale (push) Has been cancelled
This commit is contained in:
60
cMake/ConfigureChecks.cmake
Normal file
60
cMake/ConfigureChecks.cmake
Normal file
@@ -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 <cstddef>\n"
|
||||
"#include <execinfo.h>\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})
|
||||
70
cMake/FindCoin3DDoc.cmake
Normal file
70
cMake/FindCoin3DDoc.cmake
Normal file
@@ -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")
|
||||
76
cMake/FindEigen3.cmake
Normal file
76
cMake/FindEigen3.cmake
Normal file
@@ -0,0 +1,76 @@
|
||||
# - Try to find Eigen3 lib
|
||||
#
|
||||
# This module supports requiring a minimum version, e.g. you can do
|
||||
# find_package(Eigen3 3.4.0)
|
||||
# to require version 3.4.0 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, <montel@kde.org>
|
||||
# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
|
||||
# Copyright (c) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
|
||||
# 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 4)
|
||||
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 Version exists from Eigen3 5.0.0
|
||||
if (EXISTS "${EIGEN3_INCLUDE_DIR}/Eigen/Version")
|
||||
file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/Version" _eigen3_version_header)
|
||||
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}")
|
||||
string(REGEX MATCH "define[ \t]+EIGEN_PATCH_VERSION[ \t]+([0-9]+)" _eigen3_patch_version_match "${_eigen3_version_header}")
|
||||
set(EIGEN3_PATCH_VERSION "${CMAKE_MATCH_1}")
|
||||
set(EIGEN3_VERSION ${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION}.${EIGEN3_PATCH_VERSION})
|
||||
else()
|
||||
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})
|
||||
endif()
|
||||
|
||||
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)
|
||||
55
cMake/FindKDL.cmake
Normal file
55
cMake/FindKDL.cmake
Normal file
@@ -0,0 +1,55 @@
|
||||
# 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 >= 1.4.0" 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})
|
||||
|
||||
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} >= 1.4.0" 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} >= 1.4.0" 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 )
|
||||
53
cMake/FindLARK.cmake
Normal file
53
cMake/FindLARK.cmake
Normal file
@@ -0,0 +1,53 @@
|
||||
# - Find the lark library
|
||||
# This module finds if lark is installed, and sets the following variables
|
||||
# indicating where it is.
|
||||
#
|
||||
# LARK_FOUND - was lark found
|
||||
# LARK_VERSION - the version of lark found as a string
|
||||
# LARK_VERSION_MAJOR - the major version number of lark
|
||||
# LARK_VERSION_MINOR - the minor version number of lark
|
||||
# LARK_VERSION_PATCH - the patch version number of lark
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
if(Python3_EXECUTABLE)
|
||||
message(STATUS "FindLark: Using Python3_EXECUTABLE = ${Python3_EXECUTABLE}")
|
||||
|
||||
# try to import lark into Python interpreter
|
||||
execute_process(
|
||||
COMMAND "${Python3_EXECUTABLE}" "-c"
|
||||
"import lark; print(lark.__version__)"
|
||||
RESULT_VARIABLE _LARK_SEARCH_SUCCESS
|
||||
OUTPUT_VARIABLE LARK_VERSION
|
||||
ERROR_VARIABLE _LARK_ERROR_VALUE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
message(DEBUG "FindLark: Result = ${_LARK_SEARCH_SUCCESS}")
|
||||
message(DEBUG "FindLark: Version = ${LARK_VERSION}")
|
||||
message(DEBUG "FindLark: Error = ${_LARK_ERROR_VALUE}")
|
||||
|
||||
if(_LARK_SEARCH_SUCCESS MATCHES 0)
|
||||
# extract version components
|
||||
string(REGEX REPLACE "\\." ";" _LARK_VERSION_LIST ${LARK_VERSION})
|
||||
list(LENGTH _LARK_VERSION_LIST _LARK_VERSION_LIST_LEN)
|
||||
if(_LARK_VERSION_LIST_LEN GREATER_EQUAL 1)
|
||||
list(GET _LARK_VERSION_LIST 0 LARK_VERSION_MAJOR)
|
||||
endif()
|
||||
if(_LARK_VERSION_LIST_LEN GREATER_EQUAL 2)
|
||||
list(GET _LARK_VERSION_LIST 1 LARK_VERSION_MINOR)
|
||||
endif()
|
||||
if(_LARK_VERSION_LIST_LEN GREATER_EQUAL 3)
|
||||
list(GET _LARK_VERSION_LIST 2 LARK_VERSION_PATCH)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "The BIM workbench requires the lark python package / module to be installed")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "FindLark: Python3_EXECUTABLE not set")
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(LARK
|
||||
REQUIRED_VARS LARK_VERSION
|
||||
VERSION_VAR LARK_VERSION
|
||||
)
|
||||
70
cMake/FindMEDFile.cmake
Normal file
70
cMake/FindMEDFile.cmake
Normal file
@@ -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()
|
||||
45
cMake/FindMatplotlib.cmake
Normal file
45
cMake/FindMatplotlib.cmake
Normal file
@@ -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 "${Python3_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()
|
||||
150
cMake/FindNETGEN.cmake
Normal file
150
cMake/FindNETGEN.cmake
Normal file
@@ -0,0 +1,150 @@
|
||||
# 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 QUIET)
|
||||
IF (Netgen_FOUND)
|
||||
set(NGLIB_INCLUDE_DIR ${NETGEN_INCLUDE_DIRS})
|
||||
set(NGLIB_LIBRARIES nglib)
|
||||
# for external smesh only the following two variables are needed:
|
||||
set(NETGEN_FOUND True)
|
||||
set(NETGEN_INCLUDE_DIRS ${NETGEN_INCLUDE_DIRS})
|
||||
ELSE ()
|
||||
|
||||
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 <cstdio>
|
||||
include(CMakePushCheckState)
|
||||
cmake_push_check_state(RESET)
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${NETGEN_CXX_FLAGS}")
|
||||
check_cxx_source_compiles("#include <cstdio>\nint main(){}" CSTDIO_INCLUDE_TRY1)
|
||||
IF (NOT CSTDIO_INCLUDE_TRY1)
|
||||
# Ugly hack to make <stdio.h> building gets function
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -U__cplusplus -D__cplusplus=201103L")
|
||||
check_cxx_source_compiles("#include <cstdio>\nint main(){}" CSTDIO_INCLUDE_TRY2)
|
||||
IF (NOT CSTDIO_INCLUDE_TRY2)
|
||||
message(FATAL_ERROR "Cannot #include <cstdio>.")
|
||||
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 ()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(NETGEN
|
||||
REQUIRED_VARS NGLIB_INCLUDE_DIR NGLIB_LIBRARIES NETGEN_INCLUDE_DIRS
|
||||
VERSION_VAR NETGEN_VERSION)
|
||||
140
cMake/FindOCC.cmake
Normal file
140
cMake/FindOCC.cmake
Normal file
@@ -0,0 +1,140 @@
|
||||
# Try to find 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
|
||||
|
||||
# we first try to find opencascade directly:
|
||||
if (NOT OCCT_CMAKE_FALLBACK)
|
||||
find_package(OpenCASCADE CONFIG QUIET)
|
||||
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 ()
|
||||
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 ()
|
||||
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_path(OCC_LIBRARY TKernel
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/opt/opencascade/lib
|
||||
)
|
||||
else ()
|
||||
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 ()
|
||||
else ()
|
||||
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 ()
|
||||
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 ()
|
||||
endif ()
|
||||
|
||||
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 ()
|
||||
|
||||
# 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
|
||||
)
|
||||
if (OCC_VERSION_STRING VERSION_GREATER_EQUAL 7.9.0)
|
||||
list(APPEND OCC_LIBRARIES TKExpress)
|
||||
endif ()
|
||||
|
||||
set(OCC_OCAF_LIBRARIES
|
||||
TKBin
|
||||
TKBinL
|
||||
TKCAF
|
||||
TKXCAF
|
||||
TKLCAF
|
||||
TKVCAF
|
||||
TKCDF
|
||||
TKMeshVS
|
||||
TKService
|
||||
TKV3d
|
||||
TKRWMesh
|
||||
)
|
||||
|
||||
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 ()
|
||||
list(APPEND OCC_LIBRARIES TKDESTEP TKDEIGES TKDEGLTF TKDESTL)
|
||||
endif ()
|
||||
message(STATUS "Found OpenCASCADE version: ${OCC_VERSION_STRING}")
|
||||
message(STATUS " OpenCASCADE include directory: ${OCC_INCLUDE_DIR}")
|
||||
message(STATUS " OpenCASCADE shared libraries directory: ${OCC_LIBRARY_DIR}")
|
||||
endif ()
|
||||
249
cMake/FindOpenCV.cmake
Normal file
249
cMake/FindOpenCV.cmake
Normal file
@@ -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)
|
||||
|
||||
|
||||
|
||||
128
cMake/FindPyCXX.cmake
Normal file
128
cMake/FindPyCXX.cmake
Normal file
@@ -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)
|
||||
|
||||
52
cMake/FindPySide2Tools.cmake
Normal file
52
cMake/FindPySide2Tools.cmake
Normal file
@@ -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 ${Python3_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-${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} pyuic5 HINTS ${PYSIDE_BIN_DIR})
|
||||
FIND_PROGRAM(PYSIDE2_RCC_EXECUTABLE NAMES pyside2-rcc pyside2-rcc-${Python3_VERSION_MAJOR}.${Python3_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()
|
||||
54
cMake/FindPySide6.cmake
Normal file
54
cMake/FindPySide6.cmake
Normal file
@@ -0,0 +1,54 @@
|
||||
# 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
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package(PySide6 CONFIG QUIET)
|
||||
|
||||
if(NOT PySide6_FOUND)
|
||||
find_pip_package(PySide6)
|
||||
endif()
|
||||
|
||||
if(PySide6_FOUND)
|
||||
# verify PySide6 version matches Qt6 version (major.minor)
|
||||
if(PySide6_VERSION AND Qt6_VERSION)
|
||||
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)" _qt6_major_minor "${Qt6_VERSION}")
|
||||
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)" _pyside6_major_minor "${PySide6_VERSION}")
|
||||
|
||||
message(STATUS "Qt version: ${Qt6_VERSION}")
|
||||
message(STATUS "PySide version: ${PySide6_VERSION}")
|
||||
|
||||
if(NOT _qt6_major_minor STREQUAL _pyside6_major_minor)
|
||||
message(FATAL_ERROR
|
||||
" --------------------------------------------------------
|
||||
Qt/PySide version mismatch!
|
||||
cmake found Qt: ${Qt6_VERSION}
|
||||
cmake found PySide: ${PySide6_VERSION}
|
||||
major.minor versions of Qt and PySide must match to avoid errors.
|
||||
Ensure CMAKE_PREFIX_PATH points to matching Qt and PySide6 installations.
|
||||
--------------------------------------------------------"
|
||||
)
|
||||
endif()
|
||||
|
||||
message(STATUS "PySide/Qt version check passed (${_pyside6_major_minor})")
|
||||
endif()
|
||||
|
||||
if(NOT PySide6_INCLUDE_DIRS AND TARGET PySide6::pyside6)
|
||||
get_property(PySide6_INCLUDE_DIRS TARGET PySide6::pyside6 PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(PySide6
|
||||
REQUIRED_VARS PySide6_INCLUDE_DIRS
|
||||
VERSION_VAR PySide6_VERSION
|
||||
)
|
||||
|
||||
# Also provide the old-style variables so we don't have to update everything yet
|
||||
set(PYSIDE_INCLUDE_DIR ${PySide6_INCLUDE_DIRS})
|
||||
set(PYSIDE_LIBRARY ${PySide6_LIBRARIES})
|
||||
set(PYSIDE_FOUND TRUE)
|
||||
set(PYSIDE_MAJOR_VERSION 6)
|
||||
endif()
|
||||
32
cMake/FindPySide6Tools.cmake
Normal file
32
cMake/FindPySide6Tools.cmake
Normal file
@@ -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()
|
||||
100
cMake/FindRift.cmake
Normal file
100
cMake/FindRift.cmake
Normal file
@@ -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)
|
||||
70
cMake/FindSMESH.cmake
Normal file
70
cMake/FindSMESH.cmake
Normal file
@@ -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)
|
||||
|
||||
28
cMake/FindShiboken6.cmake
Normal file
28
cMake/FindShiboken6.cmake
Normal file
@@ -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. FreeCAD 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})
|
||||
set(SHIBOKEN_MAJOR_VERSION 6)
|
||||
set(SHIBOKEN_FOUND ON)
|
||||
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})
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
set(SHIBOKEN_INCLUDE_DIR ${Shiboken6_INCLUDE_DIRS})
|
||||
set(SHIBOKEN_LIBRARY ${Shiboken6_LIBRARIES})
|
||||
set(SHIBOKEN_FOUND ON)
|
||||
endif()
|
||||
29
cMake/FindSpnav.cmake
Normal file
29
cMake/FindSpnav.cmake
Normal file
@@ -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)
|
||||
156
cMake/FreeCADWebDependencies.cmake
Normal file
156
cMake/FreeCADWebDependencies.cmake
Normal file
@@ -0,0 +1,156 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
set(FREECAD_WEB_DEPENDENCY_ROOT "${CMAKE_SOURCE_DIR}/build-web" CACHE PATH
|
||||
"Root containing the installed Emscripten dependencies")
|
||||
set(FREECAD_WEB_YAML_ROOT "${FREECAD_WEB_DEPENDENCY_ROOT}/yaml-install" CACHE PATH
|
||||
"yaml-cpp Emscripten installation prefix")
|
||||
set(FREECAD_WEB_EIGEN_ROOT "${FREECAD_WEB_DEPENDENCY_ROOT}/eigen-install" CACHE PATH
|
||||
"Eigen 3.4.0 installation prefix")
|
||||
set(FREECAD_WEB_BOOST_ROOT "${FREECAD_WEB_DEPENDENCY_ROOT}/boost-install" CACHE PATH
|
||||
"Boost 1.83.0 Emscripten installation prefix")
|
||||
set(FREECAD_WEB_QT_ROOT "${FREECAD_WEB_DEPENDENCY_ROOT}/qt-install" CACHE PATH
|
||||
"Qt Emscripten installation prefix")
|
||||
set(FREECAD_WEB_PYTHON_ROOT "${FREECAD_WEB_DEPENDENCY_ROOT}/python-install" CACHE PATH
|
||||
"CPython Emscripten installation prefix")
|
||||
set(FREECAD_WEB_ICU_ROOT "${FREECAD_WEB_DEPENDENCY_ROOT}/icu-install" CACHE PATH
|
||||
"ICU 68.2 Emscripten installation prefix")
|
||||
set(FREECAD_WEB_ZLIB_ROOT "${FREECAD_WEB_DEPENDENCY_ROOT}/zlib-install" CACHE PATH
|
||||
"zlib 1.3 Emscripten installation prefix")
|
||||
set(FREECAD_WEB_XERCESC_ROOT "${FREECAD_WEB_DEPENDENCY_ROOT}/xerces-install" CACHE PATH
|
||||
"Xerces-C 3.2.4 Emscripten installation prefix")
|
||||
set(FREECAD_WEB_OCCT_ROOT "${FREECAD_WEB_DEPENDENCY_ROOT}/occt-install" CACHE PATH
|
||||
"OpenCASCADE 7.6.3 Emscripten installation prefix")
|
||||
set(FREECAD_WEB_HOST_PYTHON_EXECUTABLE "" CACHE FILEPATH
|
||||
"Native Python used for configure-time generators in a Web build")
|
||||
|
||||
function(_freecad_web_require path description)
|
||||
if(NOT EXISTS "${path}")
|
||||
message(FATAL_ERROR
|
||||
"FREECAD_WEB requires ${description} at ${path}. "
|
||||
"Run tools/prepare_web_dependencies.sh first or set the matching "
|
||||
"FREECAD_WEB_*_ROOT cache variable.")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
set(_freecad_web_yaml_dir "${FREECAD_WEB_YAML_ROOT}/lib/cmake/yaml-cpp")
|
||||
set(_freecad_web_eigen_include "${FREECAD_WEB_EIGEN_ROOT}/include/eigen3")
|
||||
set(_freecad_web_boost_include "${FREECAD_WEB_BOOST_ROOT}/include")
|
||||
set(_freecad_web_boost_library_dir "${FREECAD_WEB_BOOST_ROOT}/lib")
|
||||
set(_freecad_web_qt_cmake_root "${FREECAD_WEB_QT_ROOT}/lib/cmake")
|
||||
set(_freecad_web_python_include "${FREECAD_WEB_PYTHON_ROOT}/include/python3.12")
|
||||
set(_freecad_web_python_library "${FREECAD_WEB_PYTHON_ROOT}/lib/libpython3.12.a")
|
||||
set(_freecad_web_icu_include "${FREECAD_WEB_ICU_ROOT}/include")
|
||||
set(_freecad_web_icu_uc_library "${FREECAD_WEB_ICU_ROOT}/lib/libicuuc.a")
|
||||
set(_freecad_web_icu_i18n_library "${FREECAD_WEB_ICU_ROOT}/lib/libicui18n.a")
|
||||
set(_freecad_web_icu_data_library "${FREECAD_WEB_ICU_ROOT}/lib/libicudata.a")
|
||||
set(_freecad_web_zlib_include "${FREECAD_WEB_ZLIB_ROOT}/include")
|
||||
set(_freecad_web_zlib_library "${FREECAD_WEB_ZLIB_ROOT}/lib/libz.a")
|
||||
set(_freecad_web_xerces_include "${FREECAD_WEB_XERCESC_ROOT}/include")
|
||||
set(_freecad_web_xerces_library "${FREECAD_WEB_XERCESC_ROOT}/lib/libxerces-c.a")
|
||||
set(_freecad_web_occt_dir "${FREECAD_WEB_OCCT_ROOT}/lib/cmake/opencascade")
|
||||
|
||||
_freecad_web_require("${_freecad_web_yaml_dir}/yaml-cpp-config.cmake" "yaml-cpp CMake package")
|
||||
_freecad_web_require("${_freecad_web_eigen_include}/signature_of_eigen3_matrix_library" "Eigen Web headers")
|
||||
_freecad_web_require("${_freecad_web_eigen_include}/Eigen/src/Core/util/Macros.h" "Eigen version header")
|
||||
_freecad_web_require("${_freecad_web_boost_include}/boost/version.hpp" "Boost Web headers")
|
||||
foreach(_freecad_web_boost_component program_options regex thread date_time atomic)
|
||||
_freecad_web_require("${_freecad_web_boost_library_dir}/libboost_${_freecad_web_boost_component}.a"
|
||||
"Boost Web ${_freecad_web_boost_component} library")
|
||||
endforeach()
|
||||
_freecad_web_require("${_freecad_web_qt_cmake_root}/Qt5/Qt5Config.cmake" "Qt5 CMake package")
|
||||
_freecad_web_require("${_freecad_web_qt_cmake_root}/Qt5Core/Qt5CoreConfig.cmake" "Qt5Core CMake package")
|
||||
_freecad_web_require("${_freecad_web_qt_cmake_root}/Qt5Network/Qt5NetworkConfig.cmake" "Qt5Network CMake package")
|
||||
_freecad_web_require("${_freecad_web_qt_cmake_root}/Qt5Xml/Qt5XmlConfig.cmake" "Qt5Xml CMake package")
|
||||
_freecad_web_require("${_freecad_web_python_include}/Python.h" "CPython 3.12 Web headers")
|
||||
_freecad_web_require("${_freecad_web_python_library}" "CPython 3.12 Web static library")
|
||||
_freecad_web_require("${_freecad_web_icu_include}/unicode/utypes.h" "ICU Web headers")
|
||||
_freecad_web_require("${_freecad_web_icu_uc_library}" "ICU Web uc static library")
|
||||
_freecad_web_require("${_freecad_web_icu_i18n_library}" "ICU Web i18n static library")
|
||||
_freecad_web_require("${_freecad_web_icu_data_library}" "ICU Web data static library")
|
||||
_freecad_web_require("${_freecad_web_zlib_include}/zlib.h" "zlib Web headers")
|
||||
_freecad_web_require("${_freecad_web_zlib_library}" "zlib Web static library")
|
||||
_freecad_web_require("${_freecad_web_xerces_include}/xercesc/util/PlatformUtils.hpp" "Xerces-C Web headers")
|
||||
_freecad_web_require("${_freecad_web_xerces_library}" "Xerces-C Web static library")
|
||||
_freecad_web_require("${_freecad_web_occt_dir}/OpenCASCADEConfig.cmake" "OpenCASCADE Web CMake package")
|
||||
_freecad_web_require("${FREECAD_WEB_OCCT_ROOT}/include/opencascade/Standard_Version.hxx" "OpenCASCADE Web headers")
|
||||
_freecad_web_require("${FREECAD_WEB_OCCT_ROOT}/lib/libTKernel.a" "OpenCASCADE Web foundation library")
|
||||
|
||||
if(NOT FREECAD_WEB_HOST_PYTHON_EXECUTABLE)
|
||||
find_program(_freecad_web_host_python NAMES python3.12 python3)
|
||||
if(NOT _freecad_web_host_python)
|
||||
message(FATAL_ERROR
|
||||
"FREECAD_WEB needs a native Python 3.12 interpreter for configure-time generators. "
|
||||
"Set FREECAD_WEB_HOST_PYTHON_EXECUTABLE.")
|
||||
endif()
|
||||
set(FREECAD_WEB_HOST_PYTHON_EXECUTABLE "${_freecad_web_host_python}" CACHE FILEPATH
|
||||
"Native Python used for configure-time generators in a Web build" FORCE)
|
||||
endif()
|
||||
|
||||
# Emscripten's package root mode excludes arbitrary host paths, so direct the
|
||||
# package lookups at the validated target installations. Python deliberately
|
||||
# combines a native interpreter with WebAssembly development artifacts.
|
||||
set("yaml-cpp_DIR" "${_freecad_web_yaml_dir}" CACHE PATH "Web yaml-cpp package" FORCE)
|
||||
set(EIGEN3_INCLUDE_DIR "${_freecad_web_eigen_include}" CACHE PATH "Eigen Web headers" FORCE)
|
||||
set(Boost_ROOT "${FREECAD_WEB_BOOST_ROOT}" CACHE PATH "Boost Web installation prefix" FORCE)
|
||||
set(BOOST_ROOT "${FREECAD_WEB_BOOST_ROOT}" CACHE PATH "Boost Web installation prefix" FORCE)
|
||||
set(Boost_NO_SYSTEM_PATHS ON CACHE BOOL "Use only the Boost Web installation" FORCE)
|
||||
set(Boost_USE_STATIC_LIBS ON CACHE BOOL "Use Boost Web static libraries" FORCE)
|
||||
set(Boost_USE_MULTITHREADED OFF CACHE BOOL "Use single-threaded Boost Web libraries" FORCE)
|
||||
set(Boost_INCLUDE_DIR "${_freecad_web_boost_include}" CACHE PATH "Boost Web headers" FORCE)
|
||||
set(Boost_LIBRARY_DIR "${_freecad_web_boost_library_dir}" CACHE PATH "Boost Web libraries" FORCE)
|
||||
set(Qt5_DIR "${_freecad_web_qt_cmake_root}/Qt5" CACHE PATH "Web Qt5 package" FORCE)
|
||||
foreach(_freecad_web_qt_component Core Network Xml)
|
||||
set("Qt5${_freecad_web_qt_component}_DIR"
|
||||
"${_freecad_web_qt_cmake_root}/Qt5${_freecad_web_qt_component}"
|
||||
CACHE PATH "Web Qt5${_freecad_web_qt_component} package" FORCE)
|
||||
endforeach()
|
||||
|
||||
set(Python3_EXECUTABLE "${FREECAD_WEB_HOST_PYTHON_EXECUTABLE}" CACHE FILEPATH
|
||||
"Native Python for Web configure-time generators" FORCE)
|
||||
set(Python3_INCLUDE_DIR "${_freecad_web_python_include}" CACHE PATH
|
||||
"CPython Web development headers" FORCE)
|
||||
set(Python3_LIBRARY "${_freecad_web_python_library}" CACHE FILEPATH
|
||||
"CPython Web static library" FORCE)
|
||||
|
||||
set(ICU_ROOT "${FREECAD_WEB_ICU_ROOT}" CACHE PATH "Web ICU installation prefix" FORCE)
|
||||
set(ICU_INCLUDE_DIR "${_freecad_web_icu_include}" CACHE PATH "Web ICU headers" FORCE)
|
||||
set(ICU_UC_LIBRARY "${_freecad_web_icu_uc_library}" CACHE FILEPATH "Web ICU uc library" FORCE)
|
||||
set(ICU_UC_LIBRARY_RELEASE "${_freecad_web_icu_uc_library}" CACHE FILEPATH "Web ICU uc release library" FORCE)
|
||||
set(ICU_I18N_LIBRARY "${_freecad_web_icu_i18n_library}" CACHE FILEPATH "Web ICU i18n library" FORCE)
|
||||
set(ICU_I18N_LIBRARY_RELEASE "${_freecad_web_icu_i18n_library}" CACHE FILEPATH "Web ICU i18n release library" FORCE)
|
||||
set(FREECAD_WEB_ICU_DATA_LIBRARY "${_freecad_web_icu_data_library}" CACHE FILEPATH
|
||||
"Web ICU data static library" FORCE)
|
||||
|
||||
set(ZLIB_ROOT "${FREECAD_WEB_ZLIB_ROOT}" CACHE PATH "zlib Web installation prefix" FORCE)
|
||||
set(ZLIB_USE_STATIC_LIBS ON CACHE BOOL "Use the zlib Web static library" FORCE)
|
||||
set(ZLIB_INCLUDE_DIR "${_freecad_web_zlib_include}" CACHE PATH "zlib Web headers" FORCE)
|
||||
set(ZLIB_LIBRARY "${_freecad_web_zlib_library}" CACHE FILEPATH "zlib Web static library" FORCE)
|
||||
set(ZLIB_LIBRARY_RELEASE "${_freecad_web_zlib_library}" CACHE FILEPATH
|
||||
"zlib Web release library" FORCE)
|
||||
|
||||
set(XercesC_INCLUDE_DIR "${_freecad_web_xerces_include}" CACHE PATH
|
||||
"Xerces-C Web headers" FORCE)
|
||||
set(XercesC_LIBRARY "${_freecad_web_xerces_library}" CACHE FILEPATH
|
||||
"Xerces-C Web static library" FORCE)
|
||||
|
||||
set(OpenCASCADE_DIR "${_freecad_web_occt_dir}" CACHE PATH
|
||||
"OpenCASCADE Web CMake package" FORCE)
|
||||
set(OCCT_CMAKE_FALLBACK OFF CACHE BOOL "Use the OpenCASCADE Web CMake package" FORCE)
|
||||
|
||||
unset(_freecad_web_yaml_dir)
|
||||
unset(_freecad_web_eigen_include)
|
||||
unset(_freecad_web_boost_include)
|
||||
unset(_freecad_web_boost_library_dir)
|
||||
unset(_freecad_web_qt_cmake_root)
|
||||
unset(_freecad_web_python_include)
|
||||
unset(_freecad_web_python_library)
|
||||
unset(_freecad_web_icu_include)
|
||||
unset(_freecad_web_icu_uc_library)
|
||||
unset(_freecad_web_icu_i18n_library)
|
||||
unset(_freecad_web_icu_data_library)
|
||||
unset(_freecad_web_zlib_include)
|
||||
unset(_freecad_web_zlib_library)
|
||||
unset(_freecad_web_xerces_include)
|
||||
unset(_freecad_web_xerces_library)
|
||||
unset(_freecad_web_occt_dir)
|
||||
unset(_freecad_web_host_python)
|
||||
36
cMake/FreeCADWebEmscripten.cmake
Normal file
36
cMake/FreeCADWebEmscripten.cmake
Normal file
@@ -0,0 +1,36 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
# Keep the preset independent of a distro-specific Emscripten installation
|
||||
# path. Users may provide FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN or EMSCRIPTEN;
|
||||
# otherwise resolve emcc and its real path from PATH.
|
||||
set(FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN "" CACHE FILEPATH
|
||||
"Path to Emscripten.cmake used by the FreeCAD Web preset")
|
||||
|
||||
if(NOT FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN OR
|
||||
NOT EXISTS "${FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN}")
|
||||
if(DEFINED ENV{EMSCRIPTEN} AND
|
||||
EXISTS "$ENV{EMSCRIPTEN}/cmake/Modules/Platform/Emscripten.cmake")
|
||||
set(FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN
|
||||
"$ENV{EMSCRIPTEN}/cmake/Modules/Platform/Emscripten.cmake"
|
||||
CACHE FILEPATH "Resolved Emscripten toolchain" FORCE)
|
||||
else()
|
||||
find_program(_FREECAD_WEB_EMCC emcc)
|
||||
if(_FREECAD_WEB_EMCC)
|
||||
get_filename_component(_FREECAD_WEB_EMCC_REAL "${_FREECAD_WEB_EMCC}" REALPATH)
|
||||
get_filename_component(_FREECAD_WEB_EMSCRIPTEN_ROOT "${_FREECAD_WEB_EMCC_REAL}" DIRECTORY)
|
||||
if(EXISTS "${_FREECAD_WEB_EMSCRIPTEN_ROOT}/cmake/Modules/Platform/Emscripten.cmake")
|
||||
set(FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN
|
||||
"${_FREECAD_WEB_EMSCRIPTEN_ROOT}/cmake/Modules/Platform/Emscripten.cmake"
|
||||
CACHE FILEPATH "Resolved Emscripten toolchain" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN}")
|
||||
message(FATAL_ERROR
|
||||
"Could not locate Emscripten.cmake. Set EMSCRIPTEN or "
|
||||
"FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN to the Emscripten installation root/file.")
|
||||
endif()
|
||||
|
||||
include("${FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN}")
|
||||
@@ -0,0 +1,9 @@
|
||||
macro(BuildAndInstallDesignerPlugin)
|
||||
# =================================================================
|
||||
# ============= Build and install the designer plugin =============
|
||||
# =================================================================
|
||||
|
||||
if(BUILD_DESIGNER_PLUGIN)
|
||||
add_subdirectory(src/Tools/plugins/widget)
|
||||
endif(BUILD_DESIGNER_PLUGIN)
|
||||
endmacro(BuildAndInstallDesignerPlugin)
|
||||
8
cMake/FreeCAD_Helpers/CMakeLists.txt
Normal file
8
cMake/FreeCAD_Helpers/CMakeLists.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
file(GLOB FREECAD_HELPER_CMAKE_FILES ./*.cmake)
|
||||
set(_SKIP_FILES "SetupQt.cmake")
|
||||
foreach(_CMAKE_FILE ${FREECAD_HELPER_CMAKE_FILES})
|
||||
get_filename_component(_FILENAME ${_CMAKE_FILE} NAME)
|
||||
if (NOT _FILENAME IN_LIST _SKIP_FILES)
|
||||
include(${_CMAKE_FILE})
|
||||
endif()
|
||||
endforeach(_CMAKE_FILE ${FREECAD_HELPER_CMAKE_FILES})
|
||||
44
cMake/FreeCAD_Helpers/CheckInterModuleDependencies.cmake
Normal file
44
cMake/FreeCAD_Helpers/CheckInterModuleDependencies.cmake
Normal file
@@ -0,0 +1,44 @@
|
||||
macro(CheckInterModuleDependencies)
|
||||
# ==============================================================================
|
||||
#inter-module dependencies
|
||||
|
||||
# Takes a dependent module followed by a variable-length list of prerequisite
|
||||
# modules. Warns if any of the prerequisite modules are disabled.
|
||||
function(REQUIRES_MODS dependent)
|
||||
if(${dependent})
|
||||
foreach(prerequisite IN LISTS ARGN)
|
||||
if(NOT ${prerequisite})
|
||||
message(SEND_ERROR "${dependent} requires ${prerequisite} to be ON, but it"
|
||||
" is \"${${prerequisite}}\"")
|
||||
set(${dependent} OFF PARENT_SCOPE)
|
||||
break()
|
||||
endif(NOT ${prerequisite})
|
||||
endforeach()
|
||||
endif(${dependent})
|
||||
endfunction(REQUIRES_MODS)
|
||||
|
||||
REQUIRES_MODS(BUILD_ASSEMBLY BUILD_PART BUILD_PART_DESIGN BUILD_SPREADSHEET)
|
||||
REQUIRES_MODS(BUILD_BIM BUILD_PART BUILD_MESH BUILD_MESH_PART BUILD_DRAFT)
|
||||
REQUIRES_MODS(BUILD_DRAFT BUILD_SKETCHER BUILD_TECHDRAW)
|
||||
REQUIRES_MODS(BUILD_DRAWING BUILD_PART BUILD_SPREADSHEET)
|
||||
REQUIRES_MODS(BUILD_FEM BUILD_PART)
|
||||
REQUIRES_MODS(BUILD_IMPORT BUILD_PART BUILD_PART_DESIGN)
|
||||
REQUIRES_MODS(BUILD_INSPECTION BUILD_MESH BUILD_POINTS BUILD_PART)
|
||||
REQUIRES_MODS(BUILD_JTREADER BUILD_MESH)
|
||||
REQUIRES_MODS(BUILD_MESH_PART BUILD_PART BUILD_MESH)
|
||||
REQUIRES_MODS(BUILD_FLAT_MESH BUILD_MESH_PART)
|
||||
REQUIRES_MODS(BUILD_OPENSCAD BUILD_MESH_PART BUILD_DRAFT)
|
||||
REQUIRES_MODS(BUILD_MATERIAL_EXTERNAL BUILD_MATERIAL)
|
||||
REQUIRES_MODS(BUILD_MEASURE BUILD_PART)
|
||||
REQUIRES_MODS(BUILD_PART BUILD_MATERIAL)
|
||||
REQUIRES_MODS(BUILD_PART_DESIGN BUILD_SKETCHER)
|
||||
# REQUIRES_MODS(BUILD_CAM BUILD_PART BUILD_MESH BUILD_ROBOT)
|
||||
REQUIRES_MODS(BUILD_CAM BUILD_PART BUILD_MESH)
|
||||
REQUIRES_MODS(BUILD_REVERSEENGINEERING BUILD_PART BUILD_MESH BUILD_POINTS)
|
||||
REQUIRES_MODS(BUILD_ROBOT BUILD_PART)
|
||||
REQUIRES_MODS(BUILD_SANDBOX BUILD_PART BUILD_MESH)
|
||||
REQUIRES_MODS(BUILD_SKETCHER BUILD_PART)
|
||||
REQUIRES_MODS(BUILD_SPREADSHEET BUILD_DRAFT)
|
||||
REQUIRES_MODS(BUILD_SURFACE BUILD_PART)
|
||||
REQUIRES_MODS(BUILD_TECHDRAW BUILD_PART BUILD_PART_DESIGN BUILD_SPREADSHEET BUILD_MEASURE BUILD_IMPORT)
|
||||
endmacro(CheckInterModuleDependencies)
|
||||
101
cMake/FreeCAD_Helpers/ChooseQtVersion.cmake
Normal file
101
cMake/FreeCAD_Helpers/ChooseQtVersion.cmake
Normal file
@@ -0,0 +1,101 @@
|
||||
# ADAPTED FOR FREECAD FROM VTK'S vtkQt.cmake
|
||||
# ORIGINAL VTK COPYRIGHT NOTICE FOLLOWS (BSD 3-CLAUSE)
|
||||
#
|
||||
# /*=========================================================================
|
||||
#
|
||||
# Program: Visualization Toolkit
|
||||
# Module: Copyright.txt
|
||||
#
|
||||
# Copyright (c) 1993-2015 Ken Martin, Will Schroeder, Bill Lorensen
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
|
||||
# of any contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
|
||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# =========================================================================*/
|
||||
|
||||
|
||||
# FREECAD_QT_VERSION is used to choose between Qt5 and Qt6.
|
||||
|
||||
# If it is set to Auto(default), FreeCAD finds and uses the
|
||||
# version installed on the system. If both versions are
|
||||
# found, Qt5 is preferred.
|
||||
|
||||
# The output variable is FREECAD_QT_MAJOR_VERSION, which will be either 5 or 6
|
||||
|
||||
macro(ChooseQtVersion)
|
||||
set(freecad_supported_qt_versions "Auto" 5 6)
|
||||
|
||||
# The following `if` check can be removed once CMake 3.21 is required and
|
||||
# the policy CMP0126 is set to NEW.
|
||||
if (NOT DEFINED FREECAD_QT_VERSION)
|
||||
set(FREECAD_QT_VERSION "Auto" CACHE
|
||||
STRING "Expected Qt major version. Valid values are Auto, 5, 6.")
|
||||
set_property(CACHE FREECAD_QT_VERSION PROPERTY STRINGS "${freecad_supported_qt_versions}")
|
||||
endif()
|
||||
|
||||
if(FREECAD_LIBPACK_USE)
|
||||
find_file(FREECAD_LIBPACK_CHECKFILE_VERSION NAMES FREECAD_LIBPACK_VERSION PATHS ${FREECAD_LIBPACK_DIR} NO_DEFAULT_PATH)
|
||||
if(FREECAD_LIBPACK_CHECKFILE_VERSION)
|
||||
file(READ ${FREECAD_LIBPACK_CHECKFILE_VERSION} FREECAD_LIBPACK_VERSION)
|
||||
message(STATUS "LibPack: read version file and got ${FREECAD_LIBPACK_VERSION}")
|
||||
if(FREECAD_LIBPACK_VERSION VERSION_GREATER_EQUAL "3.0.0")
|
||||
message(STATUS "Using Qt6 directory from LibPack in ${FREECAD_LIBPACK_DIR}/lib/cmake/Qt6")
|
||||
set(Qt6_DIR ${FREECAD_LIBPACK_DIR}/lib/cmake/Qt6)
|
||||
set(FREECAD_QT_VERSION 6)
|
||||
else()
|
||||
message(ERROR ": Unrecognized LibPack version ${FREECAD_LIBPACK_CHECKFILE_VERSION}")
|
||||
endif()
|
||||
else()
|
||||
if (NOT Qt5_DIR OR Qt5_DIR STREQUAL "Qt5_DIR-NOTFOUND")
|
||||
message(STATUS "Using Qt5 directory from LibPack in ${FREECAD_LIBPACK_DIR}/lib/cmake/Qt5")
|
||||
set(Qt5_DIR ${FREECAD_LIBPACK_DIR}/lib/cmake/Qt5)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT FREECAD_QT_VERSION STREQUAL "Auto")
|
||||
if (NOT FREECAD_QT_VERSION IN_LIST freecad_supported_qt_versions)
|
||||
message(FATAL_ERROR
|
||||
"Supported Qt versions are \"${freecad_supported_qt_versions}\". But "
|
||||
"FREECAD_QT_VERSION is set to ${FREECAD_QT_VERSION}.")
|
||||
endif ()
|
||||
set(_FREECAD_QT_VERSION "${FREECAD_QT_VERSION}")
|
||||
else ()
|
||||
find_package(Qt6 QUIET COMPONENTS Core)
|
||||
set(_FREECAD_QT_VERSION 6)
|
||||
if (NOT Qt6_FOUND)
|
||||
find_package(Qt5 QUIET COMPONENTS Core)
|
||||
if (NOT Qt5_FOUND)
|
||||
message(FATAL_ERROR
|
||||
"Could not find a valid Qt installation. Consider setting Qt5_DIR or Qt6_DIR (as needed).")
|
||||
endif ()
|
||||
set(_FREECAD_QT_VERSION 5)
|
||||
endif ()
|
||||
endif ()
|
||||
set(FREECAD_QT_MAJOR_VERSION "${_FREECAD_QT_VERSION}" CACHE INTERNAL
|
||||
"Major version number for the Qt installation used.")
|
||||
message(STATUS "Compiling with Qt ${FREECAD_QT_MAJOR_VERSION}")
|
||||
endmacro()
|
||||
118
cMake/FreeCAD_Helpers/CompilerChecksAndSetups.cmake
Normal file
118
cMake/FreeCAD_Helpers/CompilerChecksAndSetups.cmake
Normal file
@@ -0,0 +1,118 @@
|
||||
# Some resources
|
||||
# https://github.com/dev-cafe/cmake-cookbook
|
||||
# https://cmake.org/cmake/help/v3.8/manual/cmake-compile-features.7.html
|
||||
|
||||
macro(CompilerChecksAndSetups)
|
||||
if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
||||
set(CMAKE_COMPILER_IS_CLANGXX TRUE)
|
||||
endif (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
||||
|
||||
# ================================================================================
|
||||
|
||||
# Use a heuristic of 1 GiB of RAM needed per compiler job and limit to
|
||||
# a single link job. Modern linkers are multithreaded and running them concurrently
|
||||
# can exhaust resources.
|
||||
cmake_host_system_information(RESULT avail_mem_MiB QUERY TOTAL_PHYSICAL_MEMORY)
|
||||
math(EXPR max_compile_procs "${avail_mem_MiB} / 1024")
|
||||
set_property(GLOBAL PROPERTY JOB_POOLS compile_jobs=${max_compile_procs} link_jobs=1)
|
||||
|
||||
# Allow developers to use Boost < 1.74
|
||||
if (NOT BOOST_MIN_VERSION)
|
||||
set(BOOST_MIN_VERSION 1.74)
|
||||
endif()
|
||||
|
||||
# For older cmake versions the variable 'CMAKE_CXX_COMPILER_VERSION' is missing
|
||||
if(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CXX_COMPILER_VERSION)
|
||||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
|
||||
OUTPUT_VARIABLE CMAKE_CXX_COMPILER_VERSION)
|
||||
endif(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CXX_COMPILER_VERSION)
|
||||
|
||||
# Enabled C++20 for Freecad 1.1 and later
|
||||
set(BUILD_ENABLE_CXX_STD "C++20" CACHE STRING "Enable C++ standard")
|
||||
set_property(CACHE BUILD_ENABLE_CXX_STD PROPERTY STRINGS
|
||||
"C++20"
|
||||
"C++23"
|
||||
)
|
||||
|
||||
if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.2)
|
||||
message(FATAL_ERROR "FreeCAD 1.1 and later requires C++20. G++ must be 11.2 or later, the used version is ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
elseif(CMAKE_COMPILER_IS_CLANGXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14.0)
|
||||
message(FATAL_ERROR "FreeCAD 1.1 and later requires C++20. Clang must be 14.0 or later, the used version is ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
endif()
|
||||
|
||||
# Escape the two plus chars as otherwise cmake complains about invalid regex
|
||||
if(${BUILD_ENABLE_CXX_STD} MATCHES "C\\+\\+23")
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
else()
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
endif()
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
# Log the compiler and version
|
||||
message(STATUS "Compiler: ${CMAKE_CXX_COMPILER_ID}, version: ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
|
||||
include(${CMAKE_SOURCE_DIR}/cMake/ConfigureChecks.cmake)
|
||||
configure_file(${CMAKE_SOURCE_DIR}/src/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||
add_definitions(-DHAVE_CONFIG_H)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "-fdiagnostics-color ${CMAKE_CXX_FLAGS}")
|
||||
|
||||
# For now only set pedantic option for clang
|
||||
if(CMAKE_COMPILER_IS_CLANGXX)
|
||||
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wpedantic -Wno-write-strings ${CMAKE_CXX_FLAGS}")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-write-strings ${CMAKE_CXX_FLAGS}")
|
||||
endif()
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
# get linker errors as soon as possible and not at runtime e.g. for modules
|
||||
if(BUILD_DYNAMIC_LINK_PYTHON)
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined,error")
|
||||
elseif(UNIX)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
|
||||
endif()
|
||||
else(BUILD_DYNAMIC_LINK_PYTHON)
|
||||
if(CMAKE_COMPILER_IS_CLANGXX)
|
||||
if(APPLE)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined,dynamic_lookup")
|
||||
elseif(UNIX)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--undefined,dynamic_lookup")
|
||||
endif()
|
||||
endif()
|
||||
endif(BUILD_DYNAMIC_LINK_PYTHON)
|
||||
|
||||
if(BUILD_USE_LIBCXX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||
endif()
|
||||
|
||||
if(BUILD_ENABLE_TIME_TRACE)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftime-trace")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftime-trace")
|
||||
endif()
|
||||
endif(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
|
||||
|
||||
if(CMAKE_COMPILER_IS_CLANGXX)
|
||||
# Disable warning about potentially uninstantiated static members
|
||||
# because it leads to a lot of false-positives.
|
||||
#
|
||||
# https://en.wikipedia.org/wiki/Xcode#Latest_versions
|
||||
if (APPLE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-undefined-var-template")
|
||||
add_definitions(-DGL_SILENCE_DEPRECATION)
|
||||
elseif (UNIX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-undefined-var-template")
|
||||
endif()
|
||||
|
||||
# boost.preprocessor 1.74 and earlier turns off variadics for clang regardless of version, even though they
|
||||
# work in all versions of clang that we support. Manually force variadic macro support until our oldest
|
||||
# supported version of boost is 1.75 or higher.
|
||||
add_definitions(-DBOOST_PP_VARIADICS=1)
|
||||
message(STATUS "Force BOOST_PP_VARIADICS=1 for clang")
|
||||
endif()
|
||||
|
||||
set (COMPILE_DEFINITIONS ${COMPILE_DEFINITIONS} BOOST_NO_CXX98_FUNCTION_BASE)
|
||||
|
||||
endmacro(CompilerChecksAndSetups)
|
||||
37
cMake/FreeCAD_Helpers/ConfigureCMakeVariables.cmake
Normal file
37
cMake/FreeCAD_Helpers/ConfigureCMakeVariables.cmake
Normal file
@@ -0,0 +1,37 @@
|
||||
macro(ConfigureCMakeVariables)
|
||||
# ================================================================================
|
||||
# Output directories for install target
|
||||
|
||||
if(MSVC)
|
||||
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "Installation root directory")
|
||||
set(CMAKE_INSTALL_BINDIR bin CACHE PATH "Output directory for executables")
|
||||
set(CMAKE_INSTALL_DATADIR data CACHE PATH "Output directory for data and resource files")
|
||||
set(CMAKE_INSTALL_INCLUDEDIR include CACHE PATH "Output directory for header files")
|
||||
set(CMAKE_INSTALL_DOCDIR doc CACHE PATH "Output directory for documentation and license files")
|
||||
# Don't set it without manual adoption of LibDir variable in src/App/FreeCADInit.py
|
||||
set(CMAKE_INSTALL_LIBDIR lib CACHE PATH "Output directory for libraries")
|
||||
else()
|
||||
set(CMAKE_INSTALL_PREFIX "/usr/lib${LIB_SUFFIX}/freecad" CACHE PATH "Installation root directory")
|
||||
include(GNUInstallDirs)
|
||||
endif()
|
||||
|
||||
set(PYCXX_INCLUDE_DIR
|
||||
"${CMAKE_SOURCE_DIR}/src/3rdParty/PyCXX" CACHE PATH
|
||||
"Path to the directory containing PyCXX's CXX/Config.hxx include file")
|
||||
set(PYCXX_SOURCE_DIR
|
||||
"${CMAKE_SOURCE_DIR}/src/3rdParty/PyCXX/CXX" CACHE PATH
|
||||
"Path to the directory containing PyCXX's cxxextensions.c source file")
|
||||
|
||||
# used as compiler defines
|
||||
set(RESOURCEDIR "${CMAKE_INSTALL_DATADIR}")
|
||||
set(LIBRARYDIR "${CMAKE_INSTALL_LIBDIR}")
|
||||
set(DOCDIR "${CMAKE_INSTALL_DOCDIR}")
|
||||
|
||||
message(STATUS "prefix: ${CMAKE_INSTALL_PREFIX}")
|
||||
message(STATUS "bindir: ${CMAKE_INSTALL_BINDIR}")
|
||||
message(STATUS "datadir: ${CMAKE_INSTALL_DATADIR}")
|
||||
message(STATUS "docdir: ${CMAKE_INSTALL_DOCDIR}")
|
||||
message(STATUS "includedir: ${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
message(STATUS "libdir: ${CMAKE_INSTALL_LIBDIR}")
|
||||
message(STATUS "cmake: ${CMAKE_VERSION}")
|
||||
endmacro(ConfigureCMakeVariables)
|
||||
79
cMake/FreeCAD_Helpers/CopyLibpackDirectories.cmake
Normal file
79
cMake/FreeCAD_Helpers/CopyLibpackDirectories.cmake
Normal file
@@ -0,0 +1,79 @@
|
||||
macro(CopyLibpackDirectories)
|
||||
# Copy libpack dependency directories to build folder for user as part of overall build process
|
||||
if(FREECAD_COPY_DEPEND_DIRS_TO_BUILD)
|
||||
message(STATUS "Copying libpack dependency directories to build directory...")
|
||||
file(COPY ${FREECAD_LIBPACK_DIR}/bin/assistant.exe DESTINATION ${CMAKE_BINARY_DIR}/bin)
|
||||
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/platforms DESTINATION ${CMAKE_BINARY_DIR}/bin)
|
||||
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/imageformats DESTINATION ${CMAKE_BINARY_DIR}/bin)
|
||||
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/iconengines DESTINATION ${CMAKE_BINARY_DIR}/bin)
|
||||
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/sqldrivers DESTINATION ${CMAKE_BINARY_DIR}/bin)
|
||||
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/styles DESTINATION ${CMAKE_BINARY_DIR}/bin)
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/bin/qt.conf "[Paths]\nPrefix=..\n")
|
||||
if(NOT FREECAD_LIBPACK_VERSION VERSION_GREATER_EQUAL "3.0.0")
|
||||
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/printsupport DESTINATION ${CMAKE_BINARY_DIR}/bin)
|
||||
endif()
|
||||
if(FREECAD_LIBPACK_VERSION VERSION_GREATER_EQUAL "3.0.0")
|
||||
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/tls DESTINATION ${CMAKE_BINARY_DIR}/bin)
|
||||
endif()
|
||||
if(FREECAD_LIBPACK_VERSION VERSION_GREATER_EQUAL "3.0.0" AND FREECAD_LIBPACK_VERSION VERSION_LESS "3.1.0")
|
||||
file(COPY ${FREECAD_LIBPACK_DIR}/resources DESTINATION ${CMAKE_BINARY_DIR})
|
||||
endif()
|
||||
message(STATUS "... end copying.\n=======================================\n")
|
||||
endif()
|
||||
|
||||
if(COPY_LIBPACK_BIN_TO_BUILD)
|
||||
if(FREECAD_COPY_LIBPACK_BIN_TO_BUILD)
|
||||
message("Copying LibPack 'bin' directory to build 'bin' directory...")
|
||||
file(COPY ${FREECAD_LIBPACK_DIR}/bin DESTINATION ${CMAKE_BINARY_DIR})
|
||||
if(FREECAD_LIBPACK_VERSION VERSION_GREATER_EQUAL "3.0.0")
|
||||
message("Copying DLLs from LibPack 'lib' directory to build 'bin' directory...")
|
||||
file(GLOB DLLS ${FREECAD_LIBPACK_DIR}/lib/*.dll)
|
||||
file(COPY ${DLLS} DESTINATION ${CMAKE_BINARY_DIR}/bin)
|
||||
file(GLOB DLLS ${FREECAD_LIBPACK_DIR}/bin/Lib/site-packages/shiboken6/shiboken*.dll)
|
||||
file(COPY ${DLLS} DESTINATION ${CMAKE_BINARY_DIR}/bin)
|
||||
file(GLOB DLLS ${FREECAD_LIBPACK_DIR}/bin/Lib/site-packages/PySide6/pyside6*.dll)
|
||||
file(COPY ${DLLS} DESTINATION ${CMAKE_BINARY_DIR}/bin)
|
||||
endif()
|
||||
message(STATUS " ... done.")
|
||||
endif()
|
||||
if(FREECAD_COPY_PLUGINS_BIN_TO_BUILD)
|
||||
message(STATUS "=======================================\n"
|
||||
"Copying plugins to build directory.")
|
||||
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/imageformats DESTINATION ${CMAKE_BINARY_DIR}/bin)
|
||||
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/platforms DESTINATION ${CMAKE_BINARY_DIR}/bin)
|
||||
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/styles DESTINATION ${CMAKE_BINARY_DIR}/bin)
|
||||
if(FREECAD_LIBPACK_VERSION VERSION_LESS "3.1.0")
|
||||
file(COPY ${FREECAD_LIBPACK_DIR}/resources DESTINATION ${CMAKE_BINARY_DIR})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(FREECAD_INSTALL_DEPEND_DIRS)
|
||||
# Test install command for installing/copying directories
|
||||
message(STATUS "=======================================")
|
||||
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/plugins/platforms DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/plugins/imageformats DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/plugins/iconengines DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/plugins/sqldrivers DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/plugins/styles DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
if(NOT FREECAD_LIBPACK_VERSION VERSION_GREATER_EQUAL "3.0.0")
|
||||
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/plugins/printsupport DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
endif()
|
||||
if(FREECAD_LIBPACK_VERSION VERSION_GREATER_EQUAL "3.0.0")
|
||||
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/plugins/tls DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
endif()
|
||||
if(FREECAD_LIBPACK_VERSION VERSION_LESS "3.1.0")
|
||||
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/resources DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
endif()
|
||||
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/bin DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/lib DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.dll")
|
||||
if(FREECAD_LIBPACK_VERSION VERSION_GREATER_EQUAL "3.0.0")
|
||||
# Trailing slashes make sure that cMake extracts the files from the directory, rather than taking the
|
||||
# directory with it
|
||||
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/lib/ DESTINATION ${CMAKE_INSTALL_PREFIX}/bin FILES_MATCHING PATTERN "*.dll")
|
||||
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/bin/Lib/site-packages/shiboken6/ DESTINATION ${CMAKE_INSTALL_PREFIX}/bin FILES_MATCHING PATTERN "shiboken*.dll")
|
||||
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/bin/Lib/site-packages/PySide6/ DESTINATION ${CMAKE_INSTALL_PREFIX}/bin FILES_MATCHING PATTERN "pyside6*.dll")
|
||||
endif()
|
||||
message(STATUS "Created install commands for INSTALL target.\n")
|
||||
endif()
|
||||
endmacro()
|
||||
41
cMake/FreeCAD_Helpers/CreatePackagingTargets.cmake
Normal file
41
cMake/FreeCAD_Helpers/CreatePackagingTargets.cmake
Normal file
@@ -0,0 +1,41 @@
|
||||
macro(CreatePackagingTargets)
|
||||
# ================================================================================
|
||||
# == Packaging ===================================================================
|
||||
#
|
||||
#add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
|
||||
add_custom_target(dist-git
|
||||
COMMAND ${Python3_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 ${Python3_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 ${Python3_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 ${Python3_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)
|
||||
49
cMake/FreeCAD_Helpers/FreeCADLibpackChecks.cmake
Normal file
49
cMake/FreeCAD_Helpers/FreeCADLibpackChecks.cmake
Normal file
@@ -0,0 +1,49 @@
|
||||
macro(FreeCADLibpackChecks)
|
||||
# ==============================================================================
|
||||
|
||||
if(FREECAD_LIBPACK_USE)
|
||||
|
||||
# checking for a unique file in LibPack location to make sure the right version of the LibPack is there
|
||||
find_file(FREECAD_LIBPACK_CHECKFILE_CLBUNDLER MANIFEST.db PATHS ${FREECAD_LIBPACK_DIR} NO_DEFAULT_PATH NO_CACHE)
|
||||
find_file(FREECAD_LIBPACK_CHECKFILE_VERSION FREECAD_LIBPACK_VERSION PATHS ${FREECAD_LIBPACK_DIR} NO_DEFAULT_PATH NO_CACHE)
|
||||
|
||||
# don't show them in the GUI
|
||||
set(FREECAD_LIBPACK_CHECKFILE_CLBUNDLER "${FREECAD_LIBPACK_CHECKFILE_CLBUNDLER}" CACHE INTERNAL "Find libpack")
|
||||
set(FREECAD_LIBPACK_CHECKFILE_VERSION "${FREECAD_LIBPACK_CHECKFILE_VERSION}" CACHE INTERNAL "Find libpack v3+")
|
||||
|
||||
if (FREECAD_LIBPACK_CHECKFILE_CLBUNDLER)
|
||||
set(FREECAD_LIBPACK_VERSION "CLbundler" CACHE STRING "Displays if the libpack has been found" FORCE)
|
||||
message("Found LibPack v2 (CLBundler) via ${FREECAD_LIBPACK_CHECKFILE_CLBUNDLER}")
|
||||
include(cMake/UseLibPackCLbundler.cmake)
|
||||
elseif (FREECAD_LIBPACK_CHECKFILE_VERSION)
|
||||
file(READ ${FREECAD_LIBPACK_CHECKFILE_VERSION} FREECAD_LIBPACK_VERSION)
|
||||
set(FREECAD_LIBPACK_VERSION "${FREECAD_LIBPACK_VERSION}" CACHE STRING "Version of the LibPack, if found" FORCE)
|
||||
message("Found LibPack " ${FREECAD_LIBPACK_VERSION})
|
||||
include(cMake/UseLibPack3.cmake)
|
||||
else(FREECAD_LIBPACK_CHECKFILE_CLBUNDLER)
|
||||
set(FREECAD_LIBPACK_VERSION "NOTFOUND" CACHE STRING "Displays if the libpack has been found" FORCE)
|
||||
message(SEND_ERROR "Could not find LibPack in specified location:" ${FREECAD_LIBPACK_DIR})
|
||||
endif(FREECAD_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 FREECAD_USE_EXTERNAL_SMESH)
|
||||
set(SMESH_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/3rdParty/salomesmesh/inc)
|
||||
endif()
|
||||
|
||||
endif(FREECAD_LIBPACK_USE)
|
||||
|
||||
endmacro(FreeCADLibpackChecks)
|
||||
226
cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake
Normal file
226
cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake
Normal file
@@ -0,0 +1,226 @@
|
||||
macro(InitializeFreeCADBuildOptions)
|
||||
# ==============================================================================
|
||||
# ================= 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 FreeCAD Gui. Otherwise you have only the command line and the Python import module." ON)
|
||||
option(FREECAD_USE_EXTERNAL_ZIPIOS "Use system installed zipios++ instead of the bundled." OFF)
|
||||
option(FREECAD_USE_EXTERNAL_SMESH "Use system installed smesh instead of the bundled." OFF)
|
||||
option(FREECAD_USE_EXTERNAL_KDL "Use system installed orocos-kdl instead of the bundled." OFF)
|
||||
option(FREECAD_USE_EXTERNAL_FMT "Use system installed fmt library if available instead of fetching the source." ON)
|
||||
option(FREECAD_USE_EXTERNAL_ONDSELSOLVER "Use system installed OndselSolver instead of git submodule." OFF)
|
||||
option(FREECAD_USE_EXTERNAL_E57FORMAT "Use system installed libE57Format instead of the bundled." OFF)
|
||||
option(FREECAD_USE_EXTERNAL_GTEST "Use system installed Google Test and Google Mock" OFF)
|
||||
option(FREECAD_USE_FREETYPE "Builds the features using FreeType libs" ON)
|
||||
option(FREECAD_BUILD_DEBIAN "Prepare for a build of a Debian package" OFF)
|
||||
option(FREECAD_CHECK_PIVY "Check for pivy version using Python at build time" ON)
|
||||
option(FREECAD_PARALLEL_COMPILE_JOBS "Compilation jobs pool size to fit memory limitations.")
|
||||
option(FREECAD_PARALLEL_LINK_JOBS "Linkage jobs pool size to fit memory limitations.")
|
||||
option(BUILD_WITH_CONDA "Set ON if you build FreeCAD with conda" OFF)
|
||||
option(BUILD_DYNAMIC_LINK_PYTHON "If OFF extension-modules do not link against python-libraries" ON)
|
||||
option(BUILD_TRACY_FRAME_PROFILER "If ON then enables support for the Tracy frame profiler" OFF)
|
||||
|
||||
option(INSTALL_TO_SITEPACKAGES "If ON the freecad root namespace (python) is installed into python's site-packages" ON)
|
||||
option(INSTALL_PREFER_SYMLINKS "If ON then fc_copy_sources macro will create symlinks instead of copying files" OFF)
|
||||
option(OCCT_CMAKE_FALLBACK "disable usage of occt-config files" OFF)
|
||||
option(FREECAD_USE_QT_DIALOGS "Use Qt's dialogs instead of the native one." OFF)
|
||||
|
||||
# == Win32 is default behaviour use the LibPack copied in Source tree ==========
|
||||
if(MSVC)
|
||||
option(FREECAD_RELEASE_PDB "Create PDB files for Release version." ON)
|
||||
option(FREECAD_RELEASE_SEH "Enable Structured Exception Handling for Release version." ON)
|
||||
option(FREECAD_LIBPACK_USE "Use the LibPack to Build FreeCAD (only Win32 so far)." ON)
|
||||
option(FREECAD_USE_PCH "Activate precompiled headers where it's used." ON)
|
||||
|
||||
if (DEFINED ENV{FREECAD_LIBPACK_DIR})
|
||||
set(FREECAD_LIBPACK_DIR $ENV{FREECAD_LIBPACK_DIR} CACHE PATH "Directory of the FreeCAD LibPack")
|
||||
message(STATUS "Found libpack env variable: ${FREECAD_LIBPACK_DIR}")
|
||||
else()
|
||||
set(FREECAD_LIBPACK_DIR ${CMAKE_SOURCE_DIR} CACHE PATH "Directory of the FreeCAD LibPack")
|
||||
endif()
|
||||
|
||||
set(LIBPACK_FOUND OFF )
|
||||
if (EXISTS ${FREECAD_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 FreeCAD solution
|
||||
option(FREECAD_INSTALL_DEPEND_DIRS "Create install dependency commands for the INSTALL target found
|
||||
in the FreeCAD 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(FREECAD_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(FREECAD_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(FREECAD_COPY_PLUGINS_BIN_TO_BUILD "Copy plugins to the build directory." OFF)
|
||||
endif()
|
||||
else()
|
||||
message(WARNING Could not locate ${FREECAD_LIBPACK_DIR}/plugins/imageformats/qsvg.dll)
|
||||
message("Libpack NOT found.\nIf you intend to use a Windows libpack, set the FREECAD_LIBPACK_DIR to the libpack directory.")
|
||||
message(STATUS "Visit: https://github.com/FreeCAD/FreeCAD-Libpack/releases/ for Windows libpack downloads.")
|
||||
endif()
|
||||
elseif(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
|
||||
option(FREECAD_WARN_ERROR "Make all warnings into errors. " OFF)
|
||||
else(MSVC)
|
||||
option(FREECAD_LIBPACK_USE "Use the LibPack to Build FreeCAD (only Win32 so far)." OFF)
|
||||
set(FREECAD_LIBPACK_DIR "" CACHE PATH "Directory of the FreeCAD LibPack")
|
||||
endif(MSVC)
|
||||
|
||||
ChooseQtVersion()
|
||||
|
||||
option(BUILD_DESIGNER_PLUGIN "Build and install the designer plugin" OFF)
|
||||
|
||||
if(APPLE)
|
||||
option(FREECAD_CREATE_MAC_APP "Create app bundle on install" OFF)
|
||||
|
||||
if(FREECAD_CREATE_MAC_APP)
|
||||
install(
|
||||
DIRECTORY ${CMAKE_SOURCE_DIR}/src/MacAppBundle/FreeCAD.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(FREECAD_CREATE_MAC_APP)
|
||||
set(CMAKE_MACOSX_RPATH TRUE )
|
||||
endif(APPLE)
|
||||
|
||||
option(BUILD_FEM "Build the FreeCAD FEM module" ON)
|
||||
option(BUILD_SANDBOX "Build the FreeCAD Sandbox module which is only for testing purposes" OFF)
|
||||
option(BUILD_TEMPLATE "Build the FreeCAD template module which is only for testing purposes" OFF)
|
||||
option(BUILD_ADDONMGR "Build the FreeCAD addon manager module" ON)
|
||||
option(BUILD_BIM "Build the FreeCAD BIM module" ON)
|
||||
option(BUILD_DRAFT "Build the FreeCAD draft module" ON)
|
||||
option(BUILD_DRAWING "Build the FreeCAD drawing module" OFF)
|
||||
option(BUILD_HELP "Build the FreeCAD help module" ON)
|
||||
option(BUILD_IMPORT "Build the FreeCAD import module" ON)
|
||||
option(BUILD_INSPECTION "Build the FreeCAD inspection module" ON)
|
||||
option(BUILD_JTREADER "Build the FreeCAD jt reader module" OFF)
|
||||
option(BUILD_MATERIAL "Build the FreeCAD material module" ON)
|
||||
option(BUILD_MATERIAL_EXTERNAL "Build the FreeCAD material external interface module" OFF)
|
||||
option(BUILD_MESH "Build the FreeCAD mesh module" ON)
|
||||
option(BUILD_MESH_PART "Build the FreeCAD mesh part module" ON)
|
||||
option(BUILD_FLAT_MESH "Build the FreeCAD flat mesh module" ON)
|
||||
option(BUILD_OPENSCAD "Build the FreeCAD openscad module" ON)
|
||||
option(BUILD_PART "Build the FreeCAD part module" ON)
|
||||
option(BUILD_PART_DESIGN "Build the FreeCAD part design module" ON)
|
||||
option(BUILD_CAM "Build the FreeCAD CAM module" ON)
|
||||
option(BUILD_ASSEMBLY "Build the FreeCAD Assembly module" ON)
|
||||
option(BUILD_PLOT "Build the FreeCAD plot module" ON)
|
||||
option(BUILD_POINTS "Build the FreeCAD points module" ON)
|
||||
option(BUILD_REVERSEENGINEERING "Build the FreeCAD reverse engineering module" ON)
|
||||
option(BUILD_ROBOT "Build the FreeCAD robot module" ON)
|
||||
option(BUILD_SHOW "Build the FreeCAD Show module (helper module for visibility automation)" ON)
|
||||
option(BUILD_SKETCHER "Build the FreeCAD sketcher module" ON)
|
||||
option(BUILD_SPREADSHEET "Build the FreeCAD spreadsheet module" ON)
|
||||
option(BUILD_START "Build the FreeCAD start module" ON)
|
||||
option(BUILD_TEST "Build the FreeCAD test module" ON)
|
||||
option(BUILD_MEASURE "Build the FreeCAD Measure module" ON)
|
||||
option(BUILD_TECHDRAW "Build the FreeCAD Technical Drawing module" ON)
|
||||
option(BUILD_TUX "Build the FreeCAD Tux module" ON)
|
||||
option(BUILD_WEB "Build the FreeCAD Web module" ON)
|
||||
option(BUILD_SURFACE "Build the FreeCAD surface module" ON)
|
||||
option(BUILD_VR "Build the FreeCAD Oculus Rift support (need Oculus SDK 4.x or higher)" OFF)
|
||||
option(BUILD_CLOUD "Build the FreeCAD cloud module" OFF)
|
||||
option(ENABLE_DEVELOPER_TESTS "Build the FreeCAD unit tests suit" ON)
|
||||
|
||||
if(MSVC OR APPLE)
|
||||
set(FREECAD_3DCONNEXION_SUPPORT "NavLib" CACHE STRING "Select version of the 3Dconnexion device integration")
|
||||
set_property(CACHE FREECAD_3DCONNEXION_SUPPORT PROPERTY STRINGS "None" "NavLib" "Legacy" "Both")
|
||||
else(MSVC OR APPLE)
|
||||
option(FREECAD_USE_3DCONNEXION_LEGACY "Enable support for 3Dconnexion devices." ON)
|
||||
endif(MSVC OR APPLE)
|
||||
|
||||
if(FREECAD_3DCONNEXION_SUPPORT STREQUAL "NavLib")
|
||||
set(FREECAD_USE_3DCONNEXION_NAVLIB ON)
|
||||
elseif(FREECAD_3DCONNEXION_SUPPORT STREQUAL "Both")
|
||||
set(FREECAD_USE_3DCONNEXION_NAVLIB ON)
|
||||
set(FREECAD_USE_3DCONNEXION_LEGACY ON)
|
||||
elseif(FREECAD_3DCONNEXION_SUPPORT STREQUAL "Legacy")
|
||||
set(FREECAD_USE_3DCONNEXION_LEGACY ON)
|
||||
elseif(FREECAD_3DCONNEXION_SUPPORT STREQUAL "None")
|
||||
set(FREECAD_USE_3DCONNEXION_NAVLIB OFF)
|
||||
set(FREECAD_USE_3DCONNEXION_LEGACY OFF)
|
||||
endif()
|
||||
|
||||
if(APPLE AND FREECAD_USE_3DCONNEXION_LEGACY)
|
||||
find_library(3DCONNEXIONCLIENT_FRAMEWORK 3DconnexionClient)
|
||||
if(NOT (IS_DIRECTORY ${3DCONNEXIONCLIENT_FRAMEWORK}))
|
||||
set(FREECAD_USE_3DCONNEXION_LEGACY OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
option(BUILD_FEM_NETGEN "Build the FreeCAD FEM module with the NETGEN mesher" ON)
|
||||
option(FREECAD_USE_PCL "Build the features that use PCL libs" OFF)
|
||||
endif(MSVC)
|
||||
if(NOT MSVC)
|
||||
option(BUILD_FEM_NETGEN "Build the FreeCAD FEM module with the NETGEN mesher" OFF)
|
||||
option(FREECAD_USE_PCL "Build the features that use PCL libs" OFF)
|
||||
endif(NOT MSVC)
|
||||
|
||||
# if this is set override some options
|
||||
if (FREECAD_BUILD_DEBIAN)
|
||||
# Disable it until the upstream package has been fixed. See
|
||||
# https://github.com/FreeCAD/FreeCAD/issues/13676#issuecomment-2539978468
|
||||
# https://github.com/FreeCAD/FreeCAD/issues/13676#issuecomment-2541513308
|
||||
set(FREECAD_USE_EXTERNAL_ZIPIOS OFF )
|
||||
# A Debian package for SMESH doesn't exist
|
||||
#set(FREECAD_USE_EXTERNAL_SMESH ON )
|
||||
endif (FREECAD_BUILD_DEBIAN)
|
||||
|
||||
if(BUILD_FEM OR BUILD_MESH_PART)
|
||||
set(FREECAD_USE_SMESH ON)
|
||||
if(FREECAD_USE_EXTERNAL_SMESH)
|
||||
set(BUILD_SMESH OFF)
|
||||
else()
|
||||
set(BUILD_SMESH ON)
|
||||
endif()
|
||||
else()
|
||||
set(FREECAD_USE_SMESH OFF)
|
||||
set(BUILD_SMESH OFF)
|
||||
endif()
|
||||
|
||||
if (BUILD_CAM OR BUILD_FLAT_MESH)
|
||||
set(FREECAD_USE_PYBIND11 ON)
|
||||
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()
|
||||
|
||||
if(FREECAD_PARALLEL_COMPILE_JOBS)
|
||||
if(CMAKE_GENERATOR MATCHES "Ninja")
|
||||
set_property(GLOBAL APPEND PROPERTY JOB_POOLS compile_job_pool=${FREECAD_PARALLEL_COMPILE_JOBS})
|
||||
set(CMAKE_JOB_POOL_COMPILE compile_job_pool)
|
||||
else()
|
||||
message(WARNING "Job pooling is only available with Ninja generators.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(FREECAD_PARALLEL_LINK_JOBS)
|
||||
if(CMAKE_GENERATOR MATCHES "Ninja")
|
||||
set_property(GLOBAL APPEND PROPERTY JOB_POOLS link_job_pool=${FREECAD_PARALLEL_LINK_JOBS})
|
||||
set(CMAKE_JOB_POOL_LINK link_job_pool)
|
||||
else()
|
||||
message(WARNING "Job pooling is only available with Ninja generators.")
|
||||
endif()
|
||||
endif()
|
||||
endmacro(InitializeFreeCADBuildOptions)
|
||||
234
cMake/FreeCAD_Helpers/PrintFinalReport.cmake
Normal file
234
cMake/FreeCAD_Helpers/PrintFinalReport.cmake
Normal file
@@ -0,0 +1,234 @@
|
||||
macro(PrintFinalReport)
|
||||
|
||||
# name and value
|
||||
macro(simple)
|
||||
set(name ${ARGV0})
|
||||
set(value ${ARGV1})
|
||||
if(NOT value)
|
||||
set(value "-undefined-")
|
||||
endif()
|
||||
string(APPEND name ": ")
|
||||
string(SUBSTRING ${name} 0 28 nameStr)
|
||||
list(APPEND simpleLines "${nameStr} ${value}")
|
||||
endmacro()
|
||||
|
||||
# just a value
|
||||
macro(value)
|
||||
unset(val)
|
||||
set(name ${ARGV0})
|
||||
if(${name})
|
||||
set(val ${${name}}) # name has a value
|
||||
elseif(DEFINED ${name})
|
||||
set(val "OFF ") #!
|
||||
endif()
|
||||
simple(${name} ${val})
|
||||
endmacro()
|
||||
|
||||
# conditional data
|
||||
macro(conditional)
|
||||
set(name ${ARGV0})
|
||||
set(condition ${ARGV1})
|
||||
set(ifFalse ${ARGV2})
|
||||
set(ifTrue ${ARGV3})
|
||||
if(${condition})
|
||||
set(out ${ifTrue})
|
||||
else()
|
||||
set(out ${ifFalse})
|
||||
endif()
|
||||
simple(${name} ${out})
|
||||
endmacro()
|
||||
|
||||
function(section_begin name)
|
||||
unset(simpleLines PARENT_SCOPE)
|
||||
message("\n ==============\n"
|
||||
" ${name}\n"
|
||||
" ==============\n")
|
||||
endfunction()
|
||||
|
||||
function(section_end)
|
||||
list(SORT simpleLines CASE INSENSITIVE)
|
||||
foreach(line ${simpleLines})
|
||||
message(STATUS ${line})
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
############## System ####################
|
||||
|
||||
section_begin(System)
|
||||
|
||||
simple(Compiler "${CMAKE_CXX_COMPILER} (${CMAKE_CXX_COMPILER_VERSION})")
|
||||
value(CMAKE_VERSION)
|
||||
conditional(ccache CCACHE_PROGRAM "not enabled" ${CCACHE_PROGRAM})
|
||||
simple(prefix ${CMAKE_INSTALL_PREFIX})
|
||||
simple(bindir ${CMAKE_INSTALL_BINDIR})
|
||||
simple(datadir ${CMAKE_INSTALL_DATADIR})
|
||||
simple(docdir ${CMAKE_INSTALL_DOCDIR})
|
||||
simple(includedir ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
simple(libdir ${CMAKE_INSTALL_LIBDIR})
|
||||
simple(Python "${Python3_VERSION} [${Python3_EXECUTABLE}] Suffix: [${PYTHON_CONFIG_SUFFIX}]")
|
||||
value(BLAS)
|
||||
|
||||
section_end()
|
||||
|
||||
############## Config ####################
|
||||
|
||||
section_begin(Config)
|
||||
|
||||
value(CMAKE_CXX_STANDARD)
|
||||
value(CMAKE_CXX_FLAGS)
|
||||
value(CMAKE_BUILD_TYPE)
|
||||
value(ENABLE_DEVELOPER_TESTS)
|
||||
value(FREECAD_USE_FREETYPE)
|
||||
value(FREECAD_USE_EXTERNAL_SMESH)
|
||||
value(FREECAD_USE_SANITIZER_ASAN)
|
||||
value(FREECAD_USE_SANITIZER_LSAN)
|
||||
value(FREECAD_USE_SANITIZER_TSAN)
|
||||
value(FREECAD_USE_SANITIZER_UBSAN)
|
||||
value(FREECAD_USE_SANITIZER_MSAN)
|
||||
value(BUILD_SMESH)
|
||||
value(BUILD_VR)
|
||||
value(CMAKE_PREFIX_PATH)
|
||||
value(FREECAD_QT_VERSION)
|
||||
value(Python3_EXECUTABLE)
|
||||
value(PYTHON_LIBRARY)
|
||||
value(FREECAD_CREATE_MAC_APP)
|
||||
value(FREECAD_USE_EXTERNAL_KDL)
|
||||
value(FREECAD_USE_PYSIDE)
|
||||
value(FREECAD_USE_SHIBOKEN)
|
||||
value(BUILD_ADDONMGR)
|
||||
value(BUILD_BIM)
|
||||
value(BUILD_ASSEMBLY)
|
||||
value(BUILD_CLOUD)
|
||||
value(BUILD_DRAFT)
|
||||
value(BUILD_DRAWING)
|
||||
value(BUILD_FEM)
|
||||
value(BUILD_GUI)
|
||||
value(BUILD_HELP)
|
||||
value(BUILD_IMPORT)
|
||||
value(BUILD_INSPECTION)
|
||||
value(BUILD_JTREADER)
|
||||
value(BUILD_MATERIAL)
|
||||
value(BUILD_MATERIAL_EXTERNAL)
|
||||
value(BUILD_MESH)
|
||||
value(BUILD_MESH_PART)
|
||||
value(BUILD_OPENSCAD)
|
||||
value(BUILD_PART)
|
||||
value(BUILD_PART_DESIGN)
|
||||
value(BUILD_CAM)
|
||||
value(BUILD_PLOT)
|
||||
value(BUILD_POINTS)
|
||||
value(BUILD_REVERSEENGINEERING)
|
||||
value(BUILD_ROBOT)
|
||||
value(BUILD_SANDBOX)
|
||||
value(BUILD_SHOW)
|
||||
value(BUILD_SKETCHER)
|
||||
value(BUILD_SPREADSHEET)
|
||||
value(BUILD_START)
|
||||
value(BUILD_SURFACE)
|
||||
value(BUILD_MEASURE)
|
||||
value(BUILD_TECHDRAW)
|
||||
value(BUILD_TEST)
|
||||
value(BUILD_TUX)
|
||||
value(BUILD_WEB)
|
||||
value(CMAKE_INSTALL_PREFIX)
|
||||
value(USE_CUDA)
|
||||
value(USE_OPENCV)
|
||||
value(FREECAD_LIBPACK_USE)
|
||||
|
||||
section_end()
|
||||
|
||||
################ Libraries ##################
|
||||
|
||||
section_begin(Libraries)
|
||||
|
||||
# Qt5 needs/sets PYTHON_CONFIG_SUFFIX regarding Shiboken
|
||||
conditional(pybind11 pybind11_FOUND "not enabled" ${pybind11_VERSION})
|
||||
simple(Boost ${Boost_VERSION})
|
||||
simple(XercesC "${XercesC_VERSION} [${XercesC_LIBRARIES}] [${XercesC_INCLUDE_DIRS}]")
|
||||
simple(ICU "${ICU_VERSION}")
|
||||
simple(ZLIB "${ZLIB_VERSION_STRING}")
|
||||
simple(OCC "${OCC_VERSION_STRING} [${OCC_LIBRARY_DIR}] [${OCC_INCLUDE_DIR}]")
|
||||
simple(OCC_Libs "[${OCC_LIBRARIES}]")
|
||||
if(FREECAD_USE_SMESH)
|
||||
if(FREECAD_USE_EXTERNAL_SMESH)
|
||||
simple(SMESH "${SMESH_VERSION_MAJOR}.${SMESH_VERSION_MINOR}.${SMESH_VERSION_PATCH}.${SMESH_VERSION_TWEAK}")
|
||||
else()
|
||||
simple(SMESH "${SMESH_VERSION_MAJOR}.${SMESH_VERSION_MINOR}.${SMESH_VERSION_PATCH}.${SMESH_VERSION_TWEAK} build internal")
|
||||
simple(MEDFile "${MEDFILE_VERSION} [${MEDFILE_LIBRARIES}] [${MEDFILE_INCLUDE_DIRS}]")
|
||||
simple(HDF5 ${HDF5_VERSION})
|
||||
endif()
|
||||
else()
|
||||
simple(SMESH "not enabled")
|
||||
endif()
|
||||
conditional(NETGEN NETGEN_FOUND
|
||||
"not enabled"
|
||||
"${NETGEN_VERSION_MAJOR}.${NETGEN_VERSION_MINOR}.${NETGEN_VERSION_PATCH} (${NETGEN_VERSION}) [${NETGEN_DEFINITIONS}] [${NETGEN_CXX_FLAGS}] [${NGLIB_INCLUDE_DIR}] [${NGLIB_LIBRARIES}] [${NETGEN_INCLUDE_DIRS}]"
|
||||
)
|
||||
#simple(OpenCV ${OpenCV_VERSION})
|
||||
conditional(SWIG SWIG_FOUND "not found" ${SWIG_VERSION})
|
||||
conditional(Eigen3 EIGEN3_FOUND "not found" ${EIGEN3_VERSION})
|
||||
conditional(QtConcurrent BUILD_GUI "not needed" ${QtConcurrent_VERSION})
|
||||
simple(QtCore ${QtCore_VERSION})
|
||||
simple(QtNetwork ${QtNetwork_VERSION})
|
||||
conditional(QtOpenGL BUILD_GUI "not needed" ${QtOpenGL_VERSION})
|
||||
conditional(QtOpenGLWidgets BUILD_GUI "not needed" ${QtOpenGLWidgets_VERSION})
|
||||
conditional(QtPrintSupport BUILD_GUI "not needed" ${QtPrintSupport_VERSION})
|
||||
conditional(QtSvg BUILD_GUI "not needed" ${QtSvg_VERSION})
|
||||
conditional(QtUiTools BUILD_GUI "not needed" ${QtUiTools_VERSION})
|
||||
conditional(QtWidgets BUILD_GUI "not needed" ${QtWidgets_VERSION})
|
||||
simple(QtXml ${QtXml_VERSION})
|
||||
conditional(QtTest ENABLE_DEVELOPER_TESTS "not needed" ${QtTest_VERSION})
|
||||
if (BUILD_GUI)
|
||||
conditional(DesignerPlugin BUILD_DESIGNER_PLUGIN
|
||||
"not built (BUILD_DESIGNER_PLUGIN is OFF)"
|
||||
"[${DESIGNER_PLUGIN_LOCATION}/${libFreeCAD_widgets}]"
|
||||
)
|
||||
endif()
|
||||
conditional(Shiboken Shiboken${SHIBOKEN_MAJOR_VERSION}_FOUND "not found" "${Shiboken_VERSION} [${SHIBOKEN_INCLUDE_DIR}]")
|
||||
conditional(PySide PySide${PYSIDE_MAJOR_VERSION}_FOUND "not found" "${PySide_VERSION} [${PYSIDE_INCLUDE_DIR}]")
|
||||
conditional(PySideTools PYSIDE_TOOLS_FOUND
|
||||
"not found"
|
||||
"v: ${PySideTools_VERSION} uic: [${PYSIDE_UIC_EXECUTABLE}] rcc: [${PYSIDE_RCC_EXECUTABLE}]"
|
||||
)
|
||||
if(FREECAD_USE_FREETYPE)
|
||||
conditional(Freetype FREETYPE_FOUND "not found" ${FREETYPE_VERSION_STRING})
|
||||
else()
|
||||
simple(Freetype "disabled")
|
||||
endif()
|
||||
simple(OpenGL_Lib [${OPENGL_gl_LIBRARY}])
|
||||
simple(OpenGLU_Lib [${OPENGL_glu_LIBRARY}])
|
||||
simple(OpenGLU_Incl [${OPENGL_INCLUDE_DIR}])
|
||||
simple(Coin3D "${COIN3D_VERSION} [${COIN3D_LIBRARIES}] [${COIN3D_INCLUDE_DIRS}]")
|
||||
simple(pivy ${PIVY_VERSION})
|
||||
if(WIN32 OR APPLE)
|
||||
if(FREECAD_USE_3DCONNEXION_LEGACY AND FREECAD_USE_3DCONNEXION_NAVLIB)
|
||||
simple(3Dconnexion "Building with 3Dconnexion legacy and NavLib support")
|
||||
elseif(FREECAD_USE_3DCONNEXION_LEGACY)
|
||||
simple(3Dconnexion "Building with 3Dconnexion legacy support")
|
||||
elseif(FREECAD_USE_3DCONNEXION_NAVLIB)
|
||||
simple(3Dconnexion "Building with 3Dconnexion NavLib support")
|
||||
else()
|
||||
simple(3Dconnexion "Not building 3Dconnexion device support")
|
||||
endif()
|
||||
else()
|
||||
conditional(SPNAV SPNAV_FOUND "not found" "[${SPNAV_LIBRARY}] [${SPNAV_INCLUDE_DIR}]")
|
||||
endif()
|
||||
conditional(Matplotlib MATPLOTLIB_FOUND "not found" "${MATPLOTLIB_VERSION} PathDirs: ${MATPLOTLIB_PATH_DIRS}")
|
||||
if(BUILD_VR)
|
||||
conditional(Rift RIFT_FOUND "not found" ${Rift_VERSION})
|
||||
else()
|
||||
simple(Rift "not enabled (BUILD_VR)")
|
||||
endif()
|
||||
conditional(Doxygen DOXYGEN_FOUND "not found" "${DOXYGEN_VERSION} Language: ${DOXYGEN_LANGUAGE}")
|
||||
conditional(Coin3D_DOC COIN3D_DOC_FOUND "not found" ${COIN3D_DOC_PATH})
|
||||
conditional(PYCXX PYCXX_FOUND "not found" "${PYCXX_VERSION} Incl: ${PYCXX_INCLUDE_DIR} Src:${PYCXX_SOURCE_DIR}")
|
||||
conditional(fmt fmt_FOUND "Sources downloaded to ${fmt_SOURCE_DIR}" "${fmt_VERSION}")
|
||||
conditional(yaml-cpp yaml-cpp_FOUND "not found" "${yaml-cpp_VERSION}")
|
||||
conditional(Vtk VTK_FOUND "not found" ${VTK_VERSION})
|
||||
if(BUILD_BIM)
|
||||
conditional(Lark LARK_FOUND "not found" "${LARK_VERSION}")
|
||||
endif()
|
||||
|
||||
section_end()
|
||||
|
||||
endmacro()
|
||||
19
cMake/FreeCAD_Helpers/README.md
Normal file
19
cMake/FreeCAD_Helpers/README.md
Normal file
@@ -0,0 +1,19 @@
|
||||
This folder will contain an individual cmake file for each FreeCAD "helper".
|
||||
|
||||
A "helper" should be a macro or function that tries (as much as possible) to adhere to the
|
||||
UNIX philosophy - in other words, it should strive to do one thing and do it well.
|
||||
|
||||
The idea here is to break up the cmake build system into smaller, more manageable chunks.
|
||||
This should make maintenance easier, and should also make troubleshooting a bit less
|
||||
painful. Finally, it should also clean up our top-level CMakeLists.txt file a bit, making
|
||||
it bit easier for new developers to jump in and see what's what.
|
||||
|
||||
NOTE: CMake has a very distinct difference between its macros and its functions. Namely, a
|
||||
function creates its own SCOPE, whereas a macro essentially executes in the calling scope.
|
||||
There are also some specifics of how arguments are managed.
|
||||
|
||||
In general:
|
||||
|
||||
1) If you use a macro, be careful modifying arguments - you may get surprises.
|
||||
2) If you use a function, make sure to use set(.... PARENT_SCOPE) for variables that
|
||||
should be available outside of the function.
|
||||
106
cMake/FreeCAD_Helpers/SetGlobalCompilerAndLinkerSettings.cmake
Normal file
106
cMake/FreeCAD_Helpers/SetGlobalCompilerAndLinkerSettings.cmake
Normal file
@@ -0,0 +1,106 @@
|
||||
macro(SetGlobalCompilerAndLinkerSettings)
|
||||
# ================================================================================
|
||||
# == Global Compiler and Linker Settings =========================================
|
||||
|
||||
include_directories(${CMAKE_BINARY_DIR}/src
|
||||
${CMAKE_SOURCE_DIR}/src)
|
||||
|
||||
# check for 64-bit platform
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
message(STATUS "Platform is 64-bit, set -D_OCC64")
|
||||
add_definitions(-D_OCC64 )
|
||||
else(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
message(STATUS "Platform is 32-bit")
|
||||
endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
|
||||
# check for mips64 platform
|
||||
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "mips64")
|
||||
message(STATUS "Architecture: mips64")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mxgot")
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
|
||||
# Only add -O0 if no -O* optimization flag exists
|
||||
if (NOT "${CMAKE_C_FLAGS_DEBUG}" MATCHES "-O[a-z0-9]+")
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0")
|
||||
endif()
|
||||
if (NOT "${CMAKE_CXX_FLAGS_DEBUG}" MATCHES "-O[a-z0-9]+")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")
|
||||
endif()
|
||||
endif()
|
||||
if(MSVC)
|
||||
# set default compiler settings
|
||||
add_definitions(-D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR -DNOMINMAX)
|
||||
add_compile_options(/Zm150 /bigobj)
|
||||
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DFC_DEBUG")
|
||||
if (MSVC_VERSION LESS 1930) # Anything before VS 2022
|
||||
# set default libs
|
||||
set (CMAKE_C_STANDARD_LIBRARIES "kernel32.lib user32.lib gdi32.lib winspool.lib SHFolder.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib winmm.lib comsupp.lib Ws2_32.lib dbghelp.lib ")
|
||||
set (CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES}")
|
||||
# set linker flag /nodefaultlib
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NODEFAULTLIB")
|
||||
set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /NODEFAULTLIB")
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB")
|
||||
endif()
|
||||
if(FREECAD_RELEASE_PDB)
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
|
||||
set (CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG")
|
||||
set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG")
|
||||
endif(FREECAD_RELEASE_PDB)
|
||||
if(FREECAD_RELEASE_SEH)
|
||||
# remove /EHsc or /EHs flags because they are incompatible with /EHa
|
||||
if (${CMAKE_BUILD_TYPE} MATCHES "Release")
|
||||
string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string(REPLACE "/EHs" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /EHa")
|
||||
endif()
|
||||
endif(FREECAD_RELEASE_SEH)
|
||||
if(CCACHE_PROGRAM)
|
||||
# By default Visual Studio generators will use /Zi which is not compatible
|
||||
# with ccache, so tell Visual Studio to use /Z7 instead.
|
||||
string(REGEX REPLACE "/Z[iI]" "/Z7" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
string(REGEX REPLACE "/Z[iI]" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||
string(REGEX REPLACE "/Z[iI]" "/Z7" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
endif(CCACHE_PROGRAM)
|
||||
option(FREECAD_USE_MP_COMPILE_FLAG "Add /MP flag to the compiler definitions. Speeds up the compile on multi processor machines" ON)
|
||||
if(FREECAD_USE_MP_COMPILE_FLAG)
|
||||
# set "Build with Multiple Processes"
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
|
||||
endif()
|
||||
|
||||
# Mark 32 bit executables large address aware so they can use > 2GB address space
|
||||
# NOTE: This setting only has an effect on machines with at least 3GB of RAM, although it sets the linker option it doesn't set the linker switch 'Enable Large Addresses'
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LARGEADDRESSAWARE")
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
|
||||
endif(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
else(MSVC)
|
||||
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DFC_DEBUG")
|
||||
#message(STATUS "DEBUG: ${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
endif(MSVC)
|
||||
|
||||
if(MINGW)
|
||||
if(CMAKE_COMPILER_IS_CLANGXX)
|
||||
# clang for MSYS doesn't support -mthreads
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-attributes")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--export-all-symbols")
|
||||
#set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--export-all-symbols")
|
||||
else()
|
||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=12477
|
||||
# Actually '-Wno-inline-dllimport' should work to suppress warnings of the form:
|
||||
# inline function 'foo' is declared as dllimport: attribute ignored
|
||||
# But it doesn't work with MinGW gcc 4.5.0 while using '-Wno-attributes' seems to
|
||||
# do the trick.
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-attributes")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--export-all-symbols")
|
||||
#set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--export-all-symbols")
|
||||
# http://stackoverflow.com/questions/8375310/warning-auto-importing-has-been-activated-without-enable-auto-import-specifie
|
||||
# set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc -static-libstdc++")
|
||||
link_libraries(-lgdi32)
|
||||
endif()
|
||||
endif(MINGW)
|
||||
|
||||
endmacro(SetGlobalCompilerAndLinkerSettings)
|
||||
10
cMake/FreeCAD_Helpers/SetLibraryVersions.cmake
Normal file
10
cMake/FreeCAD_Helpers/SetLibraryVersions.cmake
Normal file
@@ -0,0 +1,10 @@
|
||||
macro(SetLibraryVersions)
|
||||
# version information of libraries
|
||||
#
|
||||
if(OCC_INCLUDE_DIR AND EXISTS ${OCC_INCLUDE_DIR}/Standard_Version.hxx)
|
||||
set(HAVE_OCC_VERSION 1)
|
||||
endif(OCC_INCLUDE_DIR AND EXISTS ${OCC_INCLUDE_DIR}/Standard_Version.hxx)
|
||||
|
||||
configure_file(${CMAKE_SOURCE_DIR}/src/LibraryVersions.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/LibraryVersions.h)
|
||||
|
||||
endmacro(SetLibraryVersions)
|
||||
31
cMake/FreeCAD_Helpers/SetupBoost.cmake
Normal file
31
cMake/FreeCAD_Helpers/SetupBoost.cmake
Normal file
@@ -0,0 +1,31 @@
|
||||
macro(SetupBoost)
|
||||
# -------------------------------- Boost --------------------------------
|
||||
|
||||
set(_boost_TEST_VERSIONS ${Boost_ADDITIONAL_VERSIONS})
|
||||
|
||||
set (BOOST_COMPONENTS program_options regex 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)
|
||||
82
cMake/FreeCAD_Helpers/SetupCoin3D.cmake
Normal file
82
cMake/FreeCAD_Helpers/SetupCoin3D.cmake
Normal file
@@ -0,0 +1,82 @@
|
||||
macro(SetupCoin3D)
|
||||
# -------------------------------- Coin3D --------------------------------
|
||||
|
||||
if (WIN32 AND MINGW)
|
||||
find_path(COIN3D_INCLUDE_DIRS Inventor/So.h)
|
||||
find_library(COIN3D_LIBRARIES Coin)
|
||||
endif ()
|
||||
|
||||
# Try CONFIG mode -- Coin supports very old CMake files, which emits noisy warnings. Silence them.
|
||||
set(CMAKE_WARN_DEPRECATED_OLD_STATE ${CMAKE_WARN_DEPRECATED})
|
||||
set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "" FORCE)
|
||||
find_package(Coin CONFIG)
|
||||
set(CMAKE_WARN_DEPRECATED ${CMAKE_WARN_DEPRECATED_OLD_STATE} CACHE BOOL "" FORCE)
|
||||
if (Coin_FOUND)
|
||||
set(COIN3D_INCLUDE_DIRS ${Coin_INCLUDE_DIR})
|
||||
set(COIN3D_LIBRARIES ${Coin_LIBRARIES})
|
||||
set(COIN3D_LIB_DIRS ${Coin_LIB_DIR})
|
||||
else ()
|
||||
# Try MODULE mode (FindCoin3D.cmake, included by CMake)
|
||||
find_package(Coin3D)
|
||||
if (NOT COIN3D_FOUND)
|
||||
message(FATAL_ERROR "Could not find Coin3D")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
IF (NOT COIN3D_VERSION)
|
||||
file(READ "${COIN3D_INCLUDE_DIRS}/Inventor/C/basic.h" _coin3d_basic_h)
|
||||
string(REGEX MATCH "define[ \t]+COIN_MAJOR_VERSION[ \t]+([0-9?])" _coin3d_major_version_match "${_coin3d_basic_h}")
|
||||
set(COIN3D_MAJOR_VERSION "${CMAKE_MATCH_1}")
|
||||
string(REGEX MATCH "define[ \t]+COIN_MINOR_VERSION[ \t]+([0-9?])" _coin3d_minor_version_match "${_coin3d_basic_h}")
|
||||
set(COIN3D_MINOR_VERSION "${CMAKE_MATCH_1}")
|
||||
string(REGEX MATCH "define[ \t]+COIN_MICRO_VERSION[ \t]+([0-9?])" _coin3d_micro_version_match "${_coin3d_basic_h}")
|
||||
set(COIN3D_MICRO_VERSION "${CMAKE_MATCH_1}")
|
||||
set(COIN3D_VERSION "${COIN3D_MAJOR_VERSION}.${COIN3D_MINOR_VERSION}.${COIN3D_MICRO_VERSION}")
|
||||
ENDIF ()
|
||||
endmacro(SetupCoin3D)
|
||||
|
||||
macro(SetupPivy)
|
||||
# -------------------------------- Pivy --------------------------------
|
||||
|
||||
IF (FREECAD_CHECK_PIVY) # do not make pivy a host dependency for cross compiling
|
||||
IF (NOT PIVY_VERSION)
|
||||
message(STATUS "Checking Pivy version by importing it in a Python program...")
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "import pivy as p; print(p.__version__,end='')"
|
||||
OUTPUT_VARIABLE PIVY_VERSION
|
||||
RESULT_VARIABLE RETURN_CODE)
|
||||
if (RETURN_CODE EQUAL 0)
|
||||
message(STATUS "Found Pivy ${PIVY_VERSION}")
|
||||
else ()
|
||||
message(ERROR "Failed to import Pivy using ${Python3_EXECUTABLE}")
|
||||
endif ()
|
||||
ENDIF ()
|
||||
|
||||
message(STATUS "Checking Pivy Coin3D version by importing it in a Python program...")
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "import pivy as p; print(p.SoDB.getVersion(),end='')"
|
||||
OUTPUT_VARIABLE PIVY_COIN_VERSION
|
||||
RESULT_VARIABLE RETURN_CODE)
|
||||
if (RETURN_CODE EQUAL 0)
|
||||
message(STATUS "Found Pivy Coin3D ${PIVY_COIN_VERSION}")
|
||||
else ()
|
||||
message(ERROR "Failed to get Pivy Coin3D version using ${Python3_EXECUTABLE}")
|
||||
endif ()
|
||||
|
||||
if (${PIVY_COIN_VERSION} MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+)")
|
||||
set(PIVY_COIN_MAJOR_VERSION ${CMAKE_MATCH_1})
|
||||
set(PIVY_COIN_MINOR_VERSION ${CMAKE_MATCH_2})
|
||||
set(PIVY_COIN_MICRO_VERSION ${CMAKE_MATCH_3})
|
||||
set(PIVY_COIN_VERSION "${PIVY_COIN_MAJOR_VERSION}.${PIVY_COIN_MINOR_VERSION}.${PIVY_COIN_MICRO_VERSION}")
|
||||
else ()
|
||||
message(FATAL_ERROR "Failed to match Pivy Coin3D version string output")
|
||||
endif ()
|
||||
|
||||
if (NOT (
|
||||
(${COIN3D_MAJOR_VERSION} EQUAL ${PIVY_COIN_MAJOR_VERSION}) AND
|
||||
(${COIN3D_MINOR_VERSION} EQUAL ${PIVY_COIN_MINOR_VERSION}) AND
|
||||
(${COIN3D_MICRO_VERSION} EQUAL ${PIVY_COIN_MICRO_VERSION})))
|
||||
message(FATAL_ERROR "Coin3D version ${COIN3D_VERSION} mismatches Pivy Coin3D ${PIVY_COIN_VERSION}.")
|
||||
endif ()
|
||||
endif(FREECAD_CHECK_PIVY)
|
||||
endmacro(SetupPivy)
|
||||
12
cMake/FreeCAD_Helpers/SetupDoxygen.cmake
Normal file
12
cMake/FreeCAD_Helpers/SetupDoxygen.cmake
Normal file
@@ -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)
|
||||
20
cMake/FreeCAD_Helpers/SetupEigen.cmake
Normal file
20
cMake/FreeCAD_Helpers/SetupEigen.cmake
Normal file
@@ -0,0 +1,20 @@
|
||||
macro(SetupEigen)
|
||||
# -------------------------------- Eigen --------------------------------
|
||||
|
||||
# necessary for Sketcher module
|
||||
# necessary for Robot module
|
||||
|
||||
find_package(Eigen3)
|
||||
if(NOT EIGEN3_FOUND)
|
||||
message("=================\n"
|
||||
"Eigen3 not found.\n"
|
||||
"=================\n")
|
||||
endif(NOT EIGEN3_FOUND)
|
||||
|
||||
if (EIGEN3_FOUND AND ${EIGEN3_VERSION} VERSION_LESS "3.4.0")
|
||||
message(WARNING "Disable module flatmesh because it requires "
|
||||
"minimum Eigen3 version 3.4.0 but version ${EIGEN3_VERSION} was found")
|
||||
set (BUILD_FLAT_MESH OFF)
|
||||
endif()
|
||||
|
||||
endmacro(SetupEigen)
|
||||
29
cMake/FreeCAD_Helpers/SetupFreeType.cmake
Normal file
29
cMake/FreeCAD_Helpers/SetupFreeType.cmake
Normal file
@@ -0,0 +1,29 @@
|
||||
macro(SetupFreetype)
|
||||
#--------------------FreeType-----------------------
|
||||
|
||||
if(FREECAD_USE_FREETYPE)
|
||||
find_package(Freetype)
|
||||
if(NOT FREETYPE_FOUND)
|
||||
message("===============================================================\n"
|
||||
"FreeType2 not found. Part module will lack of makeWireString().\n"
|
||||
"===============================================================\n")
|
||||
else()
|
||||
# find_package(harfbuzz CONFIG) fails on windows
|
||||
# lets do it the complicated way instead.
|
||||
find_path(HARFBUZZ_INCLUDE_DIR hb.h PATH_SUFFIXES harfbuzz)
|
||||
find_library(HARFBUZZ_LIBRARY NAMES harfbuzz)
|
||||
if(HARFBUZZ_INCLUDE_DIR AND HARFBUZZ_LIBRARY)
|
||||
if(NOT TARGET harfbuzz::harfbuzz)
|
||||
add_library(harfbuzz::harfbuzz UNKNOWN IMPORTED)
|
||||
set_target_properties(harfbuzz::harfbuzz PROPERTIES
|
||||
IMPORTED_LOCATION "${HARFBUZZ_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${HARFBUZZ_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "HarfBuzz not found")
|
||||
endif()
|
||||
endif(NOT FREETYPE_FOUND)
|
||||
endif(FREECAD_USE_FREETYPE)
|
||||
|
||||
endmacro(SetupFreetype)
|
||||
7
cMake/FreeCAD_Helpers/SetupLark.cmake
Normal file
7
cMake/FreeCAD_Helpers/SetupLark.cmake
Normal file
@@ -0,0 +1,7 @@
|
||||
macro(SetupLark)
|
||||
# ------------------------------ Lark ------------------------------
|
||||
|
||||
find_package(LARK MODULE REQUIRED)
|
||||
message(STATUS "Found Lark: version ${LARK_VERSION}")
|
||||
|
||||
endmacro()
|
||||
48
cMake/FreeCAD_Helpers/SetupLibFmt.cmake
Normal file
48
cMake/FreeCAD_Helpers/SetupLibFmt.cmake
Normal file
@@ -0,0 +1,48 @@
|
||||
macro(SetupLibFmt)
|
||||
|
||||
# This internet check idea is borrowed from:
|
||||
# https://stackoverflow.com/questions/62214621/how-to-check-for-internet-connection-with-cmake-automatically-prevent-fails-if
|
||||
|
||||
if(FREECAD_USE_EXTERNAL_FMT)
|
||||
find_package(fmt QUIET)
|
||||
endif()
|
||||
|
||||
if(fmt_FOUND)
|
||||
message(STATUS "find_package() was used to locate fmt version ${fmt_VERSION}")
|
||||
else()
|
||||
|
||||
message(STATUS "Checking for connection to GitHub...")
|
||||
if (WIN32)
|
||||
set(ping_command "ping /n 1 /w 3 github.com")
|
||||
else()
|
||||
set(ping_command "ping -c 1 -W 3 github.com")
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND ${ping_command}
|
||||
RESULT_VARIABLE NO_CONNECTION
|
||||
)
|
||||
if(NO_CONNECTION GREATER 0)
|
||||
set(FETCHCONTENT_UPDATES_DISCONNECTED ON)
|
||||
message(WARNING "NO INTERNET CONNECTION: Using disconnected mode for FetchContent updates")
|
||||
else()
|
||||
message(STATUS "GitHub connection established for FetchContent")
|
||||
set(FETCHCONTENT_UPDATES_DISCONNECTED OFF)
|
||||
endif()
|
||||
|
||||
include(FetchContent)
|
||||
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.24.0")
|
||||
cmake_policy(SET CMP0135 NEW)
|
||||
endif()
|
||||
FetchContent_Declare(fmt
|
||||
URL https://github.com/fmtlib/fmt/archive/refs/tags/11.1.4.zip
|
||||
URL_MD5 90667b07f34d91554cf8285ae234ff66
|
||||
)
|
||||
FetchContent_MakeAvailable(fmt)
|
||||
set_target_properties(fmt PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
if(${fmt_POPULATED})
|
||||
message(STATUS "fmt was downloaded using FetchContent into ${fmt_SOURCE_DIR}")
|
||||
else()
|
||||
message(ERROR "Failed to install the fmt library")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
4
cMake/FreeCAD_Helpers/SetupLibOndselSolver.cmake
Normal file
4
cMake/FreeCAD_Helpers/SetupLibOndselSolver.cmake
Normal file
@@ -0,0 +1,4 @@
|
||||
macro(SetupOndselSolverCpp)
|
||||
# -------------------------------- OndselSolver --------------------------------
|
||||
find_package(OndselSolver REQUIRED)
|
||||
endmacro(SetupOndselSolverCpp)
|
||||
4
cMake/FreeCAD_Helpers/SetupLibYaml.cmake
Normal file
4
cMake/FreeCAD_Helpers/SetupLibYaml.cmake
Normal file
@@ -0,0 +1,4 @@
|
||||
macro(SetupYamlCpp)
|
||||
# -------------------------------- YamlCpp --------------------------------
|
||||
find_package(yaml-cpp REQUIRED)
|
||||
endmacro(SetupYamlCpp)
|
||||
13
cMake/FreeCAD_Helpers/SetupMatplotlib.cmake
Normal file
13
cMake/FreeCAD_Helpers/SetupMatplotlib.cmake
Normal file
@@ -0,0 +1,13 @@
|
||||
macro(SetupMatplotlib)
|
||||
# ------------------------------ Matplotlib ------------------------------
|
||||
|
||||
find_package(Matplotlib)
|
||||
if (MATPLOTLIB_FOUND)
|
||||
message(STATUS "Found Matplotlib: ${MATPLOTLIB_PATH_DIRS} (found version \"${MATPLOTLIB_VERSION}\")")
|
||||
else(MATPLOTLIB_FOUND)
|
||||
message("=====================================================\n"
|
||||
"Matplotlib not found, Plot module won't be available.\n"
|
||||
"=====================================================\n")
|
||||
endif(MATPLOTLIB_FOUND)
|
||||
|
||||
endmacro(SetupMatplotlib)
|
||||
8
cMake/FreeCAD_Helpers/SetupOpenCasCade.cmake
Normal file
8
cMake/FreeCAD_Helpers/SetupOpenCasCade.cmake
Normal file
@@ -0,0 +1,8 @@
|
||||
macro(SetupOpenCasCade)
|
||||
find_package(OCC)
|
||||
if(NOT OCC_FOUND)
|
||||
message(FATAL_ERROR "================================================================\n"
|
||||
"OpenCASCADE not found!\n"
|
||||
"================================================================\n")
|
||||
endif()
|
||||
endmacro()
|
||||
21
cMake/FreeCAD_Helpers/SetupOpenGL.cmake
Normal file
21
cMake/FreeCAD_Helpers/SetupOpenGL.cmake
Normal file
@@ -0,0 +1,21 @@
|
||||
macro(SetupOpenGL)
|
||||
# -------------------------------- OpenGL --------------------------------
|
||||
|
||||
# If on a system with both a legacy GL library and GLVND, prefer the legacy library.
|
||||
# This is probably needed until we no longer have any gl.*ARB calls in the codebase
|
||||
# See, e.g. SoBrepFaceSet.cpp
|
||||
set(OpenGL_GL_PREFERENCE LEGACY)
|
||||
|
||||
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)
|
||||
14
cMake/FreeCAD_Helpers/SetupPCL.cmake
Normal file
14
cMake/FreeCAD_Helpers/SetupPCL.cmake
Normal file
@@ -0,0 +1,14 @@
|
||||
macro(SetupPCL)
|
||||
# -------------------------------- pcl ----------------------------------
|
||||
|
||||
# Can be used by ReverseEngineering module"
|
||||
#
|
||||
# PCL needs to be found before boost because the PCLConfig also calls find_package(Boost ...),
|
||||
# but with different components
|
||||
if(FREECAD_USE_PCL)
|
||||
# pcl overrides the compiler flags by adding -Wno-deprecated
|
||||
set (SAVE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
find_package(PCL REQUIRED COMPONENTS common kdtree features surface io filters segmentation sample_consensus)
|
||||
set (CMAKE_CXX_FLAGS ${SAVE_CXX_FLAGS})
|
||||
endif(FREECAD_USE_PCL)
|
||||
endmacro(SetupPCL)
|
||||
9
cMake/FreeCAD_Helpers/SetupPybind11.cmake
Normal file
9
cMake/FreeCAD_Helpers/SetupPybind11.cmake
Normal file
@@ -0,0 +1,9 @@
|
||||
macro(SetupPybind11)
|
||||
# -------------------------------- PyBind11 -----------------------------
|
||||
|
||||
# necessary for flat-mesh feature
|
||||
if (FREECAD_USE_PYBIND11)
|
||||
find_package(pybind11 REQUIRED)
|
||||
endif()
|
||||
|
||||
endmacro(SetupPybind11)
|
||||
22
cMake/FreeCAD_Helpers/SetupPython.cmake
Normal file
22
cMake/FreeCAD_Helpers/SetupPython.cmake
Normal file
@@ -0,0 +1,22 @@
|
||||
macro(SetupPython)
|
||||
# -------------------------------- Python --------------------------------
|
||||
|
||||
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
|
||||
|
||||
if (${Python3_VERSION} VERSION_LESS "3.10")
|
||||
message(FATAL_ERROR "To build FreeCAD you need at least Python 3.10\n")
|
||||
endif()
|
||||
|
||||
# For backwards compatibility with old CMake scripts
|
||||
# See: https://github.com/FreeCAD/FreeCAD/pull/19635#issuecomment-2725612407
|
||||
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})
|
||||
|
||||
endmacro(SetupPython)
|
||||
142
cMake/FreeCAD_Helpers/SetupQt.cmake
Normal file
142
cMake/FreeCAD_Helpers/SetupQt.cmake
Normal file
@@ -0,0 +1,142 @@
|
||||
# -------------------------------- Qt --------------------------------
|
||||
|
||||
set(FREECAD_QT_COMPONENTS Core Concurrent Network Xml)
|
||||
if(FREECAD_WEB)
|
||||
# QtConcurrent is only used by GUI code in the current Web module graph.
|
||||
set(FREECAD_QT_COMPONENTS Core Network Xml)
|
||||
endif()
|
||||
if (FREECAD_QT_MAJOR_VERSION EQUAL 6)
|
||||
set (Qt6Core_MOC_EXECUTABLE Qt6::moc)
|
||||
endif()
|
||||
|
||||
if(BUILD_GUI)
|
||||
if (FREECAD_QT_MAJOR_VERSION EQUAL 5)
|
||||
if (WIN32)
|
||||
list (APPEND FREECAD_QT_COMPONENTS WinExtras)
|
||||
endif()
|
||||
elseif (FREECAD_QT_MAJOR_VERSION EQUAL 6)
|
||||
list (APPEND FREECAD_QT_COMPONENTS GuiTools)
|
||||
list (APPEND FREECAD_QT_COMPONENTS SvgWidgets)
|
||||
list (APPEND FREECAD_QT_COMPONENTS OpenGLWidgets)
|
||||
endif()
|
||||
|
||||
list (APPEND FREECAD_QT_COMPONENTS OpenGL PrintSupport Svg UiTools Widgets LinguistTools)
|
||||
|
||||
if(BUILD_DESIGNER_PLUGIN)
|
||||
list (APPEND FREECAD_QT_COMPONENTS Designer)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (ENABLE_DEVELOPER_TESTS)
|
||||
list (APPEND FREECAD_QT_COMPONENTS Test)
|
||||
endif ()
|
||||
|
||||
foreach(COMPONENT IN LISTS FREECAD_QT_COMPONENTS)
|
||||
find_package(Qt${FREECAD_QT_MAJOR_VERSION} REQUIRED COMPONENTS ${COMPONENT})
|
||||
set(Qt${COMPONENT}_LIBRARIES ${Qt${FREECAD_QT_MAJOR_VERSION}${COMPONENT}_LIBRARIES})
|
||||
set(Qt${COMPONENT}_INCLUDE_DIRS ${Qt${FREECAD_QT_MAJOR_VERSION}${COMPONENT}_INCLUDE_DIRS})
|
||||
set(Qt${COMPONENT}_FOUND ${Qt${FREECAD_QT_MAJOR_VERSION}${COMPONENT}_FOUND})
|
||||
set(Qt${COMPONENT}_VERSION ${Qt${FREECAD_QT_MAJOR_VERSION}${COMPONENT}_VERSION})
|
||||
endforeach()
|
||||
|
||||
# QtBase does not ship the LinguistTools CMake module. The Web dependency
|
||||
# prefix intentionally builds only QtBase, so provide the small part of
|
||||
# qt_add_translation needed by core resource generation using host lrelease.
|
||||
if(FREECAD_WEB AND NOT COMMAND qt_add_translation)
|
||||
find_program(FREECAD_WEB_LRELEASE_EXECUTABLE NAMES lrelease lrelease-qt5)
|
||||
if(NOT FREECAD_WEB_LRELEASE_EXECUTABLE)
|
||||
message(FATAL_ERROR "FREECAD_WEB requires a host lrelease executable to build translations")
|
||||
endif()
|
||||
function(qt_add_translation _qm_files)
|
||||
set(_generated_qm_files)
|
||||
foreach(_ts_file IN LISTS ARGN)
|
||||
get_filename_component(_ts_name "${_ts_file}" NAME_WE)
|
||||
get_source_file_property(_output_location "${_ts_file}" OUTPUT_LOCATION)
|
||||
if(NOT _output_location OR _output_location STREQUAL "NOTFOUND")
|
||||
set(_output_location "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
endif()
|
||||
set(_qm_file "${_output_location}/${_ts_name}.qm")
|
||||
add_custom_command(
|
||||
OUTPUT "${_qm_file}"
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${_output_location}"
|
||||
COMMAND "${FREECAD_WEB_LRELEASE_EXECUTABLE}" "${_ts_file}" -qm "${_qm_file}"
|
||||
DEPENDS "${_ts_file}"
|
||||
VERBATIM)
|
||||
list(APPEND _generated_qm_files "${_qm_file}")
|
||||
endforeach()
|
||||
set(${_qm_files} "${_generated_qm_files}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
endif()
|
||||
|
||||
set(CMAKE_AUTOMOC TRUE)
|
||||
set(CMAKE_AUTOUIC TRUE)
|
||||
set(QtCore_MOC_EXECUTABLE ${Qt${FREECAD_QT_MAJOR_VERSION}Core_MOC_EXECUTABLE})
|
||||
|
||||
add_definitions(-DQT_NO_KEYWORDS)
|
||||
|
||||
message(STATUS "Set up to compile with Qt ${Qt${FREECAD_QT_MAJOR_VERSION}Core_VERSION}")
|
||||
|
||||
# In Qt 5.15 they added more generic names for these functions: "backport" those new names
|
||||
# so we can migrate to using the non-version-named functions in all instances.
|
||||
if (Qt${FREECAD_QT_MAJOR_VERSION}Core_VERSION VERSION_LESS 5.15.0)
|
||||
message(STATUS "Manually creating qt_wrap_cpp() and qt_add_resources() to support Qt ${Qt${FREECAD_QT_MAJOR_VERSION}Core_VERSION}")
|
||||
|
||||
# Wrapper code adapted from Qt 6's Qt6CoreMacros.cmake file:
|
||||
function(qt_add_resources outfiles)
|
||||
qt5_add_resources("${outfiles}" ${ARGN})
|
||||
if(TARGET ${outfiles})
|
||||
cmake_parse_arguments(PARSE_ARGV 1 arg "" "OUTPUT_TARGETS" "")
|
||||
if (arg_OUTPUT_TARGETS)
|
||||
set(${arg_OUTPUT_TARGETS} ${${arg_OUTPUT_TARGETS}} PARENT_SCOPE)
|
||||
endif()
|
||||
else()
|
||||
set("${outfiles}" "${${outfiles}}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(qt_wrap_cpp outfiles)
|
||||
qt5_wrap_cpp("${outfiles}" ${ARGN})
|
||||
set("${outfiles}" "${${outfiles}}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(qt_add_translation _qm_files)
|
||||
qt5_add_translation("${_qm_files}" ${ARGN})
|
||||
set("${_qm_files}" "${${_qm_files}}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Since Qt 5.15 Q_DISABLE_COPY_MOVE is defined
|
||||
set (HAVE_Q_DISABLE_COPY_MOVE 0)
|
||||
else()
|
||||
# Since Qt 5.15 Q_DISABLE_COPY_MOVE is defined
|
||||
set (HAVE_Q_DISABLE_COPY_MOVE 1)
|
||||
endif()
|
||||
|
||||
configure_file(${CMAKE_SOURCE_DIR}/src/QtCore.h.cmake ${CMAKE_BINARY_DIR}/src/QtCore.h)
|
||||
configure_file(${CMAKE_SOURCE_DIR}/src/QtWidgets.h.cmake ${CMAKE_BINARY_DIR}/src/QtWidgets.h)
|
||||
|
||||
function(qt_find_and_add_translation _qm_files _tr_dir _qm_dir)
|
||||
file(GLOB _ts_files ${_tr_dir})
|
||||
set_source_files_properties(${_ts_files} PROPERTIES OUTPUT_LOCATION ${_qm_dir})
|
||||
qt_add_translation("${_qm_files}" ${_ts_files})
|
||||
set("${_qm_files}" "${${_qm_files}}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(qt_create_resource_file outfile)
|
||||
set(QRC "<RCC>\n <qresource>\n")
|
||||
foreach (it ${ARGN})
|
||||
get_filename_component(qmfile "${it}" NAME)
|
||||
string(APPEND QRC " <file>translations/${qmfile}</file>")
|
||||
endforeach()
|
||||
string(APPEND QRC " </qresource>\n</RCC>\n")
|
||||
file(WRITE ${outfile} ${QRC})
|
||||
endfunction()
|
||||
|
||||
function(qt_create_resource_file_prefix outfile)
|
||||
set(QRC "<RCC>\n <qresource prefix=\"/translations\">\n")
|
||||
foreach (it ${ARGN})
|
||||
get_filename_component(qmfile "${it}" NAME)
|
||||
string(APPEND QRC " <file>${qmfile}</file>")
|
||||
endforeach()
|
||||
string(APPEND QRC " </qresource>\n</RCC>\n")
|
||||
file(WRITE ${outfile} ${QRC})
|
||||
endfunction()
|
||||
170
cMake/FreeCAD_Helpers/SetupSalomeSMESH.cmake
Normal file
170
cMake/FreeCAD_Helpers/SetupSalomeSMESH.cmake
Normal file
@@ -0,0 +1,170 @@
|
||||
macro(SetupSalomeSMESH)
|
||||
# -------------------------------- Salome SMESH --------------------------
|
||||
# Salome SMESH sources are under src/3rdParty now
|
||||
if(FREECAD_USE_SMESH)
|
||||
|
||||
# set the internal smesh version:
|
||||
# see src/3rdParty/salomonemesh/CMakeLists.txt and commit https://github.com/FreeCAD/FreeCAD/commit/666a3e5 and https://forum.freecad.org/viewtopic.php?f=10&t=30838
|
||||
set(SMESH_VERSION_MAJOR 7)
|
||||
set(SMESH_VERSION_MINOR 7)
|
||||
set(SMESH_VERSION_PATCH 1)
|
||||
set(SMESH_VERSION_TWEAK 0)
|
||||
|
||||
#if we use smesh we definitely also need vtk, no matter of external or internal smesh
|
||||
set (VTK_COMPONENTS
|
||||
vtkCommonCore
|
||||
vtkCommonDataModel
|
||||
vtkFiltersVerdict
|
||||
vtkIOXML
|
||||
vtkFiltersCore
|
||||
vtkFiltersGeneral
|
||||
vtkIOLegacy
|
||||
vtkFiltersExtraction
|
||||
vtkFiltersSources
|
||||
vtkFiltersGeometry
|
||||
)
|
||||
|
||||
# check which modules are available
|
||||
if(UNIX OR WIN32)
|
||||
# Module names changed between 8 and 9, so do a QUIET find for 9 and its module name first, and fall back
|
||||
# to v7 minimum with the old component name if it is not found.
|
||||
find_package(VTK 9 COMPONENTS CommonCore QUIET NO_MODULE)
|
||||
if(NOT VTK_FOUND)
|
||||
message(STATUS "Did not find VTK 9, trying for an older version")
|
||||
find_package(VTK COMPONENTS vtkCommonCore REQUIRED NO_MODULE)
|
||||
endif()
|
||||
if(${VTK_MAJOR_VERSION} LESS 9)
|
||||
list(APPEND VTK_COMPONENTS vtkIOMPIParallel vtkParallelMPI vtkhdf5 vtkFiltersParallelDIY2 vtkRenderingCore vtkInteractionStyle vtkRenderingFreeType vtkRenderingOpenGL2)
|
||||
foreach(_module ${VTK_COMPONENTS})
|
||||
list (FIND VTK_MODULES_ENABLED ${_module} _index)
|
||||
if(${_index} GREATER -1)
|
||||
list(APPEND AVAILABLE_VTK_COMPONENTS ${_module})
|
||||
endif()
|
||||
endforeach()
|
||||
else()
|
||||
set(VTK_COMPONENTS "CommonCore;CommonDataModel;FiltersVerdict;IOXML;FiltersCore;FiltersGeneral;IOLegacy;FiltersExtraction;FiltersSources;FiltersGeometry;WrappingPythonCore")
|
||||
list(APPEND VTK_COMPONENTS "IOMPIParallel;ParallelMPI;hdf5;FiltersParallelDIY2;RenderingCore;InteractionStyle;RenderingFreeType;RenderingOpenGL2")
|
||||
foreach(_module ${VTK_COMPONENTS})
|
||||
list (FIND VTK_AVAILABLE_COMPONENTS ${_module} _index)
|
||||
if(${_index} GREATER -1)
|
||||
list(APPEND AVAILABLE_VTK_COMPONENTS ${_module})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# don't check VERSION 6 as this would exclude VERSION 7
|
||||
if(AVAILABLE_VTK_COMPONENTS)
|
||||
message(STATUS "VTK components: ${AVAILABLE_VTK_COMPONENTS}")
|
||||
find_package(VTK COMPONENTS ${AVAILABLE_VTK_COMPONENTS} REQUIRED NO_MODULE)
|
||||
else()
|
||||
message(STATUS "VTK components: not found or used")
|
||||
find_package(VTK REQUIRED NO_MODULE)
|
||||
endif()
|
||||
|
||||
set(BUILD_FEM_VTK ON)
|
||||
|
||||
# Check if PythonWrapperCore was found
|
||||
# Note: VTK 9 only, as the implementations use the VTK modules introduced in 8.1
|
||||
# VTK_WrappingPythonCore_FOUND is named differently for versions <9.0
|
||||
if (${VTK_WrappingPythonCore_FOUND})
|
||||
set(BUILD_FEM_VTK_PYTHON 1)
|
||||
message(STATUS "VTK python wrapper: available")
|
||||
else()
|
||||
message(STATUS "VTK python wrapper: NOT available")
|
||||
endif()
|
||||
|
||||
if(${VTK_MAJOR_VERSION} LESS 6)
|
||||
message( FATAL_ERROR "Found VTK version is <6, this is not compatible" )
|
||||
endif()
|
||||
if(${VTK_MAJOR_VERSION} EQUAL 6)
|
||||
if(${VTK_MINOR_VERSION} LESS 2)
|
||||
set(VTK_OPTIONS -DVTK_NO_QUAD_POLY)
|
||||
endif()
|
||||
if(${VTK_MINOR_VERSION} EQUAL 0)
|
||||
message(WARNING "VTK equal to 6.0 cannot be used with c++11, FEM postprocessing is disabled")
|
||||
set(BUILD_FEM_VTK OFF)
|
||||
endif()
|
||||
endif()
|
||||
# on openSUSE 13.1 VTK_LIBRARIES ends with "optimized" keyword
|
||||
list(REMOVE_ITEM VTK_LIBRARIES "optimized" "debug")
|
||||
|
||||
if(NOT FREECAD_USE_EXTERNAL_SMESH)
|
||||
find_package(MEDFile REQUIRED)
|
||||
# See https://www.hdfgroup.org/HDF5/release/cmakebuild.html
|
||||
if (MSVC)
|
||||
find_package(HDF5 COMPONENTS NO_MODULE REQUIRED static)
|
||||
else()
|
||||
find_package(PkgConfig)
|
||||
file(READ ${meddotH} TMPTXT)
|
||||
string(FIND "${TMPTXT}" "#define MED_HAVE_MPI" matchres)
|
||||
if(${matchres} EQUAL -1)
|
||||
message(STATUS "We guess that libmed was built using hdf5-serial version")
|
||||
set(HDF5_VARIANT "hdf5-serial")
|
||||
else()
|
||||
message(STATUS "We guess that libmed was built using hdf5-openmpi version")
|
||||
set(HDF5_VARIANT "hdf5-openmpi;hdf5_openmpi")
|
||||
set(HDF5_PREFER_PARALLEL TRUE) # if pkg-config fails, find_package(HDF5) needs this
|
||||
endif()
|
||||
pkg_search_module(PCHDF5 ${HDF5_VARIANT})
|
||||
if(NOT PCHDF5_FOUND)
|
||||
find_package(HDF5 REQUIRED)
|
||||
else()
|
||||
add_compile_options(${PCHDF5_CFLAGS})
|
||||
link_directories(${PCHDF5_LIBRARY_DIRS})
|
||||
link_libraries(${PCHDF5_LIBRARIES})
|
||||
|
||||
# workaround to define include dir from PCHDF5_CFLAGS (pkg-config PCHDF5_INCLUDEDIR is only filled since hdf5 1.14.6)
|
||||
set(hdf5_include_path "")
|
||||
foreach(flag IN LISTS PCHDF5_CFLAGS)
|
||||
if(flag MATCHES "^-I")
|
||||
string(REGEX REPLACE "^-I[ ]*" "" flag "${flag}")
|
||||
list(APPEND hdf5_include_path "${flag}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(_save_INC CMAKE_REQUIRED_INCLUDES)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${hdf5_include_path})
|
||||
check_include_file_cxx(hdf5.h HDF5_HEAD_FOUND)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${_save_INC})
|
||||
if(NOT HDF5_HEAD_FOUND)
|
||||
message( FATAL_ERROR "hdf5.h was not found (tested pkg-config ${HDF5_VARIANT}, suggested header location was '${hdf5_include_path}').")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Med Fichier can require MPI
|
||||
pkg_search_module(OPENMPI ompi-cxx)
|
||||
add_compile_options(${OPENMPI_CFLAGS})
|
||||
link_directories(${OPENMPI_LIBRARY_DIRS})
|
||||
link_libraries(${OPENMPI_LIBRARIES})
|
||||
if(NOT OPENMPI_FOUND)
|
||||
message( WARNING "ompi-cxx was not found. Check for error above.")
|
||||
endif()
|
||||
endif()
|
||||
set(SMESH_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/3rdParty/salomesmesh/inc)
|
||||
|
||||
else(NOT FREECAD_USE_EXTERNAL_SMESH)
|
||||
find_package(SMESH CONFIG)
|
||||
# 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(NOT SMESH_FOUND)
|
||||
find_package(SMESH REQUIRED)
|
||||
if(NOT SMESH_FOUND)
|
||||
message(ERROR "================\n"
|
||||
"SMESH not found.\n"
|
||||
"================\n")
|
||||
endif()
|
||||
endif()
|
||||
set (SMESH_INCLUDE_DIR ${SMESH_INCLUDE_PATH})
|
||||
set(EXTERNAL_SMESH_LIBS ${SMESH_LIBRARIES})
|
||||
|
||||
include_directories(${SMESH_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
set(SMESH_FOUND TRUE)
|
||||
configure_file(${CMAKE_SOURCE_DIR}/src/SMESH_Version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/SMESH_Version.h)
|
||||
endif(FREECAD_USE_SMESH)
|
||||
|
||||
endmacro(SetupSalomeSMESH)
|
||||
109
cMake/FreeCAD_Helpers/SetupSanitizers.cmake
Normal file
109
cMake/FreeCAD_Helpers/SetupSanitizers.cmake
Normal file
@@ -0,0 +1,109 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
# SPDX-FileNotice: Part of the FreeCAD project.
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# Copyright (c) 2026 Chris Jones github.com/ipatch *
|
||||
# *
|
||||
# This file is part of the FreeCAD CAx development system. *
|
||||
# *
|
||||
# This program is free software; you can redistribute it and/or modify *
|
||||
# it under the terms of the GNU Library General Public License (LGPL) *
|
||||
# as published by the Free Software Foundation; either version 2 of *
|
||||
# the License, or (at your option) any later version. *
|
||||
# for detail see the LICENCE text file. *
|
||||
# *
|
||||
# FreeCAD 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 Library General Public License for more details. *
|
||||
# *
|
||||
# You should have received a copy of the GNU Library General Public *
|
||||
# License along with FreeCAD; if not, write to the Free Software *
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# USA *
|
||||
# *
|
||||
#--------------------------------------------------------------------------
|
||||
|
||||
# NOTE: referencing my copy of professional cmake (book) i see the below list of available sanitizers
|
||||
# 1. AddressSanitizer (ASan) *only supported by Visual Studio
|
||||
# 2. LeakSanitizer (LSan) *can't be used with (MSan) (TSan)
|
||||
# 3. MemorySanitizer (MSan)
|
||||
# 4. ThreadSanitizer (TSan)
|
||||
# 5. UndefinedBehaviorSanitizer (UBSan) *can be used with all
|
||||
|
||||
include(CheckCCompilerFlag)
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
macro(_check_sanitizer_flag flag result)
|
||||
set(CMAKE_REQUIRED_LINK_OPTIONS ${flag})
|
||||
check_c_compiler_flag(${flag} ${result})
|
||||
unset(CMAKE_REQUIRED_LINK_OPTIONS)
|
||||
if(NOT ${result})
|
||||
message(FATAL_ERROR "Compiler does not support ${flag}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(SetupSanitizers)
|
||||
if(MSVC)
|
||||
if(FREECAD_USE_SANITIZER_ASAN)
|
||||
message(STATUS "Building with AddressSanitizer (ASan)")
|
||||
string(REPLACE "/RTC1" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
|
||||
string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
add_compile_options(/fsanitize=address /fsanitize-address-use-after-return)
|
||||
endif()
|
||||
else()
|
||||
# Validate incompatible sanitizer combinations
|
||||
if(FREECAD_USE_SANITIZER_ASAN AND (FREECAD_USE_SANITIZER_MSAN OR FREECAD_USE_SANITIZER_TSAN))
|
||||
message(FATAL_ERROR "ASan cannot be used with MSan or TSan")
|
||||
endif()
|
||||
# LSan is incompatible with MSan and TSan
|
||||
if(FREECAD_USE_SANITIZER_LSAN AND (FREECAD_USE_SANITIZER_MSAN OR FREECAD_USE_SANITIZER_TSAN))
|
||||
message(FATAL_ERROR "LSan cannot be used with MSan or TSan")
|
||||
endif()
|
||||
if(FREECAD_USE_SANITIZER_TSAN AND FREECAD_USE_SANITIZER_MSAN)
|
||||
message(FATAL_ERROR "TSan and MSan cannot be used together")
|
||||
endif()
|
||||
|
||||
|
||||
# Verify compiler supports requested sanitizers
|
||||
if(FREECAD_USE_SANITIZER_ASAN)
|
||||
_check_sanitizer_flag(-fsanitize=address _asan_supported)
|
||||
endif()
|
||||
if(FREECAD_USE_SANITIZER_LSAN)
|
||||
_check_sanitizer_flag(-fsanitize=leak _lsan_supported)
|
||||
endif()
|
||||
if(FREECAD_USE_SANITIZER_MSAN)
|
||||
_check_sanitizer_flag(-fsanitize=memory _msan_supported)
|
||||
endif()
|
||||
if(FREECAD_USE_SANITIZER_TSAN)
|
||||
_check_sanitizer_flag(-fsanitize=thread _tsan_supported)
|
||||
endif()
|
||||
if(FREECAD_USE_SANITIZER_UBSAN)
|
||||
_check_sanitizer_flag(-fsanitize=undefined _ubsan_supported)
|
||||
endif()
|
||||
|
||||
set(_has_sanitizer FALSE)
|
||||
if(FREECAD_USE_SANITIZER_ASAN OR FREECAD_USE_SANITIZER_LSAN OR FREECAD_USE_SANITIZER_TSAN
|
||||
OR FREECAD_USE_SANITIZER_UBSAN OR FREECAD_USE_SANITIZER_MSAN)
|
||||
set(_has_sanitizer TRUE)
|
||||
endif()
|
||||
|
||||
|
||||
if(_has_sanitizer)
|
||||
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug|RelWithDebInfo")
|
||||
message(WARNING "Sanitizers work best with Debug or RelWithDebInfo builds")
|
||||
endif()
|
||||
|
||||
set(_sanitizer_flags
|
||||
$<$<BOOL:${FREECAD_USE_SANITIZER_ASAN}>:-fsanitize=address>
|
||||
$<$<BOOL:${FREECAD_USE_SANITIZER_LSAN}>:-fsanitize=leak>
|
||||
$<$<BOOL:${FREECAD_USE_SANITIZER_MSAN}>:-fsanitize=memory>
|
||||
$<$<BOOL:${FREECAD_USE_SANITIZER_TSAN}>:-fsanitize=thread>
|
||||
$<$<BOOL:${FREECAD_USE_SANITIZER_UBSAN}>:-fsanitize=undefined>
|
||||
)
|
||||
|
||||
add_compile_options(-fno-omit-frame-pointer ${_sanitizer_flags})
|
||||
add_link_options(${_sanitizer_flags})
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
211
cMake/FreeCAD_Helpers/SetupShibokenAndPyside.cmake
Normal file
211
cMake/FreeCAD_Helpers/SetupShibokenAndPyside.cmake
Normal file
@@ -0,0 +1,211 @@
|
||||
macro(SetupShibokenAndPyside)
|
||||
# -------------------------------- Shiboken/PySide ------------------------
|
||||
|
||||
option(FREECAD_USE_SHIBOKEN "Links to the shiboken library at build time. If OFF its Python module is imported at runtime" ON)
|
||||
option(FREECAD_USE_PYSIDE "Links to the PySide libraries at build time." ON)
|
||||
|
||||
if(DEFINED MACPORTS_PREFIX)
|
||||
find_package(Shiboken REQUIRED HINTS "${PYTHON_LIBRARY_DIR}/cmake")
|
||||
find_package(PySide REQUIRED HINTS "${PYTHON_LIBRARY_DIR}/cmake")
|
||||
endif()
|
||||
|
||||
if(FREECAD_QT_MAJOR_VERSION EQUAL 5)
|
||||
set(SHIBOKEN_MAJOR_VERSION 2)
|
||||
set(PYSIDE_MAJOR_VERSION 2)
|
||||
else()
|
||||
set(SHIBOKEN_MAJOR_VERSION ${FREECAD_QT_MAJOR_VERSION})
|
||||
set(PYSIDE_MAJOR_VERSION ${FREECAD_QT_MAJOR_VERSION})
|
||||
endif()
|
||||
|
||||
|
||||
# Shiboken2Config.cmake may explicitly set CMAKE_BUILD_TYPE to Release which causes
|
||||
# CMake to fail to create Makefiles for a debug build.
|
||||
# So as a workaround we save and restore the value after checking for Shiboken2.
|
||||
set(SAVE_BUILD_TYPE ${CMAKE_BUILD_TYPE})
|
||||
find_package(Shiboken${SHIBOKEN_MAJOR_VERSION} QUIET)
|
||||
set(CMAKE_BUILD_TYPE ${SAVE_BUILD_TYPE})
|
||||
if(Shiboken${SHIBOKEN_MAJOR_VERSION}_FOUND)
|
||||
# Shiboken config file was found but it may use the wrong Python version
|
||||
# Try to get the matching config suffix and repeat finding the package
|
||||
set(SHIBOKEN_PATTERN .cpython-${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR})
|
||||
|
||||
file(GLOB SHIBOKEN_CONFIG "${Shiboken${SHIBOKEN_MAJOR_VERSION}_DIR}/Shiboken${SHIBOKEN_MAJOR_VERSION}Config${SHIBOKEN_PATTERN}*.cmake")
|
||||
if(SHIBOKEN_CONFIG)
|
||||
get_filename_component(SHIBOKEN_CONFIG_SUFFIX ${SHIBOKEN_CONFIG} NAME)
|
||||
string(SUBSTRING ${SHIBOKEN_CONFIG_SUFFIX} 15 -1 SHIBOKEN_CONFIG_SUFFIX)
|
||||
string(REPLACE ".cmake" "" PYTHON_CONFIG_SUFFIX ${SHIBOKEN_CONFIG_SUFFIX})
|
||||
message(STATUS "PYTHON_CONFIG_SUFFIX: ${PYTHON_CONFIG_SUFFIX}")
|
||||
find_package(Shiboken${SHIBOKEN_MAJOR_VERSION} QUIET)
|
||||
endif()
|
||||
|
||||
if(TARGET Shiboken6::libshiboken AND SHIBOKEN_MAJOR_VERSION EQUAL 6)
|
||||
set_target_properties(Shiboken6::libshiboken PROPERTIES INTERFACE_COMPILE_DEFINITIONS "NDEBUG")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# pyside2 changed its cmake files, this is the dance we have
|
||||
# to dance to be compatible with the old (<5.12) and the new versions (>=5.12)
|
||||
if(NOT SHIBOKEN_INCLUDE_DIR AND TARGET Shiboken${SHIBOKEN_MAJOR_VERSION}::libshiboken)
|
||||
get_property(SHIBOKEN_INCLUDE_DIR TARGET Shiboken${SHIBOKEN_MAJOR_VERSION}::libshiboken PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
|
||||
endif()
|
||||
|
||||
if(NOT SHIBOKEN_INCLUDE_DIR)
|
||||
find_pip_package(Shiboken${SHIBOKEN_MAJOR_VERSION})
|
||||
if(Shiboken${SHIBOKEN_MAJOR_VERSION}_FOUND)
|
||||
set(SHIBOKEN_INCLUDE_DIR ${Shiboken${SHIBOKEN_MAJOR_VERSION}_INCLUDE_DIRS})
|
||||
set(SHIBOKEN_LIBRARY ${Shiboken${SHIBOKEN_MAJOR_VERSION}_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(PySide${PYSIDE_MAJOR_VERSION} QUIET)
|
||||
|
||||
if(${PYSIDE_MAJOR_VERSION} EQUAL 2)
|
||||
# Our internal FindPySide6.cmake file already provides these for PySide6
|
||||
if(NOT PYSIDE_INCLUDE_DIR AND TARGET PySide${PYSIDE_MAJOR_VERSION}::pyside${PYSIDE_MAJOR_VERSION})
|
||||
get_property(PYSIDE_INCLUDE_DIR TARGET PySide${PYSIDE_MAJOR_VERSION}::pyside${PYSIDE_MAJOR_VERSION} PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
|
||||
endif()
|
||||
|
||||
if(NOT PYSIDE_INCLUDE_DIR)
|
||||
find_pip_package(PySide${PYSIDE_MAJOR_VERSION})
|
||||
if(PySide${PYSIDE_MAJOR_VERSION}_FOUND)
|
||||
set(PYSIDE_INCLUDE_DIR ${PySide${PYSIDE_MAJOR_VERSION}_INCLUDE_DIRS})
|
||||
set(PYSIDE_LIBRARY ${PySide${PYSIDE_MAJOR_VERSION}_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(PySide${PYSIDE_MAJOR_VERSION}Tools QUIET) # PySide utilities (uic & rcc executables)
|
||||
if(NOT PYSIDE_TOOLS_FOUND)
|
||||
message("=======================\n"
|
||||
"PySide${PYSIDE_MAJOR_VERSION}Tools not found.\n"
|
||||
"=======================\n")
|
||||
endif()
|
||||
|
||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Ext/PySide)
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/Ext/PySide/__init__.py "# PySide wrapper\n"
|
||||
"from PySide${PYSIDE_MAJOR_VERSION} import __version__\n"
|
||||
"from PySide${PYSIDE_MAJOR_VERSION} import __version_info__\n")
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/Ext/PySide/QtCore.py "from PySide${PYSIDE_MAJOR_VERSION}.QtCore import *\n\n"
|
||||
"#QCoreApplication.CodecForTr=0\n"
|
||||
"#QCoreApplication.UnicodeUTF8=1\n")
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/Ext/PySide/QtNetwork.py "from PySide${PYSIDE_MAJOR_VERSION}.QtNetwork import *\n")
|
||||
if(BUILD_GUI)
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/Ext/PySide/QtGui.py "from PySide${PYSIDE_MAJOR_VERSION}.QtGui import *\n"
|
||||
"from PySide${PYSIDE_MAJOR_VERSION}.QtWidgets import *\n"
|
||||
"QHeaderView.setResizeMode = QHeaderView.setSectionResizeMode\n")
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/Ext/PySide/QtSvg.py "from PySide${PYSIDE_MAJOR_VERSION}.QtSvg import *\n")
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/Ext/PySide/QtUiTools.py "from PySide${PYSIDE_MAJOR_VERSION}.QtUiTools import *\n")
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/Ext/PySide/QtWidgets.py "from PySide${PYSIDE_MAJOR_VERSION}.QtWidgets import *\n")
|
||||
if(PYSIDE_MAJOR_VERSION LESS 6)
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/Ext/PySide/QtSvgWidgets.py "from PySide${PYSIDE_MAJOR_VERSION}.QtSvg import QGraphicsSvgItem\n"
|
||||
"from PySide${PYSIDE_MAJOR_VERSION}.QtSvg import QSvgWidget\n")
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/Ext/PySide/QtWebEngineWidgets.py "from PySide${PYSIDE_MAJOR_VERSION}.QtWebEngineWidgets import *\n")
|
||||
else()
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/Ext/PySide/QtSvgWidgets.py "from PySide${PYSIDE_MAJOR_VERSION}.QtSvgWidgets import *\n")
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/Ext/PySide/QtWebEngineWidgets.py "from PySide${PYSIDE_MAJOR_VERSION}.QtWebEngineWidgets import *\n"
|
||||
"from PySide${PYSIDE_MAJOR_VERSION}.QtWebEngineCore import QWebEnginePage\n")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(APPLE AND NOT BUILD_WITH_CONDA)
|
||||
install(
|
||||
DIRECTORY
|
||||
${CMAKE_BINARY_DIR}/Ext/PySide
|
||||
DESTINATION
|
||||
MacOS
|
||||
)
|
||||
else()
|
||||
install(
|
||||
DIRECTORY
|
||||
${CMAKE_BINARY_DIR}/Ext/PySide
|
||||
DESTINATION
|
||||
Ext
|
||||
)
|
||||
endif()
|
||||
|
||||
# If shiboken cannot be found the build option will be set to OFF
|
||||
if(NOT SHIBOKEN_INCLUDE_DIR)
|
||||
message(WARNING "Shiboken${PYSIDE_MAJOR_VERSION} include files not found, FREECAD_USE_SHIBOKEN automatically set to OFF")
|
||||
set(FREECAD_USE_SHIBOKEN OFF)
|
||||
endif()
|
||||
|
||||
# Now try to import the shiboken Python module and print a warning if it can't be loaded
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "import shiboken${SHIBOKEN_MAJOR_VERSION}"
|
||||
RESULT_VARIABLE FAILURE
|
||||
OUTPUT_VARIABLE PRINT_OUTPUT
|
||||
)
|
||||
|
||||
if(FAILURE)
|
||||
message(WARNING
|
||||
"==================================\n"
|
||||
"Shiboken${SHIBOKEN_MAJOR_VERSION} Python module not found.\n"
|
||||
"==================================\n")
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "import shiboken${SHIBOKEN_MAJOR_VERSION};print(shiboken${SHIBOKEN_MAJOR_VERSION}.__version__, end='')"
|
||||
RESULT_VARIABLE FAILURE
|
||||
OUTPUT_VARIABLE Shiboken_VERSION
|
||||
)
|
||||
endif()
|
||||
|
||||
# If PySide cannot be found the build option will be set to OFF
|
||||
if(NOT PYSIDE_INCLUDE_DIR)
|
||||
message(WARNING "PySide${PYSIDE_MAJOR_VERSION} include files not found, FREECAD_USE_PYSIDE automatically set to OFF")
|
||||
set(FREECAD_USE_PYSIDE OFF)
|
||||
endif()
|
||||
|
||||
# Independent of the build option PySide modules must be loaded at runtime. Print a warning if it fails.
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "import PySide${PYSIDE_MAJOR_VERSION};import os;print(os.path.dirname(PySide${PYSIDE_MAJOR_VERSION}.__file__), end='')"
|
||||
RESULT_VARIABLE FAILURE
|
||||
OUTPUT_VARIABLE PRINT_OUTPUT
|
||||
)
|
||||
if(FAILURE)
|
||||
message(WARNING
|
||||
"================================\n"
|
||||
"PySide${PYSIDE_MAJOR_VERSION} Python module not found.\n"
|
||||
"================================\n")
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "import PySide${PYSIDE_MAJOR_VERSION};print(PySide${PYSIDE_MAJOR_VERSION}.__version__, end='')"
|
||||
RESULT_VARIABLE FAILURE
|
||||
OUTPUT_VARIABLE PySide_VERSION
|
||||
)
|
||||
message(STATUS "PySide ${PySide_VERSION} Python module found at ${PRINT_OUTPUT}.\n")
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
|
||||
|
||||
macro(PYSIDE_WRAP_RC outfiles)
|
||||
if(NOT PYSIDE_RCC_EXECUTABLE)
|
||||
message(FATAL_ERROR "Qt rcc is required for generating ${ARGN}")
|
||||
endif()
|
||||
foreach(it ${ARGN})
|
||||
get_filename_component(outfile ${it} NAME_WE)
|
||||
get_filename_component(infile ${it} ABSOLUTE)
|
||||
set(outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}_rc.py")
|
||||
#ADD_CUSTOM_TARGET(${it} ALL
|
||||
# DEPENDS ${outfile}
|
||||
#)
|
||||
if(WIN32 OR APPLE)
|
||||
add_custom_command(OUTPUT ${outfile}
|
||||
COMMAND ${PYSIDE_RCC_EXECUTABLE} ${RCCOPTIONS} ${infile} -o ${outfile}
|
||||
MAIN_DEPENDENCY ${infile}
|
||||
)
|
||||
else()
|
||||
# Especially on Open Build Service we don't want changing date like
|
||||
# pyside-rcc generates in comments at beginning, which is why
|
||||
# we follow the tool command with in-place sed.
|
||||
add_custom_command(OUTPUT "${outfile}"
|
||||
COMMAND "${PYSIDE_RCC_EXECUTABLE}" ${RCCOPTIONS} "${infile}" ${PY_ATTRIBUTE} -o "${outfile}"
|
||||
# The line below sometimes catches unwanted lines too - but there is no date in the file
|
||||
# anymore with Qt5 RCC, so commenting it out for now...
|
||||
#COMMAND sed "/^# /d" "${outfile}" >"${outfile}.tmp" && mv "${outfile}.tmp" "${outfile}"
|
||||
MAIN_DEPENDENCY "${infile}"
|
||||
)
|
||||
endif()
|
||||
list(APPEND ${outfiles} ${outfile})
|
||||
endforeach()
|
||||
endmacro()
|
||||
10
cMake/FreeCAD_Helpers/SetupSpaceball.cmake
Normal file
10
cMake/FreeCAD_Helpers/SetupSpaceball.cmake
Normal file
@@ -0,0 +1,10 @@
|
||||
macro(SetupSpaceball)
|
||||
# ------------------------------ Spaceball -------------------------------
|
||||
|
||||
if (WIN32)
|
||||
#future
|
||||
else(WIN32)
|
||||
find_package(Spnav)
|
||||
endif(WIN32)
|
||||
|
||||
endmacro(SetupSpaceball)
|
||||
160
cMake/FreeCAD_Helpers/SetupSwig.cmake
Normal file
160
cMake/FreeCAD_Helpers/SetupSwig.cmake
Normal file
@@ -0,0 +1,160 @@
|
||||
macro(SetupSwig)
|
||||
|
||||
#-------------------------------- Swig ----------------------------------
|
||||
|
||||
# force cmake to re-search for SWIG when CMAKE_PREFIX_PATH changes
|
||||
unset(SWIG_EXECUTABLE CACHE)
|
||||
unset(SWIG_DIR CACHE)
|
||||
unset(SWIG_VERSION CACHE)
|
||||
unset(SWIG_FOUND CACHE)
|
||||
|
||||
if(BUILD_SKETCHER)
|
||||
# SWIG is required for sketcher WB (use QUIET to provide custom error message)
|
||||
find_package(SWIG QUIET)
|
||||
|
||||
if(NOT SWIG_FOUND)
|
||||
message(FATAL_ERROR
|
||||
"-----------------------------------------------------\n"
|
||||
"SWIG not found, swig & pivy required for sketcher WB.\n"
|
||||
"-----------------------------------------------------\n")
|
||||
# do not continue with check if swig not found
|
||||
return()
|
||||
endif()
|
||||
|
||||
# check swig/pivy runtime compatibility
|
||||
message(STATUS "checking SWIG/Pivy runtime compatibility...")
|
||||
|
||||
# get SWIG's runtime version using -external-runtime flag
|
||||
execute_process(
|
||||
COMMAND ${SWIG_EXECUTABLE} -python -external-runtime "${CMAKE_BINARY_DIR}/swig_runtime_check.h"
|
||||
RESULT_VARIABLE SWIG_EXTERNAL_RUNTIME_RESULT
|
||||
ERROR_VARIABLE SWIG_EXTERNAL_RUNTIME_ERROR
|
||||
ERROR_QUIET
|
||||
)
|
||||
# NOTE: only print the below output if using `cmake --log-level=DEBUG`
|
||||
message(DEBUG "SWIG external-runtime result: ${SWIG_EXTERNAL_RUNTIME_RESULT}")
|
||||
message(DEBUG "SWIG external-runtime error: ${SWIG_EXTERNAL_RUNTIME_ERROR}")
|
||||
|
||||
message(STATUS "Looking for: ${CMAKE_BINARY_DIR}/swig_runtime_check.h")
|
||||
if(EXISTS "${CMAKE_BINARY_DIR}/swig_runtime_check.h")
|
||||
message(STATUS "File exists: YES")
|
||||
else()
|
||||
message(STATUS "File exists: NO")
|
||||
endif()
|
||||
|
||||
if(EXISTS "${CMAKE_BINARY_DIR}/swig_runtime_check.h")
|
||||
file(STRINGS "${CMAKE_BINARY_DIR}/swig_runtime_check.h"
|
||||
SWIG_RUNTIME_VERSION_LINE
|
||||
REGEX "^#define SWIG_RUNTIME_VERSION")
|
||||
|
||||
message(STATUS "SWIG_RUNTIME_VERSION_LINE: ${SWIG_RUNTIME_VERSION_LINE}")
|
||||
|
||||
if(SWIG_RUNTIME_VERSION_LINE)
|
||||
# extract the version number (it's in quotes: "5")
|
||||
string(REGEX MATCH "\"([0-9]+)\"" _ "${SWIG_RUNTIME_VERSION_LINE}")
|
||||
set(SWIG_RUNTIME_VERSION "${CMAKE_MATCH_1}")
|
||||
message(STATUS "Extracted SWIG_RUNTIME_VERSION: ${SWIG_RUNTIME_VERSION}")
|
||||
endif()
|
||||
|
||||
file(REMOVE "${CMAKE_BINARY_DIR}/swig_runtime_check.h")
|
||||
else()
|
||||
message(STATUS "swig_runtime_check.h not found!")
|
||||
endif()
|
||||
|
||||
# extract pivy's SWIG runtime version from the compiled module
|
||||
# NOTE: python code can not be indented
|
||||
set(PYTHON_CHECK_PIVY_RUNTIME [=[
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
|
||||
try:
|
||||
import pivy
|
||||
pivy_dir = os.path.dirname(pivy.__file__)
|
||||
print(f'DEBUG:pivy_dir={pivy_dir}', file=sys.stderr)
|
||||
print(f'DEBUG:files={os.listdir(pivy_dir)}', file=sys.stderr)
|
||||
|
||||
pivy_path = None
|
||||
|
||||
# Look for _coin module with any extension (.so on Unix, .pyd on Windows)
|
||||
for f in os.listdir(pivy_dir):
|
||||
print(f'DEBUG:checking={f}', file=sys.stderr)
|
||||
if f.startswith('_coin') and (f.endswith('.so') or f.endswith('.pyd')):
|
||||
pivy_path = os.path.join(pivy_dir, f)
|
||||
break
|
||||
|
||||
print(f'DEBUG:pivy_path={pivy_path}', file=sys.stderr)
|
||||
|
||||
if pivy_path and os.path.exists(pivy_path):
|
||||
with open(pivy_path, 'rb') as f:
|
||||
content = f.read().decode('latin-1', errors='ignore')
|
||||
|
||||
print(f'DEBUG:content_len={len(content)}', file=sys.stderr)
|
||||
|
||||
# Use regex to find swig_runtime_data followed by a number
|
||||
match = re.search(r'swig_runtime_data(\d+)', content)
|
||||
print(f'DEBUG:match={match}', file=sys.stderr)
|
||||
if match:
|
||||
print(match.group(1))
|
||||
|
||||
except ImportError as e:
|
||||
print(f'DEBUG:import_error={e}', file=sys.stderr)
|
||||
print('ERROR_IMPORT')
|
||||
except Exception as e:
|
||||
print(f'DEBUG:exception={e}', file=sys.stderr)
|
||||
]=])
|
||||
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -c "${PYTHON_CHECK_PIVY_RUNTIME}"
|
||||
OUTPUT_VARIABLE PIVY_RUNTIME_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_VARIABLE PIVY_DEBUG_OUTPUT
|
||||
TIMEOUT 10
|
||||
)
|
||||
|
||||
message(DEBUG "Pivy debug output: ${PIVY_DEBUG_OUTPUT}")
|
||||
|
||||
# Handle errors and compare versions
|
||||
if(PIVY_RUNTIME_VERSION STREQUAL "ERROR_IMPORT")
|
||||
message(WARNING
|
||||
"Could not import pivy to check SWIG compatibility.\n"
|
||||
"Proceeding without SWIG version check."
|
||||
)
|
||||
elseif(SWIG_RUNTIME_VERSION AND PIVY_RUNTIME_VERSION)
|
||||
if(NOT SWIG_RUNTIME_VERSION STREQUAL PIVY_RUNTIME_VERSION)
|
||||
message(FATAL_ERROR
|
||||
" --------------------------------------------------------
|
||||
|
||||
SWIG / PIVY RUNTIME VERSION MISMATCH DETECTED!
|
||||
|
||||
SWIG runtime API version: ${SWIG_RUNTIME_VERSION}
|
||||
Pivy runtime API version: ${PIVY_RUNTIME_VERSION}
|
||||
|
||||
These must match for compatibility.
|
||||
This will cause runtime errors: 'No SWIG wrapped library loaded'
|
||||
|
||||
swig v4.4.x is not compatible with pivy built with swig <=4.3.x
|
||||
|
||||
FIX: Install a SWIG version that uses runtime ${PIVY_RUNTIME_VERSION}
|
||||
or rebuild Pivy with your current SWIG ${SWIG_VERSION}.
|
||||
|
||||
--------------------------------------------------------"
|
||||
)
|
||||
else()
|
||||
message(STATUS "SWIG/Pivy runtime compatibility: PASSED")
|
||||
message(STATUS "swig runtime API version: ${SWIG_RUNTIME_VERSION}")
|
||||
message(STATUS "pivy runtime API version: ${PIVY_RUNTIME_VERSION}")
|
||||
message(STATUS "swig binary version building freecad: ${SWIG_VERSION}")
|
||||
endif()
|
||||
else()
|
||||
if(NOT SWIG_RUNTIME_VERSION)
|
||||
message(WARNING "Could not determine SWIG runtime version")
|
||||
endif()
|
||||
if(NOT PIVY_RUNTIME_VERSION)
|
||||
message(WARNING "Could not determine Pivy runtime version")
|
||||
endif()
|
||||
message(WARNING "Proceeding without SWIG/Pivy compatibility check.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
11
cMake/FreeCAD_Helpers/SetupXercesC.cmake
Normal file
11
cMake/FreeCAD_Helpers/SetupXercesC.cmake
Normal file
@@ -0,0 +1,11 @@
|
||||
macro(SetupXercesC)
|
||||
# -------------------------------- XercesC --------------------------------
|
||||
|
||||
find_package(XercesC REQUIRED)
|
||||
if(NOT XercesC_FOUND)
|
||||
message(FATAL_ERROR "==================\n"
|
||||
"XercesC not found.\n"
|
||||
"==================\n")
|
||||
endif(NOT XercesC_FOUND)
|
||||
|
||||
endmacro(SetupXercesC)
|
||||
67
cMake/FreeCAD_Helpers/SetupZipIos.cmake
Normal file
67
cMake/FreeCAD_Helpers/SetupZipIos.cmake
Normal file
@@ -0,0 +1,67 @@
|
||||
macro(SetupZipIos)
|
||||
# -------------------------------- ZipIos --------------------------------
|
||||
|
||||
# Use external zipios++ if specified.
|
||||
if(FREECAD_USE_EXTERNAL_ZIPIOS)
|
||||
find_library(ZIPIOS_LIBRARY zipios)
|
||||
find_path(ZIPIOS_INCLUDES zipios++/zipios-config.h)
|
||||
if(ZIPIOS_LIBRARY)
|
||||
message(STATUS "Found zipios++: ${ZIPIOS}")
|
||||
endif()
|
||||
if(ZIPIOS_INCLUDES)
|
||||
message(STATUS "Found zipios++ headers.")
|
||||
endif()
|
||||
if(NOT ZIPIOS_LIBRARY OR NOT ZIPIOS_INCLUDES)
|
||||
message(FATAL_ERROR "Using external zipios++ was specified but was not found.")
|
||||
endif()
|
||||
else(FREECAD_USE_EXTERNAL_ZIPIOS)
|
||||
set(ZIPIOS_INCLUDES ${CMAKE_SOURCE_DIR}/src/3rdParty)
|
||||
SET(zipios_SRCS
|
||||
${ZIPIOS_INCLUDES}/zipios++/backbuffer.h
|
||||
${ZIPIOS_INCLUDES}/zipios++/collcoll.cpp
|
||||
${ZIPIOS_INCLUDES}/zipios++/collcoll.h
|
||||
${ZIPIOS_INCLUDES}/zipios++/deflateoutputstreambuf.cpp
|
||||
${ZIPIOS_INCLUDES}/zipios++/deflateoutputstreambuf.h
|
||||
${ZIPIOS_INCLUDES}/zipios++/fcoll.cpp
|
||||
${ZIPIOS_INCLUDES}/zipios++/fcoll.h
|
||||
${ZIPIOS_INCLUDES}/zipios++/fcollexceptions.cpp
|
||||
${ZIPIOS_INCLUDES}/zipios++/fcollexceptions.h
|
||||
${ZIPIOS_INCLUDES}/zipios++/fileentry.cpp
|
||||
${ZIPIOS_INCLUDES}/zipios++/fileentry.h
|
||||
${ZIPIOS_INCLUDES}/zipios++/filepath.cpp
|
||||
${ZIPIOS_INCLUDES}/zipios++/filepath.h
|
||||
${ZIPIOS_INCLUDES}/zipios++/filterinputstreambuf.cpp
|
||||
${ZIPIOS_INCLUDES}/zipios++/filterinputstreambuf.h
|
||||
${ZIPIOS_INCLUDES}/zipios++/filteroutputstreambuf.cpp
|
||||
${ZIPIOS_INCLUDES}/zipios++/filteroutputstreambuf.h
|
||||
${ZIPIOS_INCLUDES}/zipios++/gzipoutputstream.cpp
|
||||
${ZIPIOS_INCLUDES}/zipios++/gzipoutputstream.h
|
||||
${ZIPIOS_INCLUDES}/zipios++/gzipoutputstreambuf.cpp
|
||||
${ZIPIOS_INCLUDES}/zipios++/gzipoutputstreambuf.h
|
||||
${ZIPIOS_INCLUDES}/zipios++/inflateinputstreambuf.cpp
|
||||
${ZIPIOS_INCLUDES}/zipios++/inflateinputstreambuf.h
|
||||
${ZIPIOS_INCLUDES}/zipios++/meta-iostreams.h
|
||||
${ZIPIOS_INCLUDES}/zipios++/outputstringstream.h
|
||||
${ZIPIOS_INCLUDES}/zipios++/simplesmartptr.h
|
||||
${ZIPIOS_INCLUDES}/zipios++/virtualseeker.h
|
||||
${ZIPIOS_INCLUDES}/zipios++/zipfile.cpp
|
||||
${ZIPIOS_INCLUDES}/zipios++/zipfile.h
|
||||
${ZIPIOS_INCLUDES}/zipios++/ziphead.cpp
|
||||
${ZIPIOS_INCLUDES}/zipios++/ziphead.h
|
||||
${ZIPIOS_INCLUDES}/zipios++/zipheadio.cpp
|
||||
${ZIPIOS_INCLUDES}/zipios++/zipheadio.h
|
||||
${ZIPIOS_INCLUDES}/zipios++/zipinputstream.cpp
|
||||
${ZIPIOS_INCLUDES}/zipios++/zipinputstream.h
|
||||
${ZIPIOS_INCLUDES}/zipios++/zipinputstreambuf.cpp
|
||||
${ZIPIOS_INCLUDES}/zipios++/zipinputstreambuf.h
|
||||
${ZIPIOS_INCLUDES}/zipios++/zipios_common.h
|
||||
${ZIPIOS_INCLUDES}/zipios++/zipios-config.h
|
||||
${ZIPIOS_INCLUDES}/zipios++/zipios_defs.h
|
||||
${ZIPIOS_INCLUDES}/zipios++/zipoutputstreambuf.cpp
|
||||
${ZIPIOS_INCLUDES}/zipios++/zipoutputstreambuf.h
|
||||
${ZIPIOS_INCLUDES}/zipios++/zipoutputstream.cpp
|
||||
${ZIPIOS_INCLUDES}/zipios++/zipoutputstream.h
|
||||
)
|
||||
endif(FREECAD_USE_EXTERNAL_ZIPIOS)
|
||||
|
||||
endmacro(SetupZipIos)
|
||||
330
cMake/FreeCadMacros.cmake
Normal file
330
cMake/FreeCadMacros.cmake
Normal file
@@ -0,0 +1,330 @@
|
||||
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()
|
||||
if(INSTALL_PREFER_SYMLINKS)
|
||||
set(copy_command create_symlink)
|
||||
else()
|
||||
set(copy_command copy)
|
||||
endif()
|
||||
|
||||
foreach(it ${ARGN})
|
||||
get_filename_component(infile ${it} ABSOLUTE)
|
||||
get_filename_component(outfile "${outpath}/${it}" ABSOLUTE)
|
||||
# Ensure parent directory exists when copying or creating symlinks
|
||||
get_filename_component(outfile_dir "${outfile}" PATH)
|
||||
add_file_dependencies("${infile}" "${outfile}")
|
||||
ADD_CUSTOM_COMMAND(
|
||||
# Make sure destination directory exists before copy/symlink
|
||||
COMMAND "${CMAKE_COMMAND}" -E make_directory "${outfile_dir}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E ${copy_command} "${infile}" "${outfile}"
|
||||
OUTPUT "${outfile}"
|
||||
COMMENT "Copying ${infile} to ${outfile}${fc_details}"
|
||||
MAIN_DEPENDENCY "${infile}"
|
||||
)
|
||||
endforeach(it)
|
||||
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)
|
||||
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)
|
||||
ENDMACRO(fc_target_copy_resource_flat)
|
||||
|
||||
# It would be a bit cleaner to generate these files in ${CMAKE_CURRENT_BINARY_DIR}
|
||||
|
||||
# To be removed once all instances are migrated to generate_from_py
|
||||
macro(generate_from_xml BASE_NAME)
|
||||
set(TOOL_PATH "${CMAKE_SOURCE_DIR}/src/Tools/bindings/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 "${Python3_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 ${Python3_EXECUTABLE} "${TOOL_NATIVE_PATH}" --outputPath "${OUTPUT_NATIVE_PATH}" ${BASE_NAME}.xml
|
||||
MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/${BASE_NAME}.xml"
|
||||
DEPENDS
|
||||
"${CMAKE_SOURCE_DIR}/src/Tools/bindings/templates/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_impl BASE_NAME SUFFIX)
|
||||
set(TOOL_PATH "${CMAKE_SOURCE_DIR}/src/Tools/bindings/generate.py")
|
||||
file(TO_NATIVE_PATH "${TOOL_PATH}" TOOL_NATIVE_PATH)
|
||||
file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${BASE_NAME}.pyi" SOURCE_NATIVE_PATH)
|
||||
|
||||
set(SOURCE_CPP_PATH "${CMAKE_CURRENT_BINARY_DIR}/${BASE_NAME}Py${SUFFIX}.cpp")
|
||||
set(SOURCE_H_PATH "${CMAKE_CURRENT_BINARY_DIR}/${BASE_NAME}Py${SUFFIX}.h")
|
||||
|
||||
# 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}")
|
||||
# Ensure the source files are generated at least once.
|
||||
message(STATUS "${SOURCE_CPP_PATH}")
|
||||
execute_process(
|
||||
COMMAND "${Python3_EXECUTABLE}" "${TOOL_NATIVE_PATH}" --outputPath "${OUTPUT_NATIVE_PATH}" "${SOURCE_NATIVE_PATH}"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
COMMAND_ERROR_IS_FATAL ANY
|
||||
)
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${SOURCE_H_PATH}" "${SOURCE_CPP_PATH}"
|
||||
COMMAND ${Python3_EXECUTABLE} "${TOOL_NATIVE_PATH}" --outputPath "${OUTPUT_NATIVE_PATH}" ${BASE_NAME}.pyi
|
||||
MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/${BASE_NAME}.pyi"
|
||||
DEPENDS
|
||||
"${CMAKE_SOURCE_DIR}/src/Tools/bindings/templates/templateClassPyExport.py"
|
||||
"${TOOL_PATH}"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
COMMENT "Building ${BASE_NAME}Py${SUFFIX}.h/.cpp out of ${BASE_NAME}.pyi"
|
||||
)
|
||||
endmacro(generate_from_py_impl)
|
||||
|
||||
macro(generate_from_py BASE_NAME)
|
||||
generate_from_py_impl(${BASE_NAME} "")
|
||||
endmacro(generate_from_py)
|
||||
|
||||
macro(generate_from_py_ BASE_NAME)
|
||||
generate_from_py_impl(${BASE_NAME} "_")
|
||||
endmacro(generate_from_py_)
|
||||
|
||||
macro(generate_embed_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 "${Python3_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_embed_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 "${Python3_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 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)
|
||||
# FreeCADBase, SMDS, Driver and MEFISTO2 libs don't depend on parts from CMAKE_INSTALL_LIBDIR
|
||||
if(NOT ${ProjectName} MATCHES "^(FreeCADBase|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)
|
||||
unset(${PACKAGE}_FOUND) # Remove from local scope
|
||||
unset(${PACKAGE}_FOUND CACHE) # Remove from CMake cache (if it exists)
|
||||
execute_process(
|
||||
COMMAND ${Python3_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 "Location of the ${PACKAGE} libraries")
|
||||
elseif(OPT_LIBRARIES)
|
||||
set(${PACKAGE}_LIBRARIES ${OPT_LIBRARIES} CACHE PATH "Location of the ${PACKAGE} optimized libraries")
|
||||
elseif(DEBUG_LIBRARIES)
|
||||
set(${PACKAGE}_LIBRARIES ${DEBUG_LIBRARIES} CACHE PATH "Location of the ${PACKAGE} debug libraries")
|
||||
endif()
|
||||
set(${PACKAGE}_INCLUDE_DIRS ${INCLUDE_DIR} CACHE PATH "Location of the ${PACKAGE} includes")
|
||||
set(${PACKAGE}_FOUND ON)
|
||||
message(STATUS "Found pip-installed ${PACKAGE} in ${PIP_PACKAGE_LOCATION}/${PIP_PACKAGE_NAME}")
|
||||
if(${PACKAGE}_INCLUDE_DIRS)
|
||||
message(STATUS " --> with includes in ${${PACKAGE}_INCLUDE_DIRS}")
|
||||
endif()
|
||||
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()
|
||||
|
||||
54
cMake/UseLibPack3.cmake
Normal file
54
cMake/UseLibPack3.cmake
Normal file
@@ -0,0 +1,54 @@
|
||||
set(ENV{PATH} "${FREECAD_LIBPACK_DIR};$ENV{PATH}")
|
||||
list(PREPEND CMAKE_PREFIX_PATH "${FREECAD_LIBPACK_DIR}")
|
||||
|
||||
set (Python3_EXECUTABLE ${FREECAD_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 filesystem program_options regex system thread date_time REQUIRED PATHS ${FREECAD_LIBPACK_DIR}/lib/cmake NO_DEFAULT_PATH)
|
||||
|
||||
set(OCE_DIR ${FREECAD_LIBPACK_DIR}/lib/cmake CACHE PATH "" FORCE)
|
||||
|
||||
set(SWIG_EXECUTABLE ${FREECAD_LIBPACK_DIR}/bin/swig.exe CACHE FILEPATH "Swig" FORCE)
|
||||
|
||||
find_package(Qt6 REQUIRED PATHS ${FREECAD_LIBPACK_DIR}/lib/cmake NO_DEFAULT_PATH)
|
||||
message(STATUS "Found LibPack 3 Qt ${Qt6_VERSION}")
|
||||
|
||||
if(FREECAD_LIBPACK_VERSION VERSION_GREATER_EQUAL "3.1.0")
|
||||
find_package(pybind11 REQUIRED PATHS ${FREECAD_LIBPACK_DIR}/share/cmake/pybind11 NO_DEFAULT_PATH)
|
||||
message(STATUS "Found LibPack 3 pybind11 ${pybind11_VERSION}")
|
||||
set(FREECAD_USE_PYBIND11 ON)
|
||||
else()
|
||||
# We have completely removed support for boost-python and require pybind11, which requires LibPack 3.1 or later
|
||||
message(FATAL_ERROR "FreeCAD now requires LibPack 3.1.0 or newer (you are using ${FREECAD_LIBPACK_VERSION}): please upgrade your LibPack")
|
||||
endif()
|
||||
|
||||
find_package(XercesC REQUIRED PATHS ${FREECAD_LIBPACK_DIR}/cmake NO_DEFAULT_PATH)
|
||||
message(STATUS "Found LibPack 3 XercesC ${XercesC_VERSION}")
|
||||
|
||||
if(FREECAD_LIBPACK_VERSION VERSION_GREATER_EQUAL "3.1.1")
|
||||
set(FREECAD_USE_EXTERNAL_E57FORMAT ON)
|
||||
find_package(E57Format REQUIRED PATHS ${FREECAD_LIBPACK_DIR}/lib/cmake/e57format NO_DEFAULT_PATH)
|
||||
message(STATUS "Found LibPack 3 e57format ${e57format_VERSION}")
|
||||
endif()
|
||||
|
||||
find_package(yaml-cpp REQUIRED PATHS ${FREECAD_LIBPACK_DIR}/lib/cmake NO_DEFAULT_PATH)
|
||||
message(STATUS "Found LibPack 3 yaml-cpp ${yaml-cpp_VERSION}")
|
||||
|
||||
find_package(Coin REQUIRED PATHS ${FREECAD_LIBPACK_DIR}/lib/cmake NO_DEFAULT_PATH)
|
||||
|
||||
message(STATUS "Found LibPack 3 Coin ${Coin_VERSION}")
|
||||
# For compatibility with the rest of the cMake scripts:
|
||||
set (COIN3D_FOUND TRUE)
|
||||
|
||||
set (NETGENDATA ${FREECAD_LIBPACK_DIR}/include/netgen)
|
||||
|
||||
if (FREECAD_USE_FREETYPE)
|
||||
find_package(freetype REQUIRED PATHS ${FREECAD_LIBPACK_DIR}/lib/cmake NO_DEFAULT_PATH)
|
||||
message(STATUS "Found LibPack 3 Freetype ${freetype_VERSION} library from ${freetype_LIBRARY}")
|
||||
endif (FREECAD_USE_FREETYPE)
|
||||
|
||||
set (HDF5_DIR ${FREECAD_LIBPACK_DIR}/share/cmake)
|
||||
|
||||
link_directories (${FREECAD_LIBPACK_DIR}/lib)
|
||||
60
cMake/UseLibPackCLbundler.cmake
Normal file
60
cMake/UseLibPackCLbundler.cmake
Normal file
@@ -0,0 +1,60 @@
|
||||
set(ENV{PATH} "${FREECAD_LIBPACK_DIR};$ENV{PATH}")
|
||||
set(ENV{CMAKE_PREFIX_PATH} ${FREECAD_LIBPACK_DIR})
|
||||
|
||||
set(Boost_INCLUDE_DIR ${FREECAD_LIBPACK_DIR}/include CACHE PATH "" FORCE)
|
||||
|
||||
set(OCE_DIR ${FREECAD_LIBPACK_DIR}/lib/cmake CACHE PATH "" FORCE)
|
||||
|
||||
set(SWIG_EXECUTABLE ${FREECAD_LIBPACK_DIR}/bin/swig/swig.exe CACHE FILEPATH "Swig" FORCE)
|
||||
|
||||
|
||||
# Set paths to cmake config files for each Qt module
|
||||
set(Qt5_ROOT_DIR ${FREECAD_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 "${FREECAD_LIBPACK_DIR}/lib")
|
||||
find_library(XercesC_LIBRARY_DEBUG xerces-c_3D "${FREECAD_LIBPACK_DIR}/lib")
|
||||
set (XercesC_LIBRARIES debug ${XercesC_LIBRARY_DEBUG} optimized ${XercesC_LIBRARY_RELEASE})
|
||||
set(XercesC_FOUND TRUE)
|
||||
|
||||
find_library(COIN3D_LIBRARY_RELEASE coin4 "${FREECAD_LIBPACK_DIR}/lib")
|
||||
find_library(COIN3D_LIBRARY_DEBUG coin4d "${FREECAD_LIBPACK_DIR}/lib")
|
||||
set(COIN3D_LIBRARIES optimized ${COIN3D_LIBRARY_RELEASE}
|
||||
debug ${COIN3D_LIBRARY_DEBUG})
|
||||
set(COIN3D_FOUND TRUE)
|
||||
|
||||
set(NETGENDATA ${FREECAD_LIBPACK_DIR}/include/netgen)
|
||||
|
||||
if(FREECAD_USE_FREETYPE)
|
||||
set(FREETYPE_INCLUDE_DIR_freetype2 ${FREECAD_LIBPACK_DIR}/include/freetype2)
|
||||
endif(FREECAD_USE_FREETYPE)
|
||||
|
||||
link_directories(${FREECAD_LIBPACK_DIR}/lib)
|
||||
Reference in New Issue
Block a user