Skip to content

Commit

Permalink
Meson: Add check for Qt version
Browse files Browse the repository at this point in the history
See RM #881

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
  • Loading branch information
cazfi committed Sep 23, 2024
1 parent 465ddb8 commit 5f75c46
Showing 1 changed file with 36 additions and 6 deletions.
42 changes: 36 additions & 6 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -901,13 +901,16 @@ if qtver == 'qt5'
add_global_arguments('-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00', language : 'cpp')
priv_conf_data.set('FC_QT5_MODE', 1)
qt_opts = []
qt_minver='0x050f00'
elif qtver == 'qt6x'
add_global_arguments('-DQT_DISABLE_DEPRECATED_BEFORE=0x060600', language : 'cpp')
priv_conf_data.set('FC_QT6X_MODE', 1)
qt_opts = 'cpp_std=c++17'
qt_minver='0x060600'
else
add_global_arguments('-DQT_DISABLE_DEPRECATED_BEFORE=0x060000', language : 'cpp')
qt_opts = 'cpp_std=c++17'
qt_minver='0x060000'
endif

if get_option('audio') != 'none'
Expand Down Expand Up @@ -3559,11 +3562,34 @@ else
qt_dep = dependency('Qt5', modules: ['Core', 'Gui', 'Widgets'], required: false)
endif

if qt_dep.found() and cxx_build
if cxx_compiler.compiles(
'''#include <QtCore>
int main()
{
#if QT_VERSION < ''' + qt_minver + '''
fail
#endif
return 0;
}
''',
name: 'qt minver',
dependencies: qt_dep)
qtfine = true
else
qtfine = false
endif
else
qtfine = false
endif

if get_option('clients').contains('qt')

if not qt_dep.found()
if qtver == 'qt6' or qtver == 'qt6x'
if not qtfine
if qtver == 'qt6'
error('Qt6 >= 6.0 required for qt-client in Qt6 mode, but not found')
elif qtver == 'qt6x'
error('Qt6 >= 6.6 required for qt-client in Qt6x mode, but not found')
else
error('Qt5 >= 5.15 required for qt-client in Qt5 mode, but not found')
endif
Expand Down Expand Up @@ -4259,9 +4285,11 @@ endif

if get_option('fcmp').contains('qt')

if not qt_dep.found()
if qtver == 'qt6' or qtver == 'qt6x'
if not qtfine
if qtver == 'qt6'
error('Qt6 >= 6.0 required for qt-modpack-installer in Qt6 mode, but not found')
elif qtver == 'qt6x'
error('Qt6 >= 6.6 required for qt-modpack-installer in Qt6x mode, but not found')
else
error('Qt5 >= 5.15 required for qt-modpack-installer in Qt5 mode, but not found')
endif
Expand Down Expand Up @@ -4346,9 +4374,11 @@ endif

if get_option('tools').contains('ruledit')

if not qt_dep.found()
if qtver == 'qt6' or qtver == 'qt6x'
if not qtfine
if qtver == 'qt6'
error('Qt6 >= 6.0 required for ruledit in Qt6 mode, but not found')
elif qtver == 'qt6x'
error('Qt6 >= 6.6 required for ruledit in Qt6x mode, but not found')
else
error('Qt5 >= 5.15 required for ruledit in Qt5 mode, but not found')
endif
Expand Down

0 comments on commit 5f75c46

Please sign in to comment.