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