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