1 # Copyright (C) 2012-2019 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, 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 PROJECT(SalomePYCALCULATOR 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 9)
31 SET(${PROJECT_NAME_UC}_MINOR_VERSION 4)
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(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
40 IF(EXISTS ${CONFIGURATION_ROOT_DIR})
41 LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
44 MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
49 SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
50 IF(EXISTS ${KERNEL_ROOT_DIR})
51 LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
53 FIND_PACKAGE(SalomeKERNEL REQUIRED)
54 KERNEL_WITH_CORBA() # check whether KERNEL builded with CORBA
55 ELSE(EXISTS ${KERNEL_ROOT_DIR})
56 MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
57 ENDIF(EXISTS ${KERNEL_ROOT_DIR})
61 INCLUDE(SalomeSetupPlatform) # From KERNEL
62 # Always build libraries as shared objects:
63 SET(BUILD_SHARED_LIBS TRUE)
65 LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local/cmake_files")
69 OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON)
70 OPTION(SALOME_BUILD_DOC "Generate SALOME PYCALCULATOR documentation" ON)
72 IF(SALOME_BUILD_TESTS)
76 FIND_PACKAGE(SalomeDoxygen)
77 SALOME_LOG_OPTIONAL_PACKAGE(Doxygen SALOME_BUILD_DOC)
83 FIND_PACKAGE(SalomePythonInterp REQUIRED)
84 FIND_PACKAGE(SalomePythonLibs REQUIRED)
85 FIND_PACKAGE(SalomeOmniORB REQUIRED)
86 FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
91 SET(FIELDS_ROOT_DIR $ENV{FIELDS_ROOT_DIR} CACHE PATH "Path to the Salome FIELDS")
92 IF(EXISTS ${FIELDS_ROOT_DIR})
93 LIST(APPEND CMAKE_MODULE_PATH "${FIELDS_ROOT_DIR}/adm_local/cmake_files")
94 FIND_PACKAGE(SalomeFIELDS REQUIRED)
95 IF(SALOME_FIELDS_STANDALONE)
96 MESSAGE(FATAL_ERROR "We absolutely need a Salome FIELDS with KERNEL,
97 please set SALOME_FIELDS_STANDALONE=OFF when building FIELDS module.")
99 ELSE(EXISTS ${FIELDS_ROOT_DIR})
100 MESSAGE(FATAL_ERROR "We absolutely need a Salome FIELDS, please define FIELDS_ROOT_DIR")
101 ENDIF(EXISTS ${FIELDS_ROOT_DIR})
104 SALOME_PACKAGE_REPORT_AND_CHECK()
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 # Specific to PYCALCULATOR:
134 SET(SALOME_PYCALCULATOR_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/pycalculator" CACHE PATH
135 "Install path: SALOME PYCALCULATOR specific data")
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_PYCALCULATOR_INSTALL_RES_DATA)
144 # Accumulate environment variables for PYCALCULATOR module
145 SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS}
146 ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON})
147 SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS})
152 ADD_SUBDIRECTORY(idl)
153 ADD_SUBDIRECTORY(adm_local)
154 ADD_SUBDIRECTORY(resources)
155 ADD_SUBDIRECTORY(src)
156 ADD_SUBDIRECTORY(bin)
158 ADD_SUBDIRECTORY(doc)
161 # Configuration export
162 # (here only the level 1 prerequisites are exposed)
163 # ====================
164 INCLUDE(CMakePackageConfigHelpers)
166 # List of targets in this project we want to make visible to the rest of the world.
167 # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
168 SET(_${PROJECT_NAME}_exposed_targets
169 SalomeIDLPYCALCULATOR
172 # Add all targets to the build-tree export set
173 EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
174 FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake)
176 # Create the configuration files:
177 # - in the build tree:
179 # Ensure the variables are always defined for the configure:
180 SET(FIELDS_ROOT_DIR "${FIELDS_ROOT_DIR}")
182 SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
184 # Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
185 # SALOME_CONFIGURE_PREPARE() #For use in the future
187 CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
188 ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
189 INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
190 PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
193 WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
194 VERSION ${${PROJECT_NAME_UC}_VERSION}
195 COMPATIBILITY AnyNewerVersion)
197 # Install the CMake configuration files:
199 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
200 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
201 DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}")
203 # Install the export set for use with the install-tree
204 INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
205 FILE ${PROJECT_NAME}Targets.cmake)