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