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.

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