Salome HOME
Minor documentation and code review corrections (39)
[modules/adao.git] / CMakeLists.txt
1 # Copyright (C) 2008-2023 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.
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 # Author: Anthony Geay, anthony.geay@edf.fr, EDF R&D
20
21 cmake_minimum_required(VERSION 2.6)
22
23 project(ADAO)
24
25 include(CMakeDependentOption)
26
27 option(ADAO_PYTHON_MODULE "Build and install ADAO python module files only." ON)
28 option(ADAO_BUILD_DOC "Build and install ADAO documentation." ON)
29 cmake_dependent_option(ADAO_SALOME_MODULE "Build and install ADAO SALOME module files based on ADAO python module." ON "NOT ADAO_PYTHON_MODULE" OFF)
30
31 find_package(PythonInterp)
32
33 if(NOT PYTHONINTERP_FOUND)
34   message(FATAL_ERROR "Python interp not found ! We absolutely need it !")
35 endif(NOT PYTHONINTERP_FOUND)
36
37 set(ADAO_SCRIPT_PYTHON "lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages")
38 set(ADAO_SCRIPT_PYTHON_SALOME "${ADAO_SCRIPT_PYTHON}/salome")
39 set(ADAO_LIB "lib/salome")
40 set(ADAO_RES "share/resources/adao")
41 set(ADAO_RES_SALOME "share/salome/resources/adao")
42 set(ADAO_BIN "bin")
43 set(ADAO_BIN_TEST "bin/salome/test")
44 set(ADAO_TEST "share/test/adao")
45
46 set(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
47 if(EXISTS ${CONFIGURATION_ROOT_DIR})
48   list(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
49   include(SalomeMacros NO_POLICY_SCOPE)
50 else()
51   message(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
52 endif()
53
54 if(ADAO_PYTHON_MODULE)
55
56   install(FILES COPYING.txt README.txt DESTINATION $ENV{CURRENT_SOFTWARE_INSTALL_DIR})
57
58   if(ADAO_BUILD_DOC)
59     find_package(SalomeSphinx)
60     if(NOT SPHINX_FOUND)
61       message(FATAL_ERROR "Sphinx has not been found !")
62     endif(NOT SPHINX_FOUND)
63     add_subdirectory(doc)
64   endif(ADAO_BUILD_DOC)
65
66   add_subdirectory(src)
67   add_subdirectory(resources)
68   add_subdirectory(bin)
69   add_subdirectory(i18n)
70   add_subdirectory(test)
71
72 else(ADAO_PYTHON_MODULE)
73
74   include(SalomeSetupPlatform)
75
76   # ADAO_SALOME_MODULE
77   install(FILES COPYING.txt README.txt DESTINATION $ENV{CURRENT_SOFTWARE_INSTALL_DIR})
78
79   find_package(SalomeOmniORB REQUIRED)
80   find_package(SalomeOmniORBPy REQUIRED)
81   find_package(SalomeKERNEL REQUIRED)
82   KERNEL_WITH_CORBA()
83   add_definitions(${OMNIORB_DEFINITIONS})
84
85   if(NOT ADAO_PYTHON_ROOT_DIR)
86     message(FATAL_ERROR "ADAO_PYTHON_ROOT_DIR cmake variable has to be set if ADAO_SALOME_MODULE option is ON.")
87   endif(NOT ADAO_PYTHON_ROOT_DIR)
88
89   find_file(FILE_OF_ADAO_PYTHON_MODULE "daCore/__init__.py" PATHS "${ADAO_PYTHON_ROOT_DIR}/${ADAO_SCRIPT_PYTHON}/adao")
90   if(NOT FILE_OF_ADAO_PYTHON_MODULE)
91     message(FATAL_ERROR "Could not locate daCore/__init__.py into specified ADAO_PYTHON_ROOT_DIR directory ! Sounds bad !")
92   endif(NOT FILE_OF_ADAO_PYTHON_MODULE)
93
94   if(NOT EFICAS_ROOT_DIR)
95     message(FATAL_ERROR "EFICAS_ROOT_DIR is absolutely needed !")
96   endif(NOT EFICAS_ROOT_DIR)
97
98   find_file(FILE_OF_EFICAS "generator/__init__.py" PATHS ${EFICAS_ROOT_DIR})
99   if(NOT FILE_OF_EFICAS)
100     message(FATAL_ERROR "Could not locate generator/__init__.py into EFICAS_ROOT_DIR")
101   endif(NOT FILE_OF_EFICAS)
102
103   add_subdirectory(src)
104   add_subdirectory(idl)
105   add_subdirectory(resources)
106   add_subdirectory(test)
107
108 endif(ADAO_PYTHON_MODULE)