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