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 0)
30 SET(${PROJECT_NAME_UC}_MINOR_VERSION 1)
31 SET(${PROJECT_NAME_UC}_VERSION
32 ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION})
33 SET(${PROJECT_NAME_UC}_VERSION_DEV 1)
37 SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
38 IF(EXISTS ${KERNEL_ROOT_DIR})
39 LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
41 FIND_PACKAGE(SalomeKERNEL REQUIRED)
42 ELSE(EXISTS ${KERNEL_ROOT_DIR})
43 MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
44 ENDIF(EXISTS ${KERNEL_ROOT_DIR})
48 INCLUDE(SalomeSetupPlatform) # From KERNEL
49 # Always build libraries as shared objects:
50 SET(BUILD_SHARED_LIBS TRUE)
52 LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local/cmake_files")
56 OPTION(SALOME_BUILD_DOC "Generate SALOME HYDROSOLVER documentation" ON)
57 #OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON) #for use in the future
59 #IF(SALOME_BUILD_TESTS)
66 FIND_PACKAGE(SalomePythonInterp REQUIRED)
67 FIND_PACKAGE(SalomePythonLibs REQUIRED)
68 #FIND_PACKAGE(SalomePython REQUIRED)
69 FIND_PACKAGE(SalomeOmniORB REQUIRED)
70 FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
71 FIND_PACKAGE(SalomeSWIG REQUIRED)
73 # Med and Hdf5 are second order dependencies (deps for Telemac) but since Telemac libraries
74 # are not linked against them, we need to include them here for the Telemac wrapper
75 FIND_PACKAGE(SalomeMEDFile REQUIRED)
76 FIND_PACKAGE(SalomeHDF5 REQUIRED)
79 FIND_PACKAGE(SalomeSphinx REQUIRED)
84 SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
85 IF(EXISTS ${GUI_ROOT_DIR})
86 LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
87 FIND_PACKAGE(SalomeGUI REQUIRED)
88 ADD_DEFINITIONS(${GUI_DEFINITIONS})
89 INCLUDE_DIRECTORIES(${GUI_INCLUDE_DIRS})
90 ELSE(EXISTS ${GUI_ROOT_DIR})
91 MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR")
92 ENDIF(EXISTS ${GUI_ROOT_DIR})
97 FIND_PACKAGE(SalomePyQt4 REQUIRED)
100 ## HYDROSOLVER specifics
103 FIND_PACKAGE(SalomeMascaret REQUIRED)
104 FIND_PACKAGE(SalomeTelemac REQUIRED)
107 # (default values taken from KERNEL)
109 SET(SALOME_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "Install path: SALOME binaries")
110 SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: SALOME libs")
111 SET(SALOME_INSTALL_IDLS "${SALOME_INSTALL_IDLS}" CACHE PATH "Install path: SALOME IDL files")
112 SET(SALOME_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "Install path: SALOME headers")
113 SET(SALOME_INSTALL_SCRIPT_SCRIPTS "${SALOME_INSTALL_SCRIPT_SCRIPTS}" CACHE PATH
114 "Install path: SALOME scripts")
115 SET(SALOME_INSTALL_SCRIPT_DATA "${SALOME_INSTALL_SCRIPT_DATA}" CACHE PATH
116 "Install path: SALOME script data")
117 SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH
118 "Install path: SALOME Python scripts")
119 SET(SALOME_INSTALL_APPLISKEL_SCRIPTS "${SALOME_INSTALL_APPLISKEL_SCRIPTS}" CACHE PATH
120 "Install path: SALOME application skeleton - scripts")
121 SET(SALOME_INSTALL_APPLISKEL_PYTHON "${SALOME_INSTALL_APPLISKEL_PYTHON}" CACHE PATH
122 "Install path: SALOME application skeleton - Python")
123 SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Install path: SALOME Python stuff")
124 SET(SALOME_INSTALL_PYTHON_SHARED "${SALOME_INSTALL_PYTHON_SHARED}" CACHE PATH
125 "Install path: SALOME Python shared modules")
126 SET(SALOME_INSTALL_CMAKE_LOCAL "${SALOME_INSTALL_CMAKE_LOCAL}" CACHE PATH
127 "Install path: local SALOME CMake files")
128 SET(SALOME_INSTALL_AMCONFIG_LOCAL "${SALOME_INSTALL_AMCONFIG_LOCAL}" CACHE PATH
129 "Install path: local SALOME config files (obsolete, to be removed)")
130 SET(SALOME_INSTALL_RES "${SALOME_INSTALL_RES}" CACHE PATH "Install path: SALOME resources")
131 SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME documentation")
133 # HYDROSOLVER specific:
134 SET(SALOME_HYDROSOLVER_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/hydrosolver" CACHE PATH "Install path: SALOME HYDROSOLVER specific data")
135 SET(SALOME_HYDROSOLVER_INSTALL_DOC "${SALOME_INSTALL_DOC}/gui/HYDROSOLVER" CACHE PATH "Install path: SALOME HYDROSOLVER doc")
137 MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS)
138 MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON)
139 MARK_AS_ADVANCED(SALOME_INSTALL_APPLISKEL_SCRIPTS SALOME_INSTALL_APPLISKEL_PYTHON SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES)
140 MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED)
141 MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC)
142 MARK_AS_ADVANCED(SALOME_HYDROSOLVER_INSTALL_RES_DATA SALOME_HYDROSOLVER_INSTALL_DOC)
144 # Accumulate environment variables for HYDROSOLVER module
145 SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS})
146 SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS})
151 ADD_SUBDIRECTORY(adm_local)
152 ADD_SUBDIRECTORY(resources)
153 ADD_SUBDIRECTORY(src)
154 ADD_SUBDIRECTORY(idl)
155 ADD_SUBDIRECTORY(tests)
157 ADD_SUBDIRECTORY(doc)
160 # Configuration export
161 # (here only the level 1 prerequisites are exposed)
162 # ====================
163 INCLUDE(CMakePackageConfigHelpers)
165 # List of targets in this project we want to make visible to the rest of the world.
166 # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
167 SET(_${PROJECT_NAME}_exposed_targets
171 # Add all targets to the build-tree export set
172 EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
173 FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake)
175 # Create the configuration files:
176 # - in the build tree:
178 # Ensure the variables are always defined for the configure:
179 SET(GUI_ROOT_DIR "${GUI_ROOT_DIR}")
181 SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
183 # Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
184 # SALOME_CONFIGURE_PREPARE() #For use in the future
186 CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
187 ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
188 INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
189 PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
192 WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
193 VERSION ${${PROJECT_NAME_UC}_VERSION}
194 COMPATIBILITY AnyNewerVersion)
196 # Install the CMake configuration files:
198 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
199 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
200 DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}")
202 # Install the export set for use with the install-tree
203 INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
204 FILE ${PROJECT_NAME}Targets.cmake)