Home | History | Annotate | Download | only in PCbuild
      1 <?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>
     10     <!--
     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>
     14     <ICCBuild>false</ICCBuild>
     15     <ICCBuild Condition="$(PlatformToolset.StartsWith('Intel C++ Compiler'))">true</ICCBuild>
     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\</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.8.11.0\</sqlite3Dir>
     36     <bz2Dir>$(ExternalsDir)bzip2-1.0.6\</bz2Dir>
     37     <bsddbDir>$(ExternalsDir)db-4.7.25.0</bsddbDir>
     38     <opensslDir>$(ExternalsDir)openssl-1.0.2j\</opensslDir>
     39     <opensslIncludeDir>$(opensslDir)include32</opensslIncludeDir>
     40     <opensslIncludeDir Condition="'$(ArchName)' == 'amd64'">$(opensslDir)include64</opensslIncludeDir>
     41     <nasmDir>$(ExternalsDir)\nasm-2.11.06\</nasmDir>
     42 
     43     <!-- Suffix for all binaries when building for debug -->
     44     <PyDebugExt Condition="'$(PyDebugExt)' == '' and $(Configuration) == 'Debug'">_d</PyDebugExt>
     45 
     46     <!-- Full path of the resulting python.exe binary -->
     47     <PythonExe Condition="'$(PythonExe)' == ''">$(BuildPath)python$(PyDebugExt).exe</PythonExe>
     48 
     49     <!--
     50     Read version information from Include\patchlevel.h. The following properties are set:
     51 
     52         MajorVersionNumber  -   the '3' in '3.5.2a1'
     53         MinorVersionNumber  -   the '5' in '3.5.2a1'
     54         MicroVersionNumber  -   the '2' in '3.5.2a1'
     55         ReleaseSerial       -   the '1' in '3.5.2a1'
     56         ReleaseLevelName    -   the 'a1' in '3.5.2a1'
     57         PythonVersionNumber -   '3.5.2' for '3.5.2a1'
     58         PythonVersion       -   '3.5.2a1'
     59         PythonVersionHex    -   0x030502a1 for '3.5.2a1'
     60         ReleaseLevelNumber  -   10 for alpha, 11 for beta, 12 for RC (gamma), and 15 for final
     61         Field3Value         -   2101 for '3.5.2a1' (== 1000*2 + 10*10 ('a') + 1)
     62     -->
     63     <_PatchLevelContent>$([System.IO.File]::ReadAllText(`$(PySourcePath)Include\patchlevel.h`))</_PatchLevelContent>
     64     <MajorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MAJOR_VERSION\s+(\d+)`).Groups[1].Value)</MajorVersionNumber>
     65     <MinorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MINOR_VERSION\s+(\d+)`).Groups[1].Value)</MinorVersionNumber>
     66     <MicroVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MICRO_VERSION\s+(\d+)`).Groups[1].Value)</MicroVersionNumber>
     67     <_ReleaseLevel>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_LEVEL\s+PY_RELEASE_LEVEL_(\w+)`).Groups[1].Value)</_ReleaseLevel>
     68     <ReleaseSerial>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_SERIAL\s+(\d+)`).Groups[1].Value)</ReleaseSerial>
     69     <ReleaseLevelNumber>15</ReleaseLevelNumber>
     70     <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'ALPHA'">10</ReleaseLevelNumber>
     71     <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'BETA'">11</ReleaseLevelNumber>
     72     <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'GAMMA'">12</ReleaseLevelNumber>
     73     <ReleaseLevelName Condition="$(_ReleaseLevel) == 'ALPHA'">a$(ReleaseSerial)</ReleaseLevelName>
     74     <ReleaseLevelName Condition="$(_ReleaseLevel) == 'BETA'">b$(ReleaseSerial)</ReleaseLevelName>
     75     <ReleaseLevelName Condition="$(_ReleaseLevel) == 'GAMMA'">rc$(ReleaseSerial)</ReleaseLevelName>
     76 
     77     <PythonVersionNumber>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)</PythonVersionNumber>
     78     <PythonVersion>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)$(ReleaseLevelName)</PythonVersion>
     79     <PythonVersionHex>$([msbuild]::BitwiseOr(
     80         $([msbuild]::Multiply($(MajorVersionNumber), 16777216)),
     81         $([msbuild]::BitwiseOr(
     82             $([msbuild]::Multiply($(MinorVersionNumber), 65536)),
     83             $([msbuild]::BitwiseOr(
     84                 $([msbuild]::Multiply($(MicroVersionNumber), 256)),
     85                 $([msbuild]::BitwiseOr(
     86                     $([msbuild]::Multiply($(ReleaseLevelNumber), 16)),
     87                     $(ReleaseSerial)
     88                 ))
     89             ))
     90         ))
     91     ))</PythonVersionHex>
     92     <Field3Value>$([msbuild]::Add(
     93         $(ReleaseSerial),
     94         $([msbuild]::Add(
     95             $([msbuild]::Multiply($(ReleaseLevelNumber), 10)),
     96             $([msbuild]::Multiply($(MicroVersionNumber), 1000))
     97         ))
     98     ))</Field3Value>
     99 
    100     <!-- The name of the resulting pythonXY.dll (without the extension) -->
    101     <PyDllName>python$(MajorVersionNumber)$(MinorVersionNumber)$(PyDebugExt)</PyDllName>
    102 
    103     <!-- The version and platform tag to include in .pyd filenames -->
    104     <PydTag Condition="$(Platform) == 'Win32' or $(Platform) == 'x86'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win32</PydTag>
    105     <PydTag Condition="$(Platform) == 'x64'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win_amd64</PydTag>
    106 
    107     <!-- The version number for sys.winver -->
    108     <SysWinVer>$(MajorVersionNumber).$(MinorVersionNumber)</SysWinVer>
    109   </PropertyGroup>
    110 
    111   <!-- Displays the calculated version info -->
    112   <Target Name="ShowVersionInfo">
    113     <Message Importance="high" Text="PythonVersionNumber: $(PythonVersionNumber)" />
    114     <Message Importance="high" Text="PythonVersion:       $(PythonVersion)" />
    115     <Message Importance="high" Text="$([System.String]::Format(`PythonVersionHex:    0x{0:x}`, $([System.UInt32]::Parse($(PythonVersionHex)))))" />
    116     <Message Importance="high" Text="Field3Value:         $(Field3Value)" />
    117   </Target>
    118 </Project>
    119