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.

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