Add a CMAKE option to completely disable Python (#60463)

This commit is contained in:
Loïc Bartoletti 2025-02-12 20:11:10 +01:00 committed by GitHub
parent 7d47b66ab0
commit a76a616c73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 4 deletions

View File

@ -17,7 +17,9 @@ endif()
# don't relink it only the shared object changes
set(CMAKE_LINK_DEPENDS_NO_SHARED ON)
set (WITH_BINDINGS TRUE CACHE BOOL "Determines whether Python bindings should be built")
option (WITH_PYTHON "Determines whether Python support should be built (disabling it will in particular disable processing)" ON)
set(WITH_BINDINGS ${WITH_PYTHON} CACHE BOOL "Determines whether Python bindings should be built")
set (WITH_3D TRUE CACHE BOOL "Determines whether QGIS 3D library should be built")
set (WITH_QGIS_PROCESS TRUE CACHE BOOL "Determines whether the standalone \"qgis_process\" tool should be built")
set (WITH_DESKTOP TRUE CACHE BOOL "Determines whether QGIS desktop should be built")
@ -317,8 +319,11 @@ if(WITH_CORE)
# The qgis_desktop target is meant to build a minimal but complete running QGIS during development
# This should help to reduce compile time while still having a "complete enough" QGIS for most of the development
add_custom_target(qgis_desktop
DEPENDS qgis qgispython pycore pygui pyanalysis provider_postgres staged-plugins pyplugin-installer resources svg doc icons
DEPENDS qgis provider_postgres staged-plugins resources svg doc icons
)
if ( WITH_PYTHON )
add_dependencies(qgis_desktop qgispython pycore pygui pyanalysis staged-plugins pyplugin-installer )
endif()
endif()
# try to configure and build MDAL support
@ -1181,7 +1186,6 @@ if (WITH_CORE AND WITH_BINDINGS)
endif()
endif()
#############################################################
# create qgsconfig.h
# installed with app target

View File

@ -361,6 +361,7 @@ QGIS build is tunable according to your needs. Many flags are available to activ
* `WITH_ORACLE`: Determines whether Oracle support should be built
* `WITH_PDAL`: Determines whether PDAL support should be built
* `WITH_POSTGRESQL`: Determines whether POSTGRESQL support should be built
* `WITH_PYTHON`: Determines whether Python support should be built (disabling it will in particular disable processing)
* `WITH_QGIS_PROCESS`: Determines whether the standalone \"qgis_process\" tool should be built
* `WITH_QSPATIALITE`: Determines whether QSPATIALITE sql driver should be built
* `WITH_SERVER`: Determines whether QGIS server should be built

View File

@ -567,12 +567,17 @@ target_include_directories(qgis_app PUBLIC
${CMAKE_SOURCE_DIR}/src/app/tiledscene
${CMAKE_SOURCE_DIR}/src/app/vectortile
${CMAKE_SOURCE_DIR}/src/plugins
${CMAKE_SOURCE_DIR}/src/python
${CMAKE_SOURCE_DIR}/src/native
${CMAKE_BINARY_DIR}/src/app
)
if (WITH_PYTHON)
target_include_directories(qgis_app PUBLIC
${CMAKE_SOURCE_DIR}/src/python
)
endif()
if (WITH_3D)
target_include_directories(qgis_app PUBLIC
${CMAKE_SOURCE_DIR}/src/app/3d