diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/SConscript | 51 | ||||
| -rw-r--r-- | src/organizer.pro | 4 |
2 files changed, 51 insertions, 4 deletions
diff --git a/src/SConscript b/src/SConscript index 2beec1ae..f09db093 100644 --- a/src/SConscript +++ b/src/SConscript @@ -1,6 +1,43 @@ +import ctypes
import os
import subprocess
+def resolve_name(source):
+ # Get the actual name of the file, after reparse points and symlinks are
+ # taken into account.
+ GENERIC_READ = 0x80000000
+ FILE_SHARE_READ = 0x1
+ OPEN_EXISTING = 0x3
+ FILE_FLAG_BACKUP_SEMANTICS = 0x02000000
+ handle = ctypes.windll.kernel32.CreateFileA(source,
+ GENERIC_READ,
+ FILE_SHARE_READ,
+ None,
+ OPEN_EXISTING,
+ FILE_FLAG_BACKUP_SEMANTICS,
+ None)
+ # get the target
+ FILE_NAME_NORMALIZED = 0x0
+ FILE_NAME_OPENED = 0x8
+ buff = ctypes.create_string_buffer(1024)
+ res = ctypes.windll.kernel32.GetFinalPathNameByHandleA(handle,
+ buff,
+ ctypes.sizeof(buff),
+ FILE_NAME_NORMALIZED)
+ target = buff.value
+ ctypes.windll.kernel32.CloseHandle(handle)
+ return target
+
+def search_up(path, target):
+ while True:
+ if os.path.exists(os.path.join(path, target)):
+ return True
+ npath = os.path.dirname(path)
+ if npath == path:
+ break
+ path = npath
+ return False
+
Import('qt_env')
env = qt_env.Clone()
@@ -53,7 +90,6 @@ for file in env.Glob('*.rc'): # Doing appendunique seems to throw the moc code into a tizzy
env['CPPPATH'] += [
'../archive',
-# '../boss_modified/boss-api',
'../plugins/gamefeatures',
'.', # Why is this necessary?
'${LOOTPATH}',
@@ -83,10 +119,19 @@ cpp_files = [ ]
about_env = env.Clone()
+# This is somewhat of a hack until I can work out a way of setting up a build
+# with all the repos without using millions of junction points
try:
- hgid = subprocess.check_output(['hg', 'id', '-i']).rstrip()
+ target = resolve_name(Dir('.').srcnode().abspath)
+ if search_up(target, '.hg'):
+ hgid = subprocess.check_output([env['MERCURIAL'], 'id', '-i']).rstrip()
+ elif search_up(target, '.git'):
+ hgid = subprocess.check_output([env['GIT'], '-C', target, 'describe',
+ '--tag']).rstrip()
+ else:
+ hgid = "Unknown"
except:
- hgid = 'Unknown version'
+ hgid = "Problem determining version"
# FIXME: It'd be much easier to stringify this in the source code
about_env.AppendUnique(CPPDEFINES = [ 'HGID=\\"%s\\"' % hgid ])
diff --git a/src/organizer.pro b/src/organizer.pro index 5b2c56b1..261e3c1c 100644 --- a/src/organizer.pro +++ b/src/organizer.pro @@ -310,7 +310,9 @@ DEFINES += UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS NOMI DEFINES += BOOST_DISABLE_ASSERTS NDEBUG QT_MESSAGELOGCONTEXT
#DEFINES += QMLJSDEBUGGER
-HGID = 'nothing'
+# If we are running mercurial get the build ID from that. If we aren't, at least
+# don't generate a strange message whenever you open the project
+HGID = $$system(if exist $OUT_PWD\\..\\.hg (hg id -i) else (echo 'Unknown'))
DEFINES += HGID=\\\"$${HGID}\\\"
CONFIG(debug, debug|release) {
|
