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 fdcc28c commit aadd6fe
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -702,9 +702,11 @@ if get_option('qtver') == 'qt5'
add_global_arguments('-DQT_DISABLE_DEPRECATED_BEFORE=0x050b00', language : 'cpp')
priv_conf_data.set('FC_QT5_MODE', 1)
qt_opts = []
qt_miver = '0x050b00'
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')
Expand Down Expand Up @@ -3137,9 +3139,30 @@ 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 not qtfine
if get_option('qtver') == 'qt6'
error('Qt6 >= 6.0 required for qt-client in Qt6 mode, but not found')
else
Expand Down Expand Up @@ -3608,7 +3631,7 @@ endif

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

if not qt_dep.found()
if not qtfine
if get_option('qtver') == 'qt6'
error('Qt6 >= 6.0 required for qt-modpack-installer in Qt6 mode, but not found')
else
Expand Down Expand Up @@ -3682,7 +3705,7 @@ executable('freeciv-ruleup',

if get_option('ruledit')

if not qt_dep.found()
if not qtfine
if get_option('qtver') == 'qt6'
error('Qt6 >= 6.0 required for ruledit in Qt6 mode, but not found')
else
Expand Down

0 comments on commit aadd6fe

Please sign in to comment.