2021-03-24 22:52:31 +05:00
|
|
|
# Copyright (C) 2012-2021 CEA/DEN, EDF R&D, OPEN CASCADE
|
2013-10-11 18:38:59 +06:00
|
|
|
#
|
|
|
|
# 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
|
2014-02-19 18:50:20 +06:00
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
2013-10-11 18:38:59 +06:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
|
|
|
|
PROJECT(SalomeNETGENPLUGIN C CXX)
|
|
|
|
|
|
|
|
# Versioning
|
|
|
|
# ===========
|
|
|
|
# Project name, upper case
|
|
|
|
STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
|
|
|
|
|
2018-09-11 19:47:55 +05:00
|
|
|
SET(${PROJECT_NAME_UC}_MAJOR_VERSION 9)
|
2021-04-27 18:20:34 +05:00
|
|
|
SET(${PROJECT_NAME_UC}_MINOR_VERSION 7)
|
2019-03-28 11:59:20 +05:00
|
|
|
SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
|
2013-10-11 18:38:59 +06:00
|
|
|
SET(${PROJECT_NAME_UC}_VERSION
|
|
|
|
${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
|
2018-12-10 19:58:13 +05:00
|
|
|
SET(${PROJECT_NAME_UC}_VERSION_DEV 1)
|
2013-10-11 18:38:59 +06:00
|
|
|
|
2016-07-25 19:07:02 +05:00
|
|
|
# Common CMake macros
|
|
|
|
# ===================
|
|
|
|
SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
|
|
|
|
IF(EXISTS ${CONFIGURATION_ROOT_DIR})
|
|
|
|
LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
|
2020-04-20 14:12:20 +05:00
|
|
|
INCLUDE(SalomeMacros NO_POLICY_SCOPE)
|
2016-07-25 19:07:02 +05:00
|
|
|
ELSE()
|
|
|
|
MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
|
|
|
|
ENDIF()
|
|
|
|
|
2013-10-11 18:38:59 +06:00
|
|
|
# Find KERNEL
|
|
|
|
# ===========
|
|
|
|
SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
|
|
|
|
IF(EXISTS ${KERNEL_ROOT_DIR})
|
|
|
|
FIND_PACKAGE(SalomeKERNEL REQUIRED)
|
2018-06-25 16:29:43 +05:00
|
|
|
KERNEL_WITH_CORBA() # check whether KERNEL built with CORBA
|
2013-10-11 18:38:59 +06:00
|
|
|
ELSE(EXISTS ${KERNEL_ROOT_DIR})
|
|
|
|
MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
|
|
|
|
ENDIF(EXISTS ${KERNEL_ROOT_DIR})
|
|
|
|
|
|
|
|
# Platform setup
|
|
|
|
# ==============
|
|
|
|
INCLUDE(SalomeSetupPlatform) # From KERNEL
|
|
|
|
# Always build libraries as shared objects:
|
|
|
|
SET(BUILD_SHARED_LIBS TRUE)
|
|
|
|
|
|
|
|
# User options
|
|
|
|
# ============
|
2013-11-13 18:22:16 +06:00
|
|
|
OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON)
|
2013-10-23 12:48:43 +06:00
|
|
|
OPTION(SALOME_BUILD_DOC "Generate SALOME NETGENPLUGIN documentation" ON)
|
2013-10-11 18:38:59 +06:00
|
|
|
|
2013-11-13 18:22:16 +06:00
|
|
|
IF(SALOME_BUILD_TESTS)
|
|
|
|
ENABLE_TESTING()
|
|
|
|
ENDIF()
|
|
|
|
|
2013-10-11 18:38:59 +06:00
|
|
|
# Advanced options:
|
|
|
|
OPTION(SALOME_BUILD_GUI "Enable GUI" ON)
|
|
|
|
|
|
|
|
##
|
|
|
|
## From KERNEL:
|
|
|
|
##
|
|
|
|
|
|
|
|
# Python
|
2016-02-15 17:46:16 +05:00
|
|
|
FIND_PACKAGE(SalomePythonInterp REQUIRED)
|
|
|
|
FIND_PACKAGE(SalomePythonLibs REQUIRED)
|
2013-10-11 18:38:59 +06:00
|
|
|
# Boost
|
|
|
|
FIND_PACKAGE(SalomeBoost REQUIRED)
|
|
|
|
# CORBA
|
|
|
|
FIND_PACKAGE(SalomeOmniORB REQUIRED)
|
|
|
|
FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
|
|
|
|
|
|
|
|
# Other KERNEL optionals:
|
|
|
|
IF(SALOME_BUILD_DOC)
|
|
|
|
FIND_PACKAGE(SalomeDoxygen)
|
|
|
|
SALOME_LOG_OPTIONAL_PACKAGE(Doxygen SALOME_BUILD_DOC)
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
# Find GUI (optional)
|
|
|
|
# ===========
|
|
|
|
IF(SALOME_BUILD_GUI)
|
|
|
|
SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
|
|
|
|
IF(EXISTS ${GUI_ROOT_DIR})
|
|
|
|
FIND_PACKAGE(SalomeGUI)
|
2018-06-25 16:29:43 +05:00
|
|
|
SALOME_GUI_WITH_CORBA() # check whether GUI built with CORBA
|
2015-06-11 16:52:10 +05:00
|
|
|
SALOME_GUI_MODE(SALOME_USE_SALOMEOBJECT)
|
2013-10-11 18:38:59 +06:00
|
|
|
ELSE(EXISTS ${GUI_ROOT_DIR})
|
|
|
|
MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR")
|
|
|
|
ENDIF(EXISTS ${GUI_ROOT_DIR})
|
|
|
|
SALOME_LOG_OPTIONAL_PACKAGE(SalomeGUI SALOME_BUILD_GUI)
|
|
|
|
ENDIF(SALOME_BUILD_GUI)
|
|
|
|
|
|
|
|
##
|
|
|
|
## From GUI:
|
|
|
|
##
|
|
|
|
|
|
|
|
IF(SALOME_BUILD_GUI)
|
2015-11-26 19:49:01 +05:00
|
|
|
# Qt
|
2019-05-30 17:07:23 +05:00
|
|
|
FIND_PACKAGE(SalomeQt5 REQUIRED)
|
2013-10-11 18:38:59 +06:00
|
|
|
ENDIF(SALOME_BUILD_GUI)
|
|
|
|
|
2013-10-14 15:16:04 +06:00
|
|
|
# OCCT
|
2017-02-15 20:16:12 +05:00
|
|
|
FIND_PACKAGE(SalomeOpenCASCADE REQUIRED)
|
2013-10-14 15:16:04 +06:00
|
|
|
# VTK
|
2014-10-15 16:30:54 +06:00
|
|
|
FIND_PACKAGE(SalomeVTK REQUIRED)
|
2013-10-14 15:16:04 +06:00
|
|
|
|
|
|
|
|
2013-10-11 18:38:59 +06:00
|
|
|
# Find GEOM
|
|
|
|
# ===========
|
|
|
|
|
|
|
|
SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR} CACHE PATH "Path to the Salome GEOM")
|
|
|
|
IF(EXISTS ${GEOM_ROOT_DIR})
|
|
|
|
FIND_PACKAGE(SalomeGEOM REQUIRED)
|
|
|
|
ELSE(EXISTS ${GEOM_ROOT_DIR})
|
|
|
|
MESSAGE(FATAL_ERROR "We absolutely need a Salome GEOM, please define GEOM_ROOT_DIR")
|
|
|
|
ENDIF(EXISTS ${GEOM_ROOT_DIR})
|
|
|
|
|
|
|
|
# Find SMESH
|
|
|
|
# ===========
|
|
|
|
SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR} CACHE PATH "Path to the Salome SMESH")
|
|
|
|
IF(EXISTS ${SMESH_ROOT_DIR})
|
|
|
|
FIND_PACKAGE(SalomeSMESH REQUIRED)
|
2013-10-23 12:48:43 +06:00
|
|
|
ADD_DEFINITIONS(${SMESH_DEFINITIONS})
|
|
|
|
INCLUDE_DIRECTORIES(${SMESH_INCLUDE_DIRS})
|
|
|
|
IF(SALOME_BUILD_GUI)
|
|
|
|
IF(NOT SALOME_SMESH_BUILD_GUI)
|
|
|
|
MESSAGE(FATAL_ERROR "We absolutely need a Salome SMESH with GUI, please set SALOME_BUILD_GUI=ON in SMESH module")
|
|
|
|
ENDIF(NOT SALOME_SMESH_BUILD_GUI)
|
|
|
|
ENDIF(SALOME_BUILD_GUI)
|
2013-12-18 21:10:27 +06:00
|
|
|
IF(SALOME_BUILD_DOC)
|
|
|
|
IF(NOT SALOME_SMESH_BUILD_DOC)
|
|
|
|
MESSAGE(FATAL_ERROR "We absolutely need a Salome SMESH documentation to build NETGENPLUGIN documentation. "
|
|
|
|
"So, you should either set SALOME_BUILD_DOC=OFF in NETGENPLUGIN or set SALOME_BUILD_DOC=ON in SMESH module.")
|
|
|
|
ENDIF(NOT SALOME_SMESH_BUILD_DOC)
|
|
|
|
ENDIF(SALOME_BUILD_DOC)
|
2013-10-11 18:38:59 +06:00
|
|
|
ELSE(EXISTS ${SMESH_ROOT_DIR})
|
|
|
|
MESSAGE(FATAL_ERROR "We absolutely need a Salome SMESH, please define SMESH_ROOT_DIR")
|
|
|
|
ENDIF(EXISTS ${SMESH_ROOT_DIR})
|
|
|
|
|
|
|
|
##
|
|
|
|
## NETGENPLUGIN specifics
|
|
|
|
##
|
|
|
|
|
|
|
|
FIND_PACKAGE(SalomeNetgen REQUIRED)
|
2013-10-24 19:46:04 +06:00
|
|
|
ADD_DEFINITIONS(${NETGEN_DEFINITIONS})
|
2013-10-11 18:38:59 +06:00
|
|
|
|
2021-10-26 20:27:40 +05:00
|
|
|
IF (NETGEN_V6)
|
|
|
|
SET(NETGEN_VERSION_MAJOR 6)
|
|
|
|
ELSE()
|
|
|
|
SET(NETGEN_VERSION_MAJOR 5)
|
|
|
|
ENDIF()
|
|
|
|
|
2013-10-11 18:38:59 +06:00
|
|
|
# Detection summary:
|
|
|
|
SALOME_PACKAGE_REPORT_AND_CHECK()
|
|
|
|
|
|
|
|
# Directories
|
|
|
|
# (default values taken from KERNEL)
|
|
|
|
# ===========
|
|
|
|
SET(SALOME_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "Install path: SALOME binaries")
|
|
|
|
SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: SALOME libs")
|
|
|
|
SET(SALOME_INSTALL_IDLS "${SALOME_INSTALL_IDLS}" CACHE PATH "Install path: SALOME IDL files")
|
|
|
|
SET(SALOME_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "Install path: SALOME headers")
|
|
|
|
SET(SALOME_INSTALL_SCRIPT_SCRIPTS "${SALOME_INSTALL_SCRIPT_SCRIPTS}" CACHE PATH
|
|
|
|
"Install path: SALOME scripts")
|
|
|
|
SET(SALOME_INSTALL_SCRIPT_DATA "${SALOME_INSTALL_SCRIPT_DATA}" CACHE PATH
|
|
|
|
"Install path: SALOME script data")
|
|
|
|
SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH
|
|
|
|
"Install path: SALOME Python scripts")
|
|
|
|
SET(SALOME_INSTALL_APPLISKEL_SCRIPTS "${SALOME_INSTALL_APPLISKEL_SCRIPTS}" CACHE PATH
|
|
|
|
"Install path: SALOME application skeleton - scripts")
|
|
|
|
SET(SALOME_INSTALL_APPLISKEL_PYTHON "${SALOME_INSTALL_APPLISKEL_PYTHON}" CACHE PATH
|
|
|
|
"Install path: SALOME application skeleton - Python")
|
|
|
|
SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Install path: SALOME Python stuff")
|
|
|
|
SET(SALOME_INSTALL_PYTHON_SHARED "${SALOME_INSTALL_PYTHON_SHARED}" CACHE PATH
|
|
|
|
"Install path: SALOME Python shared modules")
|
|
|
|
SET(SALOME_INSTALL_CMAKE_LOCAL "${SALOME_INSTALL_CMAKE_LOCAL}" CACHE PATH
|
|
|
|
"Install path: local SALOME CMake files")
|
|
|
|
SET(SALOME_INSTALL_AMCONFIG_LOCAL "${SALOME_INSTALL_AMCONFIG_LOCAL}" CACHE PATH
|
|
|
|
"Install path: local SALOME config files (obsolete, to be removed)")
|
|
|
|
SET(SALOME_INSTALL_RES "${SALOME_INSTALL_RES}" CACHE PATH "Install path: SALOME resources")
|
|
|
|
SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME documentation")
|
|
|
|
|
|
|
|
# Specific to NETGENPLUGIN:
|
|
|
|
SET(SALOME_NETGENPLUGIN_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/netgenplugin" CACHE PATH
|
|
|
|
"Install path: SALOME NETGENPLUGIN specific data")
|
|
|
|
|
|
|
|
MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS)
|
|
|
|
MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON)
|
|
|
|
MARK_AS_ADVANCED(SALOME_INSTALL_APPLISKEL_SCRIPTS SALOME_INSTALL_APPLISKEL_PYTHON SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES)
|
|
|
|
MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED)
|
|
|
|
MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC)
|
|
|
|
MARK_AS_ADVANCED(SALOME_NETGENPLUGIN_INSTALL_RES_DATA)
|
|
|
|
|
2013-10-31 17:52:42 +06:00
|
|
|
# Accumulate environment variables for NETGENPLUGIN module
|
|
|
|
SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS}
|
|
|
|
${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON})
|
|
|
|
SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS})
|
|
|
|
|
2013-10-11 18:38:59 +06:00
|
|
|
# Sources
|
|
|
|
# ========
|
|
|
|
|
|
|
|
ADD_SUBDIRECTORY(idl)
|
|
|
|
ADD_SUBDIRECTORY(adm_local)
|
|
|
|
ADD_SUBDIRECTORY(resources)
|
|
|
|
ADD_SUBDIRECTORY(src)
|
|
|
|
ADD_SUBDIRECTORY(bin)
|
|
|
|
IF(SALOME_BUILD_DOC)
|
|
|
|
ADD_SUBDIRECTORY(doc)
|
|
|
|
ENDIF(SALOME_BUILD_DOC)
|
|
|
|
|
|
|
|
# Header configuration
|
|
|
|
# ====================
|
|
|
|
SALOME_XVERSION(${PROJECT_NAME})
|
|
|
|
SALOME_CONFIGURE_FILE(NETGENPLUGIN_version.h.in NETGENPLUGIN_version.h INSTALL ${SALOME_INSTALL_HEADERS})
|
|
|
|
|
|
|
|
# Configuration export
|
|
|
|
# (here only the level 1 prerequisites are exposed)
|
|
|
|
# ====================
|
|
|
|
INCLUDE(CMakePackageConfigHelpers)
|
|
|
|
|
|
|
|
# List of targets in this project we want to make visible to the rest of the world.
|
|
|
|
# They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
|
|
|
|
SET(_${PROJECT_NAME}_exposed_targets
|
|
|
|
NETGENEngine SalomeIDLNETGENPLUGIN
|
|
|
|
)
|
|
|
|
|
|
|
|
IF(SALOME_BUILD_GUI)
|
|
|
|
LIST(APPEND _${PROJECT_NAME}_exposed_targets
|
|
|
|
NETGENPluginGUI
|
|
|
|
)
|
|
|
|
ENDIF(SALOME_BUILD_GUI)
|
|
|
|
|
|
|
|
# Add all targets to the build-tree export set
|
|
|
|
EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
|
|
|
|
FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake)
|
|
|
|
|
|
|
|
# Create the configuration files:
|
|
|
|
# - in the build tree:
|
|
|
|
|
|
|
|
# Ensure the variables are always defined for the configure:
|
|
|
|
SET(SMESH_ROOT_DIR "${SMESH_ROOT_DIR}")
|
|
|
|
SET(NETGEN_ROOT_DIR "${NETGEN_ROOT_DIR}")
|
|
|
|
|
|
|
|
SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
|
2013-11-05 18:47:01 +06:00
|
|
|
|
|
|
|
# Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
|
2013-11-06 15:09:13 +06:00
|
|
|
SALOME_CONFIGURE_PREPARE(Netgen)
|
2013-11-05 18:47:01 +06:00
|
|
|
|
2013-10-11 18:38:59 +06:00
|
|
|
CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
|
|
|
|
${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
|
|
|
|
INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
|
|
|
|
PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
|
|
|
|
SMESH_ROOT_DIR NETGEN_ROOT_DIR)
|
|
|
|
|
|
|
|
WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
|
|
|
|
VERSION ${${PROJECT_NAME_UC}_VERSION}
|
|
|
|
COMPATIBILITY AnyNewerVersion)
|
|
|
|
|
|
|
|
# Install the CMake configuration files:
|
|
|
|
INSTALL(FILES
|
|
|
|
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
|
|
|
|
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
|
|
|
|
DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}")
|
|
|
|
|
|
|
|
# Install the export set for use with the install-tree
|
|
|
|
INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
|
|
|
|
FILE ${PROJECT_NAME}Targets.cmake)
|