Skip to content

Commit

Permalink
feat(Python): Add an option to disable Python
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti committed Feb 5, 2025
1 parent ff09724 commit 1635de0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
20 changes: 15 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ 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 should be built" ON)
if(NOT WITH_PYTHON)
set(WITH_BINDINGS OFF CACHE BOOL "Determines whether Python bindings should be built")
else()
set(WITH_BINDINGS ON CACHE BOOL "Determines whether Python bindings should be built")
endif()
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 @@ -316,9 +321,15 @@ if(WITH_CORE)
if ( WITH_DESKTOP )
# 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
)
if ( WITH_PYTHON )
add_custom_target(qgis_desktop
DEPENDS qgis qgispython pycore pygui pyanalysis provider_postgres staged-plugins pyplugin-installer resources svg doc icons
)
else()
add_custom_target(qgis_desktop
DEPENDS qgis provider_postgres staged-plugins resources svg doc icons
)
endif()
endif()

# try to configure and build MDAL support
Expand Down Expand Up @@ -1181,7 +1192,6 @@ if (WITH_CORE AND WITH_BINDINGS)
endif()
endif()


#############################################################
# create qgsconfig.h
# installed with app target
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 1635de0

Please sign in to comment.