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