]>
Commit | Line | Data |
---|---|---|
c368d904 RD |
1 | #!/usr/bin/env python |
2 | #---------------------------------------------------------------------- | |
3 | ||
8916d007 | 4 | import sys, os, string, glob |
c368d904 RD |
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 | ||
ce914f73 | 16 | VERSION = "2.3.3rc" |
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 | ||
d4539c1a | 71 | WXDLLVER = '233' # 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 | |
ad07d019 RD |
221 | cflags = [ |
222 | # '/GX-' # workaround for internal compiler error in MSVC on some machines | |
223 | ] | |
c368d904 RD |
224 | lflags = None |
225 | ||
22d08289 RD |
226 | |
227 | if bcpp_compiling: # overwrite it | |
dbd3685c | 228 | cflags = ['-5', '-VF', ### To support MSVC spurious semicolons in the class scope |
22d08289 | 229 | ### else, all semicolons at the end of all DECLARE_...CALLBACK... macros must be eliminated |
55c020cf RD |
230 | '-Hc', '-H=' + opj(WXDIR, '\src\msw\wx32.csm'), |
231 | '@' + opj(WXDIR, '\src\msw\wxwin32.cfg') | |
22d08289 RD |
232 | ] |
233 | ||
234 | ||
235 | if not FINAL and HYBRID and not bcpp_compiling: | |
e7d63784 RD |
236 | cflags = cflags + ['/Od', '/Z7'] |
237 | lflags = ['/DEBUG', ] | |
c368d904 | 238 | |
22d08289 RD |
239 | elif bcpp_compiling and not FINAL: |
240 | cflags = cflags + ['/Od', '/v', '/y'] | |
241 | lflags = lflags + ['/v', ] ## '/PDB:NONE'] | |
242 | ||
243 | ||
c368d904 | 244 | |
dbd3685c | 245 | elif os.name == 'posix' and sys.platform[:6] == "darwin": |
e6056257 RD |
246 | # Flags and such for a Darwin (Max OS X) build of Python |
247 | ||
248 | WXDIR = '..' # assumes IN_CVS_TREE | |
249 | WXPLAT = '__WXMAC__' | |
250 | GENDIR = 'mac' | |
251 | ||
252 | includes = ['src'] | |
253 | defines = [('SWIG_GLOBAL', None), | |
254 | ('HAVE_CONFIG_H', None), | |
255 | ('WXP_USE_THREAD', '1'), | |
256 | ] | |
257 | libdirs = [] | |
258 | libs = [] | |
259 | ||
260 | cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1] | |
261 | cflags = string.split(cflags) | |
262 | ||
263 | lflags = os.popen(WX_CONFIG + ' --libs', 'r').read()[:-1] | |
264 | lflags = string.split(lflags) | |
265 | ||
266 | ||
267 | ||
c368d904 RD |
268 | elif os.name == 'posix': |
269 | # Set flags for Unix type platforms | |
270 | ||
271 | WXDIR = '..' # assumes IN_CVS_TREE | |
272 | WXPLAT = '__WXGTK__' # and assumes GTK... | |
273 | GENDIR = 'gtk' # Need to allow for Motif eventually too | |
274 | ||
275 | includes = ['src'] | |
276 | defines = [('SWIG_GLOBAL', None), | |
277 | ('HAVE_CONFIG_H', None), | |
278 | ('WXP_USE_THREAD', '1'), | |
279 | ] | |
280 | libdirs = [] | |
281 | libs = [] | |
282 | ||
e8bf92fd | 283 | cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1] + ' ' + \ |
c368d904 RD |
284 | os.popen('gtk-config --cflags', 'r').read()[:-1] |
285 | cflags = string.split(cflags) | |
286 | ||
afa3e1ed | 287 | lflags = os.popen(WX_CONFIG + ' --libs', 'r').read()[:-1] |
c368d904 RD |
288 | lflags = string.split(lflags) |
289 | ||
290 | ||
291 | else: | |
292 | raise 'Sorry Charlie...' | |
293 | ||
294 | ||
295 | #---------------------------------------------------------------------- | |
296 | # Check if the version file needs updated | |
297 | #---------------------------------------------------------------------- | |
298 | ||
299 | if IN_CVS_TREE and newer('setup.py', 'src/__version__.py'): | |
300 | open('src/__version__.py', 'w').write("ver = '%s'\n" % VERSION) | |
301 | ||
1b62f00d RD |
302 | |
303 | ||
c368d904 | 304 | #---------------------------------------------------------------------- |
1b62f00d | 305 | # SWIG defaults |
c368d904 RD |
306 | #---------------------------------------------------------------------- |
307 | ||
c368d904 | 308 | swig_force = force |
00b6c4e3 RD |
309 | swig_args = ['-c++', '-shadow', '-python', '-keyword', |
310 | '-dnone', | |
311 | #'-dascii', | |
312 | #'-docstring', '-Sbefore', | |
e6056257 RD |
313 | '-I./src', '-D'+WXPLAT, |
314 | ] | |
185d7c3e | 315 | swig_deps = ['src/my_typemaps.i'] |
c368d904 | 316 | |
c368d904 | 317 | |
1b62f00d RD |
318 | #---------------------------------------------------------------------- |
319 | # Define the CORE extension module | |
320 | #---------------------------------------------------------------------- | |
321 | ||
322 | if not GL_ONLY: | |
cfe766c3 | 323 | msg('Preparing CORE...') |
1b62f00d RD |
324 | swig_files = [ 'wx.i', 'windows.i', 'windows2.i', 'windows3.i', 'events.i', |
325 | 'misc.i', 'misc2.i', 'gdi.i', 'mdi.i', 'controls.i', | |
326 | 'controls2.i', 'cmndlgs.i', 'stattool.i', 'frames.i', 'image.i', | |
327 | 'printfw.i', 'sizers.i', 'clip_dnd.i', | |
96e5ef76 | 328 | 'filesys.i', 'streams.i', 'utils.i' |
1b62f00d | 329 | ] |
c368d904 | 330 | |
1b62f00d RD |
331 | swig_sources = run_swig(swig_files, 'src', GENDIR, PKGDIR, |
332 | USE_SWIG, swig_force, swig_args, swig_deps) | |
c368d904 | 333 | |
1b62f00d RD |
334 | copy_file('src/__init__.py', PKGDIR, update=1, verbose=0) |
335 | copy_file('src/__version__.py', PKGDIR, update=1, verbose=0) | |
c368d904 | 336 | |
c368d904 | 337 | |
1b62f00d RD |
338 | if IN_CVS_TREE: # update the licence files |
339 | mkpath('licence') | |
340 | for file in ['preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt']: | |
55c020cf | 341 | copy_file(opj(WXDIR, 'docs', file), opj('licence',file), update=1, verbose=0) |
c368d904 | 342 | |
1b62f00d RD |
343 | |
344 | if os.name == 'nt': | |
345 | rc_file = ['src/wxc.rc'] | |
346 | else: | |
347 | rc_file = [] | |
348 | ||
349 | ||
350 | ext = Extension('wxc', ['src/helpers.cpp', | |
351 | 'src/libpy.c', | |
352 | ] + rc_file + swig_sources, | |
353 | ||
354 | include_dirs = includes, | |
355 | define_macros = defines, | |
356 | ||
357 | library_dirs = libdirs, | |
358 | libraries = libs, | |
359 | ||
360 | extra_compile_args = cflags, | |
361 | extra_link_args = lflags, | |
362 | ) | |
363 | wxpExtensions.append(ext) | |
364 | ||
365 | ||
366 | # Extension for the grid module | |
367 | swig_sources = run_swig(['grid.i'], 'src', GENDIR, PKGDIR, | |
368 | USE_SWIG, swig_force, swig_args, swig_deps) | |
369 | ext = Extension('gridc', swig_sources, | |
370 | include_dirs = includes, | |
371 | define_macros = defines, | |
372 | library_dirs = libdirs, | |
373 | libraries = libs, | |
374 | extra_compile_args = cflags, | |
375 | extra_link_args = lflags, | |
376 | ) | |
377 | wxpExtensions.append(ext) | |
378 | ||
379 | ||
380 | # Extension for the html modules | |
381 | swig_sources = run_swig(['html.i', 'htmlhelp.i'], 'src', GENDIR, PKGDIR, | |
382 | USE_SWIG, swig_force, swig_args, swig_deps) | |
383 | ext = Extension('htmlc', swig_sources, | |
384 | include_dirs = includes, | |
385 | define_macros = defines, | |
386 | library_dirs = libdirs, | |
1b62f00d RD |
387 | libraries = libs, |
388 | extra_compile_args = cflags, | |
389 | extra_link_args = lflags, | |
390 | ) | |
391 | wxpExtensions.append(ext) | |
392 | ||
393 | ||
394 | # Extension for the calendar module | |
395 | swig_sources = run_swig(['calendar.i'], 'src', GENDIR, PKGDIR, | |
396 | USE_SWIG, swig_force, swig_args, swig_deps) | |
397 | ext = Extension('calendarc', swig_sources, | |
398 | include_dirs = includes, | |
399 | define_macros = defines, | |
400 | library_dirs = libdirs, | |
401 | libraries = libs, | |
402 | extra_compile_args = cflags, | |
403 | extra_link_args = lflags, | |
404 | ) | |
405 | wxpExtensions.append(ext) | |
c368d904 | 406 | |
c368d904 | 407 | |
4f3449b4 RD |
408 | # Extension for the help module |
409 | swig_sources = run_swig(['help.i'], 'src', GENDIR, PKGDIR, | |
410 | USE_SWIG, swig_force, swig_args, swig_deps) | |
411 | ext = Extension('helpc', swig_sources, | |
412 | include_dirs = includes, | |
413 | define_macros = defines, | |
414 | library_dirs = libdirs, | |
415 | libraries = libs, | |
416 | extra_compile_args = cflags, | |
417 | extra_link_args = lflags, | |
418 | ) | |
419 | wxpExtensions.append(ext) | |
420 | ||
421 | ||
c368d904 RD |
422 | #---------------------------------------------------------------------- |
423 | # Define the GLCanvas extension module | |
424 | #---------------------------------------------------------------------- | |
425 | ||
55c020cf RD |
426 | CTRB_SRC = opj(WXDIR, 'contrib/src') |
427 | CTRB_INC = opj(WXDIR, 'contrib/include/wx') | |
428 | ||
1b62f00d | 429 | if BUILD_GLCANVAS or GL_ONLY: |
cfe766c3 | 430 | msg('Preparing GLCANVAS...') |
c368d904 RD |
431 | location = 'contrib/glcanvas' |
432 | swig_files = ['glcanvas.i'] | |
19cf4f80 | 433 | other_sources = [] |
c368d904 RD |
434 | |
435 | swig_sources = run_swig(swig_files, location, GENDIR, PKGDIR, | |
1e7ecb7b | 436 | USE_SWIG, swig_force, swig_args) |
c368d904 RD |
437 | |
438 | gl_libs = [] | |
439 | if os.name == 'posix': | |
f32afe1c RD |
440 | gl_config = os.popen(WX_CONFIG + ' --gl-libs', 'r').read()[:-1] |
441 | gl_lflags = string.split(gl_config) + lflags | |
442 | gl_libs = libs | |
19cf4f80 | 443 | else: |
55c020cf | 444 | other_sources = [opj(location, 'msw/myglcanvas.cpp')] |
f32afe1c RD |
445 | gl_libs = libs + ['opengl32', 'glu32'] |
446 | gl_lflags = lflags | |
c368d904 | 447 | |
1e7ecb7b | 448 | ext = Extension('glcanvasc', |
19cf4f80 | 449 | swig_sources + other_sources, |
1e7ecb7b RD |
450 | |
451 | include_dirs = includes, | |
452 | define_macros = defines, | |
453 | ||
454 | library_dirs = libdirs, | |
f32afe1c | 455 | libraries = gl_libs, |
1e7ecb7b RD |
456 | |
457 | extra_compile_args = cflags, | |
f32afe1c | 458 | extra_link_args = gl_lflags, |
1e7ecb7b RD |
459 | ) |
460 | ||
461 | wxpExtensions.append(ext) | |
c368d904 RD |
462 | |
463 | ||
464 | #---------------------------------------------------------------------- | |
465 | # Define the OGL extension module | |
466 | #---------------------------------------------------------------------- | |
467 | ||
1b62f00d | 468 | if not GL_ONLY and BUILD_OGL: |
cfe766c3 | 469 | msg('Preparing OGL...') |
c368d904 | 470 | location = 'contrib/ogl' |
55c020cf RD |
471 | OGLLOC = opj(location, 'contrib/src/ogl') |
472 | OGLINC = opj(location, 'contrib/include') | |
c368d904 RD |
473 | |
474 | swig_files = ['ogl.i', 'oglbasic.i', 'oglshapes.i', 'oglshapes2.i', | |
475 | 'oglcanvas.i'] | |
476 | ||
477 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
1e7ecb7b | 478 | USE_SWIG, swig_force, swig_args) |
c368d904 | 479 | |
c368d904 | 480 | if IN_CVS_TREE: |
55c020cf RD |
481 | # make sure local copy of contrib files are up to date |
482 | contrib_copy_tree(opj(CTRB_INC, 'ogl'), opj(OGLINC, 'wx/ogl')) | |
483 | contrib_copy_tree(opj(CTRB_SRC, 'ogl'), OGLLOC) | |
c368d904 | 484 | |
1e7ecb7b RD |
485 | ext = Extension('oglc', ['%s/basic.cpp' % OGLLOC, |
486 | '%s/bmpshape.cpp' % OGLLOC, | |
487 | '%s/composit.cpp' % OGLLOC, | |
488 | '%s/divided.cpp' % OGLLOC, | |
489 | '%s/lines.cpp' % OGLLOC, | |
490 | '%s/misc.cpp' % OGLLOC, | |
491 | '%s/basic2.cpp' % OGLLOC, | |
492 | '%s/canvas.cpp' % OGLLOC, | |
493 | '%s/constrnt.cpp' % OGLLOC, | |
494 | '%s/drawn.cpp' % OGLLOC, | |
495 | '%s/mfutils.cpp' % OGLLOC, | |
496 | '%s/ogldiag.cpp' % OGLLOC, | |
497 | ] + swig_sources, | |
498 | ||
499 | include_dirs = [OGLINC] + includes, | |
500 | define_macros = defines, | |
501 | ||
502 | library_dirs = libdirs, | |
503 | libraries = libs, | |
504 | ||
505 | extra_compile_args = cflags, | |
506 | extra_link_args = lflags, | |
507 | ) | |
508 | ||
509 | wxpExtensions.append(ext) | |
510 | ||
511 | ||
c368d904 RD |
512 | |
513 | #---------------------------------------------------------------------- | |
514 | # Define the STC extension module | |
515 | #---------------------------------------------------------------------- | |
516 | ||
1b62f00d | 517 | if not GL_ONLY and BUILD_STC: |
cfe766c3 | 518 | msg('Preparing STC...') |
c368d904 | 519 | location = 'contrib/stc' |
55c020cf RD |
520 | STCLOC = opj(location, 'contrib/src/stc') |
521 | STCINC = opj(location, 'contrib/include') | |
522 | STC_H = opj(location, 'contrib/include/wx/stc') | |
c368d904 | 523 | |
c368d904 | 524 | if IN_CVS_TREE: |
55c020cf RD |
525 | # Check if gen_iface needs to be run for the wxSTC sources |
526 | if (newer(opj(CTRB_SRC, 'stc/stc.h.in'), opj(CTRB_INC, 'stc/stc.h' )) or | |
527 | newer(opj(CTRB_SRC, 'stc/stc.cpp.in'), opj(CTRB_SRC, 'stc/stc.cpp')) or | |
528 | newer(opj(CTRB_SRC, 'stc/gen_iface.py'), opj(CTRB_SRC, 'stc/stc.cpp'))): | |
529 | ||
530 | msg('Running gen_iface.py, regenerating stc.h and stc.cpp...') | |
531 | cwd = os.getcwd() | |
532 | os.chdir(opj(CTRB_SRC, 'stc')) | |
533 | import gen_iface | |
534 | gen_iface.main([]) | |
535 | os.chdir(cwd) | |
536 | ||
537 | ||
538 | # make sure local copy of contrib files are up to date | |
539 | contrib_copy_tree(opj(CTRB_INC, 'stc'), opj(STCINC, 'wx/stc')) | |
540 | contrib_copy_tree(opj(CTRB_SRC, 'stc'), STCLOC) | |
541 | ||
c368d904 RD |
542 | |
543 | ||
544 | swig_files = ['stc_.i'] | |
74933d75 | 545 | swig_sources = run_swig(swig_files, location, GENDIR, PKGDIR, |
c368d904 RD |
546 | USE_SWIG, swig_force, |
547 | swig_args + ['-I'+STC_H, '-I'+location], | |
55c020cf | 548 | [opj(STC_H, 'stc.h')]) |
c368d904 | 549 | |
4a61305d | 550 | # copy a contrib project specific py module to the main package dir |
55c020cf | 551 | copy_file(opj(location, 'stc.py'), PKGDIR, update=1, verbose=0) |
c368d904 RD |
552 | |
553 | # add some include dirs to the standard set | |
1e7ecb7b RD |
554 | stc_includes = includes[:] |
555 | stc_includes.append('%s/scintilla/include' % STCLOC) | |
556 | stc_includes.append('%s/scintilla/src' % STCLOC) | |
557 | stc_includes.append(STCINC) | |
c368d904 RD |
558 | |
559 | # and some macro definitions | |
1e7ecb7b RD |
560 | stc_defines = defines[:] |
561 | stc_defines.append( ('__WX__', None) ) | |
562 | stc_defines.append( ('SCI_LEXER', None) ) | |
c368d904 RD |
563 | |
564 | ||
1e7ecb7b RD |
565 | ext = Extension('stc_c', |
566 | ['%s/scintilla/src/AutoComplete.cxx' % STCLOC, | |
c368d904 RD |
567 | '%s/scintilla/src/CallTip.cxx' % STCLOC, |
568 | '%s/scintilla/src/CellBuffer.cxx' % STCLOC, | |
569 | '%s/scintilla/src/ContractionState.cxx' % STCLOC, | |
570 | '%s/scintilla/src/Document.cxx' % STCLOC, | |
55c020cf | 571 | '%s/scintilla/src/DocumentAccessor.cxx' % STCLOC, |
c368d904 RD |
572 | '%s/scintilla/src/Editor.cxx' % STCLOC, |
573 | '%s/scintilla/src/Indicator.cxx' % STCLOC, | |
574 | '%s/scintilla/src/KeyMap.cxx' % STCLOC, | |
575 | '%s/scintilla/src/KeyWords.cxx' % STCLOC, | |
576 | '%s/scintilla/src/LineMarker.cxx' % STCLOC, | |
577 | '%s/scintilla/src/PropSet.cxx' % STCLOC, | |
55c020cf | 578 | '%s/scintilla/src/RESearch.cxx' % STCLOC, |
c368d904 RD |
579 | '%s/scintilla/src/ScintillaBase.cxx' % STCLOC, |
580 | '%s/scintilla/src/Style.cxx' % STCLOC, | |
fe0aca37 | 581 | '%s/scintilla/src/StyleContext.cxx' % STCLOC, |
55c020cf | 582 | '%s/scintilla/src/UniConversion.cxx' % STCLOC, |
c368d904 | 583 | '%s/scintilla/src/ViewStyle.cxx' % STCLOC, |
55c020cf RD |
584 | '%s/scintilla/src/WindowAccessor.cxx' % STCLOC, |
585 | ||
586 | '%s/scintilla/src/LexAda.cxx' % STCLOC, | |
587 | '%s/scintilla/src/LexAVE.cxx' % STCLOC, | |
c368d904 | 588 | '%s/scintilla/src/LexCPP.cxx' % STCLOC, |
fe0aca37 RD |
589 | '%s/scintilla/src/LexConf.cxx' % STCLOC, |
590 | '%s/scintilla/src/LexCrontab.cxx' % STCLOC, | |
55c020cf | 591 | '%s/scintilla/src/LexEiffel.cxx' % STCLOC, |
c368d904 | 592 | '%s/scintilla/src/LexHTML.cxx' % STCLOC, |
55c020cf | 593 | '%s/scintilla/src/LexLisp.cxx' % STCLOC, |
c368d904 RD |
594 | '%s/scintilla/src/LexLua.cxx' % STCLOC, |
595 | '%s/scintilla/src/LexOthers.cxx' % STCLOC, | |
55c020cf | 596 | '%s/scintilla/src/LexPascal.cxx' % STCLOC, |
c368d904 RD |
597 | '%s/scintilla/src/LexPerl.cxx' % STCLOC, |
598 | '%s/scintilla/src/LexPython.cxx' % STCLOC, | |
55c020cf | 599 | '%s/scintilla/src/LexRuby.cxx' % STCLOC, |
c368d904 RD |
600 | '%s/scintilla/src/LexSQL.cxx' % STCLOC, |
601 | '%s/scintilla/src/LexVB.cxx' % STCLOC, | |
c368d904 RD |
602 | |
603 | '%s/PlatWX.cpp' % STCLOC, | |
604 | '%s/ScintillaWX.cpp' % STCLOC, | |
605 | '%s/stc.cpp' % STCLOC, | |
1e7ecb7b RD |
606 | ] + swig_sources, |
607 | ||
608 | include_dirs = stc_includes, | |
609 | define_macros = stc_defines, | |
610 | ||
611 | library_dirs = libdirs, | |
612 | libraries = libs, | |
c368d904 | 613 | |
1e7ecb7b RD |
614 | extra_compile_args = cflags, |
615 | extra_link_args = lflags, | |
616 | ) | |
617 | ||
618 | wxpExtensions.append(ext) | |
c368d904 RD |
619 | |
620 | ||
621 | ||
926bb76c RD |
622 | #---------------------------------------------------------------------- |
623 | # Define the IEWIN extension module (experimental) | |
624 | #---------------------------------------------------------------------- | |
625 | ||
626 | if not GL_ONLY and BUILD_IEWIN: | |
cfe766c3 | 627 | msg('Preparing IEWIN...') |
926bb76c RD |
628 | location = 'contrib/iewin' |
629 | ||
630 | swig_files = ['iewin.i', ] | |
631 | ||
632 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
633 | USE_SWIG, swig_force, swig_args) | |
634 | ||
635 | ||
636 | ext = Extension('iewinc', ['%s/IEHtmlWin.cpp' % location, | |
637 | ] + swig_sources, | |
638 | ||
639 | include_dirs = includes, | |
640 | define_macros = defines, | |
641 | ||
642 | library_dirs = libdirs, | |
643 | libraries = libs, | |
644 | ||
645 | extra_compile_args = cflags, | |
646 | extra_link_args = lflags, | |
647 | ) | |
648 | ||
649 | wxpExtensions.append(ext) | |
650 | ||
651 | ||
d56cebe7 RD |
652 | #---------------------------------------------------------------------- |
653 | # Define the XRC extension module | |
654 | #---------------------------------------------------------------------- | |
655 | ||
656 | if not GL_ONLY and BUILD_XRC: | |
cfe766c3 | 657 | msg('Preparing XRC...') |
d56cebe7 | 658 | location = 'contrib/xrc' |
55c020cf RD |
659 | XMLLOC = opj(location, 'contrib/src/xrc') |
660 | XMLINC = opj(location, 'contrib/include') | |
d56cebe7 RD |
661 | |
662 | swig_files = ['xrc.i'] | |
663 | ||
664 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
665 | USE_SWIG, swig_force, swig_args) | |
666 | ||
667 | xmlres_includes = includes[:] | |
668 | xmlres_includes.append('%s/expat/xmlparse' % XMLLOC) | |
669 | xmlres_includes.append('%s/expat/xmltok' % XMLLOC) | |
670 | xmlres_includes.append(XMLINC) | |
671 | ||
672 | ||
673 | # make sure local copy of contrib files are up to date | |
674 | if IN_CVS_TREE: | |
55c020cf RD |
675 | contrib_copy_tree(opj(CTRB_INC, 'xrc'), opj(XMLINC, 'wx/xrc')) |
676 | contrib_copy_tree(opj(CTRB_SRC, 'xrc'), XMLLOC) | |
d56cebe7 RD |
677 | |
678 | ext = Extension('xrcc', ['%s/expat/xmlparse/xmlparse.c' % XMLLOC, | |
679 | '%s/expat/xmltok/xmlrole.c' % XMLLOC, | |
680 | '%s/expat/xmltok/xmltok.c' % XMLLOC, | |
681 | ||
682 | '%s/xh_bmp.cpp' % XMLLOC, | |
683 | '%s/xh_bmpbt.cpp' % XMLLOC, | |
684 | '%s/xh_bttn.cpp' % XMLLOC, | |
685 | '%s/xh_cald.cpp' % XMLLOC, | |
686 | '%s/xh_chckb.cpp' % XMLLOC, | |
687 | ||
688 | '%s/xh_chckl.cpp' % XMLLOC, | |
689 | '%s/xh_choic.cpp' % XMLLOC, | |
690 | '%s/xh_combo.cpp' % XMLLOC, | |
691 | '%s/xh_dlg.cpp' % XMLLOC, | |
692 | '%s/xh_frame.cpp' % XMLLOC, | |
693 | ||
694 | '%s/xh_gauge.cpp' % XMLLOC, | |
6c5ae2d2 | 695 | '%s/xh_gdctl.cpp' % XMLLOC, |
d56cebe7 RD |
696 | '%s/xh_html.cpp' % XMLLOC, |
697 | '%s/xh_listb.cpp' % XMLLOC, | |
698 | '%s/xh_listc.cpp' % XMLLOC, | |
699 | '%s/xh_menu.cpp' % XMLLOC, | |
700 | ||
701 | '%s/xh_notbk.cpp' % XMLLOC, | |
702 | '%s/xh_panel.cpp' % XMLLOC, | |
703 | '%s/xh_radbt.cpp' % XMLLOC, | |
704 | '%s/xh_radbx.cpp' % XMLLOC, | |
705 | '%s/xh_scrol.cpp' % XMLLOC, | |
706 | ||
707 | '%s/xh_sizer.cpp' % XMLLOC, | |
708 | '%s/xh_slidr.cpp' % XMLLOC, | |
709 | '%s/xh_spin.cpp' % XMLLOC, | |
710 | '%s/xh_stbmp.cpp' % XMLLOC, | |
711 | '%s/xh_stbox.cpp' % XMLLOC, | |
712 | ||
713 | '%s/xh_stlin.cpp' % XMLLOC, | |
714 | '%s/xh_sttxt.cpp' % XMLLOC, | |
715 | '%s/xh_text.cpp' % XMLLOC, | |
716 | '%s/xh_toolb.cpp' % XMLLOC, | |
717 | '%s/xh_tree.cpp' % XMLLOC, | |
718 | ||
719 | '%s/xh_unkwn.cpp' % XMLLOC, | |
720 | '%s/xml.cpp' % XMLLOC, | |
d56cebe7 RD |
721 | '%s/xmlres.cpp' % XMLLOC, |
722 | '%s/xmlrsall.cpp' % XMLLOC, | |
d56cebe7 RD |
723 | |
724 | ] + swig_sources, | |
725 | ||
726 | include_dirs = xmlres_includes, | |
727 | define_macros = defines, | |
728 | ||
729 | library_dirs = libdirs, | |
730 | libraries = libs, | |
731 | ||
732 | extra_compile_args = cflags, | |
733 | extra_link_args = lflags, | |
734 | ) | |
735 | ||
736 | wxpExtensions.append(ext) | |
737 | ||
738 | ||
739 | ||
ebf4302c RD |
740 | #---------------------------------------------------------------------- |
741 | # Define the GIZMOS extension module | |
742 | #---------------------------------------------------------------------- | |
743 | ||
744 | if not GL_ONLY and BUILD_GIZMOS: | |
745 | msg('Preparing GIZMOS...') | |
746 | location = 'contrib/gizmos' | |
747 | GIZMOLOC = opj(location, 'contrib/src/gizmos') | |
748 | GIZMOINC = opj(location, 'contrib/include') | |
749 | ||
750 | swig_files = ['gizmos.i'] | |
751 | ||
752 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
753 | USE_SWIG, swig_force, swig_args) | |
754 | ||
755 | gizmos_includes = includes[:] | |
756 | gizmos_includes.append(GIZMOINC) | |
757 | ||
758 | ||
759 | # make sure local copy of contrib files are up to date | |
760 | if IN_CVS_TREE: | |
761 | contrib_copy_tree(opj(CTRB_INC, 'gizmos'), opj(GIZMOINC, 'wx/gizmos')) | |
762 | contrib_copy_tree(opj(CTRB_SRC, 'gizmos'), GIZMOLOC) | |
763 | ||
764 | ext = Extension('gizmosc', [ | |
765 | '%s/dynamicsash.cpp' % GIZMOLOC, | |
2f4e9287 | 766 | '%s/editlbox.cpp' % GIZMOLOC, |
950e7faf | 767 | #'%s/multicell.cpp' % GIZMOLOC, |
ebf4302c | 768 | '%s/splittree.cpp' % GIZMOLOC, |
950e7faf | 769 | '%s/ledctrl.cpp' % GIZMOLOC, |
ebf4302c RD |
770 | ] + swig_sources, |
771 | ||
772 | include_dirs = gizmos_includes, | |
773 | define_macros = defines, | |
774 | ||
775 | library_dirs = libdirs, | |
776 | libraries = libs, | |
777 | ||
778 | extra_compile_args = cflags, | |
779 | extra_link_args = lflags, | |
780 | ) | |
781 | ||
782 | wxpExtensions.append(ext) | |
783 | ||
784 | ||
785 | ||
4a61305d RD |
786 | #---------------------------------------------------------------------- |
787 | # Define the DLLWIDGET extension module | |
788 | #---------------------------------------------------------------------- | |
789 | ||
790 | if not GL_ONLY and BUILD_DLLWIDGET: | |
791 | msg('Preparing DLLWIDGET...') | |
792 | location = 'contrib/dllwidget' | |
793 | swig_files = ['dllwidget_.i'] | |
794 | ||
795 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
796 | USE_SWIG, swig_force, swig_args) | |
797 | ||
798 | # copy a contrib project specific py module to the main package dir | |
799 | copy_file(opj(location, 'dllwidget.py'), PKGDIR, update=1, verbose=0) | |
800 | ||
801 | ext = Extension('dllwidget_c', [ | |
802 | '%s/dllwidget.cpp' % location, | |
803 | ] + swig_sources, | |
804 | ||
805 | include_dirs = includes, | |
806 | define_macros = defines, | |
807 | ||
808 | library_dirs = libdirs, | |
809 | libraries = libs, | |
810 | ||
811 | extra_compile_args = cflags, | |
812 | extra_link_args = lflags, | |
813 | ) | |
814 | ||
815 | wxpExtensions.append(ext) | |
816 | ||
817 | ||
8916d007 RD |
818 | #---------------------------------------------------------------------- |
819 | # Tools and scripts | |
820 | #---------------------------------------------------------------------- | |
821 | ||
822 | TOOLS = [("wxPython/tools", glob.glob("tools/*.py")), | |
823 | ("wxPython/tools/XRCed", glob.glob("tools/XRCed/*.py") + | |
824 | glob.glob("tools/XRCed/*.xrc") + | |
825 | ["tools/XRCed/CHANGES", | |
826 | "tools/XRCed/TODO", | |
827 | "tools/XRCed/README"]), | |
828 | ] | |
829 | ||
830 | ||
4a61305d | 831 | |
926bb76c | 832 | |
c368d904 RD |
833 | #---------------------------------------------------------------------- |
834 | # Do the Setup/Build/Install/Whatever | |
835 | #---------------------------------------------------------------------- | |
836 | ||
1b62f00d RD |
837 | if __name__ == "__main__": |
838 | if not GL_ONLY: | |
839 | setup(name = PKGDIR, | |
840 | version = VERSION, | |
841 | description = DESCRIPTION, | |
842 | long_description = LONG_DESCRIPTION, | |
843 | author = AUTHOR, | |
844 | author_email = AUTHOR_EMAIL, | |
845 | url = URL, | |
846 | licence = LICENCE, | |
847 | ||
848 | packages = [PKGDIR, | |
849 | PKGDIR+'.lib', | |
850 | PKGDIR+'.lib.editor', | |
2ba9346d RD |
851 | PKGDIR+'.lib.mixins', |
852 | PKGDIR+'.lib.PyCrust', | |
1b62f00d RD |
853 | ], |
854 | ||
855 | ext_package = PKGDIR, | |
856 | ext_modules = wxpExtensions, | |
8916d007 RD |
857 | |
858 | ##data_files = TOOLS, | |
1b62f00d | 859 | ) |
c368d904 | 860 | |
1b62f00d | 861 | else: |
c368d904 | 862 | |
1b62f00d RD |
863 | setup(name = "wxPython-gl", |
864 | version = VERSION, | |
865 | description = "wxGLCanvas class for wxPython", | |
866 | author = AUTHOR, | |
867 | author_email = AUTHOR_EMAIL, | |
868 | url = URL, | |
869 | licence = LICENCE, | |
c368d904 | 870 | |
1b62f00d | 871 | py_modules = [ "wxPython.glcanvas" ], |
c368d904 | 872 | |
1b62f00d RD |
873 | ext_package = PKGDIR, |
874 | ext_modules = wxpExtensions, | |
8916d007 | 875 | |
1b62f00d | 876 | ) |
c368d904 | 877 | |
c368d904 RD |
878 | |
879 | ||
880 | ||
881 | #---------------------------------------------------------------------- | |
882 | #---------------------------------------------------------------------- |