blob: 6388d1b6426756402de9947369a381a265f0085b [file] [log] [blame]
Steve Dower65e4cb12014-11-22 12:54:57 -08001<?xml version="1.0" encoding="utf-8"?>
Steve Dower21a92f82019-06-14 08:29:20 -07002<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
Steve Dower65e4cb12014-11-22 12:54:57 -08003 <PropertyGroup>
Steve Dower21a92f82019-06-14 08:29:20 -07004 <__Python_Props_Imported>true</__Python_Props_Imported>
Steve Dowerbb240872015-02-05 22:08:48 -08005 <Platform Condition="'$(Platform)' == ''">Win32</Platform>
Steve Dower65e4cb12014-11-22 12:54:57 -08006 <Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
7 <!--
8 Use the latest available version of Visual Studio to build. To override
9 this and build with an earlier version, pass "/p:PlatformToolset=v100"
10 (for example) when building.
Zachary Ware4c5ad942016-01-29 19:08:55 -060011
12 We set BasePlatformToolset for ICC's benefit, it's otherwise ignored.
Steve Dower65e4cb12014-11-22 12:54:57 -080013 -->
Paul Monson04856c22019-06-11 15:03:17 -070014 <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and ('$(MSBuildToolsVersion)' == '16.0' or '$(VisualStudioVersion)' == '16.0')">v142</BasePlatformToolset>
Steve Dower5fcd5e62017-09-06 10:01:38 -070015 <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and ('$(MSBuildToolsVersion)' == '15.0' or '$(VisualStudioVersion)' == '15.0')">v141</BasePlatformToolset>
Zachary Ware4c5ad942016-01-29 19:08:55 -060016 <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VCTargetsPath14)' != ''">v140</BasePlatformToolset>
17 <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VCTargetsPath12)' != ''">v120</BasePlatformToolset>
18 <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VCTargetsPath11)' != ''">v110</BasePlatformToolset>
19 <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VCTargetsPath10)' != ''">v100</BasePlatformToolset>
20
21 <PlatformToolset Condition="'$(PlatformToolset)' == ''">$(BasePlatformToolset)</PlatformToolset>
22 <ICCBuild>false</ICCBuild>
23 <ICCBuild Condition="$(PlatformToolset.StartsWith(`Intel C++ Compiler`))">true</ICCBuild>
24
Steve Dower65e4cb12014-11-22 12:54:57 -080025 <!--
26 Convincing MSVC/MSBuild to prefer our platform names is too difficult,
27 so we define our own constant ArchName and use wherever we need it.
28 -->
29 <ArchName Condition="'$(ArchName)' == '' and $(Platform) == 'x64'">amd64</ArchName>
Paul Monson8a1657b2019-02-14 08:31:30 -080030 <ArchName Condition="'$(ArchName)' == '' and $(Platform) == 'ARM'">arm32</ArchName>
Paul Monsonfb7e7502019-05-15 15:38:55 -070031 <ArchName Condition="'$(ArchName)' == '' and $(Platform) == 'ARM64'">arm64</ArchName>
Steve Dower65e4cb12014-11-22 12:54:57 -080032 <ArchName Condition="'$(ArchName)' == ''">win32</ArchName>
Steve Dower65e4cb12014-11-22 12:54:57 -080033
34 <!-- Root directory of the repository -->
35 <PySourcePath Condition="'$(PySourcePath)' == ''">$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)\..\))</PySourcePath>
36 <PySourcePath Condition="!HasTrailingSlash($(PySourcePath))">$(PySourcePath)\</PySourcePath>
37
38 <!-- Directory where build outputs are put -->
Stefan Grönkef1502d02017-09-25 18:58:10 +020039 <BuildPath32 Condition="'$(Py_OutDir)' == ''">$(PySourcePath)PCbuild\win32\</BuildPath32>
Steve Dower6fd76bc2016-07-16 16:13:19 -070040 <BuildPath32 Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)\win32\</BuildPath32>
Stefan Grönkef1502d02017-09-25 18:58:10 +020041 <BuildPath64 Condition="'$(Py_OutDir)' == ''">$(PySourcePath)PCbuild\amd64\</BuildPath64>
Steve Dower6fd76bc2016-07-16 16:13:19 -070042 <BuildPath64 Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)\amd64\</BuildPath64>
Paul Monson8a1657b2019-02-14 08:31:30 -080043 <BuildPathArm32 Condition="'$(Py_OutDir)' == ''">$(PySourcePath)PCbuild\arm32\</BuildPathArm32>
44 <BuildPathArm32 Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)\arm32\</BuildPathArm32>
Paul Monsonf96e7fd2019-05-17 10:07:24 -070045 <BuildPathArm64 Condition="'$(Py_OutDir)' == ''">$(PySourcePath)PCbuild\arm64\</BuildPathArm64>
46 <BuildPathArm64 Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)\arm64\</BuildPathArm64>
Steve Dower6fd76bc2016-07-16 16:13:19 -070047 <BuildPath Condition="'$(ArchName)' == 'win32'">$(BuildPath32)</BuildPath>
48 <BuildPath Condition="'$(ArchName)' == 'amd64'">$(BuildPath64)</BuildPath>
Paul Monson8a1657b2019-02-14 08:31:30 -080049 <BuildPath Condition="'$(ArchName)' == 'arm32'">$(BuildPathArm32)</BuildPath>
Paul Monsonf96e7fd2019-05-17 10:07:24 -070050 <BuildPath Condition="'$(ArchName)' == 'arm64'">$(BuildPathArm64)</BuildPath>
Stefan Grönkef1502d02017-09-25 18:58:10 +020051 <BuildPath Condition="'$(BuildPath)' == ''">$(PySourcePath)PCbuild\$(ArchName)\</BuildPath>
Steve Dower65e4cb12014-11-22 12:54:57 -080052 <BuildPath Condition="!HasTrailingSlash($(BuildPath))">$(BuildPath)\</BuildPath>
Steve Dower5fcd5e62017-09-06 10:01:38 -070053 <BuildPath Condition="$(Configuration) == 'PGInstrument'">$(BuildPath)instrumented\</BuildPath>
Steve Dower65e4cb12014-11-22 12:54:57 -080054
55 <!-- Directories of external projects. tcltk is handled in tcltk.props -->
Steve Dower01423cb2018-02-17 18:59:03 -080056 <ExternalsDir>$(EXTERNALS_DIR)</ExternalsDir>
57 <ExternalsDir Condition="$(ExternalsDir) == ''">$([System.IO.Path]::GetFullPath(`$(PySourcePath)externals`))</ExternalsDir>
58 <ExternalsDir Condition="!HasTrailingSlash($(ExternalsDir))">$(ExternalsDir)\</ExternalsDir>
Erlend Egeberg Aasland1382c322020-03-02 13:25:10 +010059 <sqlite3Dir>$(ExternalsDir)sqlite-3.31.1.0\</sqlite3Dir>
Steve Dower65e4cb12014-11-22 12:54:57 -080060 <bz2Dir>$(ExternalsDir)bzip2-1.0.6\</bz2Dir>
Zachary Ware16c18a32016-09-11 21:18:07 -050061 <lzmaDir>$(ExternalsDir)xz-5.2.2\</lzmaDir>
Paul Monson32119e12019-03-29 16:30:10 -070062 <libffiDir>$(ExternalsDir)libffi\</libffiDir>
63 <libffiOutDir>$(ExternalsDir)libffi\$(ArchName)\</libffiOutDir>
64 <libffiIncludeDir>$(libffiOutDir)include</libffiIncludeDir>
Srinivas Reddy Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి)80d827c2020-06-13 02:16:36 +053065 <opensslDir>$(ExternalsDir)openssl-1.1.1g\</opensslDir>
66 <opensslOutDir>$(ExternalsDir)openssl-bin-1.1.1g\$(ArchName)\</opensslOutDir>
Steve Dower68d663c2017-07-17 11:15:48 +020067 <opensslIncludeDir>$(opensslOutDir)include</opensslIncludeDir>
Steve Dower65e4cb12014-11-22 12:54:57 -080068 <nasmDir>$(ExternalsDir)\nasm-2.11.06\</nasmDir>
Zachary Wared01db1c2017-09-06 17:29:37 -070069 <zlibDir>$(ExternalsDir)\zlib-1.2.11\</zlibDir>
Steve Dower65e4cb12014-11-22 12:54:57 -080070
71 <!-- Suffix for all binaries when building for debug -->
72 <PyDebugExt Condition="'$(PyDebugExt)' == '' and $(Configuration) == 'Debug'">_d</PyDebugExt>
73
Steve Dower940f6a82015-10-31 12:17:11 -070074 <!-- Suffix for versions/keys when building with test markers -->
75 <PyTestExt Condition="$(UseTestMarker) == 'true'">-test</PyTestExt>
76
77 <!-- Suffix for versions/keys when building for particular platforms -->
78 <PyArchExt Condition="'$(ArchName)' == 'win32'">-32</PyArchExt>
Paul Monson8a1657b2019-02-14 08:31:30 -080079 <PyArchExt Condition="'$(ArchName)' == 'arm32'">-arm32</PyArchExt>
Paul Monsonf96e7fd2019-05-17 10:07:24 -070080 <PyArchExt Condition="'$(ArchName)' == 'arm64'">-arm64</PyArchExt>
Steve Dower940f6a82015-10-31 12:17:11 -070081
Steve Dower65e4cb12014-11-22 12:54:57 -080082 <!-- Full path of the resulting python.exe binary -->
83 <PythonExe Condition="'$(PythonExe)' == ''">$(BuildPath)python$(PyDebugExt).exe</PythonExe>
Steve Dower12f1c722019-06-19 13:07:23 -070084
85 <!-- Include Tkinter by default -->
86 <IncludeTkinter Condition="'$(IncludeTkinter)' == ''">true</IncludeTkinter>
Steve Dower49437492015-07-08 20:18:44 -070087 </PropertyGroup>
88
Paul Monson8a1657b2019-02-14 08:31:30 -080089 <PropertyGroup Condition="'$(Platform)'=='ARM'" Label="ArmConfiguration">
90 <WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
91 </PropertyGroup>
92
Paul Monsonf96e7fd2019-05-17 10:07:24 -070093 <PropertyGroup Condition="'$(Platform)'=='ARM64'" Label="Arm64Configuration">
94 <WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
95 </PropertyGroup>
96
Steve Dower9b33bf52017-05-23 16:25:25 -070097 <PropertyGroup Condition="$(DefaultWindowsSDKVersion) == ''">
98 <!--
99 Attempt to select the latest installed WinSDK. If we don't find any, then we will
100 let the MSBuild targets determine which one it wants to use (typically the earliest
101 possible version). Since we limit WINVER to Windows 7 anyway, it doesn't really
102 matter which WinSDK version we use.
103 -->
Steve Dower30f4fa42017-11-06 12:52:09 -0800104 <_RegistryVersion>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion)</_RegistryVersion>
Isuru Fernandoaedc2732019-03-21 12:52:57 -0500105 <_RegistryVersion Condition="$(_RegistryVersion) == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion)</_RegistryVersion>
Jeremy Klothf46eccd2018-12-09 20:59:32 -0700106 <!-- Sometimes the version in the registry has to .0 suffix, and sometimes it doesn't. Check and add it -->
107 <_RegistryVersion Condition="$(_RegistryVersion) != '' and !$(_RegistryVersion.EndsWith('.0'))">$(_RegistryVersion).0</_RegistryVersion>
108
109 <!-- The minimum allowed SDK version to use for building -->
110 <DefaultWindowsSDKVersion>10.0.10586.0</DefaultWindowsSDKVersion>
111 <DefaultWindowsSDKVersion Condition="$([System.Version]::Parse($(_RegistryVersion))) > $([System.Version]::Parse($(DefaultWindowsSDKVersion)))">$(_RegistryVersion)</DefaultWindowsSDKVersion>
Steve Dower9b33bf52017-05-23 16:25:25 -0700112 </PropertyGroup>
113
Jeremy Klothf46eccd2018-12-09 20:59:32 -0700114 <PropertyGroup Condition="$(WindowsTargetPlatformVersion) == ''">
115 <WindowsTargetPlatformVersion>$(DefaultWindowsSDKVersion)</WindowsTargetPlatformVersion>
116 </PropertyGroup>
117
Steve Dower49437492015-07-08 20:18:44 -0700118 <PropertyGroup Condition="'$(OverrideVersion)' == ''">
Steve Dower65e4cb12014-11-22 12:54:57 -0800119 <!--
120 Read version information from Include\patchlevel.h. The following properties are set:
121
122 MajorVersionNumber - the '3' in '3.5.2a1'
123 MinorVersionNumber - the '5' in '3.5.2a1'
124 MicroVersionNumber - the '2' in '3.5.2a1'
125 ReleaseSerial - the '1' in '3.5.2a1'
126 ReleaseLevelName - the 'a1' in '3.5.2a1'
127 PythonVersionNumber - '3.5.2' for '3.5.2a1'
128 PythonVersion - '3.5.2a1'
129 PythonVersionHex - 0x030502a1 for '3.5.2a1'
130 ReleaseLevelNumber - 10 for alpha, 11 for beta, 12 for RC (gamma), and 15 for final
131 Field3Value - 2101 for '3.5.2a1' (== 1000*2 + 10*10 ('a') + 1)
132 -->
133 <_PatchLevelContent>$([System.IO.File]::ReadAllText(`$(PySourcePath)Include\patchlevel.h`))</_PatchLevelContent>
134 <MajorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MAJOR_VERSION\s+(\d+)`).Groups[1].Value)</MajorVersionNumber>
135 <MinorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MINOR_VERSION\s+(\d+)`).Groups[1].Value)</MinorVersionNumber>
136 <MicroVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MICRO_VERSION\s+(\d+)`).Groups[1].Value)</MicroVersionNumber>
137 <_ReleaseLevel>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_LEVEL\s+PY_RELEASE_LEVEL_(\w+)`).Groups[1].Value)</_ReleaseLevel>
138 <ReleaseSerial>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_SERIAL\s+(\d+)`).Groups[1].Value)</ReleaseSerial>
139 <ReleaseLevelNumber>15</ReleaseLevelNumber>
140 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'ALPHA'">10</ReleaseLevelNumber>
141 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'BETA'">11</ReleaseLevelNumber>
142 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'GAMMA'">12</ReleaseLevelNumber>
143 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'ALPHA'">a$(ReleaseSerial)</ReleaseLevelName>
144 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'BETA'">b$(ReleaseSerial)</ReleaseLevelName>
145 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'GAMMA'">rc$(ReleaseSerial)</ReleaseLevelName>
Steve Dower49437492015-07-08 20:18:44 -0700146 </PropertyGroup>
147
148 <PropertyGroup Condition="'$(OverrideVersion)' != ''">
149 <!--
150 Override the version number when building by specifying OverrideVersion.
151 For example:
Steve Dower65e4cb12014-11-22 12:54:57 -0800152
Stefan Grönkef1502d02017-09-25 18:58:10 +0200153 PCbuild\build.bat "/p:OverrideVersion=3.5.2a1"
Steve Dower49437492015-07-08 20:18:44 -0700154
155 Use the -V option to check your version is valid:
156
Stefan Grönkef1502d02017-09-25 18:58:10 +0200157 PCbuild\build.bat -V "/p:OverrideVersion=3.5.2a1"
Steve Dower49437492015-07-08 20:18:44 -0700158 PythonVersionNumber: 3.5.2
159 PythonVersion: 3.5.2a1
160 PythonVersionHex: 0x030502A1
161 Field3Value: 2101
162
163 Note that this only affects the version numbers embedded in resources and
164 installers, but not sys.version.
165 -->
166 <MajorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[1].Value)</MajorVersionNumber>
167 <MinorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[2].Value)</MinorVersionNumber>
168 <MicroVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[3].Value)</MicroVersionNumber>
169 <ReleaseLevelName>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[4].Value)</ReleaseLevelName>
170 <_ReleaseLevel>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[5].Value)</_ReleaseLevel>
171 <ReleaseSerial>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[6].Value)</ReleaseSerial>
172 <ReleaseSerial Condition="'$(ReleaseSerial)' == ''">0</ReleaseSerial>
173 <ReleaseLevelNumber>15</ReleaseLevelNumber>
174 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'a'">10</ReleaseLevelNumber>
175 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'b'">11</ReleaseLevelNumber>
176 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'rc'">12</ReleaseLevelNumber>
177 </PropertyGroup>
178
179 <PropertyGroup>
Steve Dower65e4cb12014-11-22 12:54:57 -0800180 <PythonVersionNumber>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)</PythonVersionNumber>
181 <PythonVersion>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)$(ReleaseLevelName)</PythonVersion>
182 <PythonVersionHex>$([msbuild]::BitwiseOr(
183 $([msbuild]::Multiply($(MajorVersionNumber), 16777216)),
184 $([msbuild]::BitwiseOr(
185 $([msbuild]::Multiply($(MinorVersionNumber), 65536)),
186 $([msbuild]::BitwiseOr(
187 $([msbuild]::Multiply($(MicroVersionNumber), 256)),
188 $([msbuild]::BitwiseOr(
189 $([msbuild]::Multiply($(ReleaseLevelNumber), 16)),
190 $(ReleaseSerial)
191 ))
192 ))
193 ))
194 ))</PythonVersionHex>
195 <Field3Value>$([msbuild]::Add(
196 $(ReleaseSerial),
197 $([msbuild]::Add(
198 $([msbuild]::Multiply($(ReleaseLevelNumber), 10)),
199 $([msbuild]::Multiply($(MicroVersionNumber), 1000))
200 ))
201 ))</Field3Value>
Steve Dower940f6a82015-10-31 12:17:11 -0700202 <Field3Value Condition="$(UseTestMarker) == 'true'">$([msbuild]::Add($(Field3Value), 9000))</Field3Value>
Steve Dower65e4cb12014-11-22 12:54:57 -0800203
204 <!-- The name of the resulting pythonXY.dll (without the extension) -->
205 <PyDllName>python$(MajorVersionNumber)$(MinorVersionNumber)$(PyDebugExt)</PyDllName>
Steve Dower03a144b2014-12-15 20:45:23 -0800206
207 <!-- The version and platform tag to include in .pyd filenames -->
Steve Dower940f6a82015-10-31 12:17:11 -0700208 <PydTag Condition="$(ArchName) == 'win32'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win32</PydTag>
Paul Monson8a1657b2019-02-14 08:31:30 -0800209 <PydTag Condition="$(ArchName) == 'arm32'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win_arm32</PydTag>
Paul Monsonf96e7fd2019-05-17 10:07:24 -0700210 <PydTag Condition="$(ArchName) == 'arm64'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win_arm64</PydTag>
Steve Dower940f6a82015-10-31 12:17:11 -0700211 <PydTag Condition="$(ArchName) == 'amd64'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win_amd64</PydTag>
Steve Dower25879522015-01-15 09:10:16 -0800212
213 <!-- The version number for sys.winver -->
Steve Dower940f6a82015-10-31 12:17:11 -0700214 <SysWinVer>$(MajorVersionNumber).$(MinorVersionNumber)$(PyArchExt)$(PyTestExt)</SysWinVer>
Steve Dower65e4cb12014-11-22 12:54:57 -0800215 </PropertyGroup>
216
217 <!-- Displays the calculated version info -->
218 <Target Name="ShowVersionInfo">
219 <Message Importance="high" Text="PythonVersionNumber: $(PythonVersionNumber)" />
220 <Message Importance="high" Text="PythonVersion: $(PythonVersion)" />
Steve Dower49437492015-07-08 20:18:44 -0700221 <Message Importance="high" Text="PythonVersionHex: 0x$([System.UInt32]::Parse($(PythonVersionHex)).ToString(`X08`))" />
Steve Dower21a92f82019-06-14 08:29:20 -0700222 <Message Importance="high" Text="PythonVersionUnique: $(MajorVersionNumber).$(MinorVersionNumber).$(Field3Value)" />
Steve Dower65e4cb12014-11-22 12:54:57 -0800223 <Message Importance="high" Text="Field3Value: $(Field3Value)" />
Steve Dower940f6a82015-10-31 12:17:11 -0700224 <Message Importance="high" Text="SysWinVer: $(SysWinVer)" />
225 <Message Importance="high" Text="PyDllName: $(PyDllName)" />
Jeremy Klothf46eccd2018-12-09 20:59:32 -0700226 <Message Importance="high" Text="WindowsSdkVersion: $(TargetPlatformVersion)" />
Steve Dower65e4cb12014-11-22 12:54:57 -0800227 </Target>
228</Project>