summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2019-03-08 17:11:03 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2019-06-25 00:38:31 +0530
commitbadd0fa500ba3b145f73aadbde9356ce0c336dab (patch)
treefd28a46fb97aa2459473f25a3a6ca294f153b8d2
parent3112e127f1579f63b2845eb28afd4d95648dd8ba (diff)
cerbero: Add preliminary support for cross-compiling with MSVC
strip and windres are not available or usable when cross-compiling with MSVC. Native files can always be used, and should be. This will also avoid shell-quoting issues when passing arguments with paths in them to Meson by avoiding them completely.
-rw-r--r--cerbero/build/build.py27
1 files changed, 14 insertions, 13 deletions
diff --git a/cerbero/build/build.py b/cerbero/build/build.py
index 726a4700..c4d00398 100644
--- a/cerbero/build/build.py
+++ b/cerbero/build/build.py
@@ -588,8 +588,6 @@ endian = '{endian}'
c = {CC}
cpp = {CXX}
ar = {AR}
-strip = {STRIP}
-windres = {WINDRES}
pkgconfig = 'pkg-config'
{extra_binaries}
'''
@@ -708,14 +706,23 @@ class Meson (Build, ModifyEnvBase) :
# Take cross toolchain from _old_env because we removed them from the
# env so meson doesn't detect them as the native toolchain.
# Same for *FLAGS below.
- cc = self.env['CC'].split()
- cxx = self.env['CXX'].split()
- ar = self.env['AR'].split()
+ if self.using_msvc():
+ cc = ['cl']
+ cxx = ['cl']
+ ar = ['lib']
+ else:
+ cc = self.env['CC'].split()
+ cxx = self.env['CXX'].split()
+ ar = self.env['AR'].split()
strip = self.env.get('STRIP', '').split()
windres = self.env.get('WINDRES', '').split()
# We do not use cmake dependency files, speed up the build by disabling it
cross_binaries = {'cmake': ['false']}
+ if 'STRIP' in self.env:
+ cross_binaries['strip'] = self.env['STRIP'].split()
+ if 'WINDRES' in self.env:
+ cross_binaries['windres'] = self.env['WINDRES'].split()
if 'OBJC' in self.env:
cross_binaries['objc'] = self.env['OBJC'].split()
if 'OBJCXX' in self.env:
@@ -769,8 +776,6 @@ class Meson (Build, ModifyEnvBase) :
CC=cc,
CXX=cxx,
AR=ar,
- STRIP=strip,
- WINDRES=windres,
extra_binaries=extra_binaries,
extra_properties=extra_properties)
with open(cross_file, 'w') as f:
@@ -840,12 +845,8 @@ class Meson (Build, ModifyEnvBase) :
if self.config.ios_platform == 'iPhoneOS':
self.meson_options.update({'b_bitcode': 'true'})
if self.config.cross_compiling():
- f = self._write_meson_cross_file()
- meson_cmd += ['--cross-file=' + f]
- else:
- # We only use native files when not cross-compiling
- f = self._write_meson_native_file()
- meson_cmd += ['--native-file=' + f]
+ meson_cmd += ['--cross-file', self._write_meson_cross_file()]
+ meson_cmd += ['--native-file', self._write_meson_native_file()]
if self.config.cross_compiling() or self.using_msvc():
# We export the cross toolchain with env vars, but Meson picks the