Imported Upstream version 2.2.0
[deb_libcec.git] / support / create-installer.bat
CommitLineData
cbbe90dd
JB
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 VC11
13IF "%VS110COMNTOOLS%"=="" (
14 set COMPILER11="%ProgramFiles%\Microsoft Visual Studio 11.0\Common7\IDE\VCExpress.exe"
15) ELSE IF EXIST "%VS110COMNTOOLS%\..\IDE\VCExpress.exe" (
16 set COMPILER11="%VS110COMNTOOLS%\..\IDE\VCExpress.exe"
17) ELSE IF EXIST "%VS110COMNTOOLS%\..\IDE\devenv.exe" (
18 set COMPILER11="%VS110COMNTOOLS%\..\IDE\devenv.exe"
19) ELSE GOTO NOSDK11
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%COMPILER11% libcec.sln /clean "Release|x64"
44echo. Compiling libCEC (x64)
45%COMPILER11% libcec.sln /build "Release|x64"
46
47:libcecx86
48rem Compile libCEC and cec-client Win32
49echo. Cleaning libCEC (x86)
50%COMPILER11% libcec.sln /clean "Release|x86"
51echo. Compiling libCEC (x86)
52%COMPILER11% libcec.sln /build "Release|x86"
53
54rem Clean things up before creating the installer
55del /q /f ..\build\LibCecSharp.pdb
56del /q /f ..\build\CecSharpTester.pdb
57del /q /f ..\build\cec-tray.pdb
58del /q /f ..\build\cec-tray.vshost.exe.manifest
59del /q /f ..\build\cec-.vshost.exe
60del /q /f ..\build\x64\LibCecSharp.pdb
61del /q /f ..\build\x64\CecSharpTester.pdb
62del /q /f ..\build\x64\cec-tray.pdb
63del /q /f ..\build\x64\cec-tray.vshost.exe.manifest
64del /q /f ..\build\x64\cec-.vshost.exe
65
66rem Check for sign-binary.cmd, only present on the Pulse-Eight production build system
67rem Calls signtool.exe and signs the DLLs with Pulse-Eight's code signing key
68IF NOT EXIST "..\support\private\sign-binary.cmd" GOTO CREATEINSTALLER
69echo. Signing all binaries
70CALL ..\support\private\sign-binary.cmd ..\build\cec-client.exe
71CALL ..\support\private\sign-binary.cmd ..\build\CecSharpTester.exe
72CALL ..\support\private\sign-binary.cmd ..\build\libcec.dll
73CALL ..\support\private\sign-binary.cmd ..\build\LibCecSharp.dll
74CALL ..\support\private\sign-binary.cmd ..\build\cec-tray.exe
75CALL ..\support\private\sign-binary.cmd ..\build\x64\cec-client.exe
76CALL ..\support\private\sign-binary.cmd ..\build\x64\CecSharpTester.exe
77CALL ..\support\private\sign-binary.cmd ..\build\x64\libcec.dll
78CALL ..\support\private\sign-binary.cmd ..\build\x64\LibCecSharp.dll
79CALL ..\support\private\sign-binary.cmd ..\build\x64\cec-tray.exe
80
81:CREATEINSTALLER
82echo. Creating the installer
83cd ..\build\x64
84copy libcec.dll libcec.x64.dll
85copy cec-client.exe cec-client.x64.exe
86cd ..\..\project
87%NSIS% /V1 /X"SetCompressor /FINAL lzma" "libCEC.nsi"
88
89IF NOT EXIST "..\build\libCEC-installer.exe" GOTO :ERRORCREATINGINSTALLER
90
91rem Sign the installer if sign-binary.cmd exists
92IF EXIST "..\support\private\sign-binary.cmd" (
93 echo. Signing the installer binaries
94 CALL ..\support\private\sign-binary.cmd ..\build\libCEC-installer.exe
95)
96
97IF "%1%"=="" (
98 echo. The installer can be found here: ..\build\libCEC-installer.exe
99) ELSE (
100 move ..\build\libCEC-installer.exe ..\build\libCEC-%1%-installer.exe
101 echo. The installer can be found here: ..\build\libCEC-%1%-installer.exe
102)
103
104set EXITCODE=0
105GOTO EXIT
106
107:NOSDK11
108echo. Visual Studio 2012 was not found on your system.
109GOTO EXIT
110
111:NOSIS
112echo. NSIS could not be found on your system.
113GOTO EXIT
114
115:NODDK
116echo. Windows DDK could not be found on your system
117GOTO EXIT
118
119:ERRORCREATINGINSTALLER
120echo. The installer could not be created. The most likely cause is that something went wrong while compiling.
121
122:EXIT
123del /q /f ..\build\cec-client.exe
124del /q /f ..\build\CecSharpTester.exe
125del /q /f ..\build\cec-tray.exe
126del /q /f ..\build\*.dll
127del /q /f ..\build\*.lib
128del /q /f ..\build\*.exp
129del /q /f ..\build\*.xml
130del /q /f ..\build\*.metagen
131del /s /f /q ..\build\x64
132rmdir ..\build\x64
133cd ..\support
134
135IF "%1%"=="" (
136 echo. exitcode = %EXITCODE%
137) ELSE (
138 exit %EXITCODE%
139)
140