Steve Dower | 65e4cb1 | 2014-11-22 12:54:57 -0800 | [diff] [blame] | 1 | <?xml version="1.0" encoding="utf-8"?> |
Steve Dower | bb24087 | 2015-02-05 22:08:48 -0800 | [diff] [blame] | 2 | <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
Steve Dower | 65e4cb1 | 2014-11-22 12:54:57 -0800 | [diff] [blame] | 3 | <PropertyGroup> |
Steve Dower | bb24087 | 2015-02-05 22:08:48 -0800 | [diff] [blame] | 4 | <Platform Condition="'$(Platform)' == ''">Win32</Platform> |
Steve Dower | 65e4cb1 | 2014-11-22 12:54:57 -0800 | [diff] [blame] | 5 | <Configuration Condition="'$(Configuration)' == ''">Release</Configuration> |
| 6 | <!-- |
| 7 | Use the latest available version of Visual Studio to build. To override |
| 8 | this and build with an earlier version, pass "/p:PlatformToolset=v100" |
| 9 | (for example) when building. |
| 10 | --> |
| 11 | <PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(VCTargetsPath14)' != ''">v140</PlatformToolset> |
| 12 | <PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(VCTargetsPath12)' != ''">v120</PlatformToolset> |
| 13 | <PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(VCTargetsPath11)' != ''">v110</PlatformToolset> |
| 14 | <PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(VCTargetsPath10)' != ''">v100</PlatformToolset> |
| 15 | |
| 16 | <!-- |
| 17 | Convincing MSVC/MSBuild to prefer our platform names is too difficult, |
| 18 | so we define our own constant ArchName and use wherever we need it. |
| 19 | --> |
| 20 | <ArchName Condition="'$(ArchName)' == '' and $(Platform) == 'x64'">amd64</ArchName> |
| 21 | <ArchName Condition="'$(ArchName)' == ''">win32</ArchName> |
| 22 | <ArchName Condition="$(Configuration) == 'PGInstrument' or $(Configuration) == 'PGUpdate'">$(ArchName)-pgo</ArchName> |
| 23 | |
| 24 | <!-- Root directory of the repository --> |
| 25 | <PySourcePath Condition="'$(PySourcePath)' == ''">$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)\..\))</PySourcePath> |
| 26 | <PySourcePath Condition="!HasTrailingSlash($(PySourcePath))">$(PySourcePath)\</PySourcePath> |
| 27 | |
| 28 | <!-- Directory where build outputs are put --> |
Steve Dower | de9fb28 | 2015-07-27 14:56:58 -0700 | [diff] [blame^] | 29 | <BuildPath Condition="'$(PyBuildPath)' == ''">$(PySourcePath)PCBuild\$(ArchName)\</BuildPath> |
| 30 | <BuildPath Condition="'$(PyBuildPath)' != ''">$(PyBuildPath)</BuildPath> |
Steve Dower | 65e4cb1 | 2014-11-22 12:54:57 -0800 | [diff] [blame] | 31 | <BuildPath Condition="!HasTrailingSlash($(BuildPath))">$(BuildPath)\</BuildPath> |
| 32 | |
| 33 | <!-- Directories of external projects. tcltk is handled in tcltk.props --> |
| 34 | <ExternalsDir>$([System.IO.Path]::GetFullPath(`$(PySourcePath)externals\`))</ExternalsDir> |
| 35 | <sqlite3Dir>$(ExternalsDir)sqlite-3.8.3.1\</sqlite3Dir> |
| 36 | <bz2Dir>$(ExternalsDir)bzip2-1.0.6\</bz2Dir> |
| 37 | <lzmaDir>$(ExternalsDir)xz-5.0.5\</lzmaDir> |
Zachary Ware | 80acc3e | 2015-07-21 23:27:08 -0500 | [diff] [blame] | 38 | <opensslDir>$(ExternalsDir)openssl-1.0.2d\</opensslDir> |
Steve Dower | 65e4cb1 | 2014-11-22 12:54:57 -0800 | [diff] [blame] | 39 | <nasmDir>$(ExternalsDir)\nasm-2.11.06\</nasmDir> |
| 40 | |
| 41 | <!-- Suffix for all binaries when building for debug --> |
| 42 | <PyDebugExt Condition="'$(PyDebugExt)' == '' and $(Configuration) == 'Debug'">_d</PyDebugExt> |
| 43 | |
| 44 | <!-- Full path of the resulting python.exe binary --> |
| 45 | <PythonExe Condition="'$(PythonExe)' == ''">$(BuildPath)python$(PyDebugExt).exe</PythonExe> |
Steve Dower | 4943749 | 2015-07-08 20:18:44 -0700 | [diff] [blame] | 46 | </PropertyGroup> |
| 47 | |
| 48 | <PropertyGroup Condition="'$(OverrideVersion)' == ''"> |
Steve Dower | 65e4cb1 | 2014-11-22 12:54:57 -0800 | [diff] [blame] | 49 | <!-- |
| 50 | Read version information from Include\patchlevel.h. The following properties are set: |
| 51 | |
| 52 | MajorVersionNumber - the '3' in '3.5.2a1' |
| 53 | MinorVersionNumber - the '5' in '3.5.2a1' |
| 54 | MicroVersionNumber - the '2' in '3.5.2a1' |
| 55 | ReleaseSerial - the '1' in '3.5.2a1' |
| 56 | ReleaseLevelName - the 'a1' in '3.5.2a1' |
| 57 | PythonVersionNumber - '3.5.2' for '3.5.2a1' |
| 58 | PythonVersion - '3.5.2a1' |
| 59 | PythonVersionHex - 0x030502a1 for '3.5.2a1' |
| 60 | ReleaseLevelNumber - 10 for alpha, 11 for beta, 12 for RC (gamma), and 15 for final |
| 61 | Field3Value - 2101 for '3.5.2a1' (== 1000*2 + 10*10 ('a') + 1) |
| 62 | --> |
| 63 | <_PatchLevelContent>$([System.IO.File]::ReadAllText(`$(PySourcePath)Include\patchlevel.h`))</_PatchLevelContent> |
| 64 | <MajorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MAJOR_VERSION\s+(\d+)`).Groups[1].Value)</MajorVersionNumber> |
| 65 | <MinorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MINOR_VERSION\s+(\d+)`).Groups[1].Value)</MinorVersionNumber> |
| 66 | <MicroVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MICRO_VERSION\s+(\d+)`).Groups[1].Value)</MicroVersionNumber> |
| 67 | <_ReleaseLevel>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_LEVEL\s+PY_RELEASE_LEVEL_(\w+)`).Groups[1].Value)</_ReleaseLevel> |
| 68 | <ReleaseSerial>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_SERIAL\s+(\d+)`).Groups[1].Value)</ReleaseSerial> |
| 69 | <ReleaseLevelNumber>15</ReleaseLevelNumber> |
| 70 | <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'ALPHA'">10</ReleaseLevelNumber> |
| 71 | <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'BETA'">11</ReleaseLevelNumber> |
| 72 | <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'GAMMA'">12</ReleaseLevelNumber> |
| 73 | <ReleaseLevelName Condition="$(_ReleaseLevel) == 'ALPHA'">a$(ReleaseSerial)</ReleaseLevelName> |
| 74 | <ReleaseLevelName Condition="$(_ReleaseLevel) == 'BETA'">b$(ReleaseSerial)</ReleaseLevelName> |
| 75 | <ReleaseLevelName Condition="$(_ReleaseLevel) == 'GAMMA'">rc$(ReleaseSerial)</ReleaseLevelName> |
Steve Dower | 4943749 | 2015-07-08 20:18:44 -0700 | [diff] [blame] | 76 | </PropertyGroup> |
| 77 | |
| 78 | <PropertyGroup Condition="'$(OverrideVersion)' != ''"> |
| 79 | <!-- |
| 80 | Override the version number when building by specifying OverrideVersion. |
| 81 | For example: |
Steve Dower | 65e4cb1 | 2014-11-22 12:54:57 -0800 | [diff] [blame] | 82 | |
Steve Dower | 4943749 | 2015-07-08 20:18:44 -0700 | [diff] [blame] | 83 | PCBuild\build.bat "/p:OverrideVersion=3.5.2a1" |
| 84 | |
| 85 | Use the -V option to check your version is valid: |
| 86 | |
| 87 | PCBuild\build.bat -V "/p:OverrideVersion=3.5.2a1" |
| 88 | PythonVersionNumber: 3.5.2 |
| 89 | PythonVersion: 3.5.2a1 |
| 90 | PythonVersionHex: 0x030502A1 |
| 91 | Field3Value: 2101 |
| 92 | |
| 93 | Note that this only affects the version numbers embedded in resources and |
| 94 | installers, but not sys.version. |
| 95 | --> |
| 96 | <MajorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[1].Value)</MajorVersionNumber> |
| 97 | <MinorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[2].Value)</MinorVersionNumber> |
| 98 | <MicroVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[3].Value)</MicroVersionNumber> |
| 99 | <ReleaseLevelName>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[4].Value)</ReleaseLevelName> |
| 100 | <_ReleaseLevel>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[5].Value)</_ReleaseLevel> |
| 101 | <ReleaseSerial>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[6].Value)</ReleaseSerial> |
| 102 | <ReleaseSerial Condition="'$(ReleaseSerial)' == ''">0</ReleaseSerial> |
| 103 | <ReleaseLevelNumber>15</ReleaseLevelNumber> |
| 104 | <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'a'">10</ReleaseLevelNumber> |
| 105 | <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'b'">11</ReleaseLevelNumber> |
| 106 | <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'rc'">12</ReleaseLevelNumber> |
| 107 | </PropertyGroup> |
| 108 | |
| 109 | <PropertyGroup> |
Steve Dower | 65e4cb1 | 2014-11-22 12:54:57 -0800 | [diff] [blame] | 110 | <PythonVersionNumber>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)</PythonVersionNumber> |
| 111 | <PythonVersion>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)$(ReleaseLevelName)</PythonVersion> |
| 112 | <PythonVersionHex>$([msbuild]::BitwiseOr( |
| 113 | $([msbuild]::Multiply($(MajorVersionNumber), 16777216)), |
| 114 | $([msbuild]::BitwiseOr( |
| 115 | $([msbuild]::Multiply($(MinorVersionNumber), 65536)), |
| 116 | $([msbuild]::BitwiseOr( |
| 117 | $([msbuild]::Multiply($(MicroVersionNumber), 256)), |
| 118 | $([msbuild]::BitwiseOr( |
| 119 | $([msbuild]::Multiply($(ReleaseLevelNumber), 16)), |
| 120 | $(ReleaseSerial) |
| 121 | )) |
| 122 | )) |
| 123 | )) |
| 124 | ))</PythonVersionHex> |
| 125 | <Field3Value>$([msbuild]::Add( |
| 126 | $(ReleaseSerial), |
| 127 | $([msbuild]::Add( |
| 128 | $([msbuild]::Multiply($(ReleaseLevelNumber), 10)), |
| 129 | $([msbuild]::Multiply($(MicroVersionNumber), 1000)) |
| 130 | )) |
| 131 | ))</Field3Value> |
| 132 | |
| 133 | <!-- The name of the resulting pythonXY.dll (without the extension) --> |
| 134 | <PyDllName>python$(MajorVersionNumber)$(MinorVersionNumber)$(PyDebugExt)</PyDllName> |
Steve Dower | 03a144b | 2014-12-15 20:45:23 -0800 | [diff] [blame] | 135 | |
| 136 | <!-- The version and platform tag to include in .pyd filenames --> |
Steve Dower | bb24087 | 2015-02-05 22:08:48 -0800 | [diff] [blame] | 137 | <PydTag Condition="$(Platform) == 'Win32' or $(Platform) == 'x86'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win32</PydTag> |
Steve Dower | 03a144b | 2014-12-15 20:45:23 -0800 | [diff] [blame] | 138 | <PydTag Condition="$(Platform) == 'x64'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win_amd64</PydTag> |
Steve Dower | 2587952 | 2015-01-15 09:10:16 -0800 | [diff] [blame] | 139 | |
| 140 | <!-- The version number for sys.winver --> |
| 141 | <SysWinVer>$(MajorVersionNumber).$(MinorVersionNumber)</SysWinVer> |
Steve Dower | bb24087 | 2015-02-05 22:08:48 -0800 | [diff] [blame] | 142 | <SysWinVer Condition="$(Platform) == 'Win32' or $(Platform) == 'x86'">$(SysWinVer)-32</SysWinVer> |
Steve Dower | 65e4cb1 | 2014-11-22 12:54:57 -0800 | [diff] [blame] | 143 | </PropertyGroup> |
| 144 | |
| 145 | <!-- Displays the calculated version info --> |
| 146 | <Target Name="ShowVersionInfo"> |
| 147 | <Message Importance="high" Text="PythonVersionNumber: $(PythonVersionNumber)" /> |
| 148 | <Message Importance="high" Text="PythonVersion: $(PythonVersion)" /> |
Steve Dower | 4943749 | 2015-07-08 20:18:44 -0700 | [diff] [blame] | 149 | <Message Importance="high" Text="PythonVersionHex: 0x$([System.UInt32]::Parse($(PythonVersionHex)).ToString(`X08`))" /> |
Steve Dower | 65e4cb1 | 2014-11-22 12:54:57 -0800 | [diff] [blame] | 150 | <Message Importance="high" Text="Field3Value: $(Field3Value)" /> |
| 151 | </Target> |
| 152 | </Project> |