uv: Upgrade to v0.11.17
[platform/upstream/nodejs.git] / deps / uv / vcbuild.bat
1 @echo off
2
3 cd %~dp0
4
5 if /i "%1"=="help" goto help
6 if /i "%1"=="--help" goto help
7 if /i "%1"=="-help" goto help
8 if /i "%1"=="/help" goto help
9 if /i "%1"=="?" goto help
10 if /i "%1"=="-?" goto help
11 if /i "%1"=="--?" goto help
12 if /i "%1"=="/?" goto help
13
14 @rem Process arguments.
15 set config=
16 set target=Build
17 set noprojgen=
18 set nobuild=
19 set run=
20 set target_arch=ia32
21 set vs_toolset=x86
22 set platform=WIN32
23 set library=static_library
24
25 :next-arg
26 if "%1"=="" goto args-done
27 if /i "%1"=="debug"        set config=Debug&goto arg-ok
28 if /i "%1"=="release"      set config=Release&goto arg-ok
29 if /i "%1"=="test"         set run=run-tests.exe&goto arg-ok
30 if /i "%1"=="bench"        set run=run-benchmarks.exe&goto arg-ok
31 if /i "%1"=="clean"        set target=Clean&goto arg-ok
32 if /i "%1"=="noprojgen"    set noprojgen=1&goto arg-ok
33 if /i "%1"=="nobuild"      set nobuild=1&goto arg-ok
34 if /i "%1"=="x86"          set target_arch=ia32&set platform=WIN32&set vs_toolset=x86&goto arg-ok
35 if /i "%1"=="ia32"         set target_arch=ia32&set platform=WIN32&set vs_toolset=x86&goto arg-ok
36 if /i "%1"=="x64"          set target_arch=x64&set platform=amd64&set vs_toolset=x64&goto arg-ok
37 if /i "%1"=="shared"       set library=shared_library&goto arg-ok
38 if /i "%1"=="static"       set library=static_library&goto arg-ok
39 :arg-ok
40 shift
41 goto next-arg
42 :args-done
43
44 @rem Look for Visual Studio 2013
45 if not defined VS120COMNTOOLS goto vc-set-2012
46 if not exist "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-2012
47 call "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat" %vs_toolset%
48 set GYP_MSVS_VERSION=2013
49 goto select-target
50
51 @rem Look for Visual Studio 2012
52 :vc-set-2012
53 if not defined VS110COMNTOOLS goto vc-set-2010
54 if not exist "%VS110COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-2010
55 call "%VS110COMNTOOLS%\..\..\vc\vcvarsall.bat" %vs_toolset%
56 set GYP_MSVS_VERSION=2012
57 goto select-target
58
59 :vc-set-2010
60 @rem Look for Visual Studio 2010
61 if not defined VS100COMNTOOLS goto vc-set-2008
62 if not exist "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-2008
63 call "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat" %vs_toolset%
64 set GYP_MSVS_VERSION=2010
65 goto select-target
66
67 :vc-set-2008
68 @rem Look for Visual Studio 2008
69 if not defined VS90COMNTOOLS goto vc-set-notfound
70 if not exist "%VS90COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-notfound
71 call "%VS90COMNTOOLS%\..\..\vc\vcvarsall.bat" %vs_toolset%
72 set GYP_MSVS_VERSION=2008
73 goto select-target
74
75 :vc-set-notfound
76 echo Warning: Visual Studio not found
77
78 :select-target
79 if not "%config%"=="" goto project-gen
80 if "%run%"=="run-tests.exe" set config=Debug& goto project-gen
81 if "%run%"=="run-benchmarks.exe" set config=Release& goto project-gen
82 set config=Debug
83
84 :project-gen
85 @rem Skip project generation if requested.
86 if defined noprojgen goto msbuild
87
88 @rem Generate the VS project.
89 if exist build\gyp goto have_gyp
90 echo git clone https://git.chromium.org/external/gyp.git build/gyp
91 git clone https://git.chromium.org/external/gyp.git build/gyp
92 if errorlevel 1 goto gyp_install_failed
93 goto have_gyp
94
95 :gyp_install_failed
96 echo Failed to download gyp. Make sure you have git installed, or
97 echo manually install gyp into %~dp0build\gyp.
98 exit /b 1
99
100 :have_gyp
101 if not defined PYTHON set PYTHON="python"
102 %PYTHON% gyp_uv.py -Dtarget_arch=%target_arch% -Dlibrary=%library%
103 if errorlevel 1 goto create-msvs-files-failed
104 if not exist uv.sln goto create-msvs-files-failed
105 echo Project files generated.
106
107 :msbuild
108 @rem Skip project generation if requested.
109 if defined nobuild goto run
110
111 @rem Check if VS build env is available
112 if not defined VCINSTALLDIR goto msbuild-not-found
113 goto msbuild-found
114
115 :msbuild-not-found
116 echo Build skipped. To build, this file needs to run from VS cmd prompt.
117 goto run
118
119 @rem Build the sln with msbuild.
120 :msbuild-found
121 msbuild uv.sln /t:%target% /p:Configuration=%config% /p:Platform="%platform%" /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
122 if errorlevel 1 exit /b 1
123
124 :run
125 @rem Run tests if requested.
126 if "%run%"=="" goto exit
127 if not exist %config%\%run% goto exit
128 echo running '%config%\%run%'
129 %config%\%run%
130 goto exit
131
132 :create-msvs-files-failed
133 echo Failed to create vc project files.
134 exit /b 1
135
136 :help
137 echo vcbuild.bat [debug/release] [test/bench] [clean] [noprojgen] [nobuild] [x86/x64] [static/shared]
138 echo Examples:
139 echo   vcbuild.bat              : builds debug build
140 echo   vcbuild.bat test         : builds debug build and runs tests
141 echo   vcbuild.bat release bench: builds release build and runs benchmarks
142 goto exit
143
144 :exit