diff options
author | Aleksey Gurtovoy <agurtovoy@acm.org> | 2019-08-06 17:04:50 -0500 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-08-10 01:00:28 +0300 |
commit | e5b515aa1d2e58b06bf1b1bbcbdb851ac531bb32 (patch) | |
tree | db4029b2aec8b30fb8f23396a14da31f863a995a | |
parent | 5d3c092ded5e08fd963e3a35288ceb885aab791d (diff) | |
download | meson-e5b515aa1d2e58b06bf1b1bbcbdb851ac531bb32.zip meson-e5b515aa1d2e58b06bf1b1bbcbdb851ac531bb32.tar.gz meson-e5b515aa1d2e58b06bf1b1bbcbdb851ac531bb32.tar.bz2 |
ninjabackend: Squish Coco support
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index b614b41..978c169 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -252,19 +252,29 @@ int dummy; '/showIncludes', '/c', 'incdetect.c'], cwd=self.environment.get_scratch_dir(), stdout=subprocess.PIPE, stderr=subprocess.PIPE) - (stdo, _) = pc.communicate() + (stdout, stderr) = pc.communicate() # We want to match 'Note: including file: ' in the line # 'Note: including file: d:\MyDir\include\stdio.h', however # different locales have different messages with a different # number of colons. Match up to the the drive name 'd:\'. matchre = re.compile(rb"^(.*\s)[a-zA-Z]:\\.*stdio.h$") - for line in re.split(rb'\r?\n', stdo): - match = matchre.match(line) - if match: - with open(tempfilename, 'ab') as binfile: - binfile.write(b'msvc_deps_prefix = ' + match.group(1) + b'\n') - return open(tempfilename, 'a', encoding='utf-8') + + def detect_prefix(out): + for line in re.split(rb'\r?\n', out): + match = matchre.match(line) + if match: + with open(tempfilename, 'ab') as binfile: + binfile.write(b'msvc_deps_prefix = ' + match.group(1) + b'\n') + return open(tempfilename, 'a', encoding='utf-8') + return None + + # Some cl wrappers (e.g. Squish Coco) output dependency info + # to stderr rather than stdout + result = detect_prefix(stdout) or detect_prefix(stderr) + if result: + return result + raise MesonException('Could not determine vs dep dependency prefix string.') def generate(self, interp): |