1 # Copyright (C) 2012-2013 EDF
3 # This file is part of SALOME HYDRO module.
5 # SALOME HYDRO module is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # SALOME HYDRO module is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
18 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
19 PROJECT(SalomeHYDROSOLVER CXX)
21 # Ensure a proper linker behavior:
22 CMAKE_POLICY(SET CMP0003 NEW)
26 # Project name, upper case
27 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
29 SET(${PROJECT_NAME_UC}_MAJOR_VERSION 2)
30 SET(${PROJECT_NAME_UC}_MINOR_VERSION 0)
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 1)
38 SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
39 IF(EXISTS ${CONFIGURATION_ROOT_DIR})
40 LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
43 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 LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
49 #INCLUDE(SalomeMacros)
50 FIND_PACKAGE(SalomeKERNEL REQUIRED)
51 ELSE(EXISTS ${KERNEL_ROOT_DIR})
52 MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
53 ENDIF(EXISTS ${KERNEL_ROOT_DIR})
57 INCLUDE(SalomeSetupPlatform) # From KERNEL
58 # Always build libraries as shared objects:
59 SET(BUILD_SHARED_LIBS TRUE)
61 LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local/cmake_files")
65 OPTION(SALOME_BUILD_DOC "Generate SALOME HYDROSOLVER documentation" ON)
66 #OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON) #for use in the future
68 #IF(SALOME_BUILD_TESTS)
75 FIND_PACKAGE(SalomePythonInterp REQUIRED)
76 FIND_PACKAGE(SalomePythonLibs REQUIRED)
77 #FIND_PACKAGE(SalomePython REQUIRED)
78 FIND_PACKAGE(SalomeOmniORB REQUIRED)
79 FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
80 FIND_PACKAGE(SalomeSWIG REQUIRED)
82 # Med and Hdf5 are second order dependencies (deps for Telemac) but since Telemac libraries
83 # are not linked against them, we need to include them here for the Telemac wrapper
84 FIND_PACKAGE(SalomeMEDFile REQUIRED)
85 FIND_PACKAGE(SalomeHDF5 REQUIRED)
88 FIND_PACKAGE(SalomeSphinx REQUIRED)
93 SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
94 IF(EXISTS ${GUI_ROOT_DIR})
95 LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
96 FIND_PACKAGE(SalomeGUI REQUIRED)
97 ADD_DEFINITIONS(${GUI_DEFINITIONS})
98 INCLUDE_DIRECTORIES(${GUI_INCLUDE_DIRS})
99 ELSE(EXISTS ${GUI_ROOT_DIR})
100 MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR")
101 ENDIF(EXISTS ${GUI_ROOT_DIR})
106 FIND_PACKAGE(SalomePyQt5 REQUIRED)
109 ## HYDROSOLVER specifics
112 FIND_PACKAGE(SalomeTelemac REQUIRED)
115 # (default values taken from KERNEL)
117 SET(SALOME_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "Install path: SALOME binaries")
118 SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: SALOME libs")
119 SET(SALOME_INSTALL_IDLS "${SALOME_INSTALL_IDLS}" CACHE PATH "Install path: SALOME IDL files")
120 SET(SALOME_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "Install path: SALOME headers")
121 SET(SALOME_INSTALL_SCRIPT_SCRIPTS "${SALOME_INSTALL_SCRIPT_SCRIPTS}" CACHE PATH
122 "Install path: SALOME scripts")
123 SET(SALOME_INSTALL_SCRIPT_DATA "${SALOME_INSTALL_SCRIPT_DATA}" CACHE PATH
124 "Install path: SALOME script data")
125 SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH
126 "Install path: SALOME Python scripts")
127 SET(SALOME_INSTALL_APPLISKEL_SCRIPTS "${SALOME_INSTALL_APPLISKEL_SCRIPTS}" CACHE PATH
128 "Install path: SALOME application skeleton - scripts")
129 SET(SALOME_INSTALL_APPLISKEL_PYTHON "${SALOME_INSTALL_APPLISKEL_PYTHON}" CACHE PATH
130 "Install path: SALOME application skeleton - Python")
131 SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Install path: SALOME Python stuff")
132 SET(SALOME_INSTALL_PYTHON_SHARED "${SALOME_INSTALL_PYTHON_SHARED}" CACHE PATH
133 "Install path: SALOME Python shared modules")
134 SET(SALOME_INSTALL_CMAKE_LOCAL "${SALOME_INSTALL_CMAKE_LOCAL}" CACHE PATH
135 "Install path: local SALOME CMake files")
136 SET(SALOME_INSTALL_AMCONFIG_LOCAL "${SALOME_INSTALL_AMCONFIG_LOCAL}" CACHE PATH
137 "Install path: local SALOME config files (obsolete, to be removed)")
138 SET(SALOME_INSTALL_RES "${SALOME_INSTALL_RES}" CACHE PATH "Install path: SALOME resources")
139 SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME documentation")
141 # HYDROSOLVER specific:
142 SET(SALOME_HYDROSOLVER_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/hydrosolver" CACHE PATH "Install path: SALOME HYDROSOLVER specific data")
143 SET(SALOME_HYDROSOLVER_INSTALL_DOC "${SALOME_INSTALL_DOC}/gui/HYDROSOLVER" CACHE PATH "Install path: SALOME HYDROSOLVER doc")
145 MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS)
146 MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON)
147 MARK_AS_ADVANCED(SALOME_INSTALL_APPLISKEL_SCRIPTS SALOME_INSTALL_APPLISKEL_PYTHON SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES)
148 MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED)
149 MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC)
150 MARK_AS_ADVANCED(SALOME_HYDROSOLVER_INSTALL_RES_DATA SALOME_HYDROSOLVER_INSTALL_DOC)
152 # Accumulate environment variables for HYDROSOLVER module
153 SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS})
154 SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS})
159 ADD_SUBDIRECTORY(adm_local)
160 ADD_SUBDIRECTORY(resources)
161 ADD_SUBDIRECTORY(src)
162 ADD_SUBDIRECTORY(idl)
163 ADD_SUBDIRECTORY(tests)
165 ADD_SUBDIRECTORY(doc)
168 # Configuration export
169 # (here only the level 1 prerequisites are exposed)
170 # ====================
171 INCLUDE(CMakePackageConfigHelpers)
173 # List of targets in this project we want to make visible to the rest of the world.
174 # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
175 SET(_${PROJECT_NAME}_exposed_targets
179 # Add all targets to the build-tree export set
180 EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
181 FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake)
183 # Create the configuration files:
184 # - in the build tree:
186 # Ensure the variables are always defined for the configure:
187 SET(GUI_ROOT_DIR "${GUI_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() #For use in the future
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
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 INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
212 FILE ${PROJECT_NAME}Targets.cmake)