blob: 08ddaf12f05a33515e44d6404e30f4bd734539fe [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 Waredc63e9c2016-01-29 19:06:00 -060014 <ICCBuild>false</ICCBuild>
15 <ICCBuild Condition="$(PlatformToolset.StartsWith('Intel C++ Compiler'))">true</ICCBuild>
Zachary Ware47343722015-07-16 00:24:48 -050016 <!--
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\</BuildPath>
30 <BuildPath Condition="'$(ArchName)' != 'win32'">$(BuildPath)\$(ArchName)\</BuildPath>
31 <BuildPath Condition="!HasTrailingSlash($(BuildPath))">$(BuildPath)\</BuildPath>
32
33 <!-- Directories of external projects. tcltk is handled in tcltk.props -->
34 <ExternalsDir>$([System.IO.Path]::GetFullPath(`$(PySourcePath)externals\`))</ExternalsDir>
35 <sqlite3Dir>$(ExternalsDir)sqlite-3.6.21\</sqlite3Dir>
36 <bz2Dir>$(ExternalsDir)bzip2-1.0.6\</bz2Dir>
37 <bsddbDir>$(ExternalsDir)db-4.7.25.0</bsddbDir>
Zachary Ware68773f32015-07-21 23:16:51 -050038 <opensslDir>$(ExternalsDir)openssl-1.0.2d\</opensslDir>
Zachary Ware47343722015-07-16 00:24:48 -050039 <nasmDir>$(ExternalsDir)\nasm-2.11.06\</nasmDir>
40
41 <!-- Suffix for all binaries when building for debug -->
42 <PyDebugExt Condition="'$(PyDebugExt)' == '' and $(Configuration) == 'Debug'">_d</PyDebugExt>
43
44 <!-- Full path of the resulting python.exe binary -->
45 <PythonExe Condition="'$(PythonExe)' == ''">$(BuildPath)python$(PyDebugExt).exe</PythonExe>
46
47 <!--
48 Read version information from Include\patchlevel.h. The following properties are set:
49
50 MajorVersionNumber - the '3' in '3.5.2a1'
51 MinorVersionNumber - the '5' in '3.5.2a1'
52 MicroVersionNumber - the '2' in '3.5.2a1'
53 ReleaseSerial - the '1' in '3.5.2a1'
54 ReleaseLevelName - the 'a1' in '3.5.2a1'
55 PythonVersionNumber - '3.5.2' for '3.5.2a1'
56 PythonVersion - '3.5.2a1'
57 PythonVersionHex - 0x030502a1 for '3.5.2a1'
58 ReleaseLevelNumber - 10 for alpha, 11 for beta, 12 for RC (gamma), and 15 for final
59 Field3Value - 2101 for '3.5.2a1' (== 1000*2 + 10*10 ('a') + 1)
60 -->
61 <_PatchLevelContent>$([System.IO.File]::ReadAllText(`$(PySourcePath)Include\patchlevel.h`))</_PatchLevelContent>
62 <MajorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MAJOR_VERSION\s+(\d+)`).Groups[1].Value)</MajorVersionNumber>
63 <MinorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MINOR_VERSION\s+(\d+)`).Groups[1].Value)</MinorVersionNumber>
64 <MicroVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MICRO_VERSION\s+(\d+)`).Groups[1].Value)</MicroVersionNumber>
65 <_ReleaseLevel>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_LEVEL\s+PY_RELEASE_LEVEL_(\w+)`).Groups[1].Value)</_ReleaseLevel>
66 <ReleaseSerial>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_SERIAL\s+(\d+)`).Groups[1].Value)</ReleaseSerial>
67 <ReleaseLevelNumber>15</ReleaseLevelNumber>
68 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'ALPHA'">10</ReleaseLevelNumber>
69 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'BETA'">11</ReleaseLevelNumber>
70 <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'GAMMA'">12</ReleaseLevelNumber>
71 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'ALPHA'">a$(ReleaseSerial)</ReleaseLevelName>
72 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'BETA'">b$(ReleaseSerial)</ReleaseLevelName>
73 <ReleaseLevelName Condition="$(_ReleaseLevel) == 'GAMMA'">rc$(ReleaseSerial)</ReleaseLevelName>
74
75 <PythonVersionNumber>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)</PythonVersionNumber>
76 <PythonVersion>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)$(ReleaseLevelName)</PythonVersion>
77 <PythonVersionHex>$([msbuild]::BitwiseOr(
78 $([msbuild]::Multiply($(MajorVersionNumber), 16777216)),
79 $([msbuild]::BitwiseOr(
80 $([msbuild]::Multiply($(MinorVersionNumber), 65536)),
81 $([msbuild]::BitwiseOr(
82 $([msbuild]::Multiply($(MicroVersionNumber), 256)),
83 $([msbuild]::BitwiseOr(
84 $([msbuild]::Multiply($(ReleaseLevelNumber), 16)),
85 $(ReleaseSerial)
86 ))
87 ))
88 ))
89 ))</PythonVersionHex>
90 <Field3Value>$([msbuild]::Add(
91 $(ReleaseSerial),
92 $([msbuild]::Add(
93 $([msbuild]::Multiply($(ReleaseLevelNumber), 10)),
94 $([msbuild]::Multiply($(MicroVersionNumber), 1000))
95 ))
96 ))</Field3Value>
97
98 <!-- The name of the resulting pythonXY.dll (without the extension) -->
99 <PyDllName>python$(MajorVersionNumber)$(MinorVersionNumber)$(PyDebugExt)</PyDllName>
100
101 <!-- The version and platform tag to include in .pyd filenames -->
102 <PydTag Condition="$(Platform) == 'Win32' or $(Platform) == 'x86'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win32</PydTag>
103 <PydTag Condition="$(Platform) == 'x64'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win_amd64</PydTag>
104
105 <!-- The version number for sys.winver -->
106 <SysWinVer>$(MajorVersionNumber).$(MinorVersionNumber)</SysWinVer>
Zachary Ware47343722015-07-16 00:24:48 -0500107 </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>