You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
7.0 KiB

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