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