-
Notifications
You must be signed in to change notification settings - Fork 177
/
build.bat
executable file
·60 lines (60 loc) · 2 KB
/
build.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
59
60
@echo off
SETLOCAL
set PATH=%windir%\system32;%PATH% &:: override msys if it's on the PATH
set TOP=%~dp0
cl /nologo /c /O2 /Zi /Fdblst.pdb /W4 /MT /Zl %TOP%src\server.c || EXIT /B
cl 2>&1 | find "for ARM64" > nul:
IF ERRORLEVEL 1 (
set arm64=no
FOR %%F IN (%TOP%build\win64\*-x86_64.asm) DO (
ml64 /nologo /c /Cp /Cx /Zi %%F || EXIT /B
)
) ELSE (
set arm64=yes
FOR %%F IN (%TOP%build\win64\*-armv8.asm) DO (
armasm64 -nologo %%F || EXIT /B
)
)
SETLOCAL ENABLEDELAYEDEXPANSION
set static=/out:blst.lib
set shared=
set arm64x=
FOR %%O IN (%*) DO (
set opt=%%O
IF "!opt!" == "-shared" (
IF [!shared!] EQU [] set shared=/out:blst.dll
) ELSE IF "!opt:~0,5!" == "/out:" (
IF "!opt:~-4!" == ".dll" (set shared=!opt!) ELSE (set static=!opt!)
) ELSE IF "!opt!" == "-arm64x" (
set arm64x=%arm64%
)
)
IF [%shared%] NEQ [] (
cl /nologo /c /O2 /Oi- /MD %TOP%build\win64\dll.c || EXIT /B
set ld=
FOR /F "usebackq delims=" %%F IN (`where link`) DO (
IF "!ld!" == "" (
"%%F" 2>&1 | find "Linker" > nul:
IF !ERRORLEVEL! EQU 0 set ld="%%F"
)
)
IF [%arm64x%] NEQ [yes] (
!ld! /nologo /debug /dll /entry:DllMain /incremental:no %shared% ^
/def:%TOP%build\win64\blst.def *.obj kernel32.lib && del *.obj
) ELSE (
lib /nologo /out:blst_arm64.lib *.obj && del *.obj || EXIT /B
cl /nologo /arm64EC /c /O2 /Zi /Fdblst.pdb /W4 /MT /Zl %TOP%src\server.c || EXIT /B
FOR %%F IN (%TOP%build\win64\*-armv8.asm) DO (
armasm64 -nologo -machine arm64ec -nowarn %%F || EXIT /B
)
cl /nologo /arm64EC /c /O2 /Oi- /MD %TOP%build\win64\dll.c || EXIT /B
!ld! /nologo /machine:arm64x /dll /noentry %shared% ^
/def:%TOP%build\win64\blst.def *.obj ^
/defArm64Native:%TOP%build\win64\blst.def blst_arm64.lib ^
kernel32.lib && del *.obj blst_arm64.lib
)
) ELSE (
lib /nologo %static% *.obj && del *.obj
)
ENDLOCAL
EXIT /B