diff options
author | Nicolas Schneider <nioncode+git@gmail.com> | 2019-01-26 23:50:52 +0100 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-02-24 23:53:18 +0200 |
commit | 72370faef0b15a16c42688f83ba57b50a866e1cb (patch) | |
tree | 4323cc8503a5b0a589b5ee623bd4bc2cfc7eea31 /mesonbuild/backend/vs2010backend.py | |
parent | 41fb5c2960b678ec7722d5f9b3c555757ba8a6bd (diff) | |
download | meson-72370faef0b15a16c42688f83ba57b50a866e1cb.zip meson-72370faef0b15a16c42688f83ba57b50a866e1cb.tar.gz meson-72370faef0b15a16c42688f83ba57b50a866e1cb.tar.bz2 |
vs: add support for `build_always_stale` for custom targets
Diffstat (limited to 'mesonbuild/backend/vs2010backend.py')
-rw-r--r-- | mesonbuild/backend/vs2010backend.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py index 8827f20..2a50dd2 100644 --- a/mesonbuild/backend/vs2010backend.py +++ b/mesonbuild/backend/vs2010backend.py @@ -547,6 +547,10 @@ class Vs2010Backend(backends.Backend): extra_paths=extra_paths, capture=ofilenames[0] if target.capture else None) wrapper_cmd = self.environment.get_build_command() + ['--internal', 'exe', exe_data] + if target.build_always_stale: + # Use a nonexistent file to always consider the target out-of-date. + ofilenames += [self.nonexistent_file(os.path.join(self.environment.get_scratch_dir(), + 'outofdate.file'))] self.add_custom_build(root, 'custom_target', ' '.join(self.quote_arguments(wrapper_cmd)), deps=[exe_data] + srcs + depend_files, outputs=ofilenames) ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.targets') @@ -1423,14 +1427,20 @@ if %%errorlevel%% neq 0 goto :VCEnd''' ET.SubElement(custombuild, 'Command').text = cmd_templ % command if not outputs: # Use a nonexistent file to always consider the target out-of-date. - output_file = os.path.join(self.environment.get_scratch_dir(), 'outofdate.file') - while os.path.exists(output_file): - output_file += '0' - outputs = [output_file] + outputs = [self.nonexistent_file(os.path.join(self.environment.get_scratch_dir(), + 'outofdate.file'))] ET.SubElement(custombuild, 'Outputs').text = ';'.join(outputs) if deps: ET.SubElement(custombuild, 'AdditionalInputs').text = ';'.join(deps) + @staticmethod + def nonexistent_file(prefix): + i = 0 + file = prefix + while os.path.exists(file): + file = '%s%d' % (prefix, i) + return file + def generate_debug_information(self, link): # valid values for vs2015 is 'false', 'true', 'DebugFastLink' ET.SubElement(link, 'GenerateDebugInformation').text = 'true' |