]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Usefull Macro for *.pyc and *.pyo on install.
authorageay <ageay>
Mon, 2 Apr 2012 12:40:07 +0000 (12:40 +0000)
committerageay <ageay>
Mon, 2 Apr 2012 12:40:07 +0000 (12:40 +0000)
salome_adm/cmake_files/InstallAndCompilePythonFile.cmake [new file with mode: 0644]
salome_adm/cmake_files/Makefile.am

diff --git a/salome_adm/cmake_files/InstallAndCompilePythonFile.cmake b/salome_adm/cmake_files/InstallAndCompilePythonFile.cmake
new file mode 100644 (file)
index 0000000..8acdaf3
--- /dev/null
@@ -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)
index 05564fe7a8cc28d98c5708d81c55642a79180e15..b005aab69288883b0a976c4eef19f01916ee1d43 100644 (file)
@@ -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