Salome HOME
0054504: Exception when accessing VTK renderer with libSalomePy module
[modules/gui.git] / tools / PyEditor / CMakeLists.txt
1 # Copyright (C) 2015-2016  CEA/DEN, EDF R&D
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(PyEditor C CXX)
22
23 # Versioning
24 # ===========
25 # Project name, upper case
26 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
27
28 # To be changed once externalized CMake procedure:
29 ###################
30 SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
31 IF(EXISTS ${KERNEL_ROOT_DIR})
32   LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
33   INCLUDE(SalomeMacros)
34 ELSE(EXISTS ${KERNEL_ROOT_DIR})
35   MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
36 ENDIF(EXISTS ${KERNEL_ROOT_DIR})
37 # From GUI - again to be changed once externalized:
38 LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/../../adm_local/cmake_files")
39 ###################
40
41 # Platform setup
42 # ==============
43 INCLUDE(SalomeSetupPlatform)
44
45 # Options
46 # =======
47 OPTION(PYEDITOR_BUILD_WITH_QT5 "Build PyEditor with Qt 5" ON)
48 OPTION(PYEDITOR_BUILD_SHARED_LIBS "Build shared libraries for PyEditor" ON)
49 OPTION(PYEDITOR_BUILD_EXE "Build PyEditor's executable" ON)
50 OPTION(PYEDITOR_BUILD_PYTHON "Build Python wrapping for PyEditor" ON)
51
52 #
53 # Set list of prerequisites
54 # =========================
55
56 IF(PYEDITOR_BUILD_SHARED_LIBS)
57   SET(BUILD_SHARED_LIBS TRUE)
58 ELSE(PYEDITOR_BUILD_SHARED_LIBS)
59   SET(BUILD_SHARED_LIBS FALSE)
60 ENDIF(PYEDITOR_BUILD_SHARED_LIBS)
61
62 # Qt
63 IF(NOT PYEDITOR_BUILD_WITH_QT5)
64   FIND_PACKAGE(SalomeQt4 REQUIRED)
65 ELSE()
66   FIND_PACKAGE(SalomeQt5 REQUIRED)
67 ENDIF()
68
69 IF(PYEDITOR_BUILD_PYTHON)
70   # Python
71   FIND_PACKAGE(SalomePythonInterp REQUIRED)
72   FIND_PACKAGE(SalomePythonLibs REQUIRED)
73   SALOME_LOG_OPTIONAL_PACKAGE(SalomePythonInterp PYEDITOR_BUILD_PYTHON)
74   SALOME_LOG_OPTIONAL_PACKAGE(SalomePythonLibs PYEDITOR_BUILD_PYTHON)
75   # Sip
76   FIND_PACKAGE(SalomeSIP REQUIRED)  # should come after Python and before PyQt
77   SALOME_LOG_OPTIONAL_PACKAGE(SalomeSIP PYEDITOR_BUILD_PYTHON)
78   # PyQt
79   IF (NOT PYEDITOR_BUILD_WITH_QT5)
80     FIND_PACKAGE(SalomePyQt4 REQUIRED)
81     SALOME_LOG_OPTIONAL_PACKAGE(SalomePyQt4 PYEDITOR_BUILD_PYTHON)
82   ELSE()
83     FIND_PACKAGE(SalomePyQt5 REQUIRED)
84     SALOME_LOG_OPTIONAL_PACKAGE(SalomePyQt5 PYEDITOR_BUILD_PYTHON)
85   ENDIF()
86 ENDIF(PYEDITOR_BUILD_PYTHON)
87
88 # Detection report
89 SALOME_PACKAGE_REPORT_AND_CHECK()
90
91 # Directories
92 #
93 # Directories have to be given after prerequisites (to be able to use
94 # Python version string for example).
95 # ===========
96 SET(PYEDITOR_INSTALL_BINS bin CACHE PATH "Install path: PyEditor binaries")
97 SET(PYEDITOR_INSTALL_LIBS lib CACHE PATH "Install path: PyEditor libraries")
98 SET(PYEDITOR_INSTALL_HEADERS include CACHE PATH "Install path: PyEditor headers")
99 SET(PYEDITOR_INSTALL_RES share/resources CACHE PATH "Install path: PyEditor resources")
100
101 # Sources
102 # ========
103 ADD_SUBDIRECTORY(src)
104