-
Notifications
You must be signed in to change notification settings - Fork 51
/
debug_windows.bat
58 lines (45 loc) · 1.61 KB
/
debug_windows.bat
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
@echo off
cd /D "%~dp0"
echo Detecting Zig compiler...
set /p baseVersion=<".zig-version"
IF "%PROCESSOR_ARCHITECTURE%"=="AMD64" (set arch=x86_64)
IF "%PROCESSOR_ARCHITECTURE%"=="IA64" (set arch=x86_64)
IF "%PROCESSOR_ARCHITECTURE%"=="x86" (set arch=x86)
IF "%PROCESSOR_ARCHITECTURE%"=="ARM64" (set arch=aarch64)
IF "%arch%"=="" (
echo Machine architecture could not be recognized: %arch%. Please file a bug report.
echo Defaulting architecture to x86_64.
set arch=x86_64
)
set version=zig-windows-%arch%-%baseVersion%
if not exist compiler mkdir compiler
if not exist compiler\version.txt copy NUL compiler\version.txt >NUL
set currVersion=
set /p currVersion=<"compiler\version.txt"
if not "%version%" == "%currVersion%" (
echo Your Zig is the wrong version.
echo Deleting current Zig installation ...
if exist compiler\zig rmdir /s /q compiler\zig
echo Downloading %version% ...
powershell -Command $ProgressPreference = 'SilentlyContinue'; "Invoke-WebRequest -uri https://ziglang.org/builds/%version%.zip -OutFile compiler\archive.zip"
if errorlevel 1 (
echo Failed to download the Zig compiler.
exit /b 1
)
echo Extracting zip file ...
powershell $ProgressPreference = 'SilentlyContinue'; Expand-Archive compiler\archive.zip -DestinationPath compiler
ren compiler\%version% zig
del compiler\archive.zip
echo %version%> compiler\version.txt
echo Done updating Zig.
) ELSE (
echo Zig compiler is valid.
)
echo Building Zig Cubyz (%*^) from source. This may take a few minutes...
compiler\zig\zig build %*
if errorlevel 1 (
exit /b 1
)
echo Cubyz successfully built!
echo Launching Cubyz.
zig-out\bin\Cubyzig