summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCerbero <cerbero@gstreamer.freedesktop.org>2020-04-04 00:41:17 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2020-04-05 09:21:14 +0530
commit154d958f2de33925e7f477cc55ee220c8e257ae6 (patch)
treeb6a164ca137b344072a2cd6ef28c5fde864a5eed
parent0e50974f803f62910c5f92765d534aa5f73e7f8e (diff)
downloadmeson-nirbheek/qt-vs-crt.tar.gz
qt dependency: Pick debug libraries based on b_vscrtnirbheek/qt-vs-crt
`b_vscrt` has existed forever, and is the canonical source for which CRT to link to, and hence whether to use the debug libraries or not.
-rw-r--r--mesonbuild/dependencies/ui.py5
-rwxr-xr-xrun_unittests.py27
2 files changed, 32 insertions, 0 deletions
diff --git a/mesonbuild/dependencies/ui.py b/mesonbuild/dependencies/ui.py
index 1cadeb00f..4cec814e2 100644
--- a/mesonbuild/dependencies/ui.py
+++ b/mesonbuild/dependencies/ui.py
@@ -376,7 +376,12 @@ class QtBaseDependency(ExternalDependency):
self.bindir = self.get_qmake_host_bins(qvars)
self.is_found = True
+ # Use the buildtype by default, but look at the b_vscrt option if the
+ # compiler supports it.
is_debug = self.env.coredata.get_builtin_option('buildtype') == 'debug'
+ if 'b_vscrt' in self.env.coredata.base_options:
+ if self.env.coredata.base_options['b_vscrt'].value in ('mdd', 'mtd'):
+ is_debug = True
modules_lib_suffix = self._get_modules_lib_suffix(is_debug)
for module in mods:
diff --git a/run_unittests.py b/run_unittests.py
index d1c10f556..96ead5a7e 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -5051,6 +5051,33 @@ class WindowsTests(BasePlatformTests):
# Verify that a valid checksum was written by all other compilers
self.assertTrue(pe.verify_checksum(), msg=msg)
+ def test_qt5dependency_vscrt(self):
+ '''
+ Test that qt5 dependencies use the debug module suffix when b_vscrt is
+ set to 'mdd'
+ '''
+ # Verify that the `b_vscrt` option is available
+ env = get_fake_env()
+ cc = env.detect_c_compiler(MachineChoice.HOST)
+ if 'b_vscrt' not in cc.base_options:
+ raise unittest.SkipTest('Compiler does not support setting the VS CRT')
+ # Verify that qmake is for Qt5
+ if not shutil.which('qmake-qt5'):
+ if not shutil.which('qmake') and not is_ci():
+ raise unittest.SkipTest('QMake not found')
+ output = subprocess.getoutput('qmake --version')
+ if 'Qt version 5' not in output and not is_ci():
+ raise unittest.SkipTest('Qmake found, but it is not for Qt 5.')
+ # Setup with /MDd
+ testdir = os.path.join(self.framework_test_dir, '4 qt')
+ self.init(testdir, extra_args=['-Db_vscrt=mdd'])
+ # Verify that we're linking to the debug versions of Qt DLLs
+ build_ninja = os.path.join(self.builddir, 'build.ninja')
+ with open(build_ninja, 'r', encoding='utf-8') as f:
+ contents = f.read()
+ m = re.search('build qt5core.exe: cpp_LINKER.*Qt5Cored.lib', contents)
+ self.assertIsNotNone(m, msg=contents)
+
@unittest.skipUnless(is_osx(), "requires Darwin")
class DarwinTests(BasePlatformTests):