mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-23 00:02:38 -05:00
Update stage-installed plugins CMakeLists.txt
This commit is contained in:
parent
1095f98173
commit
7717aeed1c
@ -83,7 +83,7 @@ IF (WITH_BINDINGS)
|
|||||||
# as otherwise user has to use PYTHONPATH environemnt variable to add
|
# as otherwise user has to use PYTHONPATH environemnt variable to add
|
||||||
# QGIS bindings to package search path
|
# QGIS bindings to package search path
|
||||||
SET (BINDINGS_GLOBAL_INSTALL FALSE CACHE BOOL "Install bindings to global python directory? (might need root)")
|
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_STAGED_PLUGINS TRUE CACHE BOOL "Stage-install core Python plugins to run from build directory? (utilities and console are always staged)")
|
||||||
SET (WITH_PY_COMPILE FALSE CACHE BOOL "Determines whether Python modules in staged or installed locations are byte-compiled")
|
SET (WITH_PY_COMPILE FALSE CACHE BOOL "Determines whether Python modules in staged or installed locations are byte-compiled")
|
||||||
# concatenate QScintilla2 API files
|
# concatenate QScintilla2 API files
|
||||||
SET (WITH_QSCIAPI TRUE CACHE BOOL "Determines whether the QScintilla2 API files will be updated and concatenated")
|
SET (WITH_QSCIAPI TRUE CACHE BOOL "Determines whether the QScintilla2 API files will be updated and concatenated")
|
||||||
|
@ -1,29 +1,75 @@
|
|||||||
IF(WITH_PY_COMPILE)
|
# Python plugins can be staged to PYTHON_OUTPUT_DIRECTORY so plugins
|
||||||
ADD_CUSTOM_TARGET(pycompile_staged ALL
|
# will function when app is run from build directory
|
||||||
COMMAND ${PYTHON_EXECUTABLE} -m compileall -q "${PYTHON_OUTPUT_DIRECTORY}/plugins"
|
|
||||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
# When staging all plugins, use the following make targets:
|
||||||
COMMENT "Byte-compiling staged Python plugins..."
|
# staged_plugins - stage plugins (usually after repo pull/build and project make)
|
||||||
)
|
# staged_plugins_pyc - stage and byte-compile all Python scripts
|
||||||
ENDIF(WITH_PY_COMPILE)
|
# clean_staged_plugins - removes the plugins directory and all contents
|
||||||
|
#
|
||||||
|
# When developing on a plugin, use the following make targets:
|
||||||
|
# staged_[plugin_dir_name] - stage specific plugin, regenerating any changed resources
|
||||||
|
# clean_staged_[plugin_dir_name] - removes the plugin directory and its contents
|
||||||
|
#
|
||||||
|
# NOTE: regular project 'make install' is unaffected
|
||||||
|
|
||||||
|
ADD_CUSTOM_TARGET(staged_plugins)
|
||||||
|
|
||||||
|
ADD_CUSTOM_TARGET(staged_plugins_pyc DEPENDS staged_plugins
|
||||||
|
COMMAND ${PYTHON_EXECUTABLE} -m compileall -q "${PYTHON_OUTPUT_DIRECTORY}/plugins"
|
||||||
|
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
||||||
|
COMMENT "Byte-compiling staged Python plugins..."
|
||||||
|
)
|
||||||
|
|
||||||
|
# plugins can also be staged with CMake option at build time
|
||||||
|
IF(WITH_STAGED_PLUGINS)
|
||||||
|
IF(WITH_PY_COMPILE)
|
||||||
|
ADD_CUSTOM_TARGET(staged_plugins_on_build ALL DEPENDS staged_plugins_pyc)
|
||||||
|
ELSE(WITH_PY_COMPILE)
|
||||||
|
ADD_CUSTOM_TARGET(staged_plugins_on_build ALL DEPENDS staged_plugins)
|
||||||
|
ENDIF(WITH_PY_COMPILE)
|
||||||
|
ENDIF(WITH_STAGED_PLUGINS)
|
||||||
|
|
||||||
|
ADD_CUSTOM_TARGET(clean_staged_plugins
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E remove_directory ${PYTHON_OUTPUT_DIRECTORY}/plugins
|
||||||
|
)
|
||||||
|
|
||||||
MACRO (PLUGIN_INSTALL plugin subdir )
|
MACRO (PLUGIN_INSTALL plugin subdir )
|
||||||
|
|
||||||
|
# regular project build's install command and target
|
||||||
INSTALL(FILES ${ARGN} DESTINATION ${QGIS_DATA_DIR}/python/plugins/${plugin}/${subdir})
|
INSTALL(FILES ${ARGN} DESTINATION ${QGIS_DATA_DIR}/python/plugins/${plugin}/${subdir})
|
||||||
STRING(REPLACE "/" "_" subdir_sane "${subdir}")
|
STRING(REPLACE "/" "_" subdir_sane "${subdir}")
|
||||||
ADD_CUSTOM_TARGET(${plugin}_${subdir_sane}_stageinstall ALL DEPENDS ${ARGN})
|
IF(WITH_STAGED_PLUGINS)
|
||||||
IF(WITH_STAGED_PLUGINS OR "${plugin}" STREQUAL "plugin_installer")
|
ADD_CUSTOM_TARGET(${plugin}_${subdir_sane} DEPENDS ${ARGN})
|
||||||
IF(WITH_PY_COMPILE)
|
ELSE(WITH_STAGED_PLUGINS)
|
||||||
ADD_DEPENDENCIES(pycompile_staged ${plugin}_${subdir_sane}_stageinstall)
|
ADD_CUSTOM_TARGET(${plugin}_${subdir_sane} ALL DEPENDS ${ARGN})
|
||||||
ENDIF(WITH_PY_COMPILE)
|
ENDIF(WITH_STAGED_PLUGINS)
|
||||||
FOREACH(file ${ARGN})
|
|
||||||
ADD_CUSTOM_COMMAND(TARGET ${plugin}_${subdir_sane}_stageinstall
|
# for staged plugin install (to run from build directory)
|
||||||
POST_BUILD
|
ADD_CUSTOM_TARGET(${plugin}_${subdir_sane}_stageinstall DEPENDS ${ARGN})
|
||||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}/${subdir}
|
ADD_CUSTOM_COMMAND(TARGET ${plugin}_${subdir_sane}_stageinstall
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy \"${file}\" ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}/${subdir}
|
POST_BUILD
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}/${subdir}
|
||||||
#COMMENT "copying ${file} to ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}/${subdir}"
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
ENDFOREACH(file)
|
FOREACH(file ${ARGN})
|
||||||
ENDIF()
|
ADD_CUSTOM_COMMAND(TARGET ${plugin}_${subdir_sane}_stageinstall
|
||||||
|
POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different \"${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)
|
||||||
|
ADD_DEPENDENCIES(staged_plugins ${plugin}_${subdir_sane}_stageinstall)
|
||||||
|
|
||||||
|
IF(TARGET staged_${plugin})
|
||||||
|
ADD_DEPENDENCIES(staged_${plugin} ${plugin}_${subdir_sane}_stageinstall)
|
||||||
|
ELSE(TARGET staged_${plugin})
|
||||||
|
ADD_CUSTOM_TARGET(staged_${plugin} DEPENDS ${plugin}_${subdir_sane}_stageinstall)
|
||||||
|
ADD_CUSTOM_TARGET(clean_staged_${plugin}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E remove_directory ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}
|
||||||
|
)
|
||||||
|
ENDIF(TARGET staged_${plugin})
|
||||||
|
|
||||||
ENDMACRO (PLUGIN_INSTALL)
|
ENDMACRO (PLUGIN_INSTALL)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user