From d7a7a46afa81b82cac636b9715c26515fd578138 Mon Sep 17 00:00:00 2001 From: Larry Shaffer Date: Tue, 30 Oct 2012 18:39:22 -0600 Subject: [PATCH] Add CMake option WITH_STAGED_PLUGINS (ON by default) - Core plugins remain available once staged (no need to re-build targets, unless source updated or build directory cleared) - Once plugins are staged, setting WITH_STAGED_PLUGINS to OFF allows for much quicker subsequent builds - PyQGIS utilities, console and installer are always staged, regardless of WITH_STAGED_PLUGINS --- CMakeLists.txt | 1 + python/plugins/CMakeLists.txt | 30 ++++++++++++++++-------------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f388637349c..96bb32fe7c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,6 +76,7 @@ IF (WITH_BINDINGS) # as otherwise user has to use PYTHONPATH environemnt variable to add # QGIS bindings to package search path SET (BINDINGS_GLOBAL_INSTALL FALSE CACHE BOOL "Install bindings to global python directory? (might need root)") + SET (WITH_STAGED_PLUGINS TRUE CACHE BOOL "Stage-install core Python plugins to run from build directory? (utilities, console and installer are always staged)") SET (WITH_PY_COMPILE FALSE CACHE BOOL "Determines whether Python modules in staged or installed locations are byte-compiled") # concatenate QScintilla2 API files SET (WITH_QSCIAPI TRUE CACHE BOOL "Determines whether the QScintilla2 API files will be updated and concatenated") diff --git a/python/plugins/CMakeLists.txt b/python/plugins/CMakeLists.txt index c0b7caeaf46..ed94577c516 100644 --- a/python/plugins/CMakeLists.txt +++ b/python/plugins/CMakeLists.txt @@ -8,20 +8,22 @@ ENDIF(WITH_PY_COMPILE) MACRO (PLUGIN_INSTALL plugin subdir ) INSTALL(FILES ${ARGN} DESTINATION ${QGIS_DATA_DIR}/python/plugins/${plugin}/${subdir}) - STRING(REPLACE "/" "_" subdir_sane "${subdir}") - ADD_CUSTOM_TARGET(${plugin}_${subdir_sane}_stageinstall ALL DEPENDS ${ARGN}) - IF(WITH_PY_COMPILE) - ADD_DEPENDENCIES(pycompile_staged ${plugin}_${subdir_sane}_stageinstall) - ENDIF(WITH_PY_COMPILE) - FOREACH(file ${ARGN}) - ADD_CUSTOM_COMMAND(TARGET ${plugin}_${subdir_sane}_stageinstall - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E make_directory ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}/${subdir} - COMMAND ${CMAKE_COMMAND} -E copy \"${file}\" ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}/${subdir} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - #COMMENT "copying ${file} to ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}/${subdir}" - ) - ENDFOREACH(file) + IF(WITH_STAGED_PLUGINS OR "${plugin}" STREQUAL "plugin_installer") + STRING(REPLACE "/" "_" subdir_sane "${subdir}") + ADD_CUSTOM_TARGET(${plugin}_${subdir_sane}_stageinstall ALL DEPENDS ${ARGN}) + IF(WITH_PY_COMPILE) + ADD_DEPENDENCIES(pycompile_staged ${plugin}_${subdir_sane}_stageinstall) + ENDIF(WITH_PY_COMPILE) + FOREACH(file ${ARGN}) + ADD_CUSTOM_COMMAND(TARGET ${plugin}_${subdir_sane}_stageinstall + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}/${subdir} + COMMAND ${CMAKE_COMMAND} -E copy \"${file}\" ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}/${subdir} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + #COMMENT "copying ${file} to ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}/${subdir}" + ) + ENDFOREACH(file) + ENDIF() ENDMACRO (PLUGIN_INSTALL)