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(SalomeOmniORB REQUIRED)
69 FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
70 FIND_PACKAGE(SalomeSWIG REQUIRED)
72 # Med and Hdf5 are second order dependencies (deps for Telemac) but since Telemac libraries
73 # are not linked against them, we need to include them here for the Telemac wrapper
74 FIND_PACKAGE(SalomeMEDFile REQUIRED)
75 FIND_PACKAGE(SalomeHDF5 REQUIRED)
78 FIND_PACKAGE(SalomeSphinx REQUIRED)
83 SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
84 IF(EXISTS ${GUI_ROOT_DIR})
85 LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
86 FIND_PACKAGE(SalomeGUI REQUIRED)
87 ADD_DEFINITIONS(${GUI_DEFINITIONS})
88 INCLUDE_DIRECTORIES(${GUI_INCLUDE_DIRS})
89 ELSE(EXISTS ${GUI_ROOT_DIR})
90 MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR")
91 ENDIF(EXISTS ${GUI_ROOT_DIR})
96 FIND_PACKAGE(SalomePyQt4 REQUIRED)
99 ## HYDROSOLVER specifics
102 FIND_PACKAGE(SalomeMascaret REQUIRED)
103 FIND_PACKAGE(SalomeTelemac REQUIRED)
106 # (default values taken from KERNEL)
108 SET(SALOME_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "Install path: SALOME binaries")
109 SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: SALOME libs")
110 SET(SALOME_INSTALL_IDLS "${SALOME_INSTALL_IDLS}" CACHE PATH "Install path: SALOME IDL files")
111 SET(SALOME_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "Install path: SALOME headers")
112 SET(SALOME_INSTALL_SCRIPT_SCRIPTS "${SALOME_INSTALL_SCRIPT_SCRIPTS}" CACHE PATH
113 "Install path: SALOME scripts")
114 SET(SALOME_INSTALL_SCRIPT_DATA "${SALOME_INSTALL_SCRIPT_DATA}" CACHE PATH
115 "Install path: SALOME script data")
116 SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH
117 "Install path: SALOME Python scripts")
118 SET(SALOME_INSTALL_APPLISKEL_SCRIPTS "${SALOME_INSTALL_APPLISKEL_SCRIPTS}" CACHE PATH
119 "Install path: SALOME application skeleton - scripts")
120 SET(SALOME_INSTALL_APPLISKEL_PYTHON "${SALOME_INSTALL_APPLISKEL_PYTHON}" CACHE PATH
121 "Install path: SALOME application skeleton - Python")
122 SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Install path: SALOME Python stuff")
123 SET(SALOME_INSTALL_PYTHON_SHARED "${SALOME_INSTALL_PYTHON_SHARED}" CACHE PATH
124 "Install path: SALOME Python shared modules")
125 SET(SALOME_INSTALL_CMAKE_LOCAL "${SALOME_INSTALL_CMAKE_LOCAL}" CACHE PATH
126 "Install path: local SALOME CMake files")
127 SET(SALOME_INSTALL_AMCONFIG_LOCAL "${SALOME_INSTALL_AMCONFIG_LOCAL}" CACHE PATH
128 "Install path: local SALOME config files (obsolete, to be removed)")
129 SET(SALOME_INSTALL_RES "${SALOME_INSTALL_RES}" CACHE PATH "Install path: SALOME resources")
130 SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME documentation")
132 # HYDROSOLVER specific:
133 SET(SALOME_HYDROSOLVER_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/hydrosolver" CACHE PATH "Install path: SALOME HYDROSOLVER specific data")
134 SET(SALOME_HYDROSOLVER_INSTALL_DOC "${SALOME_INSTALL_DOC}/gui/HYDROSOLVER" CACHE PATH "Install path: SALOME HYDROSOLVER doc")
136 MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS)
137 MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON)
138 MARK_AS_ADVANCED(SALOME_INSTALL_APPLISKEL_SCRIPTS SALOME_INSTALL_APPLISKEL_PYTHON SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES)
139 MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED)
140 MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC)
141 MARK_AS_ADVANCED(SALOME_HYDROSOLVER_INSTALL_RES_DATA SALOME_HYDROSOLVER_INSTALL_DOC)
143 # Accumulate environment variables for HYDROSOLVER module
144 SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS})
145 SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS})
150 ADD_SUBDIRECTORY(adm_local)
151 ADD_SUBDIRECTORY(resources)
152 ADD_SUBDIRECTORY(src)
153 ADD_SUBDIRECTORY(idl)
155 ADD_SUBDIRECTORY(doc)
158 # Configuration export
159 # (here only the level 1 prerequisites are exposed)
160 # ====================
161 INCLUDE(CMakePackageConfigHelpers)
163 # List of targets in this project we want to make visible to the rest of the world.
164 # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
165 SET(_${PROJECT_NAME}_exposed_targets
169 # Add all targets to the build-tree export set
170 EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
171 FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake)
173 # Create the configuration files:
174 # - in the build tree:
176 # Ensure the variables are always defined for the configure:
177 SET(GUI_ROOT_DIR "${GUI_ROOT_DIR}")
179 SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
181 # Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
182 # SALOME_CONFIGURE_PREPARE() #For use in the future
184 CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
185 ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
186 INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
187 PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
190 WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
191 VERSION ${${PROJECT_NAME_UC}_VERSION}
192 COMPATIBILITY AnyNewerVersion)
194 # Install the CMake configuration files:
196 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
197 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
198 DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}")
200 # Install the export set for use with the install-tree
201 INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
202 FILE ${PROJECT_NAME}Targets.cmake)