diff options
author | Nicolas Schneider <nioncode+git@gmail.com> | 2016-03-11 19:29:07 +0100 |
---|---|---|
committer | Nicolas Schneider <nioncode+git@gmail.com> | 2016-03-11 19:33:53 +0100 |
commit | 18ae344be42a321e14bb03504b8e154e26cf39ae (patch) | |
tree | e86ae6a1cecac48b30f4294e5ddc0d28ccfd36a3 | |
parent | 79537b54dbdaf467e425f6337d1c1566c4ccf26b (diff) | |
download | meson-18ae344be42a321e14bb03504b8e154e26cf39ae.zip meson-18ae344be42a321e14bb03504b8e154e26cf39ae.tar.gz meson-18ae344be42a321e14bb03504b8e154e26cf39ae.tar.bz2 |
vs2010: support precompiled headers
-rw-r--r-- | mesonbuild/backend/vs2010backend.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py index 58a7bd3..3214cc2 100644 --- a/mesonbuild/backend/vs2010backend.py +++ b/mesonbuild/backend/vs2010backend.py @@ -426,7 +426,18 @@ class Vs2010Backend(backends.Backend): rtlib.text = 'MultiThreadedDebugDLL' funclink = ET.SubElement(clconf, 'FunctionLevelLinking') funclink.text = 'true' - pch = ET.SubElement(clconf, 'PrecompiledHeader') + pch_node = ET.SubElement(clconf, 'PrecompiledHeader') + pch_sources = [] + for lang in ['c', 'cpp']: + pch = target.get_pch(lang) + if len(pch) == 0: + continue + pch_node.text = 'Use' + pch_file = ET.SubElement(clconf, 'PrecompiledHeaderFile') + pch_file.text = pch[0] + pch_include = ET.SubElement(clconf, 'ForcedIncludeFiles') + pch_include.text = pch[0] + ';%(ForcedIncludeFiles)' + pch_sources.append(pch[1]) warnings = ET.SubElement(clconf, 'WarningLevel') warnings.text = 'Level3' debinfo = ET.SubElement(clconf, 'DebugInformationFormat') @@ -487,11 +498,16 @@ class Vs2010Backend(backends.Backend): else: relpath = h.rel_to_builddir(proj_to_src_root) ET.SubElement(inc_hdrs, 'CLInclude', Include = relpath) - if len(sources) + len(gen_src) > 0: + if len(sources) + len(gen_src) + len(pch_sources) > 0: inc_src = ET.SubElement(root, 'ItemGroup') for s in sources: relpath = s.rel_to_builddir(proj_to_src_root) ET.SubElement(inc_src, 'CLCompile', Include=relpath) + for s in pch_sources: + relpath = os.path.join(proj_to_src_dir, s) + comp_pch = ET.SubElement(inc_src, 'CLCompile', Include=relpath) + pch = ET.SubElement(comp_pch, 'PrecompiledHeader') + pch.text = 'Create' for s in gen_src: relpath = self.relpath(s, target.subdir) ET.SubElement(inc_src, 'CLCompile', Include=relpath) |