2018-07-25 09:53:51 +00:00
|
|
|
rem Run from Qt command prompt with working directory set to root of repo
|
|
|
|
|
|
|
|
setlocal enableDelayedExpansion
|
|
|
|
@echo off
|
|
|
|
|
|
|
|
set BUILD_CONFIG=%1
|
|
|
|
set ARCH=%2
|
|
|
|
|
2018-07-29 02:56:08 +00:00
|
|
|
rem Convert to lower case for windeployqt
|
|
|
|
if /I "%BUILD_CONFIG%"=="debug" (
|
|
|
|
set BUILD_CONFIG=debug
|
|
|
|
) else (
|
|
|
|
if /I "%BUILD_CONFIG%"=="release" (
|
|
|
|
set BUILD_CONFIG=release
|
|
|
|
) else (
|
2018-08-01 01:14:04 +00:00
|
|
|
if /I "%BUILD_CONFIG%"=="signed-release" (
|
|
|
|
set BUILD_CONFIG=release
|
|
|
|
set SIGN=1
|
|
|
|
) else (
|
|
|
|
echo Invalid build configuration
|
|
|
|
exit /b 1
|
|
|
|
)
|
2018-07-25 09:53:51 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2018-07-29 02:43:40 +00:00
|
|
|
if /I "%ARCH%" NEQ "x86" (
|
|
|
|
if /I "%ARCH%" NEQ "x64" (
|
2018-07-25 09:53:51 +00:00
|
|
|
echo Invalid build architecture
|
2018-07-29 02:56:08 +00:00
|
|
|
exit /b 1
|
2018-07-25 09:53:51 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2018-07-26 02:52:58 +00:00
|
|
|
set VS_PATH=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community
|
2018-08-01 01:14:04 +00:00
|
|
|
set SIGNTOOL_PARAMS=sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /sha1 1B3C676E831A94EC0327C3347EB32C68C26B3A67 /v
|
2018-07-26 02:52:58 +00:00
|
|
|
|
|
|
|
call "%VS_PATH%\VC\Auxiliary\Build\vcvarsall.bat" %ARCH%
|
2018-07-25 09:53:51 +00:00
|
|
|
if !ERRORLEVEL! NEQ 0 goto Error
|
|
|
|
|
|
|
|
set BUILD_ROOT=%cd%\build
|
|
|
|
set SOURCE_ROOT=%cd%
|
|
|
|
set BUILD_FOLDER=%BUILD_ROOT%\build-%ARCH%-%BUILD_CONFIG%
|
|
|
|
set DEPLOY_FOLDER=%BUILD_ROOT%\deploy-%ARCH%-%BUILD_CONFIG%
|
|
|
|
set INSTALLER_FOLDER=%BUILD_ROOT%\installer-%ARCH%-%BUILD_CONFIG%
|
|
|
|
|
|
|
|
echo Cleaning output directories
|
|
|
|
rmdir /s /q %DEPLOY_FOLDER%
|
|
|
|
rmdir /s /q %BUILD_FOLDER%
|
|
|
|
rmdir /s /q %INSTALLER_FOLDER%
|
|
|
|
mkdir %BUILD_ROOT%
|
|
|
|
mkdir %DEPLOY_FOLDER%
|
|
|
|
mkdir %BUILD_FOLDER%
|
|
|
|
mkdir %INSTALLER_FOLDER%
|
|
|
|
|
|
|
|
echo Configuring the project
|
|
|
|
pushd %BUILD_FOLDER%
|
|
|
|
qmake %SOURCE_ROOT%\moonlight-qt.pro
|
|
|
|
if !ERRORLEVEL! NEQ 0 goto Error
|
|
|
|
popd
|
|
|
|
|
|
|
|
echo Compiling Moonlight in %BUILD_CONFIG% configuration
|
|
|
|
pushd %BUILD_FOLDER%
|
|
|
|
nmake %BUILD_CONFIG%
|
|
|
|
if !ERRORLEVEL! NEQ 0 goto Error
|
|
|
|
popd
|
|
|
|
|
|
|
|
echo Copying DLL dependencies
|
|
|
|
copy %SOURCE_ROOT%\libs\windows\lib\%ARCH%\*.dll %DEPLOY_FOLDER%
|
|
|
|
if !ERRORLEVEL! NEQ 0 goto Error
|
|
|
|
|
|
|
|
echo Deploying Qt dependencies
|
2018-07-26 02:16:06 +00:00
|
|
|
windeployqt.exe --dir %DEPLOY_FOLDER% --%BUILD_CONFIG% --qmldir %SOURCE_ROOT%\app\gui --no-angle --no-opengl-sw --no-compiler-runtime %BUILD_FOLDER%\app\%BUILD_CONFIG%\Moonlight.exe
|
2018-07-25 09:53:51 +00:00
|
|
|
if !ERRORLEVEL! NEQ 0 goto Error
|
|
|
|
|
|
|
|
echo Harvesting files for WiX
|
2018-08-01 01:14:04 +00:00
|
|
|
"%WIX%\bin\heat" dir %DEPLOY_FOLDER% -srd -sfrag -ag -sw5150 -cg MoonlightDependencies -var var.SourceDir -dr INSTALLFOLDER -out %BUILD_FOLDER%\Dependencies.wxs
|
2018-07-25 09:53:51 +00:00
|
|
|
if !ERRORLEVEL! NEQ 0 goto Error
|
|
|
|
|
|
|
|
echo Copying application binary to deployment directory
|
|
|
|
copy %BUILD_FOLDER%\app\%BUILD_CONFIG%\Moonlight.exe %DEPLOY_FOLDER%
|
|
|
|
if !ERRORLEVEL! NEQ 0 goto Error
|
|
|
|
|
2018-08-01 01:14:04 +00:00
|
|
|
if "%SIGN%"=="1" (
|
|
|
|
echo Signing deployed binaries
|
|
|
|
for /r "%DEPLOY_FOLDER%" %%f in (*.dll *.exe) do (
|
|
|
|
signtool %SIGNTOOL_PARAMS% %%f
|
|
|
|
if !ERRORLEVEL! NEQ 0 goto Error
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2018-07-25 09:53:51 +00:00
|
|
|
echo Building installer
|
2018-07-26 02:52:58 +00:00
|
|
|
set VCREDIST_INSTALLER=%VS_PATH%\VC\Redist\MSVC\14.14.26405\vcredist_%ARCH%.exe
|
2018-07-26 02:33:09 +00:00
|
|
|
msbuild %SOURCE_ROOT%\wix\Moonlight.sln /p:Configuration=%BUILD_CONFIG% /p:Platform=%ARCH%
|
2018-07-25 09:53:51 +00:00
|
|
|
if !ERRORLEVEL! NEQ 0 goto Error
|
|
|
|
|
2018-08-01 01:14:04 +00:00
|
|
|
if "%SIGN%"=="1" (
|
|
|
|
echo Signing installer binary
|
|
|
|
"%WIX%\bin\insignia" -ib %INSTALLER_FOLDER%\MoonlightSetup.exe -o %BUILD_FOLDER%\engine.exe
|
|
|
|
if !ERRORLEVEL! NEQ 0 goto Error
|
|
|
|
signtool %SIGNTOOL_PARAMS% %BUILD_FOLDER%\engine.exe
|
|
|
|
if !ERRORLEVEL! NEQ 0 goto Error
|
|
|
|
"%WIX%\bin\insignia" -ab %BUILD_FOLDER%\engine.exe %INSTALLER_FOLDER%\MoonlightSetup.exe -o %INSTALLER_FOLDER%\MoonlightSetup.exe
|
|
|
|
if !ERRORLEVEL! NEQ 0 goto Error
|
|
|
|
signtool %SIGNTOOL_PARAMS% %INSTALLER_FOLDER%\MoonlightSetup.exe
|
|
|
|
if !ERRORLEVEL! NEQ 0 goto Error
|
|
|
|
)
|
|
|
|
|
2018-07-29 06:59:20 +00:00
|
|
|
if /i "%APPVEYOR%"=="true" (
|
|
|
|
echo Pushing artifacts
|
|
|
|
appveyor PushArtifact %INSTALLER_FOLDER%\MoonlightSetup.exe -FileName MoonlightSetup-%ARCH%-%BUILD_CONFIG%.exe
|
2018-08-01 01:14:04 +00:00
|
|
|
if !ERRORLEVEL! NEQ 0 goto Error
|
2018-07-29 06:59:20 +00:00
|
|
|
)
|
|
|
|
|
2018-07-25 09:53:51 +00:00
|
|
|
echo Build successful!
|
|
|
|
exit /b 0
|
|
|
|
|
|
|
|
:Error
|
|
|
|
echo Build failed!
|
2018-07-29 02:43:40 +00:00
|
|
|
exit /b !ERRORLEVEL!
|