Add new define for installer with D3DCompiler version.

Fixes installer build after 3e5afbc869
Add some asserts to not forget to update defines when neccessery.

Add environment varaible to control Windows SDK build.
Switch to 8.1 SDK.
Add wrapper for VersionHelpers.h
This commit is contained in:
Kacper Michajłow committed 2017-07-30 19:14:00 +02:00
1 parent 3635f6e75f
commit 0c921bc5ed
18 files changed
+82 -24

No files matched your search

+10 -9
View File
@@ -109,6 +109,8 @@ IF EXIST "%FILE_DIR%signinfo.txt" (
IF /I "%ZIP%" == "True" SET "SIGN=True"
)
REM Set version for DX libraries
CALL "%COMMON%" :SubParseConfig
:Start
REM Check if the %LOG_DIR% folder exists otherwise MSBuild will fail
@@ -145,9 +147,9 @@ IF %ERRORLEVEL% NEQ 0 ENDLOCAL & EXIT /B
IF /I "%PPLATFORM%" == "Win32" (SET ARCH=x86) ELSE (SET ARCH=amd64)
IF /I "%COMPILER%" == "VS2017" (
CALL "%TOOLSET%" -no_logo -arch=%ARCH%
CALL "%TOOLSET%" -no_logo -arch=%ARCH% -winsdk=%MPCHC_WINSDK_VER%
) ELSE (
CALL "%TOOLSET%" %ARCH%
CALL "%TOOLSET%" %ARCH% %MPCHC_WINSDK_VER%
)
IF %ERRORLEVEL% NEQ 0 GOTO MissingVar
@@ -333,10 +335,10 @@ EXIT /B
:SubCopyDXDll
IF /I "%BUILDCFG%" == "Debug" EXIT /B
PUSHD "%BIN_DIR%"
COPY /Y /V "%WindowsSdkDir%\Redist\D3D\%~1\d3dcompiler_47.dll" "mpc-hc_%~1%~2" >NUL
IF %ERRORLEVEL% NEQ 0 CALL "%COMMON%" :SubMsg "ERROR" "Problem when copying %WindowsSdkDir%\Redist\D3D\%~1\d3dcompiler_47.dll" & EXIT /B
EXPAND "%DXSDK_DIR%\Redist\Jun2010_d3dx9_43_%~1.cab" -F:d3dx9_43.dll "mpc-hc_%~1%~2"
IF %ERRORLEVEL% NEQ 0 CALL "%COMMON%" :SubMsg "ERROR" "Problem when extracting Jun2010_d3dx9_43_%~1.cab" & EXIT /B
COPY /Y /V "%WindowsSdkDir%\Redist\D3D\%~1\d3dcompiler_%MPC_D3D_COMPILER_VERSION%.dll" "mpc-hc_%~1%~2" >NUL
IF %ERRORLEVEL% NEQ 0 CALL "%COMMON%" :SubMsg "ERROR" "Problem when copying %WindowsSdkDir%\Redist\D3D\%~1\d3dcompiler_%MPC_D3D_COMPILER_VERSION%.dll" & EXIT /B
EXPAND "%DXSDK_DIR%\Redist\Jun2010_d3dx9_%MPC_DX_SDK_NUMBER%_%~1.cab" -F:d3dx9_%MPC_DX_SDK_NUMBER%.dll "mpc-hc_%~1%~2"
IF %ERRORLEVEL% NEQ 0 CALL "%COMMON%" :SubMsg "ERROR" "Problem when extracting Jun2010_d3dx9_%MPC_DX_SDK_NUMBER%_%~1.cab" & EXIT /B
POPD
EXIT /B
@@ -458,8 +460,8 @@ IF /I "%NAME%" == "MPC-HC" (
COPY /Y /V "%VS_OUT_DIR%\%LAVFILTERSDIR%\*.dll" "%PCKG_NAME%\%LAVFILTERSDIR%" >NUL
COPY /Y /V "%VS_OUT_DIR%\%LAVFILTERSDIR%\*.manifest" "%PCKG_NAME%\%LAVFILTERSDIR%" >NUL
)
COPY /Y /V "%VS_OUT_DIR%\d3dcompiler_47.dll" "%PCKG_NAME%\d3dcompiler_47.dll" >NUL
COPY /Y /V "%VS_OUT_DIR%\d3dx9_43.dll" "%PCKG_NAME%\d3dx9_43.dll" >NUL
COPY /Y /V "%VS_OUT_DIR%\d3dcompiler_%MPC_D3D_COMPILER_VERSION%.dll" "%PCKG_NAME%\d3dcompiler_%MPC_D3D_COMPILER_VERSION%.dll" >NUL
COPY /Y /V "%VS_OUT_DIR%\d3dx9_%MPC_DX_SDK_NUMBER%.dll" "%PCKG_NAME%\d3dx9_%MPC_DX_SDK_NUMBER%.dll" >NUL
IF NOT EXIST "%PCKG_NAME%\Shaders" MD "%PCKG_NAME%\Shaders"
COPY /Y /V "..\src\mpc-hc\res\shaders\external\*.hlsl" "%PCKG_NAME%\Shaders" >NUL
IF /I "%BUILDCFG%" NEQ "Debug" IF /I "%BUILDCFG%" NEQ "Debug Lite" IF EXIST "%VS_OUT_DIR%\CrashReporter\crashrpt.dll" (
@@ -519,7 +521,6 @@ EXIT /B
:MissingVar
COLOR 0C
TITLE Compiling MPC-HC %COMPILER% [ERROR]
ECHO Not all build dependencies were found.
ECHO.
+8 -1
View File
@@ -46,6 +46,13 @@ FOR %%G IN (%~1) DO (SET FOUND=%%~$PATH:G)
IF NOT DEFINED FOUND EXIT /B 1
EXIT /B
:SubParseConfig
REM Parses mpc-hc_confg.h for MPC* defines
FOR /F "tokens=2,3" %%A IN ('FINDSTR /R /C:"define MPC" "include\mpc-hc_config.h"') DO (
IF NOT DEFINED %%A SET "%%A=%%B"
)
EXIT /B
:SubGetVersion
REM Get the version
IF NOT EXIST "include\version_rev.h" SET "FORCE_VER_UPDATE=True"
@@ -107,7 +114,7 @@ FOR /F "tokens=2*" %%A IN (
EXIT /B
:SubVSPath
FOR /f "delims=" %%A IN ('"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -property installationPath -latest -requires Microsoft.Component.MSBuild Microsoft.VisualStudio.Component.VC.ATLMFC Microsoft.VisualStudio.ComponentGroup.NativeDesktop.WinXP') DO SET MPCHC_VS_PATH=%%A
FOR /f "delims=" %%A IN ('"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -property installationPath -latest -requires Microsoft.Component.MSBuild Microsoft.VisualStudio.Component.VC.ATLMFC Microsoft.VisualStudio.Component.VC.Tools.x86.x64') DO SET "MPCHC_VS_PATH=%%A"
EXIT /B
:SubMsg
+2 -2
View File
@@ -251,7 +251,7 @@ Source: {#bindir}\{#lavfiltersdir}\*.dll; DestDir: {app}\{#lavfiltersdir};
Source: {#bindir}\{#lavfiltersdir}\*.ax; DestDir: {app}\{#lavfiltersdir}; Components: main; Flags: ignoreversion
Source: {#bindir}\{#lavfiltersdir}\*.manifest; DestDir: {app}\{#lavfiltersdir}; Components: main; Flags: ignoreversion
#endif
Source: {#bindir}\D3DCompiler_{#MPC_DX_SDK_NUMBER}.dll; DestDir: {app}; Components: main; Flags: ignoreversion
Source: {#bindir}\d3dcompiler_{#MPC_D3D_COMPILER_VERSION}.dll; DestDir: {app}; Components: main; Flags: ignoreversion
Source: {#bindir}\d3dx9_{#MPC_DX_SDK_NUMBER}.dll; DestDir: {app}; Components: main; Flags: ignoreversion
Source: {#bindir}\mpciconlib.dll; DestDir: {app}; Components: mpciconlib; Flags: ignoreversion
Source: {#bindir}\{#mpchc_exe}; DestDir: {app}; Components: main; Flags: ignoreversion
@@ -261,10 +261,10 @@ Source: ..\docs\Changelog.txt; DestDir: {app}; Components: main
Source: ..\docs\Readme.txt; DestDir: {app}; Components: main; Flags: ignoreversion
Source: ..\src\mpc-hc\res\shaders\external\*.hlsl; DestDir: {app}\Shaders; Components: main; Flags: ignoreversion
#ifexist AddBackslash(crashreporter_dir) + "crashrpt.dll"
Source: {#crashreporter_dir}\CrashReporterDialog.dll; DestDir: {app}\CrashReporter; Components: main; Flags: ignoreversion
Source: {#crashreporter_dir}\crashrpt.dll; DestDir: {app}\CrashReporter; Components: main; Flags: ignoreversion
Source: {#crashreporter_dir}\dbghelp.dll; DestDir: {app}\CrashReporter; Components: main; Flags: ignoreversion
Source: {#crashreporter_dir}\sendrpt.exe; DestDir: {app}\CrashReporter; Components: main; Flags: ignoreversion
Source: {#crashreporter_dir}\CrashReporterDialog.dll; DestDir: {app}\CrashReporter; Components: main; Flags: ignoreversion
#endif
+1 -1
View File
@@ -12,7 +12,7 @@ Choose `Use Git from the Windows command prompt`. This isn't mandatory, so if yo
### Visual Studio 2017 or 2015
1. Install Visual C++, part of Visual Studio (any edition will work fine).
Make sure to select **Windows 10 SDK (10.0.10586.0)** and **MFC and ATL support** during installation.
Make sure to select **Windows 8.1 SDK** and **MFC and ATL support** during installation.
2. Make sure you have installed all available updates from Microsoft Update
3. Install the DirectX SDK (June 2010) → <https://go.microsoft.com/fwlink/?LinkID=71193>
+7 -1
View File
@@ -1,6 +1,6 @@
#ifndef ISPP_INVOKED
/*
* (C) 2013-2016 see Authors.txt
* (C) 2013-2017 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -55,6 +55,12 @@
#define MPC_DX_SDK_MONTH _T("June")
#define MPC_DX_SDK_YEAR 2010
// Used in the installer
#define MPC_DX_SDK_NUMBER 43
#define MPC_D3D_COMPILER_VERSION 47
#ifndef ISPP_INVOKED
// Used in build scripts
#define MPCHC_WINSDK_VER 8.1
#endif
#endif // MPC_HC_CONFIG_H
-1
View File
@@ -24,7 +24,6 @@
everything for every revision. It's currently used in mpcresources, mpciconlib
and VideoRenderers projects.
* MPC_VERSION_ARCH is currently used in VSFilter only.
* MPC_DX_SDK_NUMBER is used in the installer.
*/
#endif // ISPP_INVOKED
+1
View File
@@ -92,6 +92,7 @@
<ClInclude Include="text.h" />
<ClInclude Include="vd.h" />
<ClInclude Include="vd_asm.h" />
<ClInclude Include="VersionHelpersInternal.h" />
<ClInclude Include="WinapiFunc.h" />
<ClInclude Include="WinAPIUtils.h" />
</ItemGroup>
+3
View File
@@ -139,5 +139,8 @@
<ClInclude Include="ISOLang.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="VersionHelpersInternal.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
+36
View File
@@ -0,0 +1,36 @@
/*
* (C) 2017 see Authors.txt
*
* This file is part of MPC-HC.
*
* MPC-HC is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* MPC-HC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#include <VersionHelpers.h>
// Remove once newer SDK is used
#ifndef _WIN32_WINNT_WINTHRESHOLD
#define _WIN32_WINNT_WINTHRESHOLD 0x0A00
VERSIONHELPERAPI
IsWindows10OrGreater()
{
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINTHRESHOLD), LOBYTE(_WIN32_WINNT_WINTHRESHOLD), 0);
}
#endif
@@ -1,6 +1,6 @@
/*
* (C) 2003-2006 Gabest
* (C) 2006-2016 see Authors.txt
* (C) 2006-2017 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -22,6 +22,7 @@
#include "stdafx.h"
#include "PixelShaderCompiler.h"
#include "../../../mpc-hc/resource.h"
#include <mpc-hc_config.h>
#include <d3d9.h>
CPixelShaderCompiler::CPixelShaderCompiler(IDirect3DDevice9* pD3DDev, bool fStaySilent)
@@ -31,6 +32,8 @@ CPixelShaderCompiler::CPixelShaderCompiler(IDirect3DDevice9* pD3DDev, bool fStay
, m_pD3DDev(pD3DDev)
, m_Cache(pD3DDev)
{
static_assert(D3D_COMPILER_VERSION == MPC_D3D_COMPILER_VERSION,
"MPC_D3D_COMPILER_VERSION define used in the installer needs to be updated.");
m_hDll = LoadLibrary(D3DCOMPILER_DLL);
if (m_hDll) {
@@ -23,6 +23,7 @@
#include "RenderersSettings.h"
#include "../../../mpc-hc/AppSettings.h"
#include "../../../mpc-hc/mplayerc.h"
#include <mpc-hc_config.h>
#include <d3d9.h>
#include <d3d10.h>
#include <dxgi.h>
@@ -125,7 +126,7 @@ LONGLONG CRenderersData::GetPerfCounter() const
HINSTANCE CRenderersData::GetD3X9Dll()
{
// D3DX9 v43 is the latest available and will not get any update. We support only this specific version.
static_assert(D3DX_SDK_VERSION == 43, "Different D3DX9 version?");
static_assert(D3DX_SDK_VERSION == MPC_DX_SDK_NUMBER, "Different D3DX9 version?");
if (m_hD3DX9Dll == nullptr) {
m_strD3DX9Version.Format(_T("d3dx9_%u.dll"), D3DX_SDK_VERSION);
m_hD3DX9Dll = LoadLibrary(m_strD3DX9Version);
+1 -1
View File
@@ -33,7 +33,7 @@
#include "moreuuids.h"
#include "mplayerc.h"
#include "../thirdparty/sanear/sanear/src/Factory.h"
#include <VersionHelpers.h>
#include <VersionHelpersInternal.h>
#include <mvrInterfaces.h>
#pragma warning(push)
+1 -1
View File
@@ -20,7 +20,7 @@
*/
#include "stdafx.h"
#include <VersionHelpers.h>
#include <VersionHelpersInternal.h>
#include "mplayerc.h"
#include "FileAssoc.h"
#include "resource.h"
+1 -1
View File
@@ -100,7 +100,7 @@
#include <dvdevcod.h>
#include <dvdmedia.h>
#include <strsafe.h>
#include <VersionHelpers.h>
#include <VersionHelpersInternal.h>
#include <initguid.h>
#include <qnetwork.h>
+1 -1
View File
@@ -22,7 +22,7 @@
#include <map>
#include <unordered_set>
#include <VersionHelpers.h>
#include <VersionHelpersInternal.h>
#include "EventDispatcher.h"
+1 -1
View File
@@ -20,7 +20,7 @@
*/
#include "stdafx.h"
#include <VersionHelpers.h>
#include <VersionHelpersInternal.h>
#include "mplayerc.h"
#include "PPageFormats.h"
#include "FileAssoc.h"
+1 -1
View File
@@ -20,7 +20,7 @@
*/
#include "stdafx.h"
#include <VersionHelpers.h>
#include <VersionHelpersInternal.h>
#include "mplayerc.h"
#include "PPageTweaks.h"
#include "MainFrm.h"
+2 -1
View File
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Configuration">
<WindowsTargetPlatformVersion>10.0.10586.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion Condition="'$(MPCHC_WINSDK_VER)' == ''">8.1</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion Condition="'$(MPCHC_WINSDK_VER)' != ''">$(MPCHC_WINSDK_VER)</WindowsTargetPlatformVersion>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
</PropertyGroup>