mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-18 10:56:11 +00:00
Specify PySide version in bindings template
This commit is contained in:
parent
93f88263a0
commit
aa40f69458
@ -110,9 +110,13 @@ if(CUTTER_ENABLE_PYTHON)
|
||||
find_package(Shiboken6 "${Shiboken6_VERSION_REQUIRED}" REQUIRED)
|
||||
find_package(Shiboken6Tools "${Shiboken6_VERSION_REQUIRED}" REQUIRED)
|
||||
find_package(PySide6 "${Shiboken6_VERSION_REQUIRED}" REQUIRED)
|
||||
get_target_property(LIBSHIBOKEN_INCLUDE_DIRS Shiboken6::libshiboken INTERFACE_INCLUDE_DIRECTORIES)
|
||||
get_target_property(PYSIDE_INCLUDE_DIR PySide6::pyside6 INTERFACE_INCLUDE_DIRECTORIES)
|
||||
# Check the presence of "pysidecleanup.h"
|
||||
include(CheckIncludeFileCXX)
|
||||
set(CMAKE_REQUIRED_INCLUDES "${PYSIDE_INCLUDE_DIR};${LIBSHIBOKEN_INCLUDE_DIRS}")
|
||||
CHECK_INCLUDE_FILE_CXX("pysidecleanup.h" HAVE_PYSIDECLEANUP)
|
||||
add_compile_definitions("HAVE_PYSIDECLEANUP=${HAVE_PYSIDECLEANUP}")
|
||||
else()
|
||||
# 5.12.3 => 5.12
|
||||
if("${Qt5_VERSION}" MATCHES "^([0-9]+\\.[0-9]+)\\.[0-9]+")
|
||||
|
@ -394,10 +394,18 @@ if (CUTTER_ENABLE_PYTHON)
|
||||
endif()
|
||||
|
||||
if(CUTTER_ENABLE_PYTHON_BINDINGS)
|
||||
if (CUTTER_QT6)
|
||||
set(PYSIDE_NAME PySide6)
|
||||
set(SHIBOKEN_COMMAND Shiboken6::shiboken6)
|
||||
else()
|
||||
set(PYSIDE_NAME PySide2)
|
||||
set(SHIBOKEN_COMMAND Shiboken2::shiboken2)
|
||||
endif()
|
||||
|
||||
set(BINDINGS_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bindings")
|
||||
set(BINDINGS_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/bindings")
|
||||
|
||||
configure_file("${BINDINGS_SRC_DIR}/bindings.xml" "${BINDINGS_BUILD_DIR}/bindings.xml" COPYONLY) # trigger reconfigure if file changes
|
||||
configure_file("${BINDINGS_SRC_DIR}/bindings.xml.in" "${BINDINGS_BUILD_DIR}/bindings.xml")
|
||||
|
||||
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "${BINDINGS_SRC_DIR}/src_list.py" cmake "${BINDINGS_BUILD_DIR}" OUTPUT_VARIABLE BINDINGS_SOURCE)
|
||||
|
||||
@ -436,15 +444,9 @@ if(CUTTER_ENABLE_PYTHON_BINDINGS)
|
||||
list(APPEND SHIBOKEN_OPTIONS --avoid-protected-hack)
|
||||
endif()
|
||||
|
||||
if (CUTTER_QT6)
|
||||
set(SHIBOKEN_COMMAND Shiboken6::shiboken6)
|
||||
else()
|
||||
set(SHIBOKEN_COMMAND Shiboken2::shiboken2)
|
||||
endif()
|
||||
|
||||
add_custom_command(OUTPUT ${BINDINGS_SOURCE}
|
||||
COMMAND "${SHIBOKEN_COMMAND}" --project-file="${BINDINGS_BUILD_DIR}/bindings.txt" ${SHIBOKEN_OPTIONS} ${SHIBOKEN_EXTRA_OPTIONS}
|
||||
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/bindings/bindings.xml" "${BINDINGS_BUILD_DIR}/bindings.txt"
|
||||
DEPENDS "${BINDINGS_BUILD_DIR}/bindings.xml" "${BINDINGS_BUILD_DIR}/bindings.txt"
|
||||
IMPLICIT_DEPENDS CXX "${CMAKE_CURRENT_SOURCE_DIR}/bindings/bindings.h"
|
||||
COMMENT "Generating Python bindings with shiboken2")
|
||||
else()
|
||||
|
@ -3,7 +3,7 @@
|
||||
generator-set = shiboken
|
||||
|
||||
header-file = ${BINDINGS_SRC_DIR}/bindings.h
|
||||
typesystem-file = ${BINDINGS_SRC_DIR}/bindings.xml
|
||||
typesystem-file = ${BINDINGS_BUILD_DIR}/bindings.xml
|
||||
|
||||
output-directory = ${BINDINGS_BUILD_DIR}
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
PyErr_Print();
|
||||
return QString();
|
||||
}
|
||||
PythonToCppFunc pythonToCpp = Shiboken::Conversions::isPythonToCppConvertible(SbkPySide2_QtCoreTypeConverters[SBK_QSTRING_IDX], pyResult);
|
||||
PythonToCppFunc pythonToCpp = Shiboken::Conversions::isPythonToCppConvertible(Sbk${PYSIDE_NAME}_QtCoreTypeConverters[SBK_QSTRING_IDX], pyResult);
|
||||
if (!pythonToCpp) {
|
||||
Shiboken::warning(PyExc_RuntimeWarning, 2, "Invalid return value for plugin metadata VAR_NAME, expected %s, got %s.", "QString", Py_TYPE(pyResult)->tp_name);
|
||||
return ::QString();
|
@ -9,7 +9,7 @@ script_path = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
|
||||
def get_cpp_files_gen(args, include_package=True):
|
||||
ts_tree = et.parse(os.path.join(script_path, "bindings.xml"))
|
||||
ts_tree = et.parse(os.path.join(script_path, "bindings.xml.in"))
|
||||
ts_root = ts_tree.getroot()
|
||||
|
||||
package = ts_root.attrib["package"]
|
||||
|
Loading…
Reference in New Issue
Block a user