Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- REM ****************************************
- REM * File: QBuilder script *
- REM * Author: Marcelo Mariano *
- REM * E-mail: marcelo.hs.mariano@gmail.com *
- REM ****************************************
- setlocal enableDelayedExpansion
- set TARGET="%~1"
- set TARGETS=prepare build buildAll cleanPrepare cleanBuild cleanAll
- for %%a in (%TARGETS%) do (
- if "%~1"=="%%a" goto :%~1
- )
- goto :usage
- :preConfigure
- call :configureLicense
- call :configurePlatform
- call :configureProfile
- call :configureDirectories
- call :configureDependenciesDirectories
- call :configureOpenGL
- call :configureSSL
- call :configureCompilerDirectories
- call :exportPath
- call :storeOptions
- goto :eof
- :configure
- set commandLine=-platform %PLATFORM%
- set commandLine=%commandLine% -prefix %PREFIX%
- set commandLine=%commandLine% -%LICENSE% -confirm-license
- set commandLine=%commandLine% -%PROFILE% -%DEBUG_INFO%
- set commandLine=%commandLine% -nomake tests -nomake examples -no-compile-examples
- set commandLine=%commandLine% -opengl %OPENGL_SUPPORT%
- set commandLine=%commandLine% -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-doubleconversion
- set commandLine=%commandLine% -%OPENSSL_LINK%
- REM Uncomment the line bellow to use SQL drivers for your databases
- REM SET sqldrivers=-qt-sql-mysql -qt-sql-psql -qt-sql-odbc -qt-sql-tds -qt-sql-db2 -qt-sql-sqlite -qt-sql-sqlite2 -qt-sql-ibase
- set commandLine=%commandLine% %INCLUDE% %LIBRARY% %LIBS%
- echo call configure %commandLine%
- goto :eof
- :configureLicense
- call :switch license chooseLicense "Opensource, Commercial"
- goto :eof
- :chooseLicense1
- set LICENSE=opensource
- goto :eof
- :chooseLicense2
- set LICENSE=commercial
- goto :eof
- goto :eof
- :configurePlatform
- call :switch platform choosePlatform "MinGW MSVC"
- goto :eof
- :choosePlatform1:
- set PLATFORM=win32-g++
- set MAKE=mingw32-make
- goto :eof
- :choosePlatform2:
- set PLATFORM=win32-msvc2013
- set MAKE=nmake
- goto :eof
- goto :eof
- :configureProfile
- set PROFILE=static
- set DEBUG_INFO=release
- goto :eof
- :configureDirectories
- call :input "Qt sources directory:" QT_SRC_ROOT
- call :input "Platform toolkit directory:" MAKE_DIR
- set QT_BASE_BIN=%QT_SRC_ROOT%\qtbase\bin
- set QT_GNU_WIN32_BIN=%QT_SRC_ROOT%\gnuwin32\bin
- call :input "Installation directory:" PREFIX
- goto :eof
- :configureDependenciesDirectories
- call :input "DirectX SDK directory:" DIRECTX_SDK_DIR
- call :input "ICU directory:" ICU
- call :input "OpenSSL directory:" OPENSSL
- goto :eof
- :configureOpenGL
- call :switch OpenGL chooseOpenGL "Dynamic, Desktop, ES2"
- goto :eof
- :chooseOpenGL1
- set OPENGL_SUPPORT=dynamic
- goto :eof
- :chooseOpenGL2
- set OPENGL_SUPPORT=desktop
- goto :eof
- :chooseOpenGL3
- set OPENGL_SUPPORT=es2
- goto :eof
- goto :eof
- :configureSSL
- call :switch OpenSSL chooseOpenSSL "Linked Dynamic"
- goto :eof
- :chooseOpenSSL1
- set OPENSSL_LINK=openssl-linked
- goto :eof
- :chooseOpenSSL2
- set OPENSSL_LINK=openssl
- goto :eof
- goto :eof
- :configureCompilerDirectories
- set INCLUDE=-I "%ICU%\include" -I "%OPENSSL%\include"
- set LIBRARY=-L "%ICU%\lib" -L "%OPENSSL%\lib"
- set LIBS=-l ssl -l crypto
- goto :eof
- :exportPath
- set PATH=%MAKE_DIR%;%DIRECTX_SDK_DIR%;%QT_BASE_BIN%;%QT_GNU_WIN32_BIN%;%PATH%
- goto :eof
- :readVar
- if exist "%~1" (
- for /f %%a in ('type "%~1"') do set "%~2=%%a"
- )
- goto :eof
- :loadOptions
- call :readVar "%temp%\env.txt" PATH
- call :readVar "%temp%\make.txt" MAKE
- call :readVar "%temp%\source.txt" QT_SRC_ROOT
- goto :eof
- :storeOptions
- echo %QT_SRC_ROOT% > "%temp%\source.txt"
- echo %PATH% > "%temp%\env.txt"
- echo %MAKE% > "%temp%\make.txt"
- goto :eof
- :usage
- echo.
- echo Usage: runConfigure [command]
- echo.
- echo Commands:
- echo.
- echo prepare - runs the "configure" script to generate the makefile to build Qt.
- echo build - compile the source codes.
- echo buildAll - calls "prepare" and "build" in one step.
- echo cleanPrepare - clean all the configuration generated by the "prepare" step.
- echo cleanBuild - clean all files generated by the "build" step.
- echo cleanAll - calls "clean" and "cleanBuild" in one step.
- exit /b 1
- goto :eof
- REM call :switch <list title> <handler label prefix> option1 [option2 [option3 [...] ]
- :switch
- set choices=
- set /a i=0
- echo Choose one option for "%~1"
- echo.
- for %%a in (%~3) do (
- set /a i+=1
- set choices=!choices!!i!
- if /i !i! equ 1 (
- echo !i!. %%a ^(default^)
- ) else (
- echo !i!. %%a
- )
- )
- echo.
- echo Enter your choice:
- choice /c %choices% /n /d 1 /t 10 /m "- "
- call :%~2%ERRORLEVEL%
- goto :eof
- :input
- REM call :input <prompt> <result var>
- echo %~1
- set /p %~2="- "
- goto :eof
- :insideSourceDirectory
- pushd %QT_SRC_ROOT%
- call %*
- popd
- goto :eof
- :make
- call :loadOptions
- %MAKE% %~1
- goto :eof
- :prepare
- call :preConfigure
- call :insideSourceDirectory :configure
- goto :eof
- :build
- call :insideSourceDirectory :make install
- goto :eof
- :buildAll
- call :prepare
- call :build
- goto :eof
- :cleanPrepare
- call :insideSourceDirectory :make distclean
- goto :eof
- :cleanBuild
- call :insideSourceDirectory :make clean
- goto :eof
- :cleanAll
- call :cleanPrepare
- call :cleanBuild
- goto :eof
Add Comment
Please, Sign In to add comment