Salome HOME
Pour Telemac et qques bugs
[tools/eficas.git] / CMakeLists.txt
1 # -*- coding: utf-8 -*-
2 #            CONFIGURATION MANAGEMENT OF EDF VERSION
3 # ======================================================================
4 # COPYRIGHT (C) 1991 - 2002  EDF R&D                  WWW.CODE-ASTER.ORG
5 # THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
6 # IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
7 # THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
8 # (AT YOUR OPTION) ANY LATER VERSION.
9 #
10 # THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
11 # WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
12 # MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
13 # GENERAL PUBLIC LICENSE FOR MORE DETAILS.
14 #
15 # YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
16 # ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
17 #    1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
18 #
19 #
20 # ======================================================================
21
22 cmake_minimum_required ( VERSION 2.8 )
23
24 project ( Eficas CXX C )
25
26 # Definition du chemin d'acces aux modules additionnels
27 set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules" )
28
29 # Detection de Python
30 find_package ( PythonInterp 2.4 REQUIRED )
31 if (PYTHONINTERP_FOUND)
32   string ( RANDOM tmpPyScript )
33   set ( tmpPyScript "${tmpPyScript}.py" )
34   file ( WRITE  ${tmpPyScript}
35 "# Automaticaly generated by CMake. Do NOT edit. Changes will be lost
36 import sys
37 print '%d.%d' % ( sys.version_info[0], sys.version_info[1] )
38 " )
39   get_source_file_property ( PYSCRIPT_LOC ${tmpPyScript} LOCATION )
40   execute_process ( COMMAND ${PYTHON_EXECUTABLE} ${PYSCRIPT_LOC}
41                     OUTPUT_VARIABLE PYTHON_VERSION
42                     #ERROR_QUIET
43                     OUTPUT_STRIP_TRAILING_WHITESPACE )
44   file ( REMOVE ${tmpPyScript} )
45 endif (PYTHONINTERP_FOUND)
46 message ( STATUS "Using Python version ${PYTHON_VERSION}" )
47 # Detection de QT5
48 find_package ( Qt5 COMPONENTS Core REQUIRED )
49
50 FIND_PACKAGE(Qt5LinguistTools)
51 GET_TARGET_PROPERTY(QT_LRELEASE_EXECUTABLE Qt5::lrelease LOCATION)
52 MARK_AS_ADVANCED(QT_LRELEASE_EXECUTABLE)
53
54 # Detection de PyQt5
55 if (NOT PYQT5_FOUND)
56   execute_process ( COMMAND ${PYTHON_EXECUTABLE} -c "\"import PyQt5\""
57                     RESULT_VARIABLE _res
58                     OUTPUT_VARIABLE _trashout
59                     ERROR_VARIABLE  _trasherr
60                   )
61   if (NOT _res)
62     message ( STATUS "Looking for Python package PyQt5 - found" )
63     set ( PYQT5_FOUND 1 CACHE INTERNAL "True if Python package PyQt5 is here" )
64   else (NOT _res)
65     message ( STATUS "Looking for Python package PyQt5 - not found" )
66     set ( PYQT5_FOUND 0 CACHE INTERNAL "True if Python package PyQt5 is here" )
67   endif (NOT _res)
68 endif (NOT PYQT5_FOUND)
69
70 if (NOT PYQT5_FOUND)
71   message ( FATAL_ERROR "Python package PyQt5 is REQUIRED" )
72 endif (NOT PYQT5_FOUND)
73
74 # Detection de PYUIC5
75 find_program ( PYUIC5 NAMES pyuic5
76                DOC  "Path to the pyuic5 compilation tool"
77              )
78 if (NOT PYUIC5)
79   message ( FATAL_ERROR "pyuic5 tool is REQUIRED" )
80 endif (NOT PYUIC5)
81
82 # Definition des options de CMake
83 option ( WITH_ALL_PACKAGES "Install all package files" OFF )
84 option ( WITH_MAP          "Install MAP files"         OFF )
85 option ( WITH_CARMEL       "Install CARMEL files"      OFF )
86 option ( WITH_SEP          "Install SEP files"         OFF )
87 option ( WITH_ZCRACKS      "Install ZCRACKS files"     OFF )
88 option ( WITH_TELEMAC_CATA "Install TELEMAC files"     OFF )
89 option ( IN_SALOME_CONTEXT "Configure Eficas for use in Salome" OFF )
90
91 if (WITH_ALL_PACKAGES)
92   foreach ( _opt ${_OPTIONLIST} )
93     set ( ${_opt} ON )
94   endforeach ( _opt )
95 endif (WITH_ALL_PACKAGES)
96
97
98
99
100 # Parcours recursif des sous-repertoires
101 if ( NOT WITH_TELEMAC_CATA )
102   add_subdirectory ( Accas )
103   add_subdirectory ( Aide )
104   add_subdirectory ( Editeur )
105   add_subdirectory ( Extensions )
106   add_subdirectory ( Ihm )
107   install ( DIRECTORY InterfaceQT4 DESTINATION ${CMAKE_INSTALL_PREFIX} )
108   add_subdirectory ( Noyau )
109   add_subdirectory ( UiQT5 )
110   add_subdirectory ( Validation )
111   add_subdirectory ( convert )
112   add_subdirectory ( generator )
113   add_subdirectory ( Traducteur )
114 endif ( NOT WITH_TELEMAC_CATA )
115
116
117 # Installation des fichiers : MAP
118 if (WITH_MAP)
119   add_subdirectory ( MAP )
120 endif (WITH_MAP)
121
122 # Installation des fichiers : CARMEL
123 if (WITH_CARMEL)
124   add_subdirectory ( Carmel3D )
125   add_subdirectory ( CarmelCND )
126   add_subdirectory ( CarmelCS )
127 endif (WITH_CARMEL)
128
129 # Installation des fichiers : Sep
130 if (WITH_SEP)
131   add_subdirectory ( Sep )
132 endif (WITH_SEP)
133
134 # Installation des fichiers : ZCracks
135 if (WITH_ZCRACKS)
136   add_subdirectory ( ZCracks )
137 endif (WITH_ZCRACKS)
138
139 # Installation des fichiers : Telemac
140 if (WITH_TELEMAC_CATA)
141   add_subdirectory ( Telemac )
142 endif (WITH_TELEMAC_CATA)
143
144 if (BUILD_DOC)
145   add_subdirectory ( Doc )
146 endif (BUILD_DOC)
147
148 ### Local Variables:
149 ### mode: cmake
150 ### End: