[Patch] Adding support of the PlatformToolset property to Gyp. (MSBuild AKA VS 2010/VC++ 2010 Express only)

21 views
Skip to first unread message

Alex Pakhunov

unread,
Feb 13, 2012, 4:11:11 PM2/13/12
to gyp-de...@googlegroups.com
Hi,

Could anyone take a look at this CL: https://chromiumcodereview.appspot.com/9390017/. Here is some background:


It looks like Gyp currently does not support the PlatformToolset property when generating MSBuild projects (VS 2010 or VC++ 2010 Express setup). This property is the standard way of specifying what version of SDK should be used to compile a project. The lack of support, probably, explains why the Build Instruction page describes needlessly hackish way of making sure that SDK 7.1 is used:

Manually registering the Platform SDK
VS2010
1. In Explorer, change the security C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\PlatformToolsets\v100\Microsoft.Cpp.Win32.v100.props to allow you to write to it (will require administrative priviledges).
2. Edit the file and replace v7.0A with v7.1
3. Restart Visual Studio 2010.

There are a couple ways of how the PlatformToolset property can be specified:
  1. When building using MSBuild.exe it can be passed from the command line: "msbuild.exe ... /p:PlatformToolset=Windows7.1SDK". Unfortunately this does not work when building using devenv.exe or from Visual Studio UI.
  2. It can be specified in the project itself before "$(VCTargetsPath)\Microsoft.Cpp.props" is included.
<PropertyGroup Label="Locals">
<PlatformToolset>Windows7.1SDK</PlatformToolset>
</PropertyGroup>

The second option requires patching Gyp hence the patch. The patch allows to specify the PlatformToolset property by either setting GYP_MSVS_TOOLSET=<toolset name> in the environment or by passing msvs_toolset=<toolset name> via generator attributes (... -G msvs_toolset=Windows7.1SDK). The -G flag is considered first. If msvs_toolset is not specified the PlatformToolset property is not emitted letting MSBuild to use the default toolset. This change affects only MSBuild projects (i.e. vcxproj).


In the case this patch is taken in, SDK-related instructions at the Build Instruction page can be simplified to: "set GYP_MSVS_TOOLSET=Windows7.1SDK".

Alex.


Reply all
Reply to author
Forward
0 new messages