1 # Copyright (C) 2012-2020 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_[Name_of_Application]_Profile C CXX)
24 # Project name, upper case
25 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
27 SET(${PROJECT_NAME_UC}_MAJOR_VERSION 0)
28 SET(${PROJECT_NAME_UC}_MINOR_VERSION 0)
29 SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
30 SET(${PROJECT_NAME_UC}_VERSION
31 ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
35 SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
36 IF(EXISTS ${CONFIGURATION_ROOT_DIR})
37 LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
38 INCLUDE(SalomeMacros NO_POLICY_SCOPE)
40 MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
45 SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
46 IF(EXISTS ${KERNEL_ROOT_DIR})
47 FIND_PACKAGE(SalomeKERNEL REQUIRED)
48 KERNEL_WITH_CORBA() # check whether KERNEL built with CORBA
49 ELSE(EXISTS ${KERNEL_ROOT_DIR})
50 MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
51 ENDIF(EXISTS ${KERNEL_ROOT_DIR})
55 OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON)
56 OPTION(SALOME_BUILD_DOC "Generate SALOME [Name_of_Application] documentation" ON)
58 IF(SALOME_BUILD_TESTS)
64 FIND_PACKAGE(SalomePythonInterp REQUIRED)
65 FIND_PACKAGE(SalomePythonLibs REQUIRED)
66 FIND_PACKAGE(SalomeSphinx)
67 SALOME_LOG_OPTIONAL_PACKAGE(Sphinx SALOME_BUILD_DOC)
74 SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
75 IF(EXISTS ${GUI_ROOT_DIR})
76 LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
77 FIND_PACKAGE(SalomeGUI REQUIRED)
78 SALOME_GUI_WITH_CORBA() #remove this line if you don't need GUI module built with CORBA
79 #remove unnecessary options from this list (see SALOME_GUI_MODE() macro description)
80 SALOME_GUI_MODE(SALOME_USE_SALOMEOBJECT SALOME_USE_OCCVIEWER SALOME_USE_VTKVIEWER SALOME_USE_PYCONSOLE
81 OPTIONAL SALOME_USE_PLOT2DVIEWER SALOME_USE_GLVIEWER SALOME_USE_GRAPHICSVIEW
82 SALOME_USE_QXGRAPHVIEWER SALOME_USE_PVVIEWER SALOME_USE_PYVIEWER
84 ADD_DEFINITIONS(${GUI_DEFINITIONS})
85 INCLUDE_DIRECTORIES(${GUI_INCLUDE_DIRS})
86 ELSE(EXISTS ${GUI_ROOT_DIR})
87 MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR")
88 ENDIF(EXISTS ${GUI_ROOT_DIR})
91 FIND_PACKAGE(SalomeQt5 REQUIRED)
94 # (default values taken from KERNEL)
96 SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH "Install path: SALOME Python scripts")
98 # Specific to [NAME_OF_APPLICATION]:
99 SET(SALOME_[NAME_OF_APPLICATION]_PROFILE_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/(name_of_application)_profile" CACHE PATH "Install path: SALOME [NAME_OF_APPLICATION] specific data")
100 SET(SALOME_[NAME_OF_APPLICATION]_PROFILE_INSTALL_DOC_GUI "${SALOME_INSTALL_DOC}/gui/${PROJECT_NAME_UC}" CACHE PATH "Install path: SALOME [NAME_OF_APPLICATION] gui documentation")
101 SET(SALOME_[NAME_OF_APPLICATION]_PROFILE_HTML_STATIC_PATH "${SALOME_[NAME_OF_APPLICATION]_PROFILE_INSTALL_DOC_GUI}/_static" CACHE PATH "Install path: SALOME [NAME_OF_APPLICATION] html static data")
103 MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_PYTHON)
105 INSTALL(CODE "FILE(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/USERS)")
109 ADD_SUBDIRECTORY( src )
110 ADD_SUBDIRECTORY( resources )
111 ADD_SUBDIRECTORY( doc )
115 SET(_salome_context_API_SCRIPTS
116 ${KERNEL_ROOT_DIR}/bin/salome/salomeContext.py
117 ${KERNEL_ROOT_DIR}/bin/salome/salomeContextUtils.py
118 ${KERNEL_ROOT_DIR}/bin/salome/parseConfigFile.py
120 SALOME_INSTALL_SCRIPTS("${_salome_context_API_SCRIPTS}" ${SALOME_INSTALL_SCRIPT_PYTHON})
121 SET(_salome_context_BASHRC
122 ${KERNEL_ROOT_DIR}/bin/salome/appliskel/.bashrc
124 FILE(TO_CMAKE_PATH ${CMAKE_INSTALL_PREFIX} _[NAME_OF_APPLICATION]_PROFILE_ROOT_DIR)
125 SALOME_INSTALL_SCRIPTS("${_salome_context_BASHRC}" ${_[NAME_OF_APPLICATION]_PROFILE_ROOT_DIR})