python/build/meson: write cross-file only if cross-compiling

This commit is contained in:
Max Kellermann 2023-09-26 15:26:16 +02:00
parent da7f32bddb
commit 5b83c834ac

View File

@ -88,7 +88,6 @@ endian = '{endian}'
return path return path
def configure(toolchain: AnyToolchain, src: str, build: str, args: list[str]=[]) -> None: def configure(toolchain: AnyToolchain, src: str, build: str, args: list[str]=[]) -> None:
cross_file = make_cross_file(toolchain)
configure = [ configure = [
'meson', 'setup', 'meson', 'setup',
build, src, build, src,
@ -98,10 +97,13 @@ def configure(toolchain: AnyToolchain, src: str, build: str, args: list[str]=[])
'--buildtype', 'plain', '--buildtype', 'plain',
'--default-library=static', '--default-library=static',
'--cross-file', cross_file,
] + args ] + args
if toolchain.host_triplet is not None:
# cross-compiling: write a cross-file
cross_file = make_cross_file(toolchain)
configure.append(f'--cross-file={cross_file}')
env = toolchain.env.copy() env = toolchain.env.copy()
# Meson 0.54 requires the BOOST_ROOT environment variable # Meson 0.54 requires the BOOST_ROOT environment variable