-
Notifications
You must be signed in to change notification settings - Fork 168
/
makewin.cmd
131 lines (122 loc) · 4.01 KB
/
makewin.cmd
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
@echo off
SETLOCAL
if "%~1" == "" goto USAGE
if /I "%~1" == "--help" goto USAGE
if /I "%~1" == "-h" goto USAGE
if /I "%~1" == "/?" goto USAGE
:: Set up MSVC environment
:: Kudos to https://gist.github.com/AndrewPardoe/689a3b969670787d5dba538bb0a48a1e
pushd "%~dp0"
pushd %ProgramFiles(x86)%\"Microsoft Visual Studio"\Installer
for /f "usebackq tokens=*" %%i in (`vswhere -latest -prerelease -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (
set VCINSTALLDIR=%%i\VC
)
popd
if exist %VCINSTALLDIR%\Auxiliary\Build\vcvarsall.bat (
if /I "%~1" == "x86" (
call "%VCINSTALLDIR%\Auxiliary\Build\vcvarsall.bat" %1
) else (
if /I "%~1" == "x64" (
call "%VCINSTALLDIR%\Auxiliary\Build\vcvarsall.bat" %1
) else goto USAGE
)
)
popd
set build="MinSizeRel"
set validationParser="-DUSE_VALIDATION_PARSER=off"
set zlib="-DUSE_SHARED_ZLIB=off"
set parser="-DXML_PARSER=msxml6"
set crypto="-DCRYPTO_LIB=crypt32"
set msvc="-DUSE_STATIC_MSVC=off"
set bundle="-DSKIP_BUNDLES=off"
set pack="-DMSIX_PACK=off"
set samples="-DMSIX_SAMPLES=on"
set tests="-DMSIX_TESTS=on"
:parseArgs
if /I "%~2" == "--debug" (
set build="Debug"
)
if /I "%~2" == "-d" (
set build="Debug"
)
if /I "%~2" == "--symbols" (
set build="RelWithDebInfo"
)
if /I "%~2" == "-sym" (
set build="RelWithDebInfo"
)
if /I "%~2" == "--parser-xerces" (
set parser="-DXML_PARSER=xerces"
)
if /I "%~2" == "-px" (
set parser="-DXML_PARSER=xerces"
)
if /I "%~2" == "--validation-parser" (
set validationParser="-DUSE_VALIDATION_PARSER=on"
)
if /I "%~2" == "-vp" (
set validationParser="-DUSE_VALIDATION_PARSER=on"
)
if /I "%~2" == "--shared-zlib" (
set zlib="-DUSE_SHARED_ZLIB=on"
)
if /I "%~2" == "-sz" (
set zlib="-DUSE_SHARED_ZLIB=on"
)
if /I "%~2" == "--crypto-openssl" (
set crypto="-DCRYPTO_LIB=openssl"
)
if /I "%~2" == "-co" (
set crypto="-DCRYPTO_LIB=openssl"
)
if /I "%~2" == "-mt" (
set msvc="-DUSE_STATIC_MSVC=on"
)
if /I "%~2" == "--skip-bundles" (
set bundle="-DSKIP_BUNDLES=on"
)
if /I "%~2" == "-sb" (
set bundle="-DSKIP_BUNDLES=on"
)
if /I "%~2" == "--pack" (
set pack="-DMSIX_PACK=on"
set validationParser="-DUSE_VALIDATION_PARSER=on"
)
if /I "%~2" == "--skip-samples" (
set samples="-DMSIX_SAMPLES=off"
)
if /I "%~2" == "--skip-tests" (
set tests="-DMSIX_TESTS=off"
)
shift /2
if not "%~2"=="" goto parseArgs
if not exist .vs md .vs
cd .vs
if exist CMakeFiles rd /s /q CMakeFiles
if exist CMakeCache.txt del CMakeCache.txt
echo cmake -DWIN32=on -DCMAKE_BUILD_TYPE=%build% %validationParser% %zlib% %parser% %crypto% %msvc% %bundle% %pack% %samples% %tests% -G"NMake Makefiles" ..
cmake -DWIN32=on -DCMAKE_BUILD_TYPE=%build% %validationParser% %zlib% %parser% %crypto% %msvc% %bundle% %pack% %samples% %tests% -G"NMake Makefiles" ..
nmake /NOLOGO
goto Exit
:USAGE
echo Usage
echo:
echo makewin.cmd ^<x86^|x64^> [options]
echo:
echo Helper to build the MSIX SDK for Windows. Assumes the user has a version of Visual Studio installed.
echo:
echo Options
echo --debug, -d = Build chk binary.
echo --symbols, -sym = Produce symbols for release binaries.
echo --parser-xerces, -px = Use Xerces-C parser. Default MSXML6.
echo --validation-parser, -vp = Enable XML schema validation.
echo --shared-zlib, -sz = Don't statically link zlib.
echo --crypto-openssl, -co = Use OpenSSL crypto [currently for testing]. Default Crypt32.
echo -mt = Use compiler flag /MT to use static version of the run-time library.
echo --skip-bundles, -sb = Turn off bundle support.
echo --pack = Include packaging features. Sets validation parser on.
echo --skip-samples = Skip building samples.
echo --skip-test = Skip building tests.
echo --help, -h, /? = Print this usage information and exit.
:Exit
EXIT /B 0