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 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
|
@echo off
setlocal
rem
rem buildwin.cmd
rem
rem command-line build script for MS Visual Studio
rem
rem Usage:
rem ------
rem buildwin VS_VERSION [ACTION] [LINKMODE] [CONFIGURATION] [SAMPLES] [DEVENV]
rem VS_VERSION: 71|80|90
rem ACTION: build|rebuild|clean
rem LINKMODE: static|shared|both
rem CONFIG: release|debug|both
rem SAMPLES: yes|no (shared only)
rem DEVENV: devenv|vcexpress
rem
rem VS_VERSION is required argument. Default is build all.
rem Change OPENSSL_DIR to match your setup
set OPENSSL_DIR=c:\OpenSSL
set OPENSSL_INCLUDE=%OPENSSL_DIR%\include
set OPENSSL_LIB=%OPENSSL_DIR%\lib\VC
set INCLUDE=%INCLUDE%;%OPENSSL_INCLUDE%
set LIB=%LIB%;%OPENSSL_LIB%
set POCO_BASE=%CD%
set PATH=%POCO_BASE%\bin;%PATH%
rem VS version {71|80|90}
if "%1"=="" goto usage
set VS_VERSION=vs%1
if "%6"=="" goto USE_DEVENV
set BUILD_TOOL="%6"
goto USE_CUSTOM
:USE_DEVENV
set BUILD_TOOL=devenv
:USE_CUSTOM
rem Action [build|rebuild|clean]
set ACTION=%2
if not "%ACTION%"=="build" (
if not "%ACTION%"=="rebuild" (
if not "%ACTION%"=="" (
if not "%ACTION%"=="clean" goto usage)))
if "%ACTION%"=="" (set ACTION="build")
rem Link mode [static|shared|both]
set LINK_MODE=%3
if not "%LINK_MODE%"=="static" (
if not "%LINK_MODE%"=="shared" (
if not "%LINK_MODE%"=="" (
if not "%LINK_MODE%"=="both" goto usage)))
rem Configuration [release|debug|both]
set CONFIGURATION=%4
if not "%CONFIGURATION%"=="release" (
if not "%CONFIGURATION%"=="debug" (
if not "%CONFIGURATION%"=="" (
if not "%CONFIGURATION%"=="both" goto usage)))
rem Samples [yes|no]
set SAMPLES=%5
if "%SAMPLES%"=="" (set SAMPLES=yes)
set RELEASE_SHARED=0
set DEBUG_SHARED=0
set DEBUG_STATIC=0
set RELEASE_STATIC=0
if "%LINK_MODE%"=="shared" (
if "%CONFIGURATION%"=="release" (set RELEASE_SHARED=1) else (
if "%CONFIGURATION%"=="both" (set RELEASE_SHARED=1) else (
if "%CONFIGURATION%"=="" (set RELEASE_SHARED=1))))
if "%LINK_MODE%"=="shared" (
if "%CONFIGURATION%"=="debug" (set DEBUG_SHARED=1) else (
if "%CONFIGURATION%"=="both" (set DEBUG_SHARED=1) else (
if "%CONFIGURATION%"=="" (set DEBUG_SHARED=1))))
if "%LINK_MODE%"=="static" (
if "%CONFIGURATION%"=="release" (set RELEASE_STATIC=1) else (
if "%CONFIGURATION%"=="both" (set RELEASE_STATIC=1) else (
if "%CONFIGURATION%"=="" (set RELEASE_STATIC=1))))
if "%LINK_MODE%"=="static" (
if "%CONFIGURATION%"=="debug" (set DEBUG_STATIC=1) else (
if "%CONFIGURATION%"=="both" (set DEBUG_STATIC=1) else (
if "%CONFIGURATION%"=="" (set DEBUG_STATIC=1))))
if "%LINK_MODE%"=="both" (
if "%CONFIGURATION%"=="debug" (
set DEBUG_STATIC=1
set DEBUG_SHARED=1) else (
if "%CONFIGURATION%"=="release" (
set RELEASE_STATIC=1
set RELEASE_SHARED=1) else (
if "%CONFIGURATION%"=="both" (
set DEBUG_STATIC=1
set DEBUG_SHARED=1
set RELEASE_STATIC=1
set RELEASE_SHARED=1) else (
if "%CONFIGURATION%"=="" (
set DEBUG_STATIC=1
set DEBUG_SHARED=1
set RELEASE_STATIC=1
set RELEASE_SHARED=1)))))
if "%LINK_MODE%"=="" (
if "%CONFIGURATION%"=="debug" (
set DEBUG_STATIC=1
set DEBUG_SHARED=1) else (
if "%CONFIGURATION%"=="release" (
set RELEASE_STATIC=1
set RELEASE_SHARED=1) else (
if "%CONFIGURATION%"=="both" (
set DEBUG_STATIC=1
set DEBUG_SHARED=1
set RELEASE_STATIC=1
set RELEASE_SHARED=1) else (
if "%CONFIGURATION%"=="" (
set DEBUG_STATIC=1
set DEBUG_SHARED=1
set RELEASE_STATIC=1
set RELEASE_SHARED=1)))))
echo Building:
if %DEBUG_SHARED%==1 (echo debug_shared)
if %RELEASE_SHARED%==1 (echo release_shared)
if %DEBUG_STATIC%==1 (echo debug_static)
if %RELEASE_STATIC%==1 (echo release_static)
rem build for up to 4 levels deep
for /f %%G in ('findstr /R "." components') do (
if exist %%G (
cd %%G
for /f "tokens=1,2,3,4 delims=/" %%Q in ("%%G") do (
if exist %%Q_%VS_VERSION%.sln (
echo.
echo ========== Building %%G ==========
if %DEBUG_SHARED%==1 (%BUILD_TOOL% /useenv /%ACTION% debug_shared %%Q_%VS_VERSION%.sln)
if %RELEASE_SHARED%==1 (%BUILD_TOOL% /useenv /%ACTION% release_shared %%Q_%VS_VERSION%.sln)
if %DEBUG_STATIC%==1 (%BUILD_TOOL% /useenv /%ACTION% debug_static %%Q_%VS_VERSION%.sln)
if %RELEASE_STATIC%==1 (%BUILD_TOOL% /useenv /%ACTION% release_static %%Q_%VS_VERSION%.sln)
)
if exist %%R_%VS_VERSION%.sln (
echo.
echo ========== Building %%G ==========
if %DEBUG_SHARED%==1 (%BUILD_TOOL% /useenv /%ACTION% debug_shared %%R_%VS_VERSION%.sln)
if %RELEASE_SHARED%==1 (%BUILD_TOOL% /useenv /%ACTION% release_shared %%R_%VS_VERSION%.sln)
if %DEBUG_STATIC%==1 (%BUILD_TOOL% /useenv /%ACTION% debug_static %%R_%VS_VERSION%.sln)
if %RELEASE_STATIC%==1 (%BUILD_TOOL% /useenv /%ACTION% release_static %%R_%VS_VERSION%.sln)
)
if exist %%S_%VS_VERSION%.sln (
echo.
echo ========== Building %%G ==========
if %DEBUG_SHARED%==1 (%BUILD_TOOL% /useenv /%ACTION% debug_shared %%S_%VS_VERSION%.sln)
if %RELEASE_SHARED%==1 (%BUILD_TOOL% /useenv /%ACTION% release_shared %%S_%VS_VERSION%.sln)
if %DEBUG_STATIC%==1 (%BUILD_TOOL% /useenv /%ACTION% debug_static %%S_%VS_VERSION%.sln)
if %RELEASE_STATIC%==1 (%BUILD_TOOL% /useenv /%ACTION% release_static %%S_%VS_VERSION%.sln)
)
if exist %%T_%VS_VERSION%.sln (
echo.
echo ========== Building %%G ==========
if %DEBUG_SHARED%==1 (%BUILD_TOOL% /useenv /%ACTION% debug_shared %%T_%VS_VERSION%.sln)
if %RELEASE_SHARED%==1 (%BUILD_TOOL% /useenv /%ACTION% release_shared %%T_%VS_VERSION%.sln)
if %DEBUG_STATIC%==1 (%BUILD_TOOL% /useenv /%ACTION% debug_static %%T_%VS_VERSION%.sln)
if %RELEASE_STATIC%==1 (%BUILD_TOOL% /useenv /%ACTION% release_static %%T_%VS_VERSION%.sln)
)
)
cd %POCO_BASE%
)
)
if "%SAMPLES%"=="no" goto :EOF
rem root level component samples
for /f %%G in ('findstr /R "." components') do (
if exist %%G\samples\samples_%VS_VERSION%.sln (
cd %%G\samples
echo.
echo ========== Building %%G/samples ==========
if %DEBUG_SHARED%==1 %BUILD_TOOL% /useenv /%ACTION% debug_shared samples_%VS_VERSION%.sln
if %RELEASE_SHARED%==1 %BUILD_TOOL% /useenv /%ACTION% release_shared samples_%VS_VERSION%.sln
cd %POCO_BASE%
)
)
goto :EOF
:usage
echo Usage:
echo ------
echo buildwin VS_VERSION [ACTION] [LINKMODE] [CONFIGURATION] [SAMPLES] [DEVENV]
echo VS_VERSION: "71|80|90"
echo ACTION: "build|rebuild|clean"
echo LINKMODE: "static|shared|both"
echo CONFIG: "release|debug|both"
echo SAMPLES: "yes|no" (shared only)
echo DEVENV: "devenv|vcexpress"
echo.
echo Default is build all.
endlocal
|