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