]> git.saurik.com Git - wxWidgets.git/blob - wxPython/setup.py
a hack to fix the MSW build for now, pending better solution
[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 = [] #['/GX-'] # workaround for internal compiler error in MSVC on some machines
222 lflags = None
223
224
225 if bcpp_compiling: # overwrite it
226 cflags = ['-5', '-VF', ### To support MSVC spurious semicolons in the class scope
227 ### else, all semicolons at the end of all DECLARE_...CALLBACK... macros must be eliminated
228 '-Hc', '-H=' + opj(WXDIR, '\src\msw\wx32.csm'),
229 '@' + opj(WXDIR, '\src\msw\wxwin32.cfg')
230 ]
231
232
233 if not FINAL and HYBRID and not bcpp_compiling:
234 cflags = cflags + ['/Od', '/Z7']
235 lflags = ['/DEBUG', ]
236
237 elif bcpp_compiling and not FINAL:
238 cflags = cflags + ['/Od', '/v', '/y']
239 lflags = lflags + ['/v', ] ## '/PDB:NONE']
240
241
242
243 elif os.name == 'posix' and sys.platform[:6] == "darwin":
244 # Flags and such for a Darwin (Max OS X) build of Python
245
246 WXDIR = '..' # assumes IN_CVS_TREE
247 WXPLAT = '__WXMAC__'
248 GENDIR = 'mac'
249
250 includes = ['src']
251 defines = [('SWIG_GLOBAL', None),
252 ('HAVE_CONFIG_H', None),
253 ('WXP_USE_THREAD', '1'),
254 ]
255 libdirs = []
256 libs = []
257
258 cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1]
259 cflags = string.split(cflags)
260
261 lflags = os.popen(WX_CONFIG + ' --libs', 'r').read()[:-1]
262 lflags = string.split(lflags)
263
264
265
266 elif os.name == 'posix':
267 # Set flags for Unix type platforms
268
269 WXDIR = '..' # assumes IN_CVS_TREE
270 WXPLAT = '__WXGTK__' # and assumes GTK...
271 GENDIR = 'gtk' # Need to allow for Motif eventually too
272
273 includes = ['src']
274 defines = [('SWIG_GLOBAL', None),
275 ('HAVE_CONFIG_H', None),
276 ('WXP_USE_THREAD', '1'),
277 ]
278 libdirs = []
279 libs = []
280
281 cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1] + ' ' + \
282 os.popen('gtk-config --cflags', 'r').read()[:-1]
283 cflags = string.split(cflags)
284
285 lflags = os.popen(WX_CONFIG + ' --libs', 'r').read()[:-1]
286 lflags = string.split(lflags)
287
288
289 else:
290 raise 'Sorry Charlie...'
291
292
293 #----------------------------------------------------------------------
294 # Check if the version file needs updated
295 #----------------------------------------------------------------------
296
297 if IN_CVS_TREE and newer('setup.py', 'src/__version__.py'):
298 open('src/__version__.py', 'w').write("ver = '%s'\n" % VERSION)
299
300
301
302 #----------------------------------------------------------------------
303 # SWIG defaults
304 #----------------------------------------------------------------------
305
306 swig_force = force
307 swig_args = ['-c++', '-shadow', '-python', '-keyword',
308 '-dnone',
309 #'-dascii',
310 #'-docstring', '-Sbefore',
311 '-I./src', '-D'+WXPLAT,
312 ]
313 swig_deps = ['src/my_typemaps.i']
314
315
316 #----------------------------------------------------------------------
317 # Define the CORE extension module
318 #----------------------------------------------------------------------
319
320 if not GL_ONLY:
321 msg('Preparing CORE...')
322 swig_files = [ 'wx.i', 'windows.i', 'windows2.i', 'windows3.i', 'events.i',
323 'misc.i', 'misc2.i', 'gdi.i', 'mdi.i', 'controls.i',
324 'controls2.i', 'cmndlgs.i', 'stattool.i', 'frames.i', 'image.i',
325 'printfw.i', 'sizers.i', 'clip_dnd.i',
326 'filesys.i', 'streams.i', 'utils.i'
327 ]
328
329 swig_sources = run_swig(swig_files, 'src', GENDIR, PKGDIR,
330 USE_SWIG, swig_force, swig_args, swig_deps)
331
332 copy_file('src/__init__.py', PKGDIR, update=1, verbose=0)
333 copy_file('src/__version__.py', PKGDIR, update=1, verbose=0)
334
335
336 if IN_CVS_TREE: # update the licence files
337 mkpath('licence')
338 for file in ['preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt']:
339 copy_file(opj(WXDIR, 'docs', file), opj('licence',file), update=1, verbose=0)
340
341
342 if os.name == 'nt':
343 rc_file = ['src/wxc.rc']
344 else:
345 rc_file = []
346
347
348 ext = Extension('wxc', ['src/helpers.cpp',
349 'src/libpy.c',
350 ] + rc_file + swig_sources,
351
352 include_dirs = includes,
353 define_macros = defines,
354
355 library_dirs = libdirs,
356 libraries = libs,
357
358 extra_compile_args = cflags,
359 extra_link_args = lflags,
360 )
361 wxpExtensions.append(ext)
362
363
364 # Extension for the grid module
365 swig_sources = run_swig(['grid.i'], 'src', GENDIR, PKGDIR,
366 USE_SWIG, swig_force, swig_args, swig_deps)
367 ext = Extension('gridc', swig_sources,
368 include_dirs = includes,
369 define_macros = defines,
370 library_dirs = libdirs,
371 libraries = libs,
372 extra_compile_args = cflags,
373 extra_link_args = lflags,
374 )
375 wxpExtensions.append(ext)
376
377
378 # Extension for the html modules
379 swig_sources = run_swig(['html.i', 'htmlhelp.i'], 'src', GENDIR, PKGDIR,
380 USE_SWIG, swig_force, swig_args, swig_deps)
381 ext = Extension('htmlc', swig_sources,
382 include_dirs = includes,
383 define_macros = defines,
384 library_dirs = libdirs,
385 libraries = libs,
386 extra_compile_args = cflags,
387 extra_link_args = lflags,
388 )
389 wxpExtensions.append(ext)
390
391
392 # Extension for the calendar module
393 swig_sources = run_swig(['calendar.i'], 'src', GENDIR, PKGDIR,
394 USE_SWIG, swig_force, swig_args, swig_deps)
395 ext = Extension('calendarc', swig_sources,
396 include_dirs = includes,
397 define_macros = defines,
398 library_dirs = libdirs,
399 libraries = libs,
400 extra_compile_args = cflags,
401 extra_link_args = lflags,
402 )
403 wxpExtensions.append(ext)
404
405
406 # Extension for the help module
407 swig_sources = run_swig(['help.i'], 'src', GENDIR, PKGDIR,
408 USE_SWIG, swig_force, swig_args, swig_deps)
409 ext = Extension('helpc', swig_sources,
410 include_dirs = includes,
411 define_macros = defines,
412 library_dirs = libdirs,
413 libraries = libs,
414 extra_compile_args = cflags,
415 extra_link_args = lflags,
416 )
417 wxpExtensions.append(ext)
418
419
420 #----------------------------------------------------------------------
421 # Define the GLCanvas extension module
422 #----------------------------------------------------------------------
423
424 CTRB_SRC = opj(WXDIR, 'contrib/src')
425 CTRB_INC = opj(WXDIR, 'contrib/include/wx')
426
427 if BUILD_GLCANVAS or GL_ONLY:
428 msg('Preparing GLCANVAS...')
429 location = 'contrib/glcanvas'
430 swig_files = ['glcanvas.i']
431 other_sources = []
432
433 swig_sources = run_swig(swig_files, location, GENDIR, PKGDIR,
434 USE_SWIG, swig_force, swig_args)
435
436 gl_libs = []
437 if os.name == 'posix':
438 gl_config = os.popen(WX_CONFIG + ' --gl-libs', 'r').read()[:-1]
439 gl_lflags = string.split(gl_config) + lflags
440 gl_libs = libs
441 else:
442 other_sources = [opj(location, 'msw/myglcanvas.cpp')]
443 gl_libs = libs + ['opengl32', 'glu32']
444 gl_lflags = lflags
445
446 ext = Extension('glcanvasc',
447 swig_sources + other_sources,
448
449 include_dirs = includes,
450 define_macros = defines,
451
452 library_dirs = libdirs,
453 libraries = gl_libs,
454
455 extra_compile_args = cflags,
456 extra_link_args = gl_lflags,
457 )
458
459 wxpExtensions.append(ext)
460
461
462 #----------------------------------------------------------------------
463 # Define the OGL extension module
464 #----------------------------------------------------------------------
465
466 if not GL_ONLY and BUILD_OGL:
467 msg('Preparing OGL...')
468 location = 'contrib/ogl'
469 OGLLOC = opj(location, 'contrib/src/ogl')
470 OGLINC = opj(location, 'contrib/include')
471
472 swig_files = ['ogl.i', 'oglbasic.i', 'oglshapes.i', 'oglshapes2.i',
473 'oglcanvas.i']
474
475 swig_sources = run_swig(swig_files, location, '', PKGDIR,
476 USE_SWIG, swig_force, swig_args)
477
478 if IN_CVS_TREE:
479 # make sure local copy of contrib files are up to date
480 contrib_copy_tree(opj(CTRB_INC, 'ogl'), opj(OGLINC, 'wx/ogl'))
481 contrib_copy_tree(opj(CTRB_SRC, 'ogl'), OGLLOC)
482
483 ext = Extension('oglc', ['%s/basic.cpp' % OGLLOC,
484 '%s/bmpshape.cpp' % OGLLOC,
485 '%s/composit.cpp' % OGLLOC,
486 '%s/divided.cpp' % OGLLOC,
487 '%s/lines.cpp' % OGLLOC,
488 '%s/misc.cpp' % OGLLOC,
489 '%s/basic2.cpp' % OGLLOC,
490 '%s/canvas.cpp' % OGLLOC,
491 '%s/constrnt.cpp' % OGLLOC,
492 '%s/drawn.cpp' % OGLLOC,
493 '%s/mfutils.cpp' % OGLLOC,
494 '%s/ogldiag.cpp' % OGLLOC,
495 ] + swig_sources,
496
497 include_dirs = [OGLINC] + includes,
498 define_macros = defines,
499
500 library_dirs = libdirs,
501 libraries = libs,
502
503 extra_compile_args = cflags,
504 extra_link_args = lflags,
505 )
506
507 wxpExtensions.append(ext)
508
509
510
511 #----------------------------------------------------------------------
512 # Define the STC extension module
513 #----------------------------------------------------------------------
514
515 if not GL_ONLY and BUILD_STC:
516 msg('Preparing STC...')
517 location = 'contrib/stc'
518 STCLOC = opj(location, 'contrib/src/stc')
519 STCINC = opj(location, 'contrib/include')
520 STC_H = opj(location, 'contrib/include/wx/stc')
521
522 if IN_CVS_TREE:
523 # Check if gen_iface needs to be run for the wxSTC sources
524 if (newer(opj(CTRB_SRC, 'stc/stc.h.in'), opj(CTRB_INC, 'stc/stc.h' )) or
525 newer(opj(CTRB_SRC, 'stc/stc.cpp.in'), opj(CTRB_SRC, 'stc/stc.cpp')) or
526 newer(opj(CTRB_SRC, 'stc/gen_iface.py'), opj(CTRB_SRC, 'stc/stc.cpp'))):
527
528 msg('Running gen_iface.py, regenerating stc.h and stc.cpp...')
529 cwd = os.getcwd()
530 os.chdir(opj(CTRB_SRC, 'stc'))
531 import gen_iface
532 gen_iface.main([])
533 os.chdir(cwd)
534
535
536 # make sure local copy of contrib files are up to date
537 contrib_copy_tree(opj(CTRB_INC, 'stc'), opj(STCINC, 'wx/stc'))
538 contrib_copy_tree(opj(CTRB_SRC, 'stc'), STCLOC)
539
540
541
542 swig_files = ['stc_.i']
543 swig_sources = run_swig(swig_files, location, GENDIR, PKGDIR,
544 USE_SWIG, swig_force,
545 swig_args + ['-I'+STC_H, '-I'+location],
546 [opj(STC_H, 'stc.h')])
547
548 # copy a contrib project specific py module to the main package dir
549 copy_file(opj(location, 'stc.py'), PKGDIR, update=1, verbose=0)
550
551 # add some include dirs to the standard set
552 stc_includes = includes[:]
553 stc_includes.append('%s/scintilla/include' % STCLOC)
554 stc_includes.append('%s/scintilla/src' % STCLOC)
555 stc_includes.append(STCINC)
556
557 # and some macro definitions
558 stc_defines = defines[:]
559 stc_defines.append( ('__WX__', None) )
560 stc_defines.append( ('SCI_LEXER', None) )
561
562
563 ext = Extension('stc_c',
564 ['%s/scintilla/src/AutoComplete.cxx' % STCLOC,
565 '%s/scintilla/src/CallTip.cxx' % STCLOC,
566 '%s/scintilla/src/CellBuffer.cxx' % STCLOC,
567 '%s/scintilla/src/ContractionState.cxx' % STCLOC,
568 '%s/scintilla/src/Document.cxx' % STCLOC,
569 '%s/scintilla/src/DocumentAccessor.cxx' % STCLOC,
570 '%s/scintilla/src/Editor.cxx' % STCLOC,
571 '%s/scintilla/src/Indicator.cxx' % STCLOC,
572 '%s/scintilla/src/KeyMap.cxx' % STCLOC,
573 '%s/scintilla/src/KeyWords.cxx' % STCLOC,
574 '%s/scintilla/src/LineMarker.cxx' % STCLOC,
575 '%s/scintilla/src/PropSet.cxx' % STCLOC,
576 '%s/scintilla/src/RESearch.cxx' % STCLOC,
577 '%s/scintilla/src/ScintillaBase.cxx' % STCLOC,
578 '%s/scintilla/src/Style.cxx' % STCLOC,
579 '%s/scintilla/src/StyleContext.cxx' % STCLOC,
580 '%s/scintilla/src/UniConversion.cxx' % STCLOC,
581 '%s/scintilla/src/ViewStyle.cxx' % STCLOC,
582 '%s/scintilla/src/WindowAccessor.cxx' % STCLOC,
583
584 '%s/scintilla/src/LexAda.cxx' % STCLOC,
585 '%s/scintilla/src/LexAVE.cxx' % STCLOC,
586 '%s/scintilla/src/LexCPP.cxx' % STCLOC,
587 '%s/scintilla/src/LexConf.cxx' % STCLOC,
588 '%s/scintilla/src/LexCrontab.cxx' % STCLOC,
589 '%s/scintilla/src/LexEiffel.cxx' % STCLOC,
590 '%s/scintilla/src/LexHTML.cxx' % STCLOC,
591 '%s/scintilla/src/LexLisp.cxx' % STCLOC,
592 '%s/scintilla/src/LexLua.cxx' % STCLOC,
593 '%s/scintilla/src/LexOthers.cxx' % STCLOC,
594 '%s/scintilla/src/LexPascal.cxx' % STCLOC,
595 '%s/scintilla/src/LexPerl.cxx' % STCLOC,
596 '%s/scintilla/src/LexPython.cxx' % STCLOC,
597 '%s/scintilla/src/LexRuby.cxx' % STCLOC,
598 '%s/scintilla/src/LexSQL.cxx' % STCLOC,
599 '%s/scintilla/src/LexVB.cxx' % STCLOC,
600
601 '%s/PlatWX.cpp' % STCLOC,
602 '%s/ScintillaWX.cpp' % STCLOC,
603 '%s/stc.cpp' % STCLOC,
604 ] + swig_sources,
605
606 include_dirs = stc_includes,
607 define_macros = stc_defines,
608
609 library_dirs = libdirs,
610 libraries = libs,
611
612 extra_compile_args = cflags,
613 extra_link_args = lflags,
614 )
615
616 wxpExtensions.append(ext)
617
618
619
620 #----------------------------------------------------------------------
621 # Define the IEWIN extension module (experimental)
622 #----------------------------------------------------------------------
623
624 if not GL_ONLY and BUILD_IEWIN:
625 msg('Preparing IEWIN...')
626 location = 'contrib/iewin'
627
628 swig_files = ['iewin.i', ]
629
630 swig_sources = run_swig(swig_files, location, '', PKGDIR,
631 USE_SWIG, swig_force, swig_args)
632
633
634 ext = Extension('iewinc', ['%s/IEHtmlWin.cpp' % location,
635 ] + swig_sources,
636
637 include_dirs = includes,
638 define_macros = defines,
639
640 library_dirs = libdirs,
641 libraries = libs,
642
643 extra_compile_args = cflags,
644 extra_link_args = lflags,
645 )
646
647 wxpExtensions.append(ext)
648
649
650 #----------------------------------------------------------------------
651 # Define the XRC extension module
652 #----------------------------------------------------------------------
653
654 if not GL_ONLY and BUILD_XRC:
655 msg('Preparing XRC...')
656 location = 'contrib/xrc'
657 XMLLOC = opj(location, 'contrib/src/xrc')
658 XMLINC = opj(location, 'contrib/include')
659
660 swig_files = ['xrc.i']
661
662 swig_sources = run_swig(swig_files, location, '', PKGDIR,
663 USE_SWIG, swig_force, swig_args)
664
665 xmlres_includes = includes[:]
666 xmlres_includes.append('%s/expat/xmlparse' % XMLLOC)
667 xmlres_includes.append('%s/expat/xmltok' % XMLLOC)
668 xmlres_includes.append(XMLINC)
669
670
671 # make sure local copy of contrib files are up to date
672 if IN_CVS_TREE:
673 contrib_copy_tree(opj(CTRB_INC, 'xrc'), opj(XMLINC, 'wx/xrc'))
674 contrib_copy_tree(opj(CTRB_SRC, 'xrc'), XMLLOC)
675
676 ext = Extension('xrcc', ['%s/expat/xmlparse/xmlparse.c' % XMLLOC,
677 '%s/expat/xmltok/xmlrole.c' % XMLLOC,
678 '%s/expat/xmltok/xmltok.c' % XMLLOC,
679
680 '%s/xh_bmp.cpp' % XMLLOC,
681 '%s/xh_bmpbt.cpp' % XMLLOC,
682 '%s/xh_bttn.cpp' % XMLLOC,
683 '%s/xh_cald.cpp' % XMLLOC,
684 '%s/xh_chckb.cpp' % XMLLOC,
685
686 '%s/xh_chckl.cpp' % XMLLOC,
687 '%s/xh_choic.cpp' % XMLLOC,
688 '%s/xh_combo.cpp' % XMLLOC,
689 '%s/xh_dlg.cpp' % XMLLOC,
690 '%s/xh_frame.cpp' % XMLLOC,
691
692 '%s/xh_gauge.cpp' % XMLLOC,
693 '%s/xh_gdctl.cpp' % XMLLOC,
694 '%s/xh_html.cpp' % XMLLOC,
695 '%s/xh_listb.cpp' % XMLLOC,
696 '%s/xh_listc.cpp' % XMLLOC,
697 '%s/xh_menu.cpp' % XMLLOC,
698
699 '%s/xh_notbk.cpp' % XMLLOC,
700 '%s/xh_panel.cpp' % XMLLOC,
701 '%s/xh_radbt.cpp' % XMLLOC,
702 '%s/xh_radbx.cpp' % XMLLOC,
703 '%s/xh_scrol.cpp' % XMLLOC,
704
705 '%s/xh_sizer.cpp' % XMLLOC,
706 '%s/xh_slidr.cpp' % XMLLOC,
707 '%s/xh_spin.cpp' % XMLLOC,
708 '%s/xh_stbmp.cpp' % XMLLOC,
709 '%s/xh_stbox.cpp' % XMLLOC,
710
711 '%s/xh_stlin.cpp' % XMLLOC,
712 '%s/xh_sttxt.cpp' % XMLLOC,
713 '%s/xh_text.cpp' % XMLLOC,
714 '%s/xh_toolb.cpp' % XMLLOC,
715 '%s/xh_tree.cpp' % XMLLOC,
716
717 '%s/xh_unkwn.cpp' % XMLLOC,
718 '%s/xml.cpp' % XMLLOC,
719 '%s/xmlres.cpp' % XMLLOC,
720 '%s/xmlrsall.cpp' % XMLLOC,
721
722 ] + swig_sources,
723
724 include_dirs = xmlres_includes,
725 define_macros = defines,
726
727 library_dirs = libdirs,
728 libraries = libs,
729
730 extra_compile_args = cflags,
731 extra_link_args = lflags,
732 )
733
734 wxpExtensions.append(ext)
735
736
737
738 #----------------------------------------------------------------------
739 # Define the GIZMOS extension module
740 #----------------------------------------------------------------------
741
742 if not GL_ONLY and BUILD_GIZMOS:
743 msg('Preparing GIZMOS...')
744 location = 'contrib/gizmos'
745 GIZMOLOC = opj(location, 'contrib/src/gizmos')
746 GIZMOINC = opj(location, 'contrib/include')
747
748 swig_files = ['gizmos.i']
749
750 swig_sources = run_swig(swig_files, location, '', PKGDIR,
751 USE_SWIG, swig_force, swig_args)
752
753 gizmos_includes = includes[:]
754 gizmos_includes.append(GIZMOINC)
755
756
757 # make sure local copy of contrib files are up to date
758 if IN_CVS_TREE:
759 contrib_copy_tree(opj(CTRB_INC, 'gizmos'), opj(GIZMOINC, 'wx/gizmos'))
760 contrib_copy_tree(opj(CTRB_SRC, 'gizmos'), GIZMOLOC)
761
762 ext = Extension('gizmosc', [
763 '%s/dynamicsash.cpp' % GIZMOLOC,
764 '%s/editlbox.cpp' % GIZMOLOC,
765 #'%s/multicell.cpp' % GIZMOLOC,
766 '%s/splittree.cpp' % GIZMOLOC,
767 '%s/ledctrl.cpp' % GIZMOLOC,
768 ] + swig_sources,
769
770 include_dirs = gizmos_includes,
771 define_macros = defines,
772
773 library_dirs = libdirs,
774 libraries = libs,
775
776 extra_compile_args = cflags,
777 extra_link_args = lflags,
778 )
779
780 wxpExtensions.append(ext)
781
782
783
784 #----------------------------------------------------------------------
785 # Define the DLLWIDGET extension module
786 #----------------------------------------------------------------------
787
788 if not GL_ONLY and BUILD_DLLWIDGET:
789 msg('Preparing DLLWIDGET...')
790 location = 'contrib/dllwidget'
791 swig_files = ['dllwidget_.i']
792
793 swig_sources = run_swig(swig_files, location, '', PKGDIR,
794 USE_SWIG, swig_force, swig_args)
795
796 # copy a contrib project specific py module to the main package dir
797 copy_file(opj(location, 'dllwidget.py'), PKGDIR, update=1, verbose=0)
798
799 ext = Extension('dllwidget_c', [
800 '%s/dllwidget.cpp' % location,
801 ] + swig_sources,
802
803 include_dirs = includes,
804 define_macros = defines,
805
806 library_dirs = libdirs,
807 libraries = libs,
808
809 extra_compile_args = cflags,
810 extra_link_args = lflags,
811 )
812
813 wxpExtensions.append(ext)
814
815
816 #----------------------------------------------------------------------
817 # Tools and scripts
818 #----------------------------------------------------------------------
819
820 TOOLS = [("wxPython/tools", glob.glob("tools/*.py")),
821 ("wxPython/tools/XRCed", glob.glob("tools/XRCed/*.py") +
822 glob.glob("tools/XRCed/*.xrc") +
823 ["tools/XRCed/CHANGES",
824 "tools/XRCed/TODO",
825 "tools/XRCed/README"]),
826 ]
827
828
829
830
831 #----------------------------------------------------------------------
832 # Do the Setup/Build/Install/Whatever
833 #----------------------------------------------------------------------
834
835 if __name__ == "__main__":
836 if not GL_ONLY:
837 setup(name = PKGDIR,
838 version = VERSION,
839 description = DESCRIPTION,
840 long_description = LONG_DESCRIPTION,
841 author = AUTHOR,
842 author_email = AUTHOR_EMAIL,
843 url = URL,
844 licence = LICENCE,
845
846 packages = [PKGDIR,
847 PKGDIR+'.lib',
848 PKGDIR+'.lib.editor',
849 PKGDIR+'.lib.mixins',
850 PKGDIR+'.lib.PyCrust',
851 ],
852
853 ext_package = PKGDIR,
854 ext_modules = wxpExtensions,
855
856 ##data_files = TOOLS,
857 )
858
859 else:
860
861 setup(name = "wxPython-gl",
862 version = VERSION,
863 description = "wxGLCanvas class for wxPython",
864 author = AUTHOR,
865 author_email = AUTHOR_EMAIL,
866 url = URL,
867 licence = LICENCE,
868
869 py_modules = [ "wxPython.glcanvas" ],
870
871 ext_package = PKGDIR,
872 ext_modules = wxpExtensions,
873
874 )
875
876
877
878
879 #----------------------------------------------------------------------
880 #----------------------------------------------------------------------