1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

make.bat: change the default compiler to tcc (which we have prebuilt in a known location)

This commit is contained in:
Delyan Angelov 2021-03-09 00:46:37 +02:00
parent a9358e4948
commit 343f144b0b
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -177,6 +177,31 @@ if !flag_local! NEQ 1 (
echo Building V... echo Building V...
if not [!compiler!] == [] goto :!compiler!_strap if not [!compiler!] == [] goto :!compiler!_strap
REM By default, use tcc, since we have it prebuilt:
:tcc_strap
:tcc32_strap
if [!compiler!] == [] set /a invalid_cc=1
echo ^> Attempting to build v_win.c with TCC
if !flag_verbose! EQU 1 (
echo [Debug] "!tcc_exe!" -ladvapi32 -bt10 -w -o v.exe vc\v_win.c>>"!log_file!"
echo "!tcc_exe!" -ladvapi32 -bt10 -w -o v.exe vc\v_win.c
)
"!tcc_exe!" -ladvapi32 -bt10 -w -o v.exe vc\v_win.c>>"!log_file!" 2>NUL
if %ERRORLEVEL% NEQ 0 goto :compile_error
echo ^> Compiling with .\v.exe self
if !flag_verbose! EQU 1 (
echo [Debug] v.exe -cc "!tcc_exe!" self>>"!log_file!"
echo v.exe -cc "!tcc_exe!" self
)
v.exe -cc "!tcc_exe!" self>>"!log_file!" 2>NUL
if %ERRORLEVEL% NEQ 0 goto :clang_strap
goto :success
:clang_strap :clang_strap
where /q clang where /q clang
if %ERRORLEVEL% NEQ 0 ( if %ERRORLEVEL% NEQ 0 (
@ -247,7 +272,7 @@ if "%PROCESSOR_ARCHITECTURE%" == "x86" (
if not exist "%VsWhereDir%\Microsoft Visual Studio\Installer\vswhere.exe" ( if not exist "%VsWhereDir%\Microsoft Visual Studio\Installer\vswhere.exe" (
echo ^> MSVC not found echo ^> MSVC not found
if not [!compiler!] == [] goto :error if not [!compiler!] == [] goto :error
goto :tcc_strap goto :compile_error
) )
for /f "usebackq tokens=*" %%i in (`"%VsWhereDir%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do ( for /f "usebackq tokens=*" %%i in (`"%VsWhereDir%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (
@ -284,25 +309,7 @@ del %ObjFile%>>"!log_file!" 2>>&1
if %ERRORLEVEL% NEQ 0 goto :compile_error if %ERRORLEVEL% NEQ 0 goto :compile_error
goto :success goto :success
:tcc_strap
:tcc32_strap
if [!compiler!] == [] set /a invalid_cc=1
echo ^> Attempting to build v_win.c with TCC
if !flag_verbose! EQU 1 (
echo [Debug] "!tcc_exe!" -ladvapi32 -bt10 -w -o v.exe vc\v_win.c>>"!log_file!"
echo "!tcc_exe!" -ladvapi32 -bt10 -w -o v.exe vc\v_win.c
)
"!tcc_exe!" -ladvapi32 -bt10 -w -o v.exe vc\v_win.c>>"!log_file!" 2>NUL
if %ERRORLEVEL% NEQ 0 goto :compile_error
echo ^> Compiling with .\v.exe self
if !flag_verbose! EQU 1 (
echo [Debug] v.exe -cc "!tcc_exe!" self>>"!log_file!"
echo v.exe -cc "!tcc_exe!" self
)
v.exe -cc "!tcc_exe!" self>>"!log_file!" 2>NUL
if %ERRORLEVEL% NEQ 0 goto :compile_error
goto :success
:download_tcc :download_tcc
pushd %tcc_dir% 2>NUL && ( pushd %tcc_dir% 2>NUL && (