Created
February 22, 2013 16:03
-
-
Save Zren/5014449 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @echo off | |
| @set source_dir=C:\dev\quassel | |
| @set build_dir=c:\dev\quassel-build | |
| @REM ----------- | |
| @REM Directories | |
| @REM ----------- | |
| @if "%PROGRAMFILES(X86)%" == "" ( | |
| @set "program_dir=%PROGRAMFILES%" | |
| ) else ( | |
| @REM default to x86 if using 64 bit OS | |
| @set "program_dir=%PROGRAMFILES(X86)%" | |
| ) | |
| @set vs_dir=%program_dir%\Microsoft Visual Studio 11.0 | |
| @set postgres_dir=%program_dir%\PostgreSQL\8.4 | |
| @set qt_dir=C:\Qt\4.8.2 | |
| @set openssl_dir=C:\OpenSSL-Win32\ | |
| @set directx_sdk_dir=%program_dir%\Microsoft DirectX SDK (June 2010) | |
| @set git_dir=C:\Program Files (x86)\Git | |
| @REM --------- | |
| @REM Variables | |
| @REM --------- | |
| @set QMAKESPEC=win32-msvc2010 | |
| @REM --- | |
| @REM Git | |
| @REM --- | |
| @set quassel_repo_url=git://gitorious.org/quassel/quassel.git | |
| @REM git pull from origin? (0 = No, 1 = Yes) | |
| @set git_pull_flag=0 | |
| @REM ------------------------------------------------- | |
| @REM Build flags (remove the @REM in front of desired) | |
| @REM ------------------------------------------------- | |
| @REM --- Static --- | |
| @REM @set cmake_build_flags=-DSTATIC=ON -DWANT_CORE=ON -DWANT_QTCLIENT=ON -DWANT_MONO=ON -DWITH_PHONON=OFF -DCMAKE_BUILD_TYPE=Release -DWITH_WEBKIT=OFF -DLINK_EXTRA=crypt32 | |
| @REM --- Shared --- | |
| @REM @set cmake_build_flags=-DWANT_CORE=ON -DWANT_QTCLIENT=ON -DWANT_MONO=ON -DWITH_PHONON=ON -DWITH_WEBKIT=ON -DCMAKE_BUILD_TYPE=Release -DLINK_EXTRA=crypt32 | |
| @REM --- Custom --- | |
| @set cmake_build_flags=-DWANT_CORE=ON -DWANT_QTCLIENT=ON -DWANT_MONO=ON -DWITH_PHONON=ON -DWITH_WEBKIT=ON -DLINK_EXTRA=crypt32 -DWITH_SYSLOG=OFF -DCMAKE_BUILD_TYPE=Release | |
| @REM -------------------------- | |
| @REM The actual script is below | |
| @REM -------------------------- | |
| :buildQuassel | |
| @REM Setup Building variables | |
| @call :setupDependency "%qt_dir%" | |
| @call :setupDependency "%git_dir%" bin | |
| @call "%vs_dir%\VC\vcvarsall.bat" | |
| @call :setupDependency "%directx_sdk_dir%" lib include | |
| @call :setupDependency "%openssl_dir%" bin include | |
| @set "INCLUDE=%openssl_dir%\lib\VC\static;%INCLUDE%" | |
| @call :setupDependency "%postgres_dir%" | |
| @REM @echo "PATH = %PATH%" | |
| @REM @echo "INCLUDE = %INCLUDE%" | |
| @REM @echo "LIB = %LIB%" | |
| @REM Update source code | |
| @if not exist %source_dir% ( | |
| @REM git clone -b 0.8 %quassel_repo_url% %source_dir% | |
| git clone %quassel_repo_url% %source_dir% | |
| ) | |
| @if %git_pull_flag% == 1 ( | |
| @cd %source_dir% | |
| git pull origin | |
| ) | |
| @REM Setting up Build Dir | |
| @if exist %build_dir% ( | |
| @REM Clean build directory. | |
| @REM del %build_dir%\*.* | |
| echo Y | del \F \S \Q %build_dir%\*.* | |
| ) else ( | |
| mkdir %build_dir% | |
| ) | |
| @REM Build | |
| @cd %build_dir% | |
| cmake -G"NMake Makefiles" %source_dir% %cmake_build_flags% | |
| :nmakeQuassel | |
| nmake verbose=1 | |
| @REM Wait for user input (in case of errors) | |
| echo "" | |
| set /p retryNmake=Reattempt nmake (y / n)? | |
| echo "" | |
| if /I "%retryNmake%" == "y" ( | |
| set retryNmake= | |
| goto:nmakeQuassel | |
| ) | |
| explorer %build_dir% | |
| goto:eof | |
| @REM --------- | |
| @REM Functions | |
| @REM --------- | |
| :setupDependency | |
| @REM Usage: | |
| @REM call :setupDependency <dir> [bin] [include] [lib] | |
| @REM If none of the optional flags is used, then it will be treated as though all are specified (shortcut). | |
| SETLOCAL | |
| @REM Interprete arguments | |
| @if not "%~2" == "" ( | |
| @if "%~2" == "bin" ( | |
| @set b=true | |
| ) else ( if "%~2" == "include" ( | |
| @set i=true | |
| ) else ( if "%~2" == "lib" ( | |
| @set l=true | |
| ))) | |
| if not "%~3" == "" ( | |
| @if "%~3" == "bin" ( | |
| @set b=true | |
| ) else ( if "%~3" == "include" ( | |
| @set i=true | |
| ) else ( if "%~3" == "lib" ( | |
| @set l=true | |
| ))) | |
| if not "%~4" == "" ( | |
| @if "%~4" == "bin" ( | |
| @set b=true | |
| ) else ( if "%~4" == "include" ( | |
| @set i=true | |
| ) else ( if "%~4" == "lib" ( | |
| @set l=true | |
| ))) | |
| ) | |
| ) | |
| ) else ( | |
| @set b=true | |
| @set i=true | |
| @set l=true | |
| ) | |
| @REM Make sure directory specified exists. | |
| @if not "%~1" == "" ( | |
| if not "%b%" == "" ( set "PATH=%~1\bin;%PATH%" ) | |
| if not "%i%" == "" ( set "INCLUDE=%~1\include;%INCLUDE%" ) | |
| if not "%l%" == "" ( set "LIB=%~1\lib;%LIB%" ) | |
| ) | |
| ENDLOCAL | |
| goto:eof |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment