mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-22 00:06:12 -05:00
Add cmake option WITH_PY_COMPILE (OFF by default)
- Byte-compiles staged and intalled plugins/modules
This commit is contained in:
parent
2159eda65d
commit
1fdaa04557
@ -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_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")
|
||||
ENDIF (WITH_BINDINGS)
|
||||
@ -640,6 +641,10 @@ ENDIF (UNIX AND NOT APPLE)
|
||||
|
||||
INSTALL(FILES cmake/FindQGIS.cmake DESTINATION ${QGIS_DATA_DIR})
|
||||
|
||||
#############################################################
|
||||
# Post-install commands
|
||||
ADD_SUBDIRECTORY(postinstall)
|
||||
|
||||
#############################################################
|
||||
# Uninstall stuff see: http://www.vtk.org/Wiki/CMake_FAQ
|
||||
CONFIGURE_FILE(
|
||||
|
6
postinstall/CMakeLists.txt
Normal file
6
postinstall/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
# for included scripts that set policies
|
||||
INSTALL (CODE "cmake_policy(SET CMP0011 NEW)")
|
||||
|
||||
CONFIGURE_FILE("PostInstall.cmake.in" "PostInstall.cmake" @ONLY)
|
||||
INSTALL(SCRIPT "${CMAKE_BINARY_DIR}/postinstall/PostInstall.cmake")
|
9
postinstall/PostInstall.cmake.in
Normal file
9
postinstall/PostInstall.cmake.in
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
# kill boolean warnings
|
||||
CMAKE_POLICY(SET CMP0012 NEW)
|
||||
|
||||
IF(@WITH_PY_COMPILE@)
|
||||
MESSAGE(STATUS "Byte-compiling core Python utilities and plugins...")
|
||||
# exclude Python 3 modules in PyQt4.uic package
|
||||
EXECUTE_PROCESS(COMMAND @PYTHON_EXECUTABLE@ -m compileall -q -x ".*uic.port_v3.*" "@CMAKE_INSTALL_PREFIX@/@QGIS_DATA_DIR@/python")
|
||||
ENDIF(@WITH_PY_COMPILE@)
|
@ -167,3 +167,13 @@ INSTALL(FILES ${PY_FILES} ${PYUI_FILES} DESTINATION "${QGIS_PYTHON_DIR}")
|
||||
|
||||
ADD_SUBDIRECTORY(console_help)
|
||||
|
||||
# Byte-compile staged PyQGIS utilities
|
||||
IF(WITH_PY_COMPILE)
|
||||
ADD_CUSTOM_TARGET(pycompile_pyutils ALL
|
||||
COMMAND ${PYTHON_EXECUTABLE} -m compileall -q "${PYTHON_OUTPUT_DIRECTORY}/qgis"
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
||||
COMMENT "Byte-compiling staged PyQGIS utility modules..."
|
||||
DEPENDS pyutils
|
||||
)
|
||||
ENDIF(WITH_PY_COMPILE)
|
||||
|
||||
|
@ -1,8 +1,18 @@
|
||||
IF(WITH_PY_COMPILE)
|
||||
ADD_CUSTOM_TARGET(pycompile_staged ALL
|
||||
COMMAND ${PYTHON_EXECUTABLE} -m compileall -q "${PYTHON_OUTPUT_DIRECTORY}/plugins"
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
||||
COMMENT "Byte-compiling staged Python plugins..."
|
||||
)
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user