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