]> SALOME platform Git repositories - plugins/hexoticplugin.git/blob - CMakeLists.txt
Salome HOME
Switch on dev version flag
[plugins/hexoticplugin.git] / CMakeLists.txt
1 # Copyright (C) 2012-2014  CEA/DEN, EDF R&D
2 #
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.
7 #
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.
12 #
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
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
20 PROJECT(SalomeHexoticPLUGIN C CXX)
21
22 # Ensure a proper linker behavior:
23 CMAKE_POLICY(SET CMP0003 NEW)
24
25 # Versioning
26 # ===========
27 # Project name, upper case
28 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
29
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)
36
37 # Find KERNEL
38 # ===========
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")
42   INCLUDE(SalomeMacros)
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})
48
49 # Platform setup
50 # ==============
51 INCLUDE(SalomeSetupPlatform)   # From KERNEL
52 # Always build libraries as shared objects:
53 SET(BUILD_SHARED_LIBS TRUE)
54 # Local macros:
55 LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local/cmake_files")
56
57 # User options
58 # ============
59 OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON)
60 OPTION(SALOME_BUILD_DOC "Generate SALOME HexoticPLUGIN documentation" ON)
61
62 IF(SALOME_BUILD_TESTS)
63   ENABLE_TESTING()
64 ENDIF()
65
66 # Advanced options:
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)
71 ##
72 ## From KERNEL:
73 ##
74
75 # Various
76 # Python
77 FIND_PACKAGE(SalomePython REQUIRED)
78 # Boost
79 FIND_PACKAGE(SalomeBoost REQUIRED)
80 # CORBA
81 FIND_PACKAGE(SalomeOmniORB REQUIRED)
82 FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
83
84
85 # Other KERNEL optionals:
86 IF(SALOME_BUILD_DOC)
87   FIND_PACKAGE(SalomeDoxygen)
88   SALOME_LOG_OPTIONAL_PACKAGE(Doxygen SALOME_BUILD_DOC)
89 ENDIF()
90
91 # Find GUI (optional)
92 # ===========
93 IF(SALOME_BUILD_GUI)
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)
106
107 ##
108 ## From GUI:
109 ##
110
111 IF(SALOME_BUILD_GUI)
112   # Qt4
113   FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui)
114 ENDIF(SALOME_BUILD_GUI)
115
116 # OCCT
117 FIND_PACKAGE(SalomeCAS REQUIRED)
118 # VTK
119 FIND_PACKAGE(SalomeVTK 6.1 REQUIRED)
120
121 # Find GEOM
122 # ===========
123
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})
131
132 # Find SMESH
133 # ===========
134
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})
141   IF(SALOME_BUILD_DOC)
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})
150
151 # Find BLSURFPLUGIN (optional)
152 # ===========
153
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)
160
161   ENDIF(EXISTS ${BLSURFPLUGIN_ROOT_DIR})
162   IF(SalomeBLSURFPLUGIN_FOUND)
163     ADD_DEFINITIONS(-DWITH_BLSURFPLUGIN)
164   ENDIF()
165 ENDIF(SALOME_HEXOTICPLUGIN_USE_BLSURFPLUGIN)
166
167
168 # Detection summary:
169 SALOME_PACKAGE_REPORT_AND_CHECK()
170
171 # Directories
172 # (default values taken from KERNEL)
173 # ===========
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")
197
198 # Specific to HexoticPLUGIN:
199 SET(SALOME_HexoticPLUGIN_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/hexoticplugin" CACHE PATH 
200     "Install path: SALOME HexoticPLUGIN specific data")
201
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)
208
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})
213
214 # Sources 
215 # ========
216
217 ADD_SUBDIRECTORY(idl)
218 ADD_SUBDIRECTORY(adm_local)
219 ADD_SUBDIRECTORY(resources)
220 ADD_SUBDIRECTORY(src)
221 ADD_SUBDIRECTORY(bin)
222 IF(SALOME_BUILD_DOC)
223   ADD_SUBDIRECTORY(doc)
224 ENDIF(SALOME_BUILD_DOC)
225
226 # Header configuration
227 # ====================
228 SALOME_XVERSION(${PROJECT_NAME})
229 SALOME_CONFIGURE_FILE(HexoticPLUGIN_version.h.in HexoticPLUGIN_version.h INSTALL ${SALOME_INSTALL_HEADERS})
230
231 # Configuration export
232 # (here only the level 1 prerequisites are exposed)
233 # ====================
234 INCLUDE(CMakePackageConfigHelpers)
235
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
240 )
241
242 IF(SALOME_BUILD_GUI)
243   LIST(APPEND _${PROJECT_NAME}_exposed_targets 
244     HexoticPluginGUI
245   )
246 ENDIF(SALOME_BUILD_GUI)
247
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)
251
252 # Create the configuration files:
253 #   - in the build tree:
254
255 # Ensure the variables are always defined for the configure:
256 SET(SMESH_ROOT_DIR "${SMESH_ROOT_DIR}")
257  
258 SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
259
260 # Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
261 # SALOME_CONFIGURE_PREPARE() #For use in the future
262
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
267     SMESH_ROOT_DIR)
268
269 WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
270     VERSION ${${PROJECT_NAME_UC}_VERSION}
271     COMPATIBILITY AnyNewerVersion)
272   
273 # Install the CMake configuration files:
274 INSTALL(FILES
275   "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
276   "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
277   DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}")
278
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)