1 # Copyright (C) 2012-2024 CEA, EDF
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 INCLUDE(CMakeDependentOption)
22 PROJECT(SalomeCURVEPLOT C CXX)
26 # Project name, upper case
27 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
29 SET(${PROJECT_NAME_UC}_MAJOR_VERSION 9)
30 SET(${PROJECT_NAME_UC}_MINOR_VERSION 2)
31 SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
32 SET(${PROJECT_NAME_UC}_VERSION
33 ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
34 SET(${PROJECT_NAME_UC}_VERSION_DEV 0)
38 OPTION(SALOME_CURVEPLOT_STANDALONE "Standalone installation of CURVEPLOT" OFF)
39 OPTION(SALOME_BUILD_DOC "Generate SALOME CURVEPLOT documentation" ON)
40 OPTION(SALOME_BUILD_TESTS "Generate SALOME CURVEPLOT tests" ON)
44 SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
45 IF(EXISTS ${CONFIGURATION_ROOT_DIR})
46 LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
47 INCLUDE(SalomeMacros NO_POLICY_SCOPE)
49 MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
52 IF(NOT SALOME_CURVEPLOT_STANDALONE)
55 SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
56 IF( EXISTS ${KERNEL_ROOT_DIR} )
57 FIND_PACKAGE(SalomeKERNEL REQUIRED)
58 KERNEL_WITH_CORBA() # check whether KERNEL builded with CORBA
59 ADD_DEFINITIONS(${KERNEL_DEFINITIONS} -DSALOME_KERNEL)
60 INCLUDE_DIRECTORIES(${KERNEL_INCLUDE_DIRS})
61 ELSE( EXISTS ${KERNEL_ROOT_DIR} )
62 MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR or turn option SALOME_CURVEPLOT_STANDALONE to ON!")
63 ENDIF( EXISTS ${KERNEL_ROOT_DIR} )
66 SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
67 # Are we compiled being into GUI/tools directory or have we been extracted somewhere else?
68 IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../../src/Session/SALOME_Session.hxx") # we are in GUI
69 # Re-define GUI_INCLUDE_DIRS
70 SET(GUI_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../PyInterp/src)
72 IF(EXISTS ${GUI_ROOT_DIR})
73 FIND_PACKAGE(SalomeGUI)
75 MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR or turn option SALOME_CURVEPLOT_STANDALONE to ON!")
79 ENDIF(NOT SALOME_CURVEPLOT_STANDALONE)
83 INCLUDE(SalomeSetupPlatform)
85 # Always build libraries as shared objects:
86 SET(BUILD_SHARED_LIBS TRUE)
88 LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local/cmake_files")
92 # Find "big" prerequisites first - they reference themselves many others
93 # -> this can helps to find the smaller prerequisites and detect conflicts.
94 # In our case KERNEL may have already loaded many prerequisites which are also used in OSCAR_POST:
101 FIND_PACKAGE(SalomePythonInterp REQUIRED)
102 FIND_PACKAGE(SalomePythonLibs REQUIRED)
103 FIND_PACKAGE(SalomeNumPySciPy REQUIRED)
106 FIND_PACKAGE(SalomeQt5 REQUIRED)
107 FIND_PACKAGE(SalomePyQt5 REQUIRED)
110 IF(SALOME_BUILD_TESTS)
115 SALOME_PACKAGE_REPORT_AND_CHECK()
119 IF(SALOME_CURVEPLOT_STANDALONE)
120 SET(SALOME_INSTALL_LIBS lib/salome CACHE PATH "Install path: SALOME libs")
121 SET(_pydir lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages)
122 SET(SALOME_INSTALL_PYTHON ${_pydir}/salome CACHE PATH "Install path: SALOME Python stuff")
123 SET(SALOME_INSTALL_SCRIPT_PYTHON bin/salome CACHE PATH
124 "Install path: SALOME Python scripts")
125 SET(SALOME_INSTALL_CMAKE_LOCAL adm_local/cmake_files CACHE PATH
126 "Install path: local SALOME CMake files")
127 SET(SALOME_INSTALL_RES share/salome/resources CACHE PATH "Install path: SALOME resources")
128 SET(SALOME_INSTALL_DOC share/doc/resources CACHE PATH "Install path: SALOME documentation")
130 SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: SALOME libs")
131 SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH
132 "Install path: SALOME Python scripts")
133 SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH
134 "Install path: SALOME Python scripts")
135 SET(SALOME_INSTALL_CMAKE_LOCAL ${SALOME_INSTALL_CMAKE_LOCAL} CACHE PATH
136 "Install path: local SALOME CMake files")
137 SET(SALOME_INSTALL_RES "${SALOME_INSTALL_RES}" CACHE PATH "Install path: SALOME resources")
138 SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME documentation")
139 SET(SALOME_INSTALL_HEADERS ${SALOME_INSTALL_HEADERS} CACHE PATH "Install path: SALOME headers")
142 # Specific to CURVEPLOT:
143 SET(SALOME_CURVEPLOT_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/curveplot" CACHE PATH
144 "Install path: SALOME CURVEPLOT specific data")
145 # Package installation path (lib/python<x.y>/...)
146 SET(SALOME_CURVEPLOT_INSTALL_PYTHON ${SALOME_INSTALL_PYTHON}/curveplot CACHE INTERNAL
147 "Install path: SALOME CURVEPLOT Python packages" FORCE)
148 SET(SALOME_CURVEPLOT_INSTALL_SCRIPT_PYTHON ${SALOME_INSTALL_SCRIPT_PYTHON} CACHE INTERNAL
149 "Install path: SALOME CURVEPLOT Python main entry points" FORCE)
151 SET(CRVPLOT_TEST_INSTALL ${CMAKE_BINARY_DIR}/local/curveplot)
152 SET(PYQTSIDE_TEST_INSTALL ${CMAKE_BINARY_DIR}/local/pyqtside)
156 ADD_SUBDIRECTORY(src)
157 ADD_SUBDIRECTORY(resources)
158 ADD_SUBDIRECTORY(cmake_files)
160 # ADD_SUBDIRECTORY(doc)
163 # Configuration export
164 # (here only the level 1 prerequisites are exposed)
165 # ====================
166 INCLUDE(CMakePackageConfigHelpers)
168 # List of targets in this project we want to make visible to the rest of the world.
169 # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
170 SET(_${PROJECT_NAME}_exposed_targets)
171 IF(NOT SALOME_CURVEPLOT_STANDALONE)
172 SET(_${PROJECT_NAME}_exposed_targets CurvePlot)
175 # Add all targets to the build-tree export set
176 EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
177 FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake)
179 # Create the configuration files:
180 # - in the build tree:
182 # Ensure the variables are always defined for the configure:
183 SET(KERNEL_ROOT_DIR "${KERNEL_ROOT_DIR}")
184 SET(GUI_ROOT_DIR "${GUI_ROOT_DIR}")
185 SET(QT5_ROOT_DIR "${QT5_ROOT_DIR}")
186 SET(PYQT5_ROOT_DIR "${PYQT5_ROOT_DIR}")
187 SET(PYTHON_ROOT_DIR "${PYTHON_ROOT_DIR}")
189 SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
191 # Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
192 SALOME_CONFIGURE_PREPARE(PyQt5 Qt5 Python)
194 CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
195 ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
196 INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
197 PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
198 KERNEL_ROOT_DIR GUI_ROOT_DIR QT5_ROOT_DIR PYQT5_ROOT_DIR PYTHON_ROOT_DIR)
200 WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
201 VERSION ${${PROJECT_NAME_UC}_VERSION}
202 COMPATIBILITY AnyNewerVersion)
204 # Install the CMake configuration files:
206 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
207 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
208 DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}")
210 # Install the export set for use with the install-tree
211 IF(NOT SALOME_CURVEPLOT_STANDALONE)
212 INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
213 FILE ${PROJECT_NAME}Targets.cmake)