blob: a9dc9db4863f0b874a10c4270344df29588fbdb6 [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>
Steve Dower65e4cb12014-11-22 12:54:57 -080029 <ArchName Condition="'$(ArchName)' == ''">win32</ArchName>
Steve Dower65e4cb12014-11-22 12:54:57 -080030
31 <!-- Root directory of the repository -->
32 <PySourcePath Condition="'$(PySourcePath)' == ''">$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)\..\))</PySourcePath>
33 <PySourcePath Condition="!HasTrailingSlash($(PySourcePath))">$(PySourcePath)\</PySourcePath>
34
35 <!-- Directory where build outputs are put -->
Stefan Grönkef1502d02017-09-25 18:58:10 +020036 <BuildPath32 Condition="'$(Py_OutDir)' == ''">$(PySourcePath)PCbuild\win32\</BuildPath32>
Steve Dower6fd76bc2016-07-16 16:13:19 -070037 <BuildPath32 Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)\win32\</BuildPath32>
Stefan Grönkef1502d02017-09-25 18:58:10 +020038 <BuildPath64 Condition="'$(Py_OutDir)' == ''">$(PySourcePath)PCbuild\amd64\</BuildPath64>
Steve Dower6fd76bc2016-07-16 16:13:19 -070039 <BuildPath64 Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)\amd64\</BuildPath64>
Paul Monson8a1657b2019-02-14 08:31:30 -080040 <BuildPathArm32 Condition="'$(Py_OutDir)' == ''">$(PySourcePath)PCbuild\arm32\</BuildPathArm32>
41 <BuildPathArm32 Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)\arm32\</BuildPathArm32>
Steve Dower6fd76bc2016-07-16 16:13:19 -070042 <BuildPath Condition="'$(ArchName)' == 'win32'">$(BuildPath32)</BuildPath>
43 <BuildPath Condition="'$(ArchName)' == 'amd64'">$(BuildPath64)</BuildPath>
Paul Monson8a1657b2019-02-14 08:31:30 -080044 <BuildPath Condition="'$(ArchName)' == 'arm32'">$(BuildPathArm32)</BuildPath>
Stefan Grönkef1502d02017-09-25 18:58:10 +020045 <BuildPath Condition="'$(BuildPath)' == ''">$(PySourcePath)PCbuild\$(ArchName)\</BuildPath>
Steve Dower65e4cb12014-11-22 12:54:57 -080046 <BuildPath Condition="!HasTrailingSlash($(BuildPath))">$(BuildPath)\</BuildPath>
Steve Dower5fcd5e62017-09-06 10:01:38 -070047 <BuildPath Condition="$(Configuration) == 'PGInstrument'">$(BuildPath)instrumented\</BuildPath>
Steve Dower65e4cb12014-11-22 12:54:57 -080048
49 <!-- Directories of external projects. tcltk is handled in tcltk.props -->
Steve Dower01423cb2018-02-17 18:59:03 -080050 <ExternalsDir>$(EXTERNALS_DIR)</ExternalsDir>
51 <ExternalsDir Condition="$(ExternalsDir) == ''">$([System.IO.Path]::GetFullPath(`$(PySourcePath)externals`))</ExternalsDir>
52 <ExternalsDir Condition="!HasTrailingSlash($(ExternalsDir))">$(ExternalsDir)\</ExternalsDir>
Mariatta31af6502017-11-06 19:31:53 -080053 <sqlite3Dir>$(ExternalsDir)sqlite-3.21.0.0\</sqlite3Dir>
Steve Dower65e4cb12014-11-22 12:54:57 -080054 <bz2Dir>$(ExternalsDir)bzip2-1.0.6\</bz2Dir>
Zachary Ware16c18a32016-09-11 21:18:07 -050055 <lzmaDir>$(ExternalsDir)xz-5.2.2\</lzmaDir>
Steve Dower48243852018-12-10 19:52:36 -080056 <opensslDir>$(ExternalsDir)openssl-1.1.0j\</opensslDir>
57 <opensslOutDir>$(ExternalsDir)openssl-bin-1.1.0j\$(ArchName)\</opensslOutDir>
Steve Dower68d663c2017-07-17 11:15:48 +020058 <opensslIncludeDir>$(opensslOutDir)include</opensslIncludeDir>
Steve Dower65e4cb12014-11-22 12:54:57 -080059 <nasmDir>$(ExternalsDir)\nasm-2.11.06\</nasmDir>
Zachary Wared01db1c2017-09-06 17:29:37 -070060 <zlibDir>$(ExternalsDir)\zlib-1.2.11\</zlibDir>
Steve Dower65e4cb12014-11-22 12:54:57 -080061
62 <!-- Suffix for all binaries when building for debug -->
63 <PyDebugExt Condition="'$(PyDebugExt)' == '' and $(Configuration) == 'Debug'">_d</PyDebugExt>
64
Steve Dower940f6a82015-10-31 12:17:11 -070065 <!-- Suffix for versions/keys when building with test markers -->
66 <PyTestExt Condition="$(UseTestMarker) == 'true'">-test</PyTestExt>
67
68 <!-- Suffix for versions/keys when building for particular platforms -->
69 <PyArchExt Condition="'$(ArchName)' == 'win32'">-32</PyArchExt>
Paul Monson8a1657b2019-02-14 08:31:30 -080070 <PyArchExt Condition="'$(ArchName)' == 'arm32'">-arm32</PyArchExt>
Steve Dower940f6a82015-10-31 12:17:11 -070071
Steve Dower65e4cb12014-11-22 12:54:57 -080072 <!-- Full path of the resulting python.exe binary -->
73 <PythonExe Condition="'$(PythonExe)' == ''">$(BuildPath)python$(PyDebugExt).exe</PythonExe>
Steve Dower49437492015-07-08 20:18:44 -070074 </PropertyGroup>
75
Paul Monson8a1657b2019-02-14 08:31:30 -080076 <PropertyGroup Condition="'$(Platform)'=='ARM'" Label="ArmConfiguration">
77 <WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
78 </PropertyGroup>
79
Steve Dower9b33bf52017-05-23 16:25:25 -070080 <PropertyGroup Condition="$(DefaultWindowsSDKVersion) == ''">
81 <!--
82 Attempt to select the latest installed WinSDK. If we don't find any, then we will
83 let the MSBuild targets determine which one it wants to use (typically the earliest
84 possible version). Since we limit WINVER to Windows 7 anyway, it doesn't really
85 matter which WinSDK version we use.
86 -->
Steve Dower30f4fa42017-11-06 12:52:09 -080087 <_RegistryVersion>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion)</_RegistryVersion>
88 <_RegistryVersion Condition="$(_RegistryVersion) == ''">$(Registry:HKEY_LOCAL_MACHINE\WOW6432Node\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion)</_RegistryVersion>
Jeremy Klothf46eccd2018-12-09 20:59:32 -070089 <!-- Sometimes the version in the registry has to .0 suffix, and sometimes it doesn't. Check and add it -->
90 <_RegistryVersion Condition="$(_RegistryVersion) != '' and !$(_RegistryVersion.EndsWith('.0'))">$(_RegistryVersion).0</_RegistryVersion>
91
92 <!-- The minimum allowed SDK version to use for building -->
93 <DefaultWindowsSDKVersion>10.0.10586.0</DefaultWindowsSDKVersion>
94 <DefaultWindowsSDKVersion Condition="$([System.Version]::Parse($(_RegistryVersion))) > $([System.Version]::Parse($(DefaultWindowsSDKVersion)))">$(_RegistryVersion)</DefaultWindowsSDKVersion>
Steve Dower9b33bf52017-05-23 16:25:25 -070095 </PropertyGroup>
96
Jeremy Klothf46eccd2018-12-09 20:59:32 -070097 <PropertyGroup Condition="$(WindowsTargetPlatformVersion) == ''">
98 <WindowsTargetPlatformVersion>$(DefaultWindowsSDKVersion)</WindowsTargetPlatformVersion>
99 </PropertyGroup>
100
Steve Dower49437492015-07-08 20:18:44 -0700101 <PropertyGroup Condition="'$(OverrideVersion)' == ''">
Steve Dower65e4cb12014-11-22 12:54:57 -0800102 <!--
103 Read version information from Include\patchlevel.h. The following properties are set:
104
105 MajorVersionNumber - the '3' in '3.5.2a1'
106 MinorVersionNumber - the '5' in '3.5.2a1'
107 MicroVersionNumber - the '2' in '3.5.2a1'
108 ReleaseSerial - the '1' in '3.5.2a1'
109 ReleaseLevelName - the 'a1' in '3.5.2a1'
110 PythonVersionNumber - '3.5.2' for '3.5.2a1'
111 PythonVersion - '3.5.2a1'
112 PythonVersionHex - 0x030502a1 for '3.5.2a1'
113 ReleaseLevelNumber - 10 for alpha, 11 for beta, 12 for RC (gamma), and 15 for final
114 Field3Value - 2101 for '3.5.2a1' (== 1000*2 + 10*10 ('a') + 1)
115 -->
116 <_PatchLevelContent>$([System.IO.File]::ReadAllText(`$(PySourcePath)Include\patchlevel.h`))</_PatchLevelContent>
117 <MajorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MAJOR_VERSION\s+(\d+)`).Groups[1].Value)</MajorVersionNumber>
118 <MinorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MINOR_VERSION\s+(\d+)`).Groups[1].Value)</MinorVersionNumber>
119 <MicroVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MICRO_VERSION\s+(\d+)`).Groups[1].Value)</MicroVersionNumber>
120 <_ReleaseLevel>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_LEVEL\s+PY_RELEASE_LEVEL_(\w+)`).Groups[1].Value)</_ReleaseLevel>
121 <ReleaseSerial>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_SERIAL\s+(\d+)`).Groups[1].Value)</ReleaseSerial>
122 <ReleaseLevelNumber>15</ReleaseLevelNumber>
123 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'ALPHA'">10</ReleaseLevelNumber>
124 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'BETA'">11</ReleaseLevelNumber>
125 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'GAMMA'">12</ReleaseLevelNumber>
126 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'ALPHA'">a$(ReleaseSerial)</ReleaseLevelName>
127 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'BETA'">b$(ReleaseSerial)</ReleaseLevelName>
128 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'GAMMA'">rc$(ReleaseSerial)</ReleaseLevelName>
Steve Dower49437492015-07-08 20:18:44 -0700129 </PropertyGroup>
130
131 <PropertyGroup Condition="'$(OverrideVersion)' != ''">
132 <!--
133 Override the version number when building by specifying OverrideVersion.
134 For example:
Steve Dower65e4cb12014-11-22 12:54:57 -0800135
Stefan Grönkef1502d02017-09-25 18:58:10 +0200136 PCbuild\build.bat "/p:OverrideVersion=3.5.2a1"
Steve Dower49437492015-07-08 20:18:44 -0700137
138 Use the -V option to check your version is valid:
139
Stefan Grönkef1502d02017-09-25 18:58:10 +0200140 PCbuild\build.bat -V "/p:OverrideVersion=3.5.2a1"
Steve Dower49437492015-07-08 20:18:44 -0700141 PythonVersionNumber: 3.5.2
142 PythonVersion: 3.5.2a1
143 PythonVersionHex: 0x030502A1
144 Field3Value: 2101
145
146 Note that this only affects the version numbers embedded in resources and
147 installers, but not sys.version.
148 -->
149 <MajorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[1].Value)</MajorVersionNumber>
150 <MinorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[2].Value)</MinorVersionNumber>
151 <MicroVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[3].Value)</MicroVersionNumber>
152 <ReleaseLevelName>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[4].Value)</ReleaseLevelName>
153 <_ReleaseLevel>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[5].Value)</_ReleaseLevel>
154 <ReleaseSerial>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[6].Value)</ReleaseSerial>
155 <ReleaseSerial Condition="'$(ReleaseSerial)' == ''">0</ReleaseSerial>
156 <ReleaseLevelNumber>15</ReleaseLevelNumber>
157 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'a'">10</ReleaseLevelNumber>
158 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'b'">11</ReleaseLevelNumber>
159 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'rc'">12</ReleaseLevelNumber>
160 </PropertyGroup>
161
162 <PropertyGroup>
Steve Dower65e4cb12014-11-22 12:54:57 -0800163 <PythonVersionNumber>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)</PythonVersionNumber>
164 <PythonVersion>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)$(ReleaseLevelName)</PythonVersion>
165 <PythonVersionHex>$([msbuild]::BitwiseOr(
166 $([msbuild]::Multiply($(MajorVersionNumber), 16777216)),
167 $([msbuild]::BitwiseOr(
168 $([msbuild]::Multiply($(MinorVersionNumber), 65536)),
169 $([msbuild]::BitwiseOr(
170 $([msbuild]::Multiply($(MicroVersionNumber), 256)),
171 $([msbuild]::BitwiseOr(
172 $([msbuild]::Multiply($(ReleaseLevelNumber), 16)),
173 $(ReleaseSerial)
174 ))
175 ))
176 ))
177 ))</PythonVersionHex>
178 <Field3Value>$([msbuild]::Add(
179 $(ReleaseSerial),
180 $([msbuild]::Add(
181 $([msbuild]::Multiply($(ReleaseLevelNumber), 10)),
182 $([msbuild]::Multiply($(MicroVersionNumber), 1000))
183 ))
184 ))</Field3Value>
Steve Dower940f6a82015-10-31 12:17:11 -0700185 <Field3Value Condition="$(UseTestMarker) == 'true'">$([msbuild]::Add($(Field3Value), 9000))</Field3Value>
Steve Dower65e4cb12014-11-22 12:54:57 -0800186
187 <!-- The name of the resulting pythonXY.dll (without the extension) -->
188 <PyDllName>python$(MajorVersionNumber)$(MinorVersionNumber)$(PyDebugExt)</PyDllName>
Steve Dower03a144b2014-12-15 20:45:23 -0800189
190 <!-- The version and platform tag to include in .pyd filenames -->
Steve Dower940f6a82015-10-31 12:17:11 -0700191 <PydTag Condition="$(ArchName) == 'win32'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win32</PydTag>
Paul Monson8a1657b2019-02-14 08:31:30 -0800192 <PydTag Condition="$(ArchName) == 'arm32'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win_arm32</PydTag>
Steve Dower940f6a82015-10-31 12:17:11 -0700193 <PydTag Condition="$(ArchName) == 'amd64'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win_amd64</PydTag>
Steve Dower25879522015-01-15 09:10:16 -0800194
195 <!-- The version number for sys.winver -->
Steve Dower940f6a82015-10-31 12:17:11 -0700196 <SysWinVer>$(MajorVersionNumber).$(MinorVersionNumber)$(PyArchExt)$(PyTestExt)</SysWinVer>
Steve Dower65e4cb12014-11-22 12:54:57 -0800197 </PropertyGroup>
198
199 <!-- Displays the calculated version info -->
200 <Target Name="ShowVersionInfo">
201 <Message Importance="high" Text="PythonVersionNumber: $(PythonVersionNumber)" />
202 <Message Importance="high" Text="PythonVersion: $(PythonVersion)" />
Steve Dower49437492015-07-08 20:18:44 -0700203 <Message Importance="high" Text="PythonVersionHex: 0x$([System.UInt32]::Parse($(PythonVersionHex)).ToString(`X08`))" />
Steve Dower65e4cb12014-11-22 12:54:57 -0800204 <Message Importance="high" Text="Field3Value: $(Field3Value)" />
Steve Dower940f6a82015-10-31 12:17:11 -0700205 <Message Importance="high" Text="SysWinVer: $(SysWinVer)" />
206 <Message Importance="high" Text="PyDllName: $(PyDllName)" />
Jeremy Klothf46eccd2018-12-09 20:59:32 -0700207 <Message Importance="high" Text="WindowsSdkVersion: $(TargetPlatformVersion)" />
Steve Dower65e4cb12014-11-22 12:54:57 -0800208 </Target>
209</Project>