-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwscript
203 lines (135 loc) · 3.96 KB
/
wscript
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#!/usr/bin/python
# vim: set filetype=python
import waflib.Logs as L
def dbg0(mod, msg):
if True:
L.info( "[WSCRIPT|%s]: (debug) %s" % (mod, str(msg)) )
def options(opt):
opt.load("compiler_cxx")
opt.add_option('--maya', action='store', default='2013', help='Maya version to build for')
opt.add_option('--arch', action='store', default='x64', help='Processor architecture to build for')
def configure(cfg):
def dbg(msg):
dbg0('configure', msg)
import sys
import os
cwd = os.getcwd().replace('\\', '/') # F*CK windows
is_linux = not sys.platform[0:3] == "win"
opt = cfg.options
arch = str(opt.arch).lower()
dbg("sys.platform: %s" % sys.platform)
dbg("is_linux: %s" % is_linux)
dbg("current dir: %s" % cwd)
dbg("arch: %s" % arch)
if not is_linux:
cfg.env['MSVC_VERSIONS'] = ['msvc 8.0', 'msvc 9.0', 'msvc 10.0']
if arch == "x86":
cfg.env['MSVC_TARGETS'] = ['x86']
else:
cfg.env['MSVC_TARGETS'] = ['x64']
cfg.load('msvc')
else:
cfg.load('compiler_cxx')
dbg("CC_VERSION: %s" % str(cfg.env['CC_VERSION']))
env = cfg.env
env.arch = arch
env.append_value('DEFINES', 'REQUIRE_IOSTREAM'.split())
if is_linux:
env.append_value('DEFINES', 'UNIX LINUX UNIX64 LINUX_64 FUNCPROTO _GNU_SOURCE NDEBUG _BOOL'.split())
else:
env.append_value('DEFINES', 'WIN32 _WIN32 NDEBUG _WINDOWS _AFXDLL _MBCS NT_PLUGIN WIN32_LEAN_AND_MEAN'.split())
if arch == "x64":
env.append_value('DEFINES', 'Bits64_'.split())
includes = []
env.maya_version = str(opt.maya).lower()
maya_version = env.maya_version
shared_path = ""
if is_linux:
# linux base path for Maya includes/libs
#
shared_path = "/U/development/_shared/libs/"
else:
# windows base path for Maya includes/libs
#
shared_path = "U:/development/_shared/libs/"
# MAYA INCLUDE PATH (you might need to edit this)
#
includes.append(shared_path+"maya/"+maya_version+"/include/")
# hot #1
#
if is_linux:
includes.append('%s/3rdparty/linux/include' % cwd)
else:
includes.append('%s/3rdparty/win64' % cwd)
includes.append('%s/3rdparty/include' % cwd)
env.append_value('INCLUDES', includes)
libpath = []
lib_arch = ""
if is_linux:
lib_arch = "lib_linux64/"
else:
if arch == "x64":
lib_arch = "lib_win64/"
else:
lib_arch = "lib_win32/"
# MAYA LIBRARY PATH (you might need to edit this)
#
libpath.append(shared_path+"maya/"+maya_version+"/"+lib_arch)
# hot #3
#
if is_linux:
libpath.append('%s/3rdparty/linux/lib/' % cwd)
else:
libpath.append('%s/3rdparty/win64/' % cwd)
env.append_value("LIBPATH", libpath)
libs = "Foundation OpenMaya OpenMayaUI OpenMayaAnim OpenMayaFX OpenMayaRender".split()
libs.append("Image")
# hot #2
#
if is_linux:
libs += 'fftw3f blitz'.split()
else:
libs += 'libfftw3f-3 blitz'.split()
#if is_linux:
# libs += "GL z".split()
#else:
# libs += "gdi32 OpenGL32 zlib1".split()
env.append_value('LIB', libs)
cxxflags = []
if is_linux:
cxxflags += "-O3 -shared -m64 -fPIC -export-dynamic -Bsymbolic".split()
cxxflags += "-fno-strict-aliasing -Wall -Wno-unused-variable -Wno-sign-compare".split()
cxxflags += "-fopenmp".split()
else:
cxxflags += '/W3 /Ox /Ob2 /Oi /Ot /D "_WINDLL" /fp:fast /MD /EHsc'.split()
env.append_value('CXXFLAGS', cxxflags)
if is_linux:
env['cxxshlib_PATTERN']='%s.so'
else:
env['cxxshlib_PATTERN']='%s.mll'
linkflags = []
if is_linux:
pass
else:
linkflags.append("/export:initializePlugin")
linkflags.append("/export:uninitializePlugin")
linkflags.append("/subsystem:windows")
if arch == "x64":
linkflags.append("/MACHINE:X64")
env.append_value('LINKFLAGS', linkflags)
def build(bld):
import os
sources = []
env = bld.env
is_linux = env['DEST_OS'] == 'linux'
#print env
for top, dirs, files in os.walk('./source/deformer'):
for nm in files:
fp = os.path.join(top, nm)
spl = fp.split(".")
if spl[-1] == "cpp":
sources.append(fp)
bld.shlib(source = sources, target="hotOceanDeformer")
pass
def install(ins):
pass