]>
Commit | Line | Data |
---|---|---|
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.1" | |
17 | DESCRIPTION = "Cross platform GUI toolkit for Python" | |
18 | AUTHOR = "Robin Dunn" | |
19 | AUTHOR_EMAIL = "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_IEWIN = 0 # Internet Explorer wrapper (experimental) | |
35 | BUILD_XRC = 1 # XML based resource system | |
36 | ||
37 | ||
38 | CORE_ONLY = 0 # if true, don't build any of the above | |
39 | GL_ONLY = 0 # Only used when making the -gl RPM. See the "b" script | |
40 | # for the ugly details | |
41 | ||
42 | USE_SWIG = 0 # Should we actually execute SWIG, or just use the | |
43 | # files already in the distribution? | |
44 | ||
45 | IN_CVS_TREE = 0 # Set to true if building in a full wxWindows CVS | |
46 | # tree, otherwise will assume all needed files are | |
47 | # available in the wxPython source distribution | |
48 | ||
49 | WX_CONFIG = "wx-config" # Usually you shouldn't need to touch this, | |
50 | # but you can set it to pass an alternate | |
51 | # version of wx-config or alternate flags, | |
52 | # eg. as required by the .deb in-tree build. | |
53 | ||
54 | # Some MSW build settings | |
55 | ||
56 | FINAL = 1 # Mirrors use of same flag in wx makefiles, | |
57 | # (0 or 1 only) should probably find a way to | |
58 | # autodetect this... | |
59 | ||
60 | HYBRID = 0 # If set and not debug or FINAL, then build a | |
61 | # hybrid extension that can be used by the | |
62 | # non-debug version of python, but contains | |
63 | # debugging symbols for wxWindows and wxPython. | |
64 | # wxWindows must have been built with /MD, not /MDd | |
65 | # (using FINAL=hybrid will do it.) | |
66 | ||
67 | WXDLLVER = '23_1' # Version part of DLL name | |
68 | ||
69 | ||
70 | #---------------------------------------------------------------------- | |
71 | # Some other globals | |
72 | #---------------------------------------------------------------------- | |
73 | ||
74 | PKGDIR = 'wxPython' | |
75 | wxpExtensions = [] | |
76 | ||
77 | force = '--force' in sys.argv or '-f' in sys.argv | |
78 | debug = '--debug' in sys.argv or '-g' in sys.argv | |
79 | ||
80 | bcpp_compiling = '-c' in sys.argv and 'my_bcpp' in sys.argv # Bad heuristic | |
81 | ||
82 | if bcpp_compiling: | |
83 | print "Compiling wxPython by Borland C/C++ Compiler" | |
84 | HYBRID=0 | |
85 | WXBCPPLIBVER = string.replace(WXDLLVER,"_","") | |
86 | # Version part of BCPP build LIBRARY name | |
87 | WXDLLVER="" # no dll ver path avaible | |
88 | ||
89 | ||
90 | #---------------------------------------------------------------------- | |
91 | # Check for build flags on the command line | |
92 | #---------------------------------------------------------------------- | |
93 | ||
94 | for flag in ['BUILD_GLCANVAS', 'BUILD_OGL', 'BUILD_STC', 'CORE_ONLY', | |
95 | 'USE_SWIG', 'IN_CVS_TREE', 'FINAL', 'HYBRID', ]: | |
96 | for x in range(len(sys.argv)): | |
97 | if string.find(sys.argv[x], flag) == 0: | |
98 | pos = string.find(sys.argv[x], '=') + 1 | |
99 | if pos > 0: | |
100 | vars()[flag] = eval(sys.argv[x][pos:]) | |
101 | sys.argv[x] = '' | |
102 | ||
103 | for option in ['WX_CONFIG', 'WXDLLVER', ]: | |
104 | for x in range(len(sys.argv)): | |
105 | if string.find(sys.argv[x], option) == 0: | |
106 | pos = string.find(sys.argv[x], '=') + 1 | |
107 | if pos > 0: | |
108 | vars()[option] = sys.argv[x][pos:] | |
109 | sys.argv[x] = '' | |
110 | ||
111 | sys.argv = filter(None, sys.argv) | |
112 | ||
113 | ||
114 | if CORE_ONLY: | |
115 | BUILD_GLCANVAS = 0 | |
116 | BUILD_OGL = 0 | |
117 | BUILD_STC = 0 | |
118 | ||
119 | #---------------------------------------------------------------------- | |
120 | # Setup some platform specific stuff | |
121 | #---------------------------------------------------------------------- | |
122 | ||
123 | if os.name == 'nt': | |
124 | # Set compile flags and such for MSVC. These values are derived | |
125 | # from the wxWindows makefiles for MSVC, others will probably | |
126 | # vary... | |
127 | WXDIR = os.environ['WXWIN'] | |
128 | WXPLAT = '__WXMSW__' | |
129 | GENDIR = 'msw' | |
130 | ||
131 | if debug: | |
132 | FINAL = 0 | |
133 | HYBRID = 0 | |
134 | ||
135 | if HYBRID: | |
136 | FINAL = 0 | |
137 | ||
138 | includes = ['src', | |
139 | os.path.join(WXDIR, 'include'), | |
140 | ] | |
141 | ||
142 | defines = [ ('WIN32', None), # Some of these are no longer | |
143 | ('__WIN32__', None), # necessary. Anybody know which? | |
144 | ('_WINDOWS', None), | |
145 | ('__WINDOWS__', None), | |
146 | ('WINVER', '0x0400'), | |
147 | ('__WIN95__', None), | |
148 | ('STRICT', None), | |
149 | ||
150 | (WXPLAT, None), | |
151 | ('WXUSINGDLL', '1'), | |
152 | ||
153 | ('SWIG_GLOBAL', None), | |
154 | ('HAVE_CONFIG_H', None), | |
155 | ('WXP_USE_THREAD', '1'), | |
156 | ] | |
157 | ||
158 | if bcpp_compiling: # overwrite it | |
159 | defines = [ | |
160 | ('_WINDOWS', None), | |
161 | ('WINVER', '0x0400'), | |
162 | ('STRICT', None), | |
163 | ||
164 | ('WXUSINGDLL', '1'), | |
165 | ||
166 | ('SWIG_GLOBAL', None), | |
167 | ('HAVE_CONFIG_H', None), | |
168 | ('WXP_USE_THREAD', '1'), | |
169 | ||
170 | ('WXUSE_DEFINE','1'), | |
171 | ('_RTLDLL',None), | |
172 | ] | |
173 | ||
174 | ||
175 | if not FINAL or HYBRID: | |
176 | defines.append( ('__WXDEBUG__', None) ) | |
177 | ||
178 | libdirs = [os.path.join(WXDIR, 'lib'), 'build\\ilib'] | |
179 | ||
180 | if FINAL: | |
181 | wxdll = 'wx' + WXDLLVER | |
182 | elif HYBRID: | |
183 | wxdll = 'wx' + WXDLLVER + 'h' | |
184 | else: | |
185 | wxdll = 'wx' + WXDLLVER + 'd' | |
186 | ||
187 | ||
188 | libs = [wxdll] | |
189 | if bcpp_compiling: | |
190 | libs = ['wx'+WXBCPPLIBVER] | |
191 | ||
192 | libs = libs + ['kernel32', 'user32', 'gdi32', 'comdlg32', | |
193 | 'winspool', 'winmm', 'shell32', 'oldnames', 'comctl32', | |
194 | 'ctl3d32', 'odbc32', 'ole32', 'oleaut32', 'uuid', 'rpcrt4', | |
195 | 'advapi32', 'wsock32'] | |
196 | ||
197 | ||
198 | cflags = [] #['/GX-'] # workaround for internal compiler error in MSVC 5 | |
199 | lflags = None | |
200 | ||
201 | ||
202 | if bcpp_compiling: # overwrite it | |
203 | cflags = ['-5', '-VF', ### To supplort MSVC spurious semicolons in the class scope | |
204 | ### else, all semicolons at the end of all DECLARE_...CALLBACK... macros must be eliminated | |
205 | '-Hc', '-H='+WXDIR+'\src\msw\wx32.csm', | |
206 | '@'+WXDIR+'\src\msw\wxwin32.cfg' | |
207 | ] | |
208 | ||
209 | ||
210 | if not FINAL and HYBRID and not bcpp_compiling: | |
211 | cflags = cflags + ['/Od', '/Z7'] | |
212 | lflags = ['/DEBUG', ] | |
213 | ||
214 | elif bcpp_compiling and not FINAL: | |
215 | cflags = cflags + ['/Od', '/v', '/y'] | |
216 | lflags = lflags + ['/v', ] ## '/PDB:NONE'] | |
217 | ||
218 | ||
219 | ||
220 | elif os.name == 'posix': | |
221 | # Set flags for Unix type platforms | |
222 | ||
223 | WXDIR = '..' # assumes IN_CVS_TREE | |
224 | WXPLAT = '__WXGTK__' # and assumes GTK... | |
225 | GENDIR = 'gtk' # Need to allow for Motif eventually too | |
226 | ||
227 | includes = ['src'] | |
228 | defines = [('SWIG_GLOBAL', None), | |
229 | ('HAVE_CONFIG_H', None), | |
230 | ('WXP_USE_THREAD', '1'), | |
231 | ] | |
232 | libdirs = [] | |
233 | libs = [] | |
234 | ||
235 | cflags = os.popen(WX_CONFIG + ' --cflags', 'r').read()[:-1] + ' ' + \ | |
236 | os.popen('gtk-config --cflags', 'r').read()[:-1] | |
237 | cflags = string.split(cflags) | |
238 | ||
239 | lflags = os.popen(WX_CONFIG + ' --libs', 'r').read()[:-1] | |
240 | lflags = string.split(lflags) | |
241 | ||
242 | ||
243 | else: | |
244 | raise 'Sorry Charlie...' | |
245 | ||
246 | ||
247 | #---------------------------------------------------------------------- | |
248 | # Check if the version file needs updated | |
249 | #---------------------------------------------------------------------- | |
250 | ||
251 | if IN_CVS_TREE and newer('setup.py', 'src/__version__.py'): | |
252 | open('src/__version__.py', 'w').write("ver = '%s'\n" % VERSION) | |
253 | ||
254 | ||
255 | ||
256 | #---------------------------------------------------------------------- | |
257 | # SWIG defaults | |
258 | #---------------------------------------------------------------------- | |
259 | ||
260 | swig_force = force | |
261 | swig_args = ['-c++', '-shadow', '-python', '-keyword', '-dnone', #'-dascii', | |
262 | '-I./src', '-D'+WXPLAT] | |
263 | swig_deps = ['src/my_typemaps.i'] | |
264 | ||
265 | ||
266 | #---------------------------------------------------------------------- | |
267 | # Define the CORE extension module | |
268 | #---------------------------------------------------------------------- | |
269 | ||
270 | if not GL_ONLY: | |
271 | print 'Preparing CORE...' | |
272 | swig_files = [ 'wx.i', 'windows.i', 'windows2.i', 'windows3.i', 'events.i', | |
273 | 'misc.i', 'misc2.i', 'gdi.i', 'mdi.i', 'controls.i', | |
274 | 'controls2.i', 'cmndlgs.i', 'stattool.i', 'frames.i', 'image.i', | |
275 | 'printfw.i', 'sizers.i', 'clip_dnd.i', | |
276 | 'filesys.i', 'streams.i', | |
277 | ##'grid.i', 'html.i', 'htmlhelp.i', 'calendar.i', 'utils.i', | |
278 | ] | |
279 | ||
280 | swig_sources = run_swig(swig_files, 'src', GENDIR, PKGDIR, | |
281 | USE_SWIG, swig_force, swig_args, swig_deps) | |
282 | ||
283 | copy_file('src/__init__.py', PKGDIR, update=1, verbose=0) | |
284 | copy_file('src/__version__.py', PKGDIR, update=1, verbose=0) | |
285 | ||
286 | ||
287 | if IN_CVS_TREE: # update the licence files | |
288 | mkpath('licence') | |
289 | for file in ['preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt']: | |
290 | copy_file(WXDIR+'/docs/'+file, 'licence/'+file, update=1, verbose=0) | |
291 | ||
292 | ||
293 | if os.name == 'nt': | |
294 | rc_file = ['src/wxc.rc'] | |
295 | else: | |
296 | rc_file = [] | |
297 | ||
298 | ||
299 | ext = Extension('wxc', ['src/helpers.cpp', | |
300 | 'src/libpy.c', | |
301 | ] + rc_file + swig_sources, | |
302 | ||
303 | include_dirs = includes, | |
304 | define_macros = defines, | |
305 | ||
306 | library_dirs = libdirs, | |
307 | libraries = libs, | |
308 | ||
309 | extra_compile_args = cflags, | |
310 | extra_link_args = lflags, | |
311 | ) | |
312 | wxpExtensions.append(ext) | |
313 | ||
314 | ||
315 | # Extension for the grid module | |
316 | swig_sources = run_swig(['grid.i'], 'src', GENDIR, PKGDIR, | |
317 | USE_SWIG, swig_force, swig_args, swig_deps) | |
318 | ext = Extension('gridc', swig_sources, | |
319 | include_dirs = includes, | |
320 | define_macros = defines, | |
321 | library_dirs = libdirs, | |
322 | libraries = libs, | |
323 | extra_compile_args = cflags, | |
324 | extra_link_args = lflags, | |
325 | ) | |
326 | wxpExtensions.append(ext) | |
327 | ||
328 | ||
329 | # Extension for the html modules | |
330 | swig_sources = run_swig(['html.i', 'htmlhelp.i'], 'src', GENDIR, PKGDIR, | |
331 | USE_SWIG, swig_force, swig_args, swig_deps) | |
332 | ext = Extension('htmlc', swig_sources, | |
333 | include_dirs = includes, | |
334 | define_macros = defines, | |
335 | library_dirs = libdirs, | |
336 | libraries = libs, | |
337 | extra_compile_args = cflags, | |
338 | extra_link_args = lflags, | |
339 | ) | |
340 | wxpExtensions.append(ext) | |
341 | ||
342 | ||
343 | # Extension for the utils module | |
344 | swig_sources = run_swig(['utils.i'], 'src', GENDIR, PKGDIR, | |
345 | USE_SWIG, swig_force, swig_args, swig_deps) | |
346 | ext = Extension('utilsc', swig_sources, | |
347 | include_dirs = includes, | |
348 | define_macros = defines, | |
349 | library_dirs = libdirs, | |
350 | libraries = libs, | |
351 | extra_compile_args = cflags, | |
352 | extra_link_args = lflags, | |
353 | ) | |
354 | wxpExtensions.append(ext) | |
355 | ||
356 | ||
357 | # Extension for the calendar module | |
358 | swig_sources = run_swig(['calendar.i'], 'src', GENDIR, PKGDIR, | |
359 | USE_SWIG, swig_force, swig_args, swig_deps) | |
360 | ext = Extension('calendarc', swig_sources, | |
361 | include_dirs = includes, | |
362 | define_macros = defines, | |
363 | library_dirs = libdirs, | |
364 | libraries = libs, | |
365 | extra_compile_args = cflags, | |
366 | extra_link_args = lflags, | |
367 | ) | |
368 | wxpExtensions.append(ext) | |
369 | ||
370 | ||
371 | #---------------------------------------------------------------------- | |
372 | # Define the GLCanvas extension module | |
373 | #---------------------------------------------------------------------- | |
374 | ||
375 | if BUILD_GLCANVAS or GL_ONLY: | |
376 | print 'Preparing GLCANVAS...' | |
377 | location = 'contrib/glcanvas' | |
378 | swig_files = ['glcanvas.i'] | |
379 | other_sources = [] | |
380 | ||
381 | swig_sources = run_swig(swig_files, location, GENDIR, PKGDIR, | |
382 | USE_SWIG, swig_force, swig_args) | |
383 | ||
384 | gl_libs = [] | |
385 | if os.name == 'posix': | |
386 | if '-D__WXDEBUG__' in cflags: | |
387 | gl_libs = ['wx_gtkd_gl', 'GL', 'GLU'] | |
388 | else: | |
389 | gl_libs = ['wx_gtk_gl', 'GL', 'GLU'] | |
390 | else: | |
391 | other_sources = [location + '/msw/myglcanvas.cpp'] | |
392 | gl_libs = ['opengl32', 'glu32'] | |
393 | ||
394 | ||
395 | ext = Extension('glcanvasc', | |
396 | swig_sources + other_sources, | |
397 | ||
398 | include_dirs = includes, | |
399 | define_macros = defines, | |
400 | ||
401 | library_dirs = libdirs, | |
402 | libraries = libs + gl_libs, | |
403 | ||
404 | extra_compile_args = cflags, | |
405 | extra_link_args = lflags, | |
406 | ) | |
407 | ||
408 | wxpExtensions.append(ext) | |
409 | ||
410 | ||
411 | #---------------------------------------------------------------------- | |
412 | # Define the OGL extension module | |
413 | #---------------------------------------------------------------------- | |
414 | ||
415 | if not GL_ONLY and BUILD_OGL: | |
416 | print 'Preparing OGL...' | |
417 | location = 'contrib/ogl' | |
418 | OGLLOC = location + '/contrib/src/ogl' | |
419 | OGLINC = location + '/contrib/include' | |
420 | ||
421 | swig_files = ['ogl.i', 'oglbasic.i', 'oglshapes.i', 'oglshapes2.i', | |
422 | 'oglcanvas.i'] | |
423 | ||
424 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
425 | USE_SWIG, swig_force, swig_args) | |
426 | ||
427 | # make sure local copy of contrib files are up to date | |
428 | if IN_CVS_TREE: | |
429 | contrib_copy_tree(WXDIR + '/contrib/include/wx/ogl', OGLINC+'/wx/ogl') | |
430 | contrib_copy_tree(WXDIR + '/contrib/src/ogl', OGLLOC) | |
431 | ||
432 | ext = Extension('oglc', ['%s/basic.cpp' % OGLLOC, | |
433 | '%s/bmpshape.cpp' % OGLLOC, | |
434 | '%s/composit.cpp' % OGLLOC, | |
435 | '%s/divided.cpp' % OGLLOC, | |
436 | '%s/lines.cpp' % OGLLOC, | |
437 | '%s/misc.cpp' % OGLLOC, | |
438 | '%s/basic2.cpp' % OGLLOC, | |
439 | '%s/canvas.cpp' % OGLLOC, | |
440 | '%s/constrnt.cpp' % OGLLOC, | |
441 | '%s/drawn.cpp' % OGLLOC, | |
442 | '%s/mfutils.cpp' % OGLLOC, | |
443 | '%s/ogldiag.cpp' % OGLLOC, | |
444 | ] + swig_sources, | |
445 | ||
446 | include_dirs = [OGLINC] + includes, | |
447 | define_macros = defines, | |
448 | ||
449 | library_dirs = libdirs, | |
450 | libraries = libs, | |
451 | ||
452 | extra_compile_args = cflags, | |
453 | extra_link_args = lflags, | |
454 | ) | |
455 | ||
456 | wxpExtensions.append(ext) | |
457 | ||
458 | ||
459 | ||
460 | #---------------------------------------------------------------------- | |
461 | # Define the STC extension module | |
462 | #---------------------------------------------------------------------- | |
463 | ||
464 | if not GL_ONLY and BUILD_STC: | |
465 | print 'Preparing STC...' | |
466 | location = 'contrib/stc' | |
467 | STCLOC = location + '/contrib/src/stc' | |
468 | STCINC = location + '/contrib/include' | |
469 | STC_H = location + '/contrib/include/wx/stc' | |
470 | ||
471 | # make sure local copy of contrib files are up to date | |
472 | if IN_CVS_TREE: | |
473 | contrib_copy_tree(WXDIR + '/contrib/include/wx/stc', STCINC+'/wx/stc') | |
474 | contrib_copy_tree(WXDIR + '/contrib/src/stc', STCLOC) | |
475 | ||
476 | ||
477 | swig_files = ['stc_.i'] | |
478 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
479 | USE_SWIG, swig_force, | |
480 | swig_args + ['-I'+STC_H, '-I'+location], | |
481 | [STC_H+'/stc.h']) | |
482 | ||
483 | # copy a project specific py module to the main package dir | |
484 | copy_file(location+'/stc.py', PKGDIR, update=1, verbose=1) | |
485 | ||
486 | # add some include dirs to the standard set | |
487 | stc_includes = includes[:] | |
488 | stc_includes.append('%s/scintilla/include' % STCLOC) | |
489 | stc_includes.append('%s/scintilla/src' % STCLOC) | |
490 | stc_includes.append(STCINC) | |
491 | ||
492 | # and some macro definitions | |
493 | stc_defines = defines[:] | |
494 | stc_defines.append( ('__WX__', None) ) | |
495 | stc_defines.append( ('SCI_LEXER', None) ) | |
496 | ||
497 | ||
498 | ext = Extension('stc_c', | |
499 | ['%s/scintilla/src/AutoComplete.cxx' % STCLOC, | |
500 | '%s/scintilla/src/CallTip.cxx' % STCLOC, | |
501 | '%s/scintilla/src/CellBuffer.cxx' % STCLOC, | |
502 | '%s/scintilla/src/ContractionState.cxx' % STCLOC, | |
503 | '%s/scintilla/src/Document.cxx' % STCLOC, | |
504 | '%s/scintilla/src/Editor.cxx' % STCLOC, | |
505 | '%s/scintilla/src/Indicator.cxx' % STCLOC, | |
506 | '%s/scintilla/src/KeyMap.cxx' % STCLOC, | |
507 | '%s/scintilla/src/KeyWords.cxx' % STCLOC, | |
508 | '%s/scintilla/src/LineMarker.cxx' % STCLOC, | |
509 | '%s/scintilla/src/PropSet.cxx' % STCLOC, | |
510 | '%s/scintilla/src/ScintillaBase.cxx' % STCLOC, | |
511 | '%s/scintilla/src/Style.cxx' % STCLOC, | |
512 | '%s/scintilla/src/ViewStyle.cxx' % STCLOC, | |
513 | '%s/scintilla/src/LexCPP.cxx' % STCLOC, | |
514 | '%s/scintilla/src/LexHTML.cxx' % STCLOC, | |
515 | '%s/scintilla/src/LexLua.cxx' % STCLOC, | |
516 | '%s/scintilla/src/LexOthers.cxx' % STCLOC, | |
517 | '%s/scintilla/src/LexPerl.cxx' % STCLOC, | |
518 | '%s/scintilla/src/LexPython.cxx' % STCLOC, | |
519 | '%s/scintilla/src/LexSQL.cxx' % STCLOC, | |
520 | '%s/scintilla/src/LexVB.cxx' % STCLOC, | |
521 | '%s/scintilla/src/DocumentAccessor.cxx' % STCLOC, | |
522 | '%s/scintilla/src/UniConversion.cxx' % STCLOC, | |
523 | '%s/scintilla/src/WindowAccessor.cxx' % STCLOC, | |
524 | '%s/scintilla/src/PosRegExp.cxx' % STCLOC, | |
525 | ||
526 | '%s/PlatWX.cpp' % STCLOC, | |
527 | '%s/ScintillaWX.cpp' % STCLOC, | |
528 | '%s/stc.cpp' % STCLOC, | |
529 | ] + swig_sources, | |
530 | ||
531 | include_dirs = stc_includes, | |
532 | define_macros = stc_defines, | |
533 | ||
534 | library_dirs = libdirs, | |
535 | libraries = libs, | |
536 | ||
537 | extra_compile_args = cflags, | |
538 | extra_link_args = lflags, | |
539 | ) | |
540 | ||
541 | wxpExtensions.append(ext) | |
542 | ||
543 | ||
544 | ||
545 | #---------------------------------------------------------------------- | |
546 | # Define the IEWIN extension module (experimental) | |
547 | #---------------------------------------------------------------------- | |
548 | ||
549 | if not GL_ONLY and BUILD_IEWIN: | |
550 | print 'Preparing IEWIN...' | |
551 | location = 'contrib/iewin' | |
552 | ||
553 | swig_files = ['iewin.i', ] | |
554 | ||
555 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
556 | USE_SWIG, swig_force, swig_args) | |
557 | ||
558 | ||
559 | ext = Extension('iewinc', ['%s/IEHtmlWin.cpp' % location, | |
560 | ] + swig_sources, | |
561 | ||
562 | include_dirs = includes, | |
563 | define_macros = defines, | |
564 | ||
565 | library_dirs = libdirs, | |
566 | libraries = libs, | |
567 | ||
568 | extra_compile_args = cflags, | |
569 | extra_link_args = lflags, | |
570 | ) | |
571 | ||
572 | wxpExtensions.append(ext) | |
573 | ||
574 | ||
575 | #---------------------------------------------------------------------- | |
576 | # Define the XRC extension module | |
577 | #---------------------------------------------------------------------- | |
578 | ||
579 | if not GL_ONLY and BUILD_XRC: | |
580 | print 'Preparing XRC...' | |
581 | location = 'contrib/xrc' | |
582 | XMLLOC = location + '/contrib/src/xrc' | |
583 | XMLINC = location + '/contrib/include' | |
584 | ||
585 | swig_files = ['xrc.i'] | |
586 | ||
587 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
588 | USE_SWIG, swig_force, swig_args) | |
589 | ||
590 | xmlres_includes = includes[:] | |
591 | xmlres_includes.append('%s/expat/xmlparse' % XMLLOC) | |
592 | xmlres_includes.append('%s/expat/xmltok' % XMLLOC) | |
593 | xmlres_includes.append(XMLINC) | |
594 | ||
595 | ||
596 | # make sure local copy of contrib files are up to date | |
597 | if IN_CVS_TREE: | |
598 | contrib_copy_tree(WXDIR + '/contrib/include/wx/xrc', XMLINC+'/wx/xrc') | |
599 | contrib_copy_tree(WXDIR + '/contrib/src/xrc', XMLLOC) | |
600 | ||
601 | ext = Extension('xrcc', ['%s/expat/xmlparse/xmlparse.c' % XMLLOC, | |
602 | '%s/expat/xmltok/xmlrole.c' % XMLLOC, | |
603 | '%s/expat/xmltok/xmltok.c' % XMLLOC, | |
604 | ||
605 | '%s/xh_bmp.cpp' % XMLLOC, | |
606 | '%s/xh_bmpbt.cpp' % XMLLOC, | |
607 | '%s/xh_bttn.cpp' % XMLLOC, | |
608 | '%s/xh_cald.cpp' % XMLLOC, | |
609 | '%s/xh_chckb.cpp' % XMLLOC, | |
610 | ||
611 | '%s/xh_chckl.cpp' % XMLLOC, | |
612 | '%s/xh_choic.cpp' % XMLLOC, | |
613 | '%s/xh_combo.cpp' % XMLLOC, | |
614 | '%s/xh_dlg.cpp' % XMLLOC, | |
615 | '%s/xh_frame.cpp' % XMLLOC, | |
616 | ||
617 | '%s/xh_gauge.cpp' % XMLLOC, | |
618 | '%s/xh_html.cpp' % XMLLOC, | |
619 | '%s/xh_listb.cpp' % XMLLOC, | |
620 | '%s/xh_listc.cpp' % XMLLOC, | |
621 | '%s/xh_menu.cpp' % XMLLOC, | |
622 | ||
623 | '%s/xh_notbk.cpp' % XMLLOC, | |
624 | '%s/xh_panel.cpp' % XMLLOC, | |
625 | '%s/xh_radbt.cpp' % XMLLOC, | |
626 | '%s/xh_radbx.cpp' % XMLLOC, | |
627 | '%s/xh_scrol.cpp' % XMLLOC, | |
628 | ||
629 | '%s/xh_sizer.cpp' % XMLLOC, | |
630 | '%s/xh_slidr.cpp' % XMLLOC, | |
631 | '%s/xh_spin.cpp' % XMLLOC, | |
632 | '%s/xh_stbmp.cpp' % XMLLOC, | |
633 | '%s/xh_stbox.cpp' % XMLLOC, | |
634 | ||
635 | '%s/xh_stlin.cpp' % XMLLOC, | |
636 | '%s/xh_sttxt.cpp' % XMLLOC, | |
637 | '%s/xh_text.cpp' % XMLLOC, | |
638 | '%s/xh_toolb.cpp' % XMLLOC, | |
639 | '%s/xh_tree.cpp' % XMLLOC, | |
640 | ||
641 | '%s/xh_unkwn.cpp' % XMLLOC, | |
642 | '%s/xml.cpp' % XMLLOC, | |
643 | '%s/xmlbin.cpp' % XMLLOC, | |
644 | '%s/xmlbinz.cpp' % XMLLOC, | |
645 | '%s/xmlexpat.cpp' % XMLLOC, | |
646 | ||
647 | '%s/xmlres.cpp' % XMLLOC, | |
648 | '%s/xmlrsall.cpp' % XMLLOC, | |
649 | '%s/xmlwrite.cpp' % XMLLOC, | |
650 | ||
651 | ] + swig_sources, | |
652 | ||
653 | include_dirs = xmlres_includes, | |
654 | define_macros = defines, | |
655 | ||
656 | library_dirs = libdirs, | |
657 | libraries = libs, | |
658 | ||
659 | extra_compile_args = cflags, | |
660 | extra_link_args = lflags, | |
661 | ) | |
662 | ||
663 | wxpExtensions.append(ext) | |
664 | ||
665 | ||
666 | ||
667 | ||
668 | #---------------------------------------------------------------------- | |
669 | # Do the Setup/Build/Install/Whatever | |
670 | #---------------------------------------------------------------------- | |
671 | ||
672 | if __name__ == "__main__": | |
673 | if not GL_ONLY: | |
674 | setup(name = PKGDIR, | |
675 | version = VERSION, | |
676 | description = DESCRIPTION, | |
677 | long_description = LONG_DESCRIPTION, | |
678 | author = AUTHOR, | |
679 | author_email = AUTHOR_EMAIL, | |
680 | url = URL, | |
681 | licence = LICENCE, | |
682 | ||
683 | packages = [PKGDIR, | |
684 | PKGDIR+'.lib', | |
685 | PKGDIR+'.lib.editor', | |
686 | ], | |
687 | ||
688 | ext_package = PKGDIR, | |
689 | ext_modules = wxpExtensions, | |
690 | ) | |
691 | ||
692 | else: | |
693 | ||
694 | setup(name = "wxPython-gl", | |
695 | version = VERSION, | |
696 | description = "wxGLCanvas class for wxPython", | |
697 | author = AUTHOR, | |
698 | author_email = AUTHOR_EMAIL, | |
699 | url = URL, | |
700 | licence = LICENCE, | |
701 | ||
702 | py_modules = [ "wxPython.glcanvas" ], | |
703 | ||
704 | ext_package = PKGDIR, | |
705 | ext_modules = wxpExtensions, | |
706 | ) | |
707 | ||
708 | ||
709 | ||
710 | ||
711 | #---------------------------------------------------------------------- | |
712 | #---------------------------------------------------------------------- |