]>
Commit | Line | Data |
---|---|---|
96be4bd1 JP |
1 | Description: Port to SIP 5/6 |
2 | Author: Dmitry Shachnev <mitya57@debian.org> | |
3 | Bug: https://sourceforge.net/p/plplot/mailman/message/37165423/ | |
4 | Bug-Debian: https://bugs.debian.org/964127 | |
5 | Forwarded: not-needed | |
6 | Reviewed-By: Rafael Laboissière <rafael@debian.org> | |
7 | Last-Update: 2021-06-18 | |
8 | ||
9 | --- plplot-5.15.0+dfsg.orig/bindings/qt_gui/pyqt5/CMakeLists.txt | |
10 | +++ plplot-5.15.0+dfsg/bindings/qt_gui/pyqt5/CMakeLists.txt | |
11 | @@ -42,11 +42,30 @@ if(ENABLE_pyqt5) | |
12 | #message("DEBUG: PYQT_SIP_DIR = ${PYQT_SIP_DIR}") | |
13 | #message("DEBUG: PYQT_SIP_FLAGS = ${PYQT_SIP_FLAGS}") | |
14 | ||
15 | - add_custom_command( | |
16 | - OUTPUT ${plplot_pyqt5_HDR} ${plplot_pyqt5_SRC} | |
17 | - COMMAND ${SIP_EXECUTABLE} -c . -b plplot_pyqt5.sbf -I${PYQT_SIP_DIR} ${PYQT_SIP_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/plplot_pyqt5.sip | |
18 | - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/plplot_pyqt5.sip | |
19 | + if(SIPBUILD_EXECUTABLE) | |
20 | + configure_file(plplot_pyqt5.sip plplot_pyqt5.sip COPYONLY) | |
21 | + configure_file(pyproject.toml pyproject.toml COPYONLY) | |
22 | + add_custom_command( | |
23 | + OUTPUT ${plplot_pyqt5_HDR} ${plplot_pyqt5_SRC} | |
92af3046 | 24 | + COMMAND ${SIPBUILD_EXECUTABLE} --no-make ${SIPBUILD_OPTIONS} |
96be4bd1 JP |
25 | + ) |
26 | + set(FILES_TO_COPY ${plplot_pyqt5_HDR} ${plplot_pyqt5_SRC}) | |
27 | + list(TRANSFORM FILES_TO_COPY REPLACE .*/ build/plplot_pyqt5/) | |
28 | + add_custom_command( | |
29 | + OUTPUT ${plplot_pyqt5_HDR} ${plplot_pyqt5_SRC} APPEND | |
30 | + COMMAND ${CMAKE_COMMAND} -E copy ${FILES_TO_COPY} build/sip.h ${CMAKE_CURRENT_BINARY_DIR} | |
31 | + ) | |
32 | + add_compile_definitions( | |
33 | + SIP_PROTECTED_IS_PUBLIC | |
34 | + protected=public | |
35 | ) | |
36 | + else(SIPBUILD_EXECUTABLE) | |
37 | + add_custom_command( | |
38 | + OUTPUT ${plplot_pyqt5_HDR} ${plplot_pyqt5_SRC} | |
39 | + COMMAND ${SIP_EXECUTABLE} -c . -b plplot_pyqt5.sbf -I${PYQT_SIP_DIR} ${PYQT_SIP_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/plplot_pyqt5.sip | |
40 | + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/plplot_pyqt5.sip | |
41 | + ) | |
42 | + endif(SIPBUILD_EXECUTABLE) | |
43 | add_custom_target(generate_pyqt5_source | |
44 | DEPENDS ${plplot_pyqt5_HDR} ${plplot_pyqt5_SRC} | |
45 | ) | |
46 | --- /dev/null | |
47 | +++ plplot-5.15.0+dfsg/bindings/qt_gui/pyqt5/pyproject.toml | |
48 | @@ -0,0 +1,13 @@ | |
49 | +[tool.sip] | |
50 | +project-factory = "pyqtbuild:PyQtProject" | |
51 | +bindings-factory = "pyqtbuild:PyQtBindings" | |
52 | + | |
53 | +[tool.sip.metadata] | |
54 | +name = "plplot" | |
55 | + | |
56 | +[tool.sip.project] | |
57 | +sip-files-dir = "." | |
58 | + | |
59 | +[tool.sip.bindings.plplot] | |
60 | +sip-file = "plplot_pyqt5.sip" | |
61 | +qmake-QT = ["printsupport", "widgets"] | |
62 | --- plplot-5.15.0+dfsg.orig/cmake/modules/qt.cmake | |
63 | +++ plplot-5.15.0+dfsg/cmake/modules/qt.cmake | |
64 | @@ -62,7 +62,8 @@ | |
65 | # ENABLE_pyqt5 - ON means the plplot_pyqt5 Python extension module | |
66 | # is enabled. | |
67 | # ENABLE_smoke - ON means the smoke plplotqt library is enabled. | |
68 | -# SIP_EXECUTABLE - full path for sip | |
69 | +# SIPBUILD_EXECUTABLE - full path for sip-build (SIP v5, v6) | |
70 | +# SIP_EXECUTABLE - full path for sip (SIP v4) | |
71 | # PYQT_SIP_DIR - sip system directory | |
72 | # PYQT_SIP_FLAGS - sip command flags | |
73 | ||
74 | @@ -401,7 +402,25 @@ if(ANY_QT_DEVICE) | |
75 | endif(ENABLE_DYNDRIVERS) | |
76 | endif(ANY_QT_DEVICE) | |
77 | ||
78 | -if(ENABLE_pyqt4 OR ENABLE_pyqt5) | |
79 | +if(ENABLE_pyqt5) | |
80 | + find_program(SIPBUILD_EXECUTABLE sip-build) | |
81 | + message(STATUS "pyqt: SIPBUILD_EXECUTABLE = ${SIPBUILD_EXECUTABLE}") | |
82 | + if (SIPBUILD_EXECUTABLE) | |
83 | + execute_process( | |
84 | + COMMAND ${SIPBUILD_EXECUTABLE} -V | |
85 | + OUTPUT_VARIABLE SIP_VERSION | |
86 | + RESULT_VARIABLE SIP_VERSION_ERR | |
87 | + OUTPUT_STRIP_TRAILING_WHITESPACE | |
88 | + ) | |
89 | + if(SIP_VERSION_ERR) | |
90 | + message(AUTHOR_WARNING "sip-build -V command could not determine sip version") | |
91 | + else(SIP_VERSION_ERR) | |
92 | + message(STATUS "SIP_VERSION = ${SIP_VERSION}") | |
93 | + endif(SIP_VERSION_ERR) | |
94 | + endif(SIPBUILD_EXECUTABLE) | |
95 | +endif(ENABLE_pyqt5) | |
96 | + | |
97 | +if(ENABLE_pyqt4 OR (ENABLE_pyqt5 AND NOT SIPBUILD_EXECUTABLE)) | |
98 | find_program(SIP_EXECUTABLE sip) | |
99 | message(STATUS "pyqt: SIP_EXECUTABLE = ${SIP_EXECUTABLE}") | |
100 | if(SIP_EXECUTABLE) | |
101 | @@ -566,7 +585,7 @@ if(ENABLE_pyqt4 OR ENABLE_pyqt5) | |
102 | set(ENABLE_pyqt4 OFF CACHE BOOL "Enable pyqt4 Python extension module " FORCE) | |
103 | set(ENABLE_pyqt5 OFF CACHE BOOL "Enable pyqt5 Python extension module " FORCE) | |
104 | endif(SIP_EXECUTABLE) | |
105 | -endif(ENABLE_pyqt4 OR ENABLE_pyqt5) | |
106 | +endif(ENABLE_pyqt4 OR (ENABLE_pyqt5 AND NOT SIPBUILD_EXECUTABLE)) | |
107 | ||
108 | if(ENABLE_smoke) | |
109 | if(PLPLOT_USE_QT5) |