blob: 11638fe348c86347345a0c62ebd1906c8e4d5e47 [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>
Paul Monson8a1657b2019-02-14 08:31:30 -080028 <ArchName Condition="'$(ArchName)' == '' and $(Platform) == 'ARM'">arm32</ArchName>
Paul Monsonfb7e7502019-05-15 15:38:55 -070029 <ArchName Condition="'$(ArchName)' == '' and $(Platform) == 'ARM64'">arm64</ArchName>
Steve Dower65e4cb12014-11-22 12:54:57 -080030 <ArchName Condition="'$(ArchName)' == ''">win32</ArchName>
Steve Dower65e4cb12014-11-22 12:54:57 -080031
32 <!-- Root directory of the repository -->
33 <PySourcePath Condition="'$(PySourcePath)' == ''">$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)\..\))</PySourcePath>
34 <PySourcePath Condition="!HasTrailingSlash($(PySourcePath))">$(PySourcePath)\</PySourcePath>
35
36 <!-- Directory where build outputs are put -->
Stefan Grönkef1502d02017-09-25 18:58:10 +020037 <BuildPath32 Condition="'$(Py_OutDir)' == ''">$(PySourcePath)PCbuild\win32\</BuildPath32>
Steve Dower6fd76bc2016-07-16 16:13:19 -070038 <BuildPath32 Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)\win32\</BuildPath32>
Stefan Grönkef1502d02017-09-25 18:58:10 +020039 <BuildPath64 Condition="'$(Py_OutDir)' == ''">$(PySourcePath)PCbuild\amd64\</BuildPath64>
Steve Dower6fd76bc2016-07-16 16:13:19 -070040 <BuildPath64 Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)\amd64\</BuildPath64>
Paul Monson8a1657b2019-02-14 08:31:30 -080041 <BuildPathArm32 Condition="'$(Py_OutDir)' == ''">$(PySourcePath)PCbuild\arm32\</BuildPathArm32>
42 <BuildPathArm32 Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)\arm32\</BuildPathArm32>
Paul Monsonf96e7fd2019-05-17 10:07:24 -070043 <BuildPathArm64 Condition="'$(Py_OutDir)' == ''">$(PySourcePath)PCbuild\arm64\</BuildPathArm64>
44 <BuildPathArm64 Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)\arm64\</BuildPathArm64>
Steve Dower6fd76bc2016-07-16 16:13:19 -070045 <BuildPath Condition="'$(ArchName)' == 'win32'">$(BuildPath32)</BuildPath>
46 <BuildPath Condition="'$(ArchName)' == 'amd64'">$(BuildPath64)</BuildPath>
Paul Monson8a1657b2019-02-14 08:31:30 -080047 <BuildPath Condition="'$(ArchName)' == 'arm32'">$(BuildPathArm32)</BuildPath>
Paul Monsonf96e7fd2019-05-17 10:07:24 -070048 <BuildPath Condition="'$(ArchName)' == 'arm64'">$(BuildPathArm64)</BuildPath>
Stefan Grönkef1502d02017-09-25 18:58:10 +020049 <BuildPath Condition="'$(BuildPath)' == ''">$(PySourcePath)PCbuild\$(ArchName)\</BuildPath>
Steve Dower65e4cb12014-11-22 12:54:57 -080050 <BuildPath Condition="!HasTrailingSlash($(BuildPath))">$(BuildPath)\</BuildPath>
Steve Dower5fcd5e62017-09-06 10:01:38 -070051 <BuildPath Condition="$(Configuration) == 'PGInstrument'">$(BuildPath)instrumented\</BuildPath>
Steve Dower65e4cb12014-11-22 12:54:57 -080052
53 <!-- Directories of external projects. tcltk is handled in tcltk.props -->
Steve Dower01423cb2018-02-17 18:59:03 -080054 <ExternalsDir>$(EXTERNALS_DIR)</ExternalsDir>
55 <ExternalsDir Condition="$(ExternalsDir) == ''">$([System.IO.Path]::GetFullPath(`$(PySourcePath)externals`))</ExternalsDir>
56 <ExternalsDir Condition="!HasTrailingSlash($(ExternalsDir))">$(ExternalsDir)\</ExternalsDir>
Mariatta31af6502017-11-06 19:31:53 -080057 <sqlite3Dir>$(ExternalsDir)sqlite-3.21.0.0\</sqlite3Dir>
Steve Dower65e4cb12014-11-22 12:54:57 -080058 <bz2Dir>$(ExternalsDir)bzip2-1.0.6\</bz2Dir>
Zachary Ware16c18a32016-09-11 21:18:07 -050059 <lzmaDir>$(ExternalsDir)xz-5.2.2\</lzmaDir>
Paul Monson32119e12019-03-29 16:30:10 -070060 <libffiDir>$(ExternalsDir)libffi\</libffiDir>
61 <libffiOutDir>$(ExternalsDir)libffi\$(ArchName)\</libffiOutDir>
62 <libffiIncludeDir>$(libffiOutDir)include</libffiIncludeDir>
Paul Monsonfb7e7502019-05-15 15:38:55 -070063 <opensslDir>$(ExternalsDir)openssl-1.1.1b\</opensslDir>
64 <opensslOutDir>$(ExternalsDir)openssl-bin-1.1.1b\$(ArchName)\</opensslOutDir>
Steve Dower68d663c2017-07-17 11:15:48 +020065 <opensslIncludeDir>$(opensslOutDir)include</opensslIncludeDir>
Steve Dower65e4cb12014-11-22 12:54:57 -080066 <nasmDir>$(ExternalsDir)\nasm-2.11.06\</nasmDir>
Zachary Wared01db1c2017-09-06 17:29:37 -070067 <zlibDir>$(ExternalsDir)\zlib-1.2.11\</zlibDir>
Steve Dower65e4cb12014-11-22 12:54:57 -080068
69 <!-- Suffix for all binaries when building for debug -->
70 <PyDebugExt Condition="'$(PyDebugExt)' == '' and $(Configuration) == 'Debug'">_d</PyDebugExt>
71
Steve Dower940f6a82015-10-31 12:17:11 -070072 <!-- Suffix for versions/keys when building with test markers -->
73 <PyTestExt Condition="$(UseTestMarker) == 'true'">-test</PyTestExt>
74
75 <!-- Suffix for versions/keys when building for particular platforms -->
76 <PyArchExt Condition="'$(ArchName)' == 'win32'">-32</PyArchExt>
Paul Monson8a1657b2019-02-14 08:31:30 -080077 <PyArchExt Condition="'$(ArchName)' == 'arm32'">-arm32</PyArchExt>
Paul Monsonf96e7fd2019-05-17 10:07:24 -070078 <PyArchExt Condition="'$(ArchName)' == 'arm64'">-arm64</PyArchExt>
Steve Dower940f6a82015-10-31 12:17:11 -070079
Steve Dower65e4cb12014-11-22 12:54:57 -080080 <!-- Full path of the resulting python.exe binary -->
81 <PythonExe Condition="'$(PythonExe)' == ''">$(BuildPath)python$(PyDebugExt).exe</PythonExe>
Steve Dower49437492015-07-08 20:18:44 -070082 </PropertyGroup>
83
Paul Monson8a1657b2019-02-14 08:31:30 -080084 <PropertyGroup Condition="'$(Platform)'=='ARM'" Label="ArmConfiguration">
85 <WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
86 </PropertyGroup>
87
Paul Monsonf96e7fd2019-05-17 10:07:24 -070088 <PropertyGroup Condition="'$(Platform)'=='ARM64'" Label="Arm64Configuration">
89 <WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
90 </PropertyGroup>
91
Steve Dower9b33bf52017-05-23 16:25:25 -070092 <PropertyGroup Condition="$(DefaultWindowsSDKVersion) == ''">
93 <!--
94 Attempt to select the latest installed WinSDK. If we don't find any, then we will
95 let the MSBuild targets determine which one it wants to use (typically the earliest
96 possible version). Since we limit WINVER to Windows 7 anyway, it doesn't really
97 matter which WinSDK version we use.
98 -->
Steve Dower30f4fa42017-11-06 12:52:09 -080099 <_RegistryVersion>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion)</_RegistryVersion>
Isuru Fernandoaedc2732019-03-21 12:52:57 -0500100 <_RegistryVersion Condition="$(_RegistryVersion) == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion)</_RegistryVersion>
Jeremy Klothf46eccd2018-12-09 20:59:32 -0700101 <!-- Sometimes the version in the registry has to .0 suffix, and sometimes it doesn't. Check and add it -->
102 <_RegistryVersion Condition="$(_RegistryVersion) != '' and !$(_RegistryVersion.EndsWith('.0'))">$(_RegistryVersion).0</_RegistryVersion>
103
104 <!-- The minimum allowed SDK version to use for building -->
105 <DefaultWindowsSDKVersion>10.0.10586.0</DefaultWindowsSDKVersion>
106 <DefaultWindowsSDKVersion Condition="$([System.Version]::Parse($(_RegistryVersion))) > $([System.Version]::Parse($(DefaultWindowsSDKVersion)))">$(_RegistryVersion)</DefaultWindowsSDKVersion>
Steve Dower9b33bf52017-05-23 16:25:25 -0700107 </PropertyGroup>
108
Jeremy Klothf46eccd2018-12-09 20:59:32 -0700109 <PropertyGroup Condition="$(WindowsTargetPlatformVersion) == ''">
110 <WindowsTargetPlatformVersion>$(DefaultWindowsSDKVersion)</WindowsTargetPlatformVersion>
111 </PropertyGroup>
112
Steve Dower49437492015-07-08 20:18:44 -0700113 <PropertyGroup Condition="'$(OverrideVersion)' == ''">
Steve Dower65e4cb12014-11-22 12:54:57 -0800114 <!--
115 Read version information from Include\patchlevel.h. The following properties are set:
116
117 MajorVersionNumber - the '3' in '3.5.2a1'
118 MinorVersionNumber - the '5' in '3.5.2a1'
119 MicroVersionNumber - the '2' in '3.5.2a1'
120 ReleaseSerial - the '1' in '3.5.2a1'
121 ReleaseLevelName - the 'a1' in '3.5.2a1'
122 PythonVersionNumber - '3.5.2' for '3.5.2a1'
123 PythonVersion - '3.5.2a1'
124 PythonVersionHex - 0x030502a1 for '3.5.2a1'
125 ReleaseLevelNumber - 10 for alpha, 11 for beta, 12 for RC (gamma), and 15 for final
126 Field3Value - 2101 for '3.5.2a1' (== 1000*2 + 10*10 ('a') + 1)
127 -->
128 <_PatchLevelContent>$([System.IO.File]::ReadAllText(`$(PySourcePath)Include\patchlevel.h`))</_PatchLevelContent>
129 <MajorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MAJOR_VERSION\s+(\d+)`).Groups[1].Value)</MajorVersionNumber>
130 <MinorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MINOR_VERSION\s+(\d+)`).Groups[1].Value)</MinorVersionNumber>
131 <MicroVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MICRO_VERSION\s+(\d+)`).Groups[1].Value)</MicroVersionNumber>
132 <_ReleaseLevel>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_LEVEL\s+PY_RELEASE_LEVEL_(\w+)`).Groups[1].Value)</_ReleaseLevel>
133 <ReleaseSerial>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_SERIAL\s+(\d+)`).Groups[1].Value)</ReleaseSerial>
134 <ReleaseLevelNumber>15</ReleaseLevelNumber>
135 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'ALPHA'">10</ReleaseLevelNumber>
136 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'BETA'">11</ReleaseLevelNumber>
137 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'GAMMA'">12</ReleaseLevelNumber>
138 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'ALPHA'">a$(ReleaseSerial)</ReleaseLevelName>
139 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'BETA'">b$(ReleaseSerial)</ReleaseLevelName>
140 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'GAMMA'">rc$(ReleaseSerial)</ReleaseLevelName>
Steve Dower49437492015-07-08 20:18:44 -0700141 </PropertyGroup>
142
143 <PropertyGroup Condition="'$(OverrideVersion)' != ''">
144 <!--
145 Override the version number when building by specifying OverrideVersion.
146 For example:
Steve Dower65e4cb12014-11-22 12:54:57 -0800147
Stefan Grönkef1502d02017-09-25 18:58:10 +0200148 PCbuild\build.bat "/p:OverrideVersion=3.5.2a1"
Steve Dower49437492015-07-08 20:18:44 -0700149
150 Use the -V option to check your version is valid:
151
Stefan Grönkef1502d02017-09-25 18:58:10 +0200152 PCbuild\build.bat -V "/p:OverrideVersion=3.5.2a1"
Steve Dower49437492015-07-08 20:18:44 -0700153 PythonVersionNumber: 3.5.2
154 PythonVersion: 3.5.2a1
155 PythonVersionHex: 0x030502A1
156 Field3Value: 2101
157
158 Note that this only affects the version numbers embedded in resources and
159 installers, but not sys.version.
160 -->
161 <MajorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[1].Value)</MajorVersionNumber>
162 <MinorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[2].Value)</MinorVersionNumber>
163 <MicroVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[3].Value)</MicroVersionNumber>
164 <ReleaseLevelName>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[4].Value)</ReleaseLevelName>
165 <_ReleaseLevel>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[5].Value)</_ReleaseLevel>
166 <ReleaseSerial>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[6].Value)</ReleaseSerial>
167 <ReleaseSerial Condition="'$(ReleaseSerial)' == ''">0</ReleaseSerial>
168 <ReleaseLevelNumber>15</ReleaseLevelNumber>
169 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'a'">10</ReleaseLevelNumber>
170 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'b'">11</ReleaseLevelNumber>
171 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'rc'">12</ReleaseLevelNumber>
172 </PropertyGroup>
173
174 <PropertyGroup>
Steve Dower65e4cb12014-11-22 12:54:57 -0800175 <PythonVersionNumber>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)</PythonVersionNumber>
176 <PythonVersion>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)$(ReleaseLevelName)</PythonVersion>
177 <PythonVersionHex>$([msbuild]::BitwiseOr(
178 $([msbuild]::Multiply($(MajorVersionNumber), 16777216)),
179 $([msbuild]::BitwiseOr(
180 $([msbuild]::Multiply($(MinorVersionNumber), 65536)),
181 $([msbuild]::BitwiseOr(
182 $([msbuild]::Multiply($(MicroVersionNumber), 256)),
183 $([msbuild]::BitwiseOr(
184 $([msbuild]::Multiply($(ReleaseLevelNumber), 16)),
185 $(ReleaseSerial)
186 ))
187 ))
188 ))
189 ))</PythonVersionHex>
190 <Field3Value>$([msbuild]::Add(
191 $(ReleaseSerial),
192 $([msbuild]::Add(
193 $([msbuild]::Multiply($(ReleaseLevelNumber), 10)),
194 $([msbuild]::Multiply($(MicroVersionNumber), 1000))
195 ))
196 ))</Field3Value>
Steve Dower940f6a82015-10-31 12:17:11 -0700197 <Field3Value Condition="$(UseTestMarker) == 'true'">$([msbuild]::Add($(Field3Value), 9000))</Field3Value>
Steve Dower65e4cb12014-11-22 12:54:57 -0800198
199 <!-- The name of the resulting pythonXY.dll (without the extension) -->
200 <PyDllName>python$(MajorVersionNumber)$(MinorVersionNumber)$(PyDebugExt)</PyDllName>
Steve Dower03a144b2014-12-15 20:45:23 -0800201
202 <!-- The version and platform tag to include in .pyd filenames -->
Steve Dower940f6a82015-10-31 12:17:11 -0700203 <PydTag Condition="$(ArchName) == 'win32'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win32</PydTag>
Paul Monson8a1657b2019-02-14 08:31:30 -0800204 <PydTag Condition="$(ArchName) == 'arm32'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win_arm32</PydTag>
Paul Monsonf96e7fd2019-05-17 10:07:24 -0700205 <PydTag Condition="$(ArchName) == 'arm64'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win_arm64</PydTag>
Steve Dower940f6a82015-10-31 12:17:11 -0700206 <PydTag Condition="$(ArchName) == 'amd64'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win_amd64</PydTag>
Steve Dower25879522015-01-15 09:10:16 -0800207
208 <!-- The version number for sys.winver -->
Steve Dower940f6a82015-10-31 12:17:11 -0700209 <SysWinVer>$(MajorVersionNumber).$(MinorVersionNumber)$(PyArchExt)$(PyTestExt)</SysWinVer>
Steve Dower65e4cb12014-11-22 12:54:57 -0800210 </PropertyGroup>
211
212 <!-- Displays the calculated version info -->
213 <Target Name="ShowVersionInfo">
214 <Message Importance="high" Text="PythonVersionNumber: $(PythonVersionNumber)" />
215 <Message Importance="high" Text="PythonVersion: $(PythonVersion)" />
Steve Dower49437492015-07-08 20:18:44 -0700216 <Message Importance="high" Text="PythonVersionHex: 0x$([System.UInt32]::Parse($(PythonVersionHex)).ToString(`X08`))" />
Steve Dower65e4cb12014-11-22 12:54:57 -0800217 <Message Importance="high" Text="Field3Value: $(Field3Value)" />
Steve Dower940f6a82015-10-31 12:17:11 -0700218 <Message Importance="high" Text="SysWinVer: $(SysWinVer)" />
219 <Message Importance="high" Text="PyDllName: $(PyDllName)" />
Jeremy Klothf46eccd2018-12-09 20:59:32 -0700220 <Message Importance="high" Text="WindowsSdkVersion: $(TargetPlatformVersion)" />
Steve Dower65e4cb12014-11-22 12:54:57 -0800221 </Target>
222</Project>