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