summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar ShizZy2013-09-13 17:46:27 -0400
committerGravatar ShizZy2013-09-13 17:46:27 -0400
commit9709dd2def24260ec2ea4fdc16e3a78fa206bbb9 (patch)
tree0bd5ba71df0a211cf17a8e46d882094ff704c15e
parentrenamed AkiruBinDir to EmuBinDir (diff)
downloadyuzu-9709dd2def24260ec2ea4fdc16e3a78fa206bbb9.tar.gz
yuzu-9709dd2def24260ec2ea4fdc16e3a78fa206bbb9.tar.xz
yuzu-9709dd2def24260ec2ea4fdc16e3a78fa206bbb9.zip
added scm_rev_gen project to automatically create a header with the git revision on build
-rw-r--r--akiru.sln19
-rw-r--r--src/common/scm_rev_gen.js80
-rw-r--r--src/common/scm_rev_gen.vcxproj79
-rw-r--r--src/common/src/scm_rev.h4
-rw-r--r--src/common/src/version.cpp2
5 files changed, 181 insertions, 3 deletions
diff --git a/akiru.sln b/akiru.sln
index 325d99f6f..045e0015c 100644
--- a/akiru.sln
+++ b/akiru.sln
@@ -1,10 +1,21 @@
1Microsoft Visual Studio Solution File, Format Version 11.00 1Microsoft Visual Studio Solution File, Format Version 11.00
2# Visual Studio 2010 2# Visual Studio 2010
3Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "src\common\common.vcxproj", "{DFE335FC-755D-4BAA-8452-94434F8A1EDB}" 3Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "src\common\common.vcxproj", "{DFE335FC-755D-4BAA-8452-94434F8A1EDB}"
4 ProjectSection(ProjectDependencies) = postProject
5 {69F00340-5C3D-449F-9A80-958435C6CF06} = {69F00340-5C3D-449F-9A80-958435C6CF06}
6 EndProjectSection
4EndProject 7EndProject
5Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "akiru", "src\akiru\akiru.vcxproj", "{CE7D2C07-21CE-4590-81AB-2ADA88A2B85F}" 8Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "akiru", "src\akiru\akiru.vcxproj", "{CE7D2C07-21CE-4590-81AB-2ADA88A2B85F}"
9 ProjectSection(ProjectDependencies) = postProject
10 {69F00340-5C3D-449F-9A80-958435C6CF06} = {69F00340-5C3D-449F-9A80-958435C6CF06}
11 EndProjectSection
6EndProject 12EndProject
7Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core", "src\core\core.vcxproj", "{8AEA7F29-3466-4786-A10D-6A4BD0610977}" 13Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core", "src\core\core.vcxproj", "{8AEA7F29-3466-4786-A10D-6A4BD0610977}"
14 ProjectSection(ProjectDependencies) = postProject
15 {69F00340-5C3D-449F-9A80-958435C6CF06} = {69F00340-5C3D-449F-9A80-958435C6CF06}
16 EndProjectSection
17EndProject
18Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "scm_rev_gen", "src\common\scm_rev_gen.vcxproj", "{69F00340-5C3D-449F-9A80-958435C6CF06}"
8EndProject 19EndProject
9Global 20Global
10 GlobalSection(SolutionConfigurationPlatforms) = preSolution 21 GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -38,6 +49,14 @@ Global
38 {8AEA7F29-3466-4786-A10D-6A4BD0610977}.Release|Win32.Build.0 = Release|Win32 49 {8AEA7F29-3466-4786-A10D-6A4BD0610977}.Release|Win32.Build.0 = Release|Win32
39 {8AEA7F29-3466-4786-A10D-6A4BD0610977}.Release|x64.ActiveCfg = Release|x64 50 {8AEA7F29-3466-4786-A10D-6A4BD0610977}.Release|x64.ActiveCfg = Release|x64
40 {8AEA7F29-3466-4786-A10D-6A4BD0610977}.Release|x64.Build.0 = Release|x64 51 {8AEA7F29-3466-4786-A10D-6A4BD0610977}.Release|x64.Build.0 = Release|x64
52 {69F00340-5C3D-449F-9A80-958435C6CF06}.Debug|Win32.ActiveCfg = Debug|Win32
53 {69F00340-5C3D-449F-9A80-958435C6CF06}.Debug|Win32.Build.0 = Debug|Win32
54 {69F00340-5C3D-449F-9A80-958435C6CF06}.Debug|x64.ActiveCfg = Release|x64
55 {69F00340-5C3D-449F-9A80-958435C6CF06}.Debug|x64.Build.0 = Release|x64
56 {69F00340-5C3D-449F-9A80-958435C6CF06}.Release|Win32.ActiveCfg = Release|Win32
57 {69F00340-5C3D-449F-9A80-958435C6CF06}.Release|Win32.Build.0 = Release|Win32
58 {69F00340-5C3D-449F-9A80-958435C6CF06}.Release|x64.ActiveCfg = Release|x64
59 {69F00340-5C3D-449F-9A80-958435C6CF06}.Release|x64.Build.0 = Release|x64
41 EndGlobalSection 60 EndGlobalSection
42 GlobalSection(SolutionProperties) = preSolution 61 GlobalSection(SolutionProperties) = preSolution
43 HideSolutionNode = FALSE 62 HideSolutionNode = FALSE
diff --git a/src/common/scm_rev_gen.js b/src/common/scm_rev_gen.js
new file mode 100644
index 000000000..e3ca5e67b
--- /dev/null
+++ b/src/common/scm_rev_gen.js
@@ -0,0 +1,80 @@
1var wshShell = new ActiveXObject("WScript.Shell")
2var oFS = new ActiveXObject("Scripting.FileSystemObject");
3
4var outfile = "./src/scm_rev.h";
5var cmd_revision = " rev-parse HEAD";
6var cmd_describe = " describe --always --long --dirty";
7var cmd_branch = " rev-parse --abbrev-ref HEAD";
8
9function GetGitExe()
10{
11 for (var gitexe in {"git.cmd":1, "git":1})
12 {
13 try
14 {
15 wshShell.Exec(gitexe);
16 return gitexe;
17 }
18 catch (e)
19 {}
20 }
21
22 WScript.Echo("Cannot find git or git.cmd, check your PATH:\n" +
23 wshShell.ExpandEnvironmentStrings("%PATH%"));
24 WScript.Quit(1);
25}
26
27function GetFirstStdOutLine(cmd)
28{
29 try
30 {
31 return wshShell.Exec(cmd).StdOut.ReadLine();
32 }
33 catch (e)
34 {
35 // catch "the system cannot find the file specified" error
36 WScript.Echo("Failed to exec " + cmd + " this should never happen");
37 WScript.Quit(1);
38 }
39}
40
41function GetFileContents(f)
42{
43 try
44 {
45 return oFS.OpenTextFile(f).ReadAll();
46 }
47 catch (e)
48 {
49 // file doesn't exist
50 return "";
51 }
52}
53
54// get info from git
55var gitexe = GetGitExe();
56var revision = GetFirstStdOutLine(gitexe + cmd_revision);
57var describe = GetFirstStdOutLine(gitexe + cmd_describe);
58var branch = GetFirstStdOutLine(gitexe + cmd_branch);
59var isMaster = +("master" == branch);
60
61// remove hash (and trailing "-0" if needed) from description
62describe = describe.replace(/(-0)?-[^-]+(-dirty)?$/, '$2');
63
64var out_contents =
65 "#define SCM_REV_STR \"" + revision + "\"\n" +
66 "#define SCM_DESC_STR \"" + describe + "\"\n" +
67 "#define SCM_BRANCH_STR \"" + branch + "\"\n" +
68 "#define SCM_IS_MASTER " + isMaster + "\n";
69
70// check if file needs updating
71if (out_contents == GetFileContents(outfile))
72{
73 WScript.Echo(outfile + " current at " + describe);
74}
75else
76{
77 // needs updating - writeout current info
78 oFS.CreateTextFile(outfile, true).Write(out_contents);
79 WScript.Echo(outfile + " updated to " + describe);
80}
diff --git a/src/common/scm_rev_gen.vcxproj b/src/common/scm_rev_gen.vcxproj
new file mode 100644
index 000000000..e1b413c56
--- /dev/null
+++ b/src/common/scm_rev_gen.vcxproj
@@ -0,0 +1,79 @@
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="Debug|Win32">
5 <Configuration>Debug</Configuration>
6 <Platform>Win32</Platform>
7 </ProjectConfiguration>
8 <ProjectConfiguration Include="Debug|x64">
9 <Configuration>Debug</Configuration>
10 <Platform>x64</Platform>
11 </ProjectConfiguration>
12 <ProjectConfiguration Include="Release|Win32">
13 <Configuration>Release</Configuration>
14 <Platform>Win32</Platform>
15 </ProjectConfiguration>
16 <ProjectConfiguration Include="Release|x64">
17 <Configuration>Release</Configuration>
18 <Platform>x64</Platform>
19 </ProjectConfiguration>
20 </ItemGroup>
21 <ItemGroup>
22 <None Include="scm_rev_gen.js">
23 </None>
24 </ItemGroup>
25 <ItemGroup>
26 <ClInclude Include="force_rebuild.h" />
27 <ClInclude Include="src\scm_rev.h" />
28 </ItemGroup>
29 <PropertyGroup Label="Globals">
30 <ProjectGuid>{69F00340-5C3D-449F-9A80-958435C6CF06}</ProjectGuid>
31 <RootNamespace>scm_rev_gen</RootNamespace>
32 <ProjectName>scm_rev_gen</ProjectName>
33 </PropertyGroup>
34 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
35 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
36 <ConfigurationType>Utility</ConfigurationType>
37 <UseDebugLibraries>false</UseDebugLibraries>
38 <CharacterSet>Unicode</CharacterSet>
39 </PropertyGroup>
40 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
41 <ImportGroup Label="ExtensionSettings">
42 </ImportGroup>
43 <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
44 <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
45 <Import Project="..\..\vsprops\base.props" />
46 </ImportGroup>
47 <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
48 <Import Project="..\..\vsprops\base.props" />
49 </ImportGroup>
50 <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
51 <Import Project="..\..\vsprops\base.props" />
52 </ImportGroup>
53 <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
54 <Import Project="..\..\vsprops\base.props" />
55 </ImportGroup>
56 <PropertyGroup Label="UserMacros" />
57 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
58 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
59 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
60 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
61 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
62 <PreBuildEvent>
63 <Command>cscript /nologo /E:JScript "scm_rev_gen.js"</Command>
64 </PreBuildEvent>
65 </ItemDefinitionGroup>
66 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
67 <PreBuildEvent>
68 <Command>cscript /nologo /E:JScript "scm_rev_gen.js"</Command>
69 </PreBuildEvent>
70 </ItemDefinitionGroup>
71 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
72 <PreBuildEvent>
73 <Command>cscript /nologo /E:JScript "scm_rev_gen.js"</Command>
74 </PreBuildEvent>
75 </ItemDefinitionGroup>
76 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
77 <ImportGroup Label="ExtensionTargets">
78 </ImportGroup>
79</Project> \ No newline at end of file
diff --git a/src/common/src/scm_rev.h b/src/common/src/scm_rev.h
index cb4eccfd0..05ad76964 100644
--- a/src/common/src/scm_rev.h
+++ b/src/common/src/scm_rev.h
@@ -1,4 +1,4 @@
1#define SCM_REV_STR "7d11f8cedd7c135d96880f19ecbd3ff87a60a11f" 1#define SCM_REV_STR "bfa6493324336066a1ef9d04f336faacae57d9f3"
2#define SCM_DESC_STR "3.5-254-dirty" 2#define SCM_DESC_STR "bfa6493"
3#define SCM_BRANCH_STR "master" 3#define SCM_BRANCH_STR "master"
4#define SCM_IS_MASTER 1 4#define SCM_IS_MASTER 1
diff --git a/src/common/src/version.cpp b/src/common/src/version.cpp
index 47d7b52ad..d5cf10c3d 100644
--- a/src/common/src/version.cpp
+++ b/src/common/src/version.cpp
@@ -13,7 +13,7 @@
13 #define BUILD_TYPE_STR "" 13 #define BUILD_TYPE_STR ""
14#endif 14#endif
15 15
16const char *scm_rev_str = "Dolphin " 16const char *scm_rev_str = "Akiru "
17#if !SCM_IS_MASTER 17#if !SCM_IS_MASTER
18 "[" SCM_BRANCH_STR "] " 18 "[" SCM_BRANCH_STR "] "
19#endif 19#endif