diff options
author | David Robillard <d@drobilla.net> | 2024-07-12 13:27:57 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2024-07-12 13:28:04 -0400 |
commit | fa2b39f0338f6ae42b35ae736abeefec5d2185ab (patch) | |
tree | 03fb24ffe1bca324e0a228bfaa22c8ebbd68ef3e | |
parent | 06ee7893d5f6b97a76769d2ba597e989b4c587e7 (diff) | |
download | jalv-fa2b39f0338f6ae42b35ae736abeefec5d2185ab.tar.gz jalv-fa2b39f0338f6ae42b35ae736abeefec5d2185ab.tar.bz2 jalv-fa2b39f0338f6ae42b35ae736abeefec5d2185ab.zip |
Add Qt6 version
-rw-r--r-- | .clant.json | 2 | ||||
-rw-r--r-- | .includes.imp | 7 | ||||
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | meson.build | 63 | ||||
-rw-r--r-- | meson_options.txt | 11 | ||||
-rw-r--r-- | src/jalv_qt.cpp | 9 | ||||
-rw-r--r-- | src/jalv_qt.hpp | 1 |
7 files changed, 87 insertions, 9 deletions
diff --git a/.clant.json b/.clant.json index 6f11716..8347642 100644 --- a/.clant.json +++ b/.clant.json @@ -1,4 +1,4 @@ { "version": "1.0.0", - "mapping_files": ["qt5_11.imp"] + "mapping_files": [".includes.imp", "qt5_11.imp"] } diff --git a/.includes.imp b/.includes.imp new file mode 100644 index 0000000..9ec9064 --- /dev/null +++ b/.includes.imp @@ -0,0 +1,7 @@ +[ + { "symbol": [ "QT_VERSION", "private", "<QtGlobal>", "public" ] }, + { "symbol": [ "QT_VERSION_CHECK", "private", "<QtGlobal>", "public" ] }, + { "symbol": [ "Q_OBJECT", "private", "<QObject>", "public" ] }, + { "symbol": [ "Q_SLOT", "private", "<QObject>", "public" ] }, + { "symbol": [ "qMax", "private", "<QtGlobal>", "public" ] } +] @@ -1,5 +1,6 @@ jalv (1.6.9) unstable; urgency=medium + * Add Qt6 version * Add missing short versions of command line options * Add option to install tool man pages * Build Qt UI with -fPIC @@ -10,7 +11,7 @@ jalv (1.6.9) unstable; urgency=medium * Switch to external zix dependency * Use Gtk switches instead of checkboxes for toggle controls - -- David Robillard <d@drobilla.net> Thu, 14 Mar 2024 18:26:10 +0000 + -- David Robillard <d@drobilla.net> Fri, 12 Jul 2024 17:26:57 +0000 jalv (1.6.8) stable; urgency=medium diff --git a/meson.build b/meson.build index 5217ec4..dc3b206 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -# Copyright 2020-2022 David Robillard <d@drobilla.net> +# Copyright 2020-2024 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC project( @@ -8,7 +8,7 @@ project( 'b_ndebug=if-release', 'buildtype=release', 'c_std=c99', - 'cpp_std=c++14', + 'cpp_std=c++17', ], license: 'ISC', meson_version: '>= 0.56.0', @@ -387,9 +387,17 @@ if is_variable('cpp') ) if qt5_dep.found() - moc_qt5 = find_program('moc-qt5', required: false) - if not moc_qt5.found() - moc_qt5 = find_program('moc', required: get_option('qt5')) + if get_option('qt5_moc') != '' + moc_qt5 = find_program(get_option('qt5_moc'), required: qt5_opt) + else + moc_qt5 = find_program('moc-qt5', required: false) + if not moc_qt5.found() + moc_qt5 = find_program( + 'moc', + required: qt5_opt, + version: ['>=5.0.0', '<=6.0.0'], + ) + endif endif if moc_qt5.found() @@ -413,6 +421,51 @@ if is_variable('cpp') endif endif endif + + # Qt 6 GUI version + qt6_opt = get_option('qt6') + if not qt6_opt.disabled() + qt6_dep = dependency( + 'Qt6Widgets', + include_type: 'system', + required: qt6_opt, + version: '>= 6.2.0', + ) + + if qt6_dep.found() + moc_qt6_name = get_option('qt6_moc') + if moc_qt6_name == '' + qt6_libexecdir = qt6_dep.get_variable( + default_value: get_option('prefix') / get_option('libexecdir'), + internal: 'libexecdir', + pkgconfig: 'libexecdir', + ) + + moc_qt6_name = qt6_libexecdir / 'moc' + endif + + moc_qt6 = find_program(moc_qt6_name, required: qt6_opt) + if moc_qt6.found() + jalv_qt6_meta_cpp = custom_target( + 'jalv_qt6_meta.cpp', + capture: true, + command: [moc_qt6, '@INPUT@'], + input: jalv_qt_hpp, + output: 'jalv_qt6_meta.cpp', + ) + + executable( + 'jalv.qt6', + sources + jalv_qt_cpp + [jalv_qt6_meta_cpp], + c_args: common_c_args, + cpp_args: common_cpp_args + qt_args, + dependencies: common_dependencies + [qt6_dep, suil_dep], + include_directories: include_directories('src'), + install: true, + ) + endif + endif + endif endif ################# diff --git a/meson_options.txt b/meson_options.txt index b5979d5..5c73012 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,4 +1,4 @@ -# Copyright 2020-2023 David Robillard <d@drobilla.net> +# Copyright 2020-2024 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC option('checks', type: 'feature', value: 'enabled', yield: true, @@ -28,6 +28,15 @@ option('posix', type: 'feature', value: 'auto', yield: true, option('qt5', type: 'feature', value: 'auto', yield: true, description: 'Build Qt5 GUI') +option('qt5_moc', type: 'string', yield: true, + description: 'Path to Qt5 moc executable') + +option('qt6', type: 'feature', value: 'auto', yield: true, + description: 'Build Qt6 GUI') + +option('qt6_moc', type: 'string', yield: true, + description: 'Path to Qt6 moc executable') + option('suil', type: 'feature', value: 'auto', yield: true, description: 'Use suil to load plugin UIs') diff --git a/src/jalv_qt.cpp b/src/jalv_qt.cpp index 20f9de6..54af169 100644 --- a/src/jalv_qt.cpp +++ b/src/jalv_qt.cpp @@ -25,6 +25,7 @@ #include <QLayoutItem> #include <QList> #include <QMainWindow> +#include <QMargins> #include <QMenu> #include <QMenuBar> #include <QObject> @@ -40,6 +41,7 @@ #include <QVBoxLayout> #include <QWidget> #include <QtCore> +#include <QtGlobal> #include <algorithm> #include <cmath> @@ -200,7 +202,8 @@ FlowLayout::minimumSize() const size = size.expandedTo(item->minimumSize()); } - return size + QSize(2 * margin(), 2 * margin()); + const auto m = contentsMargins(); + return size + QSize{m.left() + m.right(), m.top() + m.bottom()}; } int @@ -285,7 +288,11 @@ jalv_frontend_init(int* argc, char*** argv, JalvOptions*) const char* jalv_frontend_ui_type(void) { +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) return "http://lv2plug.in/ns/extensions/ui#Qt5UI"; +#else + return "http://lv2plug.in/ns/extensions/ui#Qt6UI"; +#endif } void diff --git a/src/jalv_qt.hpp b/src/jalv_qt.hpp index d371098..ea08bbf 100644 --- a/src/jalv_qt.hpp +++ b/src/jalv_qt.hpp @@ -8,6 +8,7 @@ #include <QAction> #include <QGroupBox> +#include <QObject> #include <QString> #include <QtCore> |