Last active
August 29, 2015 14:06
-
-
Save Zren/9b5939b16b7f8ea5ab21 to your computer and use it in GitHub Desktop.
Quassel Build Script
This file contains 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
@rem @echo off | |
@rem --------- | |
@rem Variables | |
@rem --------- | |
@rem Input/Ouput Root Directories | |
set "source_dir=C:\Users\Admin\Code\Git\quassel" | |
set "build_dir=C:\Users\Admin\Code\Git\quassel\build" | |
@rem Paths | |
set "vs_dir=C:\Program Files (x86)\Microsoft Visual Studio 10.0" | |
set "postgres_dir=C:\Program Files (x86)\PostgreSQL\8.4" | |
set "qt_dir=C:\Qt\4.8.2" | |
set "openssl_dir=C:\OpenSSL-Win32\" | |
set "platform_sdk_dir=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A" | |
set "directx_sdk_dir=C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)" | |
set "git_dir=C:\Program Files (x86)\Git" | |
set "cmake_dir=E:\Programs\cmake" | |
@rem Variables | |
set "QMAKESPEC=win32-msvc2010" | |
set "nmake_args=" | |
@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 "%postgres_dir%" | |
call :setupDependency "%openssl_dir%" bin include | |
set "INCLUDE=%openssl_dir%\lib\VC\static;%INCLUDE | |
call :setupDependency "%cmake_dir%" bin | |
call :setupDependency "%git_dir%" bin lib | |
call :setupDependency "%directx_sdk_dir%" lib include | |
call :setupDependency "%platform_sdk_dir%" | |
call :setupDependency "%qt_dir%" | |
call "%vs_dir%\VC\vcvarsall.bat" | |
@rem @echo "PATH = %PATH%" | |
@rem @echo "INCLUDE = %INCLUDE%" | |
@rem @echo "LIB = %LIB%" | |
echo %build_dir% | |
@rem Setting up Build Dir | |
if exist %build_dir% ( | |
@rem Clean build directory. | |
@rem del %build_dir%\*.* | |
@rem WinXP require the path as the first argument with the optional flags comming after. | |
@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 %nmake_args% | |
echo | |
if %ERRORLEVEL% NEQ 0 ( | |
echo "" | |
set /p retryNmake="Reattempt nmake (verbose=1) (y / n)?" | |
echo "" | |
if /I "%retryNmake%" == "y" ( | |
set retryNmake= | |
set "nmake_args=verbose=1" | |
goto:nmakeQuassel | |
) | |
) | |
@rem Open build directory in Explorer | |
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