blob: 6dbb503b3243e3e21af14ede2371dbf1eec63a8e [file] [log] [blame]
Steve Dower65e4cb12014-11-22 12:54:57 -08001<?xml version="1.0" encoding="utf-8"?>
Steve Dowerbb240872015-02-05 22:08:48 -08002<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
Steve Dower65e4cb12014-11-22 12:54:57 -08003 <PropertyGroup>
Steve Dowerbb240872015-02-05 22:08:48 -08004 <Platform Condition="'$(Platform)' == ''">Win32</Platform>
Steve Dower65e4cb12014-11-22 12:54:57 -08005 <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 Ware4c5ad942016-01-29 19:08:55 -060010
11 We set BasePlatformToolset for ICC's benefit, it's otherwise ignored.
Steve Dower65e4cb12014-11-22 12:54:57 -080012 -->
Steve Dower5fcd5e62017-09-06 10:01:38 -070013 <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and ('$(MSBuildToolsVersion)' == '15.0' or '$(VisualStudioVersion)' == '15.0')">v141</BasePlatformToolset>
Zachary Ware4c5ad942016-01-29 19:08:55 -060014 <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VCTargetsPath14)' != ''">v140</BasePlatformToolset>
15 <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VCTargetsPath12)' != ''">v120</BasePlatformToolset>
16 <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VCTargetsPath11)' != ''">v110</BasePlatformToolset>
17 <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VCTargetsPath10)' != ''">v100</BasePlatformToolset>
18
19 <PlatformToolset Condition="'$(PlatformToolset)' == ''">$(BasePlatformToolset)</PlatformToolset>
20 <ICCBuild>false</ICCBuild>
21 <ICCBuild Condition="$(PlatformToolset.StartsWith(`Intel C++ Compiler`))">true</ICCBuild>
22
Steve Dower65e4cb12014-11-22 12:54:57 -080023 <!--
24 Convincing MSVC/MSBuild to prefer our platform names is too difficult,
25 so we define our own constant ArchName and use wherever we need it.
26 -->
27 <ArchName Condition="'$(ArchName)' == '' and $(Platform) == 'x64'">amd64</ArchName>
28 <ArchName Condition="'$(ArchName)' == ''">win32</ArchName>
Steve Dower65e4cb12014-11-22 12:54:57 -080029
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 -->
Stefan Grönkef1502d02017-09-25 18:58:10 +020035 <BuildPath32 Condition="'$(Py_OutDir)' == ''">$(PySourcePath)PCbuild\win32\</BuildPath32>
Steve Dower6fd76bc2016-07-16 16:13:19 -070036 <BuildPath32 Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)\win32\</BuildPath32>
Stefan Grönkef1502d02017-09-25 18:58:10 +020037 <BuildPath64 Condition="'$(Py_OutDir)' == ''">$(PySourcePath)PCbuild\amd64\</BuildPath64>
Steve Dower6fd76bc2016-07-16 16:13:19 -070038 <BuildPath64 Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)\amd64\</BuildPath64>
39 <BuildPath Condition="'$(ArchName)' == 'win32'">$(BuildPath32)</BuildPath>
40 <BuildPath Condition="'$(ArchName)' == 'amd64'">$(BuildPath64)</BuildPath>
Stefan Grönkef1502d02017-09-25 18:58:10 +020041 <BuildPath Condition="'$(BuildPath)' == ''">$(PySourcePath)PCbuild\$(ArchName)\</BuildPath>
Steve Dower65e4cb12014-11-22 12:54:57 -080042 <BuildPath Condition="!HasTrailingSlash($(BuildPath))">$(BuildPath)\</BuildPath>
Steve Dower5fcd5e62017-09-06 10:01:38 -070043 <BuildPath Condition="$(Configuration) == 'PGInstrument'">$(BuildPath)instrumented\</BuildPath>
Steve Dower65e4cb12014-11-22 12:54:57 -080044
45 <!-- Directories of external projects. tcltk is handled in tcltk.props -->
Steve Dower01423cb2018-02-17 18:59:03 -080046 <ExternalsDir>$(EXTERNALS_DIR)</ExternalsDir>
47 <ExternalsDir Condition="$(ExternalsDir) == ''">$([System.IO.Path]::GetFullPath(`$(PySourcePath)externals`))</ExternalsDir>
48 <ExternalsDir Condition="!HasTrailingSlash($(ExternalsDir))">$(ExternalsDir)\</ExternalsDir>
Mariatta31af6502017-11-06 19:31:53 -080049 <sqlite3Dir>$(ExternalsDir)sqlite-3.21.0.0\</sqlite3Dir>
Steve Dower65e4cb12014-11-22 12:54:57 -080050 <bz2Dir>$(ExternalsDir)bzip2-1.0.6\</bz2Dir>
Zachary Ware16c18a32016-09-11 21:18:07 -050051 <lzmaDir>$(ExternalsDir)xz-5.2.2\</lzmaDir>
Steve Dower864a8922018-08-15 13:29:24 -070052 <opensslDir>$(ExternalsDir)openssl-1.1.0i\</opensslDir>
53 <opensslOutDir>$(ExternalsDir)openssl-bin-1.1.0i\$(ArchName)\</opensslOutDir>
Steve Dower68d663c2017-07-17 11:15:48 +020054 <opensslIncludeDir>$(opensslOutDir)include</opensslIncludeDir>
Steve Dower65e4cb12014-11-22 12:54:57 -080055 <nasmDir>$(ExternalsDir)\nasm-2.11.06\</nasmDir>
Zachary Wared01db1c2017-09-06 17:29:37 -070056 <zlibDir>$(ExternalsDir)\zlib-1.2.11\</zlibDir>
Steve Dower65e4cb12014-11-22 12:54:57 -080057
58 <!-- Suffix for all binaries when building for debug -->
59 <PyDebugExt Condition="'$(PyDebugExt)' == '' and $(Configuration) == 'Debug'">_d</PyDebugExt>
60
Steve Dower940f6a82015-10-31 12:17:11 -070061 <!-- Suffix for versions/keys when building with test markers -->
62 <PyTestExt Condition="$(UseTestMarker) == 'true'">-test</PyTestExt>
63
64 <!-- Suffix for versions/keys when building for particular platforms -->
65 <PyArchExt Condition="'$(ArchName)' == 'win32'">-32</PyArchExt>
66
Steve Dower65e4cb12014-11-22 12:54:57 -080067 <!-- Full path of the resulting python.exe binary -->
68 <PythonExe Condition="'$(PythonExe)' == ''">$(BuildPath)python$(PyDebugExt).exe</PythonExe>
Steve Dower49437492015-07-08 20:18:44 -070069 </PropertyGroup>
70
Steve Dower9b33bf52017-05-23 16:25:25 -070071 <PropertyGroup Condition="$(DefaultWindowsSDKVersion) == ''">
72 <!--
73 Attempt to select the latest installed WinSDK. If we don't find any, then we will
74 let the MSBuild targets determine which one it wants to use (typically the earliest
75 possible version). Since we limit WINVER to Windows 7 anyway, it doesn't really
76 matter which WinSDK version we use.
77 -->
Steve Dower30f4fa42017-11-06 12:52:09 -080078 <_RegistryVersion>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion)</_RegistryVersion>
79 <_RegistryVersion Condition="$(_RegistryVersion) == ''">$(Registry:HKEY_LOCAL_MACHINE\WOW6432Node\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion)</_RegistryVersion>
Steve Dower468a15a2018-12-06 21:09:20 -080080 <DefaultWindowsSDKVersion>10.0.17763.0</DefaultWindowsSDKVersion>
81 <DefaultWindowsSDKVersion Condition="$(_RegistryVersion) == '10.0.17134'">10.0.17134.0</DefaultWindowsSDKVersion>
Carl Meyerc0ee3412018-05-17 14:03:59 -040082 <DefaultWindowsSDKVersion Condition="$(_RegistryVersion) == '10.0.16299'">10.0.16299.0</DefaultWindowsSDKVersion>
Steve Dower30f4fa42017-11-06 12:52:09 -080083 <DefaultWindowsSDKVersion Condition="$(_RegistryVersion) == '10.0.15063'">10.0.15063.0</DefaultWindowsSDKVersion>
84 <DefaultWindowsSDKVersion Condition="$(_RegistryVersion) == '10.0.14393'">10.0.14393.0</DefaultWindowsSDKVersion>
85 <DefaultWindowsSDKVersion Condition="$(_RegistryVersion) == '10.0.10586'">10.0.10586.0</DefaultWindowsSDKVersion>
86 <DefaultWindowsSDKVersion Condition="$(_RegistryVersion) == '10.0.10240'">10.0.10240.0</DefaultWindowsSDKVersion>
Steve Dower9b33bf52017-05-23 16:25:25 -070087 </PropertyGroup>
88
Steve Dower49437492015-07-08 20:18:44 -070089 <PropertyGroup Condition="'$(OverrideVersion)' == ''">
Steve Dower65e4cb12014-11-22 12:54:57 -080090 <!--
91 Read version information from Include\patchlevel.h. The following properties are set:
92
93 MajorVersionNumber - the '3' in '3.5.2a1'
94 MinorVersionNumber - the '5' in '3.5.2a1'
95 MicroVersionNumber - the '2' in '3.5.2a1'
96 ReleaseSerial - the '1' in '3.5.2a1'
97 ReleaseLevelName - the 'a1' in '3.5.2a1'
98 PythonVersionNumber - '3.5.2' for '3.5.2a1'
99 PythonVersion - '3.5.2a1'
100 PythonVersionHex - 0x030502a1 for '3.5.2a1'
101 ReleaseLevelNumber - 10 for alpha, 11 for beta, 12 for RC (gamma), and 15 for final
102 Field3Value - 2101 for '3.5.2a1' (== 1000*2 + 10*10 ('a') + 1)
103 -->
104 <_PatchLevelContent>$([System.IO.File]::ReadAllText(`$(PySourcePath)Include\patchlevel.h`))</_PatchLevelContent>
105 <MajorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MAJOR_VERSION\s+(\d+)`).Groups[1].Value)</MajorVersionNumber>
106 <MinorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MINOR_VERSION\s+(\d+)`).Groups[1].Value)</MinorVersionNumber>
107 <MicroVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MICRO_VERSION\s+(\d+)`).Groups[1].Value)</MicroVersionNumber>
108 <_ReleaseLevel>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_LEVEL\s+PY_RELEASE_LEVEL_(\w+)`).Groups[1].Value)</_ReleaseLevel>
109 <ReleaseSerial>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_SERIAL\s+(\d+)`).Groups[1].Value)</ReleaseSerial>
110 <ReleaseLevelNumber>15</ReleaseLevelNumber>
111 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'ALPHA'">10</ReleaseLevelNumber>
112 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'BETA'">11</ReleaseLevelNumber>
113 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'GAMMA'">12</ReleaseLevelNumber>
114 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'ALPHA'">a$(ReleaseSerial)</ReleaseLevelName>
115 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'BETA'">b$(ReleaseSerial)</ReleaseLevelName>
116 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'GAMMA'">rc$(ReleaseSerial)</ReleaseLevelName>
Steve Dower49437492015-07-08 20:18:44 -0700117 </PropertyGroup>
118
119 <PropertyGroup Condition="'$(OverrideVersion)' != ''">
120 <!--
121 Override the version number when building by specifying OverrideVersion.
122 For example:
Steve Dower65e4cb12014-11-22 12:54:57 -0800123
Stefan Grönkef1502d02017-09-25 18:58:10 +0200124 PCbuild\build.bat "/p:OverrideVersion=3.5.2a1"
Steve Dower49437492015-07-08 20:18:44 -0700125
126 Use the -V option to check your version is valid:
127
Stefan Grönkef1502d02017-09-25 18:58:10 +0200128 PCbuild\build.bat -V "/p:OverrideVersion=3.5.2a1"
Steve Dower49437492015-07-08 20:18:44 -0700129 PythonVersionNumber: 3.5.2
130 PythonVersion: 3.5.2a1
131 PythonVersionHex: 0x030502A1
132 Field3Value: 2101
133
134 Note that this only affects the version numbers embedded in resources and
135 installers, but not sys.version.
136 -->
137 <MajorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[1].Value)</MajorVersionNumber>
138 <MinorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[2].Value)</MinorVersionNumber>
139 <MicroVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[3].Value)</MicroVersionNumber>
140 <ReleaseLevelName>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[4].Value)</ReleaseLevelName>
141 <_ReleaseLevel>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[5].Value)</_ReleaseLevel>
142 <ReleaseSerial>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[6].Value)</ReleaseSerial>
143 <ReleaseSerial Condition="'$(ReleaseSerial)' == ''">0</ReleaseSerial>
144 <ReleaseLevelNumber>15</ReleaseLevelNumber>
145 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'a'">10</ReleaseLevelNumber>
146 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'b'">11</ReleaseLevelNumber>
147 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'rc'">12</ReleaseLevelNumber>
148 </PropertyGroup>
149
150 <PropertyGroup>
Steve Dower65e4cb12014-11-22 12:54:57 -0800151 <PythonVersionNumber>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)</PythonVersionNumber>
152 <PythonVersion>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)$(ReleaseLevelName)</PythonVersion>
153 <PythonVersionHex>$([msbuild]::BitwiseOr(
154 $([msbuild]::Multiply($(MajorVersionNumber), 16777216)),
155 $([msbuild]::BitwiseOr(
156 $([msbuild]::Multiply($(MinorVersionNumber), 65536)),
157 $([msbuild]::BitwiseOr(
158 $([msbuild]::Multiply($(MicroVersionNumber), 256)),
159 $([msbuild]::BitwiseOr(
160 $([msbuild]::Multiply($(ReleaseLevelNumber), 16)),
161 $(ReleaseSerial)
162 ))
163 ))
164 ))
165 ))</PythonVersionHex>
166 <Field3Value>$([msbuild]::Add(
167 $(ReleaseSerial),
168 $([msbuild]::Add(
169 $([msbuild]::Multiply($(ReleaseLevelNumber), 10)),
170 $([msbuild]::Multiply($(MicroVersionNumber), 1000))
171 ))
172 ))</Field3Value>
Steve Dower940f6a82015-10-31 12:17:11 -0700173 <Field3Value Condition="$(UseTestMarker) == 'true'">$([msbuild]::Add($(Field3Value), 9000))</Field3Value>
Steve Dower65e4cb12014-11-22 12:54:57 -0800174
175 <!-- The name of the resulting pythonXY.dll (without the extension) -->
176 <PyDllName>python$(MajorVersionNumber)$(MinorVersionNumber)$(PyDebugExt)</PyDllName>
Steve Dower03a144b2014-12-15 20:45:23 -0800177
178 <!-- The version and platform tag to include in .pyd filenames -->
Steve Dower940f6a82015-10-31 12:17:11 -0700179 <PydTag Condition="$(ArchName) == 'win32'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win32</PydTag>
180 <PydTag Condition="$(ArchName) == 'amd64'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win_amd64</PydTag>
Steve Dower25879522015-01-15 09:10:16 -0800181
182 <!-- The version number for sys.winver -->
Steve Dower940f6a82015-10-31 12:17:11 -0700183 <SysWinVer>$(MajorVersionNumber).$(MinorVersionNumber)$(PyArchExt)$(PyTestExt)</SysWinVer>
Steve Dower65e4cb12014-11-22 12:54:57 -0800184 </PropertyGroup>
185
186 <!-- Displays the calculated version info -->
187 <Target Name="ShowVersionInfo">
188 <Message Importance="high" Text="PythonVersionNumber: $(PythonVersionNumber)" />
189 <Message Importance="high" Text="PythonVersion: $(PythonVersion)" />
Steve Dower49437492015-07-08 20:18:44 -0700190 <Message Importance="high" Text="PythonVersionHex: 0x$([System.UInt32]::Parse($(PythonVersionHex)).ToString(`X08`))" />
Steve Dower65e4cb12014-11-22 12:54:57 -0800191 <Message Importance="high" Text="Field3Value: $(Field3Value)" />
Steve Dower940f6a82015-10-31 12:17:11 -0700192 <Message Importance="high" Text="SysWinVer: $(SysWinVer)" />
193 <Message Importance="high" Text="PyDllName: $(PyDllName)" />
Steve Dower65e4cb12014-11-22 12:54:57 -0800194 </Target>
195</Project>