Salome HOME
0f2d52b875f53264e8ba56811e07ad5286e3fb30
[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 QT4
48 find_package ( Qt4 COMPONENTS QtCore QtGui REQUIRED )
49 include( ${QT_USE_FILE} )
50
51 # Detection de PyQt4
52 if (NOT PYQT4_FOUND)
53   execute_process ( COMMAND ${PYTHON_EXECUTABLE} -c "\"import PyQt4\""
54                     RESULT_VARIABLE _res
55                     OUTPUT_VARIABLE _trashout
56                     ERROR_VARIABLE  _trasherr
57                   )
58   if (NOT _res)
59     message ( STATUS "Looking for Python package PyQt4 - found" )
60     set ( PYQT4_FOUND 1 CACHE INTERNAL "True if Python package PyQt4 is here" )
61   else (NOT _res)
62     message ( STATUS "Looking for Python package PyQt4 - not found" )
63     set ( PYQT4_FOUND 0 CACHE INTERNAL "True if Python package PyQt4 is here" )
64   endif (NOT _res)
65 endif (NOT PYQT4_FOUND)
66
67 if (NOT PYQT4_FOUND)
68   message ( FATAL_ERROR "Python package PyQt4 is REQUIRED" )
69 endif (NOT PYQT4_FOUND)
70
71 # Detection de pyuic4
72 find_program ( PYUIC4 NAMES pyuic4
73                DOC  "Path to the pyuic4 compilation tool"
74              )
75 if (NOT PYUIC4)
76   message ( FATAL_ERROR "pyuic4 tool is REQUIRED" )
77 endif (NOT PYUIC4)
78
79 # Definition des options de CMake
80 option ( WITH_ALL_PACKAGES "Install all package files" OFF )
81 option ( WITH_SALOME_MECA  "Install OT, Aster and SEP files" OFF )
82 option ( WITH_OPENTURNS    "Install Open TURNS files"  OFF )
83 option ( WITH_ASTER        "Install Aster files"       OFF )
84 option ( WITH_MAP          "Install MAP files"         OFF )
85 option ( WITH_SEP          "Install SEP files"         OFF )
86
87 set ( _OPTIONLIST
88   WITH_OPENTURNS 
89   WITH_ASTER
90   WITH_MAP
91   WITH_SEP
92   WITH_TK
93   WITH_SALOME_MECA
94   )
95
96 set ( _SALOME_MECA_LIST
97   WITH_OPENTURNS 
98   WITH_ASTER
99   WITH_SEP
100   )
101
102 if (WITH_ALL_PACKAGES)
103   foreach ( _opt ${_OPTIONLIST} )
104     set ( ${_opt} ON )
105   endforeach ( _opt )
106 endif (WITH_ALL_PACKAGES)
107
108 if (WITH_SALOME_MECA)
109   foreach ( _opt ${_SALOME_MECA_LIST} )
110     set ( ${_opt} ON )
111   endforeach ( _opt )
112 endif (WITH_SALOME_MECA)
113
114 # Verification: au moins une option doit etre selectionnee
115 set ( _VALIDOPT FALSE )
116 foreach ( _opt ${_OPTIONLIST} )
117   if ( ${_opt} )
118     set ( _VALIDOPT TRUE )
119     string ( REPLACE WITH_ "" _opt2 ${_opt} )
120     message ( STATUS "Will install package ${_opt2}" )
121   endif ( ${_opt} )
122 endforeach ( _opt )
123 if ( NOT ${_VALIDOPT} )
124   message ( FATAL_ERROR "At least one option within ${_OPTIONLIST} must be selected" )
125 endif ( NOT ${_VALIDOPT} )
126
127 # Detection des prerequis lies aux options
128 if (WITH_OPENTURNS)
129   find_package ( OpenTURNS REQUIRED )
130 endif (WITH_OPENTURNS)
131
132 #if (WITH_ASTER)
133 #  find_package ( Aster REQUIRED )
134 #endif (WITH_ASTER)
135
136 #if (WITH_MAP)
137 #  find_package ( MAP REQUIRED )
138 #endif (WITH_MAP)
139
140
141 # Parcours recursif des sous-repertoires
142 add_subdirectory ( Accas )
143 add_subdirectory ( Aide )
144 add_subdirectory ( Editeur )
145 add_subdirectory ( Extensions )
146 add_subdirectory ( Ihm )
147 add_subdirectory ( InterfaceQT4 )
148 add_subdirectory ( Noyau )
149 add_subdirectory ( UiQT4 )
150 add_subdirectory ( Validation )
151 add_subdirectory ( convert )
152 add_subdirectory ( generator )
153
154 # Installation des fichiers : Open TURNS
155 if (WITH_OPENTURNS)
156   add_subdirectory ( Openturns_Study )
157   add_subdirectory ( Openturns_Wrapper )
158 endif (WITH_OPENTURNS)
159
160 # Installation des fichiers : Aster
161 if (WITH_ASTER)
162   add_subdirectory ( Aster )
163   add_subdirectory ( Traducteur )
164 endif (WITH_ASTER)
165
166 if (WITH_TK)
167   add_subdirectory ( InterfaceTK )
168   add_subdirectory ( Pmw )
169   add_subdirectory ( Tools )
170   add_subdirectory ( Misc )
171   add_subdirectory ( AIDE )
172 endif (WITH_TK)
173
174 # Installation des fichiers : MAP
175 if (WITH_MAP)
176   add_subdirectory ( Map )
177 endif (WITH_MAP)
178
179 # Installation des fichiers : Sep
180 if (WITH_SEP)
181   add_subdirectory ( Sep )
182 endif (WITH_SEP)
183
184 ### Local Variables:
185 ### mode: cmake
186 ### End: