blob: 245e5716bdcaa250b93552ac9c7ff3226ebb81fc [file] [log] [blame]
Zachary Ware47343722015-07-16 00:24:48 -05001<?xml version="1.0" encoding="utf-8"?>
2<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <PropertyGroup>
4 <Platform Condition="'$(Platform)' == ''">Win32</Platform>
5 <Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
6 <!--
7 Use only MSVC 9.0, unless explicitly overridden
8 -->
9 <PlatformToolset Condition="'$(PlatformToolset)' == ''">v90</PlatformToolset>
Zachary Ware62a23382015-07-28 00:00:47 -050010 <!--
11 Give a default for BasePlatformToolset as well, it's used by ICC and ignored otherwise
12 -->
13 <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(PlatformToolset)' != 'v90'">v90</BasePlatformToolset>
Zachary Ware47343722015-07-16 00:24:48 -050014 <!--
15 Convincing MSVC/MSBuild to prefer our platform names is too difficult,
16 so we define our own constant ArchName and use wherever we need it.
17 -->
18 <ArchName Condition="'$(ArchName)' == '' and $(Platform) == 'x64'">amd64</ArchName>
19 <ArchName Condition="'$(ArchName)' == ''">win32</ArchName>
20 <ArchName Condition="$(Configuration) == 'PGInstrument' or $(Configuration) == 'PGUpdate'">$(ArchName)-pgo</ArchName>
21
22 <!-- Root directory of the repository -->
23 <PySourcePath Condition="'$(PySourcePath)' == ''">$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)\..\))</PySourcePath>
24 <PySourcePath Condition="!HasTrailingSlash($(PySourcePath))">$(PySourcePath)\</PySourcePath>
25
26 <!-- Directory where build outputs are put -->
27 <BuildPath Condition="'$(BuildPath)' == ''">$(PySourcePath)PCBuild\</BuildPath>
28 <BuildPath Condition="'$(ArchName)' != 'win32'">$(BuildPath)\$(ArchName)\</BuildPath>
29 <BuildPath Condition="!HasTrailingSlash($(BuildPath))">$(BuildPath)\</BuildPath>
30
31 <!-- Directories of external projects. tcltk is handled in tcltk.props -->
32 <ExternalsDir>$([System.IO.Path]::GetFullPath(`$(PySourcePath)externals\`))</ExternalsDir>
33 <sqlite3Dir>$(ExternalsDir)sqlite-3.6.21\</sqlite3Dir>
34 <bz2Dir>$(ExternalsDir)bzip2-1.0.6\</bz2Dir>
35 <bsddbDir>$(ExternalsDir)db-4.7.25.0</bsddbDir>
Zachary Ware68773f32015-07-21 23:16:51 -050036 <opensslDir>$(ExternalsDir)openssl-1.0.2d\</opensslDir>
Zachary Ware47343722015-07-16 00:24:48 -050037 <nasmDir>$(ExternalsDir)\nasm-2.11.06\</nasmDir>
38
39 <!-- Suffix for all binaries when building for debug -->
40 <PyDebugExt Condition="'$(PyDebugExt)' == '' and $(Configuration) == 'Debug'">_d</PyDebugExt>
41
42 <!-- Full path of the resulting python.exe binary -->
43 <PythonExe Condition="'$(PythonExe)' == ''">$(BuildPath)python$(PyDebugExt).exe</PythonExe>
44
45 <!--
46 Read version information from Include\patchlevel.h. The following properties are set:
47
48 MajorVersionNumber - the '3' in '3.5.2a1'
49 MinorVersionNumber - the '5' in '3.5.2a1'
50 MicroVersionNumber - the '2' in '3.5.2a1'
51 ReleaseSerial - the '1' in '3.5.2a1'
52 ReleaseLevelName - the 'a1' in '3.5.2a1'
53 PythonVersionNumber - '3.5.2' for '3.5.2a1'
54 PythonVersion - '3.5.2a1'
55 PythonVersionHex - 0x030502a1 for '3.5.2a1'
56 ReleaseLevelNumber - 10 for alpha, 11 for beta, 12 for RC (gamma), and 15 for final
57 Field3Value - 2101 for '3.5.2a1' (== 1000*2 + 10*10 ('a') + 1)
58 -->
59 <_PatchLevelContent>$([System.IO.File]::ReadAllText(`$(PySourcePath)Include\patchlevel.h`))</_PatchLevelContent>
60 <MajorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MAJOR_VERSION\s+(\d+)`).Groups[1].Value)</MajorVersionNumber>
61 <MinorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MINOR_VERSION\s+(\d+)`).Groups[1].Value)</MinorVersionNumber>
62 <MicroVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MICRO_VERSION\s+(\d+)`).Groups[1].Value)</MicroVersionNumber>
63 <_ReleaseLevel>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_LEVEL\s+PY_RELEASE_LEVEL_(\w+)`).Groups[1].Value)</_ReleaseLevel>
64 <ReleaseSerial>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_SERIAL\s+(\d+)`).Groups[1].Value)</ReleaseSerial>
65 <ReleaseLevelNumber>15</ReleaseLevelNumber>
66 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'ALPHA'">10</ReleaseLevelNumber>
67 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'BETA'">11</ReleaseLevelNumber>
68 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'GAMMA'">12</ReleaseLevelNumber>
69 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'ALPHA'">a$(ReleaseSerial)</ReleaseLevelName>
70 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'BETA'">b$(ReleaseSerial)</ReleaseLevelName>
71 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'GAMMA'">rc$(ReleaseSerial)</ReleaseLevelName>
72
73 <PythonVersionNumber>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)</PythonVersionNumber>
74 <PythonVersion>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)$(ReleaseLevelName)</PythonVersion>
75 <PythonVersionHex>$([msbuild]::BitwiseOr(
76 $([msbuild]::Multiply($(MajorVersionNumber), 16777216)),
77 $([msbuild]::BitwiseOr(
78 $([msbuild]::Multiply($(MinorVersionNumber), 65536)),
79 $([msbuild]::BitwiseOr(
80 $([msbuild]::Multiply($(MicroVersionNumber), 256)),
81 $([msbuild]::BitwiseOr(
82 $([msbuild]::Multiply($(ReleaseLevelNumber), 16)),
83 $(ReleaseSerial)
84 ))
85 ))
86 ))
87 ))</PythonVersionHex>
88 <Field3Value>$([msbuild]::Add(
89 $(ReleaseSerial),
90 $([msbuild]::Add(
91 $([msbuild]::Multiply($(ReleaseLevelNumber), 10)),
92 $([msbuild]::Multiply($(MicroVersionNumber), 1000))
93 ))
94 ))</Field3Value>
95
96 <!-- The name of the resulting pythonXY.dll (without the extension) -->
97 <PyDllName>python$(MajorVersionNumber)$(MinorVersionNumber)$(PyDebugExt)</PyDllName>
98
99 <!-- The version and platform tag to include in .pyd filenames -->
100 <PydTag Condition="$(Platform) == 'Win32' or $(Platform) == 'x86'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win32</PydTag>
101 <PydTag Condition="$(Platform) == 'x64'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win_amd64</PydTag>
102
103 <!-- The version number for sys.winver -->
104 <SysWinVer>$(MajorVersionNumber).$(MinorVersionNumber)</SysWinVer>
105 <SysWinVer Condition="$(Platform) == 'Win32' or $(Platform) == 'x86'">$(SysWinVer)-32</SysWinVer>
106 </PropertyGroup>
107
108 <!-- Displays the calculated version info -->
109 <Target Name="ShowVersionInfo">
110 <Message Importance="high" Text="PythonVersionNumber: $(PythonVersionNumber)" />
111 <Message Importance="high" Text="PythonVersion: $(PythonVersion)" />
112 <Message Importance="high" Text="$([System.String]::Format(`PythonVersionHex: 0x{0:x}`, $([System.UInt32]::Parse($(PythonVersionHex)))))" />
113 <Message Importance="high" Text="Field3Value: $(Field3Value)" />
114 </Target>
115</Project>