diff --git a/build.bat b/build.bat index 088c2a7c..6c36e41b 100755 --- a/build.bat +++ b/build.bat @@ -1,6 +1,6 @@ @echo off SETLOCAL -set PATH=%windir%\system32;%PATH% &:: override msys if there is one on %PATH% +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: @@ -18,7 +18,7 @@ IF ERRORLEVEL 1 ( SETLOCAL ENABLEDELAYEDEXPANSION set static=/out:blst.lib set shared= -set arm64ec= +set arm64x= FOR %%O IN (%*) DO ( set opt=%%O IF "!opt!" == "-shared" ( @@ -31,8 +31,15 @@ FOR %%O IN (%*) DO ( ) 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] ( - link /nologo /debug /dll /entry:DllMain /incremental:no %shared% ^ + !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 @@ -41,7 +48,7 @@ IF [%shared%] NEQ [] ( armasm64 -nologo -machine arm64ec -nowarn %%F || EXIT /B ) cl /nologo /arm64EC /c /O2 /Oi- /MD %TOP%build\win64\dll.c || EXIT /B - link /nologo /machine:arm64x /dll /noentry %shared% ^ + !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