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