1 # Copyright (C) 2012-2020 CEA/DEN, EDF R&D
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
20 PROJECT(SalomeGHS3DPLUGIN C CXX)
24 # Project name, upper case
25 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
27 SET(${PROJECT_NAME_UC}_MAJOR_VERSION 9)
28 SET(${PROJECT_NAME_UC}_MINOR_VERSION 6)
29 SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
30 SET(${PROJECT_NAME_UC}_VERSION
31 ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
32 SET(${PROJECT_NAME_UC}_VERSION_DEV 0)
36 SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
37 IF(EXISTS ${CONFIGURATION_ROOT_DIR})
38 LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
39 INCLUDE(SalomeMacros NO_POLICY_SCOPE)
41 MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
46 SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
47 IF(EXISTS ${KERNEL_ROOT_DIR})
48 FIND_PACKAGE(SalomeKERNEL REQUIRED)
49 KERNEL_WITH_CORBA() # check whether KERNEL builded with CORBA
50 ELSE(EXISTS ${KERNEL_ROOT_DIR})
51 MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
52 ENDIF(EXISTS ${KERNEL_ROOT_DIR})
56 INCLUDE(SalomeSetupPlatform) # From KERNEL
57 # Always build libraries as shared objects:
58 SET(BUILD_SHARED_LIBS TRUE)
62 OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON)
63 OPTION(SALOME_BUILD_DOC "Generate SALOME GHS3DPLUGIN documentation" ON)
64 OPTION(SALOME_USE_MG_LIBS "Use MeshGems libraries" OFF)
66 IF(SALOME_BUILD_TESTS)
71 OPTION(SALOME_BUILD_GUI "Enable GUI" ON)
73 MARK_AS_ADVANCED(SALOME_USE_MG_LIBS)
81 FIND_PACKAGE(SalomePythonInterp REQUIRED)
82 FIND_PACKAGE(SalomePythonLibs REQUIRED)
84 FIND_PACKAGE(SalomeBoost REQUIRED)
86 FIND_PACKAGE(SalomeOmniORB REQUIRED)
87 FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
89 # Other KERNEL optionals:
91 FIND_PACKAGE(SalomeDoxygen)
92 SALOME_LOG_OPTIONAL_PACKAGE(Doxygen SALOME_BUILD_DOC)
98 SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
99 IF(EXISTS ${GUI_ROOT_DIR})
100 FIND_PACKAGE(SalomeGUI)
101 SALOME_GUI_WITH_CORBA() # check whether GUI builded with CORBA
102 ADD_DEFINITIONS(${GUI_DEFINITIONS})
103 INCLUDE_DIRECTORIES(${GUI_INCLUDE_DIRS})
104 ELSE(EXISTS ${GUI_ROOT_DIR})
105 MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR")
106 ENDIF(EXISTS ${GUI_ROOT_DIR})
107 SALOME_LOG_OPTIONAL_PACKAGE(SalomeGUI SALOME_BUILD_GUI)
108 ENDIF(SALOME_BUILD_GUI)
116 FIND_PACKAGE(SalomeQt5 REQUIRED)
117 ENDIF(SALOME_BUILD_GUI)
119 FIND_PACKAGE(SalomeOpenCASCADE REQUIRED)
121 FIND_PACKAGE(SalomeVTK REQUIRED)
126 SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR} CACHE PATH "Path to the Salome GEOM")
127 IF(EXISTS ${GEOM_ROOT_DIR})
128 FIND_PACKAGE(SalomeGEOM REQUIRED)
129 ELSE(EXISTS ${GEOM_ROOT_DIR})
130 MESSAGE(FATAL_ERROR "We absolutely need a Salome GEOM, please define GEOM_ROOT_DIR")
131 ENDIF(EXISTS ${GEOM_ROOT_DIR})
136 SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR} CACHE PATH "Path to the Salome SMESH")
137 IF(EXISTS ${SMESH_ROOT_DIR})
138 FIND_PACKAGE(SalomeSMESH REQUIRED)
139 ADD_DEFINITIONS(${SMESH_DEFINITIONS})
140 INCLUDE_DIRECTORIES(${SMESH_INCLUDE_DIRS})
142 IF(NOT SALOME_SMESH_BUILD_GUI)
143 MESSAGE(FATAL_ERROR "We absolutely need a Salome SMESH with GUI, please set SALOME_BUILD_GUI=ON in SMESH module")
144 ENDIF(NOT SALOME_SMESH_BUILD_GUI)
145 ENDIF(SALOME_BUILD_GUI)
147 IF(NOT SALOME_SMESH_BUILD_DOC)
148 MESSAGE(FATAL_ERROR "We absolutely need a Salome SMESH documentation to build GHS3DPLUGIN documentation. "
149 "So, you should either set SALOME_BUILD_DOC=OFF in GHS3DPLUGIN or set SALOME_BUILD_DOC=ON in SMESH module.")
150 ENDIF(NOT SALOME_SMESH_BUILD_DOC)
151 ENDIF(SALOME_BUILD_DOC)
152 ELSE(EXISTS ${SMESH_ROOT_DIR})
153 MESSAGE(FATAL_ERROR "We absolutely need a Salome SMESH, please define SMESH_ROOT_DIR")
154 ENDIF(EXISTS ${SMESH_ROOT_DIR})
159 IF(SALOME_USE_MG_LIBS)
160 FIND_PACKAGE(SalomeMESHGEMS)
161 SALOME_LOG_OPTIONAL_PACKAGE(MESHGEMS SALOME_USE_MG_LIBS)
162 ADD_DEFINITIONS(-DUSE_MG_LIBS)
163 ENDIF(SALOME_USE_MG_LIBS)
166 SALOME_PACKAGE_REPORT_AND_CHECK()
169 # (default values taken from KERNEL)
171 SET(SALOME_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "Install path: SALOME binaries")
172 SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: SALOME libs")
173 SET(SALOME_INSTALL_IDLS "${SALOME_INSTALL_IDLS}" CACHE PATH "Install path: SALOME IDL files")
174 SET(SALOME_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "Install path: SALOME headers")
175 SET(SALOME_INSTALL_SCRIPT_SCRIPTS "${SALOME_INSTALL_SCRIPT_SCRIPTS}" CACHE PATH
176 "Install path: SALOME scripts")
177 SET(SALOME_INSTALL_SCRIPT_DATA "${SALOME_INSTALL_SCRIPT_DATA}" CACHE PATH
178 "Install path: SALOME script data")
179 SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH
180 "Install path: SALOME Python scripts")
181 SET(SALOME_INSTALL_APPLISKEL_SCRIPTS "${SALOME_INSTALL_APPLISKEL_SCRIPTS}" CACHE PATH
182 "Install path: SALOME application skeleton - scripts")
183 SET(SALOME_INSTALL_APPLISKEL_PYTHON "${SALOME_INSTALL_APPLISKEL_PYTHON}" CACHE PATH
184 "Install path: SALOME application skeleton - Python")
185 SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Install path: SALOME Python stuff")
186 SET(SALOME_INSTALL_PYTHON_SHARED "${SALOME_INSTALL_PYTHON_SHARED}" CACHE PATH
187 "Install path: SALOME Python shared modules")
188 SET(SALOME_INSTALL_CMAKE_LOCAL "${SALOME_INSTALL_CMAKE_LOCAL}" CACHE PATH
189 "Install path: local SALOME CMake files")
190 SET(SALOME_INSTALL_AMCONFIG_LOCAL "${SALOME_INSTALL_AMCONFIG_LOCAL}" CACHE PATH
191 "Install path: local SALOME config files (obsolete, to be removed)")
192 SET(SALOME_INSTALL_RES "${SALOME_INSTALL_RES}" CACHE PATH "Install path: SALOME resources")
193 SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME documentation")
195 # Specific to GHS3DPLUGIN:
196 SET(SALOME_GHS3DPLUGIN_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/ghs3dplugin" CACHE PATH
197 "Install path: SALOME GHS3DPLUGIN specific data")
199 MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS)
200 MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON)
201 MARK_AS_ADVANCED(SALOME_INSTALL_APPLISKEL_SCRIPTS SALOME_INSTALL_APPLISKEL_PYTHON SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES)
202 MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED)
203 MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC)
204 MARK_AS_ADVANCED(SALOME_GHS3DPLUGIN_INSTALL_RES_DATA)
206 # Accumulate environment variables for GHS3DPLUGIN module
207 SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS}
208 ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON})
209 SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS})
213 ADD_SUBDIRECTORY(idl)
214 ADD_SUBDIRECTORY(adm_local)
215 ADD_SUBDIRECTORY(resources)
216 ADD_SUBDIRECTORY(src)
217 ADD_SUBDIRECTORY(bin)
219 ADD_SUBDIRECTORY(doc)
220 ENDIF(SALOME_BUILD_DOC)
222 # Header configuration
223 # ====================
224 SALOME_XVERSION(${PROJECT_NAME})
225 SALOME_CONFIGURE_FILE(GHS3DPLUGIN_version.h.in GHS3DPLUGIN_version.h INSTALL ${SALOME_INSTALL_HEADERS})
227 # Configuration export
228 # (here only the level 1 prerequisites are exposed)
229 # ====================
230 INCLUDE(CMakePackageConfigHelpers)
232 # List of targets in this project we want to make visible to the rest of the world.
233 # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
234 SET(_${PROJECT_NAME}_exposed_targets
235 GHS3DEngine SalomeIDLGHS3DPLUGIN
239 LIST(APPEND _${PROJECT_NAME}_exposed_targets
242 ENDIF(SALOME_BUILD_GUI)
244 # Add all targets to the build-tree export set
245 EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
246 FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake)
248 # Create the configuration files:
249 # - in the build tree:
251 # Ensure the variables are always defined for the configure:
252 SET(SMESH_ROOT_DIR "${SMESH_ROOT_DIR}")
253 SET(MESHGEMS_ROOT_DIR "${MESHGEMS_ROOT_DIR}")
255 SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
257 # Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
258 SALOME_CONFIGURE_PREPARE(MESHGEMS)
260 CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
261 ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
262 INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
263 PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
264 SMESH_ROOT_DIR MESHGEMS_ROOT_DIR)
266 WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
267 VERSION ${${PROJECT_NAME_UC}_VERSION}
268 COMPATIBILITY AnyNewerVersion)
270 # Install the CMake configuration files:
272 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
273 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
274 DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}")
276 # Install the export set for use with the install-tree
277 INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
278 FILE ${PROJECT_NAME}Targets.cmake)