| :: Build pylauncher.exe using MSVC. |
| :: |
| :: This links against ucrtbase.dll (via ucrt.lib) which ships as part of the OS |
| :: since Windows 10 (2015) and via Windows Update for Vista/7/8/8.1. |
| :: |
| :: /O1 : Favor small code (optimization for size) |
| :: /GS- : Disable buffer security checks (requires vc runtime and not necessary for our tiny command line wrapper) |
| :: /NODEFAULTLIB : Do not link the default libraries |
| :: /ENTRY:launcher_main : Use launcher_main() as entry point directly (no CRT startup) |
| :: /SUBSYSTEM:CONSOLE : Designate as a console app instead of WINDOWS. Needed explicitly because of custom entrypoint. |
| :: /Brepro : Deterministic (reproducible) output |
| :: ucrt.lib : Link only against Universal CRT (no vcruntime dependency) |
| |
| set OUT=pylauncher.exe |
| set MACHINE=X64 |
| |
| if /i "%~1"=="arm64" ( |
| set OUT=pylauncher-arm64.exe |
| set MACHINE=ARM64 |
| ) |
| |
| cl pylauncher.c /Fe:%OUT% /O1 /GS- /link /NODEFAULTLIB /ENTRY:launcher_main /SUBSYSTEM:CONSOLE /MACHINE:%MACHINE% /Brepro ucrt.lib kernel32.lib |