Allow building Python bindings with Qt6
Your checklist for this pull request
- [x] I've read the guidelines for contributing to this repository
- [x] I made sure to follow the project's coding style
- [ ] I've updated the documentation with the relevant information (if needed)
Detailed description
When Qt6 is selected it was impossible to build the Python bindings.
Test plan (required)
CI is green
On Fedora 36 I get this though:
$ cmake -B build -DCUTTER_ENABLE_PYTHON=ON -DCUTTER_ENABLE_PYTHON_BINDINGS=ON -DCUTTER_ENABLE_GRAPHVIZ=ON -DCUTTER_QT6=ON
-- The C compiler identification is GNU 12.1.1
-- The CXX compiler identification is GNU 12.1.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:67 (find_package):
By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Qt5", but
CMake did not find one.
Could not find a package configuration file provided by "Qt5" with any of
the following names:
Qt5Config.cmake
qt5-config.cmake
Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"
to a directory containing one of the above files. If "Qt5" provides a
separate development package or SDK, be sure it has been installed.
-- Configuring incomplete, errors occurred!
See also "/home/xvilka/rizin/cutter/build/CMakeFiles/CMakeOutput.log".
From my Arch machine
cutter (qt6_python) $ cmake -B qt6build -DCUTTER_QT6=ON -DCUTTER_ENABLE_SIGDB=ON -DCUTTER_PACKAGE_RZ_GHIDRA=ON -DCUTTER_PACKAGE_RZ_LIBSWIFT=ON -DCUTTER_PACKAGE_RZ_LIBYARA=ON -DCUTTER_ENABLE_PYTHON=ON -DCUTTER_ENABLE_PYTHON_BINDINGS=ON && make -C qt6build
-- The C compiler identification is GNU 12.2.1
-- The CXX compiler identification is GNU 12.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Performing Test HAVE_STDATOMIC
-- Performing Test HAVE_STDATOMIC - Success
-- Found WrapAtomic: TRUE
-- Found OpenGL: /usr/lib/libOpenGL.so
-- Found WrapOpenGL: TRUE
-- Found XKB: /usr/lib/libxkbcommon.so (found suitable version "1.5.0", minimum required is "0.5.0")
-- Found WrapVulkanHeaders: /usr/include
-- Found PythonInterp: /usr/bin/python (found version "3.10.9")
-- Found PythonLibs: /usr/lib/libpython3.10.so (found suitable version "3.10.9", minimum required is "3.5")
-- Shiboken6Config: Using default python: .abi3
-- Found PythonInterp: /usr/bin/python (found suitable version "3.10.9", minimum required is "3")
-- Found PythonLibs: /usr/lib/libpython3.10.so (found suitable version "3.10.9", minimum required is "3")
-- PYTHON_LIMITED_LIBRARIES:
-- SHIBOKEN_PYTHON_INCLUDE_DIRS computed to value: '/usr/include/python3.10'
-- SHIBOKEN_PYTHON_LIBRARIES computed to value: ''
-- libshiboken built for None
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.8.0")
-- Checking for module 'libgvc'
-- Found libgvc, version 7.1.0
-- Found Graphviz: /usr/include/graphviz
--
-- Building Cutter version 2.1.2-qt6_python-6e7cb58
-- Options:
-- - Bundled rizin: ON
-- - Bundled sigdb: ON
-- - Python: ON
-- - Python Bindings: ON
-- - KSyntaxHighlighting: ON
-- - Graphviz: TRUE
-- - Downloads dependencies: OFF
-- - Enable Packaging: OFF
-- - Package Dependencies: OFF
-- - Package RzGhidra: ON
-- - Package RzLibSwift: ON
-- - Package RzLibYara: ON
-- - Package JSDec: OFF
-- - QT6: ON
--
-- Configuring done
CMake Error: The INTERFACE_QT_MAJOR_VERSION property of "Qt5::Core" does
not agree with the value of QT_MAJOR_VERSION already determined
for "Cutter".
-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.
@wargio your error looks similar to https://bugs.kde.org/show_bug.cgi?id=442296
@wargio your error looks similar to https://bugs.kde.org/show_bug.cgi?id=442296
yes it is indeed my issue but i don't know how to fix this
I believe this is already an improvement since it allows building Python + Qt6 at least on some systems without breaking Qt5. Support for other systems could be added separately.
i think you are missing also this https://github.com/rizinorg/cutter/blob/dev/cmake/FindPySide2.cmake but for pyside6
currently pyside is added with PYSIDE_LIBRARY and PYSIDE_INCLUDE_DIRS
(build works ... did someone test the python bindings?)
but yeah, FindPySide6.cmake could make it shorter
it crashes with the latest changes from dev related to the history.
I merged since it already works for some platforms so already an improvement