fixup scons (osx) to generate scmrev.h and build.

hopefully this will be the last code change committed directly to master for a while... :/
next is cmake to replace scons on osx hopefully. pointers anyone? (soren?)
This commit is contained in:
Shawn 2011-08-23 03:50:06 -07:00
parent 5c15292fd8
commit 7f56842a79
4 changed files with 19 additions and 12 deletions

3
.gitignore vendored
View File

@ -29,8 +29,11 @@ _ReSharper*/
[Tt]est[Rr]esult* [Tt]est[Rr]esult*
Binary/Win32 Binary/Win32
Binary/x64 Binary/x64
Binary/Darwin*
Source/Core/Common/Src/scmrev.h Source/Core/Common/Src/scmrev.h
*.opensdf *.opensdf
*.sdf *.sdf
[Bb]uild [Bb]uild
*.ipch *.ipch
.sconsign.dblite
Externals/scons-local/*

View File

@ -2,6 +2,7 @@
# -*- python -*- # -*- python -*-
import os import os
import re
import sys import sys
import platform import platform
@ -92,7 +93,10 @@ if not env.has_key('install') or env['install'] == 'local':
if env['flavor'] == 'debug' or env['flavor'] == 'prof': if env['flavor'] == 'debug' or env['flavor'] == 'prof':
env['prefix'] += '-' + env['flavor'] env['prefix'] += '-' + env['flavor']
env['svnrev'] = os.popen('svnversion -n .').read().split(':')[0] env['gitrev'] = os.popen('git rev-parse HEAD').read().split('\n')[0]
env['gitdesc'] = re.sub('-[^-]+(-dirty)?$', '',
os.popen('git describe --always --long --dirty').read().split('\n')[0])
env['gitbranch'] = os.popen('git rev-parse --abbrev-ref HEAD').read().split('\n')[0]
# OS X specifics # OS X specifics
if sys.platform == 'darwin': if sys.platform == 'darwin':

View File

@ -4,16 +4,16 @@ Import('env')
import os import os
import sys import sys
def createVersion(env, target, source): out_contents =\
tmpstr = open(source[0].path, 'r').read().\ '#define SCM_REV_STR "' + env['gitrev'] + '"\n' +\
replace("$WCMODS?$WCREV$M:$WCREV$$", env['svnrev']) '#define SCM_DESC_STR "' + env['gitdesc'] + '"\n' +\
outfile = open(target[0].path, 'w') '#define SCM_BRANCH_STR "' + env['gitbranch'] + '"\n' +\
outfile.write(tmpstr + '\n') '#define SCM_IS_MASTER ' + ('1' if env['gitbranch'] == 'master' else '0') + '\n\n'
outfile.close()
Execute(Delete('Src/svnrev.h')) Execute(Delete('Src/scmrev.h'))
env.Command('Src/svnrev.h', 'Src/svnrev_template.h', outfile = open('Src/scmrev.h', 'w')
[Delete('${TARGET.srcpath}'), createVersion]) outfile.write(out_contents)
outfile.close()
files = [ files = [
'Src/ABI.cpp', 'Src/ABI.cpp',

View File

@ -114,7 +114,7 @@ elif sys.platform == 'darwin':
CFBundleIdentifier = 'com.dolphin-emulator.dolphin', CFBundleIdentifier = 'com.dolphin-emulator.dolphin',
CFBundleLocalizations = languages, CFBundleLocalizations = languages,
CFBundlePackageType = 'APPL', CFBundlePackageType = 'APPL',
CFBundleShortVersionString = env['svnrev'], CFBundleShortVersionString = env['gitdesc'],
CFBundleVersion = '3.0', CFBundleVersion = '3.0',
LSMinimumSystemVersion = '10.5.4', LSMinimumSystemVersion = '10.5.4',
LSRequiresCarbon = True, LSRequiresCarbon = True,