1 # Copyright (C) 2019 EDF R&D
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.6)
22 SET (CMAKE_CXX_STANDARD 11)
24 SET(BUILD_SHARED_LIBS TRUE)
26 OPTION(YDEFX_BUILD_GUI "Generate widgets" ON)
28 FIND_PACKAGE(Py2cpp REQUIRED)
30 # SalomeKERNEL can be useful in order to define SALOME_INSTALL directories and
31 # for using salome test, but it is not a c++ dependency.
32 FIND_PACKAGE(SalomeKERNEL NO_MODULE)
34 IF(NOT SalomeKERNEL_FOUND)
35 MESSAGE("SalomeKERNEL not found. Salome installation paths will not be used")
38 IF(NOT DEFINED SALOME_INSTALL_PYTHON)
39 EXECUTE_PROCESS ( COMMAND ${PYTHON_EXECUTABLE} -c
40 "from distutils import sysconfig; print(sysconfig.get_python_lib(plat_specific=True, prefix='${CMAKE_INSTALL_PREFIX}'))"
41 OUTPUT_VARIABLE _ABS_PYTHON_MODULE_PATH
42 RESULT_VARIABLE _PYTHON_pythonlib_result
43 OUTPUT_STRIP_TRAILING_WHITESPACE )
45 IF (_PYTHON_pythonlib_result)
46 MESSAGE (SEND_ERROR "Could not set SALOME_INSTALL_PYTHON!")
48 GET_FILENAME_COMPONENT(_ABS_PYTHON_MODULE_PATH
49 ${_ABS_PYTHON_MODULE_PATH} ABSOLUTE)
50 FILE(RELATIVE_PATH SALOME_INSTALL_PYTHON
51 ${CMAKE_INSTALL_PREFIX} ${_ABS_PYTHON_MODULE_PATH})
52 ENDIF(NOT DEFINED SALOME_INSTALL_PYTHON)
54 IF(NOT DEFINED SALOME_INSTALL_BINS)
55 SET(SALOME_INSTALL_BINS "bin")
57 IF(NOT DEFINED SALOME_INSTALL_LIBS)
58 SET(SALOME_INSTALL_LIBS "lib")
60 IF(NOT DEFINED SALOME_INSTALL_HEADERS)
61 SET(SALOME_INSTALL_HEADERS "include")
63 IF(NOT DEFINED SALOME_INSTALL_CMAKE)
64 SET(SALOME_INSTALL_CMAKE "lib/cmake/ydefx")
67 SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Path to install Python files")
68 SET(SALOME_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "Path to install binary files")
69 SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Path to install libraries")
70 SET(SALOME_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "Path to install headers")
71 SET(SALOME_INSTALL_CMAKE "${SALOME_INSTALL_CMAKE}" CACHE PATH "Path to install cmake configuration files")
73 # there are some problems if the configuration tools are included before the
74 # detection of py2cpp and SalomeKERNEL
75 SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
76 IF(EXISTS ${CONFIGURATION_ROOT_DIR})
77 LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
79 INCLUDE(SalomeSetupPlatform)
81 MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !"
85 FIND_PACKAGE(SalomePythonInterp REQUIRED)
86 FIND_PACKAGE(SalomePythonLibs REQUIRED)
89 FIND_PACKAGE(Qt5Widgets CONFIG REQUIRED)
90 ENDIF(YDEFX_BUILD_GUI)
94 INSTALL(EXPORT ydefxCfg_cmake DESTINATION ${SALOME_INSTALL_CMAKE} FILE ydefxConfig.cmake)