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