]>
Commit | Line | Data |
---|---|---|
c368d904 RD |
1 | #!/usr/bin/env python |
2 | #---------------------------------------------------------------------- | |
3 | ||
1e4a197e | 4 | import sys, os, glob |
c368d904 RD |
5 | from distutils.core import setup, Extension |
6 | from distutils.file_util import copy_file | |
7 | from distutils.dir_util import mkpath | |
8 | from distutils.dep_util import newer | |
1e4a197e RD |
9 | from distutils.spawn import spawn |
10 | from distutils.command.install_data import install_data | |
c368d904 RD |
11 | |
12 | #---------------------------------------------------------------------- | |
13 | # flags and values that affect this script | |
14 | #---------------------------------------------------------------------- | |
15 | ||
1e4a197e | 16 | VERSION = "2.5.0p1" |
c368d904 RD |
17 | DESCRIPTION = "Cross platform GUI toolkit for Python" |
18 | AUTHOR = "Robin Dunn" | |
b166c703 | 19 | AUTHOR_EMAIL = "Robin Dunn <robin@alldunn.com>" |
c368d904 | 20 | URL = "http://wxPython.org/" |
e2e02194 | 21 | LICENSE = "wxWindows (LGPL derivative)" |
c368d904 RD |
22 | LONG_DESCRIPTION = """\ |
23 | wxPython is a GUI toolkit for Python that is a wrapper around the | |
24 | wxWindows C++ GUI library. wxPython provides a large variety of | |
1b62f00d | 25 | window types and controls, all implemented with a native look and |
1e4a197e | 26 | feel (by using the native widgets) on the platforms it is supported |
c368d904 RD |
27 | on. |
28 | """ | |
29 | ||
30 | ||
1e4a197e RD |
31 | # Config values below this point can be reset on the setup.py command line. |
32 | ||
f221f8eb | 33 | BUILD_GLCANVAS = 1 # If true, build the contrib/glcanvas extension module |
c368d904 RD |
34 | BUILD_OGL = 1 # If true, build the contrib/ogl extension module |
35 | BUILD_STC = 1 # If true, build the contrib/stc extension module | |
d56cebe7 | 36 | BUILD_XRC = 1 # XML based resource system |
ebf4302c | 37 | BUILD_GIZMOS = 1 # Build a module for the gizmos contrib library |
1e4a197e | 38 | BUILD_DLLWIDGET = 0# Build a module that enables unknown wx widgets |
37bd51c0 | 39 | # to be loaded from a DLL and to be used from Python. |
d56cebe7 | 40 | |
c731eb47 RD |
41 | # Internet Explorer wrapper (experimental) |
42 | BUILD_IEWIN = (os.name == 'nt') | |
78e8819c | 43 | |
1e4a197e RD |
44 | BUILD_CANVAS = 0 # Build a canvas module using the one in wx/contrib (experimental) |
45 | BUILD_ART2D = 0 # Build a canvas module using code from the wxArt2D project (experimental) | |
46 | ||
47 | ||
c368d904 | 48 | CORE_ONLY = 0 # if true, don't build any of the above |
4a61305d | 49 | |
1e4a197e | 50 | PREP_ONLY = 0 # Only run the prepatory steps, not the actual build. |
c368d904 RD |
51 | |
52 | USE_SWIG = 0 # Should we actually execute SWIG, or just use the | |
53 | # files already in the distribution? | |
54 | ||
a541c325 RD |
55 | UNICODE = 0 # This will pass the 'wxUSE_UNICODE' flag to SWIG and |
56 | # will ensure that the right headers are found and the | |
57 | # right libs are linked. | |
c8bc7bb8 | 58 | |
1e4a197e RD |
59 | IN_CVS_TREE = 1 # Set to true if building in a full wxWindows CVS |
60 | # tree, or the new style of a full wxPythonSrc tarball. | |
61 | # wxPython used to be distributed as a separate source | |
62 | # tarball without the wxWindows but with a copy of the | |
63 | # needed contrib code. That's no longer the case and so | |
64 | # this setting is now defaulting to true. Eventually it | |
65 | # should be removed entirly. | |
c368d904 | 66 | |
5c8e1089 RD |
67 | UNDEF_NDEBUG = 1 # Python 2.2 on Unix/Linux by default defines NDEBUG, |
68 | # and distutils will pick this up and use it on the | |
69 | # compile command-line for the extensions. This could | |
70 | # conflict with how wxWindows was built. If NDEBUG is | |
71 | # set then wxWindows' __WXDEBUG__ setting will be turned | |
72 | # off. If wxWindows was actually built with it turned | |
73 | # on then you end up with mismatched class structures, | |
74 | # and wxPython will crash. | |
75 | ||
2eb31f8b RD |
76 | NO_SCRIPTS = 0 # Don't install the tool scripts |
77 | ||
1e4a197e RD |
78 | WX_CONFIG = None # Usually you shouldn't need to touch this, but you can set |
79 | # it to pass an alternate version of wx-config or alternate | |
80 | # flags, eg. as required by the .deb in-tree build. By | |
81 | # default a wx-config command will be assembled based on | |
82 | # version, port, etc. and it will be looked for on the | |
83 | # default $PATH. | |
84 | ||
85 | WXPORT = 'gtk' # On Linux/Unix there are several ports of wxWindows available. | |
86 | # Setting this value lets you select which will be used for | |
87 | # the wxPython build. Possibilites are 'gtk', 'gtk2' and | |
88 | # 'x11'. Curently only gtk and gtk2 works. | |
89 | ||
90 | BUILD_BASE = "build" # Directory to use for temporary build files. | |
2eb31f8b | 91 | |
c368d904 | 92 | |
a541c325 | 93 | |
c368d904 RD |
94 | # Some MSW build settings |
95 | ||
d440a0e7 | 96 | FINAL = 0 # Mirrors use of same flag in wx makefiles, |
c368d904 RD |
97 | # (0 or 1 only) should probably find a way to |
98 | # autodetect this... | |
99 | ||
d440a0e7 | 100 | HYBRID = 1 # If set and not debug or FINAL, then build a |
c368d904 RD |
101 | # hybrid extension that can be used by the |
102 | # non-debug version of python, but contains | |
103 | # debugging symbols for wxWindows and wxPython. | |
104 | # wxWindows must have been built with /MD, not /MDd | |
105 | # (using FINAL=hybrid will do it.) | |
106 | ||
1e4a197e | 107 | WXDLLVER = '250' # Version part of wxWindows DLL name |
c368d904 RD |
108 | |
109 | ||
cfe766c3 RD |
110 | #---------------------------------------------------------------------- |
111 | ||
112 | def msg(text): | |
113 | if __name__ == "__main__": | |
114 | print text | |
115 | ||
a541c325 | 116 | |
55c020cf RD |
117 | def opj(*args): |
118 | path = apply(os.path.join, args) | |
119 | return os.path.normpath(path) | |
cfe766c3 | 120 | |
a541c325 | 121 | |
a4fbdd76 RD |
122 | def libFlag(): |
123 | if FINAL: | |
c8bc7bb8 | 124 | rv = '' |
a4fbdd76 | 125 | elif HYBRID: |
c8bc7bb8 | 126 | rv = 'h' |
a4fbdd76 | 127 | else: |
c8bc7bb8 | 128 | rv = 'd' |
a541c325 | 129 | if UNICODE: |
c8bc7bb8 RD |
130 | rv = 'u' + rv |
131 | return rv | |
a4fbdd76 RD |
132 | |
133 | ||
c368d904 RD |
134 | #---------------------------------------------------------------------- |
135 | # Some other globals | |
136 | #---------------------------------------------------------------------- | |
137 | ||
138 | PKGDIR = 'wxPython' | |
139 | wxpExtensions = [] | |
1e4a197e | 140 | DATA_FILES = [] |
c368d904 RD |
141 | |
142 | force = '--force' in sys.argv or '-f' in sys.argv | |
143 | debug = '--debug' in sys.argv or '-g' in sys.argv | |
144 | ||
1e4a197e RD |
145 | # change the PORT default for wxMac |
146 | if sys.platform[:6] == "darwin": | |
147 | WXPORT = 'mac' | |
22d08289 | 148 | |
1e4a197e RD |
149 | # and do the same for wxMSW, just for consistency |
150 | if os.name == 'nt': | |
151 | WXPORT = 'msw' | |
22d08289 | 152 | |
c368d904 RD |
153 | |
154 | #---------------------------------------------------------------------- | |
155 | # Check for build flags on the command line | |
156 | #---------------------------------------------------------------------- | |
157 | ||
5c8e1089 | 158 | # Boolean (int) flags |
b166c703 | 159 | for flag in ['BUILD_GLCANVAS', 'BUILD_OGL', 'BUILD_STC', 'BUILD_XRC', |
c731eb47 | 160 | 'BUILD_GIZMOS', 'BUILD_DLLWIDGET', 'BUILD_IEWIN', |
1e4a197e | 161 | 'CORE_ONLY', 'PREP_ONLY', 'USE_SWIG', 'IN_CVS_TREE', 'UNICODE', |
2eb31f8b | 162 | 'UNDEF_NDEBUG', 'NO_SCRIPTS', |
b166c703 | 163 | 'FINAL', 'HYBRID', ]: |
c368d904 | 164 | for x in range(len(sys.argv)): |
1e4a197e RD |
165 | if sys.argv[x].find(flag) == 0: |
166 | pos = sys.argv[x].find('=') + 1 | |
c368d904 RD |
167 | if pos > 0: |
168 | vars()[flag] = eval(sys.argv[x][pos:]) | |
169 | sys.argv[x] = '' | |
170 | ||
5c8e1089 | 171 | # String options |
1e4a197e | 172 | for option in ['WX_CONFIG', 'WXDLLVER', 'BUILD_BASE', 'WXPORT']: |
afa3e1ed | 173 | for x in range(len(sys.argv)): |
1e4a197e RD |
174 | if sys.argv[x].find(option) == 0: |
175 | pos = sys.argv[x].find('=') + 1 | |
afa3e1ed RL |
176 | if pos > 0: |
177 | vars()[option] = sys.argv[x][pos:] | |
178 | sys.argv[x] = '' | |
179 | ||
c368d904 RD |
180 | sys.argv = filter(None, sys.argv) |
181 | ||
182 | ||
1e4a197e RD |
183 | #---------------------------------------------------------------------- |
184 | # some helper functions | |
185 | #---------------------------------------------------------------------- | |
186 | ||
187 | def Verify_WX_CONFIG(): | |
188 | """ Called below for the builds that need wx-config, | |
189 | if WX_CONFIG is not set then tries to select the specific | |
190 | wx*-config script based on build options. If not found | |
191 | then it defaults to 'wx-config'. | |
192 | """ | |
193 | # if WX_CONFIG hasn't been set to an explicit value then construct one. | |
194 | global WX_CONFIG | |
195 | if WX_CONFIG is None: | |
196 | if debug: # TODO: Fix this. wxPython's --debug shouldn't be tied to wxWindows... | |
197 | df = 'd' | |
198 | else: | |
199 | df = '' | |
200 | if UNICODE: | |
201 | uf = 'u' | |
202 | else: | |
203 | uf = '' | |
204 | ver2 = VERSION[:3] | |
205 | WX_CONFIG = 'wx%s%s%s-%s-config' % (WXPORT, uf, df, ver2) | |
206 | ||
207 | searchpath = os.environ["PATH"] | |
208 | for p in searchpath.split(':'): | |
209 | fp = os.path.join(p, WX_CONFIG) | |
210 | if os.path.exists(fp) and os.access(fp, os.X_OK): | |
211 | # success | |
212 | msg("Found wx-config: " + fp) | |
213 | WX_CONFIG = fp | |
214 | break | |
215 | else: | |
216 | msg("WX_CONFIG not specified and %s not found on $PATH " | |
217 | "defaulting to \"wx-config\"" % WX_CONFIG) | |
218 | WX_CONFIG = 'wx-config' | |
219 | ||
220 | ||
221 | ||
222 | def run_swig(files, dir, gendir, package, USE_SWIG, force, swig_args, swig_deps=[]): | |
223 | """Run SWIG the way I want it done""" | |
224 | if not os.path.exists(os.path.join(dir, gendir)): | |
225 | os.mkdir(os.path.join(dir, gendir)) | |
226 | ||
227 | sources = [] | |
228 | ||
229 | for file in files: | |
230 | basefile = os.path.splitext(file)[0] | |
231 | i_file = os.path.join(dir, file) | |
232 | py_file = os.path.join(dir, gendir, basefile+'.py') | |
233 | cpp_file = os.path.join(dir, gendir, basefile+'.cpp') | |
234 | ||
235 | sources.append(cpp_file) | |
236 | ||
237 | if USE_SWIG: | |
238 | for dep in swig_deps: | |
239 | if newer(dep, py_file) or newer(dep, cpp_file): | |
240 | force = 1 | |
241 | break | |
242 | ||
243 | if force or newer(i_file, py_file) or newer(i_file, cpp_file): | |
244 | # we need forward slashes here even on win32 | |
245 | cpp_file = '/'.join(cpp_file.split('\\')) | |
246 | i_file = '/'.join(i_file.split('\\')) | |
247 | ||
248 | cmd = ['./wxSWIG/wxswig'] + swig_args + ['-I'+dir, '-c', '-o', cpp_file, i_file] | |
249 | msg(' '.join(cmd)) | |
250 | spawn(cmd) | |
251 | ||
252 | # copy the generated python file to the package directory | |
253 | copy_file(py_file, package, update=not force, verbose=0) | |
254 | ||
255 | return sources | |
256 | ||
257 | ||
258 | ||
259 | def contrib_copy_tree(src, dest, verbose=0): | |
260 | """Update local copies of wxWindows contrib files""" | |
261 | from distutils.dir_util import mkpath, copy_tree | |
262 | ||
263 | mkpath(dest, verbose=verbose) | |
264 | copy_tree(src, dest, update=1, verbose=verbose) | |
265 | ||
266 | ||
267 | ||
268 | class smart_install_data(install_data): | |
269 | def run(self): | |
270 | #need to change self.install_dir to the actual library dir | |
271 | install_cmd = self.get_finalized_command('install') | |
272 | self.install_dir = getattr(install_cmd, 'install_lib') | |
273 | return install_data.run(self) | |
274 | ||
275 | ||
276 | def build_locale_dir(destdir, verbose=1): | |
277 | """Build a locale dir under the wxPython package for MSW""" | |
278 | moFiles = glob.glob(opj(WXDIR, 'locale', '*.mo')) | |
279 | for src in moFiles: | |
280 | lang = os.path.splitext(os.path.basename(src))[0] | |
281 | dest = opj(destdir, lang, 'LC_MESSAGES') | |
282 | mkpath(dest, verbose=verbose) | |
283 | copy_file(src, opj(dest, 'wxstd.mo'), update=1, verbose=verbose) | |
284 | ||
285 | ||
286 | def build_locale_list(srcdir): | |
287 | # get a list of all files under the srcdir, to be used for install_data | |
288 | def walk_helper(lst, dirname, files): | |
289 | for f in files: | |
290 | filename = opj(dirname, f) | |
291 | if not os.path.isdir(filename): | |
292 | lst.append( (dirname, [filename]) ) | |
293 | file_list = [] | |
294 | os.path.walk(srcdir, walk_helper, file_list) | |
295 | return file_list | |
296 | ||
297 | ||
298 | ||
299 | ||
c8bc7bb8 RD |
300 | |
301 | #---------------------------------------------------------------------- | |
302 | # sanity checks | |
303 | ||
c368d904 | 304 | if CORE_ONLY: |
f221f8eb | 305 | BUILD_GLCANVAS = 0 |
c368d904 RD |
306 | BUILD_OGL = 0 |
307 | BUILD_STC = 0 | |
b166c703 | 308 | BUILD_XRC = 0 |
ff5f1aba RD |
309 | BUILD_GIZMOS = 0 |
310 | BUILD_DLLWIDGET = 0 | |
c731eb47 | 311 | BUILD_IEWIN = 0 |
ff5f1aba | 312 | |
1e4a197e RD |
313 | if debug: |
314 | FINAL = 0 | |
315 | HYBRID = 0 | |
c368d904 | 316 | |
1e4a197e RD |
317 | if FINAL: |
318 | HYBRID = 0 | |
c8bc7bb8 | 319 | |
1e4a197e RD |
320 | if UNICODE and WXPORT not in ['msw', 'gtk2']: |
321 | raise SystemExit, "UNICODE mode not currently supported on this WXPORT: "+WXPORT | |
a541c325 RD |
322 | |
323 | ||
c368d904 RD |
324 | #---------------------------------------------------------------------- |
325 | # Setup some platform specific stuff | |
326 | #---------------------------------------------------------------------- | |
327 | ||
328 | if os.name == 'nt': | |
329 | # Set compile flags and such for MSVC. These values are derived | |
a541c325 RD |
330 | # from the wxWindows makefiles for MSVC, other compilers settings |
331 | # will probably vary... | |
332 | if os.environ.has_key('WXWIN'): | |
333 | WXDIR = os.environ['WXWIN'] | |
334 | else: | |
335 | msg("WARNING: WXWIN not set in environment.") | |
336 | WXDIR = '..' # assumes in CVS tree | |
c368d904 RD |
337 | WXPLAT = '__WXMSW__' |
338 | GENDIR = 'msw' | |
339 | ||
c368d904 | 340 | includes = ['src', |
a4fbdd76 | 341 | opj(WXDIR, 'lib', 'mswdll' + libFlag()), |
55c020cf | 342 | opj(WXDIR, 'include'), |
c368d904 RD |
343 | ] |
344 | ||
1e4a197e RD |
345 | defines = [ ('WIN32', None), |
346 | ('__WIN32__', None), | |
c368d904 RD |
347 | ('_WINDOWS', None), |
348 | ('__WINDOWS__', None), | |
349 | ('WINVER', '0x0400'), | |
350 | ('__WIN95__', None), | |
351 | ('STRICT', None), | |
352 | ||
353 | (WXPLAT, None), | |
354 | ('WXUSINGDLL', '1'), | |
355 | ||
356 | ('SWIG_GLOBAL', None), | |
357 | ('HAVE_CONFIG_H', None), | |
358 | ('WXP_USE_THREAD', '1'), | |
359 | ] | |
360 | ||
1e4a197e RD |
361 | if UNDEF_NDEBUG: |
362 | defines.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef | |
22d08289 RD |
363 | |
364 | ||
c368d904 RD |
365 | if not FINAL or HYBRID: |
366 | defines.append( ('__WXDEBUG__', None) ) | |
367 | ||
d440a0e7 | 368 | libdirs = [ opj(WXDIR, 'lib') ] |
a4fbdd76 | 369 | wxdll = 'wxmsw' + WXDLLVER + libFlag() |
d440a0e7 | 370 | libs = [ wxdll ] |
a4fbdd76 | 371 | |
22d08289 | 372 | libs = libs + ['kernel32', 'user32', 'gdi32', 'comdlg32', |
c368d904 | 373 | 'winspool', 'winmm', 'shell32', 'oldnames', 'comctl32', |
1e4a197e | 374 | 'odbc32', 'ole32', 'oleaut32', 'uuid', 'rpcrt4', |
c368d904 RD |
375 | 'advapi32', 'wsock32'] |
376 | ||
22d08289 | 377 | |
d440a0e7 | 378 | cflags = [ '/Gy', |
ad07d019 RD |
379 | # '/GX-' # workaround for internal compiler error in MSVC on some machines |
380 | ] | |
c368d904 RD |
381 | lflags = None |
382 | ||
1e4a197e RD |
383 | # Other MSVC flags... |
384 | # To bad I don't remember why I was playing with these, can they be removed? | |
385 | if FINAL: | |
386 | pass #cflags = cflags + ['/O1'] | |
387 | elif HYBRID : | |
388 | pass #cflags = cflags + ['/Ox'] | |
389 | else: | |
390 | pass # cflags = cflags + ['/Od', '/Z7'] | |
391 | # lflags = ['/DEBUG', ] | |
22d08289 RD |
392 | |
393 | ||
22d08289 | 394 | |
1e4a197e | 395 | #---------------------------------------------------------------------- |
c368d904 | 396 | |
dbd3685c | 397 | elif os.name == 'posix' and sys.platform[:6] == "darwin": |
e6056257 | 398 | # Flags and such for a Darwin (Max OS X) build of Python |
e6056257 RD |
399 | WXDIR = '..' # assumes IN_CVS_TREE |
400 | WXPLAT = '__WXMAC__' | |
401 | GENDIR = 'mac' | |
402 | ||
403 | includes = ['src'] | |
404 | defines = [('SWIG_GLOBAL', None), | |
405 | ('HAVE_CONFIG_H', None), | |
406 | ('WXP_USE_THREAD', '1'), | |
407 | ] | |
1e4a197e RD |
408 | if UNDEF_NDEBUG: |
409 | defines.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef | |
e6056257 | 410 | libdirs = [] |
1e4a197e RD |
411 | libs = ['stdc++'] |
412 | ||
413 | Verify_WX_CONFIG() | |
e6056257 RD |
414 | |
415 | cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1] | |
1e4a197e | 416 | cflags = cflags.split() |
ba201fa4 RD |
417 | if debug: |
418 | cflags.append('-g') | |
419 | cflags.append('-O0') | |
e6056257 RD |
420 | |
421 | lflags = os.popen(WX_CONFIG + ' --libs', 'r').read()[:-1] | |
1e4a197e | 422 | lflags = lflags.split() |
e6056257 | 423 | |
2eb31f8b | 424 | NO_SCRIPTS = 1 |
e6056257 RD |
425 | |
426 | ||
1e4a197e | 427 | #---------------------------------------------------------------------- |
c368d904 | 428 | |
1e4a197e RD |
429 | elif os.name == 'posix': |
430 | # Set flags for other Unix type platforms | |
c368d904 | 431 | WXDIR = '..' # assumes IN_CVS_TREE |
1e4a197e RD |
432 | GENDIR = WXPORT |
433 | ||
434 | if WXPORT == 'gtk': | |
435 | WXPLAT = '__WXGTK__' | |
436 | portcfg = os.popen('gtk-config --cflags', 'r').read()[:-1] | |
437 | elif WXPORT == 'gtk2': | |
438 | WXPLAT = '__WXGTK__' | |
439 | GENDIR = 'gtk' # no code differences so use the same generated sources | |
440 | portcfg = os.popen('pkg-config gtk+-2.0 --cflags', 'r').read()[:-1] | |
441 | BUILD_BASE = BUILD_BASE + '-' + WXPORT | |
442 | elif WXPORT == 'x11': | |
443 | WXPLAT = '__WXX11__' | |
444 | portcfg = '' | |
445 | BUILD_BASE = BUILD_BASE + '-' + WXPORT | |
446 | else: | |
447 | raise SystemExit, "Unknown WXPORT value: " + WXPORT | |
c368d904 RD |
448 | |
449 | includes = ['src'] | |
450 | defines = [('SWIG_GLOBAL', None), | |
451 | ('HAVE_CONFIG_H', None), | |
452 | ('WXP_USE_THREAD', '1'), | |
453 | ] | |
1e4a197e RD |
454 | if UNDEF_NDEBUG: |
455 | defines.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef | |
456 | ||
c368d904 RD |
457 | libdirs = [] |
458 | libs = [] | |
459 | ||
1e4a197e RD |
460 | Verify_WX_CONFIG() |
461 | ||
462 | cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1] + ' ' + portcfg | |
463 | ||
464 | cflags = cflags.split() | |
ba201fa4 RD |
465 | if debug: |
466 | cflags.append('-g') | |
467 | cflags.append('-O0') | |
c368d904 | 468 | |
afa3e1ed | 469 | lflags = os.popen(WX_CONFIG + ' --libs', 'r').read()[:-1] |
1e4a197e RD |
470 | lflags = lflags.split() |
471 | ||
472 | # Some distros (e.g. Mandrake) put libGLU in /usr/X11R6/lib, but | |
473 | # wx-config doesn't output that for some reason. For now, just | |
474 | # add it unconditionally but we should really check if the lib is | |
475 | # really found there or wx-config should be fixed. | |
476 | libdirs.append("/usr/X11R6/lib") | |
c368d904 RD |
477 | |
478 | ||
1e4a197e | 479 | #---------------------------------------------------------------------- |
c368d904 | 480 | else: |
1e4a197e RD |
481 | raise 'Sorry Charlie, platform not supported...' |
482 | ||
483 | ||
484 | #---------------------------------------------------------------------- | |
485 | # post platform setup checks and tweaks | |
486 | #---------------------------------------------------------------------- | |
487 | ||
488 | if UNICODE: | |
489 | BUILD_BASE = BUILD_BASE + '.unicode' | |
490 | VERSION = VERSION + 'u' | |
c368d904 RD |
491 | |
492 | ||
493 | #---------------------------------------------------------------------- | |
494 | # Check if the version file needs updated | |
495 | #---------------------------------------------------------------------- | |
496 | ||
1e4a197e RD |
497 | ##if IN_CVS_TREE and newer('setup.py', 'src/__version__.py'): |
498 | ||
499 | # Always do it since the version string can change based on the UNICODE flag | |
b8510c2f | 500 | open('src/__version__.py', 'w').write("ver = '%s'\n" % VERSION) |
c368d904 | 501 | |
1b62f00d RD |
502 | |
503 | ||
c368d904 | 504 | #---------------------------------------------------------------------- |
1b62f00d | 505 | # SWIG defaults |
c368d904 RD |
506 | #---------------------------------------------------------------------- |
507 | ||
c368d904 | 508 | swig_force = force |
00b6c4e3 RD |
509 | swig_args = ['-c++', '-shadow', '-python', '-keyword', |
510 | '-dnone', | |
511 | #'-dascii', | |
512 | #'-docstring', '-Sbefore', | |
e6056257 RD |
513 | '-I./src', '-D'+WXPLAT, |
514 | ] | |
a541c325 | 515 | if UNICODE: |
c8bc7bb8 RD |
516 | swig_args.append('-DwxUSE_UNICODE') |
517 | ||
185d7c3e | 518 | swig_deps = ['src/my_typemaps.i'] |
c368d904 | 519 | |
c368d904 | 520 | |
1b62f00d RD |
521 | #---------------------------------------------------------------------- |
522 | # Define the CORE extension module | |
523 | #---------------------------------------------------------------------- | |
524 | ||
1e4a197e RD |
525 | msg('Preparing CORE...') |
526 | swig_files = [ 'wx.i', 'windows.i', 'windows2.i', 'windows3.i', 'events.i', | |
527 | 'misc.i', 'misc2.i', 'gdi.i', 'mdi.i', 'controls.i', | |
528 | 'controls2.i', 'cmndlgs.i', 'stattool.i', 'frames.i', 'image.i', | |
529 | 'printfw.i', 'sizers.i', 'clip_dnd.i', | |
530 | 'filesys.i', 'streams.i', 'utils.i', 'fonts.i' | |
531 | ] | |
1b62f00d | 532 | |
1e4a197e RD |
533 | swig_sources = run_swig(swig_files, 'src', GENDIR, PKGDIR, |
534 | USE_SWIG, swig_force, swig_args, swig_deps) | |
1b62f00d | 535 | |
1e4a197e RD |
536 | copy_file('src/__init__.py', PKGDIR, update=1, verbose=0) |
537 | copy_file('src/__version__.py', PKGDIR, update=1, verbose=0) | |
1b62f00d RD |
538 | |
539 | ||
1e4a197e RD |
540 | if IN_CVS_TREE: # update the license files |
541 | mkpath('licence') | |
542 | for file in ['preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt']: | |
543 | copy_file(opj(WXDIR, 'docs', file), opj('licence',file), update=1, verbose=0) | |
c368d904 | 544 | |
c368d904 | 545 | |
1e4a197e RD |
546 | if os.name == 'nt': |
547 | build_locale_dir(opj(PKGDIR, 'locale')) | |
548 | DATA_FILES += build_locale_list(opj(PKGDIR, 'locale')) | |
4f3449b4 RD |
549 | |
550 | ||
1e4a197e RD |
551 | if os.name == 'nt': |
552 | rc_file = ['src/wxc.rc'] | |
553 | else: | |
554 | rc_file = [] | |
555 | ||
556 | ||
557 | ext = Extension('wxc', ['src/helpers.cpp', | |
558 | 'src/drawlist.cpp', | |
559 | 'src/libpy.c', | |
560 | ] + rc_file + swig_sources, | |
561 | ||
562 | include_dirs = includes, | |
563 | define_macros = defines, | |
564 | ||
565 | library_dirs = libdirs, | |
566 | libraries = libs, | |
567 | ||
568 | extra_compile_args = cflags, | |
569 | extra_link_args = lflags, | |
570 | ) | |
571 | wxpExtensions.append(ext) | |
572 | ||
573 | ||
574 | # Extension for the grid module | |
575 | swig_sources = run_swig(['grid.i'], 'src', GENDIR, PKGDIR, | |
576 | USE_SWIG, swig_force, swig_args, swig_deps) | |
577 | ext = Extension('gridc', swig_sources, | |
578 | include_dirs = includes, | |
579 | define_macros = defines, | |
580 | library_dirs = libdirs, | |
581 | libraries = libs, | |
582 | extra_compile_args = cflags, | |
583 | extra_link_args = lflags, | |
584 | ) | |
585 | wxpExtensions.append(ext) | |
586 | ||
587 | ||
588 | # Extension for the html modules | |
589 | swig_sources = run_swig(['html.i', 'htmlhelp.i'], 'src', GENDIR, PKGDIR, | |
590 | USE_SWIG, swig_force, swig_args, swig_deps) | |
591 | ext = Extension('htmlc', swig_sources, | |
592 | include_dirs = includes, | |
593 | define_macros = defines, | |
594 | library_dirs = libdirs, | |
595 | libraries = libs, | |
596 | extra_compile_args = cflags, | |
597 | extra_link_args = lflags, | |
598 | ) | |
599 | wxpExtensions.append(ext) | |
600 | ||
601 | ||
602 | # Extension for the calendar module | |
603 | swig_sources = run_swig(['calendar.i'], 'src', GENDIR, PKGDIR, | |
604 | USE_SWIG, swig_force, swig_args, swig_deps) | |
605 | ext = Extension('calendarc', swig_sources, | |
606 | include_dirs = includes, | |
607 | define_macros = defines, | |
608 | library_dirs = libdirs, | |
609 | libraries = libs, | |
610 | extra_compile_args = cflags, | |
611 | extra_link_args = lflags, | |
612 | ) | |
613 | wxpExtensions.append(ext) | |
614 | ||
615 | ||
616 | # Extension for the help module | |
617 | swig_sources = run_swig(['help.i'], 'src', GENDIR, PKGDIR, | |
618 | USE_SWIG, swig_force, swig_args, swig_deps) | |
619 | ext = Extension('helpc', swig_sources, | |
620 | include_dirs = includes, | |
621 | define_macros = defines, | |
622 | library_dirs = libdirs, | |
623 | libraries = libs, | |
624 | extra_compile_args = cflags, | |
625 | extra_link_args = lflags, | |
626 | ) | |
627 | wxpExtensions.append(ext) | |
628 | ||
629 | ||
630 | # Extension for the wizard module | |
631 | swig_sources = run_swig(['wizard.i'], 'src', GENDIR, PKGDIR, | |
632 | USE_SWIG, swig_force, swig_args, swig_deps) | |
633 | ext = Extension('wizardc', swig_sources, | |
634 | include_dirs = includes, | |
635 | define_macros = defines, | |
636 | library_dirs = libdirs, | |
637 | libraries = libs, | |
638 | extra_compile_args = cflags, | |
639 | extra_link_args = lflags, | |
640 | ) | |
641 | wxpExtensions.append(ext) | |
af83019e RD |
642 | |
643 | ||
c368d904 RD |
644 | #---------------------------------------------------------------------- |
645 | # Define the GLCanvas extension module | |
646 | #---------------------------------------------------------------------- | |
647 | ||
55c020cf RD |
648 | CTRB_SRC = opj(WXDIR, 'contrib/src') |
649 | CTRB_INC = opj(WXDIR, 'contrib/include/wx') | |
650 | ||
1e4a197e | 651 | if BUILD_GLCANVAS: |
cfe766c3 | 652 | msg('Preparing GLCANVAS...') |
c368d904 RD |
653 | location = 'contrib/glcanvas' |
654 | swig_files = ['glcanvas.i'] | |
19cf4f80 | 655 | other_sources = [] |
c368d904 RD |
656 | |
657 | swig_sources = run_swig(swig_files, location, GENDIR, PKGDIR, | |
10ef30eb | 658 | USE_SWIG, swig_force, swig_args, swig_deps) |
c368d904 RD |
659 | |
660 | gl_libs = [] | |
661 | if os.name == 'posix': | |
f32afe1c | 662 | gl_config = os.popen(WX_CONFIG + ' --gl-libs', 'r').read()[:-1] |
1e4a197e | 663 | gl_lflags = gl_config.split() + lflags |
f32afe1c | 664 | gl_libs = libs |
19cf4f80 | 665 | else: |
55c020cf | 666 | other_sources = [opj(location, 'msw/myglcanvas.cpp')] |
f32afe1c RD |
667 | gl_libs = libs + ['opengl32', 'glu32'] |
668 | gl_lflags = lflags | |
c368d904 | 669 | |
1e7ecb7b | 670 | ext = Extension('glcanvasc', |
19cf4f80 | 671 | swig_sources + other_sources, |
1e7ecb7b RD |
672 | |
673 | include_dirs = includes, | |
674 | define_macros = defines, | |
675 | ||
676 | library_dirs = libdirs, | |
f32afe1c | 677 | libraries = gl_libs, |
1e7ecb7b RD |
678 | |
679 | extra_compile_args = cflags, | |
f32afe1c | 680 | extra_link_args = gl_lflags, |
1e7ecb7b RD |
681 | ) |
682 | ||
683 | wxpExtensions.append(ext) | |
c368d904 RD |
684 | |
685 | ||
686 | #---------------------------------------------------------------------- | |
687 | # Define the OGL extension module | |
688 | #---------------------------------------------------------------------- | |
689 | ||
1e4a197e | 690 | if BUILD_OGL: |
cfe766c3 | 691 | msg('Preparing OGL...') |
c368d904 | 692 | location = 'contrib/ogl' |
55c020cf RD |
693 | OGLLOC = opj(location, 'contrib/src/ogl') |
694 | OGLINC = opj(location, 'contrib/include') | |
c368d904 RD |
695 | |
696 | swig_files = ['ogl.i', 'oglbasic.i', 'oglshapes.i', 'oglshapes2.i', | |
697 | 'oglcanvas.i'] | |
698 | ||
699 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
10ef30eb | 700 | USE_SWIG, swig_force, swig_args, swig_deps) |
c368d904 | 701 | |
c368d904 | 702 | if IN_CVS_TREE: |
55c020cf RD |
703 | # make sure local copy of contrib files are up to date |
704 | contrib_copy_tree(opj(CTRB_INC, 'ogl'), opj(OGLINC, 'wx/ogl')) | |
705 | contrib_copy_tree(opj(CTRB_SRC, 'ogl'), OGLLOC) | |
c368d904 | 706 | |
1e7ecb7b RD |
707 | ext = Extension('oglc', ['%s/basic.cpp' % OGLLOC, |
708 | '%s/bmpshape.cpp' % OGLLOC, | |
709 | '%s/composit.cpp' % OGLLOC, | |
710 | '%s/divided.cpp' % OGLLOC, | |
711 | '%s/lines.cpp' % OGLLOC, | |
712 | '%s/misc.cpp' % OGLLOC, | |
713 | '%s/basic2.cpp' % OGLLOC, | |
714 | '%s/canvas.cpp' % OGLLOC, | |
715 | '%s/constrnt.cpp' % OGLLOC, | |
716 | '%s/drawn.cpp' % OGLLOC, | |
717 | '%s/mfutils.cpp' % OGLLOC, | |
718 | '%s/ogldiag.cpp' % OGLLOC, | |
719 | ] + swig_sources, | |
720 | ||
721 | include_dirs = [OGLINC] + includes, | |
722 | define_macros = defines, | |
723 | ||
724 | library_dirs = libdirs, | |
725 | libraries = libs, | |
726 | ||
727 | extra_compile_args = cflags, | |
728 | extra_link_args = lflags, | |
729 | ) | |
730 | ||
731 | wxpExtensions.append(ext) | |
732 | ||
733 | ||
c368d904 RD |
734 | |
735 | #---------------------------------------------------------------------- | |
736 | # Define the STC extension module | |
737 | #---------------------------------------------------------------------- | |
738 | ||
1e4a197e | 739 | if BUILD_STC: |
cfe766c3 | 740 | msg('Preparing STC...') |
c368d904 | 741 | location = 'contrib/stc' |
55c020cf RD |
742 | STCLOC = opj(location, 'contrib/src/stc') |
743 | STCINC = opj(location, 'contrib/include') | |
744 | STC_H = opj(location, 'contrib/include/wx/stc') | |
c368d904 | 745 | |
c368d904 | 746 | if IN_CVS_TREE: |
55c020cf RD |
747 | # Check if gen_iface needs to be run for the wxSTC sources |
748 | if (newer(opj(CTRB_SRC, 'stc/stc.h.in'), opj(CTRB_INC, 'stc/stc.h' )) or | |
749 | newer(opj(CTRB_SRC, 'stc/stc.cpp.in'), opj(CTRB_SRC, 'stc/stc.cpp')) or | |
750 | newer(opj(CTRB_SRC, 'stc/gen_iface.py'), opj(CTRB_SRC, 'stc/stc.cpp'))): | |
751 | ||
752 | msg('Running gen_iface.py, regenerating stc.h and stc.cpp...') | |
753 | cwd = os.getcwd() | |
754 | os.chdir(opj(CTRB_SRC, 'stc')) | |
1e4a197e | 755 | sys.path.insert(0, os.curdir) |
55c020cf RD |
756 | import gen_iface |
757 | gen_iface.main([]) | |
758 | os.chdir(cwd) | |
759 | ||
760 | ||
761 | # make sure local copy of contrib files are up to date | |
762 | contrib_copy_tree(opj(CTRB_INC, 'stc'), opj(STCINC, 'wx/stc')) | |
763 | contrib_copy_tree(opj(CTRB_SRC, 'stc'), STCLOC) | |
764 | ||
c368d904 RD |
765 | |
766 | ||
767 | swig_files = ['stc_.i'] | |
74933d75 | 768 | swig_sources = run_swig(swig_files, location, GENDIR, PKGDIR, |
c368d904 RD |
769 | USE_SWIG, swig_force, |
770 | swig_args + ['-I'+STC_H, '-I'+location], | |
10ef30eb | 771 | [opj(STC_H, 'stc.h')] + swig_deps) |
c368d904 | 772 | |
4a61305d | 773 | # copy a contrib project specific py module to the main package dir |
55c020cf | 774 | copy_file(opj(location, 'stc.py'), PKGDIR, update=1, verbose=0) |
c368d904 RD |
775 | |
776 | # add some include dirs to the standard set | |
1e7ecb7b RD |
777 | stc_includes = includes[:] |
778 | stc_includes.append('%s/scintilla/include' % STCLOC) | |
779 | stc_includes.append('%s/scintilla/src' % STCLOC) | |
780 | stc_includes.append(STCINC) | |
c368d904 RD |
781 | |
782 | # and some macro definitions | |
1e7ecb7b RD |
783 | stc_defines = defines[:] |
784 | stc_defines.append( ('__WX__', None) ) | |
785 | stc_defines.append( ('SCI_LEXER', None) ) | |
1a2fb4cd | 786 | stc_defines.append( ('LINK_LEXERS', None) ) |
c368d904 RD |
787 | |
788 | ||
1e7ecb7b RD |
789 | ext = Extension('stc_c', |
790 | ['%s/scintilla/src/AutoComplete.cxx' % STCLOC, | |
c368d904 RD |
791 | '%s/scintilla/src/CallTip.cxx' % STCLOC, |
792 | '%s/scintilla/src/CellBuffer.cxx' % STCLOC, | |
793 | '%s/scintilla/src/ContractionState.cxx' % STCLOC, | |
794 | '%s/scintilla/src/Document.cxx' % STCLOC, | |
55c020cf | 795 | '%s/scintilla/src/DocumentAccessor.cxx' % STCLOC, |
c368d904 RD |
796 | '%s/scintilla/src/Editor.cxx' % STCLOC, |
797 | '%s/scintilla/src/Indicator.cxx' % STCLOC, | |
798 | '%s/scintilla/src/KeyMap.cxx' % STCLOC, | |
799 | '%s/scintilla/src/KeyWords.cxx' % STCLOC, | |
800 | '%s/scintilla/src/LineMarker.cxx' % STCLOC, | |
801 | '%s/scintilla/src/PropSet.cxx' % STCLOC, | |
55c020cf | 802 | '%s/scintilla/src/RESearch.cxx' % STCLOC, |
c368d904 RD |
803 | '%s/scintilla/src/ScintillaBase.cxx' % STCLOC, |
804 | '%s/scintilla/src/Style.cxx' % STCLOC, | |
fe0aca37 | 805 | '%s/scintilla/src/StyleContext.cxx' % STCLOC, |
55c020cf | 806 | '%s/scintilla/src/UniConversion.cxx' % STCLOC, |
c368d904 | 807 | '%s/scintilla/src/ViewStyle.cxx' % STCLOC, |
55c020cf RD |
808 | '%s/scintilla/src/WindowAccessor.cxx' % STCLOC, |
809 | ||
810 | '%s/scintilla/src/LexAda.cxx' % STCLOC, | |
811 | '%s/scintilla/src/LexAVE.cxx' % STCLOC, | |
1a2fb4cd RD |
812 | '%s/scintilla/src/LexBaan.cxx' % STCLOC, |
813 | '%s/scintilla/src/LexBullant.cxx' % STCLOC, | |
c368d904 | 814 | '%s/scintilla/src/LexCPP.cxx' % STCLOC, |
fe0aca37 RD |
815 | '%s/scintilla/src/LexConf.cxx' % STCLOC, |
816 | '%s/scintilla/src/LexCrontab.cxx' % STCLOC, | |
55c020cf | 817 | '%s/scintilla/src/LexEiffel.cxx' % STCLOC, |
c368d904 | 818 | '%s/scintilla/src/LexHTML.cxx' % STCLOC, |
55c020cf | 819 | '%s/scintilla/src/LexLisp.cxx' % STCLOC, |
c368d904 | 820 | '%s/scintilla/src/LexLua.cxx' % STCLOC, |
1a2fb4cd | 821 | '%s/scintilla/src/LexMatlab.cxx' % STCLOC, |
c368d904 | 822 | '%s/scintilla/src/LexOthers.cxx' % STCLOC, |
55c020cf | 823 | '%s/scintilla/src/LexPascal.cxx' % STCLOC, |
c368d904 RD |
824 | '%s/scintilla/src/LexPerl.cxx' % STCLOC, |
825 | '%s/scintilla/src/LexPython.cxx' % STCLOC, | |
55c020cf | 826 | '%s/scintilla/src/LexRuby.cxx' % STCLOC, |
c368d904 RD |
827 | '%s/scintilla/src/LexSQL.cxx' % STCLOC, |
828 | '%s/scintilla/src/LexVB.cxx' % STCLOC, | |
c368d904 RD |
829 | |
830 | '%s/PlatWX.cpp' % STCLOC, | |
831 | '%s/ScintillaWX.cpp' % STCLOC, | |
832 | '%s/stc.cpp' % STCLOC, | |
1e7ecb7b RD |
833 | ] + swig_sources, |
834 | ||
835 | include_dirs = stc_includes, | |
836 | define_macros = stc_defines, | |
837 | ||
838 | library_dirs = libdirs, | |
839 | libraries = libs, | |
c368d904 | 840 | |
1e7ecb7b RD |
841 | extra_compile_args = cflags, |
842 | extra_link_args = lflags, | |
843 | ) | |
844 | ||
845 | wxpExtensions.append(ext) | |
c368d904 RD |
846 | |
847 | ||
848 | ||
926bb76c RD |
849 | #---------------------------------------------------------------------- |
850 | # Define the IEWIN extension module (experimental) | |
851 | #---------------------------------------------------------------------- | |
852 | ||
1e4a197e | 853 | if BUILD_IEWIN: |
cfe766c3 | 854 | msg('Preparing IEWIN...') |
926bb76c RD |
855 | location = 'contrib/iewin' |
856 | ||
857 | swig_files = ['iewin.i', ] | |
858 | ||
859 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
10ef30eb | 860 | USE_SWIG, swig_force, swig_args, swig_deps) |
926bb76c RD |
861 | |
862 | ||
863 | ext = Extension('iewinc', ['%s/IEHtmlWin.cpp' % location, | |
c731eb47 | 864 | '%s/wxactivex.cpp' % location, |
926bb76c RD |
865 | ] + swig_sources, |
866 | ||
867 | include_dirs = includes, | |
868 | define_macros = defines, | |
869 | ||
870 | library_dirs = libdirs, | |
871 | libraries = libs, | |
872 | ||
873 | extra_compile_args = cflags, | |
874 | extra_link_args = lflags, | |
875 | ) | |
876 | ||
877 | wxpExtensions.append(ext) | |
878 | ||
879 | ||
d56cebe7 RD |
880 | #---------------------------------------------------------------------- |
881 | # Define the XRC extension module | |
882 | #---------------------------------------------------------------------- | |
883 | ||
1e4a197e | 884 | if BUILD_XRC: |
cfe766c3 | 885 | msg('Preparing XRC...') |
d56cebe7 | 886 | location = 'contrib/xrc' |
55c020cf RD |
887 | XMLLOC = opj(location, 'contrib/src/xrc') |
888 | XMLINC = opj(location, 'contrib/include') | |
d56cebe7 RD |
889 | |
890 | swig_files = ['xrc.i'] | |
891 | ||
892 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
10ef30eb | 893 | USE_SWIG, swig_force, swig_args, swig_deps) |
d56cebe7 RD |
894 | |
895 | xmlres_includes = includes[:] | |
896 | xmlres_includes.append('%s/expat/xmlparse' % XMLLOC) | |
897 | xmlres_includes.append('%s/expat/xmltok' % XMLLOC) | |
898 | xmlres_includes.append(XMLINC) | |
899 | ||
900 | ||
901 | # make sure local copy of contrib files are up to date | |
902 | if IN_CVS_TREE: | |
55c020cf RD |
903 | contrib_copy_tree(opj(CTRB_INC, 'xrc'), opj(XMLINC, 'wx/xrc')) |
904 | contrib_copy_tree(opj(CTRB_SRC, 'xrc'), XMLLOC) | |
d56cebe7 RD |
905 | |
906 | ext = Extension('xrcc', ['%s/expat/xmlparse/xmlparse.c' % XMLLOC, | |
907 | '%s/expat/xmltok/xmlrole.c' % XMLLOC, | |
908 | '%s/expat/xmltok/xmltok.c' % XMLLOC, | |
909 | ||
910 | '%s/xh_bmp.cpp' % XMLLOC, | |
911 | '%s/xh_bmpbt.cpp' % XMLLOC, | |
912 | '%s/xh_bttn.cpp' % XMLLOC, | |
913 | '%s/xh_cald.cpp' % XMLLOC, | |
914 | '%s/xh_chckb.cpp' % XMLLOC, | |
915 | ||
916 | '%s/xh_chckl.cpp' % XMLLOC, | |
917 | '%s/xh_choic.cpp' % XMLLOC, | |
918 | '%s/xh_combo.cpp' % XMLLOC, | |
919 | '%s/xh_dlg.cpp' % XMLLOC, | |
920 | '%s/xh_frame.cpp' % XMLLOC, | |
921 | ||
922 | '%s/xh_gauge.cpp' % XMLLOC, | |
6c5ae2d2 | 923 | '%s/xh_gdctl.cpp' % XMLLOC, |
d56cebe7 RD |
924 | '%s/xh_html.cpp' % XMLLOC, |
925 | '%s/xh_listb.cpp' % XMLLOC, | |
926 | '%s/xh_listc.cpp' % XMLLOC, | |
927 | '%s/xh_menu.cpp' % XMLLOC, | |
928 | ||
929 | '%s/xh_notbk.cpp' % XMLLOC, | |
930 | '%s/xh_panel.cpp' % XMLLOC, | |
931 | '%s/xh_radbt.cpp' % XMLLOC, | |
932 | '%s/xh_radbx.cpp' % XMLLOC, | |
933 | '%s/xh_scrol.cpp' % XMLLOC, | |
1e4a197e | 934 | '%s/xh_scwin.cpp' % XMLLOC, |
d56cebe7 RD |
935 | |
936 | '%s/xh_sizer.cpp' % XMLLOC, | |
937 | '%s/xh_slidr.cpp' % XMLLOC, | |
938 | '%s/xh_spin.cpp' % XMLLOC, | |
230e09ad | 939 | '%s/xh_split.cpp' % XMLLOC, |
d56cebe7 RD |
940 | '%s/xh_stbmp.cpp' % XMLLOC, |
941 | '%s/xh_stbox.cpp' % XMLLOC, | |
942 | ||
943 | '%s/xh_stlin.cpp' % XMLLOC, | |
944 | '%s/xh_sttxt.cpp' % XMLLOC, | |
945 | '%s/xh_text.cpp' % XMLLOC, | |
946 | '%s/xh_toolb.cpp' % XMLLOC, | |
947 | '%s/xh_tree.cpp' % XMLLOC, | |
948 | ||
949 | '%s/xh_unkwn.cpp' % XMLLOC, | |
950 | '%s/xml.cpp' % XMLLOC, | |
d56cebe7 RD |
951 | '%s/xmlres.cpp' % XMLLOC, |
952 | '%s/xmlrsall.cpp' % XMLLOC, | |
d56cebe7 RD |
953 | |
954 | ] + swig_sources, | |
955 | ||
956 | include_dirs = xmlres_includes, | |
957 | define_macros = defines, | |
958 | ||
959 | library_dirs = libdirs, | |
960 | libraries = libs, | |
961 | ||
962 | extra_compile_args = cflags, | |
963 | extra_link_args = lflags, | |
964 | ) | |
965 | ||
966 | wxpExtensions.append(ext) | |
967 | ||
968 | ||
969 | ||
ebf4302c RD |
970 | #---------------------------------------------------------------------- |
971 | # Define the GIZMOS extension module | |
972 | #---------------------------------------------------------------------- | |
973 | ||
1e4a197e | 974 | if BUILD_GIZMOS: |
ebf4302c RD |
975 | msg('Preparing GIZMOS...') |
976 | location = 'contrib/gizmos' | |
977 | GIZMOLOC = opj(location, 'contrib/src/gizmos') | |
978 | GIZMOINC = opj(location, 'contrib/include') | |
979 | ||
980 | swig_files = ['gizmos.i'] | |
981 | ||
982 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
10ef30eb | 983 | USE_SWIG, swig_force, swig_args, swig_deps) |
ebf4302c RD |
984 | |
985 | gizmos_includes = includes[:] | |
986 | gizmos_includes.append(GIZMOINC) | |
987 | ||
988 | ||
989 | # make sure local copy of contrib files are up to date | |
990 | if IN_CVS_TREE: | |
991 | contrib_copy_tree(opj(CTRB_INC, 'gizmos'), opj(GIZMOINC, 'wx/gizmos')) | |
992 | contrib_copy_tree(opj(CTRB_SRC, 'gizmos'), GIZMOLOC) | |
993 | ||
994 | ext = Extension('gizmosc', [ | |
995 | '%s/dynamicsash.cpp' % GIZMOLOC, | |
2f4e9287 | 996 | '%s/editlbox.cpp' % GIZMOLOC, |
950e7faf | 997 | #'%s/multicell.cpp' % GIZMOLOC, |
ebf4302c | 998 | '%s/splittree.cpp' % GIZMOLOC, |
950e7faf | 999 | '%s/ledctrl.cpp' % GIZMOLOC, |
ebf4302c RD |
1000 | ] + swig_sources, |
1001 | ||
1002 | include_dirs = gizmos_includes, | |
1003 | define_macros = defines, | |
1004 | ||
1005 | library_dirs = libdirs, | |
1006 | libraries = libs, | |
1007 | ||
1008 | extra_compile_args = cflags, | |
1009 | extra_link_args = lflags, | |
1010 | ) | |
1011 | ||
1012 | wxpExtensions.append(ext) | |
1013 | ||
1014 | ||
1015 | ||
4a61305d RD |
1016 | #---------------------------------------------------------------------- |
1017 | # Define the DLLWIDGET extension module | |
1018 | #---------------------------------------------------------------------- | |
1019 | ||
1e4a197e | 1020 | if BUILD_DLLWIDGET: |
4a61305d RD |
1021 | msg('Preparing DLLWIDGET...') |
1022 | location = 'contrib/dllwidget' | |
1023 | swig_files = ['dllwidget_.i'] | |
1024 | ||
1025 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
10ef30eb | 1026 | USE_SWIG, swig_force, swig_args, swig_deps) |
4a61305d RD |
1027 | |
1028 | # copy a contrib project specific py module to the main package dir | |
1029 | copy_file(opj(location, 'dllwidget.py'), PKGDIR, update=1, verbose=0) | |
1030 | ||
1031 | ext = Extension('dllwidget_c', [ | |
1032 | '%s/dllwidget.cpp' % location, | |
1033 | ] + swig_sources, | |
1034 | ||
1035 | include_dirs = includes, | |
1036 | define_macros = defines, | |
1037 | ||
1038 | library_dirs = libdirs, | |
1039 | libraries = libs, | |
1040 | ||
1041 | extra_compile_args = cflags, | |
1042 | extra_link_args = lflags, | |
1043 | ) | |
1044 | ||
1045 | wxpExtensions.append(ext) | |
1046 | ||
1047 | ||
8916d007 | 1048 | #---------------------------------------------------------------------- |
1e4a197e | 1049 | # Define the CANVAS extension module |
8916d007 RD |
1050 | #---------------------------------------------------------------------- |
1051 | ||
1e4a197e RD |
1052 | if BUILD_CANVAS: |
1053 | msg('Preparing CANVAS...') | |
1054 | location = 'contrib/canvas' | |
1055 | CANVASLOC = opj(location, 'contrib/src/canvas') | |
1056 | CANVASINC = opj(location, 'contrib/include') | |
8916d007 | 1057 | |
1e4a197e RD |
1058 | swig_files = ['canvas.i'] |
1059 | ||
1060 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
1061 | USE_SWIG, swig_force, swig_args, swig_deps) | |
1062 | ||
1063 | if IN_CVS_TREE: | |
1064 | # make sure local copy of contrib files are up to date | |
1065 | contrib_copy_tree(opj(CTRB_INC, 'canvas'), opj(CANVASINC, 'wx/canvas')) | |
1066 | contrib_copy_tree(opj(CTRB_SRC, 'canvas'), CANVASLOC) | |
1067 | ||
1068 | ext = Extension('canvasc', ['%s/bbox.cpp' % CANVASLOC, | |
1069 | '%s/liner.cpp' % CANVASLOC, | |
1070 | '%s/polygon.cpp' % CANVASLOC, | |
1071 | '%s/canvas.cpp' % CANVASLOC, | |
1072 | ] + swig_sources, | |
1073 | ||
1074 | include_dirs = [CANVASINC] + includes, | |
1075 | define_macros = defines, | |
1076 | ||
1077 | library_dirs = libdirs, | |
1078 | libraries = libs, | |
1079 | ||
1080 | extra_compile_args = cflags, | |
1081 | extra_link_args = lflags, | |
1082 | ) | |
1083 | ||
1084 | wxpExtensions.append(ext) | |
1085 | ||
1086 | ||
1087 | #---------------------------------------------------------------------- | |
1088 | # Define the ART2D extension module | |
1089 | #---------------------------------------------------------------------- | |
1090 | ||
1091 | if BUILD_ART2D: | |
1092 | msg('Preparing ART2D...') | |
1093 | location = 'contrib/art2d' | |
1094 | ART2DLOC = opj(location, 'modules/canvas/src') | |
1095 | ART2DINC = opj(location, 'modules/canvas/include') | |
1096 | EXPATLOC = opj(location, 'modules/expat') | |
1097 | EXPATINC = opj(location, 'modules/expat/include') | |
1098 | ||
1099 | swig_files = ['art2d.i', | |
1100 | 'art2d_misc.i', | |
1101 | 'art2d_base.i', | |
1102 | 'art2d_canvas.i', | |
1103 | ] | |
1104 | ||
1105 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
1106 | USE_SWIG, swig_force, swig_args, swig_deps) | |
1107 | ||
1108 | if IN_CVS_TREE: | |
1109 | # Don't copy data in this case as the code snapshots are | |
1110 | # taken manually | |
1111 | pass | |
1112 | ||
1113 | ext = Extension('art2dc', [ opj(ART2DLOC, 'afmatrix.cpp'), | |
1114 | opj(ART2DLOC, 'bbox.cpp'), | |
1115 | opj(ART2DLOC, 'cancom.cpp'), | |
1116 | opj(ART2DLOC, 'candoc.cpp'), | |
1117 | opj(ART2DLOC, 'canglob.cpp'), | |
1118 | opj(ART2DLOC, 'canobj3d.cpp'), | |
1119 | opj(ART2DLOC, 'canobj.cpp'), | |
1120 | opj(ART2DLOC, 'canprim.cpp'), | |
1121 | opj(ART2DLOC, 'canprop.cpp'), | |
1122 | opj(ART2DLOC, 'canvas.cpp'), | |
1123 | opj(ART2DLOC, 'docviewref.cpp'), | |
1124 | opj(ART2DLOC, 'drawer.cpp'), | |
1125 | opj(ART2DLOC, 'eval.cpp'), | |
1126 | opj(ART2DLOC, 'graph.cpp'), | |
1127 | opj(ART2DLOC, 'layerinf.cpp'), | |
1128 | opj(ART2DLOC, 'liner.cpp'), | |
1129 | opj(ART2DLOC, 'meta.cpp'), | |
1130 | opj(ART2DLOC, 'objlist.cpp'), | |
1131 | opj(ART2DLOC, 'polygon.cpp'), | |
1132 | opj(ART2DLOC, 'recur.cpp'), | |
1133 | opj(ART2DLOC, 'rendimg.cpp'), | |
1134 | opj(ART2DLOC, 'tools.cpp'), | |
1135 | opj(ART2DLOC, 'vpath.cpp'), | |
1136 | opj(ART2DLOC, 'xmlpars.cpp'), | |
1137 | ||
1138 | opj(EXPATLOC, 'xmlparse/xmlparse.c'), | |
1139 | opj(EXPATLOC, 'xmltok/xmlrole.c'), | |
1140 | opj(EXPATLOC, 'xmltok/xmltok.c'), | |
1141 | ||
1142 | ] + swig_sources, | |
1143 | ||
1144 | include_dirs = [ ART2DINC, | |
1145 | EXPATINC, | |
1146 | opj(EXPATLOC, 'xmltok'), | |
1147 | opj(EXPATLOC, 'xmlparse'), | |
1148 | ] + includes, | |
1149 | define_macros = defines, | |
1150 | ||
1151 | library_dirs = libdirs, | |
1152 | libraries = libs, | |
1153 | ||
1154 | extra_compile_args = cflags, | |
1155 | extra_link_args = lflags, | |
1156 | ) | |
1157 | ||
1158 | wxpExtensions.append(ext) | |
1159 | ||
1160 | ||
1161 | #---------------------------------------------------------------------- | |
1162 | # Tools and scripts | |
1163 | #---------------------------------------------------------------------- | |
8916d007 | 1164 | |
2eb31f8b RD |
1165 | if NO_SCRIPTS: |
1166 | SCRIPTS = None | |
1167 | else: | |
1e4a197e RD |
1168 | SCRIPTS = [opj('scripts/helpviewer'), |
1169 | opj('scripts/img2png'), | |
2eb31f8b RD |
1170 | opj('scripts/img2xpm'), |
1171 | opj('scripts/img2py'), | |
1172 | opj('scripts/xrced'), | |
1173 | opj('scripts/pyshell'), | |
1174 | opj('scripts/pycrust'), | |
1e4a197e | 1175 | opj('scripts/pycwrap'), |
2eb31f8b | 1176 | ] |
4a61305d | 1177 | |
926bb76c | 1178 | |
1e4a197e RD |
1179 | DATA_FILES.append( ('wxPython/tools/XRCed', glob.glob('wxPython/tools/XRCed/*.txt') + |
1180 | [ 'wxPython/tools/XRCed/xrced.xrc'])) | |
1181 | ||
1182 | DATA_FILES.append( ('wxPython/lib/PyCrust', glob.glob('wxPython/lib/PyCrust/*.txt') + | |
1183 | glob.glob('wxPython/lib/PyCrust/*.ico'))) | |
1184 | ||
1185 | ||
c368d904 RD |
1186 | #---------------------------------------------------------------------- |
1187 | # Do the Setup/Build/Install/Whatever | |
1188 | #---------------------------------------------------------------------- | |
1189 | ||
1b62f00d | 1190 | if __name__ == "__main__": |
1e4a197e | 1191 | if not PREP_ONLY: |
1b62f00d RD |
1192 | setup(name = PKGDIR, |
1193 | version = VERSION, | |
1194 | description = DESCRIPTION, | |
1195 | long_description = LONG_DESCRIPTION, | |
1196 | author = AUTHOR, | |
1197 | author_email = AUTHOR_EMAIL, | |
1198 | url = URL, | |
e2e02194 | 1199 | license = LICENSE, |
1b62f00d RD |
1200 | |
1201 | packages = [PKGDIR, | |
1202 | PKGDIR+'.lib', | |
1e4a197e | 1203 | PKGDIR+'.lib.colourchooser', |
1b62f00d | 1204 | PKGDIR+'.lib.editor', |
2ba9346d RD |
1205 | PKGDIR+'.lib.mixins', |
1206 | PKGDIR+'.lib.PyCrust', | |
1e4a197e | 1207 | PKGDIR+'.lib.PyCrust.wxd', |
f6f98ecc RD |
1208 | PKGDIR+'.tools', |
1209 | PKGDIR+'.tools.XRCed', | |
1b62f00d RD |
1210 | ], |
1211 | ||
1212 | ext_package = PKGDIR, | |
1213 | ext_modules = wxpExtensions, | |
8916d007 | 1214 | |
f6f98ecc | 1215 | options = { 'build' : { 'build_base' : BUILD_BASE }}, |
a541c325 | 1216 | |
b817523b | 1217 | scripts = SCRIPTS, |
c368d904 | 1218 | |
1e4a197e RD |
1219 | cmdclass = { 'install_data': smart_install_data}, |
1220 | data_files = DATA_FILES, | |
8916d007 | 1221 | |
1b62f00d | 1222 | ) |
c368d904 | 1223 | |
c368d904 | 1224 | |
c368d904 RD |
1225 | #---------------------------------------------------------------------- |
1226 | #---------------------------------------------------------------------- |