blob: e6642fc4818a0acc399d47c3fd92545dc563e95a [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 -->
Miss Islington (bot)36926df2019-06-11 15:35:55 -070013 <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and ('$(MSBuildToolsVersion)' == '16.0' or '$(VisualStudioVersion)' == '16.0')">v142</BasePlatformToolset>
Steve Dower5fcd5e62017-09-06 10:01:38 -070014 <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and ('$(MSBuildToolsVersion)' == '15.0' or '$(VisualStudioVersion)' == '15.0')">v141</BasePlatformToolset>
Zachary Ware4c5ad942016-01-29 19:08:55 -060015 <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VCTargetsPath14)' != ''">v140</BasePlatformToolset>
16 <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VCTargetsPath12)' != ''">v120</BasePlatformToolset>
17 <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VCTargetsPath11)' != ''">v110</BasePlatformToolset>
18 <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VCTargetsPath10)' != ''">v100</BasePlatformToolset>
19
20 <PlatformToolset Condition="'$(PlatformToolset)' == ''">$(BasePlatformToolset)</PlatformToolset>
21 <ICCBuild>false</ICCBuild>
22 <ICCBuild Condition="$(PlatformToolset.StartsWith(`Intel C++ Compiler`))">true</ICCBuild>
23
Steve Dower65e4cb12014-11-22 12:54:57 -080024 <!--
25 Convincing MSVC/MSBuild to prefer our platform names is too difficult,
26 so we define our own constant ArchName and use wherever we need it.
27 -->
28 <ArchName Condition="'$(ArchName)' == '' and $(Platform) == 'x64'">amd64</ArchName>
Paul Monson8a1657b2019-02-14 08:31:30 -080029 <ArchName Condition="'$(ArchName)' == '' and $(Platform) == 'ARM'">arm32</ArchName>
Paul Monsonfb7e7502019-05-15 15:38:55 -070030 <ArchName Condition="'$(ArchName)' == '' and $(Platform) == 'ARM64'">arm64</ArchName>
Steve Dower65e4cb12014-11-22 12:54:57 -080031 <ArchName Condition="'$(ArchName)' == ''">win32</ArchName>
Steve Dower65e4cb12014-11-22 12:54:57 -080032
33 <!-- Root directory of the repository -->
34 <PySourcePath Condition="'$(PySourcePath)' == ''">$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)\..\))</PySourcePath>
35 <PySourcePath Condition="!HasTrailingSlash($(PySourcePath))">$(PySourcePath)\</PySourcePath>
36
37 <!-- Directory where build outputs are put -->
Stefan Grönkef1502d02017-09-25 18:58:10 +020038 <BuildPath32 Condition="'$(Py_OutDir)' == ''">$(PySourcePath)PCbuild\win32\</BuildPath32>
Steve Dower6fd76bc2016-07-16 16:13:19 -070039 <BuildPath32 Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)\win32\</BuildPath32>
Stefan Grönkef1502d02017-09-25 18:58:10 +020040 <BuildPath64 Condition="'$(Py_OutDir)' == ''">$(PySourcePath)PCbuild\amd64\</BuildPath64>
Steve Dower6fd76bc2016-07-16 16:13:19 -070041 <BuildPath64 Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)\amd64\</BuildPath64>
Paul Monson8a1657b2019-02-14 08:31:30 -080042 <BuildPathArm32 Condition="'$(Py_OutDir)' == ''">$(PySourcePath)PCbuild\arm32\</BuildPathArm32>
43 <BuildPathArm32 Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)\arm32\</BuildPathArm32>
Paul Monsonf96e7fd2019-05-17 10:07:24 -070044 <BuildPathArm64 Condition="'$(Py_OutDir)' == ''">$(PySourcePath)PCbuild\arm64\</BuildPathArm64>
45 <BuildPathArm64 Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)\arm64\</BuildPathArm64>
Steve Dower6fd76bc2016-07-16 16:13:19 -070046 <BuildPath Condition="'$(ArchName)' == 'win32'">$(BuildPath32)</BuildPath>
47 <BuildPath Condition="'$(ArchName)' == 'amd64'">$(BuildPath64)</BuildPath>
Paul Monson8a1657b2019-02-14 08:31:30 -080048 <BuildPath Condition="'$(ArchName)' == 'arm32'">$(BuildPathArm32)</BuildPath>
Paul Monsonf96e7fd2019-05-17 10:07:24 -070049 <BuildPath Condition="'$(ArchName)' == 'arm64'">$(BuildPathArm64)</BuildPath>
Stefan Grönkef1502d02017-09-25 18:58:10 +020050 <BuildPath Condition="'$(BuildPath)' == ''">$(PySourcePath)PCbuild\$(ArchName)\</BuildPath>
Steve Dower65e4cb12014-11-22 12:54:57 -080051 <BuildPath Condition="!HasTrailingSlash($(BuildPath))">$(BuildPath)\</BuildPath>
Steve Dower5fcd5e62017-09-06 10:01:38 -070052 <BuildPath Condition="$(Configuration) == 'PGInstrument'">$(BuildPath)instrumented\</BuildPath>
Steve Dower65e4cb12014-11-22 12:54:57 -080053
54 <!-- Directories of external projects. tcltk is handled in tcltk.props -->
Steve Dower01423cb2018-02-17 18:59:03 -080055 <ExternalsDir>$(EXTERNALS_DIR)</ExternalsDir>
56 <ExternalsDir Condition="$(ExternalsDir) == ''">$([System.IO.Path]::GetFullPath(`$(PySourcePath)externals`))</ExternalsDir>
57 <ExternalsDir Condition="!HasTrailingSlash($(ExternalsDir))">$(ExternalsDir)\</ExternalsDir>
Mariatta31af6502017-11-06 19:31:53 -080058 <sqlite3Dir>$(ExternalsDir)sqlite-3.21.0.0\</sqlite3Dir>
Steve Dower65e4cb12014-11-22 12:54:57 -080059 <bz2Dir>$(ExternalsDir)bzip2-1.0.6\</bz2Dir>
Zachary Ware16c18a32016-09-11 21:18:07 -050060 <lzmaDir>$(ExternalsDir)xz-5.2.2\</lzmaDir>
Paul Monson32119e12019-03-29 16:30:10 -070061 <libffiDir>$(ExternalsDir)libffi\</libffiDir>
62 <libffiOutDir>$(ExternalsDir)libffi\$(ArchName)\</libffiOutDir>
63 <libffiIncludeDir>$(libffiOutDir)include</libffiIncludeDir>
Paul Monsonfb7e7502019-05-15 15:38:55 -070064 <opensslDir>$(ExternalsDir)openssl-1.1.1b\</opensslDir>
65 <opensslOutDir>$(ExternalsDir)openssl-bin-1.1.1b\$(ArchName)\</opensslOutDir>
Steve Dower68d663c2017-07-17 11:15:48 +020066 <opensslIncludeDir>$(opensslOutDir)include</opensslIncludeDir>
Steve Dower65e4cb12014-11-22 12:54:57 -080067 <nasmDir>$(ExternalsDir)\nasm-2.11.06\</nasmDir>
Zachary Wared01db1c2017-09-06 17:29:37 -070068 <zlibDir>$(ExternalsDir)\zlib-1.2.11\</zlibDir>
Steve Dower65e4cb12014-11-22 12:54:57 -080069
70 <!-- Suffix for all binaries when building for debug -->
71 <PyDebugExt Condition="'$(PyDebugExt)' == '' and $(Configuration) == 'Debug'">_d</PyDebugExt>
72
Steve Dower940f6a82015-10-31 12:17:11 -070073 <!-- Suffix for versions/keys when building with test markers -->
74 <PyTestExt Condition="$(UseTestMarker) == 'true'">-test</PyTestExt>
75
76 <!-- Suffix for versions/keys when building for particular platforms -->
77 <PyArchExt Condition="'$(ArchName)' == 'win32'">-32</PyArchExt>
Paul Monson8a1657b2019-02-14 08:31:30 -080078 <PyArchExt Condition="'$(ArchName)' == 'arm32'">-arm32</PyArchExt>
Paul Monsonf96e7fd2019-05-17 10:07:24 -070079 <PyArchExt Condition="'$(ArchName)' == 'arm64'">-arm64</PyArchExt>
Steve Dower940f6a82015-10-31 12:17:11 -070080
Steve Dower65e4cb12014-11-22 12:54:57 -080081 <!-- Full path of the resulting python.exe binary -->
82 <PythonExe Condition="'$(PythonExe)' == ''">$(BuildPath)python$(PyDebugExt).exe</PythonExe>
Steve Dower49437492015-07-08 20:18:44 -070083 </PropertyGroup>
84
Paul Monson8a1657b2019-02-14 08:31:30 -080085 <PropertyGroup Condition="'$(Platform)'=='ARM'" Label="ArmConfiguration">
86 <WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
87 </PropertyGroup>
88
Paul Monsonf96e7fd2019-05-17 10:07:24 -070089 <PropertyGroup Condition="'$(Platform)'=='ARM64'" Label="Arm64Configuration">
90 <WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
91 </PropertyGroup>
92
Steve Dower9b33bf52017-05-23 16:25:25 -070093 <PropertyGroup Condition="$(DefaultWindowsSDKVersion) == ''">
94 <!--
95 Attempt to select the latest installed WinSDK. If we don't find any, then we will
96 let the MSBuild targets determine which one it wants to use (typically the earliest
97 possible version). Since we limit WINVER to Windows 7 anyway, it doesn't really
98 matter which WinSDK version we use.
99 -->
Steve Dower30f4fa42017-11-06 12:52:09 -0800100 <_RegistryVersion>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion)</_RegistryVersion>
Isuru Fernandoaedc2732019-03-21 12:52:57 -0500101 <_RegistryVersion Condition="$(_RegistryVersion) == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion)</_RegistryVersion>
Jeremy Klothf46eccd2018-12-09 20:59:32 -0700102 <!-- Sometimes the version in the registry has to .0 suffix, and sometimes it doesn't. Check and add it -->
103 <_RegistryVersion Condition="$(_RegistryVersion) != '' and !$(_RegistryVersion.EndsWith('.0'))">$(_RegistryVersion).0</_RegistryVersion>
104
105 <!-- The minimum allowed SDK version to use for building -->
106 <DefaultWindowsSDKVersion>10.0.10586.0</DefaultWindowsSDKVersion>
107 <DefaultWindowsSDKVersion Condition="$([System.Version]::Parse($(_RegistryVersion))) > $([System.Version]::Parse($(DefaultWindowsSDKVersion)))">$(_RegistryVersion)</DefaultWindowsSDKVersion>
Steve Dower9b33bf52017-05-23 16:25:25 -0700108 </PropertyGroup>
109
Jeremy Klothf46eccd2018-12-09 20:59:32 -0700110 <PropertyGroup Condition="$(WindowsTargetPlatformVersion) == ''">
111 <WindowsTargetPlatformVersion>$(DefaultWindowsSDKVersion)</WindowsTargetPlatformVersion>
112 </PropertyGroup>
113
Steve Dower49437492015-07-08 20:18:44 -0700114 <PropertyGroup Condition="'$(OverrideVersion)' == ''">
Steve Dower65e4cb12014-11-22 12:54:57 -0800115 <!--
116 Read version information from Include\patchlevel.h. The following properties are set:
117
118 MajorVersionNumber - the '3' in '3.5.2a1'
119 MinorVersionNumber - the '5' in '3.5.2a1'
120 MicroVersionNumber - the '2' in '3.5.2a1'
121 ReleaseSerial - the '1' in '3.5.2a1'
122 ReleaseLevelName - the 'a1' in '3.5.2a1'
123 PythonVersionNumber - '3.5.2' for '3.5.2a1'
124 PythonVersion - '3.5.2a1'
125 PythonVersionHex - 0x030502a1 for '3.5.2a1'
126 ReleaseLevelNumber - 10 for alpha, 11 for beta, 12 for RC (gamma), and 15 for final
127 Field3Value - 2101 for '3.5.2a1' (== 1000*2 + 10*10 ('a') + 1)
128 -->
129 <_PatchLevelContent>$([System.IO.File]::ReadAllText(`$(PySourcePath)Include\patchlevel.h`))</_PatchLevelContent>
130 <MajorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MAJOR_VERSION\s+(\d+)`).Groups[1].Value)</MajorVersionNumber>
131 <MinorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MINOR_VERSION\s+(\d+)`).Groups[1].Value)</MinorVersionNumber>
132 <MicroVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MICRO_VERSION\s+(\d+)`).Groups[1].Value)</MicroVersionNumber>
133 <_ReleaseLevel>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_LEVEL\s+PY_RELEASE_LEVEL_(\w+)`).Groups[1].Value)</_ReleaseLevel>
134 <ReleaseSerial>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_SERIAL\s+(\d+)`).Groups[1].Value)</ReleaseSerial>
135 <ReleaseLevelNumber>15</ReleaseLevelNumber>
136 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'ALPHA'">10</ReleaseLevelNumber>
137 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'BETA'">11</ReleaseLevelNumber>
138 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'GAMMA'">12</ReleaseLevelNumber>
139 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'ALPHA'">a$(ReleaseSerial)</ReleaseLevelName>
140 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'BETA'">b$(ReleaseSerial)</ReleaseLevelName>
141 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'GAMMA'">rc$(ReleaseSerial)</ReleaseLevelName>
Steve Dower49437492015-07-08 20:18:44 -0700142 </PropertyGroup>
143
144 <PropertyGroup Condition="'$(OverrideVersion)' != ''">
145 <!--
146 Override the version number when building by specifying OverrideVersion.
147 For example:
Steve Dower65e4cb12014-11-22 12:54:57 -0800148
Stefan Grönkef1502d02017-09-25 18:58:10 +0200149 PCbuild\build.bat "/p:OverrideVersion=3.5.2a1"
Steve Dower49437492015-07-08 20:18:44 -0700150
151 Use the -V option to check your version is valid:
152
Stefan Grönkef1502d02017-09-25 18:58:10 +0200153 PCbuild\build.bat -V "/p:OverrideVersion=3.5.2a1"
Steve Dower49437492015-07-08 20:18:44 -0700154 PythonVersionNumber: 3.5.2
155 PythonVersion: 3.5.2a1
156 PythonVersionHex: 0x030502A1
157 Field3Value: 2101
158
159 Note that this only affects the version numbers embedded in resources and
160 installers, but not sys.version.
161 -->
162 <MajorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[1].Value)</MajorVersionNumber>
163 <MinorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[2].Value)</MinorVersionNumber>
164 <MicroVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[3].Value)</MicroVersionNumber>
165 <ReleaseLevelName>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[4].Value)</ReleaseLevelName>
166 <_ReleaseLevel>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[5].Value)</_ReleaseLevel>
167 <ReleaseSerial>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[6].Value)</ReleaseSerial>
168 <ReleaseSerial Condition="'$(ReleaseSerial)' == ''">0</ReleaseSerial>
169 <ReleaseLevelNumber>15</ReleaseLevelNumber>
170 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'a'">10</ReleaseLevelNumber>
171 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'b'">11</ReleaseLevelNumber>
172 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'rc'">12</ReleaseLevelNumber>
173 </PropertyGroup>
174
175 <PropertyGroup>
Steve Dower65e4cb12014-11-22 12:54:57 -0800176 <PythonVersionNumber>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)</PythonVersionNumber>
177 <PythonVersion>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)$(ReleaseLevelName)</PythonVersion>
178 <PythonVersionHex>$([msbuild]::BitwiseOr(
179 $([msbuild]::Multiply($(MajorVersionNumber), 16777216)),
180 $([msbuild]::BitwiseOr(
181 $([msbuild]::Multiply($(MinorVersionNumber), 65536)),
182 $([msbuild]::BitwiseOr(
183 $([msbuild]::Multiply($(MicroVersionNumber), 256)),
184 $([msbuild]::BitwiseOr(
185 $([msbuild]::Multiply($(ReleaseLevelNumber), 16)),
186 $(ReleaseSerial)
187 ))
188 ))
189 ))
190 ))</PythonVersionHex>
191 <Field3Value>$([msbuild]::Add(
192 $(ReleaseSerial),
193 $([msbuild]::Add(
194 $([msbuild]::Multiply($(ReleaseLevelNumber), 10)),
195 $([msbuild]::Multiply($(MicroVersionNumber), 1000))
196 ))
197 ))</Field3Value>
Steve Dower940f6a82015-10-31 12:17:11 -0700198 <Field3Value Condition="$(UseTestMarker) == 'true'">$([msbuild]::Add($(Field3Value), 9000))</Field3Value>
Steve Dower65e4cb12014-11-22 12:54:57 -0800199
200 <!-- The name of the resulting pythonXY.dll (without the extension) -->
201 <PyDllName>python$(MajorVersionNumber)$(MinorVersionNumber)$(PyDebugExt)</PyDllName>
Steve Dower03a144b2014-12-15 20:45:23 -0800202
203 <!-- The version and platform tag to include in .pyd filenames -->
Steve Dower940f6a82015-10-31 12:17:11 -0700204 <PydTag Condition="$(ArchName) == 'win32'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win32</PydTag>
Paul Monson8a1657b2019-02-14 08:31:30 -0800205 <PydTag Condition="$(ArchName) == 'arm32'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win_arm32</PydTag>
Paul Monsonf96e7fd2019-05-17 10:07:24 -0700206 <PydTag Condition="$(ArchName) == 'arm64'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win_arm64</PydTag>
Steve Dower940f6a82015-10-31 12:17:11 -0700207 <PydTag Condition="$(ArchName) == 'amd64'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win_amd64</PydTag>
Steve Dower25879522015-01-15 09:10:16 -0800208
209 <!-- The version number for sys.winver -->
Steve Dower940f6a82015-10-31 12:17:11 -0700210 <SysWinVer>$(MajorVersionNumber).$(MinorVersionNumber)$(PyArchExt)$(PyTestExt)</SysWinVer>
Steve Dower65e4cb12014-11-22 12:54:57 -0800211 </PropertyGroup>
212
213 <!-- Displays the calculated version info -->
214 <Target Name="ShowVersionInfo">
215 <Message Importance="high" Text="PythonVersionNumber: $(PythonVersionNumber)" />
216 <Message Importance="high" Text="PythonVersion: $(PythonVersion)" />
Steve Dower49437492015-07-08 20:18:44 -0700217 <Message Importance="high" Text="PythonVersionHex: 0x$([System.UInt32]::Parse($(PythonVersionHex)).ToString(`X08`))" />
Steve Dower65e4cb12014-11-22 12:54:57 -0800218 <Message Importance="high" Text="Field3Value: $(Field3Value)" />
Steve Dower940f6a82015-10-31 12:17:11 -0700219 <Message Importance="high" Text="SysWinVer: $(SysWinVer)" />
220 <Message Importance="high" Text="PyDllName: $(PyDllName)" />
Jeremy Klothf46eccd2018-12-09 20:59:32 -0700221 <Message Importance="high" Text="WindowsSdkVersion: $(TargetPlatformVersion)" />
Steve Dower65e4cb12014-11-22 12:54:57 -0800222 </Target>
223</Project>