-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathSConscript
More file actions
111 lines (92 loc) · 3.05 KB
/
Copy pathSConscript
File metadata and controls
111 lines (92 loc) · 3.05 KB
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
#
# Copyright 2010-2015 Fabric Software Inc. All rights reserved.
#
import os
Import('buildOS', 'buildArch', 'buildType', 'parentEnv', 'fabricFlags', 'qtFlags', 'qtMOC', 'uiLibPrefix', 'qtDir', 'stageDir')
suffix = '4'
if buildType == 'Debug':
suffix = 'd4'
qtMOCBuilder = Builder(
action = [[qtMOC, '-o', '$TARGET', '$SOURCE']],
prefix = 'moc_',
suffix = '.cc',
src_suffix = '.h',
)
# create the build environment
env = parentEnv.Clone()
env.Append(BUILDERS = {'QTMOC': qtMOCBuilder})
env.Append(CPPPATH = [env.Dir('.').srcnode()])
if buildOS == 'Darwin':
env.Append(CXXFLAGS = ['-std=c++03'])
env.Append(CXXFLAGS = ['-stdlib=libstdc++'])
env.Append(LINKFLAGS = ['-stdlib=libstdc++'])
if buildOS == 'Linux':
env.Append(CPPPATH=['/usr/include/qt4'])
if buildOS == 'Windows':
env.Append(CPPDEFINES = ['FABRIC_OS_WINDOWS'])
elif buildOS == 'Linux':
env.Append(CPPDEFINES = ['FABRIC_OS_LINUX'])
elif buildOS == 'Darwin':
env.Append(CPPDEFINES = ['FABRIC_OS_DARWIN'])
# # enable timers
# env.Append(CPPDEFINES = ['FABRICUI_TIMERS'])
def GlobQObjectHeaders(env, filter):
headers = Flatten(env.Glob(filter))
qobjectHeaders = []
for header in headers:
content = open(header.srcnode().abspath, 'rb').read()
if content.find('Q_OBJECT') > -1:
qobjectHeaders.append(header)
return qobjectHeaders
Export('GlobQObjectHeaders')
env.AddMethod(GlobQObjectHeaders)
def GlobQObjectSources(env, filter):
headers = env.GlobQObjectHeaders(filter)
sources = []
for header in headers:
sources += env.QTMOC(header)
return sources
Export('GlobQObjectSources')
env.AddMethod(GlobQObjectSources)
if buildType == 'Debug':
env.Append(CPPDEFINES = ['_DEBUG'])
env.MergeFlags(fabricFlags)
env.MergeFlags(qtFlags)
dirs = [
'Util',
'Style',
'TreeView',
'ValueEditor',
'GraphView',
'GraphView/Commands',
'KLEditor',
'DFG',
'DFG/Commands',
'DFG/Dialogs',
'SceneHub',
'Viewports',
]
includeDir = stageDir.Dir('include').Dir('FabricServices')
installedHeaders = []
sources = []
for d in dirs:
headers = Flatten(env.Glob(os.path.join(env.Dir('.').abspath, d, '*.h')))
sources += Flatten(env.Glob(os.path.join(env.Dir('.').abspath, d, '*.cpp')))
sources += env.GlobQObjectSources(os.path.join(env.Dir('.').abspath, d, '*.h'))
if uiLibPrefix == 'ui':
installedHeaders += env.Install(stageDir.Dir('include').Dir('FabricUI').Dir(d), headers)
uiLib = env.StaticLibrary('FabricUI', sources)
uiFiles = installedHeaders
if uiLibPrefix == 'ui':
uiFiles += env.Install(stageDir.Dir('lib'), uiLib)
icons = env.Install(stageDir.srcnode().Dir('Resources').Dir('Icons'), Glob(os.path.join(env.Dir('GraphView').Dir('images').srcnode().abspath, '*.png')))
env.Depends(uiLib, icons)
locals()[uiLibPrefix + 'Lib'] = uiLib
locals()[uiLibPrefix + 'IncludeDir'] = env.Dir('.').srcnode()
locals()[uiLibPrefix + 'Flags'] = {
'CPPPATH': [locals()[uiLibPrefix + 'IncludeDir']],
'LIBS': [locals()[uiLibPrefix + 'Lib']]
}
Export(uiLibPrefix + 'Lib', uiLibPrefix + 'IncludeDir', uiLibPrefix + 'Flags')
env.Alias(uiLibPrefix + 'Lib', uiFiles)
Return('uiFiles')