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