blob: 51eceb8f5947d587460d3624f70f3614f2367bd6 [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.
10 -->
11 <PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(VCTargetsPath14)' != ''">v140</PlatformToolset>
12 <PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(VCTargetsPath12)' != ''">v120</PlatformToolset>
13 <PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(VCTargetsPath11)' != ''">v110</PlatformToolset>
14 <PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(VCTargetsPath10)' != ''">v100</PlatformToolset>
15
16 <!--
17 Convincing MSVC/MSBuild to prefer our platform names is too difficult,
18 so we define our own constant ArchName and use wherever we need it.
19 -->
20 <ArchName Condition="'$(ArchName)' == '' and $(Platform) == 'x64'">amd64</ArchName>
21 <ArchName Condition="'$(ArchName)' == ''">win32</ArchName>
22 <ArchName Condition="$(Configuration) == 'PGInstrument' or $(Configuration) == 'PGUpdate'">$(ArchName)-pgo</ArchName>
23
24 <!-- Root directory of the repository -->
25 <PySourcePath Condition="'$(PySourcePath)' == ''">$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)\..\))</PySourcePath>
26 <PySourcePath Condition="!HasTrailingSlash($(PySourcePath))">$(PySourcePath)\</PySourcePath>
27
28 <!-- Directory where build outputs are put -->
29 <BuildPath Condition="'$(BuildPath)' == ''">$(PySourcePath)PCBuild\$(ArchName)\</BuildPath>
30 <BuildPath Condition="!HasTrailingSlash($(BuildPath))">$(BuildPath)\</BuildPath>
31
32 <!-- Directories of external projects. tcltk is handled in tcltk.props -->
33 <ExternalsDir>$([System.IO.Path]::GetFullPath(`$(PySourcePath)externals\`))</ExternalsDir>
34 <sqlite3Dir>$(ExternalsDir)sqlite-3.8.3.1\</sqlite3Dir>
35 <bz2Dir>$(ExternalsDir)bzip2-1.0.6\</bz2Dir>
36 <lzmaDir>$(ExternalsDir)xz-5.0.5\</lzmaDir>
Steve Dowera5e1dbe2015-01-31 12:20:40 -080037 <opensslDir>$(ExternalsDir)openssl-1.0.1l\</opensslDir>
Steve Dower65e4cb12014-11-22 12:54:57 -080038 <nasmDir>$(ExternalsDir)\nasm-2.11.06\</nasmDir>
39
40 <!-- Suffix for all binaries when building for debug -->
41 <PyDebugExt Condition="'$(PyDebugExt)' == '' and $(Configuration) == 'Debug'">_d</PyDebugExt>
42
43 <!-- Full path of the resulting python.exe binary -->
44 <PythonExe Condition="'$(PythonExe)' == ''">$(BuildPath)python$(PyDebugExt).exe</PythonExe>
45
46 <!--
47 Read version information from Include\patchlevel.h. The following properties are set:
48
49 MajorVersionNumber - the '3' in '3.5.2a1'
50 MinorVersionNumber - the '5' in '3.5.2a1'
51 MicroVersionNumber - the '2' in '3.5.2a1'
52 ReleaseSerial - the '1' in '3.5.2a1'
53 ReleaseLevelName - the 'a1' in '3.5.2a1'
54 PythonVersionNumber - '3.5.2' for '3.5.2a1'
55 PythonVersion - '3.5.2a1'
56 PythonVersionHex - 0x030502a1 for '3.5.2a1'
57 ReleaseLevelNumber - 10 for alpha, 11 for beta, 12 for RC (gamma), and 15 for final
58 Field3Value - 2101 for '3.5.2a1' (== 1000*2 + 10*10 ('a') + 1)
59 -->
60 <_PatchLevelContent>$([System.IO.File]::ReadAllText(`$(PySourcePath)Include\patchlevel.h`))</_PatchLevelContent>
61 <MajorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MAJOR_VERSION\s+(\d+)`).Groups[1].Value)</MajorVersionNumber>
62 <MinorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MINOR_VERSION\s+(\d+)`).Groups[1].Value)</MinorVersionNumber>
63 <MicroVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MICRO_VERSION\s+(\d+)`).Groups[1].Value)</MicroVersionNumber>
64 <_ReleaseLevel>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_LEVEL\s+PY_RELEASE_LEVEL_(\w+)`).Groups[1].Value)</_ReleaseLevel>
65 <ReleaseSerial>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_SERIAL\s+(\d+)`).Groups[1].Value)</ReleaseSerial>
66 <ReleaseLevelNumber>15</ReleaseLevelNumber>
67 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'ALPHA'">10</ReleaseLevelNumber>
68 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'BETA'">11</ReleaseLevelNumber>
69 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'GAMMA'">12</ReleaseLevelNumber>
70 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'ALPHA'">a$(ReleaseSerial)</ReleaseLevelName>
71 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'BETA'">b$(ReleaseSerial)</ReleaseLevelName>
72 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'GAMMA'">rc$(ReleaseSerial)</ReleaseLevelName>
73
74 <PythonVersionNumber>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)</PythonVersionNumber>
75 <PythonVersion>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)$(ReleaseLevelName)</PythonVersion>
76 <PythonVersionHex>$([msbuild]::BitwiseOr(
77 $([msbuild]::Multiply($(MajorVersionNumber), 16777216)),
78 $([msbuild]::BitwiseOr(
79 $([msbuild]::Multiply($(MinorVersionNumber), 65536)),
80 $([msbuild]::BitwiseOr(
81 $([msbuild]::Multiply($(MicroVersionNumber), 256)),
82 $([msbuild]::BitwiseOr(
83 $([msbuild]::Multiply($(ReleaseLevelNumber), 16)),
84 $(ReleaseSerial)
85 ))
86 ))
87 ))
88 ))</PythonVersionHex>
89 <Field3Value>$([msbuild]::Add(
90 $(ReleaseSerial),
91 $([msbuild]::Add(
92 $([msbuild]::Multiply($(ReleaseLevelNumber), 10)),
93 $([msbuild]::Multiply($(MicroVersionNumber), 1000))
94 ))
95 ))</Field3Value>
96
97 <!-- The name of the resulting pythonXY.dll (without the extension) -->
98 <PyDllName>python$(MajorVersionNumber)$(MinorVersionNumber)$(PyDebugExt)</PyDllName>
Steve Dower03a144b2014-12-15 20:45:23 -080099
100 <!-- The version and platform tag to include in .pyd filenames -->
Steve Dowerbb240872015-02-05 22:08:48 -0800101 <PydTag Condition="$(Platform) == 'Win32' or $(Platform) == 'x86'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win32</PydTag>
Steve Dower03a144b2014-12-15 20:45:23 -0800102 <PydTag Condition="$(Platform) == 'x64'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win_amd64</PydTag>
Steve Dower25879522015-01-15 09:10:16 -0800103
104 <!-- The version number for sys.winver -->
105 <SysWinVer>$(MajorVersionNumber).$(MinorVersionNumber)</SysWinVer>
Steve Dowerbb240872015-02-05 22:08:48 -0800106 <SysWinVer Condition="$(Platform) == 'Win32' or $(Platform) == 'x86'">$(SysWinVer)-32</SysWinVer>
Steve Dower65e4cb12014-11-22 12:54:57 -0800107 </PropertyGroup>
108
109 <!-- Displays the calculated version info -->
110 <Target Name="ShowVersionInfo">
111 <Message Importance="high" Text="PythonVersionNumber: $(PythonVersionNumber)" />
112 <Message Importance="high" Text="PythonVersion: $(PythonVersion)" />
113 <Message Importance="high" Text="$([System.String]::Format(`PythonVersionHex: 0x{0:x}`, $([System.UInt32]::Parse($(PythonVersionHex)))))" />
114 <Message Importance="high" Text="Field3Value: $(Field3Value)" />
115 </Target>
116</Project>