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