1 # Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE
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.
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)
27 # Project name, upper case
28 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
30 SET(${PROJECT_NAME_UC}_MAJOR_VERSION 7)
31 SET(${PROJECT_NAME_UC}_MINOR_VERSION 2)
32 SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
33 SET(${PROJECT_NAME_UC}_VERSION
34 ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
35 SET(${PROJECT_NAME_UC}_VERSION_DEV 1)
39 SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
40 IF(EXISTS ${KERNEL_ROOT_DIR})
41 LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
43 FIND_PACKAGE(SalomeKERNEL REQUIRED)
44 ELSE(EXISTS ${KERNEL_ROOT_DIR})
45 MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
46 ENDIF(EXISTS ${KERNEL_ROOT_DIR})
49 MESSAGE(FATAL_ERROR "BLSURFPLUGIN module can't be built in Light mode (without CORBA)")
54 INCLUDE(SalomeSetupPlatform) # From KERNEL
55 # Always build libraries as shared objects:
56 SET(BUILD_SHARED_LIBS TRUE)
58 LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local/cmake_files")
61 # (some options have already been defined in KERNEL)
63 OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ${SALOME_BUILD_TESTS})
64 OPTION(SALOME_BUILD_DOC "Generate SALOME BLSURFPLUGIN documentation" ${SALOME_BUILD_DOC})
67 OPTION(SALOME_BUILD_GUI "Enable BLSURFPLUGIN GUI" ON)
68 MARK_AS_ADVANCED(SALOME_BUILD_GUI)
74 FIND_PACKAGE(SalomePython REQUIRED)
76 FIND_PACKAGE(SalomeBoost REQUIRED)
78 FIND_PACKAGE(SalomeOmniORB REQUIRED)
79 FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
81 # Other KERNEL optionals:
83 FIND_PACKAGE(SalomeDoxygen)
84 SALOME_LOG_OPTIONAL_PACKAGE(Doxygen SALOME_BUILD_DOC)
90 SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
91 IF(EXISTS ${GUI_ROOT_DIR})
92 LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
93 FIND_PACKAGE(SalomeGUI)
94 ELSE(EXISTS ${GUI_ROOT_DIR})
95 MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR")
96 ENDIF(EXISTS ${GUI_ROOT_DIR})
97 SALOME_LOG_OPTIONAL_PACKAGE(SalomeGUI SALOME_BUILD_GUI)
98 ENDIF(SALOME_BUILD_GUI)
105 FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui)
106 ENDIF(SALOME_BUILD_GUI)
109 FIND_PACKAGE(SalomeCAS REQUIRED)
111 FIND_PACKAGE(SalomeVTK 6.0 REQUIRED)
115 SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR} CACHE PATH "Path to the Salome GEOM")
116 IF(EXISTS ${GEOM_ROOT_DIR})
117 LIST(APPEND CMAKE_MODULE_PATH "${GEOM_ROOT_DIR}/adm_local/cmake_files")
118 FIND_PACKAGE(SalomeGEOM REQUIRED)
119 ELSE(EXISTS ${GEOM_ROOT_DIR})
120 MESSAGE(FATAL_ERROR "We absolutely need a Salome GEOM, please define GEOM_ROOT_DIR")
121 ENDIF(EXISTS ${GEOM_ROOT_DIR})
125 SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR} CACHE PATH "Path to the Salome SMESH")
126 IF(EXISTS ${SMESH_ROOT_DIR})
127 LIST(APPEND CMAKE_MODULE_PATH "${SMESH_ROOT_DIR}/adm_local/cmake_files")
128 FIND_PACKAGE(SalomeSMESH REQUIRED)
129 ELSE(EXISTS ${SMESH_ROOT_DIR})
130 MESSAGE(FATAL_ERROR "We absolutely need a Salome SMESH, please define SMESH_ROOT_DIR")
131 ENDIF(EXISTS ${SMESH_ROOT_DIR})
134 ## BLSURFPLUGIN specifics
136 FIND_PACKAGE(SalomeMESHGEMS REQUIRED)
139 SALOME_PACKAGE_REPORT_AND_CHECK()
142 # (default values taken from KERNEL)
144 SET(SALOME_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "Install path: SALOME binaries")
145 SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: SALOME libs")
146 SET(SALOME_INSTALL_IDLS "${SALOME_INSTALL_IDLS}" CACHE PATH "Install path: SALOME IDL files")
147 SET(SALOME_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "Install path: SALOME headers")
148 SET(SALOME_INSTALL_SCRIPT_SCRIPTS "${SALOME_INSTALL_SCRIPT_SCRIPTS}" CACHE PATH
149 "Install path: SALOME scripts")
150 SET(SALOME_INSTALL_SCRIPT_DATA "${SALOME_INSTALL_SCRIPT_DATA}" CACHE PATH
151 "Install path: SALOME script data")
152 SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH
153 "Install path: SALOME Python scripts")
154 SET(SALOME_INSTALL_APPLISKEL_SCRIPTS "${SALOME_INSTALL_APPLISKEL_SCRIPTS}" CACHE PATH
155 "Install path: SALOME application skeleton - scripts")
156 SET(SALOME_INSTALL_APPLISKEL_PYTHON "${SALOME_INSTALL_APPLISKEL_PYTHON}" CACHE PATH
157 "Install path: SALOME application skeleton - Python")
158 SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Install path: SALOME Python stuff")
159 SET(SALOME_INSTALL_PYTHON_SHARED "${SALOME_INSTALL_PYTHON_SHARED}" CACHE PATH
160 "Install path: SALOME Python shared modules")
161 SET(SALOME_INSTALL_CMAKE_LOCAL "${SALOME_INSTALL_CMAKE_LOCAL}" CACHE PATH
162 "Install path: local SALOME CMake files")
163 SET(SALOME_INSTALL_AMCONFIG_LOCAL "${SALOME_INSTALL_AMCONFIG_LOCAL}" CACHE PATH
164 "Install path: local SALOME config files (obsolete, to be removed)")
165 SET(SALOME_INSTALL_RES "${SALOME_INSTALL_RES}" CACHE PATH "Install path: SALOME resources")
166 SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME documentation")
168 # Specific to BLSURFPLUGIN:
169 SET(SALOME_BLSURFPLUGIN_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/blsurfplugin" CACHE PATH
170 "Install path: SALOME BLSURFPLUGIN specific data")
171 SET(SALOME_BLSURFPLUGIN_INSTALL_TESTS ${SALOME_INSTALL_BINS})
173 MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS)
174 MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON)
175 MARK_AS_ADVANCED(SALOME_INSTALL_APPLISKEL_SCRIPTS SALOME_INSTALL_APPLISKEL_PYTHON SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES)
176 MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED)
177 MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC)
178 MARK_AS_ADVANCED(SALOME_BLSURFPLUGIN_INSTALL_RES_DATA SALOME_BLSURFPLUGIN_INSTALL_TESTS)
183 ADD_SUBDIRECTORY(idl)
184 ADD_SUBDIRECTORY(adm_local)
185 ADD_SUBDIRECTORY(resources)
186 ADD_SUBDIRECTORY(src)
187 ADD_SUBDIRECTORY(bin)
189 ADD_SUBDIRECTORY(doc)
190 ENDIF(SALOME_BUILD_DOC)
191 IF(SALOME_BUILD_TESTS)
192 ADD_SUBDIRECTORY(tests)
193 ENDIF(SALOME_BUILD_TESTS)
195 # Header configuration
196 # ====================
197 SALOME_XVERSION(${PROJECT_NAME})
198 SALOME_CONFIGURE_FILE(BLSURFPLUGIN_version.h.in BLSURFPLUGIN_version.h INSTALL ${SALOME_INSTALL_HEADERS})
200 # Configuration export
201 # (here only the level 1 prerequisites are exposed)
202 # ====================
203 INCLUDE(CMakePackageConfigHelpers)
205 # List of targets in this project we want to make visible to the rest of the world.
206 # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
207 SET(_${PROJECT_NAME}_exposed_targets
208 BLSURFEngine SalomeIDLBLSURFPLUGIN
212 LIST(APPEND _${PROJECT_NAME}_exposed_targets
215 ENDIF(SALOME_BUILD_GUI)
217 # Add all targets to the build-tree export set
218 EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
219 FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake)
221 # Create the configuration files:
222 # - in the build tree:
224 # Ensure the variables are always defined for the configure:
225 SET(SMESH_ROOT_DIR "${SMESH_ROOT_DIR}")
226 SET(MESHGEMS_ROOT_DIR "${BLSURF_ROOT_DIR}")
228 SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
229 CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
230 ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
231 INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
232 PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
233 SMESH_ROOT_DIR MESHGEMS_ROOT_DIR)
235 WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
236 VERSION ${${PROJECT_NAME_UC}_VERSION}
237 COMPATIBILITY AnyNewerVersion)
239 # Install the CMake configuration files:
241 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
242 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
243 DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}")
245 # Install the export set for use with the install-tree
246 INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
247 FILE ${PROJECT_NAME}Targets.cmake)