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