2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-25 11:19:52 +01:00

Improve Qt6 detection with msvc

This commit is contained in:
Waf Project 2024-01-12 14:08:12 +01:00
parent 38966242f0
commit a8b4a5ff17
2 changed files with 14 additions and 3 deletions

View File

@ -1,3 +1,7 @@
NEW IN WAF 2.0.27
-----------------
* Improve Qt6 detection on msvc #2423
NEW IN WAF 2.0.26
-----------------
* Improve "waf dist" - Support SOURCE_DATE_EPOCH

View File

@ -530,13 +530,20 @@ def configure(self):
Logs.error('No xml.sax support was found, rcc dependencies will be incomplete!')
feature = 'qt6' if self.want_qt6 else 'qt5'
# Qt6 requires C++17 (https://www.qt.io/blog/qt-6.0-released)
stdflag = '-std=c++17' if self.want_qt6 else '-std=c++11'
# Qt5 may be compiled with '-reduce-relocations' which requires dependent programs to have -fPIE or -fPIC?
frag = '#include <QMap>\nint main(int argc, char **argv) {QMap<int,int> m;return m.keys().size();}\n'
uses = 'QT6CORE' if self.want_qt6 else 'QT5CORE'
for flag in [[], '-fPIE', '-fPIC', stdflag, [stdflag, '-fPIE'], [stdflag, '-fPIC']]:
# Qt6 requires C++17 (https://www.qt.io/blog/qt-6.0-released)
flag_list = []
if self.env.CXX_NAME == 'msvc':
stdflag = '/std:c++17' if self.want_qt6 else '/std:c++11'
flag_list = [[], ['/Zc:__cplusplus', '/permissive-', stdflag]]
else:
stdflag = '-std=c++17' if self.want_qt6 else '-std=c++11'
flag_list = [[], '-fPIE', '-fPIC', stdflag, [stdflag, '-fPIE'], [stdflag, '-fPIC']]
for flag in flag_list:
msg = 'See if Qt files compile '
if flag:
msg += 'with %s' % flag