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