blob: 07acfaba7b2b75b94ddc63ae70b328779f46d677 [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>
28 <ArchName Condition="$(Configuration) == 'PGInstrument' or $(Configuration) == 'PGUpdate'">$(ArchName)-pgo</ArchName>
29
30 <!-- Root directory of the repository -->
31 <PySourcePath Condition="'$(PySourcePath)' == ''">$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)\..\))</PySourcePath>
32 <PySourcePath Condition="!HasTrailingSlash($(PySourcePath))">$(PySourcePath)\</PySourcePath>
33
34 <!-- Directory where build outputs are put -->
Steve Dowerde9fb282015-07-27 14:56:58 -070035 <BuildPath Condition="'$(PyBuildPath)' == ''">$(PySourcePath)PCBuild\$(ArchName)\</BuildPath>
36 <BuildPath Condition="'$(PyBuildPath)' != ''">$(PyBuildPath)</BuildPath>
Steve Dower65e4cb12014-11-22 12:54:57 -080037 <BuildPath Condition="!HasTrailingSlash($(BuildPath))">$(BuildPath)\</BuildPath>
38
39 <!-- Directories of external projects. tcltk is handled in tcltk.props -->
40 <ExternalsDir>$([System.IO.Path]::GetFullPath(`$(PySourcePath)externals\`))</ExternalsDir>
Steve Dower4e167ca2015-07-28 11:09:40 -070041 <sqlite3Dir>$(ExternalsDir)sqlite-3.8.11.0\</sqlite3Dir>
Steve Dower65e4cb12014-11-22 12:54:57 -080042 <bz2Dir>$(ExternalsDir)bzip2-1.0.6\</bz2Dir>
43 <lzmaDir>$(ExternalsDir)xz-5.0.5\</lzmaDir>
Steve Dower947f4112016-03-08 10:26:52 -080044 <opensslDir>$(ExternalsDir)openssl-1.0.2g\</opensslDir>
Zachary Ware6fe57ad2016-02-22 04:08:51 -060045 <opensslIncludeDir>$(opensslDir)include32</opensslIncludeDir>
46 <opensslIncludeDir Condition="'$(ArchName)' == 'amd64'">$(opensslDir)include64</opensslIncludeDir>
Steve Dower65e4cb12014-11-22 12:54:57 -080047 <nasmDir>$(ExternalsDir)\nasm-2.11.06\</nasmDir>
48
49 <!-- Suffix for all binaries when building for debug -->
50 <PyDebugExt Condition="'$(PyDebugExt)' == '' and $(Configuration) == 'Debug'">_d</PyDebugExt>
51
Steve Dower940f6a82015-10-31 12:17:11 -070052 <!-- Suffix for versions/keys when building with test markers -->
53 <PyTestExt Condition="$(UseTestMarker) == 'true'">-test</PyTestExt>
54
55 <!-- Suffix for versions/keys when building for particular platforms -->
56 <PyArchExt Condition="'$(ArchName)' == 'win32'">-32</PyArchExt>
57
Steve Dower65e4cb12014-11-22 12:54:57 -080058 <!-- Full path of the resulting python.exe binary -->
59 <PythonExe Condition="'$(PythonExe)' == ''">$(BuildPath)python$(PyDebugExt).exe</PythonExe>
Steve Dower49437492015-07-08 20:18:44 -070060 </PropertyGroup>
61
62 <PropertyGroup Condition="'$(OverrideVersion)' == ''">
Steve Dower65e4cb12014-11-22 12:54:57 -080063 <!--
64 Read version information from Include\patchlevel.h. The following properties are set:
65
66 MajorVersionNumber - the '3' in '3.5.2a1'
67 MinorVersionNumber - the '5' in '3.5.2a1'
68 MicroVersionNumber - the '2' in '3.5.2a1'
69 ReleaseSerial - the '1' in '3.5.2a1'
70 ReleaseLevelName - the 'a1' in '3.5.2a1'
71 PythonVersionNumber - '3.5.2' for '3.5.2a1'
72 PythonVersion - '3.5.2a1'
73 PythonVersionHex - 0x030502a1 for '3.5.2a1'
74 ReleaseLevelNumber - 10 for alpha, 11 for beta, 12 for RC (gamma), and 15 for final
75 Field3Value - 2101 for '3.5.2a1' (== 1000*2 + 10*10 ('a') + 1)
76 -->
77 <_PatchLevelContent>$([System.IO.File]::ReadAllText(`$(PySourcePath)Include\patchlevel.h`))</_PatchLevelContent>
78 <MajorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MAJOR_VERSION\s+(\d+)`).Groups[1].Value)</MajorVersionNumber>
79 <MinorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MINOR_VERSION\s+(\d+)`).Groups[1].Value)</MinorVersionNumber>
80 <MicroVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MICRO_VERSION\s+(\d+)`).Groups[1].Value)</MicroVersionNumber>
81 <_ReleaseLevel>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_LEVEL\s+PY_RELEASE_LEVEL_(\w+)`).Groups[1].Value)</_ReleaseLevel>
82 <ReleaseSerial>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_SERIAL\s+(\d+)`).Groups[1].Value)</ReleaseSerial>
83 <ReleaseLevelNumber>15</ReleaseLevelNumber>
84 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'ALPHA'">10</ReleaseLevelNumber>
85 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'BETA'">11</ReleaseLevelNumber>
86 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'GAMMA'">12</ReleaseLevelNumber>
87 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'ALPHA'">a$(ReleaseSerial)</ReleaseLevelName>
88 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'BETA'">b$(ReleaseSerial)</ReleaseLevelName>
89 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'GAMMA'">rc$(ReleaseSerial)</ReleaseLevelName>
Steve Dower49437492015-07-08 20:18:44 -070090 </PropertyGroup>
91
92 <PropertyGroup Condition="'$(OverrideVersion)' != ''">
93 <!--
94 Override the version number when building by specifying OverrideVersion.
95 For example:
Steve Dower65e4cb12014-11-22 12:54:57 -080096
Steve Dower49437492015-07-08 20:18:44 -070097 PCBuild\build.bat "/p:OverrideVersion=3.5.2a1"
98
99 Use the -V option to check your version is valid:
100
101 PCBuild\build.bat -V "/p:OverrideVersion=3.5.2a1"
102 PythonVersionNumber: 3.5.2
103 PythonVersion: 3.5.2a1
104 PythonVersionHex: 0x030502A1
105 Field3Value: 2101
106
107 Note that this only affects the version numbers embedded in resources and
108 installers, but not sys.version.
109 -->
110 <MajorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[1].Value)</MajorVersionNumber>
111 <MinorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[2].Value)</MinorVersionNumber>
112 <MicroVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[3].Value)</MicroVersionNumber>
113 <ReleaseLevelName>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[4].Value)</ReleaseLevelName>
114 <_ReleaseLevel>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[5].Value)</_ReleaseLevel>
115 <ReleaseSerial>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[6].Value)</ReleaseSerial>
116 <ReleaseSerial Condition="'$(ReleaseSerial)' == ''">0</ReleaseSerial>
117 <ReleaseLevelNumber>15</ReleaseLevelNumber>
118 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'a'">10</ReleaseLevelNumber>
119 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'b'">11</ReleaseLevelNumber>
120 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'rc'">12</ReleaseLevelNumber>
121 </PropertyGroup>
122
123 <PropertyGroup>
Steve Dower65e4cb12014-11-22 12:54:57 -0800124 <PythonVersionNumber>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)</PythonVersionNumber>
125 <PythonVersion>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)$(ReleaseLevelName)</PythonVersion>
126 <PythonVersionHex>$([msbuild]::BitwiseOr(
127 $([msbuild]::Multiply($(MajorVersionNumber), 16777216)),
128 $([msbuild]::BitwiseOr(
129 $([msbuild]::Multiply($(MinorVersionNumber), 65536)),
130 $([msbuild]::BitwiseOr(
131 $([msbuild]::Multiply($(MicroVersionNumber), 256)),
132 $([msbuild]::BitwiseOr(
133 $([msbuild]::Multiply($(ReleaseLevelNumber), 16)),
134 $(ReleaseSerial)
135 ))
136 ))
137 ))
138 ))</PythonVersionHex>
139 <Field3Value>$([msbuild]::Add(
140 $(ReleaseSerial),
141 $([msbuild]::Add(
142 $([msbuild]::Multiply($(ReleaseLevelNumber), 10)),
143 $([msbuild]::Multiply($(MicroVersionNumber), 1000))
144 ))
145 ))</Field3Value>
Steve Dower940f6a82015-10-31 12:17:11 -0700146 <Field3Value Condition="$(UseTestMarker) == 'true'">$([msbuild]::Add($(Field3Value), 9000))</Field3Value>
Steve Dower65e4cb12014-11-22 12:54:57 -0800147
148 <!-- The name of the resulting pythonXY.dll (without the extension) -->
149 <PyDllName>python$(MajorVersionNumber)$(MinorVersionNumber)$(PyDebugExt)</PyDllName>
Steve Dower03a144b2014-12-15 20:45:23 -0800150
151 <!-- The version and platform tag to include in .pyd filenames -->
Steve Dower940f6a82015-10-31 12:17:11 -0700152 <PydTag Condition="$(ArchName) == 'win32'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win32</PydTag>
153 <PydTag Condition="$(ArchName) == 'amd64'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win_amd64</PydTag>
Steve Dower25879522015-01-15 09:10:16 -0800154
155 <!-- The version number for sys.winver -->
Steve Dower940f6a82015-10-31 12:17:11 -0700156 <SysWinVer>$(MajorVersionNumber).$(MinorVersionNumber)$(PyArchExt)$(PyTestExt)</SysWinVer>
Steve Dower65e4cb12014-11-22 12:54:57 -0800157 </PropertyGroup>
158
159 <!-- Displays the calculated version info -->
160 <Target Name="ShowVersionInfo">
161 <Message Importance="high" Text="PythonVersionNumber: $(PythonVersionNumber)" />
162 <Message Importance="high" Text="PythonVersion: $(PythonVersion)" />
Steve Dower49437492015-07-08 20:18:44 -0700163 <Message Importance="high" Text="PythonVersionHex: 0x$([System.UInt32]::Parse($(PythonVersionHex)).ToString(`X08`))" />
Steve Dower65e4cb12014-11-22 12:54:57 -0800164 <Message Importance="high" Text="Field3Value: $(Field3Value)" />
Steve Dower940f6a82015-10-31 12:17:11 -0700165 <Message Importance="high" Text="SysWinVer: $(SysWinVer)" />
166 <Message Importance="high" Text="PyDllName: $(PyDllName)" />
Steve Dower65e4cb12014-11-22 12:54:57 -0800167 </Target>
168</Project>