From c817c6b53f36c459af9460a0a339f5d9c6a50a63 Mon Sep 17 00:00:00 2001 From: karliss Date: Thu, 1 Aug 2024 22:14:41 +0300 Subject: [PATCH] Use qt6 by default (#3366) * Use Qt6 by default. * Replace a potentially ambigious CUTTER_QT6=On/Off option with CUTTER_QT=(5|6) * Add support Qt6 version of KSyntaxHighlighter --- .appveyor.yml | 1 - .github/actions/build-linux-old/entrypoint.sh | 11 +--- .github/workflows/ci.yml | 13 +--- CMakeLists.txt | 34 +++++----- cmake/Translations.cmake | 4 +- dist/CMakeLists.txt | 2 +- docs/source/building.rst | 63 +++++++++---------- docs/source/contributing/code/ide-setup.rst | 4 +- src/CMakeLists.txt | 26 +++----- 9 files changed, 64 insertions(+), 94 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index d8efea05..f49fc152 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -39,7 +39,6 @@ build_script: - cmd: "cmake -DCMAKE_BUILD_TYPE=Release -DCUTTER_USE_BUNDLED_RIZIN=ON - -DCUTTER_QT6=ON -DCUTTER_ENABLE_PYTHON=ON -DCUTTER_ENABLE_PYTHON_BINDINGS=ON -DCUTTER_ENABLE_PACKAGING=ON diff --git a/.github/actions/build-linux-old/entrypoint.sh b/.github/actions/build-linux-old/entrypoint.sh index 59f9fb3d..a1524938 100755 --- a/.github/actions/build-linux-old/entrypoint.sh +++ b/.github/actions/build-linux-old/entrypoint.sh @@ -109,13 +109,6 @@ fi # otherwise git complains about dubious ownership, due to code being checked out outside the container with a different user git config --global --add safe.directory /github/workspace/rizin -if [ $qt_major = 6] -then - CMAKE_QT_ARG='ON' -else - CMAKE_QT_ARG='OFF' -fi - mkdir build cd build if [ "$system_deps" = "false" ] @@ -144,14 +137,14 @@ then -DCUTTER_PACKAGE_RZ_SILHOUETTE=ON \ -DCMAKE_INSTALL_PREFIX=appdir/usr \ -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON \ - -DCUTTER_QT6=$CMAKE_QT_ARG \ + -DCUTTER_QT=$qt_major \ .. else cmake \ -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCUTTER_USE_BUNDLED_RIZIN=ON \ - -DCUTTER_QT6=$CMAKE_QT_ARG \ + -DCUTTER_QT=$qt_major \ .. fi ninja diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 764a898d..1090778b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -222,20 +222,13 @@ jobs: -DCUTTER_PACKAGE_RZ_SILHOUETTE=ON \ -DCMAKE_INSTALL_PREFIX=appdir/usr \ -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON \ - -DCUTTER_QT6=${{ matrix.qt-major == '6' && 'ON' || 'OFF' }} \ - .. - elif [ "${{ matrix.image }}" = "ubuntu:22.04" ] - then - cmake \ - -G Ninja \ - -DCMAKE_BUILD_TYPE=Release \ - -DCUTTER_QT6=ON \ - -DCUTTER_USE_BUNDLED_RIZIN=ON \ + -DCUTTER_QT=${{ matrix.qt-major }} \ .. else cmake \ -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ + -DCUTTER_QT=${{ matrix.qt-major }} \ -DCUTTER_USE_BUNDLED_RIZIN=ON \ .. fi @@ -473,7 +466,6 @@ jobs: -DCUTTER_PACKAGE_RZ_LIBSWIFT=ON \ -DCUTTER_PACKAGE_RZ_LIBYARA=ON \ -DCUTTER_PACKAGE_RZ_SILHOUETTE=ON \ - -DCUTTER_QT6=ON \ -DCPACK_PACKAGE_FILE_NAME="$PACKAGE_NAME" \ -DCPACK_BUNDLE_APPLE_CERT_APP="-" \ .. && \ @@ -518,7 +510,6 @@ jobs: -DCUTTER_ENABLE_DEPENDENCY_DOWNLOADS=ON ^ -DCMAKE_PREFIX_PATH="%CUTTER_DEPS%\pyside" ^ -DCPACK_PACKAGE_FILE_NAME=%PACKAGE_NAME% ^ - -DCUTTER_QT6=ON ^ -G Ninja ^ .. cmake --build . --config Release diff --git a/CMakeLists.txt b/CMakeLists.txt index ac5fa726..41cd6845 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,8 @@ option(CUTTER_PACKAGE_RZ_LIBSWIFT "Compile and install rz-libswift demangler dur option(CUTTER_PACKAGE_RZ_LIBYARA "Compile and install rz-libyara during the install step." OFF) option(CUTTER_PACKAGE_RZ_SILHOUETTE "Compile and install rz-silhouette during the install step." OFF) option(CUTTER_PACKAGE_JSDEC "Compile and install jsdec during install step." OFF) -OPTION(CUTTER_QT6 "Use QT6" OFF) +set("CUTTER_QT" 6 CACHE STRING "Major QT version to use 5|6") +set_property(CACHE "CUTTER_QT" PROPERTY STRINGS 5 6) if(NOT CUTTER_ENABLE_PYTHON) set(CUTTER_ENABLE_PYTHON_BINDINGS OFF) @@ -84,12 +85,10 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) set(QT_COMPONENTS Core Widgets Gui Svg Network) -if (CUTTER_QT6) - set(QT_PREFIX Qt6) +if (CUTTER_QT GREATER_EQUAL 6) list(APPEND QT_COMPONENTS Core5Compat SvgWidgets OpenGLWidgets) -else() - set(QT_PREFIX Qt5) endif() +set(QT_PREFIX "Qt${CUTTER_QT}") find_package(${QT_PREFIX} REQUIRED COMPONENTS ${QT_COMPONENTS}) if(CUTTER_ENABLE_PYTHON) @@ -105,7 +104,7 @@ if(CUTTER_ENABLE_PYTHON) add_definitions(-DCUTTER_ENABLE_PYTHON) if(CUTTER_ENABLE_PYTHON_BINDINGS) - if (CUTTER_QT6) + if (CUTTER_QT GREATER_EQUAL 6) # 6.12.3 => 6.12 if("${Qt6_VERSION}" MATCHES "^([0-9]+\\.[0-9]+)\\.[0-9]+") set(Shiboken6_VERSION_REQUIRED "${CMAKE_MATCH_1}") @@ -122,7 +121,7 @@ if(CUTTER_ENABLE_PYTHON) set(CMAKE_REQUIRED_INCLUDES "${PYSIDE_INCLUDE_DIRS};${LIBSHIBOKEN_INCLUDE_DIRS}") CHECK_INCLUDE_FILE_CXX("pysidecleanup.h" HAVE_PYSIDECLEANUP) add_compile_definitions("HAVE_PYSIDECLEANUP=${HAVE_PYSIDECLEANUP}") - else() + elseif(CUTTER_QT EQUAL 5) # 5.12.3 => 5.12 if("${Qt5_VERSION}" MATCHES "^([0-9]+\\.[0-9]+)\\.[0-9]+") set(Shiboken2_VERSION_REQUIRED "${CMAKE_MATCH_1}") @@ -132,6 +131,8 @@ if(CUTTER_ENABLE_PYTHON) find_package(Shiboken2 "${Shiboken2_VERSION_REQUIRED}" REQUIRED) find_package(PySide2 "${Shiboken2_VERSION_REQUIRED}" REQUIRED) get_target_property(PYSIDE_INCLUDE_DIRS PySide2::pyside2 INTERFACE_INCLUDE_DIRECTORIES) + else() + message(FATAL_ERROR "Unsupported QT version ${CUTTER_QT}") endif() foreach(_dir IN LISTS PYSIDE_INCLUDE_DIRS) @@ -145,23 +146,18 @@ if(CUTTER_ENABLE_PYTHON) endif() endif() -if(CUTTER_ENABLE_KSYNTAXHIGHLIGHTING AND (NOT CUTTER_QT6)) +if(CUTTER_ENABLE_KSYNTAXHIGHLIGHTING) if(CUTTER_ENABLE_KSYNTAXHIGHLIGHTING STREQUAL AUTO) - find_package(KF5SyntaxHighlighting) - if(KF5SyntaxHighlighting_FOUND) + find_package(KF${CUTTER_QT}SyntaxHighlighting) + if(KF${CUTTER_QT}SyntaxHighlighting_FOUND) set(KSYNTAXHIGHLIGHTING_STATUS ON) else() set(KSYNTAXHIGHLIGHTING_STATUS "OFF (KSyntaxHighlighting not found)") endif() else() - find_package(KF5SyntaxHighlighting REQUIRED) + find_package(KF${CUTTER_QT}SyntaxHighlighting REQUIRED) set(KSYNTAXHIGHLIGHTING_STATUS ON) endif() -else() - if(CUTTER_ENABLE_KSYNTAXHIGHLIGHTING AND CUTTER_QT6) - message(WARNING "KSyntaxHighlighting has been disabled because not supported in QT6") - endif() - set(KSYNTAXHIGHLIGHTING_STATUS OFF) endif() if (CUTTER_ENABLE_GRAPHVIZ) @@ -192,9 +188,13 @@ message(STATUS "- Package RzLibSwift: ${CUTTER_PACKAGE_RZ_LIBSWIFT}") message(STATUS "- Package RzLibYara: ${CUTTER_PACKAGE_RZ_LIBYARA}") message(STATUS "- Package RzSilhouette: ${CUTTER_PACKAGE_RZ_SILHOUETTE}") message(STATUS "- Package JSDec: ${CUTTER_PACKAGE_JSDEC}") -message(STATUS "- QT6: ${CUTTER_QT6}") +message(STATUS "- QT: ${CUTTER_QT}") message(STATUS "") +if (CUTTER_QT LESS 5 OR CUTTER_QT GREATER 6) + message(FATAL_ERROR "Unsupported QT major version") +endif() + add_subdirectory(src) if(CUTTER_ENABLE_PACKAGING) diff --git a/cmake/Translations.cmake b/cmake/Translations.cmake index a57a8797..8b6a319a 100644 --- a/cmake/Translations.cmake +++ b/cmake/Translations.cmake @@ -24,10 +24,10 @@ set(TS_FILES # translations/pt-BR/cutter_pt.ts #2321 handling multiple versions of a language set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/translations) -if (CUTTER_QT6) +if (CUTTER_QT EQUAL 6) find_package(Qt6LinguistTools REQUIRED) qt6_add_translation(qmFiles ${TS_FILES}) -else() +elseif(CUTTER_QT EQUAL 5) find_package(Qt5LinguistTools REQUIRED) qt5_add_translation(qmFiles ${TS_FILES}) endif() diff --git a/dist/CMakeLists.txt b/dist/CMakeLists.txt index 7046c4d0..60b4dd95 100644 --- a/dist/CMakeLists.txt +++ b/dist/CMakeLists.txt @@ -163,7 +163,7 @@ if(CUTTER_ENABLE_DEPENDENCY_DOWNLOADS AND (NOT WIN32)) else() set (YARA_PLUGIN_OPTIONS "") endif() - if (CUTTER_QT6) + if (CUTTER_QT EQUAL 6) set (YARA_PLUGIN_OPTIONS "${YARA_PLUGIN_OPTIONS} -DCUTTER_QT6=ON") endif() install(CODE " diff --git a/docs/source/building.rst b/docs/source/building.rst index 7520fd96..6c23769f 100644 --- a/docs/source/building.rst +++ b/docs/source/building.rst @@ -45,13 +45,15 @@ On Linux, you will need: * meson * libzip-dev * libzlib-dev -* qt5 -* qt5-svg +* qt6 +* qt6-svg * pkgconf * curl* * python-setuptools* * KSyntaxHighlighter** * graphviz** +* shiboken6** +* pyside6** `*` Recommended while building with ``make``/``Cmake``. @@ -61,22 +63,14 @@ On Debian-based Linux distributions, all of these essential packages can be inst :: - sudo apt install build-essential cmake meson libzip-dev zlib1g-dev qt5-default libqt5svg5-dev qttools5-dev qttools5-dev-tools - -.. note:: - On Debian 11 (bullseye) and higher or Ubuntu 22.04 (Jammy) and higher, replace ``qt5-default`` above with ``qtbase5-dev``. + sudo apt install build-essential cmake meson pkgconf libzip-dev zlib1g-dev qt6-base-dev qt6-tools-dev qt6-tools-dev-tools libqt6svg6-dev libqt6core5compat6-dev libqt6svgwidgets6 qt6-l10n-tools Depending on your configuration you'll might also need the following: :: - # When building with CUTTER_ENABLE_KSYNTAXHIGHLIGHTING (Default) - sudo apt install libkf5syntaxhighlighting-dev # When building with CUTTER_ENABLE_GRAPHVIZ (Default) sudo apt install libgraphviz-dev - # when building with CUTTER_ENABLE_PYTHON_BINDINGS - sudo apt install libshiboken2-dev libpyside2-dev qtdeclarative5-dev - .. note:: For Ubuntu 20.04 and lower (or in any case you get an error ``Meson version is x but project requires >=y``), ``meson`` should be installed with ``pip install --upgrade --user meson``. @@ -85,19 +79,25 @@ On Arch-based Linux distributions: :: + sudo pacman -Syu --needed base-devel cmake meson qt6-base qt6-svg qt6-tools + # When building with CUTTER_ENABLE_KSYNTAXHIGHLIGHTING (Default) sudo pacman -Syu --needed syntax-highlighting # When building with CUTTER_ENABLE_GRAPHVIZ (Default) sudo pacman -Syu --needed graphviz - - sudo pacman -Syu --needed base-devel cmake meson qt5-base qt5-svg qt5-tools - + # When building with CUTTER_ENABLE_PYTHON and CUTTER_ENABLE_PYTHON_BINDINGS + sudo pacman -Syu --needed pyside6 shiboken6 On dnf/yum based distributions: :: - sudo dnf install -y gcc gcc-c++ make cmake meson qt5-qtbase-devel qt5-qtsvg-devel qt5-qttools-devel + sudo dnf install -y gcc gcc-c++ make cmake meson qt6-qtbase-devel qt6-qtsvg-devel qt6-qttools-devel qt6-qt5compat-devel + # Optional packages + sudo dnf install -y graphviz-devel kf6-syntax-highlighting-devel python3-devel shiboken6 python3-pyside6-devel clang + + +On older Linux systems not supported by QT6 you can use Qt 5.15. Use of Qt5 on operating systems other than Linux is untested. Building Steps ~~~~~~~~~~~~~~ @@ -163,12 +163,12 @@ Building on Windows Requirements ~~~~~~~~~~~~ -Cutter works on Windows 7 or newer. +Cutter works on Windows 10 or newer. To compile Cutter it is necessary to have the following installed: -* A version of `Visual Studio `_ (2015, 2017 and 2019 are supported) +* A version of `Visual Studio `_ (2019 or newer) * `CMake `_ -* `Qt 5 `_ +* `Qt 6 `_ See :doc:`development environment setup` for alternative ways of obtaining Qt that don't require Qt account. * `Meson `_ * `Ninja `_ @@ -198,12 +198,9 @@ If they are not available, you can use PowerShell to add them to your PATH one b Note that the paths below may vary depending on your version of Qt and Visual Studio. .. code:: powershell - - # First, set CMAKE_PREFIX_PATH to Qt5 intallation prefix - $Env:CMAKE_PREFIX_PATH = "C:\Qt\5.15.2\msvc2019_64\lib\cmake\Qt5" - # Then, add the following directory to your PATH - $Env:Path += ";C:\Qt\5.15.2\msvc2019_64\bin" + # Add the following directory to your PATH + $Env:Path += ";C:\Qt\6.7.2\msvc2019_64\bin" # Build Cutter cmake -B build @@ -231,7 +228,7 @@ For basic build all dependencies except XCode can be installed using homebrew: :: - brew install cmake qt5 meson ninja + brew install cmake qt6 meson ninja Recommended Way for dev builds @@ -241,7 +238,7 @@ Recommended Way for dev builds mkdir build cd build - cmake .. -DCMAKE_PREFIX_PATH=/usr/local/opt/qt5 + cmake .. -DCMAKE_PREFIX_PATH=/opt/homebrew/opt/qt6 make -------------- @@ -252,17 +249,19 @@ CMake Building Options Note that there are some major building options available: * ``CUTTER_USE_BUNDLED_RIZIN`` automatically compile Rizin from submodule (Enabled by default). -* ``CUTTER_ENABLE_PYTHON`` compile with Python support. +* ``CUTTER_ENABLE_PYTHON`` compile with Python support, required for Python plugins. * ``CUTTER_ENABLE_PYTHON_BINDINGS`` automatically generate Python Bindings with Shiboken, required for Python plugins! * ``CUTTER_ENABLE_KSYNTAXHIGHLIGHTING`` use KSyntaxHighlighting for code highlighting. * ``CUTTER_ENABLE_GRAPHVIZ`` enable Graphviz for graph layouts. * ``CUTTER_EXTRA_PLUGIN_DIRS`` List of addition plugin locations. Useful when preparing package for Linux distros that have strict package layout rules. +* ``CUTTER_QT`` Qt major version to use. Defaults to 6. Allowed values: 5, 6. Cutter binary release options, not needed for most users and might not work easily outside CI environment: * ``CUTTER_ENABLE_DEPENDENCY_DOWNLOADS`` Enable downloading of dependencies. Setting to OFF doesn't affect any downloads done by Rizin build. This option is used for preparing Cutter binary release packges. Turned off by default. -* ``CUTTER_PACKAGE_DEPENDENCIES`` During install step include the third party dependencies. This option is used for preparing Cutter binary release packges. +* ``CUTTER_PACKAGE_DEPENDENCIES`` During install step include the third party dependencies. This option is used for preparing Cutter binary release packages. +For full list of Cutter specific build options and their description see CMakeCache.txt after configuring the project or use a graphical CMake configurator if your IDE provides one. These options can be enabled or disabled from the command line arguments passed to CMake. For example, to build Cutter with support for Python plugins, you can run this command: @@ -278,6 +277,8 @@ Or if one wants to explicitly disable an option: cmake -B build -DCUTTER_ENABLE_PYTHON=OFF + + -------------- Troubleshooting @@ -345,11 +346,3 @@ You can also try: You can also install Rizin into ``/usr/lib/pkgconfig/`` and then add a variable ``PKG_CONFIG_PATH`` with the value ``/usr/lib/pkgconfig/``. -* **macOS libjpeg error** - -On macOS, Qt5 apps fail to build on QtCreator if you have the ``libjpeg`` -installed with brew. Run this command to work around the issue: - -:: - - sudo mv /usr/local/lib/libjpeg.dylib /usr/local/lib/libjpeg.dylib.not-found diff --git a/docs/source/contributing/code/ide-setup.rst b/docs/source/contributing/code/ide-setup.rst index 021d01f1..708e2a27 100644 --- a/docs/source/contributing/code/ide-setup.rst +++ b/docs/source/contributing/code/ide-setup.rst @@ -182,7 +182,7 @@ Project setup - Check options that you want Cutter to be built with, or leave it as-is for the default options. - If you are using vcpkg, Visual Studio should detect it automatically. The list of CMake options in the configurator should have some referring to vcpkg. If they are not there, specify the path to vcpkg toolchain file in the :guilabel:`CMake toolchain file` field. - If you are not using vcpkg, configure the path to Qt as mentioned in :ref:`windows CMake instructions`. You can specify the CMake flag in :guilabel:`CMake command arguments:` field. -- To Ensure that VS debugger can display Qt types in a readable way, it is recommended to install `Qt Visual Studio Tools `_ plugin. It will create a :file:`Documents/Visual Studio 2019/Visualizers/qt5.natvis` file. Once :file:`qt5.natvis` has been created you can uninstall the plugin. +- To Ensure that VS debugger can display Qt types in a readable way, it is recommended to install `Qt Visual Studio Tools `_ plugin. It will create a :file:`Documents/Visual Studio 2019/Visualizers/qt6.natvis` file. Once :file:`qt6.natvis` has been created you can uninstall the plugin. Changing CMake configuration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -197,4 +197,4 @@ Editing Qt .ui files and Qt integration By default Visual Studio will open ``.ui`` files as XML text documents. You can configure to open it using Qt Designer by right-clicking and selecting :guilabel:`Open With...`. There is a Qt plugin for Visual Studio from Qt. It isn't very useful for Cutter development since it is aimed more at helping with Qt integration into Visual Studio projects. -It doesn't do much for CMake based projects. The biggest benefit is that it automatically installs :file:`qt5.natvis` file for more readable displaying of Qt types in the debugger. +It doesn't do much for CMake based projects. The biggest benefit is that it automatically installs :file:`qt6.natvis` file for more readable displaying of Qt types in the debugger. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d5e0d529..839954d2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -410,12 +410,14 @@ if (CUTTER_ENABLE_PYTHON) endif() if(CUTTER_ENABLE_PYTHON_BINDINGS) - if (CUTTER_QT6) + if (CUTTER_QT EQUAL 6) set(PYSIDE_NAME PySide6) set(SHIBOKEN_COMMAND Shiboken6::shiboken6) - else() + set (CUTTER_PYSIDE_LIBS Shiboken6::libshiboken PySide6::pyside6) + elseif(CUTTER_QT EQUAL 5) set(PYSIDE_NAME PySide2) set(SHIBOKEN_COMMAND Shiboken2::shiboken2) + set (CUTTER_PYSIDE_LIBS Shiboken2::libshiboken PySide2::pyside2) endif() set(BINDINGS_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bindings") @@ -491,7 +493,7 @@ if (TARGET Graphviz::GVC) endif() target_link_libraries(Cutter PUBLIC ${QT_PREFIX}::Core ${QT_PREFIX}::Widgets ${QT_PREFIX}::Gui PRIVATE ${QT_PREFIX}::Svg ${QT_PREFIX}::Network) -if (CUTTER_QT6) +if (CUTTER_QT EQUAL 6) target_link_libraries(Cutter PUBLIC Qt6::Core5Compat Qt6::SvgWidgets) target_link_libraries(Cutter PRIVATE Qt6::OpenGLWidgets) endif() @@ -517,11 +519,7 @@ if(CUTTER_ENABLE_PYTHON) endif() if(CUTTER_ENABLE_PYTHON_BINDINGS) - if (CUTTER_QT6) - target_link_libraries(Cutter PRIVATE Shiboken6::libshiboken PySide6::pyside6) - else() - target_link_libraries(Cutter PRIVATE Shiboken2::libshiboken PySide2::pyside2) - endif() + target_link_libraries(Cutter PRIVATE ${CUTTER_PYSIDE_LIBS}) get_target_property(RAW_BINDINGS_INCLUDE_DIRS Cutter INCLUDE_DIRECTORIES) if(NOT CUTTER_USE_BUNDLED_RIZIN) @@ -544,15 +542,11 @@ if(CUTTER_ENABLE_PYTHON) list(APPEND BINDINGS_INCLUDE_DIRS "${_qt5Core_install_prefix}/include/QtCore") list(APPEND BINDINGS_INCLUDE_DIRS "${_qt5Core_install_prefix}/include/QtGui") list(APPEND BINDINGS_INCLUDE_DIRS "${_qt5Core_install_prefix}/include/QtWidgets") - elseif(CUTTER_QT6) + elseif(CUTTER_QT EQUAL 6) string(APPEND BINDINGS_INCLUDE_DIR_LINES "framework-include-path=${QT6_INSTALL_PREFIX}/${QT6_INSTALL_LIBS}\n") endif() endif() - if (CUTTER_QT6) - list(APPEND BINDINGS_INCLUDE_DIRS ${Qt6Core_INCLUDE_DIRS} ${Qt6Widgets_INCLUDE_DIRS} ${Qt6Gui_INCLUDE_DIRS}) - else() - list(APPEND BINDINGS_INCLUDE_DIRS ${Qt5Core_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS}) - endif() + list(APPEND BINDINGS_INCLUDE_DIRS ${${QT_PREFIX}Core_INCLUDE_DIRS} ${${QT_PREFIX}Widgets_INCLUDE_DIRS} ${${QT_PREFIX}Gui_INCLUDE_DIRS}) list(APPEND BINDINGS_INCLUDE_DIRS ${Rizin_INCLUDE_DIRS}) list(APPEND BINDINGS_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}") @@ -567,8 +561,8 @@ if(CUTTER_ENABLE_PYTHON) endif() endif() -if(TARGET KF5::SyntaxHighlighting) - target_link_libraries(Cutter PRIVATE KF5::SyntaxHighlighting) +if(TARGET KF${CUTTER_QT}::SyntaxHighlighting) + target_link_libraries(Cutter PRIVATE KF${CUTTER_QT}::SyntaxHighlighting) target_compile_definitions(Cutter PRIVATE CUTTER_ENABLE_KSYNTAXHIGHLIGHTING) endif()