| 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|---|
| 2 | ;;
|
|---|
| 3 | ;; Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ;; Contact: Qt Software Information (qt-info@nokia.com)
|
|---|
| 5 | ;;
|
|---|
| 6 | ;; This file is part of the tools applications of the Qt Toolkit.
|
|---|
| 7 | ;;
|
|---|
| 8 | ;; $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 9 | ;; Commercial Usage
|
|---|
| 10 | ;; Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 11 | ;; accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 12 | ;; Software or, alternatively, in accordance with the terms contained in
|
|---|
| 13 | ;; a written agreement between you and Nokia.
|
|---|
| 14 | ;;
|
|---|
| 15 | ;; GNU Lesser General Public License Usage
|
|---|
| 16 | ;; Alternatively, this file may be used under the terms of the GNU Lesser
|
|---|
| 17 | ;; General Public License version 2.1 as published by the Free Software
|
|---|
| 18 | ;; Foundation and appearing in the file LICENSE.LGPL included in the
|
|---|
| 19 | ;; packaging of this file. Please review the following information to
|
|---|
| 20 | ;; ensure the GNU Lesser General Public License version 2.1 requirements
|
|---|
| 21 | ;; will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|---|
| 22 | ;;
|
|---|
| 23 | ;; In addition, as a special exception, Nokia gives you certain
|
|---|
| 24 | ;; additional rights. These rights are described in the Nokia Qt LGPL
|
|---|
| 25 | ;; Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
|---|
| 26 | ;; package.
|
|---|
| 27 | ;;
|
|---|
| 28 | ;; GNU General Public License Usage
|
|---|
| 29 | ;; Alternatively, this file may be used under the terms of the GNU
|
|---|
| 30 | ;; General Public License version 3.0 as published by the Free Software
|
|---|
| 31 | ;; Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 32 | ;; packaging of this file. Please review the following information to
|
|---|
| 33 | ;; ensure the GNU General Public License version 3.0 requirements will be
|
|---|
| 34 | ;; met: http://www.gnu.org/copyleft/gpl.html.
|
|---|
| 35 | ;;
|
|---|
| 36 | ;; If you are unsure which license is appropriate for your use, please
|
|---|
| 37 | ;; contact the sales department at qt-sales@nokia.com.
|
|---|
| 38 | ;; $QT_END_LICENSE$
|
|---|
| 39 | ;;
|
|---|
| 40 | ;; This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
|---|
| 41 | ;; WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|---|
| 42 | ;;
|
|---|
| 43 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|---|
| 44 | !ifndef QTENV_INCLUDE
|
|---|
| 45 | !define QTENV_INCLUDE
|
|---|
| 46 | #
|
|---|
| 47 | # creates a qtvars.bat file in $QTDIR\bin
|
|---|
| 48 | # push "vs2003" #compiler
|
|---|
| 49 | # push "c:\qt" #QTDIR
|
|---|
| 50 | # call MakeQtVarsFile
|
|---|
| 51 | #
|
|---|
| 52 | Function MakeQtVarsFile
|
|---|
| 53 | exch $1 ; QTDIR
|
|---|
| 54 | exch
|
|---|
| 55 | exch $3 ; vs version
|
|---|
| 56 | push $0 ; file handle
|
|---|
| 57 | push $2
|
|---|
| 58 | push $4
|
|---|
| 59 |
|
|---|
| 60 | push $3
|
|---|
| 61 | call GetMkSpec
|
|---|
| 62 | pop $2
|
|---|
| 63 |
|
|---|
| 64 | ClearErrors
|
|---|
| 65 | FileOpen $0 "$1\bin\qtvars.bat" w
|
|---|
| 66 | IfErrors done
|
|---|
| 67 | FileWrite $0 "@echo off$\r$\n"
|
|---|
| 68 | FileWrite $0 "rem$\r$\n"
|
|---|
| 69 | FileWrite $0 "rem This file is generated$\r$\n"
|
|---|
| 70 | FileWrite $0 "rem$\r$\n"
|
|---|
| 71 | FileWrite $0 "$\r$\n"
|
|---|
| 72 | FileWrite $0 "echo Setting up a Qt environment...$\r$\n"
|
|---|
| 73 | FileWrite $0 "echo -- QTDIR set to $1$\r$\n"
|
|---|
| 74 | FileWrite $0 "echo -- Added $1\bin to PATH$\r$\n"
|
|---|
| 75 | FileWrite $0 "echo -- QMAKESPEC set to $2$\r$\n"
|
|---|
| 76 | FileWrite $0 "$\r$\n"
|
|---|
| 77 | FileWrite $0 "set QTDIR=$1$\r$\n"
|
|---|
| 78 | FileWrite $0 "set PATH=$1\bin;%PATH%$\r$\n"
|
|---|
| 79 | FileWrite $0 "set QMAKESPEC=$2$\r$\n"
|
|---|
| 80 |
|
|---|
| 81 | call IsExpressVersion
|
|---|
| 82 | pop $4
|
|---|
| 83 | strcmp $4 "" noExpressVersion
|
|---|
| 84 | FileWrite $0 "$\r$\n"
|
|---|
| 85 | FileWrite $0 'regedit /e S$$D$$K$$ "HKEY_LOCAL_MACHINE\Software\Microsoft\MicrosoftSDK"$\r$\n'
|
|---|
| 86 | Filewrite $0 'if not exist S$$D$$K$$ goto ENDSDK\r$\n'
|
|---|
| 87 | FileWrite $0 'find "Install Dir" < S$$D$$K$$ > D$$I$$R$$$\r$\n'
|
|---|
| 88 | FileWrite $0 'del S$$D$$K$$$\r$\n'
|
|---|
| 89 | FileWrite $0 'for /f "tokens=2 delims==" %%i in (D$$I$$R$$) do call %%i\setenv$\r$\n'
|
|---|
| 90 | FileWrite $0 'del D$$I$$R$$$\r$\n'
|
|---|
| 91 | Filewrite $0 ':ENDSDK\r$\n'
|
|---|
| 92 | noExpressVersion:
|
|---|
| 93 |
|
|---|
| 94 | push $3
|
|---|
| 95 | call GetVSVarsFile
|
|---|
| 96 | pop $2
|
|---|
| 97 | strcmp $2 "" novsvars
|
|---|
| 98 | FileWrite $0 "$\r$\n"
|
|---|
| 99 | FileWrite $0 'if not "%1"=="vsvars" goto END$\r$\n'
|
|---|
| 100 | FileWrite $0 'call "$2"$\r$\n'
|
|---|
| 101 | FileWrite $0 ":END$\r$\n"
|
|---|
| 102 |
|
|---|
| 103 | FileWrite $0 "$\r$\n"
|
|---|
| 104 | FileWrite $0 'if not "%1"=="vsstart" goto ENDSTARTVS$\r$\n'
|
|---|
| 105 | FileWrite $0 'call "$2"$\r$\n'
|
|---|
| 106 |
|
|---|
| 107 | strcmp $3 "vc60" vc60startup
|
|---|
| 108 | FileWrite $0 "devenv /useenv$\r$\n"
|
|---|
| 109 | Goto donevsstartup
|
|---|
| 110 | vc60startup:
|
|---|
| 111 | FileWrite $0 "msdev /useenv$\r$\n"
|
|---|
| 112 | donevsstartup:
|
|---|
| 113 |
|
|---|
| 114 | FileWrite $0 ":ENDSTARTVS$\r$\n"
|
|---|
| 115 |
|
|---|
| 116 | novsvars:
|
|---|
| 117 | FileWrite $0 "$\r$\n"
|
|---|
| 118 | FileClose $0
|
|---|
| 119 | done:
|
|---|
| 120 | pop $4
|
|---|
| 121 | pop $2
|
|---|
| 122 | pop $0
|
|---|
| 123 | pop $3
|
|---|
| 124 | pop $1
|
|---|
| 125 | FunctionEnd
|
|---|
| 126 |
|
|---|
| 127 | Function GetMkSpec
|
|---|
| 128 | exch $0
|
|---|
| 129 | StrCmp $0 "mingw" MINGW
|
|---|
| 130 | StrCmp $0 "vs2005" VS2005
|
|---|
| 131 | StrCmp $0 "vs2003" VS2003
|
|---|
| 132 | StrCmp $0 "vs2002" VS2002
|
|---|
| 133 | StrCmp $0 "vc60" VS60
|
|---|
| 134 | StrCmp $0 "icc" ICC
|
|---|
| 135 |
|
|---|
| 136 | MINGW:
|
|---|
| 137 | pop $0
|
|---|
| 138 | push "win32-g++"
|
|---|
| 139 | goto done
|
|---|
| 140 |
|
|---|
| 141 | VS2005:
|
|---|
| 142 | pop $0
|
|---|
| 143 | push "win32-msvc2005"
|
|---|
| 144 | goto done
|
|---|
| 145 |
|
|---|
| 146 | VS2003:
|
|---|
| 147 | pop $0
|
|---|
| 148 | push "win32-msvc.net"
|
|---|
| 149 | goto done
|
|---|
| 150 |
|
|---|
| 151 | VS2002:
|
|---|
| 152 | pop $0
|
|---|
| 153 | push "win32-msvc.net"
|
|---|
| 154 | goto done
|
|---|
| 155 |
|
|---|
| 156 | VS60:
|
|---|
| 157 | pop $0
|
|---|
| 158 | push "win32-msvc"
|
|---|
| 159 | goto done
|
|---|
| 160 |
|
|---|
| 161 | ICC:
|
|---|
| 162 | pop $0
|
|---|
| 163 | push "win32-icc"
|
|---|
| 164 | goto done
|
|---|
| 165 |
|
|---|
| 166 | done:
|
|---|
| 167 | FunctionEnd
|
|---|
| 168 |
|
|---|
| 169 | !define AD_COMPILER_NAME_VS2005 "Visual Studio .NET 2005"
|
|---|
| 170 | !define AD_COMPILER_NAME_VS2005_EXPRESS "Visual C++ 2005 Express Edition"
|
|---|
| 171 | !define AD_COMPILER_NAME_VS2003 "Visual Studio .NET 2003"
|
|---|
| 172 | !define AD_COMPILER_NAME_VS2002 "Visual Studio .NET 2002"
|
|---|
| 173 | !define AD_COMPILER_NAME_VC60 "Visual Studio 6.0"
|
|---|
| 174 | !define AD_COMPILER_NAME_ICC "Intel C++ Compiler"
|
|---|
| 175 | !define AD_COMPILER_NAME_MINGW "MinGW (Must be in PATH!)"
|
|---|
| 176 |
|
|---|
| 177 | Function GetShortCompilerName
|
|---|
| 178 | exch $0
|
|---|
| 179 |
|
|---|
| 180 | strcmp "$0" "${AD_COMPILER_NAME_VS2005}" 0 +3
|
|---|
| 181 | strcpy $0 "vs2005"
|
|---|
| 182 | goto done
|
|---|
| 183 |
|
|---|
| 184 | strcmp "$0" "${AD_COMPILER_NAME_VS2005_EXPRESS}" 0 +3
|
|---|
| 185 | strcpy $0 "vs2005"
|
|---|
| 186 | goto done
|
|---|
| 187 |
|
|---|
| 188 | strcmp "$0" "${AD_COMPILER_NAME_VS2003}" 0 +3
|
|---|
| 189 | strcpy $0 "vs2003"
|
|---|
| 190 | goto done
|
|---|
| 191 |
|
|---|
| 192 | strcmp "$0" "${AD_COMPILER_NAME_VS2002}" 0 +3
|
|---|
| 193 | strcpy $0 "vs2002"
|
|---|
| 194 | goto done
|
|---|
| 195 |
|
|---|
| 196 | strcmp "$0" "${AD_COMPILER_NAME_VC60}" 0 +3
|
|---|
| 197 | strcpy $0 "vc60"
|
|---|
| 198 | goto done
|
|---|
| 199 |
|
|---|
| 200 | strcmp "$0" "${AD_COMPILER_NAME_ICC}" 0 +3
|
|---|
| 201 | strcpy $0 "icc"
|
|---|
| 202 | goto done
|
|---|
| 203 |
|
|---|
| 204 | strcmp "$0" "${AD_COMPILER_NAME_MINGW}" 0 +3
|
|---|
| 205 | strcpy $0 "mingw"
|
|---|
| 206 | goto done
|
|---|
| 207 |
|
|---|
| 208 | strcpy $0 "" ;this is bad!
|
|---|
| 209 |
|
|---|
| 210 | done:
|
|---|
| 211 | exch $0
|
|---|
| 212 | FunctionEnd
|
|---|
| 213 |
|
|---|
| 214 | Function IsExpressVersion
|
|---|
| 215 | push $0
|
|---|
| 216 | ReadRegStr $0 HKLM "Software\Microsoft\VCExpress\8.0" "InstallDir"
|
|---|
| 217 | ClearErrors
|
|---|
| 218 | exch $0
|
|---|
| 219 | FunctionEnd
|
|---|
| 220 |
|
|---|
| 221 | Function AutoDetectCompilers
|
|---|
| 222 | push $0
|
|---|
| 223 | push $1
|
|---|
| 224 |
|
|---|
| 225 | strcpy $1 ""
|
|---|
| 226 |
|
|---|
| 227 | ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\8.0" "InstallDir"
|
|---|
| 228 | strcmp $0 "" +2
|
|---|
| 229 | strcpy $1 "$1${AD_COMPILER_NAME_VS2005}|"
|
|---|
| 230 |
|
|---|
| 231 | ReadRegStr $0 HKLM "Software\Microsoft\VCExpress\8.0" "InstallDir"
|
|---|
| 232 | strcmp $0 "" +2
|
|---|
| 233 | strcpy $1 "$1${AD_COMPILER_NAME_VS2005_EXPRESS}|"
|
|---|
| 234 |
|
|---|
| 235 | ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\7.1" "InstallDir"
|
|---|
| 236 | strcmp $0 "" +2
|
|---|
| 237 | strcpy $1 "$1${AD_COMPILER_NAME_VS2003}|"
|
|---|
| 238 |
|
|---|
| 239 | ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\7.0" "InstallDir"
|
|---|
| 240 | strcmp $0 "" +2
|
|---|
| 241 | strcpy $1 "$1${AD_COMPILER_NAME_VS2002}|"
|
|---|
| 242 |
|
|---|
| 243 | ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\6.0\Setup" "VsCommonDir"
|
|---|
| 244 | strcmp $0 "" +2
|
|---|
| 245 | strcpy $1 "$1${AD_COMPILER_NAME_VC60}|"
|
|---|
| 246 |
|
|---|
| 247 | ReadRegStr $0 HKLM "Software\Intel\Compilers\C++\80" "Major Version"
|
|---|
| 248 | strcmp $0 "" +2
|
|---|
| 249 | strcpy $1 "$1${AD_COMPILER_NAME_ICC}|"
|
|---|
| 250 |
|
|---|
| 251 | strcpy $1 "$1${AD_COMPILER_NAME_MINGW}"
|
|---|
| 252 |
|
|---|
| 253 | exch
|
|---|
| 254 | pop $0
|
|---|
| 255 | exch $1
|
|---|
| 256 | FunctionEnd
|
|---|
| 257 |
|
|---|
| 258 | Function GetVSVarsFile
|
|---|
| 259 | exch $1
|
|---|
| 260 | push $0
|
|---|
| 261 |
|
|---|
| 262 | StrCmp $1 "vs2005" VS2005
|
|---|
| 263 | StrCmp $1 "vs2003" VS2003
|
|---|
| 264 | StrCmp $1 "vs2002" VS2002
|
|---|
| 265 | StrCmp $1 "vc60" VS60
|
|---|
| 266 |
|
|---|
| 267 | push "" ;empty string if not found
|
|---|
| 268 | goto done
|
|---|
| 269 |
|
|---|
| 270 | VS2005:
|
|---|
| 271 | ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\8.0\Setup\VS" "ProductDir"
|
|---|
| 272 | StrCmp $0 "" +1 foundVSDir ; found msvc.net 2005
|
|---|
| 273 |
|
|---|
| 274 | ReadRegStr $0 HKLM "Software\Microsoft\VCExpress\8.0\Setup\VS" "ProductDir"
|
|---|
| 275 | StrCmp $0 "" +1 foundVSDir ; found msvc.net 2005 epress
|
|---|
| 276 |
|
|---|
| 277 | VS2003:
|
|---|
| 278 | ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\7.1\Setup\VS" "ProductDir"
|
|---|
| 279 | StrCmp $0 "" +1 foundVSDir ; found msvc.net 2003
|
|---|
| 280 |
|
|---|
| 281 | VS2002:
|
|---|
| 282 | ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\7.0\Setup\VS" "ProductDir"
|
|---|
| 283 | StrCmp $0 "" +1 foundVSDir ; found msvc.net 2002
|
|---|
| 284 |
|
|---|
| 285 | VS60:
|
|---|
| 286 | ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\6.0\Setup\Microsoft Visual C++" "ProductDir"
|
|---|
| 287 | StrCmp $0 "" +1 foundVCDir ; found msvc 6.0
|
|---|
| 288 |
|
|---|
| 289 | push "" ;empty string if not found
|
|---|
| 290 | goto done
|
|---|
| 291 |
|
|---|
| 292 | foundVSDir:
|
|---|
| 293 | push "$0\Common7\Tools\vsvars32.bat"
|
|---|
| 294 | goto done
|
|---|
| 295 |
|
|---|
| 296 | foundVCDir:
|
|---|
| 297 | push "$0\bin\vcvars32.bat"
|
|---|
| 298 |
|
|---|
| 299 | done:
|
|---|
| 300 | exch
|
|---|
| 301 | pop $0
|
|---|
| 302 | exch
|
|---|
| 303 | pop $1
|
|---|
| 304 | FunctionEnd
|
|---|
| 305 |
|
|---|
| 306 | !endif ;QTENV_INCLUDE
|
|---|