-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.bat
More file actions
59 lines (55 loc) · 2.37 KB
/
Copy pathbuild.bat
File metadata and controls
59 lines (55 loc) · 2.37 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
@rem Builds the default library for every memory model, since a program links the build that
@rem matches its own -mm= and there is deliberately no fallback to another model's copy.
@rem
@rem build.bat -> release and debug, all three models
@rem build.bat release -> release only, all three models
@rem build.bat release rc -> just that one
@rem
@rem Set TSLANG_TOOLCHAIN=llvm to build the C++ wrappers with clang-cl/llvm-lib instead
@rem of cl/lib.exe; everything else (flags, layout, output tree) is identical, so the two
@rem builds are interchangeable and overwrite each other in lib\ and dll\.
@rem
@rem Set TSLANG_ARCH=x86 to build the 32-bit tree instead of the default x64 one, e.g.
@rem set TSLANG_ARCH=x86
@rem build.bat release gc
@rem Like TSLANG_TOOLCHAIN, it is an environment variable, not a positional argument -
@rem %1/%2 stay "mode model" either way. x86 stages into lib\x86\... and dll\x86\...,
@rem alongside the x64 tree, and needs the x86 Boehm GC prerequisite (see README.md).
@rem
@rem Set TSLANG_DEBUG_CRT=/MT to build the debug archive against the release C runtime, for a
@rem package whose runtime/collector/LLVM libraries are all release builds (the compiler's
@rem release zip). The default, /MTd, matches a debug tslang build. See scripts\build_core.bat.
@rem
@rem See tslang/include/TypeScript/Defines.h for the resulting layout.
if /I "%TSLANG_TOOLCHAIN%" == "llvm" (
set "BUILD_SCRIPT=scripts\build_llvm.bat"
) else (
set "BUILD_SCRIPT=scripts\build_vs.bat"
)
if not "%2" == "" (
cmd /c %BUILD_SCRIPT% %1 %2
exit /b %errorlevel%
)
if "%1" == "debug" (
call :build_all_models debug
) else if "%1" == "release" (
call :build_all_models release
) else (
call :build_all_models release
if errorlevel 1 exit /b 1
call :build_all_models debug
)
exit /b %errorlevel%
:build_all_models
rem Each model runs in its own cmd.exe child (via "cmd /c", not "call") so
rem vcvars64.bat's PATH/INCLUDE/LIB growth doesn't accumulate across models -
rem calling it 3x in one process eventually trips cmd's line-length limit
rem ("The input line is too long"), which silently aborts that model's build
rem partway through and leaves its subfolder uncopied.
cmd /c %BUILD_SCRIPT% %1 gc
if errorlevel 1 exit /b 1
cmd /c %BUILD_SCRIPT% %1 rc
if errorlevel 1 exit /b 1
cmd /c %BUILD_SCRIPT% %1 none
if errorlevel 1 exit /b 1
exit /b 0