MCPcopy Create free account
hub / github.com/nodejs/node / _AddConfigurationToMSVSProject

Function _AddConfigurationToMSVSProject

tools/gyp/pylib/gyp/generator/msvs.py:1159–1246  ·  view source on GitHub ↗

Adds a configuration to the MSVS project. Many settings in a vcproj file are specific to a configuration. This function the main part of the vcproj file that's configuration specific. Arguments: p: The target project being generated. spec: The target dictionary containing

(p, spec, config_type, config_name, config)

Source from the content-addressed store, hash-verified

1157
1158
1159def _AddConfigurationToMSVSProject(p, spec, config_type, config_name, config):
1160 """Adds a configuration to the MSVS project.
1161
1162 Many settings in a vcproj file are specific to a configuration. This
1163 function the main part of the vcproj file that's configuration specific.
1164
1165 Arguments:
1166 p: The target project being generated.
1167 spec: The target dictionary containing the properties of the target.
1168 config_type: The configuration type, a number as defined by Microsoft.
1169 config_name: The name of the configuration.
1170 config: The dictionary that defines the special processing to be done
1171 for this configuration.
1172 """
1173 # Get the information for this configuration
1174 include_dirs, midl_include_dirs, resource_include_dirs = _GetIncludeDirs(config)
1175 libraries = _GetLibraries(spec)
1176 library_dirs = _GetLibraryDirs(config)
1177 out_file, vc_tool, _ = _GetOutputFilePathAndTool(spec, msbuild=False)
1178 defines = _GetDefines(config)
1179 defines = [_EscapeCppDefineForMSVS(d) for d in defines]
1180 disabled_warnings = _GetDisabledWarnings(config)
1181 prebuild = config.get("msvs_prebuild")
1182 postbuild = config.get("msvs_postbuild")
1183 def_file = _GetModuleDefinition(spec)
1184 precompiled_header = config.get("msvs_precompiled_header")
1185
1186 # Prepare the list of tools as a dictionary.
1187 tools = {}
1188 # Add in user specified msvs_settings.
1189 msvs_settings = config.get("msvs_settings", {})
1190 MSVSSettings.ValidateMSVSSettings(msvs_settings)
1191
1192 # Prevent default library inheritance from the environment.
1193 _ToolAppend(tools, "VCLinkerTool", "AdditionalDependencies", ["$(NOINHERIT)"])
1194
1195 for tool in msvs_settings:
1196 settings = config["msvs_settings"][tool]
1197 for setting in settings:
1198 _ToolAppend(tools, tool, setting, settings[setting])
1199 # Add the information to the appropriate tool
1200 _ToolAppend(tools, "VCCLCompilerTool", "AdditionalIncludeDirectories", include_dirs)
1201 _ToolAppend(tools, "VCMIDLTool", "AdditionalIncludeDirectories", midl_include_dirs)
1202 _ToolAppend(
1203 tools,
1204 "VCResourceCompilerTool",
1205 "AdditionalIncludeDirectories",
1206 resource_include_dirs,
1207 )
1208 # Add in libraries.
1209 _ToolAppend(tools, "VCLinkerTool", "AdditionalDependencies", libraries)
1210 _ToolAppend(tools, "VCLinkerTool", "AdditionalLibraryDirectories", library_dirs)
1211 if out_file:
1212 _ToolAppend(tools, vc_tool, "OutputFile", out_file, only_if_unset=True)
1213 # Add defines.
1214 _ToolAppend(tools, "VCCLCompilerTool", "PreprocessorDefinitions", defines)
1215 _ToolAppend(tools, "VCResourceCompilerTool", "PreprocessorDefinitions", defines)
1216 # Change program database directory to prevent collisions.

Callers 1

_GenerateMSVSProjectFunction · 0.85

Calls 12

_GetIncludeDirsFunction · 0.85
_GetLibrariesFunction · 0.85
_GetLibraryDirsFunction · 0.85
_GetDefinesFunction · 0.85
_EscapeCppDefineForMSVSFunction · 0.85
_GetDisabledWarningsFunction · 0.85
_GetModuleDefinitionFunction · 0.85
_ToolAppendFunction · 0.85
_AddConfigurationToMSVSFunction · 0.85
getMethod · 0.65
splitMethod · 0.45

Tested by

no test coverage detected