# -*- coding: utf-8 -*-
# CONFIGURATION MANAGEMENT OF EDF VERSION
# ======================================================================
-# COPYRIGHT (C) 1991 - 2002, 2013 EDF R&D WWW.CODE-ASTER.ORG
+# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
#
# ======================================================================
-set ( _PYFILES )
-macro ( eficas_compile_ui uifile )
- get_filename_component ( _file_we ${uifile} NAME_WE )
- set ( _pyfile "${_file_we}.py" )
- add_custom_command ( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_pyfile}
- COMMAND ${PYUIC4} ARGS -x -o ${CMAKE_CURRENT_BINARY_DIR}/${_pyfile} ${CMAKE_CURRENT_SOURCE_DIR}/${uifile}
- MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/${uifile}
- COMMENT "Compiling ${uifile}"
- )
- list ( APPEND _PYFILES ${CMAKE_CURRENT_BINARY_DIR}/${_pyfile} )
-endmacro ( eficas_compile_ui )
-
-eficas_compile_ui ( desSelectVal.ui )
-eficas_compile_ui ( desViewTexte.ui )
-eficas_compile_ui ( desChoixCommandes.ui )
-eficas_compile_ui ( desParam.ui )
-eficas_compile_ui ( desWidgetCommande.ui )
-eficas_compile_ui ( desWidgetSimpBase.ui )
-eficas_compile_ui ( desWidget4a6RadioButton.ui )
-eficas_compile_ui ( desWidgetRadioButton.ui )
-eficas_compile_ui ( desWidgetBloc.ui )
-eficas_compile_ui ( desWidgetCB.ui )
-eficas_compile_ui ( desWidgetPlusieursBase.ui )
-eficas_compile_ui ( desWidgetFact.ui )
-eficas_compile_ui ( desWidgetFactPlie.ui )
-eficas_compile_ui ( desWidgetSimpBool.ui )
-eficas_compile_ui ( desWidgetSimpComplexe.ui )
-eficas_compile_ui ( myMain.ui )
-eficas_compile_ui ( desChoixCata.ui )
-eficas_compile_ui ( desWidgetPlusieursInto.ui )
-eficas_compile_ui ( desWidgetPlusieursIntoOrdonne.ui )
-eficas_compile_ui ( desBaseWidget.ui )
-eficas_compile_ui ( desWidgetOptionnel.ui )
-eficas_compile_ui ( desWidgetSimpFichier.ui )
-eficas_compile_ui ( desWidgetSimpTxt.ui )
-eficas_compile_ui ( desRecherche.ui )
-eficas_compile_ui ( desWidgetCommentaire.ui )
-eficas_compile_ui ( desWidgetTuple2.ui )
-eficas_compile_ui ( desWidgetTuple3.ui )
-eficas_compile_ui ( desWidgetParam.ui )
-eficas_compile_ui ( desWidgetHeure.ui )
-eficas_compile_ui ( desWidgetDate.ui )
-eficas_compile_ui ( desWidgetVide.ui )
-eficas_compile_ui ( desWidgetInformation.ui )
-eficas_compile_ui ( desVisu.ui )
-eficas_compile_ui ( desSelectVal.ui )
-
-add_custom_target ( CompileUI ALL DEPENDS ${_PYFILES}
- COMMENT "Built UI files"
+cmake_minimum_required ( VERSION 2.8 )
+
+project ( Eficas CXX C )
+
+# Definition du chemin d'acces aux modules additionnels
+set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules" )
+
+# Detection de Python
+find_package ( PythonInterp REQUIRED )
+if (PYTHONINTERP_FOUND)
+ string ( RANDOM tmpPyScript )
+ set ( tmpPyScript "${tmpPyScript}.py" )
+ file ( WRITE ${tmpPyScript}
+"# Automaticaly generated by CMake. Do NOT edit. Changes will be lost
+import sys
+print ('%d.%d' % ( sys.version_info[0], sys.version_info[1] ))
+" )
+ get_source_file_property ( PYSCRIPT_LOC ${tmpPyScript} LOCATION )
+ execute_process ( COMMAND ${PYTHON_EXECUTABLE} ${PYSCRIPT_LOC}
+ OUTPUT_VARIABLE PYTHON_VERSION
+ #ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE )
+ file ( REMOVE ${tmpPyScript} )
+endif (PYTHONINTERP_FOUND)
+message ( STATUS "Using Python version ${PYTHON_VERSION}" )
+# Detection de QT5
+find_package ( Qt5 COMPONENTS Core REQUIRED )
+
+FIND_PACKAGE(Qt5LinguistTools)
+GET_TARGET_PROPERTY(QT_LRELEASE_EXECUTABLE Qt5::lrelease LOCATION)
+MARK_AS_ADVANCED(QT_LRELEASE_EXECUTABLE)
+
+# Detection de PyQt5
+if (NOT PYQT5_FOUND)
+ execute_process ( COMMAND ${PYTHON_EXECUTABLE} -c "\"import PyQt5\""
+ RESULT_VARIABLE _res
+ OUTPUT_VARIABLE _trashout
+ ERROR_VARIABLE _trasherr
)
+ if (NOT _res)
+ message ( STATUS "Looking for Python package PyQt5 - found" )
+ set ( PYQT5_FOUND 1 CACHE INTERNAL "True if Python package PyQt5 is here" )
+ else (NOT _res)
+ message ( STATUS "Looking for Python package PyQt5 - not found" )
+ set ( PYQT5_FOUND 0 CACHE INTERNAL "True if Python package PyQt5 is here" )
+ endif (NOT _res)
+endif (NOT PYQT5_FOUND)
+
+if (NOT PYQT5_FOUND)
+ message ( FATAL_ERROR "Python package PyQt5 is REQUIRED" )
+endif (NOT PYQT5_FOUND)
+
+# Detection de PYUIC5
+find_program ( PYUIC5 NAMES pyuic5
+ DOC "Path to the pyuic5 compilation tool"
+ )
+if (NOT PYUIC5)
+ message ( FATAL_ERROR "pyuic5 tool is REQUIRED" )
+endif (NOT PYUIC5)
+
+# Definition des options de CMake
+option ( WITH_ALL_PACKAGES "Install all package files" OFF )
+option ( WITH_CARMEL "Install CARMEL files" OFF )
+option ( WITH_SEP "Install SEP files" OFF )
+option ( WITH_ZCRACKS "Install ZCRACKS files" OFF )
+option ( WITH_TELEMAC_CATA "Install TELEMAC files" OFF )
+option ( IN_SALOME_CONTEXT "Configure Eficas for use in Salome" OFF )
+
+set ( _OPTIONLIST
+ WITH_CARMEL
+ WITH_TELEMAC_CATA
+ )
+
+if (WITH_ALL_PACKAGES)
+ foreach ( _opt ${_OPTIONLIST} )
+ set ( ${_opt} ON )
+ endforeach ( _opt )
+endif (WITH_ALL_PACKAGES)
+
+
+# Verification: au moins une option doit etre selectionnee
+set ( _VALIDOPT FALSE )
+foreach ( _opt ${_OPTIONLIST} )
+ if ( ${_opt} )
+ set ( _VALIDOPT TRUE )
+ string ( REPLACE WITH_ "" _opt2 ${_opt} )
+ message ( STATUS "Will install package ${_opt2}" )
+ endif ( ${_opt} )
+endforeach ( _opt )
+if ( NOT ${_VALIDOPT} )
+ message ( FATAL_ERROR "At least one option within ${_OPTIONLIST} must be selected" )
+endif ( NOT ${_VALIDOPT} )
+
+
+
+# Parcours recursif des sous-repertoires
+add_subdirectory ( Accas )
+add_subdirectory ( Aide )
+add_subdirectory ( Editeur )
+add_subdirectory ( Extensions )
+add_subdirectory ( Ihm )
+install ( DIRECTORY InterfaceQT4 DESTINATION ${CMAKE_INSTALL_PREFIX} )
+add_subdirectory ( Noyau )
+add_subdirectory ( UiQT5 )
+add_subdirectory ( Validation )
+add_subdirectory ( convert )
+add_subdirectory ( generator )
+add_subdirectory ( Traducteur )
+
+
+# Installation des fichiers : CARMEL
+if (WITH_CARMEL)
+ add_subdirectory ( Carmel3D )
+ add_subdirectory ( CarmelCND )
+ add_subdirectory ( CarmelCS )
+endif (WITH_CARMEL)
+
+
+# Installation des fichiers : ZCracks
+if (WITH_ZCRACKS)
+ add_subdirectory ( ZCracks )
+endif (WITH_ZCRACKS)
+
+# Installation des fichiers : Telemac
+if (WITH_TELEMAC_CATA)
+ add_subdirectory ( Telemac )
+endif (WITH_TELEMAC_CATA)
-install ( FILES ${_PYFILES}
- DESTINATION ${CMAKE_INSTALL_PREFIX}/UiQT4
- )
-
-# Rules to compile TS files
-SET(TSFILES eficas_en.ts
- eficas_fr.ts)
-
-SET(QMFILES)
-FOREACH(input ${TSFILES})
- GET_FILENAME_COMPONENT(base ${input} NAME_WE)
- SET(output ${CMAKE_CURRENT_BINARY_DIR}/${base}.qm)
- SET(QMFILES ${QMFILES} ${output})
- ADD_CUSTOM_COMMAND(OUTPUT ${output}
- COMMAND ${QT_LRELEASE_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${input} -qm ${output}
- MAIN_DEPENDENCY ${input})
-ENDFOREACH(input ${TSFILES})
-
-ADD_CUSTOM_TARGET(CompileTS ALL DEPENDS ${QMFILES})
-INSTALL(FILES ${QMFILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/UiQT4)
+if (BUILD_DOC)
+ add_subdirectory ( Doc )
+endif (BUILD_DOC)
### Local Variables:
### mode: cmake