1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
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()
modules = [
'Core',
'Gui',
'Network',
'Script',
'Sql',
'WebKit',
'Xml',
'XmlPatterns',
'Declarative'
]
if env['QT_MAJOR_VERSION'] > 4:
modules += [
'Widgets',
'Qml',
'WebKitWidgets'
]
env.EnableQtModules(*modules)
env.Uic(env.Glob('*.ui'))
env.RequireLibraries('uibase', 'shared', 'bsatk', 'esptk')
env.AppendUnique(LIBS = [
'shell32',
'user32',
'ole32',
'advapi32',
'gdi32',
'shlwapi',
'Psapi',
'Version'
])
# We have to 'persuade' moc to generate certain other targets and inject them
# into the list of cpps
other_sources = env.AddExtraMoc(env.Glob('*.h'))
for file in env.Glob('*.rc'):
other_sources.append(env.RES(file))
# Note the order of this is important, or you can pick up the wrong report.h...
# Doing appendunique seems to throw the moc code into a tizzy
env['CPPPATH'] += [
'../archive',
'../plugins/gamefeatures',
'.', # Why is this necessary?
'${LOOTPATH}',
'${BOOSTPATH}',
]
#########################FUDGE###############################
env['CPPPATH'] += [
'../plugins/gameGamebryo',
]
#############################################################
env.AppendUnique(CPPDEFINES = [
'_UNICODE',
'_CRT_SECURE_NO_WARNINGS',
'_SCL_SECURE_NO_WARNINGS',
'BOOST_DISABLE_ASSERTS',
'NDEBUG',
'QT_MESSAGELOGCONTEXT'
])
# Boost produces very long names with msvc truncates. Doesn't seem to cause
# problems.
# Also note to remove the -wd4100 I hacked the boost headers (tagged_argument.hpp)
# appropriately.
env.AppendUnique(CPPFLAGS = [ '-wd4503' ])
env.AppendUnique(LINKFLAGS = [
'/SUBSYSTEM:WINDOWS',
'${EXE_MANIFEST_DEPENDENCY}'
])
# modeltest is optional and it doesn't compile anyway...
cpp_files = [
x for x in env.Glob('*.cpp', source = True)
if x.name != 'modeltest.cpp' and x.name != 'aboutdialog.cpp' and \
not x.name.startswith('moc_') # I think this is a strange bug
]
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:
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 = "Problem determining version"
# FIXME: It'd be much easier to stringify this in the source code
about_env.AppendUnique(CPPDEFINES = [ 'HGID=\\"%s\\"' % hgid ])
other_sources.append(about_env.StaticObject('aboutdialog.cpp'))
env.AppendUnique(LIBPATH = "${ZLIBPATH}/build")
env.AppendUnique(LIBS = 'zlibstatic')
prog = env.Program('ModOrganizer',
cpp_files + env.Glob('*.qrc') + other_sources)
env.InstallModule(prog)
for subdir in ('tutorials', 'stylesheets'):
env.Install(os.path.join(env['INSTALL_PATH'], subdir),
env.Glob(os.path.join(subdir, '*')))
# FIXME Sort the translations. Except they don't exist on the 1.2 branch
res = env['QT_USED_MODULES']
Return('res')
"""
CONFIG(debug, debug|release) {
} else {
QMAKE_CXXFLAGS += /Zi /GL
QMAKE_LFLAGS += /DEBUG /LTCG /OPT:REF /OPT:ICF
}
TRANSLATIONS = organizer_en.ts
QMAKE_POST_LINK += xcopy /y /s /I $$quote($$BASEDIR\\*.qm) $$quote($$DSTDIR)\\translations $$escape_expand(\\n)
"""
|