1 # Copyright (C) 2012-2020 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(SalomeSIERPINSKY C CXX)
24 # Project name, upper case
25 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
27 SET(${PROJECT_NAME_UC}_MAJOR_VERSION 9)
28 SET(${PROJECT_NAME_UC}_MINOR_VERSION 5)
29 SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
30 SET(${PROJECT_NAME_UC}_VERSION
31 ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
32 SET(${PROJECT_NAME_UC}_VERSION_DEV 0)
36 SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
37 IF(EXISTS ${CONFIGURATION_ROOT_DIR})
38 LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
39 INCLUDE(SalomeMacros NO_POLICY_SCOPE)
41 MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
46 SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
47 IF(EXISTS ${KERNEL_ROOT_DIR})
48 FIND_PACKAGE(SalomeKERNEL REQUIRED)
49 KERNEL_WITH_CORBA() # check whether KERNEL builded with CORBA
50 ELSE(EXISTS ${KERNEL_ROOT_DIR})
51 MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
52 ENDIF(EXISTS ${KERNEL_ROOT_DIR})
56 INCLUDE(SalomeSetupPlatform) # From KERNEL
57 # Always build libraries as shared objects:
58 SET(BUILD_SHARED_LIBS TRUE)
60 LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local/cmake_files")
64 OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON)
65 # OPTION(SALOME_BUILD_DOC "Generate SALOME SIERPINSKY documentation" ON) #For use in the future
66 OPTION(SALOME_SIERPINSKY_USE_LIBGD "Enable export to JPEG" ON)
67 MARK_AS_ADVANCED(SALOME_SIERPINSKY_USE_LIBGD)
69 IF(SALOME_BUILD_TESTS)
79 FIND_PACKAGE(SalomePythonInterp REQUIRED)
80 FIND_PACKAGE(SalomePythonLibs REQUIRED)
82 FIND_PACKAGE(SalomeBoost REQUIRED)
84 FIND_PACKAGE(SalomeOmniORB REQUIRED)
85 FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
87 FIND_PACKAGE(SalomeHDF5 REQUIRED COMPONENTS C)
92 SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
93 IF(EXISTS ${GUI_ROOT_DIR})
94 FIND_PACKAGE(SalomeGUI REQUIRED)
95 SALOME_GUI_WITH_CORBA() # check whether GUI builded 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})
108 FIND_PACKAGE(SalomeQt5 REQUIRED)
110 FIND_PACKAGE(SalomeOpenCASCADE REQUIRED)
112 FIND_PACKAGE(SalomeVTK REQUIRED)
117 SET(RANDOMIZER_ROOT_DIR $ENV{RANDOMIZER_ROOT_DIR} CACHE PATH "Path to the Salome RANDOMIZER")
118 IF(EXISTS ${RANDOMIZER_ROOT_DIR})
119 LIST(APPEND CMAKE_MODULE_PATH "${RANDOMIZER_ROOT_DIR}/adm_local/cmake_files")
120 FIND_PACKAGE(SalomeRANDOMIZER REQUIRED)
121 ADD_DEFINITIONS(${RANDOMIZER_DEFINITIONS})
122 INCLUDE_DIRECTORIES(${RANDOMIZER_INCLUDE_DIRS})
123 ELSE(EXISTS ${RANDOMIZER_ROOT_DIR})
124 MESSAGE(FATAL_ERROR "We absolutely need a Salome RANDOMIZER, please define RANDOMIZER_ROOT_DIR")
125 ENDIF(EXISTS ${RANDOMIZER_ROOT_DIR})
130 SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR} CACHE PATH "Path to the Salome SMESH")
131 IF(EXISTS ${SMESH_ROOT_DIR})
132 FIND_PACKAGE(SalomeSMESH REQUIRED)
133 ADD_DEFINITIONS(${SMESH_DEFINITIONS})
134 INCLUDE_DIRECTORIES(${SMESH_INCLUDE_DIRS})
135 ELSE(EXISTS ${SMESH_ROOT_DIR})
136 MESSAGE(FATAL_ERROR "We absolutely need a Salome SMESH, please define SMESH_ROOT_DIR")
137 ENDIF(EXISTS ${SMESH_ROOT_DIR})
140 ## SIERPINSKY specifics
144 IF(SALOME_SIERPINSKY_USE_LIBGD)
145 FIND_PACKAGE(SalomeLibGd)
146 SALOME_LOG_OPTIONAL_PACKAGE(LibGd SALOME_SIERPINSKY_USE_LIBGD)
147 ADD_DEFINITIONS(-DWITH_LIBGD)
148 ENDIF(SALOME_SIERPINSKY_USE_LIBGD)
151 SALOME_PACKAGE_REPORT_AND_CHECK()
154 # (default values taken from KERNEL)
156 SET(SALOME_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "Install path: SALOME binaries")
157 SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: SALOME libs")
158 SET(SALOME_INSTALL_IDLS "${SALOME_INSTALL_IDLS}" CACHE PATH "Install path: SALOME IDL files")
159 SET(SALOME_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "Install path: SALOME headers")
160 SET(SALOME_INSTALL_SCRIPT_SCRIPTS "${SALOME_INSTALL_SCRIPT_SCRIPTS}" CACHE PATH
161 "Install path: SALOME scripts")
162 SET(SALOME_INSTALL_SCRIPT_DATA "${SALOME_INSTALL_SCRIPT_DATA}" CACHE PATH
163 "Install path: SALOME script data")
164 SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH
165 "Install path: SALOME Python scripts")
166 SET(SALOME_INSTALL_APPLISKEL_SCRIPTS "${SALOME_INSTALL_APPLISKEL_SCRIPTS}" CACHE PATH
167 "Install path: SALOME application skeleton - scripts")
168 SET(SALOME_INSTALL_APPLISKEL_PYTHON "${SALOME_INSTALL_APPLISKEL_PYTHON}" CACHE PATH
169 "Install path: SALOME application skeleton - Python")
170 SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Install path: SALOME Python stuff")
171 SET(SALOME_INSTALL_PYTHON_SHARED "${SALOME_INSTALL_PYTHON_SHARED}" CACHE PATH
172 "Install path: SALOME Python shared modules")
173 SET(SALOME_INSTALL_CMAKE_LOCAL "${SALOME_INSTALL_CMAKE_LOCAL}" CACHE PATH
174 "Install path: local SALOME CMake files")
175 SET(SALOME_INSTALL_AMCONFIG_LOCAL "${SALOME_INSTALL_AMCONFIG_LOCAL}" CACHE PATH
176 "Install path: local SALOME config files (obsolete, to be removed)")
177 SET(SALOME_INSTALL_RES "${SALOME_INSTALL_RES}" CACHE PATH "Install path: SALOME resources")
178 SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME documentation")
180 # Specific to SIERPINSKY:
181 SET(SALOME_SIERPINSKY_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/sierpinsky" CACHE PATH
182 "Install path: SALOME SIERPINSKY specific data")
184 MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS)
185 MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON)
186 MARK_AS_ADVANCED(SALOME_INSTALL_APPLISKEL_SCRIPTS SALOME_INSTALL_APPLISKEL_PYTHON SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES)
187 MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED)
188 MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC)
189 MARK_AS_ADVANCED(SALOME_SIERPINSKY_INSTALL_RES_DATA)
191 # Accumulate environment variables for SIERPINSKY module
192 SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS}
193 ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON})
194 SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS})
199 ADD_SUBDIRECTORY(idl)
200 ADD_SUBDIRECTORY(adm_local)
201 ADD_SUBDIRECTORY(resources)
202 ADD_SUBDIRECTORY(src)
203 ADD_SUBDIRECTORY(bin)
205 # Header configuration
206 # ====================
207 SALOME_XVERSION(${PROJECT_NAME})
208 SALOME_CONFIGURE_FILE(SIERPINSKY_version.h.in SIERPINSKY_version.h INSTALL ${SALOME_INSTALL_HEADERS})
210 # Configuration export
211 # (here only the level 1 prerequisites are exposed)
212 # ====================
213 INCLUDE(CMakePackageConfigHelpers)
215 # List of targets in this project we want to make visible to the rest of the world.
216 # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
217 SET(_${PROJECT_NAME}_exposed_targets
218 SIERPINSKYEngine SIERPINSKY SalomeIDLSIERPINSKY
221 # Add all targets to the build-tree export set
222 EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
223 FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake)
225 # Create the configuration files:
226 # - in the build tree:
228 # Ensure the variables are always defined for the configure:
229 SET(SMESH_ROOT_DIR "${SMESH_ROOT_DIR}")
230 SET(RANDOMIZER_ROOT_DIR "${RANDOMIZER_ROOT_DIR}")
231 SET(LIBGD_ROOT_DIR "${LIBGD_ROOT_DIR}")
233 SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
235 # Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
236 SALOME_CONFIGURE_PREPARE(LibGd)
238 CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
239 ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
240 INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
241 PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
242 SMESH_ROOT_DIR LIBGD_ROOT_DIR RANDOMIZER_ROOT_DIR)
244 WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
245 VERSION ${${PROJECT_NAME_UC}_VERSION}
246 COMPATIBILITY AnyNewerVersion)
248 # Install the CMake configuration files:
250 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
251 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
252 DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}")
254 # Install the export set for use with the install-tree
255 INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
256 FILE ${PROJECT_NAME}Targets.cmake)