648db22b |
1 | @echo off |
2 | |
3 | IF "%1%" == "" GOTO display_help |
4 | |
5 | SETLOCAL |
6 | |
7 | SET msbuild_version=%1 |
8 | |
9 | SET msbuild_platform=%2 |
10 | IF "%msbuild_platform%" == "" SET msbuild_platform=x64 |
11 | |
12 | SET msbuild_configuration=%3 |
13 | IF "%msbuild_configuration%" == "" SET msbuild_configuration=Release |
14 | |
15 | SET msbuild_toolset=%4 |
16 | |
17 | GOTO build |
18 | |
19 | :display_help |
20 | |
21 | echo Syntax: build.generic.cmd msbuild_version msbuild_platform msbuild_configuration msbuild_toolset |
22 | echo msbuild_version: VS installed version (VS2012, VS2013, VS2015, VS2017, VS2019, ...) |
23 | echo msbuild_platform: Platform (x64 or Win32) |
24 | echo msbuild_configuration: VS configuration (Release or Debug) |
25 | echo msbuild_toolset: Platform Toolset (v100, v110, v120, v140, v141, v142, ...) |
26 | |
27 | EXIT /B 1 |
28 | |
29 | :build |
30 | |
31 | SET msbuild="%windir%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" |
32 | SET msbuild_vs2017community="%programfiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" |
33 | SET msbuild_vs2017professional="%programfiles(x86)%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe" |
34 | SET msbuild_vs2017enterprise="%programfiles(x86)%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe" |
35 | IF %msbuild_version% == VS2013 SET msbuild="%programfiles(x86)%\MSBuild\12.0\Bin\MSBuild.exe" |
36 | IF %msbuild_version% == VS2015 SET msbuild="%programfiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe" |
37 | IF %msbuild_version% == VS2017Community SET msbuild=%msbuild_vs2017community% |
38 | IF %msbuild_version% == VS2017Professional SET msbuild=%msbuild_vs2017professional% |
39 | IF %msbuild_version% == VS2017Enterprise SET msbuild=%msbuild_vs2017enterprise% |
40 | IF %msbuild_version% == VS2017 ( |
41 | IF EXIST %msbuild_vs2017community% SET msbuild=%msbuild_vs2017community% |
42 | IF EXIST %msbuild_vs2017professional% SET msbuild=%msbuild_vs2017professional% |
43 | IF EXIST %msbuild_vs2017enterprise% SET msbuild=%msbuild_vs2017enterprise% |
44 | ) |
45 | |
46 | :: VS2019 |
47 | SET msbuild_vs2019community="%programfiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" |
48 | SET msbuild_vs2019professional="%programfiles(x86)%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe" |
49 | SET msbuild_vs2019enterprise="%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe" |
50 | IF %msbuild_version% == VS2019 ( |
51 | IF EXIST %msbuild_vs2019community% SET msbuild=%msbuild_vs2019community% |
52 | IF EXIST %msbuild_vs2019professional% SET msbuild=%msbuild_vs2019professional% |
53 | IF EXIST %msbuild_vs2019enterprise% SET msbuild=%msbuild_vs2019enterprise% |
54 | ) |
55 | |
56 | SET project="%~p0\..\VS2010\zstd.sln" |
57 | |
58 | SET msbuild_params=/verbosity:minimal /nologo /t:Clean,Build /p:Platform=%msbuild_platform% /p:Configuration=%msbuild_configuration% |
59 | IF NOT "%msbuild_toolset%" == "" SET msbuild_params=%msbuild_params% /p:PlatformToolset=%msbuild_toolset% |
60 | |
61 | SET output=%~p0%bin |
62 | SET output="%output%/%msbuild_configuration%/%msbuild_platform%/" |
63 | SET msbuild_params=%msbuild_params% /p:OutDir=%output% |
64 | |
65 | echo ### Building %msbuild_version% project for %msbuild_configuration% %msbuild_platform% (%msbuild_toolset%)... |
66 | echo ### Build Params: %msbuild_params% |
67 | |
68 | %msbuild% %project% %msbuild_params% |
69 | IF ERRORLEVEL 1 EXIT /B 1 |
70 | echo # Success |
71 | echo # OutDir: %output% |
72 | echo # |