1 # Copyright (C) 2012-2014 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(SalomeHexoticPLUGIN 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 4)
32 SET(${PROJECT_NAME_UC}_PATCH_VERSION 1)
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 KERNEL_WITH_CORBA() # check whether KERNEL builded with CORBA
45 ELSE(EXISTS ${KERNEL_ROOT_DIR})
46 MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
47 ENDIF(EXISTS ${KERNEL_ROOT_DIR})
51 INCLUDE(SalomeSetupPlatform) # From KERNEL
52 # Always build libraries as shared objects:
53 SET(BUILD_SHARED_LIBS TRUE)
55 LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local/cmake_files")
59 OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON)
60 OPTION(SALOME_BUILD_DOC "Generate SALOME HexoticPLUGIN documentation" ON)
62 IF(SALOME_BUILD_TESTS)
67 OPTION(SALOME_BUILD_GUI "Enable HexoticPLUGIN GUI" ON)
68 MARK_AS_ADVANCED(SALOME_BUILD_GUI)
69 OPTION(SALOME_HEXOTICPLUGIN_USE_BLSURFPLUGIN "Enable using BLSURFPLUGIN" ON)
70 MARK_AS_ADVANCED(SALOME_HEXOTICPLUGIN_USE_BLSURFPLUGIN)
77 FIND_PACKAGE(SalomePython REQUIRED)
79 FIND_PACKAGE(SalomeBoost REQUIRED)
81 FIND_PACKAGE(SalomeOmniORB REQUIRED)
82 FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
85 # Other KERNEL optionals:
87 FIND_PACKAGE(SalomeDoxygen)
88 SALOME_LOG_OPTIONAL_PACKAGE(Doxygen SALOME_BUILD_DOC)
94 SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
95 IF(EXISTS ${GUI_ROOT_DIR})
96 LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
97 FIND_PACKAGE(SalomeGUI)
98 FULL_GUI(TRUE) # check whether GUI builded in full mode and with CORBA
99 ADD_DEFINITIONS(${GUI_DEFINITIONS})
100 INCLUDE_DIRECTORIES(${GUI_INCLUDE_DIRS})
101 ELSE(EXISTS ${GUI_ROOT_DIR})
102 MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR")
103 ENDIF(EXISTS ${GUI_ROOT_DIR})
104 SALOME_LOG_OPTIONAL_PACKAGE(SalomeGUI SALOME_BUILD_GUI)
105 ENDIF(SALOME_BUILD_GUI)
113 FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui)
114 ENDIF(SALOME_BUILD_GUI)
117 FIND_PACKAGE(SalomeCAS REQUIRED)
119 FIND_PACKAGE(SalomeVTK 6.1 REQUIRED)
124 SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR} CACHE PATH "Path to the Salome GEOM")
125 IF(EXISTS ${GEOM_ROOT_DIR})
126 LIST(APPEND CMAKE_MODULE_PATH "${GEOM_ROOT_DIR}/adm_local/cmake_files")
127 FIND_PACKAGE(SalomeGEOM REQUIRED)
128 ELSE(EXISTS ${GEOM_ROOT_DIR})
129 MESSAGE(FATAL_ERROR "We absolutely need a Salome GEOM, please define GEOM_ROOT_DIR")
130 ENDIF(EXISTS ${GEOM_ROOT_DIR})
135 SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR} CACHE PATH "Path to the Salome SMESH")
136 IF(EXISTS ${SMESH_ROOT_DIR})
137 LIST(APPEND CMAKE_MODULE_PATH "${SMESH_ROOT_DIR}/adm_local/cmake_files")
138 FIND_PACKAGE(SalomeSMESH REQUIRED)
139 ADD_DEFINITIONS(${SMESH_DEFINITIONS})
140 INCLUDE_DIRECTORIES(${SMESH_INCLUDE_DIRS})
142 IF(NOT SALOME_SMESH_BUILD_DOC)
143 MESSAGE(FATAL_ERROR "We absolutely need a Salome SMESH documentation to build HexoticPLUGIN documentation. "
144 "So, you should either set SALOME_BUILD_DOC=OFF in HexoticPLUGIN or set SALOME_BUILD_DOC=ON in SMESH module.")
145 ENDIF(NOT SALOME_SMESH_BUILD_DOC)
146 ENDIF(SALOME_BUILD_DOC)
147 ELSE(EXISTS ${SMESH_ROOT_DIR})
148 MESSAGE(FATAL_ERROR "We absolutely need a Salome SMESH, please define SMESH_ROOT_DIR")
149 ENDIF(EXISTS ${SMESH_ROOT_DIR})
151 # Find BLSURFPLUGIN (optional)
154 IF(SALOME_HEXOTICPLUGIN_USE_BLSURFPLUGIN)
155 SET(BLSURFPLUGIN_ROOT_DIR $ENV{BLSURFPLUGIN_ROOT_DIR} CACHE PATH "Path to the Salome BLSURFPLUGIN")
156 IF(EXISTS ${BLSURFPLUGIN_ROOT_DIR})
157 LIST(APPEND CMAKE_MODULE_PATH "${BLSURFPLUGIN_ROOT_DIR}/adm_local/cmake_files")
158 FIND_PACKAGE(SalomeBLSURFPLUGIN)
159 SALOME_LOG_OPTIONAL_PACKAGE(SalomeBLSURFPLUGIN WITH_BLSURFPLUGIN)
161 ENDIF(EXISTS ${BLSURFPLUGIN_ROOT_DIR})
162 IF(SalomeBLSURFPLUGIN_FOUND)
163 ADD_DEFINITIONS(-DWITH_BLSURFPLUGIN)
165 ENDIF(SALOME_HEXOTICPLUGIN_USE_BLSURFPLUGIN)
169 SALOME_PACKAGE_REPORT_AND_CHECK()
172 # (default values taken from KERNEL)
174 SET(SALOME_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "Install path: SALOME binaries")
175 SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: SALOME libs")
176 SET(SALOME_INSTALL_IDLS "${SALOME_INSTALL_IDLS}" CACHE PATH "Install path: SALOME IDL files")
177 SET(SALOME_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "Install path: SALOME headers")
178 SET(SALOME_INSTALL_SCRIPT_SCRIPTS "${SALOME_INSTALL_SCRIPT_SCRIPTS}" CACHE PATH
179 "Install path: SALOME scripts")
180 SET(SALOME_INSTALL_SCRIPT_DATA "${SALOME_INSTALL_SCRIPT_DATA}" CACHE PATH
181 "Install path: SALOME script data")
182 SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH
183 "Install path: SALOME Python scripts")
184 SET(SALOME_INSTALL_APPLISKEL_SCRIPTS "${SALOME_INSTALL_APPLISKEL_SCRIPTS}" CACHE PATH
185 "Install path: SALOME application skeleton - scripts")
186 SET(SALOME_INSTALL_APPLISKEL_PYTHON "${SALOME_INSTALL_APPLISKEL_PYTHON}" CACHE PATH
187 "Install path: SALOME application skeleton - Python")
188 SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Install path: SALOME Python stuff")
189 SET(SALOME_INSTALL_PYTHON_SHARED "${SALOME_INSTALL_PYTHON_SHARED}" CACHE PATH
190 "Install path: SALOME Python shared modules")
191 SET(SALOME_INSTALL_CMAKE_LOCAL "${SALOME_INSTALL_CMAKE_LOCAL}" CACHE PATH
192 "Install path: local SALOME CMake files")
193 SET(SALOME_INSTALL_AMCONFIG_LOCAL "${SALOME_INSTALL_AMCONFIG_LOCAL}" CACHE PATH
194 "Install path: local SALOME config files (obsolete, to be removed)")
195 SET(SALOME_INSTALL_RES "${SALOME_INSTALL_RES}" CACHE PATH "Install path: SALOME resources")
196 SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME documentation")
198 # Specific to HexoticPLUGIN:
199 SET(SALOME_HexoticPLUGIN_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/hexoticplugin" CACHE PATH
200 "Install path: SALOME HexoticPLUGIN specific data")
202 MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS)
203 MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON)
204 MARK_AS_ADVANCED(SALOME_INSTALL_APPLISKEL_SCRIPTS SALOME_INSTALL_APPLISKEL_PYTHON SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES)
205 MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED)
206 MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC)
207 MARK_AS_ADVANCED(SALOME_HexoticPLUGIN_INSTALL_RES_DATA)
209 # Accumulate environment variables for HexoticPLUGIN module
210 SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS}
211 ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON})
212 SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS})
217 ADD_SUBDIRECTORY(idl)
218 ADD_SUBDIRECTORY(adm_local)
219 ADD_SUBDIRECTORY(resources)
220 ADD_SUBDIRECTORY(src)
221 ADD_SUBDIRECTORY(bin)
223 ADD_SUBDIRECTORY(doc)
224 ENDIF(SALOME_BUILD_DOC)
226 # Header configuration
227 # ====================
228 SALOME_XVERSION(${PROJECT_NAME})
229 SALOME_CONFIGURE_FILE(HexoticPLUGIN_version.h.in HexoticPLUGIN_version.h INSTALL ${SALOME_INSTALL_HEADERS})
231 # Configuration export
232 # (here only the level 1 prerequisites are exposed)
233 # ====================
234 INCLUDE(CMakePackageConfigHelpers)
236 # List of targets in this project we want to make visible to the rest of the world.
237 # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
238 SET(_${PROJECT_NAME}_exposed_targets
239 HexoticEngine SalomeIDLHexoticPLUGIN
243 LIST(APPEND _${PROJECT_NAME}_exposed_targets
246 ENDIF(SALOME_BUILD_GUI)
248 # Add all targets to the build-tree export set
249 EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
250 FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake)
252 # Create the configuration files:
253 # - in the build tree:
255 # Ensure the variables are always defined for the configure:
256 SET(SMESH_ROOT_DIR "${SMESH_ROOT_DIR}")
258 SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
260 # Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
261 # SALOME_CONFIGURE_PREPARE() #For use in the future
263 CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
264 ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
265 INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
266 PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
269 WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
270 VERSION ${${PROJECT_NAME_UC}_VERSION}
271 COMPATIBILITY AnyNewerVersion)
273 # Install the CMake configuration files:
275 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
276 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
277 DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}")
279 # Install the export set for use with the install-tree
280 INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
281 FILE ${PROJECT_NAME}Targets.cmake)