1 # Copyright (C) 2012-2013 CEA/DEN, EDF R&D, 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.
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(SalomeATOMSOLV C CXX)
22 # Ensure a proper linker behavior:
23 CMAKE_POLICY(SET CMP0003 NEW)
27 # Project name, upper case
28 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
30 SET(${PROJECT_NAME_UC}_MAJOR_VERSION 7)
31 SET(${PROJECT_NAME_UC}_MINOR_VERSION 3)
32 SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
33 SET(${PROJECT_NAME_UC}_VERSION
34 ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
35 SET(${PROJECT_NAME_UC}_VERSION_DEV 0)
39 SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
40 IF(EXISTS ${KERNEL_ROOT_DIR})
41 LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
43 FIND_PACKAGE(SalomeKERNEL REQUIRED)
44 ELSE(EXISTS ${KERNEL_ROOT_DIR})
45 MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
46 ENDIF(EXISTS ${KERNEL_ROOT_DIR})
49 MESSAGE(FATAL_ERROR "ATOMGEN module can't be built in Light mode (whiout CORBA)")
54 INCLUDE(SalomeSetupPlatform) # From KERNEL
55 # Always build libraries as shared objects:
56 SET(BUILD_SHARED_LIBS TRUE)
58 LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local/cmake_files")
62 #OPTION(SALOME_BUILD_DOC "Generate SALOME ATOMSOLV documentation" ON) #for use in the future
63 OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON)
65 IF(SALOME_BUILD_TESTS)
72 FIND_PACKAGE(SalomePython REQUIRED)
73 FIND_PACKAGE(SalomeOmniORB REQUIRED)
74 FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
75 FIND_PACKAGE(SalomePThread REQUIRED)
80 SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
81 IF(EXISTS ${GUI_ROOT_DIR})
82 LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
83 FIND_PACKAGE(SalomeGUI REQUIRED)
84 ELSE(EXISTS ${GUI_ROOT_DIR})
85 MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR")
86 ENDIF(EXISTS ${GUI_ROOT_DIR})
91 FIND_PACKAGE(SalomeCAS REQUIRED)
92 FIND_PACKAGE(SalomeVTK 6.0 REQUIRED)
93 FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui)
94 INCLUDE(${QT_USE_FILE})
98 SET(ATOMGEN_ROOT_DIR $ENV{ATOMGEN_ROOT_DIR} CACHE PATH "Path to the Salome ATOMGEN")
99 IF(EXISTS ${ATOMGEN_ROOT_DIR})
100 LIST(APPEND CMAKE_MODULE_PATH "${ATOMGEN_ROOT_DIR}/adm_local/cmake_files")
101 FIND_PACKAGE(SalomeATOMGEN REQUIRED)
102 ADD_DEFINITIONS(${ATOMGEN_DEFINITIONS})
103 INCLUDE_DIRECTORIES(${ATOMGEN_INCLUDE_DIRS})
104 ELSE(EXISTS ${ATOMGEN_ROOT_DIR})
105 MESSAGE(FATAL_ERROR "We absolutely need a Salome ATOMGEN, please define ATOMGEN_ROOT_DIR")
106 ENDIF(EXISTS ${ATOMGEN_ROOT_DIR})
109 # (default values taken from KERNEL)
111 SET(SALOME_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "Install path: SALOME binaries")
112 SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: SALOME libs")
113 SET(SALOME_INSTALL_IDLS "${SALOME_INSTALL_IDLS}" CACHE PATH "Install path: SALOME IDL files")
114 SET(SALOME_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "Install path: SALOME headers")
115 SET(SALOME_INSTALL_SCRIPT_SCRIPTS "${SALOME_INSTALL_SCRIPT_SCRIPTS}" CACHE PATH
116 "Install path: SALOME scripts")
117 SET(SALOME_INSTALL_SCRIPT_DATA "${SALOME_INSTALL_SCRIPT_DATA}" CACHE PATH
118 "Install path: SALOME script data")
119 SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH
120 "Install path: SALOME Python scripts")
121 SET(SALOME_INSTALL_APPLISKEL_SCRIPTS "${SALOME_INSTALL_APPLISKEL_SCRIPTS}" CACHE PATH
122 "Install path: SALOME application skeleton - scripts")
123 SET(SALOME_INSTALL_APPLISKEL_PYTHON "${SALOME_INSTALL_APPLISKEL_PYTHON}" CACHE PATH
124 "Install path: SALOME application skeleton - Python")
125 SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Install path: SALOME Python stuff")
126 SET(SALOME_INSTALL_PYTHON_SHARED "${SALOME_INSTALL_PYTHON_SHARED}" CACHE PATH
127 "Install path: SALOME Python shared modules")
128 SET(SALOME_INSTALL_CMAKE_LOCAL "${SALOME_INSTALL_CMAKE_LOCAL}" CACHE PATH
129 "Install path: local SALOME CMake files")
130 SET(SALOME_INSTALL_AMCONFIG_LOCAL "${SALOME_INSTALL_AMCONFIG_LOCAL}" CACHE PATH
131 "Install path: local SALOME config files (obsolete, to be removed)")
132 SET(SALOME_INSTALL_RES "${SALOME_INSTALL_RES}" CACHE PATH "Install path: SALOME resources")
133 SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME documentation")
135 # Specific to ATOMSOLV:
136 SET(SALOME_ATOMSOLV_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/atomsolv" CACHE PATH
137 "Install path: SALOME ATOMSOLV specific data")
139 MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS)
140 MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON)
141 MARK_AS_ADVANCED(SALOME_INSTALL_APPLISKEL_SCRIPTS SALOME_INSTALL_APPLISKEL_PYTHON SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES)
142 MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED)
143 MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC)
144 MARK_AS_ADVANCED(SALOME_ATOMSOLV_INSTALL_RES_DATA)
146 # Accumulate environment variables for ATOMSOLV module
147 SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS}
148 ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON})
149 SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS})
153 ADD_SUBDIRECTORY(idl)
154 ADD_SUBDIRECTORY(adm_local)
155 ADD_SUBDIRECTORY(resources)
156 ADD_SUBDIRECTORY(src)
157 ADD_SUBDIRECTORY(bin)
159 # Header configuration
160 # ====================
161 SALOME_XVERSION(${PROJECT_NAME})
162 SALOME_CONFIGURE_FILE(ATOMSOLV_version.h.in ATOMSOLV_version.h INSTALL ${SALOME_INSTALL_HEADERS})
164 # Configuration export
165 # (here only the level 1 prerequisites are exposed)
166 # ====================
167 INCLUDE(CMakePackageConfigHelpers)
169 # List of targets in this project we want to make visible to the rest of the world.
170 # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
171 SET(_${PROJECT_NAME}_exposed_targets
172 SalomeIDLATOMSOLV ATOMSOLV ATOMSOLVEngine
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(ATOMGEN_ROOT_DIR "${ATOMGEN_ROOT_DIR}")
185 SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
187 # Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
188 # SALOME_CONFIGURE_PREPARE() #For use in the future
190 CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
191 ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
192 INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
193 PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
196 WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
197 VERSION ${${PROJECT_NAME_UC}_VERSION}
198 COMPATIBILITY AnyNewerVersion)
200 # Install the CMake configuration files:
202 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
203 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
204 DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}")
206 # Install the export set for use with the install-tree
207 INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
208 FILE ${PROJECT_NAME}Targets.cmake)