Skip to content

Commit d7a7a46

Browse files
committed
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
1 parent 9918350 commit d7a7a46

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ IF (WITH_BINDINGS)
7676
# as otherwise user has to use PYTHONPATH environemnt variable to add
7777
# QGIS bindings to package search path
7878
SET (BINDINGS_GLOBAL_INSTALL FALSE CACHE BOOL "Install bindings to global python directory? (might need root)")
79+
SET (WITH_STAGED_PLUGINS TRUE CACHE BOOL "Stage-install core Python plugins to run from build directory? (utilities, console and installer are always staged)")
7980
SET (WITH_PY_COMPILE FALSE CACHE BOOL "Determines whether Python modules in staged or installed locations are byte-compiled")
8081
# concatenate QScintilla2 API files
8182
SET (WITH_QSCIAPI TRUE CACHE BOOL "Determines whether the QScintilla2 API files will be updated and concatenated")

python/plugins/CMakeLists.txt

+16-14
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,22 @@ ENDIF(WITH_PY_COMPILE)
88

99
MACRO (PLUGIN_INSTALL plugin subdir )
1010
INSTALL(FILES ${ARGN} DESTINATION ${QGIS_DATA_DIR}/python/plugins/${plugin}/${subdir})
11-
STRING(REPLACE "/" "_" subdir_sane "${subdir}")
12-
ADD_CUSTOM_TARGET(${plugin}_${subdir_sane}_stageinstall ALL DEPENDS ${ARGN})
13-
IF(WITH_PY_COMPILE)
14-
ADD_DEPENDENCIES(pycompile_staged ${plugin}_${subdir_sane}_stageinstall)
15-
ENDIF(WITH_PY_COMPILE)
16-
FOREACH(file ${ARGN})
17-
ADD_CUSTOM_COMMAND(TARGET ${plugin}_${subdir_sane}_stageinstall
18-
POST_BUILD
19-
COMMAND ${CMAKE_COMMAND} -E make_directory ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}/${subdir}
20-
COMMAND ${CMAKE_COMMAND} -E copy \"${file}\" ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}/${subdir}
21-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
22-
#COMMENT "copying ${file} to ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}/${subdir}"
23-
)
24-
ENDFOREACH(file)
11+
IF(WITH_STAGED_PLUGINS OR "${plugin}" STREQUAL "plugin_installer")
12+
STRING(REPLACE "/" "_" subdir_sane "${subdir}")
13+
ADD_CUSTOM_TARGET(${plugin}_${subdir_sane}_stageinstall ALL DEPENDS ${ARGN})
14+
IF(WITH_PY_COMPILE)
15+
ADD_DEPENDENCIES(pycompile_staged ${plugin}_${subdir_sane}_stageinstall)
16+
ENDIF(WITH_PY_COMPILE)
17+
FOREACH(file ${ARGN})
18+
ADD_CUSTOM_COMMAND(TARGET ${plugin}_${subdir_sane}_stageinstall
19+
POST_BUILD
20+
COMMAND ${CMAKE_COMMAND} -E make_directory ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}/${subdir}
21+
COMMAND ${CMAKE_COMMAND} -E copy \"${file}\" ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}/${subdir}
22+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
23+
#COMMENT "copying ${file} to ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}/${subdir}"
24+
)
25+
ENDFOREACH(file)
26+
ENDIF()
2527
ENDMACRO (PLUGIN_INSTALL)
2628

2729

0 commit comments

Comments
 (0)