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