1 # Copyright (C) 2013-2016 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(SalomeBLSURFPLUGIN C CXX)
22 # Ensure a proper linker behavior:
23 CMAKE_POLICY(SET CMP0003 NEW)
25 CMAKE_POLICY(SET CMP0020 OLD) # disable automatic linking to qtmain.lib
30 # Project name, upper case
31 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
33 SET(${PROJECT_NAME_UC}_MAJOR_VERSION 8)
34 SET(${PROJECT_NAME_UC}_MINOR_VERSION 5)
35 SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
36 SET(${PROJECT_NAME_UC}_VERSION
37 ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
38 SET(${PROJECT_NAME_UC}_VERSION_DEV 1)
42 SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
43 IF(EXISTS ${CONFIGURATION_ROOT_DIR})
44 LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
47 MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
53 SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
54 IF(EXISTS ${KERNEL_ROOT_DIR})
55 LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
57 FIND_PACKAGE(SalomeKERNEL REQUIRED)
58 KERNEL_WITH_CORBA() # check whether KERNEL builded with CORBA
59 ELSE(EXISTS ${KERNEL_ROOT_DIR})
60 MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
61 ENDIF(EXISTS ${KERNEL_ROOT_DIR})
65 INCLUDE(SalomeSetupPlatform) # From KERNEL
66 # Always build libraries as shared objects:
67 SET(BUILD_SHARED_LIBS TRUE)
71 OPTION(SALOME_BUILD_DOC "Generate SALOME BLSURFPLUGIN documentation" ON)
72 OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON)
74 IF(SALOME_BUILD_TESTS)
79 OPTION(SALOME_BUILD_GUI "Enable BLSURFPLUGIN GUI" ON)
80 MARK_AS_ADVANCED(SALOME_BUILD_GUI)
86 FIND_PACKAGE(SalomePythonInterp REQUIRED)
87 FIND_PACKAGE(SalomePythonLibs REQUIRED)
89 FIND_PACKAGE(SalomeBoost REQUIRED)
91 FIND_PACKAGE(SalomeOmniORB REQUIRED)
92 FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
94 # Other KERNEL optionals:
96 FIND_PACKAGE(SalomeDoxygen)
97 SALOME_LOG_OPTIONAL_PACKAGE(Doxygen SALOME_BUILD_DOC)
100 # Find GUI (optional)
103 SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
104 IF(EXISTS ${GUI_ROOT_DIR})
105 LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
106 FIND_PACKAGE(SalomeGUI)
107 SALOME_GUI_WITH_CORBA() # check whether GUI builded with CORBA
108 SALOME_GUI_MODE(SALOME_USE_SALOMEOBJECT)
109 ADD_DEFINITIONS(${GUI_DEFINITIONS})
110 INCLUDE_DIRECTORIES(${GUI_INCLUDE_DIRS})
111 ELSE(EXISTS ${GUI_ROOT_DIR})
112 MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR")
113 ENDIF(EXISTS ${GUI_ROOT_DIR})
114 SALOME_LOG_OPTIONAL_PACKAGE(SalomeGUI SALOME_BUILD_GUI)
115 ENDIF(SALOME_BUILD_GUI)
122 IF(NOT SALOME_GUI_BUILD_WITH_QT5)
123 FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui)
125 FIND_PACKAGE(SalomeQt5 REQUIRED)
127 ENDIF(SALOME_BUILD_GUI)
130 FIND_PACKAGE(SalomeOpenCASCADE REQUIRED)
132 FIND_PACKAGE(SalomeVTK REQUIRED)
136 SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR} CACHE PATH "Path to the Salome GEOM")
137 IF(EXISTS ${GEOM_ROOT_DIR})
138 LIST(APPEND CMAKE_MODULE_PATH "${GEOM_ROOT_DIR}/adm_local/cmake_files")
139 FIND_PACKAGE(SalomeGEOM REQUIRED)
140 ELSE(EXISTS ${GEOM_ROOT_DIR})
141 MESSAGE(FATAL_ERROR "We absolutely need a Salome GEOM, please define GEOM_ROOT_DIR")
142 ENDIF(EXISTS ${GEOM_ROOT_DIR})
146 SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR} CACHE PATH "Path to the Salome SMESH")
147 IF(EXISTS ${SMESH_ROOT_DIR})
148 LIST(APPEND CMAKE_MODULE_PATH "${SMESH_ROOT_DIR}/adm_local/cmake_files")
149 FIND_PACKAGE(SalomeSMESH REQUIRED)
150 ADD_DEFINITIONS(${SMESH_DEFINITIONS})
151 INCLUDE_DIRECTORIES(${SMESH_INCLUDE_DIRS})
153 IF(NOT SALOME_SMESH_BUILD_GUI)
154 MESSAGE(FATAL_ERROR "We absolutely need a Salome SMESH with GUI, please set SALOME_BUILD_GUI=ON in SMESH module")
155 ENDIF(NOT SALOME_SMESH_BUILD_GUI)
156 ENDIF(SALOME_BUILD_GUI)
158 IF(NOT SALOME_SMESH_BUILD_DOC)
159 MESSAGE(FATAL_ERROR "We absolutely need a Salome SMESH documentation to build BLSURFPLUGIN documentation. "
160 "So, you should either set SALOME_BUILD_DOC=OFF in BLSURFPLUGIN or set SALOME_BUILD_DOC=ON in SMESH module.")
161 ENDIF(NOT SALOME_SMESH_BUILD_DOC)
162 ENDIF(SALOME_BUILD_DOC)
163 ELSE(EXISTS ${SMESH_ROOT_DIR})
164 MESSAGE(FATAL_ERROR "We absolutely need a Salome SMESH, please define SMESH_ROOT_DIR")
165 ENDIF(EXISTS ${SMESH_ROOT_DIR})
168 ## BLSURFPLUGIN specifics
170 FIND_PACKAGE(SalomeMESHGEMS REQUIRED)
173 SALOME_PACKAGE_REPORT_AND_CHECK()
176 # (default values taken from KERNEL)
178 SET(SALOME_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "Install path: SALOME binaries")
179 SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: SALOME libs")
180 SET(SALOME_INSTALL_IDLS "${SALOME_INSTALL_IDLS}" CACHE PATH "Install path: SALOME IDL files")
181 SET(SALOME_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "Install path: SALOME headers")
182 SET(SALOME_INSTALL_SCRIPT_SCRIPTS "${SALOME_INSTALL_SCRIPT_SCRIPTS}" CACHE PATH
183 "Install path: SALOME scripts")
184 SET(SALOME_INSTALL_SCRIPT_DATA "${SALOME_INSTALL_SCRIPT_DATA}" CACHE PATH
185 "Install path: SALOME script data")
186 SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH
187 "Install path: SALOME Python scripts")
188 SET(SALOME_INSTALL_APPLISKEL_SCRIPTS "${SALOME_INSTALL_APPLISKEL_SCRIPTS}" CACHE PATH
189 "Install path: SALOME application skeleton - scripts")
190 SET(SALOME_INSTALL_APPLISKEL_PYTHON "${SALOME_INSTALL_APPLISKEL_PYTHON}" CACHE PATH
191 "Install path: SALOME application skeleton - Python")
192 SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Install path: SALOME Python stuff")
193 SET(SALOME_INSTALL_PYTHON_SHARED "${SALOME_INSTALL_PYTHON_SHARED}" CACHE PATH
194 "Install path: SALOME Python shared modules")
195 SET(SALOME_INSTALL_CMAKE_LOCAL "${SALOME_INSTALL_CMAKE_LOCAL}" CACHE PATH
196 "Install path: local SALOME CMake files")
197 SET(SALOME_INSTALL_AMCONFIG_LOCAL "${SALOME_INSTALL_AMCONFIG_LOCAL}" CACHE PATH
198 "Install path: local SALOME config files (obsolete, to be removed)")
199 SET(SALOME_INSTALL_RES "${SALOME_INSTALL_RES}" CACHE PATH "Install path: SALOME resources")
200 SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME documentation")
202 # Specific to BLSURFPLUGIN:
203 SET(SALOME_BLSURFPLUGIN_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/blsurfplugin" CACHE PATH
204 "Install path: SALOME BLSURFPLUGIN specific data")
205 SET(SALOME_BLSURFPLUGIN_INSTALL_TESTS "${SALOME_INSTALL_BINS}/test")
207 MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS)
208 MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON)
209 MARK_AS_ADVANCED(SALOME_INSTALL_APPLISKEL_SCRIPTS SALOME_INSTALL_APPLISKEL_PYTHON SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES)
210 MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED)
211 MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC)
212 MARK_AS_ADVANCED(SALOME_BLSURFPLUGIN_INSTALL_RES_DATA SALOME_BLSURFPLUGIN_INSTALL_TESTS)
214 # Accumulate environment variables for BLSURFPLUGIN module
215 SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS}
216 ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON})
217 SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS})
222 ADD_SUBDIRECTORY(idl)
223 ADD_SUBDIRECTORY(adm_local)
224 ADD_SUBDIRECTORY(resources)
225 ADD_SUBDIRECTORY(src)
226 ADD_SUBDIRECTORY(bin)
228 ADD_SUBDIRECTORY(doc)
229 ENDIF(SALOME_BUILD_DOC)
230 IF(SALOME_BUILD_TESTS)
231 ADD_SUBDIRECTORY(tests)
232 ENDIF(SALOME_BUILD_TESTS)
234 # Header configuration
235 # ====================
236 SALOME_XVERSION(${PROJECT_NAME})
237 SALOME_CONFIGURE_FILE(BLSURFPLUGIN_version.h.in BLSURFPLUGIN_version.h INSTALL ${SALOME_INSTALL_HEADERS})
239 # Configuration export
240 # (here only the level 1 prerequisites are exposed)
241 # ====================
242 INCLUDE(CMakePackageConfigHelpers)
244 # List of targets in this project we want to make visible to the rest of the world.
245 # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
246 SET(_${PROJECT_NAME}_exposed_targets
247 BLSURFEngine SalomeIDLBLSURFPLUGIN
251 LIST(APPEND _${PROJECT_NAME}_exposed_targets
254 ENDIF(SALOME_BUILD_GUI)
256 # Add all targets to the build-tree export set
257 EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
258 FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake)
260 # Create the configuration files:
261 # - in the build tree:
263 # Ensure the variables are always defined for the configure:
264 SET(SMESH_ROOT_DIR "${SMESH_ROOT_DIR}")
265 SET(MESHGEMS_ROOT_DIR "${MESHGEMS_ROOT_DIR}")
267 SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
269 # Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
270 SALOME_CONFIGURE_PREPARE(MESHGEMS)
272 CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
273 ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
274 INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
275 PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
276 SMESH_ROOT_DIR MESHGEMS_ROOT_DIR)
278 WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
279 VERSION ${${PROJECT_NAME_UC}_VERSION}
280 COMPATIBILITY AnyNewerVersion)
282 # Install the CMake configuration files:
284 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
285 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
286 DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}")
288 # Install the export set for use with the install-tree
289 INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
290 FILE ${PROJECT_NAME}Targets.cmake)