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