1 # Copyright (C) 2012-2016 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(Salome_:sat:{AppModule} 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 0)
31 SET(${PROJECT_NAME_UC}_MINOR_VERSION 0)
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})
38 SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
39 IF(EXISTS ${CONFIGURATION_ROOT_DIR})
40 LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
43 MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
48 SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
49 IF(EXISTS ${KERNEL_ROOT_DIR})
50 LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
51 FIND_PACKAGE(SalomeKERNEL REQUIRED)
52 KERNEL_WITH_CORBA() # check whether KERNEL builded with CORBA
53 ELSE(EXISTS ${KERNEL_ROOT_DIR})
54 MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
55 ENDIF(EXISTS ${KERNEL_ROOT_DIR})
59 OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON)
60 OPTION(SALOME_BUILD_DOC "Generate SALOME :sat:{AppModule} documentation" ON)
62 IF(SALOME_BUILD_TESTS)
68 FIND_PACKAGE(SalomePythonInterp REQUIRED)
69 FIND_PACKAGE(SalomePythonLibs REQUIRED)
70 FIND_PACKAGE(SalomeSphinx)
71 SALOME_LOG_OPTIONAL_PACKAGE(Sphinx SALOME_BUILD_DOC)
78 SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
79 IF(EXISTS ${GUI_ROOT_DIR})
80 LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
81 FIND_PACKAGE(SalomeGUI REQUIRED)
82 SALOME_GUI_WITH_CORBA() #remove this line if you don't need GUI module builded with CORBA
83 #remove unnecessary options from this list (see SALOME_GUI_MODE() macro description)
84 SALOME_GUI_MODE(SALOME_USE_SALOMEOBJECT SALOME_USE_OCCVIEWER SALOME_USE_VTKVIEWER SALOME_USE_PYCONSOLE
85 OPTIONAL SALOME_USE_PLOT2DVIEWER SALOME_USE_GLVIEWER SALOME_USE_GRAPHICSVIEW
86 SALOME_USE_QXGRAPHVIEWER SALOME_USE_PVVIEWER SALOME_USE_PYVIEWER
88 ADD_DEFINITIONS(${GUI_DEFINITIONS})
89 INCLUDE_DIRECTORIES(${GUI_INCLUDE_DIRS})
90 ELSE(EXISTS ${GUI_ROOT_DIR})
91 MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR")
92 ENDIF(EXISTS ${GUI_ROOT_DIR})
95 IF(NOT SALOME_GUI_BUILD_WITH_QT5)
96 FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui)
98 FIND_PACKAGE(SalomeQt5 REQUIRED)
102 # (default values taken from KERNEL)
104 SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH "Install path: SALOME Python scripts")
106 # Specific to :sat:{AppModule}:
107 SET(SALOME_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/salome" CACHE PATH "Install path: SALOME SALOME specific data")
108 SET(SALOME_INSTALL_DOC_GUI "${SALOME_INSTALL_DOC}/gui/${PROJECT_NAME_UC}" CACHE PATH "Install path: SALOME SALOME gui documentation")
109 SET(SALOME_HTML_STATIC_PATH "${SALOME_INSTALL_DOC_GUI}/_static" CACHE PATH "Install path: SALOME SALOME html static data")
111 MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_PYTHON)
113 INSTALL(CODE "FILE(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/USERS)")
117 #ADD_SUBDIRECTORY( src ) # JCC 29/08/2017 #spns 8090
118 ADD_SUBDIRECTORY( resources )
119 #ADD_SUBDIRECTORY( doc )
123 SET(_salome_context_API_SCRIPTS
124 ${KERNEL_ROOT_DIR}/bin/salome/salomeContext.py
125 ${KERNEL_ROOT_DIR}/bin/salome/salomeContextUtils.py
126 ${KERNEL_ROOT_DIR}/bin/salome/parseConfigFile.py
128 SALOME_INSTALL_SCRIPTS("${_salome_context_API_SCRIPTS}" ${SALOME_INSTALL_SCRIPT_PYTHON})
129 SET(_salome_context_TEST_DRIVER
130 ${KERNEL_ROOT_DIR}/bin/salome/appliskel/salome_test_driver.py
131 ${KERNEL_ROOT_DIR}/bin/salome/appliskel/salome_test_driver_gui.py
133 SALOME_INSTALL_SCRIPTS("${_salome_context_TEST_DRIVER}" ${SALOME_INSTALL_SCRIPT_PYTHON}/appliskel)
134 SET(_salome_context_BASHRC
135 ${KERNEL_ROOT_DIR}/bin/salome/appliskel/.bashrc
137 FILE(TO_CMAKE_PATH ${CMAKE_INSTALL_PREFIX} _:sat:{AppModule}_ROOT_DIR)
138 SALOME_INSTALL_SCRIPTS("${_salome_context_BASHRC}" ${_:sat:{AppModule}_ROOT_DIR})