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.

168 lines
10 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. We set BasePlatformToolset for ICC's benefit, it's otherwise ignored.
  11. -->
  12. <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VCTargetsPath14)' != ''">v140</BasePlatformToolset>
  13. <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VCTargetsPath12)' != ''">v120</BasePlatformToolset>
  14. <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VCTargetsPath11)' != ''">v110</BasePlatformToolset>
  15. <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VCTargetsPath10)' != ''">v100</BasePlatformToolset>
  16. <PlatformToolset Condition="'$(PlatformToolset)' == ''">$(BasePlatformToolset)</PlatformToolset>
  17. <ICCBuild>false</ICCBuild>
  18. <ICCBuild Condition="$(PlatformToolset.StartsWith(`Intel C++ Compiler`))">true</ICCBuild>
  19. <!--
  20. Convincing MSVC/MSBuild to prefer our platform names is too difficult,
  21. so we define our own constant ArchName and use wherever we need it.
  22. -->
  23. <ArchName Condition="'$(ArchName)' == '' and $(Platform) == 'x64'">amd64</ArchName>
  24. <ArchName Condition="'$(ArchName)' == ''">win32</ArchName>
  25. <ArchName Condition="$(Configuration) == 'PGInstrument' or $(Configuration) == 'PGUpdate'">$(ArchName)-pgo</ArchName>
  26. <!-- Root directory of the repository -->
  27. <PySourcePath Condition="'$(PySourcePath)' == ''">$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)\..\))</PySourcePath>
  28. <PySourcePath Condition="!HasTrailingSlash($(PySourcePath))">$(PySourcePath)\</PySourcePath>
  29. <!-- Directory where build outputs are put -->
  30. <BuildPath Condition="'$(PyBuildPath)' == ''">$(PySourcePath)PCBuild\$(ArchName)\</BuildPath>
  31. <BuildPath Condition="'$(PyBuildPath)' != ''">$(PyBuildPath)</BuildPath>
  32. <BuildPath Condition="!HasTrailingSlash($(BuildPath))">$(BuildPath)\</BuildPath>
  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. <lzmaDir>$(ExternalsDir)xz-5.0.5\</lzmaDir>
  38. <opensslDir>$(ExternalsDir)openssl-1.0.2f\</opensslDir>
  39. <opensslIncludeDir>$(opensslDir)include32</opensslIncludeDir>
  40. <opensslIncludeDir Condition="'$(ArchName)' == 'amd64'">$(opensslDir)include64</opensslIncludeDir>
  41. <nasmDir>$(ExternalsDir)\nasm-2.11.06\</nasmDir>
  42. <!-- Suffix for all binaries when building for debug -->
  43. <PyDebugExt Condition="'$(PyDebugExt)' == '' and $(Configuration) == 'Debug'">_d</PyDebugExt>
  44. <!-- Suffix for versions/keys when building with test markers -->
  45. <PyTestExt Condition="$(UseTestMarker) == 'true'">-test</PyTestExt>
  46. <!-- Suffix for versions/keys when building for particular platforms -->
  47. <PyArchExt Condition="'$(ArchName)' == 'win32'">-32</PyArchExt>
  48. <!-- Full path of the resulting python.exe binary -->
  49. <PythonExe Condition="'$(PythonExe)' == ''">$(BuildPath)python$(PyDebugExt).exe</PythonExe>
  50. </PropertyGroup>
  51. <PropertyGroup Condition="'$(OverrideVersion)' == ''">
  52. <!--
  53. Read version information from Include\patchlevel.h. The following properties are set:
  54. MajorVersionNumber - the '3' in '3.5.2a1'
  55. MinorVersionNumber - the '5' in '3.5.2a1'
  56. MicroVersionNumber - the '2' in '3.5.2a1'
  57. ReleaseSerial - the '1' in '3.5.2a1'
  58. ReleaseLevelName - the 'a1' in '3.5.2a1'
  59. PythonVersionNumber - '3.5.2' for '3.5.2a1'
  60. PythonVersion - '3.5.2a1'
  61. PythonVersionHex - 0x030502a1 for '3.5.2a1'
  62. ReleaseLevelNumber - 10 for alpha, 11 for beta, 12 for RC (gamma), and 15 for final
  63. Field3Value - 2101 for '3.5.2a1' (== 1000*2 + 10*10 ('a') + 1)
  64. -->
  65. <_PatchLevelContent>$([System.IO.File]::ReadAllText(`$(PySourcePath)Include\patchlevel.h`))</_PatchLevelContent>
  66. <MajorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MAJOR_VERSION\s+(\d+)`).Groups[1].Value)</MajorVersionNumber>
  67. <MinorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MINOR_VERSION\s+(\d+)`).Groups[1].Value)</MinorVersionNumber>
  68. <MicroVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MICRO_VERSION\s+(\d+)`).Groups[1].Value)</MicroVersionNumber>
  69. <_ReleaseLevel>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_LEVEL\s+PY_RELEASE_LEVEL_(\w+)`).Groups[1].Value)</_ReleaseLevel>
  70. <ReleaseSerial>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_SERIAL\s+(\d+)`).Groups[1].Value)</ReleaseSerial>
  71. <ReleaseLevelNumber>15</ReleaseLevelNumber>
  72. <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'ALPHA'">10</ReleaseLevelNumber>
  73. <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'BETA'">11</ReleaseLevelNumber>
  74. <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'GAMMA'">12</ReleaseLevelNumber>
  75. <ReleaseLevelName Condition="$(_ReleaseLevel) == 'ALPHA'">a$(ReleaseSerial)</ReleaseLevelName>
  76. <ReleaseLevelName Condition="$(_ReleaseLevel) == 'BETA'">b$(ReleaseSerial)</ReleaseLevelName>
  77. <ReleaseLevelName Condition="$(_ReleaseLevel) == 'GAMMA'">rc$(ReleaseSerial)</ReleaseLevelName>
  78. </PropertyGroup>
  79. <PropertyGroup Condition="'$(OverrideVersion)' != ''">
  80. <!--
  81. Override the version number when building by specifying OverrideVersion.
  82. For example:
  83. PCBuild\build.bat "/p:OverrideVersion=3.5.2a1"
  84. Use the -V option to check your version is valid:
  85. PCBuild\build.bat -V "/p:OverrideVersion=3.5.2a1"
  86. PythonVersionNumber: 3.5.2
  87. PythonVersion: 3.5.2a1
  88. PythonVersionHex: 0x030502A1
  89. Field3Value: 2101
  90. Note that this only affects the version numbers embedded in resources and
  91. installers, but not sys.version.
  92. -->
  93. <MajorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[1].Value)</MajorVersionNumber>
  94. <MinorVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[2].Value)</MinorVersionNumber>
  95. <MicroVersionNumber>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[3].Value)</MicroVersionNumber>
  96. <ReleaseLevelName>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[4].Value)</ReleaseLevelName>
  97. <_ReleaseLevel>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[5].Value)</_ReleaseLevel>
  98. <ReleaseSerial>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[6].Value)</ReleaseSerial>
  99. <ReleaseSerial Condition="'$(ReleaseSerial)' == ''">0</ReleaseSerial>
  100. <ReleaseLevelNumber>15</ReleaseLevelNumber>
  101. <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'a'">10</ReleaseLevelNumber>
  102. <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'b'">11</ReleaseLevelNumber>
  103. <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'rc'">12</ReleaseLevelNumber>
  104. </PropertyGroup>
  105. <PropertyGroup>
  106. <PythonVersionNumber>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)</PythonVersionNumber>
  107. <PythonVersion>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)$(ReleaseLevelName)</PythonVersion>
  108. <PythonVersionHex>$([msbuild]::BitwiseOr(
  109. $([msbuild]::Multiply($(MajorVersionNumber), 16777216)),
  110. $([msbuild]::BitwiseOr(
  111. $([msbuild]::Multiply($(MinorVersionNumber), 65536)),
  112. $([msbuild]::BitwiseOr(
  113. $([msbuild]::Multiply($(MicroVersionNumber), 256)),
  114. $([msbuild]::BitwiseOr(
  115. $([msbuild]::Multiply($(ReleaseLevelNumber), 16)),
  116. $(ReleaseSerial)
  117. ))
  118. ))
  119. ))
  120. ))</PythonVersionHex>
  121. <Field3Value>$([msbuild]::Add(
  122. $(ReleaseSerial),
  123. $([msbuild]::Add(
  124. $([msbuild]::Multiply($(ReleaseLevelNumber), 10)),
  125. $([msbuild]::Multiply($(MicroVersionNumber), 1000))
  126. ))
  127. ))</Field3Value>
  128. <Field3Value Condition="$(UseTestMarker) == 'true'">$([msbuild]::Add($(Field3Value), 9000))</Field3Value>
  129. <!-- The name of the resulting pythonXY.dll (without the extension) -->
  130. <PyDllName>python$(MajorVersionNumber)$(MinorVersionNumber)$(PyDebugExt)</PyDllName>
  131. <!-- The version and platform tag to include in .pyd filenames -->
  132. <PydTag Condition="$(ArchName) == 'win32'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win32</PydTag>
  133. <PydTag Condition="$(ArchName) == 'amd64'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win_amd64</PydTag>
  134. <!-- The version number for sys.winver -->
  135. <SysWinVer>$(MajorVersionNumber).$(MinorVersionNumber)$(PyArchExt)$(PyTestExt)</SysWinVer>
  136. </PropertyGroup>
  137. <!-- Displays the calculated version info -->
  138. <Target Name="ShowVersionInfo">
  139. <Message Importance="high" Text="PythonVersionNumber: $(PythonVersionNumber)" />
  140. <Message Importance="high" Text="PythonVersion: $(PythonVersion)" />
  141. <Message Importance="high" Text="PythonVersionHex: 0x$([System.UInt32]::Parse($(PythonVersionHex)).ToString(`X08`))" />
  142. <Message Importance="high" Text="Field3Value: $(Field3Value)" />
  143. <Message Importance="high" Text="SysWinVer: $(SysWinVer)" />
  144. <Message Importance="high" Text="PyDllName: $(PyDllName)" />
  145. </Target>
  146. </Project>