blob: c81cd94fe40b213bca729bf2eedeffc633b180f7 [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 -->
Zachary Ware4c5ad942016-01-29 19:08:55 -060013 <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VCTargetsPath14)' != ''">v140</BasePlatformToolset>
14 <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VCTargetsPath12)' != ''">v120</BasePlatformToolset>
15 <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VCTargetsPath11)' != ''">v110</BasePlatformToolset>
16 <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VCTargetsPath10)' != ''">v100</BasePlatformToolset>
17
18 <PlatformToolset Condition="'$(PlatformToolset)' == ''">$(BasePlatformToolset)</PlatformToolset>
19 <ICCBuild>false</ICCBuild>
20 <ICCBuild Condition="$(PlatformToolset.StartsWith(`Intel C++ Compiler`))">true</ICCBuild>
21
Steve Dower65e4cb12014-11-22 12:54:57 -080022 <!--
23 Convincing MSVC/MSBuild to prefer our platform names is too difficult,
24 so we define our own constant ArchName and use wherever we need it.
25 -->
26 <ArchName Condition="'$(ArchName)' == '' and $(Platform) == 'x64'">amd64</ArchName>
27 <ArchName Condition="'$(ArchName)' == ''">win32</ArchName>
Steve Dower65e4cb12014-11-22 12:54:57 -080028
29 <!-- Root directory of the repository -->
30 <PySourcePath Condition="'$(PySourcePath)' == ''">$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)\..\))</PySourcePath>
31 <PySourcePath Condition="!HasTrailingSlash($(PySourcePath))">$(PySourcePath)\</PySourcePath>
32
33 <!-- Directory where build outputs are put -->
Steve Dower6fd76bc2016-07-16 16:13:19 -070034 <BuildPath32 Condition="'$(Py_OutDir)' == ''">$(PySourcePath)PCBuild\win32\</BuildPath32>
35 <BuildPath32 Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)\win32\</BuildPath32>
36 <BuildPath64 Condition="'$(Py_OutDir)' == ''">$(PySourcePath)PCBuild\amd64\</BuildPath64>
37 <BuildPath64 Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)\amd64\</BuildPath64>
38 <BuildPath Condition="'$(ArchName)' == 'win32'">$(BuildPath32)</BuildPath>
39 <BuildPath Condition="'$(ArchName)' == 'amd64'">$(BuildPath64)</BuildPath>
40 <BuildPath Condition="'$(BuildPath)' == ''">$(PySourcePath)PCBuild\$(ArchName)\</BuildPath>
Steve Dower65e4cb12014-11-22 12:54:57 -080041 <BuildPath Condition="!HasTrailingSlash($(BuildPath))">$(BuildPath)\</BuildPath>
42
43 <!-- Directories of external projects. tcltk is handled in tcltk.props -->
44 <ExternalsDir>$([System.IO.Path]::GetFullPath(`$(PySourcePath)externals\`))</ExternalsDir>
Zachary Ware547d1562016-10-10 22:36:21 -050045 <sqlite3Dir>$(ExternalsDir)sqlite-3.14.2.0\</sqlite3Dir>
Steve Dower65e4cb12014-11-22 12:54:57 -080046 <bz2Dir>$(ExternalsDir)bzip2-1.0.6\</bz2Dir>
Zachary Ware16c18a32016-09-11 21:18:07 -050047 <lzmaDir>$(ExternalsDir)xz-5.2.2\</lzmaDir>
Zachary Warefc64c352017-03-03 16:07:07 -060048 <opensslDir>$(ExternalsDir)openssl-1.0.2k\</opensslDir>
Steve Dower68d663c2017-07-17 11:15:48 +020049 <opensslOutDir>$(ExternalsDir)openssl-bin-1.0.2k\$(ArchName)\</opensslOutDir>
50 <opensslIncludeDir>$(opensslOutDir)include</opensslIncludeDir>
Steve Dower65e4cb12014-11-22 12:54:57 -080051 <nasmDir>$(ExternalsDir)\nasm-2.11.06\</nasmDir>
52
53 <!-- Suffix for all binaries when building for debug -->
54 <PyDebugExt Condition="'$(PyDebugExt)' == '' and $(Configuration) == 'Debug'">_d</PyDebugExt>
55
Steve Dower940f6a82015-10-31 12:17:11 -070056 <!-- Suffix for versions/keys when building with test markers -->
57 <PyTestExt Condition="$(UseTestMarker) == 'true'">-test</PyTestExt>
58
59 <!-- Suffix for versions/keys when building for particular platforms -->
60 <PyArchExt Condition="'$(ArchName)' == 'win32'">-32</PyArchExt>
61
Steve Dower65e4cb12014-11-22 12:54:57 -080062 <!-- Full path of the resulting python.exe binary -->
63 <PythonExe Condition="'$(PythonExe)' == ''">$(BuildPath)python$(PyDebugExt).exe</PythonExe>
Steve Dower49437492015-07-08 20:18:44 -070064 </PropertyGroup>
65
Steve Dower9b33bf52017-05-23 16:25:25 -070066 <PropertyGroup Condition="$(DefaultWindowsSDKVersion) == ''">
67 <!--
68 Attempt to select the latest installed WinSDK. If we don't find any, then we will
69 let the MSBuild targets determine which one it wants to use (typically the earliest
70 possible version). Since we limit WINVER to Windows 7 anyway, it doesn't really
71 matter which WinSDK version we use.
72 -->
73 <DefaultWindowsSDKVersion Condition="$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion) == '10.0.15063'">10.0.15063.0</DefaultWindowsSDKVersion>
74 <DefaultWindowsSDKVersion Condition="$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion) == '10.0.15063'">10.0.15063.0</DefaultWindowsSDKVersion>
Steve Dower68d663c2017-07-17 11:15:48 +020075 <DefaultWindowsSDKVersion Condition="$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion) == '10.0.14393'">10.0.14393.0</DefaultWindowsSDKVersion>
76 <DefaultWindowsSDKVersion Condition="$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion) == '10.0.14393'">10.0.14393.0</DefaultWindowsSDKVersion>
Steve Dower9b33bf52017-05-23 16:25:25 -070077 <DefaultWindowsSDKVersion Condition="$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion) == '10.0.10586'">10.0.10586.0</DefaultWindowsSDKVersion>
78 <DefaultWindowsSDKVersion Condition="$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion) == '10.0.10586'">10.0.10586.0</DefaultWindowsSDKVersion>
79 <DefaultWindowsSDKVersion Condition="$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion) == '10.0.10240'">10.0.10240.0</DefaultWindowsSDKVersion>
80 <DefaultWindowsSDKVersion Condition="$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion) == '10.0.10240'">10.0.10240.0</DefaultWindowsSDKVersion>
81 </PropertyGroup>
82
Steve Dower49437492015-07-08 20:18:44 -070083 <PropertyGroup Condition="'$(OverrideVersion)' == ''">
Steve Dower65e4cb12014-11-22 12:54:57 -080084 <!--
85 Read version information from Include\patchlevel.h. The following properties are set:
86
87 MajorVersionNumber - the '3' in '3.5.2a1'
88 MinorVersionNumber - the '5' in '3.5.2a1'
89 MicroVersionNumber - the '2' in '3.5.2a1'
90 ReleaseSerial - the '1' in '3.5.2a1'
91 ReleaseLevelName - the 'a1' in '3.5.2a1'
92 PythonVersionNumber - '3.5.2' for '3.5.2a1'
93 PythonVersion - '3.5.2a1'
94 PythonVersionHex - 0x030502a1 for '3.5.2a1'
95 ReleaseLevelNumber - 10 for alpha, 11 for beta, 12 for RC (gamma), and 15 for final
96 Field3Value - 2101 for '3.5.2a1' (== 1000*2 + 10*10 ('a') + 1)
97 -->
98 <_PatchLevelContent>$([System.IO.File]::ReadAllText(`$(PySourcePath)Include\patchlevel.h`))</_PatchLevelContent>
99 <MajorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MAJOR_VERSION\s+(\d+)`).Groups[1].Value)</MajorVersionNumber>
100 <MinorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MINOR_VERSION\s+(\d+)`).Groups[1].Value)</MinorVersionNumber>
101 <MicroVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MICRO_VERSION\s+(\d+)`).Groups[1].Value)</MicroVersionNumber>
102 <_ReleaseLevel>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_LEVEL\s+PY_RELEASE_LEVEL_(\w+)`).Groups[1].Value)</_ReleaseLevel>
103 <ReleaseSerial>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_SERIAL\s+(\d+)`).Groups[1].Value)</ReleaseSerial>
104 <ReleaseLevelNumber>15</ReleaseLevelNumber>
105 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'ALPHA'">10</ReleaseLevelNumber>
106 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'BETA'">11</ReleaseLevelNumber>
107 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'GAMMA'">12</ReleaseLevelNumber>
108 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'ALPHA'">a$(ReleaseSerial)</ReleaseLevelName>
109 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'BETA'">b$(ReleaseSerial)</ReleaseLevelName>
110 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'GAMMA'">rc$(ReleaseSerial)</ReleaseLevelName>
Steve Dower49437492015-07-08 20:18:44 -0700111 </PropertyGroup>
112
113 <PropertyGroup Condition="'$(OverrideVersion)' != ''">
114 <!--
115 Override the version number when building by specifying OverrideVersion.
116 For example:
Steve Dower65e4cb12014-11-22 12:54:57 -0800117
Steve Dower49437492015-07-08 20:18:44 -0700118 PCBuild\build.bat "/p:OverrideVersion=3.5.2a1"
119
120 Use the -V option to check your version is valid:
121
122 PCBuild\build.bat -V "/p:OverrideVersion=3.5.2a1"
123 PythonVersionNumber: 3.5.2
124 PythonVersion: 3.5.2a1
125 PythonVersionHex: 0x030502A1
126 Field3Value: 2101
127
128 Note that this only affects the version numbers embedded in resources and
129 installers, but not sys.version.
130 -->
131 <MajorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[1].Value)</MajorVersionNumber>
132 <MinorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[2].Value)</MinorVersionNumber>
133 <MicroVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[3].Value)</MicroVersionNumber>
134 <ReleaseLevelName>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[4].Value)</ReleaseLevelName>
135 <_ReleaseLevel>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[5].Value)</_ReleaseLevel>
136 <ReleaseSerial>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[6].Value)</ReleaseSerial>
137 <ReleaseSerial Condition="'$(ReleaseSerial)' == ''">0</ReleaseSerial>
138 <ReleaseLevelNumber>15</ReleaseLevelNumber>
139 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'a'">10</ReleaseLevelNumber>
140 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'b'">11</ReleaseLevelNumber>
141 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'rc'">12</ReleaseLevelNumber>
142 </PropertyGroup>
143
144 <PropertyGroup>
Steve Dower65e4cb12014-11-22 12:54:57 -0800145 <PythonVersionNumber>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)</PythonVersionNumber>
146 <PythonVersion>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)$(ReleaseLevelName)</PythonVersion>
147 <PythonVersionHex>$([msbuild]::BitwiseOr(
148 $([msbuild]::Multiply($(MajorVersionNumber), 16777216)),
149 $([msbuild]::BitwiseOr(
150 $([msbuild]::Multiply($(MinorVersionNumber), 65536)),
151 $([msbuild]::BitwiseOr(
152 $([msbuild]::Multiply($(MicroVersionNumber), 256)),
153 $([msbuild]::BitwiseOr(
154 $([msbuild]::Multiply($(ReleaseLevelNumber), 16)),
155 $(ReleaseSerial)
156 ))
157 ))
158 ))
159 ))</PythonVersionHex>
160 <Field3Value>$([msbuild]::Add(
161 $(ReleaseSerial),
162 $([msbuild]::Add(
163 $([msbuild]::Multiply($(ReleaseLevelNumber), 10)),
164 $([msbuild]::Multiply($(MicroVersionNumber), 1000))
165 ))
166 ))</Field3Value>
Steve Dower940f6a82015-10-31 12:17:11 -0700167 <Field3Value Condition="$(UseTestMarker) == 'true'">$([msbuild]::Add($(Field3Value), 9000))</Field3Value>
Steve Dower65e4cb12014-11-22 12:54:57 -0800168
169 <!-- The name of the resulting pythonXY.dll (without the extension) -->
170 <PyDllName>python$(MajorVersionNumber)$(MinorVersionNumber)$(PyDebugExt)</PyDllName>
Steve Dower03a144b2014-12-15 20:45:23 -0800171
172 <!-- The version and platform tag to include in .pyd filenames -->
Steve Dower940f6a82015-10-31 12:17:11 -0700173 <PydTag Condition="$(ArchName) == 'win32'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win32</PydTag>
174 <PydTag Condition="$(ArchName) == 'amd64'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win_amd64</PydTag>
Steve Dower25879522015-01-15 09:10:16 -0800175
176 <!-- The version number for sys.winver -->
Steve Dower940f6a82015-10-31 12:17:11 -0700177 <SysWinVer>$(MajorVersionNumber).$(MinorVersionNumber)$(PyArchExt)$(PyTestExt)</SysWinVer>
Steve Dower65e4cb12014-11-22 12:54:57 -0800178 </PropertyGroup>
179
180 <!-- Displays the calculated version info -->
181 <Target Name="ShowVersionInfo">
182 <Message Importance="high" Text="PythonVersionNumber: $(PythonVersionNumber)" />
183 <Message Importance="high" Text="PythonVersion: $(PythonVersion)" />
Steve Dower49437492015-07-08 20:18:44 -0700184 <Message Importance="high" Text="PythonVersionHex: 0x$([System.UInt32]::Parse($(PythonVersionHex)).ToString(`X08`))" />
Steve Dower65e4cb12014-11-22 12:54:57 -0800185 <Message Importance="high" Text="Field3Value: $(Field3Value)" />
Steve Dower940f6a82015-10-31 12:17:11 -0700186 <Message Importance="high" Text="SysWinVer: $(SysWinVer)" />
187 <Message Importance="high" Text="PyDllName: $(PyDllName)" />
Steve Dower65e4cb12014-11-22 12:54:57 -0800188 </Target>
189</Project>