Merge branch 'master' into release
[deb_libcec.git] / support / create-installer.cmd
index cd5227c564488eb7c65d43130ce1bfb4d1705807..8c37a8f93a8317d4559782fb3bd64441c578c12c 100644 (file)
@@ -20,12 +20,19 @@ IF "%VS100COMNTOOLS%"=="" (
   set COMPILER10="%VS100COMNTOOLS%\..\IDE\devenv.exe"
 ) ELSE GOTO NOSDK10
 
-cd ..\project
-
 del /s /f /q ..\build
 mkdir ..\build
+
+IF EXIST "..\support\p8-usbcec-driver-installer.exe" (
+  copy "..\support\p8-usbcec-driver-installer.exe" "..\build\."
+) ELSE (
+  call create-driver-installer.cmd
+)
+
 mkdir ..\build\x64
 
+cd ..\project
+
 rem Skip to libCEC/x86 when we're running on win32
 if "%PROCESSOR_ARCHITECTURE%"=="x86" if "%PROCESSOR_ARCHITEW6432%"=="" goto libcecx86
 
@@ -64,9 +71,11 @@ echo. Cleaning LibCecSharp (x64)
 echo. Compiling LibCecSharp (x64)
 %COMPILER9% LibCecSharp.sln /build "Release|x64" /project LibCecSharp
 %COMPILER9% LibCecSharp.sln /build "Release|x64" /project CecSharpTester
+%COMPILER9% LibCecSharp.sln /build "Release|x64" /project cec-config-gui
 
 copy ..\build\LibCecSharp.dll ..\build\x64\LibCecSharp.dll
 copy ..\build\CecSharpTester.exe ..\build\x64\CecSharpTester.exe
+copy ..\build\cec-config-gui.exe ..\build\x64\cec-config-gui.exe
 
 :libcecsharpx86
 rem Compile LibCecSharp (x86)
@@ -75,26 +84,49 @@ echo. Cleaning LibCecSharp (x86)
 echo. Compiling LibCecSharp (x86)
 %COMPILER9% LibCecSharp.sln /build "Release|x86" /project LibCecSharp
 %COMPILER9% LibCecSharp.sln /build "Release|x86" /project CecSharpTester
+%COMPILER9% LibCecSharp.sln /build "Release|x86" /project cec-config-gui
 
 :NOSDK9
-:CREATEINSTALLER
-echo. Copying driver installer
-copy "%DDK%\redist\DIFx\dpinst\MultiLin\amd64\dpinst.exe" ..\build\dpinst-amd64.exe
-copy "%DDK%\redist\DIFx\dpinst\MultiLin\x86\dpinst.exe" ..\build\dpinst-x86.exe
-
 rem Clean things up before creating the installer
-del ..\build\LibCecSharp.pdb
-del ..\build\CecSharpTester.pdb
+del /q /f ..\build\LibCecSharp.pdb
+del /q /f ..\build\CecSharpTester.pdb
+del /q /f ..\build\cec-config-gui.pdb
+del /q /f ..\build\cec-config-gui.vshost.exe.manifest
+del /q /f ..\build\cec-config-gui.vshost.exe
 copy ..\build\cec-client.x64.exe ..\build\x64\cec-client.x64.exe
-del ..\build\cec-client.x64.exe
+del /q /f ..\build\cec-client.x64.exe
 copy ..\build\libcec.x64.dll ..\build\x64\libcec.x64.dll
-del ..\build\libcec.x64.dll
+del /q /f ..\build\libcec.x64.dll
 copy ..\build\libcec.x64.lib ..\build\x64\libcec.x64.lib
-del ..\build\libcec.x64.lib
+del /q /f ..\build\libcec.x64.lib
+
+rem Check for sign-binary.cmd, only present on the Pulse-Eight production build system
+rem Calls signtool.exe and signs the DLLs with Pulse-Eight's code signing key
+IF NOT EXIST "..\support\private\sign-binary.cmd" GOTO CREATEINSTALLER
+echo. Signing all binaries
+CALL ..\support\private\sign-binary.cmd ..\build\cec-client.exe
+CALL ..\support\private\sign-binary.cmd ..\build\CecSharpTester.exe
+CALL ..\support\private\sign-binary.cmd ..\build\libcec.dll
+CALL ..\support\private\sign-binary.cmd ..\build\LibCecSharp.dll
+CALL ..\support\private\sign-binary.cmd ..\build\cec-config-gui.exe
+CALL ..\support\private\sign-binary.cmd ..\build\x64\cec-client.x64.exe
+CALL ..\support\private\sign-binary.cmd ..\build\x64\CecSharpTester.exe
+CALL ..\support\private\sign-binary.cmd ..\build\x64\libcec.x64.dll
+CALL ..\support\private\sign-binary.cmd ..\build\x64\LibCecSharp.dll
+CALL ..\support\private\sign-binary.cmd ..\build\x64\cec-config-gui.exe
 
+:CREATEINSTALLER
 echo. Creating the installer
 %NSIS% /V1 /X"SetCompressor /FINAL lzma" "libCEC.nsi"
 
+IF NOT EXIST "..\build\libCEC-installer.exe" GOTO :ERRORCREATINGINSTALLER
+
+rem Sign the installer if sign-binary.cmd exists
+IF EXIST "..\support\private\sign-binary.cmd" (
+  echo. Signing the installer binaries
+  CALL ..\support\private\sign-binary.cmd ..\build\libCEC-installer.exe
+)
+
 echo. The installer can be found here: ..\build\libCEC-installer.exe
 
 GOTO EXIT
@@ -109,5 +141,18 @@ GOTO EXIT
 
 :NODDK
 echo. Windows DDK could not be found on your system
+GOTO EXIT
+
+:ERRORCREATINGINSTALLER
+echo. The installer could not be created. The most likely cause is that something went wrong while compiling.
 
 :EXIT
+del /q /f ..\build\cec-client.exe
+del /q /f ..\build\CecSharpTester.exe
+del /q /f ..\build\cec-config-gui.exe
+del /q /f ..\build\*.dll
+del /q /f ..\build\*.lib
+del /q /f ..\build\*.exp
+del /s /f /q ..\build\x64
+rmdir ..\build\x64
+cd ..\support
\ No newline at end of file