git compat:
add git support to cmake and make_svnrev.h.js add .gitignore
This commit is contained in:
parent
5ea787b087
commit
6bc81f5ac4
|
@ -0,0 +1,37 @@
|
|||
|
||||
#ignore thumbnails created by windows
|
||||
Thumbs.db
|
||||
#Ignore files built by Visual Studio
|
||||
*.obj
|
||||
*.exe
|
||||
*.pdb
|
||||
*.user
|
||||
*.aps
|
||||
*.pch
|
||||
*.vspscc
|
||||
*_i.c
|
||||
*_p.c
|
||||
*.ncb
|
||||
*.suo
|
||||
*.tlb
|
||||
*.tlh
|
||||
*.bak
|
||||
*.cache
|
||||
*.ilk
|
||||
*.log
|
||||
[Bb]in
|
||||
[Dd]ebug*/
|
||||
*.lib
|
||||
*.sbr
|
||||
obj/
|
||||
[Rr]elease*/
|
||||
_ReSharper*/
|
||||
[Tt]est[Rr]esult*
|
||||
Binary/Win32
|
||||
Binary/x64
|
||||
Source/Core/Common/Src/svnrev.h
|
||||
*.opensdf
|
||||
*.sdf
|
||||
[Bb]uild
|
||||
|
||||
*.ipch
|
|
@ -46,10 +46,13 @@ function(enable_precompiled_headers PRECOMPILED_HEADER SOURCE_FILE SOURCE_VARIAB
|
|||
endif(MSVC)
|
||||
endfunction(enable_precompiled_headers)
|
||||
|
||||
|
||||
include(FindSubversion OPTIONAL) # for revision info
|
||||
if(Subversion_FOUND AND NOT DOLPHIN_WC_REVISION)
|
||||
Subversion_WC_INFO(${CMAKE_CURRENT_SOURCE_DIR} DOLPHIN) # defines DOLPHIN_WC_REVISION
|
||||
# for revision info
|
||||
include(FindGit OPTIONAL)
|
||||
if(GIT_FOUND AND NOT DOLPHIN_WC_REVISION)
|
||||
# defines DOLPHIN_WC_REVISION
|
||||
EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
|
||||
OUTPUT_VARIABLE DOLPHIN_WC_REVISION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif()
|
||||
|
||||
# Various compile flags
|
||||
|
|
|
@ -5,8 +5,9 @@ var outfile = "./Src/svnrev.h";
|
|||
var svncmd = "SubWCRev ../../.. ./Src/svnrev_template.h " + outfile;
|
||||
var svntestcmd = "SubWCRev ../../..";
|
||||
var hgcmd = "hg svn info";
|
||||
var gitcmd = "git.cmd rev-parse HEAD";
|
||||
|
||||
var SVN = 1, HG = 2;
|
||||
var SVN = 1, HG = 2, git = 3;
|
||||
var file_rev = 0, cur_rev = 0, cur_cms = 0;
|
||||
|
||||
function RunCmdGetMatch(cmd, regex)
|
||||
|
@ -32,14 +33,14 @@ function RunCmdGetMatch(cmd, regex)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (oFS.FileExists(outfile))
|
||||
try
|
||||
{
|
||||
// file exists, read the value of SVN_REV_STR
|
||||
file_rev = oFS.OpenTextFile(outfile).ReadLine().match(/\d+/);
|
||||
// read the value of SVN_REV_STR
|
||||
file_rev = oFS.OpenTextFile(outfile).ReadLine().match(/\d+/);
|
||||
}
|
||||
else
|
||||
catch (e)
|
||||
{
|
||||
// file doesn't exist, create it
|
||||
// file doesn't exist or string not found, (re)create it
|
||||
oFS.CreateTextFile(outfile);
|
||||
}
|
||||
|
||||
|
@ -49,14 +50,21 @@ if (cur_rev)
|
|||
cur_cms = SVN;
|
||||
else
|
||||
{
|
||||
// SubWCRev failed, so use hg
|
||||
// SubWCRev failed, try hg
|
||||
cur_rev = RunCmdGetMatch(hgcmd, /Revision.*?(\d+)/);
|
||||
if (cur_rev)
|
||||
cur_cms = HG;
|
||||
else
|
||||
{
|
||||
WScript.Echo("Neither SVN or Hg revision info found!");
|
||||
WScript.Quit(1);
|
||||
// hg failed, try git
|
||||
cur_rev = RunCmdGetMatch(gitcmd, /(.*)/);
|
||||
if (cur_rev)
|
||||
cur_cms = git;
|
||||
else
|
||||
{
|
||||
WScript.Echo("Trying to get SVN, Hg, and git info all failed");
|
||||
WScript.Quit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue