-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathSC.bat
More file actions
68 lines (57 loc) · 2.03 KB
/
SC.bat
File metadata and controls
68 lines (57 loc) · 2.03 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
@echo off
setlocal enabledelayedexpansion enableextensions
set "SCRIPT_DIR=%~dp0"
@REM Remove the trailing slash
set "SCRIPT_DIR=%SCRIPT_DIR:~0,-1%"
@REM Change to project directory
cd /d "%SCRIPT_DIR%"
@REM Set up MSVC environment
set "vswhere_path=C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"
if not exist "%vswhere_path%" (
echo Error: Visual Studio Locator not found.
exit /b 1
)
set vcvarsall_path=""
for /f "usebackq delims=" %%i in (`"%vswhere_path%" -latest -property installationPath`) do (
set "vcvarsall_path=%%i\VC\Auxiliary\Build\vcvarsall.bat"
)
)
set __VSCMD_ARG_NO_LOGO=1
set VSCMD_SKIP_SENDTELEMETRY=1
set VCPKG_KEEP_ENV_VARS=VSCMD_SKIP_SENDTELEMETRY
set vcvarsall_called=0
if exist "%vcvarsall_path%" (
call "%vcvarsall_path%" x86_amd64
set vcvarsall_called=1
) else (
echo Error: vcvarsall.bat not found.
exit /b 1
)
set "BOOTSTRAP_EXE=%SCRIPT_DIR%\_Build\_Tools\Windows\ToolsBootstrap.exe"
@REM Create platform Tools directory if needed
mkdir "%SCRIPT_DIR%\_Build\_Tools\Windows" 2>nul
@REM Check if ToolsBootstrap needs to be built
if not exist "%BOOTSTRAP_EXE%" (
set build_bootstrap=1
) else (
for %%f in ("%SCRIPT_DIR%\Tools\ToolsBootstrap.c") do set source_time=%%~tf
for %%f in ("%BOOTSTRAP_EXE%") do set exe_time=%%~tf
if "!source_time!" gtr "!exe_time!" (set build_bootstrap=1) else (set build_bootstrap=0)
)
if !build_bootstrap! equ 1 (
set SRC_FILE=!SCRIPT_DIR!\Tools\ToolsBootstrap.c
set OBJ_FILE=!SCRIPT_DIR!\_Build\_Tools\Windows\ToolsBootstrap.obj
cl.exe /nologo /MTd /Zi /Od /D_DEBUG=1 /Fo"!OBJ_FILE!" /c "!SRC_FILE!" 2>&1
if !errorlevel! neq 0 (
echo Failed to build ToolsBootstrap
exit /b 1
)
link /nologo /DEBUG /OUT:"!BOOTSTRAP_EXE!" "!OBJ_FILE!" Shell32.lib 2>&1
if !errorlevel! neq 0 (
echo Failed to link ToolsBootstrap
exit /b 1
)
)
@REM Execute ToolsBootstrap with original args
"%BOOTSTRAP_EXE%" "%SCRIPT_DIR%" "%SCRIPT_DIR%\Tools" "%SCRIPT_DIR%\_Build" "%SCRIPT_DIR%" %*
endlocal