summaryrefslogtreecommitdiff
path: root/src/SConscript
blob: 6783fd8b18f8144fcf4ef38b5bbeaf21a3bcc25a (plain)
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
import os
import subprocess

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'):
    # version.rc is included in app_icon.rc. Not sure why it's a separate file.
    if file.name == 'version.rc':
        continue
    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',
#    '../boss_modified/boss-api',
    '../plugins/gamefeatures',
    '.',            # Why is this necessary?
    '${LOOTPATH}',
    '${BOOSTPATH}',
]

env.AppendUnique(CPPDEFINES = [
    '_UNICODE',
    '_CRT_SECURE_NO_WARNINGS',
    '_SCL_SECURE_NO_WARNINGS',
    'BOOST_DISABLE_ASSERTS',
    'NDEBUG',
    'QT_MESSAGELOGCONTEXT'
])

env.AppendUnique(CPPFLAGS = [ '-wd4100', '-wd4127', '-wd4512', '-wd4189' ])

env.AppendUnique(LINKFLAGS = [
    '/SUBSYSTEM:WINDOWS',
    '${EXE_MANIFEST_DEPENDENCY}'
])

#  modeltest is optional and it doesn't compile anyway...
cpp_files = [
    x for x in Glob('*.cpp')
        if x.name != 'modeltest.cpp' and x.name != 'aboutdialog.cpp'
]

about_env = env.Clone()
try:
    hgid = subprocess.check_output(['hg', 'id', '-i']).rstrip()
except:
    hgid = 'Unknown 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)

"""