converted to vs2012
[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
58f3d0a9
LOK
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"
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)
58f3d0a9 43%COMPILER11% libcec.sln /clean "Release|x64"
4d760b54 44echo. Compiling libCEC (x64)
58f3d0a9 45%COMPILER11% libcec.sln /build "Release|x64"
7879fa15 46
4d760b54
LOK
47:libcecx86
48rem Compile libCEC and cec-client Win32
49echo. Cleaning libCEC (x86)
58f3d0a9 50%COMPILER11% libcec.sln /clean "Release|x86"
4d760b54 51echo. Compiling libCEC (x86)
58f3d0a9 52%COMPILER11% libcec.sln /build "Release|x86"
4d760b54 53
4d760b54 54rem Clean things up before creating the installer
8dfe215b
LOK
55del /q /f ..\build\LibCecSharp.pdb
56del /q /f ..\build\CecSharpTester.pdb
f017f3c4
LOK
57del /q /f ..\build\cec-tray.pdb
58del /q /f ..\build\cec-tray.vshost.exe.manifest
59del /q /f ..\build\cec-.vshost.exe
58f3d0a9
LOK
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
4d760b54 65
7c6346eb
LOK
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
d05a1e9c 68IF NOT EXIST "..\support\private\sign-binary.cmd" GOTO CREATEINSTALLER
7c6346eb 69echo. Signing all binaries
d05a1e9c
LOK
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
f017f3c4 74CALL ..\support\private\sign-binary.cmd ..\build\cec-tray.exe
58f3d0a9 75CALL ..\support\private\sign-binary.cmd ..\build\x64\cec-client.exe
d05a1e9c 76CALL ..\support\private\sign-binary.cmd ..\build\x64\CecSharpTester.exe
58f3d0a9 77CALL ..\support\private\sign-binary.cmd ..\build\x64\libcec.dll
d05a1e9c 78CALL ..\support\private\sign-binary.cmd ..\build\x64\LibCecSharp.dll
f017f3c4 79CALL ..\support\private\sign-binary.cmd ..\build\x64\cec-tray.exe
7c6346eb
LOK
80
81:CREATEINSTALLER
4d760b54 82echo. Creating the installer
09054f70
LOK
83%NSIS% /V1 /X"SetCompressor /FINAL lzma" "libCEC.nsi"
84
7c6346eb
LOK
85IF NOT EXIST "..\build\libCEC-installer.exe" GOTO :ERRORCREATINGINSTALLER
86
87rem Sign the installer if sign-binary.cmd exists
d05a1e9c 88IF EXIST "..\support\private\sign-binary.cmd" (
7c6346eb 89 echo. Signing the installer binaries
d05a1e9c 90 CALL ..\support\private\sign-binary.cmd ..\build\libCEC-installer.exe
7c6346eb
LOK
91)
92
924a6975
LOK
93IF "%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)
4d760b54 99
948ee14e 100set EXITCODE=0
4d760b54 101GOTO EXIT
7879fa15 102
4d760b54
LOK
103:NOSDK10
104echo. Both Visual Studio 2010 and Visual C++ Express 2010 were not found on your system.
7879fa15
LOK
105GOTO EXIT
106
107:NOSIS
4d760b54 108echo. NSIS could not be found on your system.
7879fa15
LOK
109GOTO EXIT
110
111:NODDK
4d760b54 112echo. Windows DDK could not be found on your system
7c6346eb
LOK
113GOTO EXIT
114
115:ERRORCREATINGINSTALLER
116echo. The installer could not be created. The most likely cause is that something went wrong while compiling.
7879fa15 117
f00ff009 118:EXIT
8dfe215b
LOK
119del /q /f ..\build\cec-client.exe
120del /q /f ..\build\CecSharpTester.exe
f017f3c4 121del /q /f ..\build\cec-tray.exe
8dfe215b
LOK
122del /q /f ..\build\*.dll
123del /q /f ..\build\*.lib
124del /q /f ..\build\*.exp
9884e9ff 125del /q /f ..\build\*.xml
8dfe215b
LOK
126del /s /f /q ..\build\x64
127rmdir ..\build\x64
44f8f041
LOK
128cd ..\support
129
3c9f1fb4
LOK
130IF "%1%"=="" (
131 echo. exitcode = %EXITCODE%
132) ELSE (
133 exit %EXITCODE%
134)
135