From 764614388972a4763bb6e4f66c553b30a0e7d76b Mon Sep 17 00:00:00 2001 From: Renaud Barate Date: Fri, 1 Mar 2013 16:55:03 +0100 Subject: [PATCH] Compile Python files on installation --- CMakeLists.txt | 2 ++ src/CMakeLists.txt | 2 -- src/PARAMETRIC/CMakeLists.txt | 2 +- src/PARAMETRICGUI/CMakeLists.txt | 2 +- src/salome/CMakeLists.txt | 6 ++++++ src/salome/parametric/CMakeLists.txt | 9 +++++++++ src/salome/parametric/gui/CMakeLists.txt | 13 ++++++++++++- 7 files changed, 31 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b1f8b2a..05179c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,8 @@ FIND_PACKAGE(SalomeSPHINX) FIND_PACKAGE(SalomeSIP) FIND_PACKAGE(SalomePYQT4) +INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/SalomeMacros.cmake) + SET(BINDIR bin/salome) SET(RESDIR share/salome/resources/parametric) SET(LIBDIR lib/salome) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 765f780..1be7161 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,5 +18,3 @@ ADD_SUBDIRECTORY(PARAMETRIC) ADD_SUBDIRECTORY(PARAMETRICGUI) ADD_SUBDIRECTORY(salome) - -INSTALL(DIRECTORY salome DESTINATION ${PYTHONDIR} FILES_MATCHING PATTERN "*.py") diff --git a/src/PARAMETRIC/CMakeLists.txt b/src/PARAMETRIC/CMakeLists.txt index 1eef9a6..19db10e 100644 --- a/src/PARAMETRIC/CMakeLists.txt +++ b/src/PARAMETRIC/CMakeLists.txt @@ -15,4 +15,4 @@ # You should have received a copy of the GNU Lesser General Public License # along with SALOME PARAMETRIC module. If not, see . -INSTALL(FILES PARAMETRIC.py DESTINATION ${BINDIR}) +INSTALL_AND_COMPILE_PYTHON_FILE(PARAMETRIC.py ${BINDIR}) diff --git a/src/PARAMETRICGUI/CMakeLists.txt b/src/PARAMETRICGUI/CMakeLists.txt index 3334038..6b115c7 100644 --- a/src/PARAMETRICGUI/CMakeLists.txt +++ b/src/PARAMETRICGUI/CMakeLists.txt @@ -15,4 +15,4 @@ # You should have received a copy of the GNU Lesser General Public License # along with SALOME PARAMETRIC module. If not, see . -INSTALL(FILES PARAMETRICGUI.py DESTINATION ${BINDIR}) +INSTALL_AND_COMPILE_PYTHON_FILE(PARAMETRICGUI.py ${BINDIR}) diff --git a/src/salome/CMakeLists.txt b/src/salome/CMakeLists.txt index 7735ed8..73e16b5 100644 --- a/src/salome/CMakeLists.txt +++ b/src/salome/CMakeLists.txt @@ -16,3 +16,9 @@ # along with SALOME PARAMETRIC module. If not, see . ADD_SUBDIRECTORY(parametric) + +SET(PYTHON_FILES + __init__.py +) + +INSTALL_AND_COMPILE_PYTHON_FILE("${PYTHON_FILES}" ${PYTHONDIR}/salome) diff --git a/src/salome/parametric/CMakeLists.txt b/src/salome/parametric/CMakeLists.txt index d3de504..de5501e 100644 --- a/src/salome/parametric/CMakeLists.txt +++ b/src/salome/parametric/CMakeLists.txt @@ -16,3 +16,12 @@ # along with SALOME PARAMETRIC module. If not, see . ADD_SUBDIRECTORY(gui) + +SET(PYTHON_FILES + __init__.py + genjob.py + persistence.py + study.py +) + +INSTALL_AND_COMPILE_PYTHON_FILE("${PYTHON_FILES}" ${PYTHONDIR}/salome/parametric) diff --git a/src/salome/parametric/gui/CMakeLists.txt b/src/salome/parametric/gui/CMakeLists.txt index 1766c66..6220f97 100644 --- a/src/salome/parametric/gui/CMakeLists.txt +++ b/src/salome/parametric/gui/CMakeLists.txt @@ -15,6 +15,15 @@ # You should have received a copy of the GNU Lesser General Public License # along with SALOME PARAMETRIC module. If not, see . +SET(PYTHON_FILES + __init__.py + definevalues.py + execparams.py + genjob.py + mainpanel.py + selectvars.py + wizard.py +) SET(PYUIC_FILES wizard_ui.py varrange_ui.py execparams_ui.py genjob_ui.py definevalues_ui.py) SET(INSTALL_DIR ${PYTHONDIR}/salome/parametric/gui) @@ -26,7 +35,9 @@ FOREACH(OUTPUT ${PYUIC_FILES}) COMMAND ${PYQT_PYUIC_EXECUTABLE} -o ${OUTPUT} ${INPUT} MAIN_DEPENDENCY ${INPUT} ) - INSTALL(FILES ${OUTPUT} DESTINATION ${INSTALL_DIR}) + SET(PYTHON_FILES ${PYTHON_FILES} ${OUTPUT}) ENDFOREACH(OUTPUT ${PYUIC_FILES}) ADD_CUSTOM_TARGET(BUILD_PY_UI_FILES ALL DEPENDS ${PYUIC_FILES}) + +INSTALL_AND_COMPILE_PYTHON_FILE("${PYTHON_FILES}" ${INSTALL_DIR}) -- 2.39.2