]>
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 | |
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', | |
96e5ef76 | 326 | 'filesys.i', 'streams.i', 'utils.i' |
1b62f00d | 327 | ] |
c368d904 | 328 | |
1b62f00d RD |
329 | swig_sources = run_swig(swig_files, 'src', GENDIR, PKGDIR, |
330 | USE_SWIG, swig_force, swig_args, swig_deps) | |
c368d904 | 331 | |
1b62f00d RD |
332 | copy_file('src/__init__.py', PKGDIR, update=1, verbose=0) |
333 | copy_file('src/__version__.py', PKGDIR, update=1, verbose=0) | |
c368d904 | 334 | |
c368d904 | 335 | |
1b62f00d RD |
336 | if IN_CVS_TREE: # update the licence files |
337 | mkpath('licence') | |
338 | for file in ['preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt']: | |
55c020cf | 339 | copy_file(opj(WXDIR, 'docs', file), opj('licence',file), update=1, verbose=0) |
c368d904 | 340 | |
1b62f00d RD |
341 | |
342 | if os.name == 'nt': | |
343 | rc_file = ['src/wxc.rc'] | |
344 | else: | |
345 | rc_file = [] | |
346 | ||
347 | ||
348 | ext = Extension('wxc', ['src/helpers.cpp', | |
349 | 'src/libpy.c', | |
350 | ] + rc_file + swig_sources, | |
351 | ||
352 | include_dirs = includes, | |
353 | define_macros = defines, | |
354 | ||
355 | library_dirs = libdirs, | |
356 | libraries = libs, | |
357 | ||
358 | extra_compile_args = cflags, | |
359 | extra_link_args = lflags, | |
360 | ) | |
361 | wxpExtensions.append(ext) | |
362 | ||
363 | ||
364 | # Extension for the grid module | |
365 | swig_sources = run_swig(['grid.i'], 'src', GENDIR, PKGDIR, | |
366 | USE_SWIG, swig_force, swig_args, swig_deps) | |
367 | ext = Extension('gridc', swig_sources, | |
368 | include_dirs = includes, | |
369 | define_macros = defines, | |
370 | library_dirs = libdirs, | |
371 | libraries = libs, | |
372 | extra_compile_args = cflags, | |
373 | extra_link_args = lflags, | |
374 | ) | |
375 | wxpExtensions.append(ext) | |
376 | ||
377 | ||
378 | # Extension for the html modules | |
379 | swig_sources = run_swig(['html.i', 'htmlhelp.i'], 'src', GENDIR, PKGDIR, | |
380 | USE_SWIG, swig_force, swig_args, swig_deps) | |
381 | ext = Extension('htmlc', swig_sources, | |
382 | include_dirs = includes, | |
383 | define_macros = defines, | |
384 | library_dirs = libdirs, | |
1b62f00d RD |
385 | libraries = libs, |
386 | extra_compile_args = cflags, | |
387 | extra_link_args = lflags, | |
388 | ) | |
389 | wxpExtensions.append(ext) | |
390 | ||
391 | ||
392 | # Extension for the calendar module | |
393 | swig_sources = run_swig(['calendar.i'], 'src', GENDIR, PKGDIR, | |
394 | USE_SWIG, swig_force, swig_args, swig_deps) | |
395 | ext = Extension('calendarc', swig_sources, | |
396 | include_dirs = includes, | |
397 | define_macros = defines, | |
398 | library_dirs = libdirs, | |
399 | libraries = libs, | |
400 | extra_compile_args = cflags, | |
401 | extra_link_args = lflags, | |
402 | ) | |
403 | wxpExtensions.append(ext) | |
c368d904 | 404 | |
c368d904 | 405 | |
4f3449b4 RD |
406 | # Extension for the help module |
407 | swig_sources = run_swig(['help.i'], 'src', GENDIR, PKGDIR, | |
408 | USE_SWIG, swig_force, swig_args, swig_deps) | |
409 | ext = Extension('helpc', swig_sources, | |
410 | include_dirs = includes, | |
411 | define_macros = defines, | |
412 | library_dirs = libdirs, | |
413 | libraries = libs, | |
414 | extra_compile_args = cflags, | |
415 | extra_link_args = lflags, | |
416 | ) | |
417 | wxpExtensions.append(ext) | |
418 | ||
419 | ||
c368d904 RD |
420 | #---------------------------------------------------------------------- |
421 | # Define the GLCanvas extension module | |
422 | #---------------------------------------------------------------------- | |
423 | ||
55c020cf RD |
424 | CTRB_SRC = opj(WXDIR, 'contrib/src') |
425 | CTRB_INC = opj(WXDIR, 'contrib/include/wx') | |
426 | ||
1b62f00d | 427 | if BUILD_GLCANVAS or GL_ONLY: |
cfe766c3 | 428 | msg('Preparing GLCANVAS...') |
c368d904 RD |
429 | location = 'contrib/glcanvas' |
430 | swig_files = ['glcanvas.i'] | |
19cf4f80 | 431 | other_sources = [] |
c368d904 RD |
432 | |
433 | swig_sources = run_swig(swig_files, location, GENDIR, PKGDIR, | |
1e7ecb7b | 434 | USE_SWIG, swig_force, swig_args) |
c368d904 RD |
435 | |
436 | gl_libs = [] | |
437 | if os.name == 'posix': | |
f32afe1c RD |
438 | gl_config = os.popen(WX_CONFIG + ' --gl-libs', 'r').read()[:-1] |
439 | gl_lflags = string.split(gl_config) + lflags | |
440 | gl_libs = libs | |
19cf4f80 | 441 | else: |
55c020cf | 442 | other_sources = [opj(location, 'msw/myglcanvas.cpp')] |
f32afe1c RD |
443 | gl_libs = libs + ['opengl32', 'glu32'] |
444 | gl_lflags = lflags | |
c368d904 | 445 | |
1e7ecb7b | 446 | ext = Extension('glcanvasc', |
19cf4f80 | 447 | swig_sources + other_sources, |
1e7ecb7b RD |
448 | |
449 | include_dirs = includes, | |
450 | define_macros = defines, | |
451 | ||
452 | library_dirs = libdirs, | |
f32afe1c | 453 | libraries = gl_libs, |
1e7ecb7b RD |
454 | |
455 | extra_compile_args = cflags, | |
f32afe1c | 456 | extra_link_args = gl_lflags, |
1e7ecb7b RD |
457 | ) |
458 | ||
459 | wxpExtensions.append(ext) | |
c368d904 RD |
460 | |
461 | ||
462 | #---------------------------------------------------------------------- | |
463 | # Define the OGL extension module | |
464 | #---------------------------------------------------------------------- | |
465 | ||
1b62f00d | 466 | if not GL_ONLY and BUILD_OGL: |
cfe766c3 | 467 | msg('Preparing OGL...') |
c368d904 | 468 | location = 'contrib/ogl' |
55c020cf RD |
469 | OGLLOC = opj(location, 'contrib/src/ogl') |
470 | OGLINC = opj(location, 'contrib/include') | |
c368d904 RD |
471 | |
472 | swig_files = ['ogl.i', 'oglbasic.i', 'oglshapes.i', 'oglshapes2.i', | |
473 | 'oglcanvas.i'] | |
474 | ||
475 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
1e7ecb7b | 476 | USE_SWIG, swig_force, swig_args) |
c368d904 | 477 | |
c368d904 | 478 | if IN_CVS_TREE: |
55c020cf RD |
479 | # make sure local copy of contrib files are up to date |
480 | contrib_copy_tree(opj(CTRB_INC, 'ogl'), opj(OGLINC, 'wx/ogl')) | |
481 | contrib_copy_tree(opj(CTRB_SRC, 'ogl'), OGLLOC) | |
c368d904 | 482 | |
1e7ecb7b RD |
483 | ext = Extension('oglc', ['%s/basic.cpp' % OGLLOC, |
484 | '%s/bmpshape.cpp' % OGLLOC, | |
485 | '%s/composit.cpp' % OGLLOC, | |
486 | '%s/divided.cpp' % OGLLOC, | |
487 | '%s/lines.cpp' % OGLLOC, | |
488 | '%s/misc.cpp' % OGLLOC, | |
489 | '%s/basic2.cpp' % OGLLOC, | |
490 | '%s/canvas.cpp' % OGLLOC, | |
491 | '%s/constrnt.cpp' % OGLLOC, | |
492 | '%s/drawn.cpp' % OGLLOC, | |
493 | '%s/mfutils.cpp' % OGLLOC, | |
494 | '%s/ogldiag.cpp' % OGLLOC, | |
495 | ] + swig_sources, | |
496 | ||
497 | include_dirs = [OGLINC] + includes, | |
498 | define_macros = defines, | |
499 | ||
500 | library_dirs = libdirs, | |
501 | libraries = libs, | |
502 | ||
503 | extra_compile_args = cflags, | |
504 | extra_link_args = lflags, | |
505 | ) | |
506 | ||
507 | wxpExtensions.append(ext) | |
508 | ||
509 | ||
c368d904 RD |
510 | |
511 | #---------------------------------------------------------------------- | |
512 | # Define the STC extension module | |
513 | #---------------------------------------------------------------------- | |
514 | ||
1b62f00d | 515 | if not GL_ONLY and BUILD_STC: |
cfe766c3 | 516 | msg('Preparing STC...') |
c368d904 | 517 | location = 'contrib/stc' |
55c020cf RD |
518 | STCLOC = opj(location, 'contrib/src/stc') |
519 | STCINC = opj(location, 'contrib/include') | |
520 | STC_H = opj(location, 'contrib/include/wx/stc') | |
c368d904 | 521 | |
c368d904 | 522 | if IN_CVS_TREE: |
55c020cf RD |
523 | # Check if gen_iface needs to be run for the wxSTC sources |
524 | if (newer(opj(CTRB_SRC, 'stc/stc.h.in'), opj(CTRB_INC, 'stc/stc.h' )) or | |
525 | newer(opj(CTRB_SRC, 'stc/stc.cpp.in'), opj(CTRB_SRC, 'stc/stc.cpp')) or | |
526 | newer(opj(CTRB_SRC, 'stc/gen_iface.py'), opj(CTRB_SRC, 'stc/stc.cpp'))): | |
527 | ||
528 | msg('Running gen_iface.py, regenerating stc.h and stc.cpp...') | |
529 | cwd = os.getcwd() | |
530 | os.chdir(opj(CTRB_SRC, 'stc')) | |
531 | import gen_iface | |
532 | gen_iface.main([]) | |
533 | os.chdir(cwd) | |
534 | ||
535 | ||
536 | # make sure local copy of contrib files are up to date | |
537 | contrib_copy_tree(opj(CTRB_INC, 'stc'), opj(STCINC, 'wx/stc')) | |
538 | contrib_copy_tree(opj(CTRB_SRC, 'stc'), STCLOC) | |
539 | ||
c368d904 RD |
540 | |
541 | ||
542 | swig_files = ['stc_.i'] | |
74933d75 | 543 | swig_sources = run_swig(swig_files, location, GENDIR, PKGDIR, |
c368d904 RD |
544 | USE_SWIG, swig_force, |
545 | swig_args + ['-I'+STC_H, '-I'+location], | |
55c020cf | 546 | [opj(STC_H, 'stc.h')]) |
c368d904 | 547 | |
4a61305d | 548 | # copy a contrib project specific py module to the main package dir |
55c020cf | 549 | copy_file(opj(location, 'stc.py'), PKGDIR, update=1, verbose=0) |
c368d904 RD |
550 | |
551 | # add some include dirs to the standard set | |
1e7ecb7b RD |
552 | stc_includes = includes[:] |
553 | stc_includes.append('%s/scintilla/include' % STCLOC) | |
554 | stc_includes.append('%s/scintilla/src' % STCLOC) | |
555 | stc_includes.append(STCINC) | |
c368d904 RD |
556 | |
557 | # and some macro definitions | |
1e7ecb7b RD |
558 | stc_defines = defines[:] |
559 | stc_defines.append( ('__WX__', None) ) | |
560 | stc_defines.append( ('SCI_LEXER', None) ) | |
c368d904 RD |
561 | |
562 | ||
1e7ecb7b RD |
563 | ext = Extension('stc_c', |
564 | ['%s/scintilla/src/AutoComplete.cxx' % STCLOC, | |
c368d904 RD |
565 | '%s/scintilla/src/CallTip.cxx' % STCLOC, |
566 | '%s/scintilla/src/CellBuffer.cxx' % STCLOC, | |
567 | '%s/scintilla/src/ContractionState.cxx' % STCLOC, | |
568 | '%s/scintilla/src/Document.cxx' % STCLOC, | |
55c020cf | 569 | '%s/scintilla/src/DocumentAccessor.cxx' % STCLOC, |
c368d904 RD |
570 | '%s/scintilla/src/Editor.cxx' % STCLOC, |
571 | '%s/scintilla/src/Indicator.cxx' % STCLOC, | |
572 | '%s/scintilla/src/KeyMap.cxx' % STCLOC, | |
573 | '%s/scintilla/src/KeyWords.cxx' % STCLOC, | |
574 | '%s/scintilla/src/LineMarker.cxx' % STCLOC, | |
575 | '%s/scintilla/src/PropSet.cxx' % STCLOC, | |
55c020cf | 576 | '%s/scintilla/src/RESearch.cxx' % STCLOC, |
c368d904 RD |
577 | '%s/scintilla/src/ScintillaBase.cxx' % STCLOC, |
578 | '%s/scintilla/src/Style.cxx' % STCLOC, | |
fe0aca37 | 579 | '%s/scintilla/src/StyleContext.cxx' % STCLOC, |
55c020cf | 580 | '%s/scintilla/src/UniConversion.cxx' % STCLOC, |
c368d904 | 581 | '%s/scintilla/src/ViewStyle.cxx' % STCLOC, |
55c020cf RD |
582 | '%s/scintilla/src/WindowAccessor.cxx' % STCLOC, |
583 | ||
584 | '%s/scintilla/src/LexAda.cxx' % STCLOC, | |
585 | '%s/scintilla/src/LexAVE.cxx' % STCLOC, | |
c368d904 | 586 | '%s/scintilla/src/LexCPP.cxx' % STCLOC, |
fe0aca37 RD |
587 | '%s/scintilla/src/LexConf.cxx' % STCLOC, |
588 | '%s/scintilla/src/LexCrontab.cxx' % STCLOC, | |
55c020cf | 589 | '%s/scintilla/src/LexEiffel.cxx' % STCLOC, |
c368d904 | 590 | '%s/scintilla/src/LexHTML.cxx' % STCLOC, |
55c020cf | 591 | '%s/scintilla/src/LexLisp.cxx' % STCLOC, |
c368d904 RD |
592 | '%s/scintilla/src/LexLua.cxx' % STCLOC, |
593 | '%s/scintilla/src/LexOthers.cxx' % STCLOC, | |
55c020cf | 594 | '%s/scintilla/src/LexPascal.cxx' % STCLOC, |
c368d904 RD |
595 | '%s/scintilla/src/LexPerl.cxx' % STCLOC, |
596 | '%s/scintilla/src/LexPython.cxx' % STCLOC, | |
55c020cf | 597 | '%s/scintilla/src/LexRuby.cxx' % STCLOC, |
c368d904 RD |
598 | '%s/scintilla/src/LexSQL.cxx' % STCLOC, |
599 | '%s/scintilla/src/LexVB.cxx' % STCLOC, | |
c368d904 RD |
600 | |
601 | '%s/PlatWX.cpp' % STCLOC, | |
602 | '%s/ScintillaWX.cpp' % STCLOC, | |
603 | '%s/stc.cpp' % STCLOC, | |
1e7ecb7b RD |
604 | ] + swig_sources, |
605 | ||
606 | include_dirs = stc_includes, | |
607 | define_macros = stc_defines, | |
608 | ||
609 | library_dirs = libdirs, | |
610 | libraries = libs, | |
c368d904 | 611 | |
1e7ecb7b RD |
612 | extra_compile_args = cflags, |
613 | extra_link_args = lflags, | |
614 | ) | |
615 | ||
616 | wxpExtensions.append(ext) | |
c368d904 RD |
617 | |
618 | ||
619 | ||
926bb76c RD |
620 | #---------------------------------------------------------------------- |
621 | # Define the IEWIN extension module (experimental) | |
622 | #---------------------------------------------------------------------- | |
623 | ||
624 | if not GL_ONLY and BUILD_IEWIN: | |
cfe766c3 | 625 | msg('Preparing IEWIN...') |
926bb76c RD |
626 | location = 'contrib/iewin' |
627 | ||
628 | swig_files = ['iewin.i', ] | |
629 | ||
630 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
631 | USE_SWIG, swig_force, swig_args) | |
632 | ||
633 | ||
634 | ext = Extension('iewinc', ['%s/IEHtmlWin.cpp' % location, | |
635 | ] + swig_sources, | |
636 | ||
637 | include_dirs = includes, | |
638 | define_macros = defines, | |
639 | ||
640 | library_dirs = libdirs, | |
641 | libraries = libs, | |
642 | ||
643 | extra_compile_args = cflags, | |
644 | extra_link_args = lflags, | |
645 | ) | |
646 | ||
647 | wxpExtensions.append(ext) | |
648 | ||
649 | ||
d56cebe7 RD |
650 | #---------------------------------------------------------------------- |
651 | # Define the XRC extension module | |
652 | #---------------------------------------------------------------------- | |
653 | ||
654 | if not GL_ONLY and BUILD_XRC: | |
cfe766c3 | 655 | msg('Preparing XRC...') |
d56cebe7 | 656 | location = 'contrib/xrc' |
55c020cf RD |
657 | XMLLOC = opj(location, 'contrib/src/xrc') |
658 | XMLINC = opj(location, 'contrib/include') | |
d56cebe7 RD |
659 | |
660 | swig_files = ['xrc.i'] | |
661 | ||
662 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
663 | USE_SWIG, swig_force, swig_args) | |
664 | ||
665 | xmlres_includes = includes[:] | |
666 | xmlres_includes.append('%s/expat/xmlparse' % XMLLOC) | |
667 | xmlres_includes.append('%s/expat/xmltok' % XMLLOC) | |
668 | xmlres_includes.append(XMLINC) | |
669 | ||
670 | ||
671 | # make sure local copy of contrib files are up to date | |
672 | if IN_CVS_TREE: | |
55c020cf RD |
673 | contrib_copy_tree(opj(CTRB_INC, 'xrc'), opj(XMLINC, 'wx/xrc')) |
674 | contrib_copy_tree(opj(CTRB_SRC, 'xrc'), XMLLOC) | |
d56cebe7 RD |
675 | |
676 | ext = Extension('xrcc', ['%s/expat/xmlparse/xmlparse.c' % XMLLOC, | |
677 | '%s/expat/xmltok/xmlrole.c' % XMLLOC, | |
678 | '%s/expat/xmltok/xmltok.c' % XMLLOC, | |
679 | ||
680 | '%s/xh_bmp.cpp' % XMLLOC, | |
681 | '%s/xh_bmpbt.cpp' % XMLLOC, | |
682 | '%s/xh_bttn.cpp' % XMLLOC, | |
683 | '%s/xh_cald.cpp' % XMLLOC, | |
684 | '%s/xh_chckb.cpp' % XMLLOC, | |
685 | ||
686 | '%s/xh_chckl.cpp' % XMLLOC, | |
687 | '%s/xh_choic.cpp' % XMLLOC, | |
688 | '%s/xh_combo.cpp' % XMLLOC, | |
689 | '%s/xh_dlg.cpp' % XMLLOC, | |
690 | '%s/xh_frame.cpp' % XMLLOC, | |
691 | ||
692 | '%s/xh_gauge.cpp' % XMLLOC, | |
6c5ae2d2 | 693 | '%s/xh_gdctl.cpp' % XMLLOC, |
d56cebe7 RD |
694 | '%s/xh_html.cpp' % XMLLOC, |
695 | '%s/xh_listb.cpp' % XMLLOC, | |
696 | '%s/xh_listc.cpp' % XMLLOC, | |
697 | '%s/xh_menu.cpp' % XMLLOC, | |
698 | ||
699 | '%s/xh_notbk.cpp' % XMLLOC, | |
700 | '%s/xh_panel.cpp' % XMLLOC, | |
701 | '%s/xh_radbt.cpp' % XMLLOC, | |
702 | '%s/xh_radbx.cpp' % XMLLOC, | |
703 | '%s/xh_scrol.cpp' % XMLLOC, | |
704 | ||
705 | '%s/xh_sizer.cpp' % XMLLOC, | |
706 | '%s/xh_slidr.cpp' % XMLLOC, | |
707 | '%s/xh_spin.cpp' % XMLLOC, | |
708 | '%s/xh_stbmp.cpp' % XMLLOC, | |
709 | '%s/xh_stbox.cpp' % XMLLOC, | |
710 | ||
711 | '%s/xh_stlin.cpp' % XMLLOC, | |
712 | '%s/xh_sttxt.cpp' % XMLLOC, | |
713 | '%s/xh_text.cpp' % XMLLOC, | |
714 | '%s/xh_toolb.cpp' % XMLLOC, | |
715 | '%s/xh_tree.cpp' % XMLLOC, | |
716 | ||
717 | '%s/xh_unkwn.cpp' % XMLLOC, | |
718 | '%s/xml.cpp' % XMLLOC, | |
d56cebe7 RD |
719 | '%s/xmlres.cpp' % XMLLOC, |
720 | '%s/xmlrsall.cpp' % XMLLOC, | |
d56cebe7 RD |
721 | |
722 | ] + swig_sources, | |
723 | ||
724 | include_dirs = xmlres_includes, | |
725 | define_macros = defines, | |
726 | ||
727 | library_dirs = libdirs, | |
728 | libraries = libs, | |
729 | ||
730 | extra_compile_args = cflags, | |
731 | extra_link_args = lflags, | |
732 | ) | |
733 | ||
734 | wxpExtensions.append(ext) | |
735 | ||
736 | ||
737 | ||
ebf4302c RD |
738 | #---------------------------------------------------------------------- |
739 | # Define the GIZMOS extension module | |
740 | #---------------------------------------------------------------------- | |
741 | ||
742 | if not GL_ONLY and BUILD_GIZMOS: | |
743 | msg('Preparing GIZMOS...') | |
744 | location = 'contrib/gizmos' | |
745 | GIZMOLOC = opj(location, 'contrib/src/gizmos') | |
746 | GIZMOINC = opj(location, 'contrib/include') | |
747 | ||
748 | swig_files = ['gizmos.i'] | |
749 | ||
750 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
751 | USE_SWIG, swig_force, swig_args) | |
752 | ||
753 | gizmos_includes = includes[:] | |
754 | gizmos_includes.append(GIZMOINC) | |
755 | ||
756 | ||
757 | # make sure local copy of contrib files are up to date | |
758 | if IN_CVS_TREE: | |
759 | contrib_copy_tree(opj(CTRB_INC, 'gizmos'), opj(GIZMOINC, 'wx/gizmos')) | |
760 | contrib_copy_tree(opj(CTRB_SRC, 'gizmos'), GIZMOLOC) | |
761 | ||
762 | ext = Extension('gizmosc', [ | |
763 | '%s/dynamicsash.cpp' % GIZMOLOC, | |
2f4e9287 | 764 | '%s/editlbox.cpp' % GIZMOLOC, |
950e7faf | 765 | #'%s/multicell.cpp' % GIZMOLOC, |
ebf4302c | 766 | '%s/splittree.cpp' % GIZMOLOC, |
950e7faf | 767 | '%s/ledctrl.cpp' % GIZMOLOC, |
ebf4302c RD |
768 | ] + swig_sources, |
769 | ||
770 | include_dirs = gizmos_includes, | |
771 | define_macros = defines, | |
772 | ||
773 | library_dirs = libdirs, | |
774 | libraries = libs, | |
775 | ||
776 | extra_compile_args = cflags, | |
777 | extra_link_args = lflags, | |
778 | ) | |
779 | ||
780 | wxpExtensions.append(ext) | |
781 | ||
782 | ||
783 | ||
4a61305d RD |
784 | #---------------------------------------------------------------------- |
785 | # Define the DLLWIDGET extension module | |
786 | #---------------------------------------------------------------------- | |
787 | ||
788 | if not GL_ONLY and BUILD_DLLWIDGET: | |
789 | msg('Preparing DLLWIDGET...') | |
790 | location = 'contrib/dllwidget' | |
791 | swig_files = ['dllwidget_.i'] | |
792 | ||
793 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
794 | USE_SWIG, swig_force, swig_args) | |
795 | ||
796 | # copy a contrib project specific py module to the main package dir | |
797 | copy_file(opj(location, 'dllwidget.py'), PKGDIR, update=1, verbose=0) | |
798 | ||
799 | ext = Extension('dllwidget_c', [ | |
800 | '%s/dllwidget.cpp' % location, | |
801 | ] + swig_sources, | |
802 | ||
803 | include_dirs = includes, | |
804 | define_macros = defines, | |
805 | ||
806 | library_dirs = libdirs, | |
807 | libraries = libs, | |
808 | ||
809 | extra_compile_args = cflags, | |
810 | extra_link_args = lflags, | |
811 | ) | |
812 | ||
813 | wxpExtensions.append(ext) | |
814 | ||
815 | ||
8916d007 RD |
816 | #---------------------------------------------------------------------- |
817 | # Tools and scripts | |
818 | #---------------------------------------------------------------------- | |
819 | ||
820 | TOOLS = [("wxPython/tools", glob.glob("tools/*.py")), | |
821 | ("wxPython/tools/XRCed", glob.glob("tools/XRCed/*.py") + | |
822 | glob.glob("tools/XRCed/*.xrc") + | |
823 | ["tools/XRCed/CHANGES", | |
824 | "tools/XRCed/TODO", | |
825 | "tools/XRCed/README"]), | |
826 | ] | |
827 | ||
828 | ||
4a61305d | 829 | |
926bb76c | 830 | |
c368d904 RD |
831 | #---------------------------------------------------------------------- |
832 | # Do the Setup/Build/Install/Whatever | |
833 | #---------------------------------------------------------------------- | |
834 | ||
1b62f00d RD |
835 | if __name__ == "__main__": |
836 | if not GL_ONLY: | |
837 | setup(name = PKGDIR, | |
838 | version = VERSION, | |
839 | description = DESCRIPTION, | |
840 | long_description = LONG_DESCRIPTION, | |
841 | author = AUTHOR, | |
842 | author_email = AUTHOR_EMAIL, | |
843 | url = URL, | |
844 | licence = LICENCE, | |
845 | ||
846 | packages = [PKGDIR, | |
847 | PKGDIR+'.lib', | |
848 | PKGDIR+'.lib.editor', | |
2ba9346d RD |
849 | PKGDIR+'.lib.mixins', |
850 | PKGDIR+'.lib.PyCrust', | |
1b62f00d RD |
851 | ], |
852 | ||
853 | ext_package = PKGDIR, | |
854 | ext_modules = wxpExtensions, | |
8916d007 RD |
855 | |
856 | ##data_files = TOOLS, | |
1b62f00d | 857 | ) |
c368d904 | 858 | |
1b62f00d | 859 | else: |
c368d904 | 860 | |
1b62f00d RD |
861 | setup(name = "wxPython-gl", |
862 | version = VERSION, | |
863 | description = "wxGLCanvas class for wxPython", | |
864 | author = AUTHOR, | |
865 | author_email = AUTHOR_EMAIL, | |
866 | url = URL, | |
867 | licence = LICENCE, | |
c368d904 | 868 | |
1b62f00d | 869 | py_modules = [ "wxPython.glcanvas" ], |
c368d904 | 870 | |
1b62f00d RD |
871 | ext_package = PKGDIR, |
872 | ext_modules = wxpExtensions, | |
8916d007 | 873 | |
1b62f00d | 874 | ) |
c368d904 | 875 | |
c368d904 RD |
876 | |
877 | ||
878 | ||
879 | #---------------------------------------------------------------------- | |
880 | #---------------------------------------------------------------------- |