-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.bat
More file actions
91 lines (78 loc) · 3.5 KB
/
build.bat
File metadata and controls
91 lines (78 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
@echo off
setlocal EnableDelayedExpansion
echo.
echo Building Quantum Language v2.0.0 ^| Bytecode VM
echo quantum hello.sa =^> hello.exe ^(compile + bundle^)
echo qrun hello.sa =^> runs directly ^(interpret^)
echo.
rem ── Add MSYS2 ucrt64 to PATH for this session ─────────────────────────────────
set "PATH=C:\msys64\ucrt64\bin;C:\msys64\mingw64\bin;C:\msys64\usr\bin;C:\MinGW\bin;C:\MinGW64\bin;C:\TDM-GCC-64\bin;%PATH%"
rem ── Locate make ───────────────────────────────────────────────────────────────
set "MAKE_EXE="
where mingw32-make >nul 2>&1 && set "MAKE_EXE=mingw32-make" && goto :make_found
where make >nul 2>&1 && set "MAKE_EXE=make" && goto :make_found
echo.
echo [ERROR] mingw32-make / make not found after searching common paths.
echo.
echo Please run this in PowerShell (no admin needed) then reopen terminal:
echo [System.Environment]::SetEnvironmentVariable("PATH","C:\msys64\ucrt64\bin;$env:PATH","User")
echo.
pause
exit /b 1
:make_found
echo Using: !MAKE_EXE!
rem ── Locate cmake ──────────────────────────────────────────────────────────────
set "CMAKE_EXE=cmake"
where cmake >nul 2>&1 || (
if exist "C:\Program Files\CMake\bin\cmake.exe" set "CMAKE_EXE=C:\Program Files\CMake\bin\cmake.exe"
)
rem ── Clean old build so no stale binaries survive ──────────────────────────────
echo Cleaning old build...
if exist build (
rmdir /S /Q build
)
rem ── Configure + build ─────────────────────────────────────────────────────────
mkdir build
cd build
"%CMAKE_EXE%" .. -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles" -DCMAKE_MAKE_PROGRAM="!MAKE_EXE!" > ..\build_log.txt 2>&1
if errorlevel 1 (
cd ..
echo [ERROR] CMake configure failed:
type build_log.txt
pause
exit /b 1
)
"!MAKE_EXE!" 2> ..\build_errors.txt
if errorlevel 1 (
cd ..
echo.
echo [ERROR] Compile failed:
type build_errors.txt
pause
exit /b 1
)
cd ..
rem ── Copy all THREE binaries to the project root ───────────────────────────────
copy /Y build\quantum.exe quantum.exe >nul
copy /Y build\qrun.exe qrun.exe >nul
copy /Y build\quantum_stub.exe quantum_stub.exe >nul
echo.
echo Build successful
echo.
echo Binaries copied to project root:
echo quantum.exe ^<-- compiler + bundler
echo qrun.exe ^<-- direct interpreter
echo quantum_stub.exe ^<-- standalone runtime ^(template for hello.exe etc.^)
echo.
echo Usage:
echo quantum hello.sa ^<-- compiles hello.sa into hello.exe, then runs it
echo hello.exe ^<-- run the compiled program directly
echo qrun hello.sa ^<-- interprets hello.sa in-place, no .exe created
echo.
echo Other flags:
echo quantum --debug hello.sa ^<-- dump bytecode then run
echo quantum --dis hello.sa ^<-- dump bytecode only
echo quantum --check hello.sa ^<-- parse + type-check only
echo quantum --test examples ^<-- batch test all .sa files
echo.
endlocal