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