Browse Source

Add BuildConfig project

It handles version_rev.h file generation.
Alex Marsev 3 years ago
parent
commit
3fcde2d7ff

+ 1
- 1
.gitignore View File

@@ -21,7 +21,7 @@
21 21
 /contrib/MPC-HC.tar
22 22
 /contrib/MPC-HC.tgz
23 23
 /distrib/*.exe
24
-/include/version_rev.h
24
+/build/version_rev.h
25 25
 /signinfo.txt
26 26
 /src/filters/transform/VSFilter/installer/*.exe
27 27
 /src/mpc-hc/mpcresources/backup

+ 1
- 0
build/About.txt View File

@@ -0,0 +1 @@
1
+Generates git-describe and environment info through custom build step.

+ 48
- 0
build/BuildConfig.vcxproj View File

@@ -0,0 +1,48 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+  <ItemGroup Label="ProjectConfigurations">
4
+    <ProjectConfiguration Include="Release|Win32">
5
+      <Configuration>Release</Configuration>
6
+      <Platform>Win32</Platform>
7
+    </ProjectConfiguration>
8
+    <ProjectConfiguration Include="Release|x64">
9
+      <Configuration>Release</Configuration>
10
+      <Platform>x64</Platform>
11
+    </ProjectConfiguration>
12
+  </ItemGroup>
13
+  <ItemGroup>
14
+    <Text Include="About.txt" />
15
+  </ItemGroup>
16
+  <ItemGroup>
17
+    <ClInclude Include="version_rev.h" />
18
+  </ItemGroup>
19
+  <ItemGroup>
20
+    <Manifest Include="..\src\mpc-hc\res\mpc-hc.exe.manifest" />
21
+  </ItemGroup>
22
+  <PropertyGroup Label="Globals">
23
+    <ProjectGuid>{981574AE-5A5E-4F27-BDF1-1B841E374CFF}</ProjectGuid>
24
+    <ProjectName>BuildConfig</ProjectName>
25
+  </PropertyGroup>
26
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
27
+  <Import Project="..\src\platform.props" />
28
+  <PropertyGroup Label="Configuration">
29
+    <ConfigurationType>StaticLibrary</ConfigurationType>
30
+    <CharacterSet>Unicode</CharacterSet>
31
+  </PropertyGroup>
32
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
33
+  <ImportGroup Label="ExtensionSettings">
34
+  </ImportGroup>
35
+  <ImportGroup Label="PropertySheets">
36
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
37
+    <Import Project="..\src\common.props" />
38
+  </ImportGroup>
39
+  <ItemDefinitionGroup>
40
+    <CustomBuildStep>
41
+      <Command>..\update_version.bat --quiet</Command>
42
+      <Outputs>nobody_expects_Spanish_Inquisition</Outputs>
43
+    </CustomBuildStep>
44
+  </ItemDefinitionGroup>
45
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
46
+  <ImportGroup Label="ExtensionTargets">
47
+  </ImportGroup>
48
+</Project>

+ 2
- 2
include/version.h View File

@@ -1,6 +1,6 @@
1 1
 #ifndef ISPP_INVOKED
2 2
 /*
3
- * (C) 2010-2015 see Authors.txt
3
+ * (C) 2010-2013, 2015 see Authors.txt
4 4
  *
5 5
  * This file is part of MPC-HC.
6 6
  *
@@ -45,7 +45,7 @@
45 45
 #endif
46 46
 
47 47
 #ifndef NO_VERSION_REV_NEEDED
48
-#include "version_rev.h"
48
+#include "..\build\version_rev.h"
49 49
 #endif
50 50
 
51 51
 #define DO_MAKE_STR(x)          _T(#x)

+ 37
- 1
mpc-hc.sln View File

@@ -1,6 +1,6 @@
1 1
 Microsoft Visual Studio Solution File, Format Version 12.00
2 2
 # Visual Studio 2013
3
-VisualStudioVersion = 12.0.31101.0
3
+VisualStudioVersion = 12.0.40629.0
4 4
 MinimumVisualStudioVersion = 10.0.40219.1
5 5
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Apps", "Apps", "{A21F07E6-A891-479C-98EA-EDB58CE4EFAB}"
6 6
 EndProject
@@ -25,6 +25,9 @@ EndProject
25 25
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Transform", "Transform", "{F9F42BF2-3F13-4654-82C5-E27B8879EC4E}"
26 26
 EndProject
27 27
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpc-hc", "src\mpc-hc\mpc-hc.vcxproj", "{8CE7E5D0-C821-47AC-A247-28EC95B34670}"
28
+	ProjectSection(ProjectDependencies) = postProject
29
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF} = {981574AE-5A5E-4F27-BDF1-1B841E374CFF}
30
+	EndProjectSection
28 31
 EndProject
29 32
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DeCSS", "src\DeCSS\DeCSS.vcxproj", "{1A2DFD1A-3C6C-44D1-909D-294AF646B575}"
30 33
 EndProject
@@ -51,6 +54,9 @@ EndProject
51 54
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseClasses", "src\thirdparty\BaseClasses\BaseClasses.vcxproj", "{E8A3F6FA-AE1C-4C8E-A0B6-9C8480324EAA}"
52 55
 EndProject
53 56
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Filters", "src\filters\Filters.vcxproj", "{273B3149-3192-4B75-A791-470320B90812}"
57
+	ProjectSection(ProjectDependencies) = postProject
58
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF} = {981574AE-5A5E-4F27-BDF1-1B841E374CFF}
59
+	EndProjectSection
54 60
 EndProject
55 61
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "src\thirdparty\zlib\zlib.vcxproj", "{2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}"
56 62
 EndProject
@@ -115,6 +121,9 @@ EndProject
115 121
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DoctorDump", "src\thirdparty\DoctorDump\DoctorDump.vcxproj", "{BECEAFF9-CDCA-45EC-A1CF-658FA51818E6}"
116 122
 EndProject
117 123
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CrashReporterDialog", "src\mpc-hc\CrashReporterDialog\CrashReporterDialog.vcxproj", "{5DB958DD-8B25-45EF-8072-3356CAF8CCD7}"
124
+	ProjectSection(ProjectDependencies) = postProject
125
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF} = {981574AE-5A5E-4F27-BDF1-1B841E374CFF}
126
+	EndProjectSection
118 127
 EndProject
119 128
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Crash Reporter", "Crash Reporter", "{B161892C-93C5-4F89-8C43-7E9BE5DD4AE4}"
120 129
 EndProject
@@ -128,6 +137,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zita-resampler", "src\third
128 137
 EndProject
129 138
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sanear", "src\thirdparty\sanear\sanear\sanear.vcxproj", "{BB2B61AF-734A-4DAD-9326-07F4F9EA088F}"
130 139
 EndProject
140
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BuildConfig", "build\BuildConfig.vcxproj", "{981574AE-5A5E-4F27-BDF1-1B841E374CFF}"
141
+EndProject
131 142
 Global
132 143
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
133 144
 		Debug Filter|Win32 = Debug Filter|Win32
@@ -1234,6 +1245,30 @@ Global
1234 1245
 		{BB2B61AF-734A-4DAD-9326-07F4F9EA088F}.Release|Win32.Build.0 = Release|Win32
1235 1246
 		{BB2B61AF-734A-4DAD-9326-07F4F9EA088F}.Release|x64.ActiveCfg = Release|x64
1236 1247
 		{BB2B61AF-734A-4DAD-9326-07F4F9EA088F}.Release|x64.Build.0 = Release|x64
1248
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF}.Debug Filter|Win32.ActiveCfg = Release|Win32
1249
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF}.Debug Filter|Win32.Build.0 = Release|Win32
1250
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF}.Debug Filter|x64.ActiveCfg = Release|x64
1251
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF}.Debug Filter|x64.Build.0 = Release|x64
1252
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF}.Debug Lite|Win32.ActiveCfg = Release|Win32
1253
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF}.Debug Lite|Win32.Build.0 = Release|Win32
1254
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF}.Debug Lite|x64.ActiveCfg = Release|x64
1255
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF}.Debug Lite|x64.Build.0 = Release|x64
1256
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF}.Debug|Win32.ActiveCfg = Release|Win32
1257
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF}.Debug|Win32.Build.0 = Release|Win32
1258
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF}.Debug|x64.ActiveCfg = Release|x64
1259
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF}.Debug|x64.Build.0 = Release|x64
1260
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF}.Release Filter|Win32.ActiveCfg = Release|Win32
1261
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF}.Release Filter|Win32.Build.0 = Release|Win32
1262
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF}.Release Filter|x64.ActiveCfg = Release|x64
1263
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF}.Release Filter|x64.Build.0 = Release|x64
1264
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF}.Release Lite|Win32.ActiveCfg = Release|Win32
1265
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF}.Release Lite|Win32.Build.0 = Release|Win32
1266
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF}.Release Lite|x64.ActiveCfg = Release|x64
1267
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF}.Release Lite|x64.Build.0 = Release|x64
1268
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF}.Release|Win32.ActiveCfg = Release|Win32
1269
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF}.Release|Win32.Build.0 = Release|Win32
1270
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF}.Release|x64.ActiveCfg = Release|x64
1271
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF}.Release|x64.Build.0 = Release|x64
1237 1272
 	EndGlobalSection
1238 1273
 	GlobalSection(SolutionProperties) = preSolution
1239 1274
 		HideSolutionNode = FALSE
@@ -1299,5 +1334,6 @@ Global
1299 1334
 		{4C7A1953-CBC4-42D5-A12F-BB512C64B547} = {D9A0529B-9EC4-4D30-9E05-A5D533739D95}
1300 1335
 		{F3D02050-F39A-4103-8343-09285359A495} = {D9A0529B-9EC4-4D30-9E05-A5D533739D95}
1301 1336
 		{BB2B61AF-734A-4DAD-9326-07F4F9EA088F} = {D9A0529B-9EC4-4D30-9E05-A5D533739D95}
1337
+		{981574AE-5A5E-4F27-BDF1-1B841E374CFF} = {D9A0529B-9EC4-4D30-9E05-A5D533739D95}
1302 1338
 	EndGlobalSection
1303 1339
 EndGlobal

+ 0
- 3
src/mpc-hc/CrashReporterDialog/CrashReporterDialog.vcxproj View File

@@ -64,9 +64,6 @@
64 64
     <ResourceCompile>
65 65
       <AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
66 66
     </ResourceCompile>
67
-    <PreBuildEvent>
68
-      <Command>..\..\..\update_version.bat</Command>
69
-    </PreBuildEvent>
70 67
   </ItemDefinitionGroup>
71 68
   <ItemGroup>
72 69
     <ClInclude Include="CrashReporterDialog.h" />

+ 0
- 24
src/mpc-hc/mpc-hc.vcxproj View File

@@ -133,9 +133,6 @@
133 133
     <TargetName Condition="'$(Configuration)|$(Platform)'=='Release Lite|x64'">$(ProjectName)64</TargetName>
134 134
   </PropertyGroup>
135 135
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
136
-    <PreBuildEvent>
137
-      <Command>..\..\update_version.bat</Command>
138
-    </PreBuildEvent>
139 136
     <ClCompile>
140 137
       <AdditionalIncludeDirectories>..\..\include;..\DSUtil;..\filters\renderer\VideoRenderers;..\thirdparty;..\thirdparty\MediaInfo\library\Source;..\thirdparty\ZenLib\library\Source;$(DXSDK_DIR)Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
141 138
     </ClCompile>
@@ -155,9 +152,6 @@
155 152
     </Manifest>
156 153
   </ItemDefinitionGroup>
157 154
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Lite|Win32'">
158
-    <PreBuildEvent>
159
-      <Command>..\..\update_version.bat</Command>
160
-    </PreBuildEvent>
161 155
     <ClCompile>
162 156
       <AdditionalIncludeDirectories>..\..\include;..\DSUtil;..\filters\renderer\VideoRenderers;..\thirdparty;..\thirdparty\MediaInfo\library\Source;$(DXSDK_DIR)Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
163 157
       <PreprocessorDefinitions>MPCHC_LITE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -181,9 +175,6 @@
181 175
     </Manifest>
182 176
   </ItemDefinitionGroup>
183 177
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
184
-    <PreBuildEvent>
185
-      <Command>..\..\update_version.bat</Command>
186
-    </PreBuildEvent>
187 178
     <ClCompile>
188 179
       <AdditionalIncludeDirectories>..\..\include;..\DSUtil;..\filters\renderer\VideoRenderers;..\thirdparty;..\thirdparty\MediaInfo\library\Source;..\thirdparty\ZenLib\library\Source;$(DXSDK_DIR)Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
189 180
     </ClCompile>
@@ -202,9 +193,6 @@
202 193
     </Manifest>
203 194
   </ItemDefinitionGroup>
204 195
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Lite|x64'">
205
-    <PreBuildEvent>
206
-      <Command>..\..\update_version.bat</Command>
207
-    </PreBuildEvent>
208 196
     <ClCompile>
209 197
       <AdditionalIncludeDirectories>..\..\include;..\DSUtil;..\filters\renderer\VideoRenderers;..\thirdparty;..\thirdparty\MediaInfo\library\Source;$(DXSDK_DIR)Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
210 198
       <PreprocessorDefinitions>MPCHC_LITE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -227,9 +215,6 @@
227 215
     </Manifest>
228 216
   </ItemDefinitionGroup>
229 217
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
230
-    <PreBuildEvent>
231
-      <Command>..\..\update_version.bat</Command>
232
-    </PreBuildEvent>
233 218
     <ClCompile>
234 219
       <AdditionalIncludeDirectories>..\..\include;..\DSUtil;..\filters\renderer\VideoRenderers;..\thirdparty;..\thirdparty\MediaInfo\library\Source;..\thirdparty\ZenLib\library\Source;$(DXSDK_DIR)Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
235 220
     </ClCompile>
@@ -248,9 +233,6 @@
248 233
     </Manifest>
249 234
   </ItemDefinitionGroup>
250 235
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Lite|Win32'">
251
-    <PreBuildEvent>
252
-      <Command>..\..\update_version.bat</Command>
253
-    </PreBuildEvent>
254 236
     <ClCompile>
255 237
       <AdditionalIncludeDirectories>..\..\include;..\DSUtil;..\filters\renderer\VideoRenderers;..\thirdparty;..\thirdparty\MediaInfo\library\Source;$(DXSDK_DIR)Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
256 238
       <PreprocessorDefinitions>MPCHC_LITE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -273,9 +255,6 @@
273 255
     </Manifest>
274 256
   </ItemDefinitionGroup>
275 257
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
276
-    <PreBuildEvent>
277
-      <Command>..\..\update_version.bat</Command>
278
-    </PreBuildEvent>
279 258
     <ClCompile>
280 259
       <AdditionalIncludeDirectories>..\..\include;..\DSUtil;..\filters\renderer\VideoRenderers;..\thirdparty;..\thirdparty\MediaInfo\library\Source;..\thirdparty\ZenLib\library\Source;$(DXSDK_DIR)Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
281 260
     </ClCompile>
@@ -294,9 +273,6 @@
294 273
     </Manifest>
295 274
   </ItemDefinitionGroup>
296 275
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Lite|x64'">
297
-    <PreBuildEvent>
298
-      <Command>..\..\update_version.bat</Command>
299
-    </PreBuildEvent>
300 276
     <ClCompile>
301 277
       <AdditionalIncludeDirectories>..\..\include;..\DSUtil;..\filters\renderer\VideoRenderers;..\thirdparty;..\thirdparty\MediaInfo\library\Source;$(DXSDK_DIR)Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
302 278
       <PreprocessorDefinitions>MPCHC_LITE;%(PreprocessorDefinitions)</PreprocessorDefinitions>

+ 1
- 1
update_version.bat View File

@@ -33,7 +33,7 @@ IF %ERRORLEVEL% NEQ 0 GOTO MissingVar
33 33
 CALL "%COMMON%" :SubDoesExist bash.exe
34 34
 IF %ERRORLEVEL% NEQ 0 GOTO MissingVar
35 35
 
36
-bash.exe ./version.sh
36
+bash.exe ./version.sh %*
37 37
 
38 38
 
39 39
 :END

+ 11
- 7
version.sh View File

@@ -17,9 +17,11 @@
17 17
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 18
 
19 19
 versionfile_fixed="./include/version.h"
20
-versionfile="./include/version_rev.h"
20
+versionfile="./build/version_rev.h"
21 21
 manifestfile="./src/mpc-hc/res/mpc-hc.exe.manifest"
22 22
 
23
+[[ "$1" == "--quiet" ]] && quiet="yes" || quiet=""
24
+
23 25
 # Read major, minor and patch version numbers from static version.h file
24 26
 while read -r _ var value; do
25 27
   if [[ $var == MPC_VERSION_MAJOR ]]; then
@@ -31,7 +33,7 @@ while read -r _ var value; do
31 33
   fi
32 34
 done < "$versionfile_fixed"
33 35
 ver_fixed="${ver_fixed_major}.${ver_fixed_minor}.${ver_fixed_patch}"
34
-echo "Version:   $ver_fixed"
36
+[[ -z "$quiet" ]] && echo "Version:   $ver_fixed"
35 37
 
36 38
 # If we are not inside a git repo use hardcoded values
37 39
 if ! git rev-parse --git-dir > /dev/null 2>&1; then
@@ -42,7 +44,7 @@ if ! git rev-parse --git-dir > /dev/null 2>&1; then
42 44
 else
43 45
   # Get information about the current version
44 46
   describe=$(git describe --long --dirty)
45
-  echo "Describe:  $describe"
47
+  [[ -z "$quiet" ]] && echo "Describe:  $describe"
46 48
 
47 49
   # Get the abbreviated hash of the current changeset
48 50
   hash=${describe##*-g}
@@ -56,9 +58,11 @@ else
56 58
   # Get the current branch name
57 59
   branch=$(git symbolic-ref -q HEAD) && branch=${branch##refs/heads/} || branch="no branch"
58 60
 
59
-  echo "On branch: $branch"
60
-  echo "Hash:      $hash"
61
-  echo "Revision:  $ver"
61
+  if [[ -z "$quiet" ]]; then
62
+    echo "On branch: $branch"
63
+    echo "Hash:      $hash"
64
+    echo "Revision:  $ver"
65
+  fi
62 66
 
63 67
   # If we are on another branch that isn't develop or master, we want extra info like on
64 68
   # which commit from develop it is based on. This assumes we
@@ -71,7 +75,7 @@ else
71 75
       base=$(git merge-base develop HEAD)
72 76
       base=${base:0:7}
73 77
       ver_additional+=" (develop@${base})"
74
-      echo "Mergebase: develop@${base}"
78
+      [[ -z "$quiet" ]] && echo "Mergebase: develop@${base}"
75 79
     fi
76 80
   fi
77 81
 fi

Loading…
Cancel
Save