Skip to content

Commit

Permalink
Add a CMAKE option to completely disable Python (#60463)
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti authored Feb 12, 2025
1 parent 7d47b66 commit a76a616
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
10 changes: 7 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1181,7 +1186,6 @@ if (WITH_CORE AND WITH_BINDINGS)
endif()
endif()


#############################################################
# create qgsconfig.h
# installed with app target
Expand Down
1 change: 1 addition & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a76a616

Please sign in to comment.