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