Add support for Meson build system

Tested on:
 - Linux/x86* with gcc
 - Android armv7 arm64 x86 x86_64 with clang
 - Windows x86 x86_64 with Visual Studio 2017
 - Windows x86 x86_64 with MinGW
 - macOS x86_64 with clang
 - iOS arm64 x86_64 with clang

Co-authored by: Nirbheek Chauhan <nirbheek@centricular.com>

https://gitlab.xiph.org/xiph/opus/-/merge_requests/13
This commit is contained in:
Tim-Philipp Müller 2016-03-19 15:40:22 +00:00 committed by Nirbheek Chauhan
parent 034c1b61a2
commit c2b542b6c0
15 changed files with 1114 additions and 1 deletions

28
meson/read-sources-list.py Executable file
View file

@ -0,0 +1,28 @@
#!/usr/bin/env python3
#
# opus/read-sources-list.py
#
# Parses .mk files and extracts list of source files.
# Prints one line per source file list, with filenames space-separated.
import sys
if len(sys.argv) < 2:
sys.exit('Usage: {} sources_foo.mk [sources_bar.mk...]'.format(sys.argv[0]))
for input_fn in sys.argv[1:]:
with open(input_fn, 'r', encoding='utf8') as f:
text = f.read()
text = text.replace('\\\n', '')
# Remove empty lines
lines = [line for line in text.split('\n') if line.strip()]
# Print SOURCES_XYZ = file1.c file2.c
for line in lines:
values = line.strip().split('=', maxsplit=2)
if len(values) != 2:
raise RuntimeError('Unable to parse line "{}" from file "{}"'.format(line, input_fn))
var, files = values
sources_list = [f for f in files.split(' ') if f]
print(var.strip(), '=', ' '.join(sources_list))