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