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