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