1 # Copyright (C) 2015-2021 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
20 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12 FATAL_ERROR)
21 PROJECT(PyEditor C CXX)
25 # Project name, uppercase / lowercase
26 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
27 STRING(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LC)
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)
36 MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
41 INCLUDE(SalomeSetupPlatform)
45 OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON)
46 OPTION(BUILD_EXECUTABLE "Build executable" ON)
47 OPTION(BUILD_PYMODULE "Build Python module" ON)
49 # Detect prerequisites
50 # ====================
53 FIND_PACKAGE(SalomeQt5 REQUIRED)
56 FIND_PACKAGE(SalomePythonInterp REQUIRED)
57 FIND_PACKAGE(SalomePythonLibs REQUIRED)
58 SALOME_LOG_OPTIONAL_PACKAGE(SalomePythonInterp BUILD_PYMODULE)
59 SALOME_LOG_OPTIONAL_PACKAGE(SalomePythonLibs BUILD_PYMODULE)
60 # Sip (should come after Python and before PyQt)
61 FIND_PACKAGE(SalomeSIP REQUIRED)
62 SALOME_LOG_OPTIONAL_PACKAGE(SalomeSIP BUILD_PYMODULE)
64 FIND_PACKAGE(SalomePyQt5 REQUIRED)
65 SALOME_LOG_OPTIONAL_PACKAGE(SalomePyQt5 BUILD_PYMODULE)
68 # Detection summary report
69 SALOME_PACKAGE_REPORT_AND_CHECK()
73 # Directories have to be given after prerequisites (to be able to use
74 # Python version string for example).
75 # ===================================================================
76 SET(PYEDITOR_INSTALL_BINS bin CACHE PATH "Install path: binaries")
77 SET(PYEDITOR_INSTALL_LIBS lib CACHE PATH "Install path: libraries")
78 SET(PYEDITOR_INSTALL_PYTHON lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages CACHE PATH "Install path: Python module")
79 SET(PYEDITOR_INSTALL_HEADERS include CACHE PATH "Install path: headers")
80 SET(PYEDITOR_INSTALL_RES share/resources CACHE PATH "Install path: resources")
81 SET(PYEDITOR_INSTALL_CMAKE lib/cmake/${PROJECT_NAME_LC} CACHE PATH "Install path: cmake files")
83 MARK_AS_ADVANCED(PYEDITOR_INSTALL_BINS PYEDITOR_INSTALL_LIBS PYEDITOR_INSTALL_PYTHON
84 PYEDITOR_INSTALL_HEADERS PYEDITOR_INSTALL_RES PYEDITOR_INSTALL_CMAKE)
86 SET(PYEDITOR_EXPORT_NAME ${PROJECT_NAME} CACHE STRING "Export name")
87 MARK_AS_ADVANCED(PYEDITOR_EXPORT_NAME)
93 # Export configuration and targets
94 # ================================
95 IF(NOT PYEDITOR_SUBPROJECT)
96 # Install the export set for use with the install-tree
97 INSTALL(EXPORT ${PYEDITOR_EXPORT_NAME}TargetGroup DESTINATION ${PYEDITOR_INSTALL_CMAKE}
98 FILE ${PROJECT_NAME}Targets.cmake)