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