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