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