PageRenderTime 33ms CodeModel.GetById 16ms app.highlight 13ms RepoModel.GetById 1ms app.codeStats 0ms

/vcbuild.bat

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