]> git.saurik.com Git - wxWidgets.git/blame - wxPython/setup.py
fix for single item wildcards with no explanatory name item
[wxWidgets.git] / wxPython / setup.py
CommitLineData
c368d904
RD
1#!/usr/bin/env python
2#----------------------------------------------------------------------
3
8916d007 4import sys, os, string, glob
c368d904
RD
5from distutils.core import setup, Extension
6from distutils.file_util import copy_file
7from distutils.dir_util import mkpath
8from distutils.dep_util import newer
9
10from my_distutils import run_swig, contrib_copy_tree
11
12#----------------------------------------------------------------------
13# flags and values that affect this script
14#----------------------------------------------------------------------
15
efe12e95 16VERSION = "2.3.3pre6"
c368d904
RD
17DESCRIPTION = "Cross platform GUI toolkit for Python"
18AUTHOR = "Robin Dunn"
b166c703 19AUTHOR_EMAIL = "Robin Dunn <robin@alldunn.com>"
c368d904 20URL = "http://wxPython.org/"
e2e02194 21LICENSE = "wxWindows (LGPL derivative)"
c368d904
RD
22LONG_DESCRIPTION = """\
23wxPython is a GUI toolkit for Python that is a wrapper around the
24wxWindows C++ GUI library. wxPython provides a large variety of
1b62f00d 25window types and controls, all implemented with a native look and
c368d904
RD
26feel (and native runtime speed) on the platforms it is supported
27on.
28"""
29
30
f221f8eb 31BUILD_GLCANVAS = 1 # If true, build the contrib/glcanvas extension module
c368d904
RD
32BUILD_OGL = 1 # If true, build the contrib/ogl extension module
33BUILD_STC = 1 # If true, build the contrib/stc extension module
d56cebe7 34BUILD_XRC = 1 # XML based resource system
ebf4302c 35BUILD_GIZMOS = 1 # Build a module for the gizmos contrib library
37bd51c0
RD
36BUILD_DLLWIDGET = 1# Build a module that enables unknown wx widgets
37 # to be loaded from a DLL and to be used from Python.
d56cebe7 38
c731eb47
RD
39 # Internet Explorer wrapper (experimental)
40BUILD_IEWIN = (os.name == 'nt')
78e8819c 41
c368d904 42CORE_ONLY = 0 # if true, don't build any of the above
4a61305d 43
f221f8eb 44GL_ONLY = 0 # Only used when making the -gl RPM. See the "b" script
1b62f00d 45 # for the ugly details
c368d904
RD
46
47USE_SWIG = 0 # Should we actually execute SWIG, or just use the
48 # files already in the distribution?
49
a541c325
RD
50UNICODE = 0 # This will pass the 'wxUSE_UNICODE' flag to SWIG and
51 # will ensure that the right headers are found and the
52 # right libs are linked.
c8bc7bb8 53
c368d904
RD
54IN_CVS_TREE = 0 # Set to true if building in a full wxWindows CVS
55 # tree, otherwise will assume all needed files are
56 # available in the wxPython source distribution
57
5c8e1089
RD
58UNDEF_NDEBUG = 1 # Python 2.2 on Unix/Linux by default defines NDEBUG,
59 # and distutils will pick this up and use it on the
60 # compile command-line for the extensions. This could
61 # conflict with how wxWindows was built. If NDEBUG is
62 # set then wxWindows' __WXDEBUG__ setting will be turned
63 # off. If wxWindows was actually built with it turned
64 # on then you end up with mismatched class structures,
65 # and wxPython will crash.
66
2eb31f8b
RD
67NO_SCRIPTS = 0 # Don't install the tool scripts
68
69
afa3e1ed
RL
70WX_CONFIG = "wx-config" # Usually you shouldn't need to touch this,
71 # but you can set it to pass an alternate
72 # version of wx-config or alternate flags,
73 # eg. as required by the .deb in-tree build.
c368d904 74
a541c325
RD
75BUILD_BASE = "build"
76
c368d904
RD
77# Some MSW build settings
78
79FINAL = 1 # Mirrors use of same flag in wx makefiles,
80 # (0 or 1 only) should probably find a way to
81 # autodetect this...
82
83HYBRID = 0 # If set and not debug or FINAL, then build a
84 # hybrid extension that can be used by the
85 # non-debug version of python, but contains
86 # debugging symbols for wxWindows and wxPython.
87 # wxWindows must have been built with /MD, not /MDd
88 # (using FINAL=hybrid will do it.)
89
a541c325 90WXDLLVER = '233' # Version part of wxWindows DLL name
c368d904
RD
91
92
cfe766c3
RD
93#----------------------------------------------------------------------
94
95def msg(text):
96 if __name__ == "__main__":
97 print text
98
a541c325 99
55c020cf
RD
100def opj(*args):
101 path = apply(os.path.join, args)
102 return os.path.normpath(path)
cfe766c3 103
a541c325 104
a4fbdd76
RD
105def libFlag():
106 if FINAL:
c8bc7bb8 107 rv = ''
a4fbdd76 108 elif HYBRID:
c8bc7bb8 109 rv = 'h'
a4fbdd76 110 else:
c8bc7bb8 111 rv = 'd'
a541c325 112 if UNICODE:
c8bc7bb8
RD
113 rv = 'u' + rv
114 return rv
a4fbdd76
RD
115
116
c368d904
RD
117#----------------------------------------------------------------------
118# Some other globals
119#----------------------------------------------------------------------
120
121PKGDIR = 'wxPython'
122wxpExtensions = []
123
124force = '--force' in sys.argv or '-f' in sys.argv
125debug = '--debug' in sys.argv or '-g' in sys.argv
126
22d08289
RD
127bcpp_compiling = '-c' in sys.argv and 'my_bcpp' in sys.argv # Bad heuristic
128
129if bcpp_compiling:
cfe766c3 130 msg("Compiling wxPython by Borland C/C++ Compiler")
22d08289
RD
131 HYBRID=0
132 WXBCPPLIBVER = string.replace(WXDLLVER,"_","")
133 # Version part of BCPP build LIBRARY name
134 WXDLLVER="" # no dll ver path avaible
135
c368d904
RD
136
137#----------------------------------------------------------------------
138# Check for build flags on the command line
139#----------------------------------------------------------------------
140
5c8e1089 141# Boolean (int) flags
b166c703 142for flag in ['BUILD_GLCANVAS', 'BUILD_OGL', 'BUILD_STC', 'BUILD_XRC',
c731eb47 143 'BUILD_GIZMOS', 'BUILD_DLLWIDGET', 'BUILD_IEWIN',
2eb31f8b
RD
144 'CORE_ONLY', 'USE_SWIG', 'IN_CVS_TREE', 'UNICODE',
145 'UNDEF_NDEBUG', 'NO_SCRIPTS',
b166c703 146 'FINAL', 'HYBRID', ]:
c368d904
RD
147 for x in range(len(sys.argv)):
148 if string.find(sys.argv[x], flag) == 0:
149 pos = string.find(sys.argv[x], '=') + 1
150 if pos > 0:
151 vars()[flag] = eval(sys.argv[x][pos:])
152 sys.argv[x] = ''
153
5c8e1089
RD
154# String options
155for option in ['WX_CONFIG', 'WXDLLVER', 'BUILD_BASE']:
afa3e1ed
RL
156 for x in range(len(sys.argv)):
157 if string.find(sys.argv[x], option) == 0:
158 pos = string.find(sys.argv[x], '=') + 1
159 if pos > 0:
160 vars()[option] = sys.argv[x][pos:]
161 sys.argv[x] = ''
162
c368d904
RD
163sys.argv = filter(None, sys.argv)
164
165
c8bc7bb8
RD
166
167#----------------------------------------------------------------------
168# sanity checks
169
c368d904 170if CORE_ONLY:
f221f8eb 171 BUILD_GLCANVAS = 0
c368d904
RD
172 BUILD_OGL = 0
173 BUILD_STC = 0
b166c703 174 BUILD_XRC = 0
ff5f1aba
RD
175 BUILD_GIZMOS = 0
176 BUILD_DLLWIDGET = 0
c731eb47 177 BUILD_IEWIN = 0
ff5f1aba 178
c368d904 179
a541c325 180if UNICODE and os.name != 'nt':
c8bc7bb8
RD
181 print "UNICODE is currently only supported on Win32"
182 sys.exit()
183
a541c325
RD
184
185if UNICODE:
186 BUILD_BASE = BUILD_BASE + '.unicode'
fc51b8c3 187 VERSION = VERSION + 'u'
a541c325
RD
188
189
c368d904
RD
190#----------------------------------------------------------------------
191# Setup some platform specific stuff
192#----------------------------------------------------------------------
193
194if os.name == 'nt':
195 # Set compile flags and such for MSVC. These values are derived
a541c325
RD
196 # from the wxWindows makefiles for MSVC, other compilers settings
197 # will probably vary...
198 if os.environ.has_key('WXWIN'):
199 WXDIR = os.environ['WXWIN']
200 else:
201 msg("WARNING: WXWIN not set in environment.")
202 WXDIR = '..' # assumes in CVS tree
c368d904
RD
203 WXPLAT = '__WXMSW__'
204 GENDIR = 'msw'
205
c368d904
RD
206 if debug:
207 FINAL = 0
208 HYBRID = 0
209
210 if HYBRID:
211 FINAL = 0
212
c368d904 213 includes = ['src',
a4fbdd76 214 opj(WXDIR, 'lib', 'mswdll' + libFlag()),
55c020cf 215 opj(WXDIR, 'include'),
c368d904
RD
216 ]
217
218 defines = [ ('WIN32', None), # Some of these are no longer
219 ('__WIN32__', None), # necessary. Anybody know which?
220 ('_WINDOWS', None),
221 ('__WINDOWS__', None),
222 ('WINVER', '0x0400'),
223 ('__WIN95__', None),
224 ('STRICT', None),
225
226 (WXPLAT, None),
227 ('WXUSINGDLL', '1'),
228
229 ('SWIG_GLOBAL', None),
230 ('HAVE_CONFIG_H', None),
231 ('WXP_USE_THREAD', '1'),
232 ]
233
22d08289
RD
234 if bcpp_compiling: # overwrite it
235 defines = [
236 ('_WINDOWS', None),
237 ('WINVER', '0x0400'),
238 ('STRICT', None),
239
240 ('WXUSINGDLL', '1'),
241
242 ('SWIG_GLOBAL', None),
243 ('HAVE_CONFIG_H', None),
244 ('WXP_USE_THREAD', '1'),
245
246 ('WXUSE_DEFINE','1'),
247 ('_RTLDLL',None),
248 ]
249
250
c368d904
RD
251 if not FINAL or HYBRID:
252 defines.append( ('__WXDEBUG__', None) )
253
55c020cf 254 libdirs = [opj(WXDIR, 'lib'), 'build\\ilib']
a4fbdd76 255 wxdll = 'wxmsw' + WXDLLVER + libFlag()
22d08289 256 libs = [wxdll]
a4fbdd76 257
22d08289
RD
258 if bcpp_compiling:
259 libs = ['wx'+WXBCPPLIBVER]
260
261 libs = libs + ['kernel32', 'user32', 'gdi32', 'comdlg32',
c368d904
RD
262 'winspool', 'winmm', 'shell32', 'oldnames', 'comctl32',
263 'ctl3d32', 'odbc32', 'ole32', 'oleaut32', 'uuid', 'rpcrt4',
264 'advapi32', 'wsock32']
265
22d08289 266
ad07d019
RD
267 cflags = [
268 # '/GX-' # workaround for internal compiler error in MSVC on some machines
269 ]
c368d904
RD
270 lflags = None
271
22d08289
RD
272
273 if bcpp_compiling: # overwrite it
dbd3685c 274 cflags = ['-5', '-VF', ### To support MSVC spurious semicolons in the class scope
22d08289 275 ### else, all semicolons at the end of all DECLARE_...CALLBACK... macros must be eliminated
55c020cf
RD
276 '-Hc', '-H=' + opj(WXDIR, '\src\msw\wx32.csm'),
277 '@' + opj(WXDIR, '\src\msw\wxwin32.cfg')
22d08289
RD
278 ]
279
280
281 if not FINAL and HYBRID and not bcpp_compiling:
e7d63784
RD
282 cflags = cflags + ['/Od', '/Z7']
283 lflags = ['/DEBUG', ]
c368d904 284
22d08289
RD
285 elif bcpp_compiling and not FINAL:
286 cflags = cflags + ['/Od', '/v', '/y']
b96c7a38 287 lflags = lflags + ['/v', ]
22d08289
RD
288
289
c368d904 290
dbd3685c 291elif os.name == 'posix' and sys.platform[:6] == "darwin":
e6056257
RD
292 # Flags and such for a Darwin (Max OS X) build of Python
293
294 WXDIR = '..' # assumes IN_CVS_TREE
295 WXPLAT = '__WXMAC__'
296 GENDIR = 'mac'
297
298 includes = ['src']
299 defines = [('SWIG_GLOBAL', None),
300 ('HAVE_CONFIG_H', None),
301 ('WXP_USE_THREAD', '1'),
302 ]
303 libdirs = []
304 libs = []
305
306 cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1]
307 cflags = string.split(cflags)
5c8e1089
RD
308 if UNDEF_NDEBUG:
309 cflags.append('-UNDEBUG')
e6056257
RD
310
311 lflags = os.popen(WX_CONFIG + ' --libs', 'r').read()[:-1]
312 lflags = string.split(lflags)
313
2eb31f8b 314 NO_SCRIPTS = 1
e6056257
RD
315
316
c368d904
RD
317elif os.name == 'posix':
318 # Set flags for Unix type platforms
319
320 WXDIR = '..' # assumes IN_CVS_TREE
321 WXPLAT = '__WXGTK__' # and assumes GTK...
322 GENDIR = 'gtk' # Need to allow for Motif eventually too
323
324 includes = ['src']
325 defines = [('SWIG_GLOBAL', None),
326 ('HAVE_CONFIG_H', None),
327 ('WXP_USE_THREAD', '1'),
328 ]
329 libdirs = []
330 libs = []
331
e8bf92fd 332 cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1] + ' ' + \
c368d904
RD
333 os.popen('gtk-config --cflags', 'r').read()[:-1]
334 cflags = string.split(cflags)
5c8e1089
RD
335 if UNDEF_NDEBUG:
336 cflags.append('-UNDEBUG')
c368d904 337
afa3e1ed 338 lflags = os.popen(WX_CONFIG + ' --libs', 'r').read()[:-1]
c368d904
RD
339 lflags = string.split(lflags)
340
341
342else:
343 raise 'Sorry Charlie...'
344
345
346#----------------------------------------------------------------------
347# Check if the version file needs updated
348#----------------------------------------------------------------------
349
b8510c2f
RD
350#if IN_CVS_TREE and newer('setup.py', 'src/__version__.py'):
351open('src/__version__.py', 'w').write("ver = '%s'\n" % VERSION)
c368d904 352
1b62f00d
RD
353
354
c368d904 355#----------------------------------------------------------------------
1b62f00d 356# SWIG defaults
c368d904
RD
357#----------------------------------------------------------------------
358
c368d904 359swig_force = force
00b6c4e3
RD
360swig_args = ['-c++', '-shadow', '-python', '-keyword',
361 '-dnone',
362 #'-dascii',
363 #'-docstring', '-Sbefore',
e6056257
RD
364 '-I./src', '-D'+WXPLAT,
365 ]
a541c325 366if UNICODE:
c8bc7bb8
RD
367 swig_args.append('-DwxUSE_UNICODE')
368
185d7c3e 369swig_deps = ['src/my_typemaps.i']
c368d904 370
c368d904 371
1b62f00d
RD
372#----------------------------------------------------------------------
373# Define the CORE extension module
374#----------------------------------------------------------------------
375
376if not GL_ONLY:
cfe766c3 377 msg('Preparing CORE...')
1b62f00d
RD
378 swig_files = [ 'wx.i', 'windows.i', 'windows2.i', 'windows3.i', 'events.i',
379 'misc.i', 'misc2.i', 'gdi.i', 'mdi.i', 'controls.i',
380 'controls2.i', 'cmndlgs.i', 'stattool.i', 'frames.i', 'image.i',
381 'printfw.i', 'sizers.i', 'clip_dnd.i',
68bc8549 382 'filesys.i', 'streams.i', 'utils.i', 'fonts.i'
1b62f00d 383 ]
c368d904 384
1b62f00d
RD
385 swig_sources = run_swig(swig_files, 'src', GENDIR, PKGDIR,
386 USE_SWIG, swig_force, swig_args, swig_deps)
c368d904 387
1b62f00d
RD
388 copy_file('src/__init__.py', PKGDIR, update=1, verbose=0)
389 copy_file('src/__version__.py', PKGDIR, update=1, verbose=0)
b96c7a38 390 copy_file('src/wxc.pyd.manifest', PKGDIR, update=1, verbose=0)
c368d904 391
e2e02194 392 if IN_CVS_TREE: # update the license files
1b62f00d
RD
393 mkpath('licence')
394 for file in ['preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt']:
55c020cf 395 copy_file(opj(WXDIR, 'docs', file), opj('licence',file), update=1, verbose=0)
c368d904 396
1b62f00d
RD
397
398 if os.name == 'nt':
399 rc_file = ['src/wxc.rc']
400 else:
401 rc_file = []
402
403
404 ext = Extension('wxc', ['src/helpers.cpp',
405 'src/libpy.c',
406 ] + rc_file + swig_sources,
407
408 include_dirs = includes,
409 define_macros = defines,
410
411 library_dirs = libdirs,
412 libraries = libs,
413
414 extra_compile_args = cflags,
415 extra_link_args = lflags,
416 )
417 wxpExtensions.append(ext)
418
419
420 # Extension for the grid module
421 swig_sources = run_swig(['grid.i'], 'src', GENDIR, PKGDIR,
422 USE_SWIG, swig_force, swig_args, swig_deps)
423 ext = Extension('gridc', swig_sources,
424 include_dirs = includes,
425 define_macros = defines,
426 library_dirs = libdirs,
427 libraries = libs,
428 extra_compile_args = cflags,
429 extra_link_args = lflags,
430 )
431 wxpExtensions.append(ext)
432
433
434 # Extension for the html modules
435 swig_sources = run_swig(['html.i', 'htmlhelp.i'], 'src', GENDIR, PKGDIR,
436 USE_SWIG, swig_force, swig_args, swig_deps)
437 ext = Extension('htmlc', swig_sources,
438 include_dirs = includes,
439 define_macros = defines,
440 library_dirs = libdirs,
1b62f00d
RD
441 libraries = libs,
442 extra_compile_args = cflags,
443 extra_link_args = lflags,
444 )
445 wxpExtensions.append(ext)
446
447
448 # Extension for the calendar module
449 swig_sources = run_swig(['calendar.i'], 'src', GENDIR, PKGDIR,
450 USE_SWIG, swig_force, swig_args, swig_deps)
451 ext = Extension('calendarc', swig_sources,
452 include_dirs = includes,
453 define_macros = defines,
454 library_dirs = libdirs,
455 libraries = libs,
456 extra_compile_args = cflags,
457 extra_link_args = lflags,
458 )
459 wxpExtensions.append(ext)
c368d904 460
c368d904 461
4f3449b4
RD
462 # Extension for the help module
463 swig_sources = run_swig(['help.i'], 'src', GENDIR, PKGDIR,
464 USE_SWIG, swig_force, swig_args, swig_deps)
465 ext = Extension('helpc', swig_sources,
466 include_dirs = includes,
467 define_macros = defines,
468 library_dirs = libdirs,
469 libraries = libs,
470 extra_compile_args = cflags,
471 extra_link_args = lflags,
472 )
473 wxpExtensions.append(ext)
474
475
af83019e
RD
476 # Extension for the wizard module
477 swig_sources = run_swig(['wizard.i'], 'src', GENDIR, PKGDIR,
478 USE_SWIG, swig_force, swig_args, swig_deps)
479 ext = Extension('wizardc', swig_sources,
480 include_dirs = includes,
481 define_macros = defines,
482 library_dirs = libdirs,
483 libraries = libs,
484 extra_compile_args = cflags,
485 extra_link_args = lflags,
486 )
487 wxpExtensions.append(ext)
488
489
c368d904
RD
490#----------------------------------------------------------------------
491# Define the GLCanvas extension module
492#----------------------------------------------------------------------
493
55c020cf
RD
494CTRB_SRC = opj(WXDIR, 'contrib/src')
495CTRB_INC = opj(WXDIR, 'contrib/include/wx')
496
1b62f00d 497if BUILD_GLCANVAS or GL_ONLY:
cfe766c3 498 msg('Preparing GLCANVAS...')
c368d904
RD
499 location = 'contrib/glcanvas'
500 swig_files = ['glcanvas.i']
19cf4f80 501 other_sources = []
c368d904
RD
502
503 swig_sources = run_swig(swig_files, location, GENDIR, PKGDIR,
10ef30eb 504 USE_SWIG, swig_force, swig_args, swig_deps)
c368d904
RD
505
506 gl_libs = []
507 if os.name == 'posix':
f32afe1c
RD
508 gl_config = os.popen(WX_CONFIG + ' --gl-libs', 'r').read()[:-1]
509 gl_lflags = string.split(gl_config) + lflags
510 gl_libs = libs
19cf4f80 511 else:
55c020cf 512 other_sources = [opj(location, 'msw/myglcanvas.cpp')]
f32afe1c
RD
513 gl_libs = libs + ['opengl32', 'glu32']
514 gl_lflags = lflags
c368d904 515
1e7ecb7b 516 ext = Extension('glcanvasc',
19cf4f80 517 swig_sources + other_sources,
1e7ecb7b
RD
518
519 include_dirs = includes,
520 define_macros = defines,
521
522 library_dirs = libdirs,
f32afe1c 523 libraries = gl_libs,
1e7ecb7b
RD
524
525 extra_compile_args = cflags,
f32afe1c 526 extra_link_args = gl_lflags,
1e7ecb7b
RD
527 )
528
529 wxpExtensions.append(ext)
c368d904
RD
530
531
532#----------------------------------------------------------------------
533# Define the OGL extension module
534#----------------------------------------------------------------------
535
1b62f00d 536if not GL_ONLY and BUILD_OGL:
cfe766c3 537 msg('Preparing OGL...')
c368d904 538 location = 'contrib/ogl'
55c020cf
RD
539 OGLLOC = opj(location, 'contrib/src/ogl')
540 OGLINC = opj(location, 'contrib/include')
c368d904
RD
541
542 swig_files = ['ogl.i', 'oglbasic.i', 'oglshapes.i', 'oglshapes2.i',
543 'oglcanvas.i']
544
545 swig_sources = run_swig(swig_files, location, '', PKGDIR,
10ef30eb 546 USE_SWIG, swig_force, swig_args, swig_deps)
c368d904 547
c368d904 548 if IN_CVS_TREE:
55c020cf
RD
549 # make sure local copy of contrib files are up to date
550 contrib_copy_tree(opj(CTRB_INC, 'ogl'), opj(OGLINC, 'wx/ogl'))
551 contrib_copy_tree(opj(CTRB_SRC, 'ogl'), OGLLOC)
c368d904 552
1e7ecb7b
RD
553 ext = Extension('oglc', ['%s/basic.cpp' % OGLLOC,
554 '%s/bmpshape.cpp' % OGLLOC,
555 '%s/composit.cpp' % OGLLOC,
556 '%s/divided.cpp' % OGLLOC,
557 '%s/lines.cpp' % OGLLOC,
558 '%s/misc.cpp' % OGLLOC,
559 '%s/basic2.cpp' % OGLLOC,
560 '%s/canvas.cpp' % OGLLOC,
561 '%s/constrnt.cpp' % OGLLOC,
562 '%s/drawn.cpp' % OGLLOC,
563 '%s/mfutils.cpp' % OGLLOC,
564 '%s/ogldiag.cpp' % OGLLOC,
565 ] + swig_sources,
566
567 include_dirs = [OGLINC] + includes,
568 define_macros = defines,
569
570 library_dirs = libdirs,
571 libraries = libs,
572
573 extra_compile_args = cflags,
574 extra_link_args = lflags,
575 )
576
577 wxpExtensions.append(ext)
578
579
c368d904
RD
580
581#----------------------------------------------------------------------
582# Define the STC extension module
583#----------------------------------------------------------------------
584
1b62f00d 585if not GL_ONLY and BUILD_STC:
cfe766c3 586 msg('Preparing STC...')
c368d904 587 location = 'contrib/stc'
55c020cf
RD
588 STCLOC = opj(location, 'contrib/src/stc')
589 STCINC = opj(location, 'contrib/include')
590 STC_H = opj(location, 'contrib/include/wx/stc')
c368d904 591
c368d904 592 if IN_CVS_TREE:
55c020cf
RD
593 # Check if gen_iface needs to be run for the wxSTC sources
594 if (newer(opj(CTRB_SRC, 'stc/stc.h.in'), opj(CTRB_INC, 'stc/stc.h' )) or
595 newer(opj(CTRB_SRC, 'stc/stc.cpp.in'), opj(CTRB_SRC, 'stc/stc.cpp')) or
596 newer(opj(CTRB_SRC, 'stc/gen_iface.py'), opj(CTRB_SRC, 'stc/stc.cpp'))):
597
598 msg('Running gen_iface.py, regenerating stc.h and stc.cpp...')
599 cwd = os.getcwd()
600 os.chdir(opj(CTRB_SRC, 'stc'))
601 import gen_iface
602 gen_iface.main([])
603 os.chdir(cwd)
604
605
606 # make sure local copy of contrib files are up to date
607 contrib_copy_tree(opj(CTRB_INC, 'stc'), opj(STCINC, 'wx/stc'))
608 contrib_copy_tree(opj(CTRB_SRC, 'stc'), STCLOC)
609
c368d904
RD
610
611
612 swig_files = ['stc_.i']
74933d75 613 swig_sources = run_swig(swig_files, location, GENDIR, PKGDIR,
c368d904
RD
614 USE_SWIG, swig_force,
615 swig_args + ['-I'+STC_H, '-I'+location],
10ef30eb 616 [opj(STC_H, 'stc.h')] + swig_deps)
c368d904 617
4a61305d 618 # copy a contrib project specific py module to the main package dir
55c020cf 619 copy_file(opj(location, 'stc.py'), PKGDIR, update=1, verbose=0)
c368d904
RD
620
621 # add some include dirs to the standard set
1e7ecb7b
RD
622 stc_includes = includes[:]
623 stc_includes.append('%s/scintilla/include' % STCLOC)
624 stc_includes.append('%s/scintilla/src' % STCLOC)
625 stc_includes.append(STCINC)
c368d904
RD
626
627 # and some macro definitions
1e7ecb7b
RD
628 stc_defines = defines[:]
629 stc_defines.append( ('__WX__', None) )
630 stc_defines.append( ('SCI_LEXER', None) )
1a2fb4cd 631 stc_defines.append( ('LINK_LEXERS', None) )
c368d904
RD
632
633
1e7ecb7b
RD
634 ext = Extension('stc_c',
635 ['%s/scintilla/src/AutoComplete.cxx' % STCLOC,
c368d904
RD
636 '%s/scintilla/src/CallTip.cxx' % STCLOC,
637 '%s/scintilla/src/CellBuffer.cxx' % STCLOC,
638 '%s/scintilla/src/ContractionState.cxx' % STCLOC,
639 '%s/scintilla/src/Document.cxx' % STCLOC,
55c020cf 640 '%s/scintilla/src/DocumentAccessor.cxx' % STCLOC,
c368d904
RD
641 '%s/scintilla/src/Editor.cxx' % STCLOC,
642 '%s/scintilla/src/Indicator.cxx' % STCLOC,
643 '%s/scintilla/src/KeyMap.cxx' % STCLOC,
644 '%s/scintilla/src/KeyWords.cxx' % STCLOC,
645 '%s/scintilla/src/LineMarker.cxx' % STCLOC,
646 '%s/scintilla/src/PropSet.cxx' % STCLOC,
55c020cf 647 '%s/scintilla/src/RESearch.cxx' % STCLOC,
c368d904
RD
648 '%s/scintilla/src/ScintillaBase.cxx' % STCLOC,
649 '%s/scintilla/src/Style.cxx' % STCLOC,
fe0aca37 650 '%s/scintilla/src/StyleContext.cxx' % STCLOC,
55c020cf 651 '%s/scintilla/src/UniConversion.cxx' % STCLOC,
c368d904 652 '%s/scintilla/src/ViewStyle.cxx' % STCLOC,
55c020cf
RD
653 '%s/scintilla/src/WindowAccessor.cxx' % STCLOC,
654
655 '%s/scintilla/src/LexAda.cxx' % STCLOC,
656 '%s/scintilla/src/LexAVE.cxx' % STCLOC,
1a2fb4cd
RD
657 '%s/scintilla/src/LexBaan.cxx' % STCLOC,
658 '%s/scintilla/src/LexBullant.cxx' % STCLOC,
c368d904 659 '%s/scintilla/src/LexCPP.cxx' % STCLOC,
fe0aca37
RD
660 '%s/scintilla/src/LexConf.cxx' % STCLOC,
661 '%s/scintilla/src/LexCrontab.cxx' % STCLOC,
55c020cf 662 '%s/scintilla/src/LexEiffel.cxx' % STCLOC,
c368d904 663 '%s/scintilla/src/LexHTML.cxx' % STCLOC,
55c020cf 664 '%s/scintilla/src/LexLisp.cxx' % STCLOC,
c368d904 665 '%s/scintilla/src/LexLua.cxx' % STCLOC,
1a2fb4cd 666 '%s/scintilla/src/LexMatlab.cxx' % STCLOC,
c368d904 667 '%s/scintilla/src/LexOthers.cxx' % STCLOC,
55c020cf 668 '%s/scintilla/src/LexPascal.cxx' % STCLOC,
c368d904
RD
669 '%s/scintilla/src/LexPerl.cxx' % STCLOC,
670 '%s/scintilla/src/LexPython.cxx' % STCLOC,
55c020cf 671 '%s/scintilla/src/LexRuby.cxx' % STCLOC,
c368d904
RD
672 '%s/scintilla/src/LexSQL.cxx' % STCLOC,
673 '%s/scintilla/src/LexVB.cxx' % STCLOC,
c368d904
RD
674
675 '%s/PlatWX.cpp' % STCLOC,
676 '%s/ScintillaWX.cpp' % STCLOC,
677 '%s/stc.cpp' % STCLOC,
1e7ecb7b
RD
678 ] + swig_sources,
679
680 include_dirs = stc_includes,
681 define_macros = stc_defines,
682
683 library_dirs = libdirs,
684 libraries = libs,
c368d904 685
1e7ecb7b
RD
686 extra_compile_args = cflags,
687 extra_link_args = lflags,
688 )
689
690 wxpExtensions.append(ext)
c368d904
RD
691
692
693
926bb76c
RD
694#----------------------------------------------------------------------
695# Define the IEWIN extension module (experimental)
696#----------------------------------------------------------------------
697
698if not GL_ONLY and BUILD_IEWIN:
cfe766c3 699 msg('Preparing IEWIN...')
926bb76c
RD
700 location = 'contrib/iewin'
701
702 swig_files = ['iewin.i', ]
703
704 swig_sources = run_swig(swig_files, location, '', PKGDIR,
10ef30eb 705 USE_SWIG, swig_force, swig_args, swig_deps)
926bb76c
RD
706
707
708 ext = Extension('iewinc', ['%s/IEHtmlWin.cpp' % location,
c731eb47 709 '%s/wxactivex.cpp' % location,
926bb76c
RD
710 ] + swig_sources,
711
712 include_dirs = includes,
713 define_macros = defines,
714
715 library_dirs = libdirs,
716 libraries = libs,
717
718 extra_compile_args = cflags,
719 extra_link_args = lflags,
720 )
721
722 wxpExtensions.append(ext)
723
724
d56cebe7
RD
725#----------------------------------------------------------------------
726# Define the XRC extension module
727#----------------------------------------------------------------------
728
729if not GL_ONLY and BUILD_XRC:
cfe766c3 730 msg('Preparing XRC...')
d56cebe7 731 location = 'contrib/xrc'
55c020cf
RD
732 XMLLOC = opj(location, 'contrib/src/xrc')
733 XMLINC = opj(location, 'contrib/include')
d56cebe7
RD
734
735 swig_files = ['xrc.i']
736
737 swig_sources = run_swig(swig_files, location, '', PKGDIR,
10ef30eb 738 USE_SWIG, swig_force, swig_args, swig_deps)
d56cebe7
RD
739
740 xmlres_includes = includes[:]
741 xmlres_includes.append('%s/expat/xmlparse' % XMLLOC)
742 xmlres_includes.append('%s/expat/xmltok' % XMLLOC)
743 xmlres_includes.append(XMLINC)
744
745
746 # make sure local copy of contrib files are up to date
747 if IN_CVS_TREE:
55c020cf
RD
748 contrib_copy_tree(opj(CTRB_INC, 'xrc'), opj(XMLINC, 'wx/xrc'))
749 contrib_copy_tree(opj(CTRB_SRC, 'xrc'), XMLLOC)
d56cebe7
RD
750
751 ext = Extension('xrcc', ['%s/expat/xmlparse/xmlparse.c' % XMLLOC,
752 '%s/expat/xmltok/xmlrole.c' % XMLLOC,
753 '%s/expat/xmltok/xmltok.c' % XMLLOC,
754
755 '%s/xh_bmp.cpp' % XMLLOC,
756 '%s/xh_bmpbt.cpp' % XMLLOC,
757 '%s/xh_bttn.cpp' % XMLLOC,
758 '%s/xh_cald.cpp' % XMLLOC,
759 '%s/xh_chckb.cpp' % XMLLOC,
760
761 '%s/xh_chckl.cpp' % XMLLOC,
762 '%s/xh_choic.cpp' % XMLLOC,
763 '%s/xh_combo.cpp' % XMLLOC,
764 '%s/xh_dlg.cpp' % XMLLOC,
765 '%s/xh_frame.cpp' % XMLLOC,
766
767 '%s/xh_gauge.cpp' % XMLLOC,
6c5ae2d2 768 '%s/xh_gdctl.cpp' % XMLLOC,
d56cebe7
RD
769 '%s/xh_html.cpp' % XMLLOC,
770 '%s/xh_listb.cpp' % XMLLOC,
771 '%s/xh_listc.cpp' % XMLLOC,
772 '%s/xh_menu.cpp' % XMLLOC,
773
774 '%s/xh_notbk.cpp' % XMLLOC,
775 '%s/xh_panel.cpp' % XMLLOC,
776 '%s/xh_radbt.cpp' % XMLLOC,
777 '%s/xh_radbx.cpp' % XMLLOC,
778 '%s/xh_scrol.cpp' % XMLLOC,
779
780 '%s/xh_sizer.cpp' % XMLLOC,
781 '%s/xh_slidr.cpp' % XMLLOC,
782 '%s/xh_spin.cpp' % XMLLOC,
783 '%s/xh_stbmp.cpp' % XMLLOC,
784 '%s/xh_stbox.cpp' % XMLLOC,
785
786 '%s/xh_stlin.cpp' % XMLLOC,
787 '%s/xh_sttxt.cpp' % XMLLOC,
788 '%s/xh_text.cpp' % XMLLOC,
789 '%s/xh_toolb.cpp' % XMLLOC,
790 '%s/xh_tree.cpp' % XMLLOC,
791
792 '%s/xh_unkwn.cpp' % XMLLOC,
793 '%s/xml.cpp' % XMLLOC,
d56cebe7
RD
794 '%s/xmlres.cpp' % XMLLOC,
795 '%s/xmlrsall.cpp' % XMLLOC,
d56cebe7
RD
796
797 ] + swig_sources,
798
799 include_dirs = xmlres_includes,
800 define_macros = defines,
801
802 library_dirs = libdirs,
803 libraries = libs,
804
805 extra_compile_args = cflags,
806 extra_link_args = lflags,
807 )
808
809 wxpExtensions.append(ext)
810
811
812
ebf4302c
RD
813#----------------------------------------------------------------------
814# Define the GIZMOS extension module
815#----------------------------------------------------------------------
816
817if not GL_ONLY and BUILD_GIZMOS:
818 msg('Preparing GIZMOS...')
819 location = 'contrib/gizmos'
820 GIZMOLOC = opj(location, 'contrib/src/gizmos')
821 GIZMOINC = opj(location, 'contrib/include')
822
823 swig_files = ['gizmos.i']
824
825 swig_sources = run_swig(swig_files, location, '', PKGDIR,
10ef30eb 826 USE_SWIG, swig_force, swig_args, swig_deps)
ebf4302c
RD
827
828 gizmos_includes = includes[:]
829 gizmos_includes.append(GIZMOINC)
830
831
832 # make sure local copy of contrib files are up to date
833 if IN_CVS_TREE:
834 contrib_copy_tree(opj(CTRB_INC, 'gizmos'), opj(GIZMOINC, 'wx/gizmos'))
835 contrib_copy_tree(opj(CTRB_SRC, 'gizmos'), GIZMOLOC)
836
837 ext = Extension('gizmosc', [
838 '%s/dynamicsash.cpp' % GIZMOLOC,
2f4e9287 839 '%s/editlbox.cpp' % GIZMOLOC,
950e7faf 840 #'%s/multicell.cpp' % GIZMOLOC,
ebf4302c 841 '%s/splittree.cpp' % GIZMOLOC,
950e7faf 842 '%s/ledctrl.cpp' % GIZMOLOC,
ebf4302c
RD
843 ] + swig_sources,
844
845 include_dirs = gizmos_includes,
846 define_macros = defines,
847
848 library_dirs = libdirs,
849 libraries = libs,
850
851 extra_compile_args = cflags,
852 extra_link_args = lflags,
853 )
854
855 wxpExtensions.append(ext)
856
857
858
4a61305d
RD
859#----------------------------------------------------------------------
860# Define the DLLWIDGET extension module
861#----------------------------------------------------------------------
862
863if not GL_ONLY and BUILD_DLLWIDGET:
864 msg('Preparing DLLWIDGET...')
865 location = 'contrib/dllwidget'
866 swig_files = ['dllwidget_.i']
867
868 swig_sources = run_swig(swig_files, location, '', PKGDIR,
10ef30eb 869 USE_SWIG, swig_force, swig_args, swig_deps)
4a61305d
RD
870
871 # copy a contrib project specific py module to the main package dir
872 copy_file(opj(location, 'dllwidget.py'), PKGDIR, update=1, verbose=0)
873
874 ext = Extension('dllwidget_c', [
875 '%s/dllwidget.cpp' % location,
876 ] + swig_sources,
877
878 include_dirs = includes,
879 define_macros = defines,
880
881 library_dirs = libdirs,
882 libraries = libs,
883
884 extra_compile_args = cflags,
885 extra_link_args = lflags,
886 )
887
888 wxpExtensions.append(ext)
889
890
8916d007
RD
891#----------------------------------------------------------------------
892# Tools and scripts
893#----------------------------------------------------------------------
894
b817523b
RD
895## TOOLS = [("wxPython/tools", glob.glob("tools/*.py")),
896## ("wxPython/tools/XRCed", glob.glob("tools/XRCed/*.py") +
897## glob.glob("tools/XRCed/*.xrc") +
898## ["tools/XRCed/CHANGES",
899## "tools/XRCed/TODO",
900## "tools/XRCed/README"]),
901## ]
8916d007
RD
902
903
2eb31f8b
RD
904if NO_SCRIPTS:
905 SCRIPTS = None
906else:
907 SCRIPTS = [opj('scripts/img2png'),
908 opj('scripts/img2xpm'),
909 opj('scripts/img2py'),
910 opj('scripts/xrced'),
911 opj('scripts/pyshell'),
912 opj('scripts/pycrust'),
913 ]
4a61305d 914
926bb76c 915
c368d904
RD
916#----------------------------------------------------------------------
917# Do the Setup/Build/Install/Whatever
918#----------------------------------------------------------------------
919
1b62f00d
RD
920if __name__ == "__main__":
921 if not GL_ONLY:
922 setup(name = PKGDIR,
923 version = VERSION,
924 description = DESCRIPTION,
925 long_description = LONG_DESCRIPTION,
926 author = AUTHOR,
927 author_email = AUTHOR_EMAIL,
928 url = URL,
e2e02194 929 license = LICENSE,
1b62f00d
RD
930
931 packages = [PKGDIR,
932 PKGDIR+'.lib',
933 PKGDIR+'.lib.editor',
2ba9346d
RD
934 PKGDIR+'.lib.mixins',
935 PKGDIR+'.lib.PyCrust',
f6f98ecc
RD
936 PKGDIR+'.tools',
937 PKGDIR+'.tools.XRCed',
1b62f00d
RD
938 ],
939
940 ext_package = PKGDIR,
941 ext_modules = wxpExtensions,
8916d007 942
f6f98ecc 943 options = { 'build' : { 'build_base' : BUILD_BASE }},
a541c325 944
8916d007 945 ##data_files = TOOLS,
b817523b 946 scripts = SCRIPTS,
1b62f00d 947 )
c368d904 948
1b62f00d 949 else:
c368d904 950
1b62f00d
RD
951 setup(name = "wxPython-gl",
952 version = VERSION,
953 description = "wxGLCanvas class for wxPython",
954 author = AUTHOR,
955 author_email = AUTHOR_EMAIL,
956 url = URL,
e2e02194 957 license = LICENSE,
c368d904 958
1b62f00d 959 py_modules = [ "wxPython.glcanvas" ],
c368d904 960
1b62f00d
RD
961 ext_package = PKGDIR,
962 ext_modules = wxpExtensions,
8916d007 963
1b62f00d 964 )
c368d904 965
c368d904
RD
966
967
968
969#----------------------------------------------------------------------
970#----------------------------------------------------------------------