Skip to content

Commit e8260ca

Browse files
authored
Adding build script. (#254)
1 parent b5c510e commit e8260ca

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

build.cmd

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@echo off
2+
if "%1"=="/?" goto :usage
3+
if "%1"=="-?" goto :usage
4+
if "%VSINSTALLDIR%" == "" goto :usage
5+
6+
set platform=%1
7+
set configuration=%2
8+
set sample_filter=%3\
9+
10+
if "%platform%"=="" set platform=x64
11+
if "%configuration%"=="" set configuration=Release
12+
13+
if not exist ".\.nuget" mkdir ".\.nuget"
14+
if not exist ".\.nuget\nuget.exe" powershell -Command "Invoke-WebRequest https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile .\.nuget\nuget.exe"
15+
16+
for /f "delims=" %%D in ('dir /s/b samples\%sample_filter%*.sln') do (
17+
call .nuget\nuget.exe restore "%%D" -configfile Samples\nuget.config
18+
call msbuild /p:platform=%platform% /p:configuration=%configuration% "%%D"
19+
20+
if ERRORLEVEL 1 goto :eof
21+
)
22+
goto :eof
23+
24+
:usage
25+
echo Usage:
26+
echo This script should be run under a Visual Studio Developer Command Prompt.
27+
echo.
28+
echo build.cmd [Platform] [Configuration] [Sample]
29+
echo.
30+
echo [Platform] Either x86, x64, or arm64. Default is x64.
31+
echo [Configuration] Either Debug or Release. Default is Release.
32+
echo [Sample] The sample folder under Samples to build. If none specified, all samples are built.
33+
echo.
34+
echo If no parameters are specified, all samples are built for x64 Release.
35+
36+
exit /b /1

0 commit comments

Comments
 (0)