Finds msvs_system_include_dirs that are common to all targets, removes them from all targets, and returns an OrderedSet containing them.
(configs, generator_flags)
| 169 | |
| 170 | |
| 171 | def ExtractSharedMSVSSystemIncludes(configs, generator_flags): |
| 172 | """Finds msvs_system_include_dirs that are common to all targets, removes |
| 173 | them from all targets, and returns an OrderedSet containing them.""" |
| 174 | all_system_includes = OrderedSet(configs[0].get("msvs_system_include_dirs", [])) |
| 175 | for config in configs[1:]: |
| 176 | system_includes = config.get("msvs_system_include_dirs", []) |
| 177 | all_system_includes = all_system_includes & OrderedSet(system_includes) |
| 178 | if not all_system_includes: |
| 179 | return None |
| 180 | # Expand macros in all_system_includes. |
| 181 | env = GetGlobalVSMacroEnv(GetVSVersion(generator_flags)) |
| 182 | expanded_system_includes = OrderedSet( |
| 183 | [ExpandMacros(include, env) for include in all_system_includes] |
| 184 | ) |
| 185 | if any("$" in include for include in expanded_system_includes): |
| 186 | # Some path relies on target-specific variables, bail. |
| 187 | return None |
| 188 | |
| 189 | # Remove system includes shared by all targets from the targets. |
| 190 | for config in configs: |
| 191 | includes = config.get("msvs_system_include_dirs", []) |
| 192 | if includes: # Don't insert a msvs_system_include_dirs key if not needed. |
| 193 | # This must check the unexpanded includes list: |
| 194 | new_includes = [i for i in includes if i not in all_system_includes] |
| 195 | config["msvs_system_include_dirs"] = new_includes |
| 196 | return expanded_system_includes |
| 197 | |
| 198 | |
| 199 | class MsvsSettings: |
nothing calls this directly
no test coverage detected