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