File tree Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -25,12 +25,18 @@ SET (PLUGINS_ALSO_BINARIES FALSE)
25
25
26
26
27
27
# try to configure and build GRASS plugin by default
28
- SET (WITH_GRASS TRE CACHE BOOL "Determines whether GRASS plugin should be built" )
28
+ SET (WITH_GRASS TRUE CACHE BOOL "Determines whether GRASS plugin should be built" )
29
29
SET (GRASS_PREFIX "" CACHE PATH "Path to GRASS base directory" )
30
30
31
31
# try to configure and build python bindings by default
32
32
SET (WITH_BINDINGS TRUE CACHE BOOL "Determines whether python bindings should be built" )
33
33
34
+ # By default bindings will be installed only to QGIS directory
35
+ # Someone might want to install it to python site-packages directory
36
+ # as otherwise user has to use PYTHONPATH environemnt variable to add
37
+ # QGIS bindings to package search path
38
+ SET (BINDINGS_GLOBAL_INSTALL FALSE CACHE BOOL "Install bindings to global python directory? (might need root)" )
39
+
34
40
35
41
#############################################################
36
42
# check if lexer and parser are not missing
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ ADD_CUSTOM_COMMAND(OUTPUT ${BINDINGS_GUI_LIB} PRE_LINK
48
48
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /gui
49
49
DEPENDS ${BINDINGS_GUI_MAKEFILE} )
50
50
51
+ IF (BINDINGS_GLOBAL_INSTALL )
51
52
52
53
# python's site-packages dir: bindings will be installed here
53
54
IF (UNIX )
@@ -65,6 +66,12 @@ ENDIF (UNIX)
65
66
66
67
EXEC_PROGRAM (${PYTHON_EXECUTABLE} ARGS -c "\" ${CMD} \" " OUTPUT_VARIABLE SITE_PKG_PATH )
67
68
69
+ ELSE (BINDINGS_GLOBAL_INSTALL )
70
+
71
+ SET (SITE_PKG_PATH ${QGIS_DATA_DIR} /python )
72
+
73
+ ENDIF (BINDINGS_GLOBAL_INSTALL )
74
+
75
+
68
76
# Step 4: install built libs to python's site packages
69
77
INSTALL (FILES __init__.py ${CMAKE_CURRENT_BINARY_DIR} /qgisconfig.py ${BINDINGS_LIBS} DESTINATION ${SITE_PKG_PATH} /qgis )
70
-
Original file line number Diff line number Diff line change @@ -43,6 +43,10 @@ void QgsPythonUtils::initPython(QgisInterface* interface)
43
43
44
44
// import sys module
45
45
runString (" import sys" );
46
+
47
+ // expect that bindings are installed locally, so add the path to modules
48
+ QString pythonPath = QgsApplication::pkgDataPath () + " /python" ;
49
+ runString (" sys.path.insert(0, \" " + pythonPath + " \" )" );
46
50
47
51
// import SIP
48
52
if (!runString (" from sip import wrapinstance, unwrapinstance" ))
You can’t perform that action at this time.
0 commit comments