]> git.sesse.net Git - casparcg/blob - build-scripts/build-windows.bat
build scripts
[casparcg] / build-scripts / build-windows.bat
1 @echo off
2
3 :: Fail early if environment not set
4 if not defined BUILD_VCVARSALL exit /b 1
5 if not defined BUILD_ARCHIVE_NAME exit /b 1
6 if not defined BUILD_7ZIP exit /b 1
7
8 :: Clean and enter shadow build folder
9 echo Cleaning...
10 cd .. || goto :error
11 if exist bin rmdir bin /s /q || goto :error
12 if exist ipch rmdir ipch /s /q || goto :error
13 if exist tmp rmdir tmp /s /q || goto :error
14 if exist build rmdir build /s /q || goto :error
15 mkdir build || goto :error
16
17 :: Unpack archived dependencies
18 echo Unpacking archived dependencies...
19 "%BUILD_7ZIP%" x -y -odependencies dependencies\cef.7z || goto :error
20
21 :: Setup VC++ environment
22 echo Setting up VC++...
23 call "%BUILD_VCVARSALL%" x86 || goto :error
24
25 :: Build with MSBuild
26 echo Building...
27 msbuild /t:Clean /p:Configuration=Release || goto :error
28 msbuild /p:Configuration=Release || goto :error
29
30 :: Create server folder to later zip
31 cd build || goto :error
32 set SERVER_FOLDER=CasparCG Server
33 if exist "%SERVER_FOLDER%" rmdir "%SERVER_FOLDER%" /s /q || goto :error
34 mkdir "%SERVER_FOLDER%" || goto :error
35
36 :: Copy media files
37 echo Copying media...
38 xcopy ..\deploy\Server "%SERVER_FOLDER%\Server" /E /I /Y || goto :error
39 xcopy ..\deploy\Wallpapers "%SERVER_FOLDER%\Wallpapers" /E /I /Y || goto :error
40 copy ..\deploy\CasparCG_Server_2.0-brochure.pdf "%SERVER_FOLDER%" || goto :error
41
42 :: Copy binaries
43 echo Copying binaries...
44 copy ..\bin\Release\* "%SERVER_FOLDER%\Server" || goto :error
45 xcopy ..\bin\Release\locales "%SERVER_FOLDER%\Server\locales" /E /I /Y || goto :error
46
47 :: Copy documentation
48 echo Copying documentation...
49 copy ..\CHANGES.txt "%SERVER_FOLDER%" || goto :error
50 copy ..\LICENSE.txt "%SERVER_FOLDER%" || goto :error
51 copy ..\README.txt "%SERVER_FOLDER%" || goto :error
52
53 :: Create zip file
54 echo Creating zip...
55 "%BUILD_7ZIP%" a "%BUILD_ARCHIVE_NAME%.zip" "%SERVER_FOLDER%" || goto :error
56
57 :: Skip exiting with failure
58 goto :EOF
59
60 :error
61 exit /b %errorlevel%