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