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