win32: only call 'exit' when building in teamcity
[deb_libcec.git] / support / create-installer.bat
... / ...
CommitLineData
1@echo off
2
3set EXITCODE=1
4
5rem Check for NSIS
6IF EXIST "%ProgramFiles%\NSIS\makensis.exe" (
7 set NSIS="%ProgramFiles%\NSIS\makensis.exe"
8) ELSE IF EXIST "%ProgramFiles(x86)%\NSIS\makensis.exe" (
9 set NSIS="%ProgramFiles(x86)%\NSIS\makensis.exe"
10) ELSE GOTO NONSIS
11
12rem Check for VC10
13IF "%VS100COMNTOOLS%"=="" (
14 set COMPILER10="%ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE\VCExpress.exe"
15) ELSE IF EXIST "%VS100COMNTOOLS%\..\IDE\VCExpress.exe" (
16 set COMPILER10="%VS100COMNTOOLS%\..\IDE\VCExpress.exe"
17) ELSE IF EXIST "%VS100COMNTOOLS%\..\IDE\devenv.exe" (
18 set COMPILER10="%VS100COMNTOOLS%\..\IDE\devenv.exe"
19) ELSE GOTO NOSDK10
20
21del /s /f /q ..\build
22mkdir ..\build
23
24IF EXIST "..\support\p8-usbcec-driver-installer.exe" (
25 copy "..\support\p8-usbcec-driver-installer.exe" "..\build\."
26) ELSE (
27 rem Check for the Windows DDK
28 IF NOT EXIST "C:\WinDDK\7600.16385.1" GOTO NODDK
29 set DDK="C:\WinDDK\7600.16385.1"
30
31 call create-driver-installer.cmd
32)
33
34mkdir ..\build\x64
35
36cd ..\project
37
38rem Skip to libCEC/x86 when we're running on win32
39if "%PROCESSOR_ARCHITECTURE%"=="x86" if "%PROCESSOR_ARCHITEW6432%"=="" goto libcecx86
40
41rem Compile libCEC and cec-client x64
42echo. Cleaning libCEC (x64)
43%COMPILER10% libcec.sln /clean "Release|x64"
44echo. Compiling libCEC (x64)
45%COMPILER10% libcec.sln /build "Release|x64" /project libcec
46echo. Compiling cec-client (x64)
47%COMPILER10% libcec.sln /build "Release|x64" /project testclient
48
49:libcecx86
50rem Compile libCEC and cec-client Win32
51echo. Cleaning libCEC (x86)
52%COMPILER10% libcec.sln /clean "Release|Win32"
53echo. Compiling libCEC (x86)
54%COMPILER10% libcec.sln /build "Release|Win32" /project libcec
55echo. Compiling cec-client (x86)
56%COMPILER10% libcec.sln /build "Release|Win32" /project testclient
57
58rem Check for VC9
59IF "%VS90COMNTOOLS%"=="" (
60 set COMPILER9="%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe"
61) ELSE IF EXIST "%VS90COMNTOOLS%\..\IDE\VCExpress.exe" (
62 set COMPILER9="%VS90COMNTOOLS%\..\IDE\VCExpress.exe"
63) ELSE IF EXIST "%VS90COMNTOOLS%\..\IDE\devenv.exe" (
64 set COMPILER9="%VS90COMNTOOLS%\..\IDE\devenv.exe"
65) ELSE GOTO NOSDK9
66
67rem Skip to libCEC/x86 when we're running on win32
68if "%PROCESSOR_ARCHITECTURE%"=="x86" if "%PROCESSOR_ARCHITEW6432%"=="" goto libcecsharpx86
69
70rem Compile LibCecSharp (x64)
71echo. Cleaning LibCecSharp (x64)
72%COMPILER9% LibCecSharp.Net2.sln /clean "Release|x64"
73echo. Compiling LibCecSharp (x64)
74%COMPILER9% LibCecSharp.sln /build "Release|x64" /project LibCecSharp
75%COMPILER9% LibCecSharp.sln /build "Release|x64" /project CecSharpTester
76%COMPILER9% LibCecSharp.sln /build "Release|x64" /project cec-config-gui
77
78copy ..\build\LibCecSharp.dll ..\build\x64\LibCecSharp.dll
79copy ..\build\CecSharpTester.exe ..\build\x64\CecSharpTester.exe
80copy ..\build\cec-config-gui.exe ..\build\x64\cec-config-gui.exe
81
82:libcecsharpx86
83rem Compile LibCecSharp (x86)
84echo. Cleaning LibCecSharp (x86)
85%COMPILER9% LibCecSharp.sln /clean "Release|x86"
86echo. Compiling LibCecSharp (x86)
87%COMPILER9% LibCecSharp.sln /build "Release|x86" /project LibCecSharp
88%COMPILER9% LibCecSharp.sln /build "Release|x86" /project CecSharpTester
89%COMPILER9% LibCecSharp.sln /build "Release|x86" /project cec-config-gui
90
91:NOSDK9
92rem Clean things up before creating the installer
93del /q /f ..\build\LibCecSharp.pdb
94del /q /f ..\build\CecSharpTester.pdb
95del /q /f ..\build\cec-config-gui.pdb
96del /q /f ..\build\cec-config-gui.vshost.exe.manifest
97del /q /f ..\build\cec-config-gui.vshost.exe
98copy ..\build\cec-client.x64.exe ..\build\x64\cec-client.x64.exe
99del /q /f ..\build\cec-client.x64.exe
100copy ..\build\libcec.x64.dll ..\build\x64\libcec.x64.dll
101del /q /f ..\build\libcec.x64.dll
102copy ..\build\libcec.x64.lib ..\build\x64\libcec.x64.lib
103del /q /f ..\build\libcec.x64.lib
104
105rem Check for sign-binary.cmd, only present on the Pulse-Eight production build system
106rem Calls signtool.exe and signs the DLLs with Pulse-Eight's code signing key
107IF NOT EXIST "..\support\private\sign-binary.cmd" GOTO CREATEINSTALLER
108echo. Signing all binaries
109CALL ..\support\private\sign-binary.cmd ..\build\cec-client.exe
110CALL ..\support\private\sign-binary.cmd ..\build\CecSharpTester.exe
111CALL ..\support\private\sign-binary.cmd ..\build\libcec.dll
112CALL ..\support\private\sign-binary.cmd ..\build\LibCecSharp.dll
113CALL ..\support\private\sign-binary.cmd ..\build\cec-config-gui.exe
114CALL ..\support\private\sign-binary.cmd ..\build\x64\cec-client.x64.exe
115CALL ..\support\private\sign-binary.cmd ..\build\x64\CecSharpTester.exe
116CALL ..\support\private\sign-binary.cmd ..\build\x64\libcec.x64.dll
117CALL ..\support\private\sign-binary.cmd ..\build\x64\LibCecSharp.dll
118CALL ..\support\private\sign-binary.cmd ..\build\x64\cec-config-gui.exe
119
120:CREATEINSTALLER
121echo. Creating the installer
122%NSIS% /V1 /X"SetCompressor /FINAL lzma" "libCEC.nsi"
123
124IF NOT EXIST "..\build\libCEC-installer.exe" GOTO :ERRORCREATINGINSTALLER
125
126rem Sign the installer if sign-binary.cmd exists
127IF EXIST "..\support\private\sign-binary.cmd" (
128 echo. Signing the installer binaries
129 CALL ..\support\private\sign-binary.cmd ..\build\libCEC-installer.exe
130)
131
132IF "%1%"=="" (
133 echo. The installer can be found here: ..\build\libCEC-installer.exe
134) ELSE (
135 move ..\build\libCEC-installer.exe ..\build\libCEC-%1%-installer.exe
136 echo. The installer can be found here: ..\build\libCEC-%1%-installer.exe
137)
138
139set EXITCODE=0
140GOTO EXIT
141
142:NOSDK10
143echo. Both Visual Studio 2010 and Visual C++ Express 2010 were not found on your system.
144GOTO EXIT
145
146:NOSIS
147echo. NSIS could not be found on your system.
148GOTO EXIT
149
150:NODDK
151echo. Windows DDK could not be found on your system
152GOTO EXIT
153
154:ERRORCREATINGINSTALLER
155echo. The installer could not be created. The most likely cause is that something went wrong while compiling.
156
157:EXIT
158del /q /f ..\build\cec-client.exe
159del /q /f ..\build\CecSharpTester.exe
160del /q /f ..\build\cec-config-gui.exe
161del /q /f ..\build\*.dll
162del /q /f ..\build\*.lib
163del /q /f ..\build\*.exp
164del /s /f /q ..\build\x64
165rmdir ..\build\x64
166cd ..\support
167
168IF "%1%"=="" (
169 echo. exitcode = %EXITCODE%
170) ELSE (
171 exit %EXITCODE%
172)
173