forked from Leandros/ClangOnWindows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.bat
60 lines (46 loc) · 1.45 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
@echo off
:: Change to your LLVM installation
set "LLVMPath=C:\Program Files\LLVM"
:: Change to your Visual Studio 2017 installation
set "VSPath=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community"
set "VSVersion=14.10.25017"
:: Change to your Windows Kit version & installation
set "WinSDKVersion=10.0.15063.0"
set "WinSDKPath=C:\Program Files (x86)\Windows Kits\10"
:: Change this to your resulting exe
set "OUTPUT=test.exe"
:: Setup
set "VSBasePath=%VSPath%\VC\Tools\MSVC\%VSVersion%"
set "PATH=%PATH%;%LLVMPath%\bin;%VSBasePath%\bin\HostX64\x64"
:: Compiler Flags
set CFLAGS= ^
-std=c++14 -Wall -Wextra
set CPPFLAGS= ^
-I "%VSBasePath%\include" ^
-I "%WinSDKPath%\Include\%WinSDKVersion%\shared" ^
-I "%WinSDKPath%\Include\%WinSDKVersion%\ucrt" ^
-I "%WinSDKPath%\Include\%WinSDKVersion%\um"
:: Linker Libs
set LDFLAGS= ^
-machine:x64 ^
-nodefaultlib ^
-subsystem:console
set LDLIBS= ^
-libpath:"%VSBasePath%\lib\x64" ^
-libpath:"%WinSDKPath%\Lib\%WinSDKVersion%\ucrt\x64" ^
-libpath:"%WinSDKPath%\Lib\%WinSDKVersion%\um\x64" ^
libucrt.lib libvcruntime.lib libcmt.lib libcpmt.lib ^
legacy_stdio_definitions.lib oldnames.lib ^
legacy_stdio_wide_specifiers.lib ^
kernel32.lib User32.lib
:: Compiling
@echo on
@for %%f in (*.cc) do (
clang++.exe "%%~f" -o "%%~nf.o" -c %CFLAGS%
)
:: Linking
@set "LINK_FILES="
@for %%f in (*.o) do (
@set "LINK_FILES=%LINK_FILES% %%~f"
)
lld-link.exe %LINK_FILES% -out:"%OUTPUT%" %LDFLAGS% %LDLIBS%