]>
Commit | Line | Data |
---|---|---|
c368d904 RD |
1 | #!/usr/bin/env python |
2 | #---------------------------------------------------------------------- | |
3 | ||
b0640a71 | 4 | import sys, os, glob, fnmatch, tempfile |
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 | |
1e4a197e RD |
9 | from distutils.spawn import spawn |
10 | from distutils.command.install_data import install_data | |
c368d904 RD |
11 | |
12 | #---------------------------------------------------------------------- | |
13 | # flags and values that affect this script | |
14 | #---------------------------------------------------------------------- | |
15 | ||
1fded56b RD |
16 | VER_MAJOR = 2 # The first three must match wxWindows |
17 | VER_MINOR = 5 | |
4326f7b7 | 18 | VER_RELEASE = 1 |
b887061d RD |
19 | VER_SUBREL = 1 # wxPython release num for x.y.z release of wxWindows |
20 | VER_FLAGS = "" # release flags, such as prerelease num, unicode, etc. | |
1fded56b | 21 | |
c368d904 RD |
22 | DESCRIPTION = "Cross platform GUI toolkit for Python" |
23 | AUTHOR = "Robin Dunn" | |
b166c703 | 24 | AUTHOR_EMAIL = "Robin Dunn <robin@alldunn.com>" |
c368d904 | 25 | URL = "http://wxPython.org/" |
851d4ac7 RD |
26 | DOWNLOAD_URL = "http://wxPython.org/download.php" |
27 | LICENSE = "wxWindows Library License (LGPL derivative)" | |
28 | PLATFORMS = "WIN32,OSX,POSIX" | |
29 | KEYWORDS = "GUI,wx,wxWindows,cross-platform" | |
30 | ||
c368d904 RD |
31 | LONG_DESCRIPTION = """\ |
32 | wxPython is a GUI toolkit for Python that is a wrapper around the | |
33 | wxWindows C++ GUI library. wxPython provides a large variety of | |
1b62f00d | 34 | window types and controls, all implemented with a native look and |
1e4a197e | 35 | feel (by using the native widgets) on the platforms it is supported |
c368d904 RD |
36 | on. |
37 | """ | |
38 | ||
851d4ac7 RD |
39 | CLASSIFIERS = """\ |
40 | Development Status :: 6 - Mature | |
41 | Environment :: MacOS X :: Carbon | |
42 | Environment :: Win32 (MS Windows) | |
43 | Environment :: X11 Applications :: GTK | |
44 | Intended Audience :: Developers | |
45 | License :: OSI Approved | |
46 | Operating System :: MacOS :: MacOS X | |
47 | Operating System :: Microsoft :: Windows :: Windows 95/98/2000 | |
48 | Operating System :: POSIX | |
49 | Programming Language :: Python | |
50 | Topic :: Software Development :: User Interfaces | |
51 | """ | |
52 | ||
53 | ## License :: OSI Approved :: wxWindows Library Licence | |
54 | ||
c368d904 | 55 | |
1e4a197e RD |
56 | # Config values below this point can be reset on the setup.py command line. |
57 | ||
f221f8eb | 58 | BUILD_GLCANVAS = 1 # If true, build the contrib/glcanvas extension module |
c368d904 RD |
59 | BUILD_OGL = 1 # If true, build the contrib/ogl extension module |
60 | BUILD_STC = 1 # If true, build the contrib/stc extension module | |
d56cebe7 | 61 | BUILD_XRC = 1 # XML based resource system |
ebf4302c | 62 | BUILD_GIZMOS = 1 # Build a module for the gizmos contrib library |
1e4a197e | 63 | BUILD_DLLWIDGET = 0# Build a module that enables unknown wx widgets |
37bd51c0 | 64 | # to be loaded from a DLL and to be used from Python. |
d56cebe7 | 65 | |
c731eb47 | 66 | # Internet Explorer wrapper (experimental) |
de7b7fe6 | 67 | BUILD_IEWIN = (os.name == 'nt') |
78e8819c | 68 | |
1e4a197e | 69 | |
c368d904 | 70 | CORE_ONLY = 0 # if true, don't build any of the above |
4a61305d | 71 | |
1e4a197e | 72 | PREP_ONLY = 0 # Only run the prepatory steps, not the actual build. |
c368d904 RD |
73 | |
74 | USE_SWIG = 0 # Should we actually execute SWIG, or just use the | |
75 | # files already in the distribution? | |
76 | ||
d14a1e28 RD |
77 | SWIG = "swig" # The swig executable to use. |
78 | ||
79 | BUILD_RENAMERS = 1 # Should we build the renamer modules too? | |
80 | ||
a541c325 RD |
81 | UNICODE = 0 # This will pass the 'wxUSE_UNICODE' flag to SWIG and |
82 | # will ensure that the right headers are found and the | |
83 | # right libs are linked. | |
c8bc7bb8 | 84 | |
5c8e1089 RD |
85 | UNDEF_NDEBUG = 1 # Python 2.2 on Unix/Linux by default defines NDEBUG, |
86 | # and distutils will pick this up and use it on the | |
87 | # compile command-line for the extensions. This could | |
88 | # conflict with how wxWindows was built. If NDEBUG is | |
89 | # set then wxWindows' __WXDEBUG__ setting will be turned | |
90 | # off. If wxWindows was actually built with it turned | |
91 | # on then you end up with mismatched class structures, | |
92 | # and wxPython will crash. | |
93 | ||
2eb31f8b RD |
94 | NO_SCRIPTS = 0 # Don't install the tool scripts |
95 | ||
1e4a197e RD |
96 | WX_CONFIG = None # Usually you shouldn't need to touch this, but you can set |
97 | # it to pass an alternate version of wx-config or alternate | |
98 | # flags, eg. as required by the .deb in-tree build. By | |
99 | # default a wx-config command will be assembled based on | |
100 | # version, port, etc. and it will be looked for on the | |
101 | # default $PATH. | |
102 | ||
103 | WXPORT = 'gtk' # On Linux/Unix there are several ports of wxWindows available. | |
104 | # Setting this value lets you select which will be used for | |
105 | # the wxPython build. Possibilites are 'gtk', 'gtk2' and | |
106 | # 'x11'. Curently only gtk and gtk2 works. | |
107 | ||
108 | BUILD_BASE = "build" # Directory to use for temporary build files. | |
2eb31f8b | 109 | |
96d37ab5 | 110 | CONTRIBS_INC = "" # A dir to add as an -I flag when compiling the contribs |
c368d904 | 111 | |
a541c325 | 112 | |
c368d904 RD |
113 | # Some MSW build settings |
114 | ||
d440a0e7 | 115 | FINAL = 0 # Mirrors use of same flag in wx makefiles, |
c368d904 RD |
116 | # (0 or 1 only) should probably find a way to |
117 | # autodetect this... | |
118 | ||
d440a0e7 | 119 | HYBRID = 1 # If set and not debug or FINAL, then build a |
c368d904 RD |
120 | # hybrid extension that can be used by the |
121 | # non-debug version of python, but contains | |
122 | # debugging symbols for wxWindows and wxPython. | |
123 | # wxWindows must have been built with /MD, not /MDd | |
124 | # (using FINAL=hybrid will do it.) | |
125 | ||
3e46a8e6 RD |
126 | # Version part of wxWindows LIB/DLL names |
127 | WXDLLVER = '%d%d' % (VER_MAJOR, VER_MINOR) | |
c368d904 RD |
128 | |
129 | ||
cfe766c3 RD |
130 | #---------------------------------------------------------------------- |
131 | ||
132 | def msg(text): | |
133 | if __name__ == "__main__": | |
134 | print text | |
135 | ||
a541c325 | 136 | |
55c020cf RD |
137 | def opj(*args): |
138 | path = apply(os.path.join, args) | |
139 | return os.path.normpath(path) | |
cfe766c3 | 140 | |
a541c325 | 141 | |
a4fbdd76 RD |
142 | def libFlag(): |
143 | if FINAL: | |
c8bc7bb8 | 144 | rv = '' |
a4fbdd76 | 145 | elif HYBRID: |
c8bc7bb8 | 146 | rv = 'h' |
a4fbdd76 | 147 | else: |
c8bc7bb8 | 148 | rv = 'd' |
a541c325 | 149 | if UNICODE: |
c8bc7bb8 RD |
150 | rv = 'u' + rv |
151 | return rv | |
a4fbdd76 RD |
152 | |
153 | ||
c368d904 RD |
154 | #---------------------------------------------------------------------- |
155 | # Some other globals | |
156 | #---------------------------------------------------------------------- | |
157 | ||
d14a1e28 | 158 | PKGDIR = 'wx' |
c368d904 | 159 | wxpExtensions = [] |
1e4a197e | 160 | DATA_FILES = [] |
c368d904 RD |
161 | |
162 | force = '--force' in sys.argv or '-f' in sys.argv | |
163 | debug = '--debug' in sys.argv or '-g' in sys.argv | |
ce8f00f3 RD |
164 | cleaning = 'clean' in sys.argv |
165 | ||
c368d904 | 166 | |
1e4a197e RD |
167 | # change the PORT default for wxMac |
168 | if sys.platform[:6] == "darwin": | |
169 | WXPORT = 'mac' | |
22d08289 | 170 | |
1e4a197e RD |
171 | # and do the same for wxMSW, just for consistency |
172 | if os.name == 'nt': | |
173 | WXPORT = 'msw' | |
22d08289 | 174 | |
c368d904 RD |
175 | |
176 | #---------------------------------------------------------------------- | |
177 | # Check for build flags on the command line | |
178 | #---------------------------------------------------------------------- | |
179 | ||
5c8e1089 | 180 | # Boolean (int) flags |
b166c703 | 181 | for flag in ['BUILD_GLCANVAS', 'BUILD_OGL', 'BUILD_STC', 'BUILD_XRC', |
c731eb47 | 182 | 'BUILD_GIZMOS', 'BUILD_DLLWIDGET', 'BUILD_IEWIN', |
d14a1e28 RD |
183 | 'CORE_ONLY', 'PREP_ONLY', 'USE_SWIG', 'UNICODE', |
184 | 'UNDEF_NDEBUG', 'NO_SCRIPTS', 'BUILD_RENAMERS', | |
b166c703 | 185 | 'FINAL', 'HYBRID', ]: |
c368d904 | 186 | for x in range(len(sys.argv)): |
1e4a197e RD |
187 | if sys.argv[x].find(flag) == 0: |
188 | pos = sys.argv[x].find('=') + 1 | |
c368d904 RD |
189 | if pos > 0: |
190 | vars()[flag] = eval(sys.argv[x][pos:]) | |
191 | sys.argv[x] = '' | |
192 | ||
5c8e1089 | 193 | # String options |
96d37ab5 RD |
194 | for option in ['WX_CONFIG', 'WXDLLVER', 'BUILD_BASE', 'WXPORT', 'SWIG', |
195 | 'CONTRIBS_INC']: | |
afa3e1ed | 196 | for x in range(len(sys.argv)): |
1e4a197e RD |
197 | if sys.argv[x].find(option) == 0: |
198 | pos = sys.argv[x].find('=') + 1 | |
afa3e1ed RL |
199 | if pos > 0: |
200 | vars()[option] = sys.argv[x][pos:] | |
201 | sys.argv[x] = '' | |
202 | ||
c368d904 RD |
203 | sys.argv = filter(None, sys.argv) |
204 | ||
205 | ||
1e4a197e RD |
206 | #---------------------------------------------------------------------- |
207 | # some helper functions | |
208 | #---------------------------------------------------------------------- | |
209 | ||
210 | def Verify_WX_CONFIG(): | |
211 | """ Called below for the builds that need wx-config, | |
212 | if WX_CONFIG is not set then tries to select the specific | |
213 | wx*-config script based on build options. If not found | |
214 | then it defaults to 'wx-config'. | |
215 | """ | |
216 | # if WX_CONFIG hasn't been set to an explicit value then construct one. | |
217 | global WX_CONFIG | |
218 | if WX_CONFIG is None: | |
219 | if debug: # TODO: Fix this. wxPython's --debug shouldn't be tied to wxWindows... | |
220 | df = 'd' | |
221 | else: | |
222 | df = '' | |
223 | if UNICODE: | |
224 | uf = 'u' | |
225 | else: | |
226 | uf = '' | |
1fded56b | 227 | ver2 = "%s.%s" % (VER_MAJOR, VER_MINOR) |
f87da722 RD |
228 | port = WXPORT |
229 | if port == "x11": | |
230 | port = "x11univ" | |
231 | WX_CONFIG = 'wx%s%s%s-%s-config' % (port, uf, df, ver2) | |
1e4a197e RD |
232 | |
233 | searchpath = os.environ["PATH"] | |
234 | for p in searchpath.split(':'): | |
235 | fp = os.path.join(p, WX_CONFIG) | |
236 | if os.path.exists(fp) and os.access(fp, os.X_OK): | |
237 | # success | |
238 | msg("Found wx-config: " + fp) | |
239 | WX_CONFIG = fp | |
240 | break | |
241 | else: | |
242 | msg("WX_CONFIG not specified and %s not found on $PATH " | |
243 | "defaulting to \"wx-config\"" % WX_CONFIG) | |
244 | WX_CONFIG = 'wx-config' | |
245 | ||
246 | ||
247 | ||
248 | def run_swig(files, dir, gendir, package, USE_SWIG, force, swig_args, swig_deps=[]): | |
249 | """Run SWIG the way I want it done""" | |
d14a1e28 | 250 | |
1e4a197e RD |
251 | if not os.path.exists(os.path.join(dir, gendir)): |
252 | os.mkdir(os.path.join(dir, gendir)) | |
253 | ||
8994c3c2 RD |
254 | if not os.path.exists(os.path.join("docs", "xml-raw")): |
255 | os.mkdir(os.path.join("docs", "xml-raw")) | |
256 | ||
1e4a197e RD |
257 | sources = [] |
258 | ||
259 | for file in files: | |
260 | basefile = os.path.splitext(file)[0] | |
261 | i_file = os.path.join(dir, file) | |
262 | py_file = os.path.join(dir, gendir, basefile+'.py') | |
d14a1e28 | 263 | cpp_file = os.path.join(dir, gendir, basefile+'_wrap.cpp') |
8994c3c2 | 264 | xml_file = os.path.join("docs", "xml-raw", basefile+'_swig.xml') |
1e4a197e RD |
265 | |
266 | sources.append(cpp_file) | |
267 | ||
ce8f00f3 | 268 | if not cleaning and USE_SWIG: |
1e4a197e RD |
269 | for dep in swig_deps: |
270 | if newer(dep, py_file) or newer(dep, cpp_file): | |
271 | force = 1 | |
272 | break | |
273 | ||
274 | if force or newer(i_file, py_file) or newer(i_file, cpp_file): | |
d14a1e28 RD |
275 | ## we need forward slashes here even on win32 |
276 | #cpp_file = opj(cpp_file) #'/'.join(cpp_file.split('\\')) | |
277 | #i_file = opj(i_file) #'/'.join(i_file.split('\\')) | |
278 | ||
279 | if BUILD_RENAMERS: | |
b0640a71 RD |
280 | #tempfile.tempdir = sourcePath |
281 | xmltemp = tempfile.mktemp('.xml') | |
282 | ||
8994c3c2 RD |
283 | # First run swig to produce the XML file, adding |
284 | # an extra -D that prevents the old rename | |
285 | # directives from being used | |
286 | cmd = [ swig_cmd ] + swig_args + \ | |
b0640a71 | 287 | [ '-DBUILDING_RENAMERS', '-xmlout', xmltemp ] + \ |
8994c3c2 RD |
288 | ['-I'+dir, '-o', cpp_file, i_file] |
289 | msg(' '.join(cmd)) | |
290 | spawn(cmd) | |
291 | ||
292 | # Next run build_renamers to process the XML | |
d14a1e28 | 293 | cmd = [ sys.executable, '-u', |
b0640a71 | 294 | './distrib/build_renamers.py', dir, basefile, xmltemp] |
d14a1e28 RD |
295 | msg(' '.join(cmd)) |
296 | spawn(cmd) | |
b0640a71 | 297 | os.remove(xmltemp) |
d14a1e28 RD |
298 | |
299 | # Then run swig for real | |
b0640a71 RD |
300 | cmd = [ swig_cmd ] + swig_args + ['-I'+dir, '-o', cpp_file, |
301 | '-xmlout', xml_file, i_file] | |
1e4a197e RD |
302 | msg(' '.join(cmd)) |
303 | spawn(cmd) | |
304 | ||
d14a1e28 | 305 | |
1e4a197e RD |
306 | # copy the generated python file to the package directory |
307 | copy_file(py_file, package, update=not force, verbose=0) | |
308 | ||
309 | return sources | |
310 | ||
311 | ||
312 | ||
313 | def contrib_copy_tree(src, dest, verbose=0): | |
314 | """Update local copies of wxWindows contrib files""" | |
315 | from distutils.dir_util import mkpath, copy_tree | |
316 | ||
317 | mkpath(dest, verbose=verbose) | |
318 | copy_tree(src, dest, update=1, verbose=verbose) | |
319 | ||
320 | ||
321 | ||
322 | class smart_install_data(install_data): | |
323 | def run(self): | |
324 | #need to change self.install_dir to the actual library dir | |
325 | install_cmd = self.get_finalized_command('install') | |
326 | self.install_dir = getattr(install_cmd, 'install_lib') | |
327 | return install_data.run(self) | |
328 | ||
329 | ||
330 | def build_locale_dir(destdir, verbose=1): | |
331 | """Build a locale dir under the wxPython package for MSW""" | |
332 | moFiles = glob.glob(opj(WXDIR, 'locale', '*.mo')) | |
333 | for src in moFiles: | |
334 | lang = os.path.splitext(os.path.basename(src))[0] | |
335 | dest = opj(destdir, lang, 'LC_MESSAGES') | |
336 | mkpath(dest, verbose=verbose) | |
337 | copy_file(src, opj(dest, 'wxstd.mo'), update=1, verbose=verbose) | |
338 | ||
339 | ||
340 | def build_locale_list(srcdir): | |
341 | # get a list of all files under the srcdir, to be used for install_data | |
342 | def walk_helper(lst, dirname, files): | |
343 | for f in files: | |
344 | filename = opj(dirname, f) | |
345 | if not os.path.isdir(filename): | |
346 | lst.append( (dirname, [filename]) ) | |
347 | file_list = [] | |
348 | os.path.walk(srcdir, walk_helper, file_list) | |
349 | return file_list | |
350 | ||
351 | ||
1fded56b RD |
352 | def find_data_files(srcdir, *wildcards): |
353 | # get a list of all files under the srcdir matching wildcards, | |
354 | # returned in a format to be used for install_data | |
355 | ||
356 | def walk_helper(arg, dirname, files): | |
357 | names = [] | |
358 | lst, wildcards = arg | |
359 | for wc in wildcards: | |
360 | for f in files: | |
361 | filename = opj(dirname, f) | |
362 | if fnmatch.fnmatch(filename, wc) and not os.path.isdir(filename): | |
363 | names.append(filename) | |
364 | if names: | |
365 | lst.append( (dirname, names ) ) | |
366 | ||
367 | file_list = [] | |
368 | os.path.walk(srcdir, walk_helper, (file_list, wildcards)) | |
369 | return file_list | |
1e4a197e RD |
370 | |
371 | ||
3ef86e32 RD |
372 | def makeLibName(name): |
373 | if os.name == 'posix': | |
374 | libname = '%s_%s-%s' % (WXBASENAME, name, WXRELEASE) | |
375 | else: | |
3e46a8e6 | 376 | libname = 'wxmsw%s%s_%s' % (WXDLLVER, libFlag(), name) |
3ef86e32 RD |
377 | |
378 | return [libname] | |
379 | ||
380 | ||
381 | ||
382 | def adjustCFLAGS(cflags, defines, includes): | |
d14a1e28 | 383 | '''Extrace the raw -I, -D, and -U flags and put them into |
3ef86e32 RD |
384 | defines and includes as needed.''' |
385 | newCFLAGS = [] | |
386 | for flag in cflags: | |
387 | if flag[:2] == '-I': | |
388 | includes.append(flag[2:]) | |
389 | elif flag[:2] == '-D': | |
390 | flag = flag[2:] | |
391 | if flag.find('=') == -1: | |
392 | defines.append( (flag, None) ) | |
393 | else: | |
394 | defines.append( tuple(flag.split('=')) ) | |
395 | elif flag[:2] == '-U': | |
396 | defines.append( (flag[2:], ) ) | |
397 | else: | |
398 | newCFLAGS.append(flag) | |
399 | return newCFLAGS | |
400 | ||
401 | ||
402 | ||
403 | def adjustLFLAGS(lfags, libdirs, libs): | |
d14a1e28 | 404 | '''Extrace the -L and -l flags and put them in libdirs and libs as needed''' |
3ef86e32 RD |
405 | newLFLAGS = [] |
406 | for flag in lflags: | |
407 | if flag[:2] == '-L': | |
408 | libdirs.append(flag[2:]) | |
409 | elif flag[:2] == '-l': | |
410 | libs.append(flag[2:]) | |
411 | else: | |
412 | newLFLAGS.append(flag) | |
413 | ||
414 | return newLFLAGS | |
c8bc7bb8 RD |
415 | |
416 | #---------------------------------------------------------------------- | |
417 | # sanity checks | |
418 | ||
c368d904 | 419 | if CORE_ONLY: |
f221f8eb | 420 | BUILD_GLCANVAS = 0 |
c368d904 RD |
421 | BUILD_OGL = 0 |
422 | BUILD_STC = 0 | |
b166c703 | 423 | BUILD_XRC = 0 |
ff5f1aba RD |
424 | BUILD_GIZMOS = 0 |
425 | BUILD_DLLWIDGET = 0 | |
c731eb47 | 426 | BUILD_IEWIN = 0 |
ff5f1aba | 427 | |
1e4a197e RD |
428 | if debug: |
429 | FINAL = 0 | |
430 | HYBRID = 0 | |
c368d904 | 431 | |
1e4a197e RD |
432 | if FINAL: |
433 | HYBRID = 0 | |
c8bc7bb8 | 434 | |
1e4a197e RD |
435 | if UNICODE and WXPORT not in ['msw', 'gtk2']: |
436 | raise SystemExit, "UNICODE mode not currently supported on this WXPORT: "+WXPORT | |
a541c325 RD |
437 | |
438 | ||
c368d904 RD |
439 | #---------------------------------------------------------------------- |
440 | # Setup some platform specific stuff | |
441 | #---------------------------------------------------------------------- | |
442 | ||
443 | if os.name == 'nt': | |
444 | # Set compile flags and such for MSVC. These values are derived | |
a541c325 RD |
445 | # from the wxWindows makefiles for MSVC, other compilers settings |
446 | # will probably vary... | |
447 | if os.environ.has_key('WXWIN'): | |
448 | WXDIR = os.environ['WXWIN'] | |
449 | else: | |
450 | msg("WARNING: WXWIN not set in environment.") | |
451 | WXDIR = '..' # assumes in CVS tree | |
c368d904 RD |
452 | WXPLAT = '__WXMSW__' |
453 | GENDIR = 'msw' | |
454 | ||
d14a1e28 RD |
455 | includes = ['include', 'src', |
456 | opj(WXDIR, 'lib', 'vc_dll', 'msw' + libFlag()), | |
55c020cf | 457 | opj(WXDIR, 'include'), |
5a2a9da2 | 458 | opj(WXDIR, 'contrib', 'include'), |
c368d904 RD |
459 | ] |
460 | ||
1e4a197e | 461 | defines = [ ('WIN32', None), |
c368d904 | 462 | ('_WINDOWS', None), |
c368d904 RD |
463 | |
464 | (WXPLAT, None), | |
465 | ('WXUSINGDLL', '1'), | |
466 | ||
467 | ('SWIG_GLOBAL', None), | |
c368d904 RD |
468 | ('WXP_USE_THREAD', '1'), |
469 | ] | |
470 | ||
1e4a197e RD |
471 | if UNDEF_NDEBUG: |
472 | defines.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef | |
22d08289 | 473 | |
a3a2c5fe RD |
474 | if HYBRID: |
475 | defines.append( ('__NO_VC_CRTDBG__', None) ) | |
22d08289 | 476 | |
c368d904 RD |
477 | if not FINAL or HYBRID: |
478 | defines.append( ('__WXDEBUG__', None) ) | |
479 | ||
1e521887 | 480 | libdirs = [ opj(WXDIR, 'lib', 'vc_dll') ] |
0a67b751 RD |
481 | libs = [ 'wxbase' + WXDLLVER + libFlag(), # TODO: trim this down to what is really needed for the core |
482 | 'wxbase' + WXDLLVER + libFlag() + '_net', | |
483 | 'wxbase' + WXDLLVER + libFlag() + '_xml', | |
484 | makeLibName('core')[0], | |
485 | makeLibName('adv')[0], | |
486 | makeLibName('html')[0], | |
487 | ] | |
a4fbdd76 | 488 | |
22d08289 | 489 | libs = libs + ['kernel32', 'user32', 'gdi32', 'comdlg32', |
c368d904 | 490 | 'winspool', 'winmm', 'shell32', 'oldnames', 'comctl32', |
1e4a197e | 491 | 'odbc32', 'ole32', 'oleaut32', 'uuid', 'rpcrt4', |
c368d904 RD |
492 | 'advapi32', 'wsock32'] |
493 | ||
22d08289 | 494 | |
d440a0e7 | 495 | cflags = [ '/Gy', |
ad07d019 RD |
496 | # '/GX-' # workaround for internal compiler error in MSVC on some machines |
497 | ] | |
c368d904 RD |
498 | lflags = None |
499 | ||
1e4a197e | 500 | # Other MSVC flags... |
1fded56b | 501 | # Too bad I don't remember why I was playing with these, can they be removed? |
1e4a197e RD |
502 | if FINAL: |
503 | pass #cflags = cflags + ['/O1'] | |
504 | elif HYBRID : | |
505 | pass #cflags = cflags + ['/Ox'] | |
506 | else: | |
507 | pass # cflags = cflags + ['/Od', '/Z7'] | |
508 | # lflags = ['/DEBUG', ] | |
22d08289 RD |
509 | |
510 | ||
22d08289 | 511 | |
1e4a197e | 512 | #---------------------------------------------------------------------- |
c368d904 | 513 | |
3ef86e32 | 514 | elif os.name == 'posix': |
d14a1e28 RD |
515 | WXDIR = '..' |
516 | includes = ['include', 'src'] | |
e6056257 RD |
517 | defines = [('SWIG_GLOBAL', None), |
518 | ('HAVE_CONFIG_H', None), | |
519 | ('WXP_USE_THREAD', '1'), | |
520 | ] | |
1e4a197e RD |
521 | if UNDEF_NDEBUG: |
522 | defines.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef | |
1e4a197e RD |
523 | |
524 | Verify_WX_CONFIG() | |
e6056257 | 525 | |
3ef86e32 RD |
526 | libdirs = [] |
527 | libs = [] | |
528 | ||
f9b46bcb RD |
529 | # If you get unresolved symbol errors on Solaris and are using gcc, then |
530 | # uncomment this block to add the right flags to the link step and build | |
531 | # again. | |
532 | ## if os.uname()[0] == 'SunOS': | |
533 | ## libs.append('gcc') | |
534 | ## libdirs.append(commands.getoutput("gcc -print-search-dirs | grep '^install' | awk '{print $2}'")[:-1]) | |
535 | ||
e6056257 | 536 | cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1] |
1e4a197e | 537 | cflags = cflags.split() |
ba201fa4 RD |
538 | if debug: |
539 | cflags.append('-g') | |
540 | cflags.append('-O0') | |
8b9a4190 RD |
541 | else: |
542 | cflags.append('-O3') | |
e6056257 RD |
543 | |
544 | lflags = os.popen(WX_CONFIG + ' --libs', 'r').read()[:-1] | |
1e4a197e | 545 | lflags = lflags.split() |
e6056257 | 546 | |
3ef86e32 RD |
547 | WXBASENAME = os.popen(WX_CONFIG + ' --basename').read()[:-1] |
548 | WXRELEASE = os.popen(WX_CONFIG + ' --release').read()[:-1] | |
549 | WXPREFIX = os.popen(WX_CONFIG + ' --prefix').read()[:-1] | |
e6056257 RD |
550 | |
551 | ||
3ef86e32 RD |
552 | if sys.platform[:6] == "darwin": |
553 | # Flags and such for a Darwin (Max OS X) build of Python | |
554 | WXPLAT = '__WXMAC__' | |
555 | GENDIR = 'mac' | |
556 | libs = ['stdc++'] | |
557 | NO_SCRIPTS = 1 | |
c368d904 | 558 | |
1e4a197e | 559 | |
3ef86e32 RD |
560 | else: |
561 | # Set flags for other Unix type platforms | |
562 | GENDIR = WXPORT | |
563 | ||
564 | if WXPORT == 'gtk': | |
565 | WXPLAT = '__WXGTK__' | |
566 | portcfg = os.popen('gtk-config --cflags', 'r').read()[:-1] | |
567 | elif WXPORT == 'gtk2': | |
568 | WXPLAT = '__WXGTK__' | |
569 | GENDIR = 'gtk' # no code differences so use the same generated sources | |
570 | portcfg = os.popen('pkg-config gtk+-2.0 --cflags', 'r').read()[:-1] | |
571 | BUILD_BASE = BUILD_BASE + '-' + WXPORT | |
572 | elif WXPORT == 'x11': | |
573 | WXPLAT = '__WXX11__' | |
574 | portcfg = '' | |
575 | BUILD_BASE = BUILD_BASE + '-' + WXPORT | |
576 | else: | |
577 | raise SystemExit, "Unknown WXPORT value: " + WXPORT | |
1e4a197e | 578 | |
3ef86e32 | 579 | cflags += portcfg.split() |
1e4a197e | 580 | |
d14a1e28 RD |
581 | # Some distros (e.g. Mandrake) put libGLU in /usr/X11R6/lib, but |
582 | # wx-config doesn't output that for some reason. For now, just | |
583 | # add it unconditionally but we should really check if the lib is | |
584 | # really found there or wx-config should be fixed. | |
585 | libdirs.append("/usr/X11R6/lib") | |
c368d904 | 586 | |
1e4a197e | 587 | |
3ef86e32 RD |
588 | # Move the various -I, -D, etc. flags we got from the *config scripts |
589 | # into the distutils lists. | |
590 | cflags = adjustCFLAGS(cflags, defines, includes) | |
591 | lflags = adjustLFLAGS(lflags, libdirs, libs) | |
c368d904 RD |
592 | |
593 | ||
1e4a197e | 594 | #---------------------------------------------------------------------- |
c368d904 | 595 | else: |
96d37ab5 | 596 | raise 'Sorry, platform not supported...' |
1e4a197e RD |
597 | |
598 | ||
599 | #---------------------------------------------------------------------- | |
1fded56b | 600 | # post platform setup checks and tweaks, create the full version string |
1e4a197e RD |
601 | #---------------------------------------------------------------------- |
602 | ||
603 | if UNICODE: | |
604 | BUILD_BASE = BUILD_BASE + '.unicode' | |
1fded56b | 605 | VER_FLAGS += 'u' |
c368d904 RD |
606 | |
607 | ||
1fded56b RD |
608 | VERSION = "%s.%s.%s.%s%s" % (VER_MAJOR, VER_MINOR, VER_RELEASE, |
609 | VER_SUBREL, VER_FLAGS) | |
610 | ||
c368d904 | 611 | #---------------------------------------------------------------------- |
1fded56b | 612 | # Update the version file |
c368d904 RD |
613 | #---------------------------------------------------------------------- |
614 | ||
1fded56b RD |
615 | # Unconditionally updated since the version string can change based |
616 | # on the UNICODE flag | |
617 | open('src/__version__.py', 'w').write("""\ | |
618 | # This file was generated by setup.py... | |
619 | ||
d14a1e28 RD |
620 | VERSION_STRING = '%(VERSION)s' |
621 | MAJOR_VERSION = %(VER_MAJOR)s | |
622 | MINOR_VERSION = %(VER_MINOR)s | |
623 | RELEASE_VERSION = %(VER_RELEASE)s | |
624 | SUBREL_VERSION = %(VER_SUBREL)s | |
1fded56b | 625 | |
d14a1e28 RD |
626 | VERSION = (MAJOR_VERSION, MINOR_VERSION, RELEASE_VERSION, |
627 | SUBREL_VERSION, '%(VER_FLAGS)s') | |
1fded56b | 628 | |
d14a1e28 | 629 | RELEASE_NUMBER = RELEASE_VERSION # for compatibility |
1fded56b | 630 | """ % globals()) |
1e4a197e | 631 | |
c368d904 | 632 | |
1b62f00d RD |
633 | |
634 | ||
c368d904 | 635 | #---------------------------------------------------------------------- |
1b62f00d | 636 | # SWIG defaults |
c368d904 RD |
637 | #---------------------------------------------------------------------- |
638 | ||
d14a1e28 | 639 | swig_cmd = SWIG |
c368d904 | 640 | swig_force = force |
d14a1e28 RD |
641 | swig_args = ['-c++', |
642 | '-Wall', | |
643 | '-nodefault', | |
644 | ||
645 | ## '-xml', | |
646 | ||
647 | '-python', | |
648 | '-keyword', | |
649 | '-new_repr', | |
650 | '-modern', | |
651 | ||
652 | '-I./src', | |
653 | '-D'+WXPLAT, | |
98fb9b71 | 654 | '-noruntime' |
e6056257 | 655 | ] |
a541c325 | 656 | if UNICODE: |
c8bc7bb8 RD |
657 | swig_args.append('-DwxUSE_UNICODE') |
658 | ||
d14a1e28 RD |
659 | swig_deps = [ 'src/my_typemaps.i', |
660 | 'src/common.swg', | |
661 | 'src/pyrun.swg', | |
662 | ] | |
663 | ||
664 | depends = [ #'include/wx/wxPython/wxPython.h', | |
665 | #'include/wx/wxPython/wxPython_int.h', | |
666 | #'src/pyclasses.h', | |
667 | ] | |
c368d904 | 668 | |
c368d904 | 669 | |
1b62f00d RD |
670 | #---------------------------------------------------------------------- |
671 | # Define the CORE extension module | |
672 | #---------------------------------------------------------------------- | |
673 | ||
1e4a197e | 674 | msg('Preparing CORE...') |
d14a1e28 RD |
675 | swig_sources = run_swig(['core.i'], 'src', GENDIR, PKGDIR, |
676 | USE_SWIG, swig_force, swig_args, swig_deps + | |
1e0c8722 RD |
677 | [ 'src/_accel.i', |
678 | 'src/_app.i', | |
d14a1e28 RD |
679 | 'src/_app_ex.py', |
680 | 'src/_constraints.i', | |
681 | 'src/_core_api.i', | |
682 | 'src/_core_ex.py', | |
683 | 'src/_core_rename.i', | |
684 | 'src/_core_reverse.txt', | |
685 | 'src/_defs.i', | |
686 | 'src/_event.i', | |
687 | 'src/_event_ex.py', | |
688 | 'src/_evthandler.i', | |
689 | 'src/_filesys.i', | |
690 | 'src/_gdicmn.i', | |
691 | 'src/_image.i', | |
692 | 'src/_menu.i', | |
693 | 'src/_obj.i', | |
694 | 'src/_sizers.i', | |
695 | 'src/_gbsizer.i', | |
696 | 'src/_streams.i', | |
697 | 'src/_validator.i', | |
698 | 'src/_window.i', | |
cf636c45 | 699 | 'src/_control.i', |
d14a1e28 | 700 | ]) |
1b62f00d | 701 | |
1e4a197e RD |
702 | copy_file('src/__init__.py', PKGDIR, update=1, verbose=0) |
703 | copy_file('src/__version__.py', PKGDIR, update=1, verbose=0) | |
1b62f00d RD |
704 | |
705 | ||
d14a1e28 RD |
706 | # update the license files |
707 | mkpath('licence') | |
708 | for file in ['preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt']: | |
709 | copy_file(opj(WXDIR, 'docs', file), opj('licence',file), update=1, verbose=0) | |
c368d904 | 710 | |
c368d904 | 711 | |
1e4a197e RD |
712 | if os.name == 'nt': |
713 | build_locale_dir(opj(PKGDIR, 'locale')) | |
714 | DATA_FILES += build_locale_list(opj(PKGDIR, 'locale')) | |
4f3449b4 RD |
715 | |
716 | ||
1e4a197e RD |
717 | if os.name == 'nt': |
718 | rc_file = ['src/wxc.rc'] | |
719 | else: | |
720 | rc_file = [] | |
721 | ||
722 | ||
d14a1e28 RD |
723 | ext = Extension('_core', ['src/helpers.cpp', |
724 | 'src/libpy.c', | |
1e4a197e RD |
725 | ] + rc_file + swig_sources, |
726 | ||
727 | include_dirs = includes, | |
728 | define_macros = defines, | |
729 | ||
730 | library_dirs = libdirs, | |
731 | libraries = libs, | |
732 | ||
733 | extra_compile_args = cflags, | |
734 | extra_link_args = lflags, | |
d14a1e28 RD |
735 | |
736 | depends = depends | |
1e4a197e RD |
737 | ) |
738 | wxpExtensions.append(ext) | |
739 | ||
740 | ||
d14a1e28 RD |
741 | |
742 | ||
743 | ||
744 | # Extension for the GDI module | |
745 | swig_sources = run_swig(['gdi.i'], 'src', GENDIR, PKGDIR, | |
746 | USE_SWIG, swig_force, swig_args, swig_deps + | |
747 | ['src/_gdi_rename.i', | |
748 | 'src/_bitmap.i', 'src/_brush.i', | |
749 | 'src/_colour.i', 'src/_cursor.i', | |
750 | 'src/_dc.i', 'src/_font.i', | |
751 | 'src/_gdiobj.i', 'src/_icon.i', | |
752 | 'src/_imaglist.i', 'src/_pen.i', | |
753 | 'src/_region.i', 'src/_palette.i', | |
dd9f7fea | 754 | 'src/_stockobjs.i', |
d14a1e28 RD |
755 | 'src/_effects.i', |
756 | 'src/_intl.i', | |
757 | 'src/_intl_ex.py', | |
758 | ]) | |
759 | ext = Extension('_gdi', ['src/drawlist.cpp'] + swig_sources, | |
1e4a197e RD |
760 | include_dirs = includes, |
761 | define_macros = defines, | |
762 | library_dirs = libdirs, | |
763 | libraries = libs, | |
764 | extra_compile_args = cflags, | |
765 | extra_link_args = lflags, | |
d14a1e28 | 766 | depends = depends |
1e4a197e RD |
767 | ) |
768 | wxpExtensions.append(ext) | |
769 | ||
770 | ||
d14a1e28 RD |
771 | |
772 | ||
773 | ||
774 | ||
775 | # Extension for the windows module | |
776 | swig_sources = run_swig(['windows.i'], 'src', GENDIR, PKGDIR, | |
777 | USE_SWIG, swig_force, swig_args, swig_deps + | |
778 | ['src/_windows_rename.i', 'src/_windows_reverse.txt', | |
779 | 'src/_panel.i', | |
d14a1e28 RD |
780 | 'src/_toplvl.i', 'src/_statusbar.i', |
781 | 'src/_splitter.i', 'src/_sashwin.i', | |
782 | 'src/_popupwin.i', 'src/_tipwin.i', | |
783 | 'src/_vscroll.i', 'src/_taskbar.i', | |
784 | 'src/_cmndlgs.i', 'src/_mdi.i', | |
785 | 'src/_pywindows.i', 'src/_printfw.i', | |
786 | ]) | |
787 | ext = Extension('_windows', swig_sources, | |
1e4a197e RD |
788 | include_dirs = includes, |
789 | define_macros = defines, | |
790 | library_dirs = libdirs, | |
791 | libraries = libs, | |
792 | extra_compile_args = cflags, | |
793 | extra_link_args = lflags, | |
d14a1e28 | 794 | depends = depends |
1e4a197e RD |
795 | ) |
796 | wxpExtensions.append(ext) | |
797 | ||
798 | ||
d14a1e28 RD |
799 | |
800 | ||
801 | # Extension for the controls module | |
802 | swig_sources = run_swig(['controls.i'], 'src', GENDIR, PKGDIR, | |
803 | USE_SWIG, swig_force, swig_args, swig_deps + | |
804 | [ 'src/_controls_rename.i', 'src/_controls_reverse.txt', | |
cf636c45 | 805 | 'src/_toolbar.i', |
d14a1e28 RD |
806 | 'src/_button.i', 'src/_checkbox.i', |
807 | 'src/_choice.i', 'src/_combobox.i', | |
808 | 'src/_gauge.i', 'src/_statctrls.i', | |
809 | 'src/_listbox.i', 'src/_textctrl.i', | |
810 | 'src/_scrolbar.i', 'src/_spin.i', | |
811 | 'src/_radio.i', 'src/_slider.i', | |
812 | 'src/_tglbtn.i', 'src/_notebook.i', | |
813 | 'src/_listctrl.i', 'src/_treectrl.i', | |
814 | 'src/_dirctrl.i', 'src/_pycontrol.i', | |
dd9f7fea | 815 | 'src/_cshelp.i', 'src/_dragimg.i', |
d14a1e28 RD |
816 | ]) |
817 | ext = Extension('_controls', swig_sources, | |
818 | include_dirs = includes, | |
819 | define_macros = defines, | |
820 | library_dirs = libdirs, | |
821 | libraries = libs, | |
822 | extra_compile_args = cflags, | |
823 | extra_link_args = lflags, | |
824 | depends = depends | |
825 | ) | |
826 | wxpExtensions.append(ext) | |
827 | ||
828 | ||
829 | ||
830 | ||
831 | # Extension for the misc module | |
832 | swig_sources = run_swig(['misc.i'], 'src', GENDIR, PKGDIR, | |
833 | USE_SWIG, swig_force, swig_args, swig_deps + | |
834 | [ 'src/_settings.i', 'src/_functions.i', | |
835 | 'src/_misc.i', 'src/_tipdlg.i', | |
836 | 'src/_timer.i', 'src/_log.i', | |
837 | 'src/_process.i', 'src/_joystick.i', | |
78862f24 | 838 | 'src/_sound.i', 'src/_mimetype.i', |
d14a1e28 RD |
839 | 'src/_artprov.i', 'src/_config.i', |
840 | 'src/_datetime.i', 'src/_dataobj.i', | |
96d37ab5 | 841 | 'src/_dnd.i', 'src/_display.i', |
d14a1e28 RD |
842 | 'src/_clipbrd.i', |
843 | ]) | |
844 | ext = Extension('_misc', swig_sources, | |
845 | include_dirs = includes, | |
846 | define_macros = defines, | |
847 | library_dirs = libdirs, | |
848 | libraries = libs, | |
849 | extra_compile_args = cflags, | |
850 | extra_link_args = lflags, | |
851 | depends = depends | |
852 | ) | |
853 | wxpExtensions.append(ext) | |
854 | ||
855 | ||
856 | ||
857 | ## | |
858 | ## Core modules that are not in the "core" namespace start here | |
859 | ## | |
860 | ||
1e4a197e RD |
861 | swig_sources = run_swig(['calendar.i'], 'src', GENDIR, PKGDIR, |
862 | USE_SWIG, swig_force, swig_args, swig_deps) | |
d14a1e28 RD |
863 | ext = Extension('_calendar', swig_sources, |
864 | include_dirs = includes, | |
865 | define_macros = defines, | |
866 | library_dirs = libdirs, | |
867 | libraries = libs, | |
868 | extra_compile_args = cflags, | |
869 | extra_link_args = lflags, | |
870 | depends = depends | |
871 | ) | |
872 | wxpExtensions.append(ext) | |
873 | ||
874 | ||
875 | swig_sources = run_swig(['grid.i'], 'src', GENDIR, PKGDIR, | |
876 | USE_SWIG, swig_force, swig_args, swig_deps) | |
877 | ext = Extension('_grid', swig_sources, | |
1e4a197e RD |
878 | include_dirs = includes, |
879 | define_macros = defines, | |
880 | library_dirs = libdirs, | |
881 | libraries = libs, | |
882 | extra_compile_args = cflags, | |
883 | extra_link_args = lflags, | |
d14a1e28 | 884 | depends = depends |
1e4a197e RD |
885 | ) |
886 | wxpExtensions.append(ext) | |
887 | ||
888 | ||
d14a1e28 RD |
889 | |
890 | swig_sources = run_swig(['html.i'], 'src', GENDIR, PKGDIR, | |
1e4a197e | 891 | USE_SWIG, swig_force, swig_args, swig_deps) |
d14a1e28 | 892 | ext = Extension('_html', swig_sources, |
1e4a197e RD |
893 | include_dirs = includes, |
894 | define_macros = defines, | |
895 | library_dirs = libdirs, | |
896 | libraries = libs, | |
897 | extra_compile_args = cflags, | |
898 | extra_link_args = lflags, | |
d14a1e28 | 899 | depends = depends |
1e4a197e RD |
900 | ) |
901 | wxpExtensions.append(ext) | |
902 | ||
903 | ||
d14a1e28 | 904 | |
1e4a197e RD |
905 | swig_sources = run_swig(['wizard.i'], 'src', GENDIR, PKGDIR, |
906 | USE_SWIG, swig_force, swig_args, swig_deps) | |
d14a1e28 | 907 | ext = Extension('_wizard', swig_sources, |
1e4a197e RD |
908 | include_dirs = includes, |
909 | define_macros = defines, | |
910 | library_dirs = libdirs, | |
911 | libraries = libs, | |
912 | extra_compile_args = cflags, | |
913 | extra_link_args = lflags, | |
d14a1e28 | 914 | depends = depends |
1e4a197e RD |
915 | ) |
916 | wxpExtensions.append(ext) | |
af83019e RD |
917 | |
918 | ||
96d37ab5 | 919 | #---------------------------------------------------------------------- |
d14a1e28 | 920 | |
96d37ab5 | 921 | if CONTRIBS_INC: |
4c417214 RD |
922 | CONTRIBS_INC = [ CONTRIBS_INC ] |
923 | else: | |
924 | CONTRIBS_INC = [] | |
925 | ||
d14a1e28 | 926 | |
c368d904 RD |
927 | #---------------------------------------------------------------------- |
928 | # Define the GLCanvas extension module | |
929 | #---------------------------------------------------------------------- | |
930 | ||
1e4a197e | 931 | if BUILD_GLCANVAS: |
cfe766c3 | 932 | msg('Preparing GLCANVAS...') |
c368d904 | 933 | location = 'contrib/glcanvas' |
c368d904 | 934 | |
d14a1e28 | 935 | swig_sources = run_swig(['glcanvas.i'], location, GENDIR, PKGDIR, |
10ef30eb | 936 | USE_SWIG, swig_force, swig_args, swig_deps) |
c368d904 RD |
937 | |
938 | gl_libs = [] | |
939 | if os.name == 'posix': | |
f32afe1c | 940 | gl_config = os.popen(WX_CONFIG + ' --gl-libs', 'r').read()[:-1] |
1e4a197e | 941 | gl_lflags = gl_config.split() + lflags |
f32afe1c | 942 | gl_libs = libs |
19cf4f80 | 943 | else: |
3e46a8e6 | 944 | gl_libs = libs + ['opengl32', 'glu32'] + makeLibName('gl') |
f32afe1c | 945 | gl_lflags = lflags |
c368d904 | 946 | |
d14a1e28 | 947 | ext = Extension('_glcanvas', |
3e46a8e6 | 948 | swig_sources, |
1e7ecb7b | 949 | |
4c417214 | 950 | include_dirs = includes + CONTRIBS_INC, |
1e7ecb7b RD |
951 | define_macros = defines, |
952 | ||
953 | library_dirs = libdirs, | |
f32afe1c | 954 | libraries = gl_libs, |
1e7ecb7b RD |
955 | |
956 | extra_compile_args = cflags, | |
f32afe1c | 957 | extra_link_args = gl_lflags, |
1e7ecb7b RD |
958 | ) |
959 | ||
960 | wxpExtensions.append(ext) | |
c368d904 RD |
961 | |
962 | ||
963 | #---------------------------------------------------------------------- | |
964 | # Define the OGL extension module | |
965 | #---------------------------------------------------------------------- | |
966 | ||
1e4a197e | 967 | if BUILD_OGL: |
cfe766c3 | 968 | msg('Preparing OGL...') |
c368d904 | 969 | location = 'contrib/ogl' |
c368d904 | 970 | |
a32360e0 | 971 | swig_sources = run_swig(['ogl.i'], location, GENDIR, PKGDIR, |
d14a1e28 RD |
972 | USE_SWIG, swig_force, swig_args, swig_deps + |
973 | [ '%s/_oglbasic.i' % location, | |
974 | '%s/_oglshapes.i' % location, | |
975 | '%s/_oglshapes2.i' % location, | |
976 | '%s/_oglcanvas.i' % location, | |
977 | '%s/_ogldefs.i' % location, | |
978 | ]) | |
c368d904 | 979 | |
d14a1e28 | 980 | ext = Extension('_ogl', |
3ef86e32 | 981 | swig_sources, |
1e7ecb7b | 982 | |
4c417214 | 983 | include_dirs = includes + [ location ] + CONTRIBS_INC, |
dd116e73 | 984 | define_macros = defines + [('wxUSE_DEPRECATED', '0')], |
1e7ecb7b RD |
985 | |
986 | library_dirs = libdirs, | |
3ef86e32 | 987 | libraries = libs + makeLibName('ogl'), |
1e7ecb7b RD |
988 | |
989 | extra_compile_args = cflags, | |
990 | extra_link_args = lflags, | |
991 | ) | |
992 | ||
993 | wxpExtensions.append(ext) | |
994 | ||
995 | ||
c368d904 RD |
996 | |
997 | #---------------------------------------------------------------------- | |
998 | # Define the STC extension module | |
999 | #---------------------------------------------------------------------- | |
1000 | ||
1e4a197e | 1001 | if BUILD_STC: |
cfe766c3 | 1002 | msg('Preparing STC...') |
c368d904 | 1003 | location = 'contrib/stc' |
5a2a9da2 RD |
1004 | if os.name == 'nt': |
1005 | STC_H = opj(WXDIR, 'contrib', 'include/wx/stc') | |
1006 | else: | |
1007 | STC_H = opj(WXPREFIX, 'include/wx/stc') | |
55c020cf | 1008 | |
de7b7fe6 | 1009 | ## NOTE: need to add something like this to the stc.bkl... |
55c020cf | 1010 | |
3ef86e32 RD |
1011 | ## # Check if gen_iface needs to be run for the wxSTC sources |
1012 | ## if (newer(opj(CTRB_SRC, 'stc/stc.h.in'), opj(CTRB_INC, 'stc/stc.h' )) or | |
1013 | ## newer(opj(CTRB_SRC, 'stc/stc.cpp.in'), opj(CTRB_SRC, 'stc/stc.cpp')) or | |
1014 | ## newer(opj(CTRB_SRC, 'stc/gen_iface.py'), opj(CTRB_SRC, 'stc/stc.cpp'))): | |
55c020cf | 1015 | |
3ef86e32 RD |
1016 | ## msg('Running gen_iface.py, regenerating stc.h and stc.cpp...') |
1017 | ## cwd = os.getcwd() | |
1018 | ## os.chdir(opj(CTRB_SRC, 'stc')) | |
1019 | ## sys.path.insert(0, os.curdir) | |
1020 | ## import gen_iface | |
1021 | ## gen_iface.main([]) | |
1022 | ## os.chdir(cwd) | |
c368d904 RD |
1023 | |
1024 | ||
d14a1e28 | 1025 | swig_sources = run_swig(['stc.i'], location, '', PKGDIR, |
c368d904 RD |
1026 | USE_SWIG, swig_force, |
1027 | swig_args + ['-I'+STC_H, '-I'+location], | |
10ef30eb | 1028 | [opj(STC_H, 'stc.h')] + swig_deps) |
c368d904 | 1029 | |
d14a1e28 | 1030 | ext = Extension('_stc', |
3ef86e32 RD |
1031 | swig_sources, |
1032 | ||
4c417214 | 1033 | include_dirs = includes + CONTRIBS_INC, |
3ef86e32 | 1034 | define_macros = defines, |
1e7ecb7b RD |
1035 | |
1036 | library_dirs = libdirs, | |
3ef86e32 | 1037 | libraries = libs + makeLibName('stc'), |
c368d904 | 1038 | |
1e7ecb7b RD |
1039 | extra_compile_args = cflags, |
1040 | extra_link_args = lflags, | |
1041 | ) | |
1042 | ||
1043 | wxpExtensions.append(ext) | |
c368d904 RD |
1044 | |
1045 | ||
1046 | ||
926bb76c RD |
1047 | #---------------------------------------------------------------------- |
1048 | # Define the IEWIN extension module (experimental) | |
1049 | #---------------------------------------------------------------------- | |
1050 | ||
1e4a197e | 1051 | if BUILD_IEWIN: |
cfe766c3 | 1052 | msg('Preparing IEWIN...') |
926bb76c RD |
1053 | location = 'contrib/iewin' |
1054 | ||
1055 | swig_files = ['iewin.i', ] | |
1056 | ||
1057 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
10ef30eb | 1058 | USE_SWIG, swig_force, swig_args, swig_deps) |
926bb76c RD |
1059 | |
1060 | ||
de7b7fe6 | 1061 | ext = Extension('_iewin', ['%s/IEHtmlWin.cpp' % location, |
c731eb47 | 1062 | '%s/wxactivex.cpp' % location, |
926bb76c RD |
1063 | ] + swig_sources, |
1064 | ||
4c417214 | 1065 | include_dirs = includes + CONTRIBS_INC, |
926bb76c RD |
1066 | define_macros = defines, |
1067 | ||
1068 | library_dirs = libdirs, | |
1069 | libraries = libs, | |
1070 | ||
1071 | extra_compile_args = cflags, | |
1072 | extra_link_args = lflags, | |
1073 | ) | |
1074 | ||
1075 | wxpExtensions.append(ext) | |
1076 | ||
1077 | ||
d56cebe7 RD |
1078 | #---------------------------------------------------------------------- |
1079 | # Define the XRC extension module | |
1080 | #---------------------------------------------------------------------- | |
1081 | ||
1e4a197e | 1082 | if BUILD_XRC: |
cfe766c3 | 1083 | msg('Preparing XRC...') |
d56cebe7 | 1084 | location = 'contrib/xrc' |
d56cebe7 | 1085 | |
d14a1e28 RD |
1086 | swig_sources = run_swig(['xrc.i'], location, '', PKGDIR, |
1087 | USE_SWIG, swig_force, swig_args, swig_deps + | |
1088 | [ '%s/_xrc_rename.i' % location, | |
1089 | '%s/_xrc_ex.py' % location, | |
1090 | '%s/_xmlres.i' % location, | |
1091 | '%s/_xmlsub.i' % location, | |
1092 | '%s/_xml.i' % location, | |
1093 | '%s/_xmlhandler.i' % location, | |
1094 | ]) | |
1095 | ||
1096 | ext = Extension('_xrc', | |
3ef86e32 | 1097 | swig_sources, |
1fded56b | 1098 | |
4c417214 | 1099 | include_dirs = includes + CONTRIBS_INC, |
d56cebe7 RD |
1100 | define_macros = defines, |
1101 | ||
1102 | library_dirs = libdirs, | |
3ef86e32 | 1103 | libraries = libs + makeLibName('xrc'), |
d56cebe7 RD |
1104 | |
1105 | extra_compile_args = cflags, | |
1106 | extra_link_args = lflags, | |
1107 | ) | |
1108 | ||
1109 | wxpExtensions.append(ext) | |
1110 | ||
1111 | ||
1112 | ||
ebf4302c RD |
1113 | #---------------------------------------------------------------------- |
1114 | # Define the GIZMOS extension module | |
1115 | #---------------------------------------------------------------------- | |
1116 | ||
1e4a197e | 1117 | if BUILD_GIZMOS: |
ebf4302c RD |
1118 | msg('Preparing GIZMOS...') |
1119 | location = 'contrib/gizmos' | |
ebf4302c | 1120 | |
a32360e0 | 1121 | swig_sources = run_swig(['gizmos.i'], location, GENDIR, PKGDIR, |
10ef30eb | 1122 | USE_SWIG, swig_force, swig_args, swig_deps) |
ebf4302c | 1123 | |
d14a1e28 | 1124 | ext = Extension('_gizmos', |
d84a9306 | 1125 | [ '%s/treelistctrl.cpp' % location ] + swig_sources, |
ebf4302c | 1126 | |
4c417214 | 1127 | include_dirs = includes + [ location ] + CONTRIBS_INC, |
ebf4302c RD |
1128 | define_macros = defines, |
1129 | ||
1130 | library_dirs = libdirs, | |
3ef86e32 | 1131 | libraries = libs + makeLibName('gizmos'), |
ebf4302c RD |
1132 | |
1133 | extra_compile_args = cflags, | |
1134 | extra_link_args = lflags, | |
1135 | ) | |
1136 | ||
1137 | wxpExtensions.append(ext) | |
1138 | ||
1139 | ||
1140 | ||
4a61305d RD |
1141 | #---------------------------------------------------------------------- |
1142 | # Define the DLLWIDGET extension module | |
1143 | #---------------------------------------------------------------------- | |
1144 | ||
1e4a197e | 1145 | if BUILD_DLLWIDGET: |
4a61305d RD |
1146 | msg('Preparing DLLWIDGET...') |
1147 | location = 'contrib/dllwidget' | |
1148 | swig_files = ['dllwidget_.i'] | |
1149 | ||
1150 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
10ef30eb | 1151 | USE_SWIG, swig_force, swig_args, swig_deps) |
4a61305d RD |
1152 | |
1153 | # copy a contrib project specific py module to the main package dir | |
1154 | copy_file(opj(location, 'dllwidget.py'), PKGDIR, update=1, verbose=0) | |
1155 | ||
1156 | ext = Extension('dllwidget_c', [ | |
1157 | '%s/dllwidget.cpp' % location, | |
1158 | ] + swig_sources, | |
1159 | ||
4c417214 | 1160 | include_dirs = includes + CONTRIBS_INC, |
4a61305d RD |
1161 | define_macros = defines, |
1162 | ||
1163 | library_dirs = libdirs, | |
1164 | libraries = libs, | |
1165 | ||
1166 | extra_compile_args = cflags, | |
1167 | extra_link_args = lflags, | |
1168 | ) | |
1169 | ||
1170 | wxpExtensions.append(ext) | |
1171 | ||
1172 | ||
1e4a197e RD |
1173 | |
1174 | ||
1175 | #---------------------------------------------------------------------- | |
1176 | # Tools and scripts | |
1177 | #---------------------------------------------------------------------- | |
8916d007 | 1178 | |
2eb31f8b RD |
1179 | if NO_SCRIPTS: |
1180 | SCRIPTS = None | |
1181 | else: | |
1e4a197e RD |
1182 | SCRIPTS = [opj('scripts/helpviewer'), |
1183 | opj('scripts/img2png'), | |
2eb31f8b RD |
1184 | opj('scripts/img2xpm'), |
1185 | opj('scripts/img2py'), | |
1186 | opj('scripts/xrced'), | |
1187 | opj('scripts/pyshell'), | |
1188 | opj('scripts/pycrust'), | |
1fded56b RD |
1189 | opj('scripts/pywrap'), |
1190 | opj('scripts/pywrap'), | |
1191 | opj('scripts/pyalacarte'), | |
1192 | opj('scripts/pyalamode'), | |
2eb31f8b | 1193 | ] |
4a61305d | 1194 | |
926bb76c | 1195 | |
c2079460 RD |
1196 | DATA_FILES += find_data_files('wx/tools/XRCed', '*.txt', '*.xrc') |
1197 | DATA_FILES += find_data_files('wx/py', '*.txt', '*.ico', '*.css', '*.html') | |
1fded56b | 1198 | DATA_FILES += find_data_files('wx', '*.txt', '*.css', '*.html') |
1e4a197e RD |
1199 | |
1200 | ||
c368d904 RD |
1201 | #---------------------------------------------------------------------- |
1202 | # Do the Setup/Build/Install/Whatever | |
1203 | #---------------------------------------------------------------------- | |
1204 | ||
1b62f00d | 1205 | if __name__ == "__main__": |
1e4a197e | 1206 | if not PREP_ONLY: |
d14a1e28 | 1207 | setup(name = 'wxPython', |
1b62f00d RD |
1208 | version = VERSION, |
1209 | description = DESCRIPTION, | |
1210 | long_description = LONG_DESCRIPTION, | |
1211 | author = AUTHOR, | |
1212 | author_email = AUTHOR_EMAIL, | |
1213 | url = URL, | |
851d4ac7 | 1214 | download_url = DOWNLOAD_URL, |
e2e02194 | 1215 | license = LICENSE, |
851d4ac7 RD |
1216 | platforms = PLATFORMS, |
1217 | classifiers = filter(None, CLASSIFIERS.split("\n")), | |
1218 | keywords = KEYWORDS, | |
d14a1e28 | 1219 | |
1fded56b RD |
1220 | packages = ['wxPython', |
1221 | 'wxPython.lib', | |
1222 | 'wxPython.lib.colourchooser', | |
1223 | 'wxPython.lib.editor', | |
1224 | 'wxPython.lib.mixins', | |
1fded56b | 1225 | 'wxPython.tools', |
1fded56b RD |
1226 | |
1227 | 'wx', | |
1228 | 'wx.lib', | |
1229 | 'wx.lib.colourchooser', | |
1230 | 'wx.lib.editor', | |
1231 | 'wx.lib.mixins', | |
1232 | 'wx.py', | |
1233 | 'wx.tools', | |
1234 | 'wx.tools.XRCed', | |
1b62f00d RD |
1235 | ], |
1236 | ||
1237 | ext_package = PKGDIR, | |
1238 | ext_modules = wxpExtensions, | |
8916d007 | 1239 | |
f6f98ecc | 1240 | options = { 'build' : { 'build_base' : BUILD_BASE }}, |
a541c325 | 1241 | |
b817523b | 1242 | scripts = SCRIPTS, |
c368d904 | 1243 | |
1e4a197e RD |
1244 | cmdclass = { 'install_data': smart_install_data}, |
1245 | data_files = DATA_FILES, | |
8916d007 | 1246 | |
1b62f00d | 1247 | ) |
c368d904 | 1248 | |
c368d904 | 1249 | |
c368d904 RD |
1250 | #---------------------------------------------------------------------- |
1251 | #---------------------------------------------------------------------- |