converted to vs2012
[deb_libcec.git] / support / create-installer.bat
1 @echo off
2
3 set EXITCODE=1
4
5 rem Check for NSIS
6 IF 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
12 rem Check for VC11
13 IF "%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 NOSDK10
20
21 del /s /f /q ..\build
22 mkdir ..\build
23
24 IF 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
34 mkdir ..\build\x64
35
36 cd ..\project
37
38 rem Skip to libCEC/x86 when we're running on win32
39 if "%PROCESSOR_ARCHITECTURE%"=="x86" if "%PROCESSOR_ARCHITEW6432%"=="" goto libcecx86
40
41 rem Compile libCEC and cec-client x64
42 echo. Cleaning libCEC (x64)
43 %COMPILER11% libcec.sln /clean "Release|x64"
44 echo. Compiling libCEC (x64)
45 %COMPILER11% libcec.sln /build "Release|x64"
46
47 :libcecx86
48 rem Compile libCEC and cec-client Win32
49 echo. Cleaning libCEC (x86)
50 %COMPILER11% libcec.sln /clean "Release|x86"
51 echo. Compiling libCEC (x86)
52 %COMPILER11% libcec.sln /build "Release|x86"
53
54 rem Clean things up before creating the installer
55 del /q /f ..\build\LibCecSharp.pdb
56 del /q /f ..\build\CecSharpTester.pdb
57 del /q /f ..\build\cec-tray.pdb
58 del /q /f ..\build\cec-tray.vshost.exe.manifest
59 del /q /f ..\build\cec-.vshost.exe
60 del /q /f ..\build\x64\LibCecSharp.pdb
61 del /q /f ..\build\x64\CecSharpTester.pdb
62 del /q /f ..\build\x64\cec-tray.pdb
63 del /q /f ..\build\x64\cec-tray.vshost.exe.manifest
64 del /q /f ..\build\x64\cec-.vshost.exe
65
66 rem Check for sign-binary.cmd, only present on the Pulse-Eight production build system
67 rem Calls signtool.exe and signs the DLLs with Pulse-Eight's code signing key
68 IF NOT EXIST "..\support\private\sign-binary.cmd" GOTO CREATEINSTALLER
69 echo. Signing all binaries
70 CALL ..\support\private\sign-binary.cmd ..\build\cec-client.exe
71 CALL ..\support\private\sign-binary.cmd ..\build\CecSharpTester.exe
72 CALL ..\support\private\sign-binary.cmd ..\build\libcec.dll
73 CALL ..\support\private\sign-binary.cmd ..\build\LibCecSharp.dll
74 CALL ..\support\private\sign-binary.cmd ..\build\cec-tray.exe
75 CALL ..\support\private\sign-binary.cmd ..\build\x64\cec-client.exe
76 CALL ..\support\private\sign-binary.cmd ..\build\x64\CecSharpTester.exe
77 CALL ..\support\private\sign-binary.cmd ..\build\x64\libcec.dll
78 CALL ..\support\private\sign-binary.cmd ..\build\x64\LibCecSharp.dll
79 CALL ..\support\private\sign-binary.cmd ..\build\x64\cec-tray.exe
80
81 :CREATEINSTALLER
82 echo. Creating the installer
83 %NSIS% /V1 /X"SetCompressor /FINAL lzma" "libCEC.nsi"
84
85 IF NOT EXIST "..\build\libCEC-installer.exe" GOTO :ERRORCREATINGINSTALLER
86
87 rem Sign the installer if sign-binary.cmd exists
88 IF EXIST "..\support\private\sign-binary.cmd" (
89 echo. Signing the installer binaries
90 CALL ..\support\private\sign-binary.cmd ..\build\libCEC-installer.exe
91 )
92
93 IF "%1%"=="" (
94 echo. The installer can be found here: ..\build\libCEC-installer.exe
95 ) ELSE (
96 move ..\build\libCEC-installer.exe ..\build\libCEC-%1%-installer.exe
97 echo. The installer can be found here: ..\build\libCEC-%1%-installer.exe
98 )
99
100 set EXITCODE=0
101 GOTO EXIT
102
103 :NOSDK10
104 echo. Both Visual Studio 2010 and Visual C++ Express 2010 were not found on your system.
105 GOTO EXIT
106
107 :NOSIS
108 echo. NSIS could not be found on your system.
109 GOTO EXIT
110
111 :NODDK
112 echo. Windows DDK could not be found on your system
113 GOTO EXIT
114
115 :ERRORCREATINGINSTALLER
116 echo. The installer could not be created. The most likely cause is that something went wrong while compiling.
117
118 :EXIT
119 del /q /f ..\build\cec-client.exe
120 del /q /f ..\build\CecSharpTester.exe
121 del /q /f ..\build\cec-tray.exe
122 del /q /f ..\build\*.dll
123 del /q /f ..\build\*.lib
124 del /q /f ..\build\*.exp
125 del /q /f ..\build\*.xml
126 del /s /f /q ..\build\x64
127 rmdir ..\build\x64
128 cd ..\support
129
130 IF "%1%"=="" (
131 echo. exitcode = %EXITCODE%
132 ) ELSE (
133 exit %EXITCODE%
134 )
135