From 82cea00610f098a97443dc829584eabd2328a503 Mon Sep 17 00:00:00 2001 From: ageay Date: Mon, 2 Apr 2012 12:40:07 +0000 Subject: [PATCH] Usefull Macro for *.pyc and *.pyo on install. --- .../InstallAndCompilePythonFile.cmake | 33 +++++++++++++++++++ salome_adm/cmake_files/Makefile.am | 3 +- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 salome_adm/cmake_files/InstallAndCompilePythonFile.cmake diff --git a/salome_adm/cmake_files/InstallAndCompilePythonFile.cmake b/salome_adm/cmake_files/InstallAndCompilePythonFile.cmake new file mode 100644 index 000000000..8acdaf333 --- /dev/null +++ b/salome_adm/cmake_files/InstallAndCompilePythonFile.cmake @@ -0,0 +1,33 @@ +# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +MACRO(INSTALL_AND_COMPILE_PYTHON_FILE PYFILE2COMPINST PYFILELOC) + INSTALL(CODE "SET(PYTHON_FILE ${f})") + FOREACH(input ${PYFILE2COMPINST}) + GET_FILENAME_COMPONENT(inputname ${input} NAME) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${inputname} DESTINATION ${PYFILELOC}) + INSTALL(CODE "MESSAGE(STATUS \"py compiling ${CMAKE_INSTALL_PREFIX}/${PYFILELOC}/${inputname}\")") + INSTALL(CODE "SET(CMD \"import py_compile ; py_compile.compile('${CMAKE_INSTALL_PREFIX}/${PYFILELOC}/${inputname}')\")") + INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c \"\${CMD}\")") + INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -O -c \"\${CMD}\")") + ENDFOREACH(input ${PYFILE2COMPINST}) +ENDMACRO(INSTALL_AND_COMPILE_PYTHON_FILE PYFILE2COMPINST PYFILELOC) diff --git a/salome_adm/cmake_files/Makefile.am b/salome_adm/cmake_files/Makefile.am index 05564fe7a..b005aab69 100644 --- a/salome_adm/cmake_files/Makefile.am +++ b/salome_adm/cmake_files/Makefile.am @@ -40,6 +40,7 @@ FindPYTHON.cmake \ FindSWIG.cmake \ FindSPHINX.cmake \ install_python_from_idl.cmake \ -install_and_compile_python_file.cmake +install_and_compile_python_file.cmake \ +InstallAndCompilePythonFile.cmake dist_salomescript_SCRIPTS = prepare_generating_doc.py -- 2.39.2