1 # Copyright (C) 2012-2014 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, 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)
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 5)
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 0)
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 GHS3DPLUGIN documentation" ON)
62 IF(SALOME_BUILD_TESTS)
67 OPTION(SALOME_BUILD_GUI "Enable GUI" ON)
75 FIND_PACKAGE(SalomePython REQUIRED)
77 FIND_PACKAGE(SalomeBoost REQUIRED)
79 FIND_PACKAGE(SalomeOmniORB REQUIRED)
80 FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
82 # Other KERNEL optionals:
84 FIND_PACKAGE(SalomeDoxygen)
85 SALOME_LOG_OPTIONAL_PACKAGE(Doxygen SALOME_BUILD_DOC)
91 SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
92 IF(EXISTS ${GUI_ROOT_DIR})
93 LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
94 FIND_PACKAGE(SalomeGUI)
95 FULL_GUI(TRUE) # check whether GUI builded in full mode and with CORBA
96 ADD_DEFINITIONS(${GUI_DEFINITIONS})
97 INCLUDE_DIRECTORIES(${GUI_INCLUDE_DIRS})
98 ELSE(EXISTS ${GUI_ROOT_DIR})
99 MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR")
100 ENDIF(EXISTS ${GUI_ROOT_DIR})
101 SALOME_LOG_OPTIONAL_PACKAGE(SalomeGUI SALOME_BUILD_GUI)
102 ENDIF(SALOME_BUILD_GUI)
110 FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui)
111 ENDIF(SALOME_BUILD_GUI)
113 FIND_PACKAGE(SalomeCAS REQUIRED)
115 FIND_PACKAGE(SalomeVTK REQUIRED)
120 SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR} CACHE PATH "Path to the Salome GEOM")
121 IF(EXISTS ${GEOM_ROOT_DIR})
122 LIST(APPEND CMAKE_MODULE_PATH "${GEOM_ROOT_DIR}/adm_local/cmake_files")
123 FIND_PACKAGE(SalomeGEOM REQUIRED)
124 ELSE(EXISTS ${GEOM_ROOT_DIR})
125 MESSAGE(FATAL_ERROR "We absolutely need a Salome GEOM, please define GEOM_ROOT_DIR")
126 ENDIF(EXISTS ${GEOM_ROOT_DIR})
131 SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR} CACHE PATH "Path to the Salome SMESH")
132 IF(EXISTS ${SMESH_ROOT_DIR})
133 LIST(APPEND CMAKE_MODULE_PATH "${SMESH_ROOT_DIR}/adm_local/cmake_files")
134 FIND_PACKAGE(SalomeSMESH REQUIRED)
135 ADD_DEFINITIONS(${SMESH_DEFINITIONS})
136 INCLUDE_DIRECTORIES(${SMESH_INCLUDE_DIRS})
138 IF(NOT SALOME_SMESH_BUILD_GUI)
139 MESSAGE(FATAL_ERROR "We absolutely need a Salome SMESH with GUI, please set SALOME_BUILD_GUI=ON in SMESH module")
140 ENDIF(NOT SALOME_SMESH_BUILD_GUI)
141 ENDIF(SALOME_BUILD_GUI)
143 IF(NOT SALOME_SMESH_BUILD_DOC)
144 MESSAGE(FATAL_ERROR "We absolutely need a Salome SMESH documentation to build GHS3DPLUGIN documentation. "
145 "So, you should either set SALOME_BUILD_DOC=OFF in GHS3DPLUGIN or set SALOME_BUILD_DOC=ON in SMESH module.")
146 ENDIF(NOT SALOME_SMESH_BUILD_DOC)
147 ENDIF(SALOME_BUILD_DOC)
148 ELSE(EXISTS ${SMESH_ROOT_DIR})
149 MESSAGE(FATAL_ERROR "We absolutely need a Salome SMESH, please define SMESH_ROOT_DIR")
150 ENDIF(EXISTS ${SMESH_ROOT_DIR})
153 SALOME_PACKAGE_REPORT_AND_CHECK()
156 # (default values taken from KERNEL)
158 SET(SALOME_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "Install path: SALOME binaries")
159 SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: SALOME libs")
160 SET(SALOME_INSTALL_IDLS "${SALOME_INSTALL_IDLS}" CACHE PATH "Install path: SALOME IDL files")
161 SET(SALOME_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "Install path: SALOME headers")
162 SET(SALOME_INSTALL_SCRIPT_SCRIPTS "${SALOME_INSTALL_SCRIPT_SCRIPTS}" CACHE PATH
163 "Install path: SALOME scripts")
164 SET(SALOME_INSTALL_SCRIPT_DATA "${SALOME_INSTALL_SCRIPT_DATA}" CACHE PATH
165 "Install path: SALOME script data")
166 SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH
167 "Install path: SALOME Python scripts")
168 SET(SALOME_INSTALL_APPLISKEL_SCRIPTS "${SALOME_INSTALL_APPLISKEL_SCRIPTS}" CACHE PATH
169 "Install path: SALOME application skeleton - scripts")
170 SET(SALOME_INSTALL_APPLISKEL_PYTHON "${SALOME_INSTALL_APPLISKEL_PYTHON}" CACHE PATH
171 "Install path: SALOME application skeleton - Python")
172 SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Install path: SALOME Python stuff")
173 SET(SALOME_INSTALL_PYTHON_SHARED "${SALOME_INSTALL_PYTHON_SHARED}" CACHE PATH
174 "Install path: SALOME Python shared modules")
175 SET(SALOME_INSTALL_CMAKE_LOCAL "${SALOME_INSTALL_CMAKE_LOCAL}" CACHE PATH
176 "Install path: local SALOME CMake files")
177 SET(SALOME_INSTALL_AMCONFIG_LOCAL "${SALOME_INSTALL_AMCONFIG_LOCAL}" CACHE PATH
178 "Install path: local SALOME config files (obsolete, to be removed)")
179 SET(SALOME_INSTALL_RES "${SALOME_INSTALL_RES}" CACHE PATH "Install path: SALOME resources")
180 SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME documentation")
182 # Specific to GHS3DPLUGIN:
183 SET(SALOME_GHS3DPLUGIN_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/ghs3dplugin" CACHE PATH
184 "Install path: SALOME GHS3DPLUGIN specific data")
186 MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS)
187 MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON)
188 MARK_AS_ADVANCED(SALOME_INSTALL_APPLISKEL_SCRIPTS SALOME_INSTALL_APPLISKEL_PYTHON SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES)
189 MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED)
190 MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC)
191 MARK_AS_ADVANCED(SALOME_GHS3DPLUGIN_INSTALL_RES_DATA)
193 # Accumulate environment variables for GHS3DPLUGIN module
194 SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS}
195 ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON})
196 SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS})
200 ADD_SUBDIRECTORY(idl)
201 ADD_SUBDIRECTORY(adm_local)
202 ADD_SUBDIRECTORY(resources)
203 ADD_SUBDIRECTORY(src)
204 ADD_SUBDIRECTORY(bin)
206 ADD_SUBDIRECTORY(doc)
207 ENDIF(SALOME_BUILD_DOC)
209 # Header configuration
210 # ====================
211 SALOME_XVERSION(${PROJECT_NAME})
212 SALOME_CONFIGURE_FILE(GHS3DPLUGIN_version.h.in GHS3DPLUGIN_version.h INSTALL ${SALOME_INSTALL_HEADERS})
214 # Configuration export
215 # (here only the level 1 prerequisites are exposed)
216 # ====================
217 INCLUDE(CMakePackageConfigHelpers)
219 # List of targets in this project we want to make visible to the rest of the world.
220 # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
221 SET(_${PROJECT_NAME}_exposed_targets
222 GHS3DEngine SalomeIDLGHS3DPLUGIN
226 LIST(APPEND _${PROJECT_NAME}_exposed_targets
229 ENDIF(SALOME_BUILD_GUI)
231 # Add all targets to the build-tree export set
232 EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
233 FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake)
235 # Create the configuration files:
236 # - in the build tree:
238 # Ensure the variables are always defined for the configure:
239 SET(SMESH_ROOT_DIR "${SMESH_ROOT_DIR}")
241 SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
243 # Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
244 # SALOME_CONFIGURE_PREPARE() #For use in the future
246 CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
247 ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
248 INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
249 PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
252 WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
253 VERSION ${${PROJECT_NAME_UC}_VERSION}
254 COMPATIBILITY AnyNewerVersion)
256 # Install the CMake configuration files:
258 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
259 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
260 DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}")
262 # Install the export set for use with the install-tree
263 INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
264 FILE ${PROJECT_NAME}Targets.cmake)