forked from ahmidou/SpliceMaya
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SConstruct
80 lines (66 loc) · 2.99 KB
/
SConstruct
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
import os, platform
import shutil
spliceEnv = Environment()
def RemoveFolderCmd(target, source, env):
if os.path.exists(source[0].abspath):
shutil.rmtree(source[0].abspath)
# define the clean target
if 'clean' in COMMAND_LINE_TARGETS:
cleanBuild = spliceEnv.Command( spliceEnv.File('cleaning build folder'), spliceEnv.Dir('.build'), RemoveFolderCmd )
cleanStage = spliceEnv.Command( spliceEnv.File('cleaning stage folder'), spliceEnv.Dir('.stage'), RemoveFolderCmd )
spliceEnv.Alias('clean', [cleanBuild, cleanStage])
Return()
# check environment variables
for var in ['FABRIC_DIR', 'FABRIC_SPLICE_VERSION', 'FABRIC_BUILD_OS', 'FABRIC_BUILD_ARCH', 'FABRIC_BUILD_TYPE', 'BOOST_DIR', 'MAYA_INCLUDE_DIR', 'MAYA_LIB_DIR', 'MAYA_VERSION']:
if not os.environ.has_key(var):
print 'The environment variable %s is not defined.' % var
exit(0)
if var.lower().endswith('_dir'):
if not os.path.exists(os.environ[var]):
print 'The path for environment variable %s does not exist.' % var
exit(0)
spliceEnv = Environment()
if not os.path.exists(spliceEnv.Dir('.stage').abspath):
os.makedirs(spliceEnv.Dir('.stage').abspath)
# determine if we have the SpliceAPI two levels up
spliceApiDir = spliceEnv.Dir('..').Dir('..').Dir('SpliceAPI')
# try to get the Splice API from there
if os.path.exists(spliceApiDir.abspath):
(spliceAPIAlias, spliceAPIFiles) = SConscript(
dirs = [spliceApiDir],
exports = {
'parentEnv': spliceEnv,
'FABRIC_DIR': os.environ['FABRIC_DIR'],
'FABRIC_SPLICE_VERSION': os.environ['FABRIC_SPLICE_VERSION'],
'FABRIC_BUILD_TYPE': os.environ['FABRIC_BUILD_TYPE'],
'FABRIC_BUILD_OS': os.environ['FABRIC_BUILD_OS'],
'FABRIC_BUILD_ARCH': os.environ['FABRIC_BUILD_ARCH'],
'STAGE_DIR': spliceEnv.Dir('.build').Dir('SpliceAPI').Dir('.stage'),
'BOOST_DIR': os.environ['BOOST_DIR']
},
variant_dir = spliceEnv.Dir('.build').Dir('SpliceAPI')
)
spliceApiDir = spliceEnv.Dir('.build').Dir('SpliceAPI').Dir('.stage').abspath
else:
print 'The folder "'+spliceApiDir.abspath+'" does not exist. Please see the README.md for build instructions.'
exit(0)
(mayaSpliceAlias, mayaSpliceFiles) = SConscript(
os.path.join('SConscript'),
exports = {
'parentEnv': spliceEnv,
'FABRIC_DIR': os.environ['FABRIC_DIR'],
'FABRIC_SPLICE_VERSION': os.environ['FABRIC_SPLICE_VERSION'],
'FABRIC_BUILD_TYPE': os.environ['FABRIC_BUILD_TYPE'],
'FABRIC_BUILD_OS': os.environ['FABRIC_BUILD_OS'],
'FABRIC_BUILD_ARCH': os.environ['FABRIC_BUILD_ARCH'],
'STAGE_DIR': spliceEnv.Dir('.stage').Dir('SpliceIntegrations').Dir('FabricSpliceMaya'+os.environ['MAYA_VERSION']),
'BOOST_DIR': os.environ['BOOST_DIR'],
'MAYA_INCLUDE_DIR': os.environ['MAYA_INCLUDE_DIR'],
'MAYA_LIB_DIR': os.environ['MAYA_LIB_DIR'],
'MAYA_VERSION': os.environ['MAYA_VERSION']
},
variant_dir = spliceEnv.Dir('.build').Dir(os.environ['MAYA_VERSION'])
)
allAliases = [mayaSpliceAlias]
spliceEnv.Alias('all', allAliases)
spliceEnv.Default(allAliases)