Skip to content

Commit

Permalink
build(QSci): fix build when python QSci is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
troopa81 committed Dec 11, 2024
1 parent fdc24b2 commit 6502e28
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
22 changes: 12 additions & 10 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -371,18 +371,21 @@ if(WITH_QSCIAPI)
set(_python ${Python_EXECUTABLE})
endif()

configure_file("${APIS_SRC_DIR}/generate_console_pap.py.in" ${CMAKE_BINARY_DIR}/generate_console_pap.py)
if (QSCI_SIP_DIR)
configure_file("${APIS_SRC_DIR}/generate_console_pap.py.in" ${CMAKE_BINARY_DIR}/generate_console_pap.py)

add_custom_command(
OUTPUT "${QGIS_PYTHON_PAP_FILE}"
DEPENDS "${QGIS_PYTHON_API_FILE}"
COMMAND ${_python} "${CMAKE_BINARY_DIR}/generate_console_pap.py" -platform offscreen "${QGIS_PYTHON_PAP_FILE}" "${APIS_SRC_DIR}" "${APIS_OUT_DIR}"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
COMMENT "Generating pap file for console auto-completion" VERBATIM)
add_custom_command(
OUTPUT "${QGIS_PYTHON_PAP_FILE}"
DEPENDS "${QGIS_PYTHON_API_FILE}"
COMMAND ${_python} "${CMAKE_BINARY_DIR}/generate_console_pap.py" -platform offscreen "${QGIS_PYTHON_PAP_FILE}" "${APIS_SRC_DIR}" "${APIS_OUT_DIR}"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
COMMENT "Generating pap file for console auto-completion" VERBATIM)

ADD_QGIS_RESOURCES("${APIS_OUT_DIR}" "python/qsci_apis" DEST_DATA_FILES "PyQGIS.api;PyQGIS.pap")
ADD_QGIS_RESOURCES("${APIS_OUT_DIR}" "python/qsci_apis" DEST_DATA_FILES "PyQGIS.api;PyQGIS.pap")

add_custom_target(pyqgis-pap ALL DEPENDS ${QGIS_PYTHON_API_FILE} ${QGIS_PYTHON_PAP_FILE} ${DEST_DATA_FILES})
endif()

add_custom_target(pyqgis-pap ALL DEPENDS ${QGIS_PYTHON_API_FILE} ${QGIS_PYTHON_PAP_FILE} ${DEST_DATA_FILES})
endif()

if(WITH_CUSTOM_WIDGETS)
Expand Down Expand Up @@ -463,4 +466,3 @@ foreach(module ${PY_MODULES})
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${module}/auto_generated DESTINATION ${SIP_DEFAULT_SIP_DIR}/qgis/${module})
endif()
endforeach(module)

5 changes: 4 additions & 1 deletion python/gui/gui.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ ${DEFAULTDOCSTRINGSIGNATURE}
%Import QtGui/QtGuimod.sip
%Import QtXml/QtXmlmod.sip
%Import QtMultimedia/QtMultimediamod.sip
%Import ${QSCI_SIP_MOD_NAME}

%If (HAVE_QSCI_SIP)
%Import ${QSCI_SIP_MOD_NAME}
%End

%Include gui_auto.sip
2 changes: 2 additions & 0 deletions python/gui/gui_auto.sip
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,9 @@
%Include auto_generated/editorwidgets/qgsdefaultsearchwidgetwrapper.sip
%Include auto_generated/editorwidgets/qgsdoublespinbox.sip
%Include auto_generated/editorwidgets/qgshtmlwidgetwrapper.sip
%If ( HAVE_QSCI_SIP )
%Include auto_generated/editorwidgets/qgsjsoneditwidget.sip
%End
%Include auto_generated/editorwidgets/qgsmultiedittoolbutton.sip
%Include auto_generated/editorwidgets/qgsrelationaggregatesearchwidgetwrapper.sip
%Include auto_generated/editorwidgets/qgsrelationreferencesearchwidgetwrapper.sip
Expand Down

0 comments on commit 6502e28

Please sign in to comment.