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