Salome HOME
Copyright update 2022
[modules/gui.git] / tools / PyInterp / CMakeLists.txt
1 # Copyright (C) 2015-2022  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
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.
7 #
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.
12 #
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
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12 FATAL_ERROR)
21 PROJECT(PyInterp C CXX)
22
23 # Versioning
24 # ===========
25 # Project name, uppercase / lowercase
26 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
27 STRING(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LC)
28
29 # Include common macros
30 # =====================
31 SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
32 IF(EXISTS ${CONFIGURATION_ROOT_DIR})
33   LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
34   INCLUDE(SalomeMacros NO_POLICY_SCOPE)
35 ELSE()
36   MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
37 ENDIF()
38
39 # Platform setup
40 # ==============
41 INCLUDE(SalomeSetupPlatform)
42
43 # Options
44 # =======
45 OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON)
46
47 # Detect prerequisites
48 # ====================
49
50 # Python
51 FIND_PACKAGE(SalomePythonInterp REQUIRED)
52 FIND_PACKAGE(SalomePythonLibs REQUIRED)
53 # Qt
54 FIND_PACKAGE(SalomeQt5 REQUIRED)
55
56 # Detection summary report
57 SALOME_PACKAGE_REPORT_AND_CHECK()
58
59 # Directories
60 #
61 # Directories have to be given after prerequisites (to be able to use
62 # Python version string for example).
63 # ===================================================================
64 SET(PYINTERP_INSTALL_LIBS lib CACHE PATH "Install path: libraries")
65 SET(PYINTERP_INSTALL_HEADERS include CACHE PATH "Install path: headers")
66 SET(PYINTERP_INSTALL_RES share/resources CACHE PATH "Install path: resources")
67 SET(PYINTERP_INSTALL_CMAKE lib/cmake/${PROJECT_NAME_LC} CACHE PATH "Install path: cmake files")
68
69 MARK_AS_ADVANCED(PYINTERP_INSTALL_LIBS PYINTERP_INSTALL_HEADERS
70                  PYINTERP_INSTALL_RES PYINTERP_INSTALL_CMAKE)
71
72 SET(PYINTERP_EXPORT_NAME ${PROJECT_NAME} CACHE STRING "Export name")
73 MARK_AS_ADVANCED(PYINTERP_EXPORT_NAME)
74
75 # Subdirs
76 # =======
77 ADD_SUBDIRECTORY(src)
78
79 # Export configuration and targets
80 # ================================
81 IF(NOT PYINTERP_SUBPROJECT)
82   # Install the export set for use with the install-tree
83   INSTALL(EXPORT ${PYINTERP_EXPORT_NAME}TargetGroup DESTINATION ${PYINTERP_INSTALL_CMAKE}
84           FILE ${PROJECT_NAME}Targets.cmake)
85 ENDIF()