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