Skip to content

Commit 6f05fc9

Browse files
authored
Modify build.ps1 for 64-bit Python support
Updated build script to support 64-bit Python builds and removed unnecessary commands.
1 parent c60f116 commit 6f05fc9

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

scripts/build.ps1

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
C:\mingw32\bin\dlltool.exe --version
2-
31
# download python 3.11.8 source code
42
curl -o Python-3.11.8.tgz https://www.python.org/ftp/python/3.11.8/Python-3.11.8.tgz
53
# extract the tarball
@@ -10,10 +8,11 @@ Set-Location Python-3.11.8
108
$vcxprojPath = "PCbuild/pythoncore.vcxproj"
119
$content = Get-Content $vcxprojPath -Raw # Read the entire content as a single string
1210

11+
# Replace ClCompile closing tag with runtime library entries for 64-bit (x64) builds
1312
$pattern = '</ClCompile>'
1413
$replacement = @"
15-
<RuntimeLibrary Condition="'`$(Configuration)|`$(Platform)'=='Release|Win32'">MultiThreaded</RuntimeLibrary>
16-
<RuntimeLibrary Condition="'`$(Configuration)|`$(Platform)'=='Debug|Win32'">MultiThreadedDebug</RuntimeLibrary>
14+
<RuntimeLibrary Condition="'`$(Configuration)|`$(Platform)'=='Release|x64'">MultiThreaded</RuntimeLibrary>
15+
<RuntimeLibrary Condition="'`$(Configuration)|`$(Platform)'=='Debug|x64'">MultiThreadedDebug</RuntimeLibrary>
1716
</ClCompile>
1817
"@
1918

@@ -22,27 +21,20 @@ $modifiedContent | Set-Content $vcxprojPath
2221

2322
# get python external libs before build
2423
./PCbuild/get_externals.bat
25-
# build python 3.11.8
26-
msbuild PCBuild/pcbuild.sln /p:Configuration=Release /p:RuntimeLibrary=MT
27-
msbuild PCBuild/pcbuild.sln /p:Configuration=Debug /p:RuntimeLibrary=MT
28-
# verify python is installed
29-
PCbuild/win32/python.exe --version
30-
31-
New-Item -ItemType Directory -Path "./python-build" -Force
3224

33-
Write-Host "Generating delay libraries for Python 3.11.8..."
25+
# build python 3.11.8 for 64-bit (x64)
26+
# ensure Platform is set to x64 so MSBuild produces 64-bit (amd64) artifacts
27+
msbuild PCBuild/pcbuild.sln /p:Configuration=Release /p:Platform=x64 /p:RuntimeLibrary=MT
28+
msbuild PCBuild/pcbuild.sln /p:Configuration=Debug /p:Platform=x64 /p:RuntimeLibrary=MT
3429

35-
Get-Command dlltool
30+
# verify python is installed (64-bit)
31+
PCbuild/amd64/python.exe --version
3632

37-
C:\mingw32\bin\dlltool.exe --input-def ../exports.def --output-delaylib "./python-build/python311.lib" --dllname "./PCbuild/win32/python311.dll"
38-
C:\mingw32\bin\dlltool.exe --input-def ../exports.def --output-delaylib "./python-build/python311_d.lib" --dllname "./PCbuild/win32/python311_d.dll"
39-
40-
Write-Host "Done!"
33+
New-Item -ItemType Directory -Path "./python-build" -Force
4134

42-
# copy python 3.11.8 to python-build
43-
Copy-Item -Path "./PCbuild/win32/python311.dll" -Destination "./python-build/python311.dll"
44-
Copy-Item -Path "./PCbuild/win32/python311_d.dll" -Destination "./python-build/python311_d.dll"
35+
# copy python 3.11.8 64-bit artifacts to python-build
36+
Copy-Item -Path "./PCbuild/amd64/python311.dll" -Destination "./python-build/python311.dll"
37+
Copy-Item -Path "./PCbuild/amd64/python311_d.dll" -Destination "./python-build/python311_d.dll"
4538

4639
# List the contents of the python-build directory
4740
Get-ChildItem -Path "./python-build"
48-

0 commit comments

Comments
 (0)