1+ # download python 3.11.8 source code
2+ curl - o Python- 3.11 .8. tgz https:// www.python.org/ ftp/ python/ 3.11 .8 / Python- 3.11 .8. tgz
3+ # extract the tarball
4+ tar - xzvf Python- 3.11 .8. tgz > nul 2>&1
5+
6+ Set-Location Python- 3.11 .8
7+
8+ $vcxprojPath = " PCbuild/pythoncore.vcxproj"
9+ $content = Get-Content $vcxprojPath - Raw # Read the entire content as a single string
10+
11+ $pattern = ' </ClCompile>'
12+ $replacement = @"
13+ <RuntimeLibrary Condition="'`$ (Configuration)|`$ (Platform)'=='Release|Win32'">MultiThreaded</RuntimeLibrary>
14+ <RuntimeLibrary Condition="'`$ (Configuration)|`$ (Platform)'=='Debug|Win32'">MultiThreadedDebug</RuntimeLibrary>
15+ </ClCompile>
16+ "@
17+
18+ $modifiedContent = $content -replace [regex ]::Escape($pattern ), $replacement
19+ $modifiedContent | Set-Content $vcxprojPath
20+
21+ # get python external libs before build
22+ ./ PCbuild/ get_externals.bat
23+ # build python 3.11.8 as win32 and release
24+ msbuild PCBuild/ pcbuild.sln / p:Configuration= Release / p:Platform= Win32 / p:RuntimeLibrary= MT
25+ msbuild PCBuild/ pcbuild.sln / p:Configuration= Debug / p:Platform= Win32 / p:RuntimeLibrary= MT
26+ # verify python is installed
27+ PCbuild/ win32/ python.exe -- version
28+
29+
30+ mkdir D:/ a/ Millennium/ Millennium/ build/ python
31+ # Move the python311.dll binary to the release directory
32+ Copy-Item D:/ a/ Millennium/ Millennium/ Python- 3.11 .8 / PCbuild/ win32/ python311.dll D:/ a/ Millennium/ Millennium/ build/ python/ python311.dll
33+ Copy-Item D:/ a/ Millennium/ Millennium/ Python- 3.11 .8 / PCbuild/ win32/ python311_d.dll D:/ a/ Millennium/ Millennium/ build/ python/ python311_d.dll
34+ Copy-Item D:/ a/ Millennium/ Millennium/ Python- 3.11 .8 / PCbuild/ win32/ python311.lib D:/ a/ Millennium/ Millennium/ build/ python/ python311.lib
35+ Copy-Item D:/ a/ Millennium/ Millennium/ Python- 3.11 .8 / PCbuild/ win32/ python311_d.lib D:/ a/ Millennium/ Millennium/ build/ python/ python311_d.lib
0 commit comments