Various fixes for the build on Windows

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@69080 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2011-09-14 06:50:09 +00:00
parent 3b087917bf
commit e54ba50b49
7 changed files with 64 additions and 32 deletions

View File

@@ -1,9 +1,8 @@
#!/usr/bin/python
#---------------------------------------------------------------------------
# A simple wrapper script that assists with the building of the project for
# day-to-day development work. Instead of needing to remember lots of
# commands and options for setup.py or build-wxpython.py this script uses
# some defaults that are good for development (debug mode, etc.)
# This script is used to run through the commands used for the various stages
# of building Phoenix, and can also be a front-end for building wxWidgets and
# the Python extension mocdules.
#---------------------------------------------------------------------------
import sys
@@ -41,7 +40,7 @@ Usage: ./build.py [command(s)] [options]
Commands:
N.N NN Major.Minor version number of the Python to use to run
the other commands. Default is 2.6
the other commands. Default is 2.7
dox Run Doxygen to produce the XML file used by ETG scripts
doxhtml Run Doxygen to create the HTML documetation for wx
touch 'touch' the etg files so they will all get run in the
@@ -177,7 +176,6 @@ def setDevModeOptions(args):
# it inserts into the args list being consistent. They could change at any
# update from the repository.
myDevModeOptions = [
'--sip',
'--build_dir=../bld',
'--prefix=/opt/wx/2.9',
@@ -233,7 +231,6 @@ def getMSWSettings(options):
def makeOptionParser():
OPTS = [
("debug", (False, "Build wxPython with debug symbols")),
("sip", (False, "Allow SIP to regenerate the wrappers if needed")),
("osx_cocoa", (True, "Build the OSX Cocoa port on Mac (default)")),
("osx_carbon", (False, "Build the OSX Carbon port on Mac")),
("mac_framework", (False, "Build wxWidgets as a Mac framework.")),
@@ -376,6 +373,7 @@ def sip(options, args):
cfg = Config()
for src_name in glob.glob(opj(cfg.SIPGEN, '_*.sip')):
tmpdir = tempfile.mkdtemp()
tmpdir = tmpdir.replace('\\', '/')
src_name = src_name.replace('\\', '/')
base = os.path.basename(os.path.splitext(src_name)[0])
sbf = posixjoin(cfg.SIPOUT, base) + '.sbf'
@@ -550,8 +548,6 @@ def build_py(options, args):
if options.debug or (isWindows and options.both):
build_options.append("--debug")
if options.sip:
build_options.append('USE_SIP=1')
if isDarwin and options.mac_arch:
build_options.append("ARCH=%s" % options.mac_arch)

View File

@@ -45,7 +45,6 @@ else:
class Configuration(object):
USE_SIP = False # Can we run sip?
SIP = SIPdefault # Where is the sip binary?
SIPINC = 'sip/siplib' # Use our local copy of sip.h
SIPGEN = 'sip/gen' # Where the generated .sip files go

View File

@@ -232,23 +232,7 @@ class MyUnixCCompiler(distutils.unixccompiler.UnixCCompiler):
self.spawn(compiler_so + cc_args + [src, '-o', obj] +
extra_postargs)
except DistutilsExecError, msg:
raise CompileError, msg
def _setup_compile(self, outdir, macros, incdirs, sources, depends, extra):
m = distutils.ccompiler.CCompiler._setup_compile
macros, objects, extra, pp_opts, build = \
m(self, outdir, macros, incdirs, sources, depends, extra)
# Remove items from the build collection that don't need to be built
# because their obj file is newer than the source fle and any other
# dependencies.
for obj in objects:
src, ext = build[obj]
if not newer_group([src] + depends, obj):
del build[obj]
return macros, objects, extra, pp_opts, build
raise CompileError, msg
_orig_parse_makefile = distutils.sysconfig.parse_makefile
def _parse_makefile(filename, g=None):
@@ -271,6 +255,27 @@ distutils.unixccompiler._darwin_compiler = _darwin_compiler_fixup_24
distutils.sysconfig.parse_makefile = _parse_makefile
# Inject a little code into the CCompiler class that will check if the object
# file is up to date with respect to its source file and any other
# dependencies associated with the extentension. If so then it is removed from
# the collection of files to build.
_orig_setup_compile = distutils.ccompiler.CCompiler._setup_compile
def _setup_compile(self, outdir, macros, incdirs, sources, depends, extra):
print 'hello'
macros, objects, extra, pp_opts, build = \
_orig_setup_compile(self, outdir, macros, incdirs, sources, depends, extra)
# Remove items from the build collection that don't need to be built
# because their obj file is newer than the source fle and any other
# dependencies.
for obj in objects:
src, ext = build[obj]
if not newer_group([src] + depends, obj):
del build[obj]
return macros, objects, extra, pp_opts, build
distutils.ccompiler.CCompiler._setup_compile = _setup_compile
#----------------------------------------------------------------------
# Another hack-job for the CygwinCCompiler class, this time replacing
# the _compile function with one that will pass the -I flags to windres.
@@ -399,8 +404,6 @@ class etgsip_build_ext(build_ext):
def _sip_compile(self, sip_bin, source, sbf):
cfg = Config()
if not cfg.USE_SIP:
return
other_opts = []
base = os.path.basename(source)

View File

@@ -37,8 +37,24 @@ def run():
c.find('wxBitmap').findOverload('(const char *const *bits)').ignore()
c.find('wxBitmap.type').default = 'wxBITMAP_TYPE_ANY'
c.find('GetHandlers').ignore()
c.find('LoadFile.type').default = 'wxBITMAP_TYPE_ANY'
# On MSW the handler classes are different than what is documented, and
# this causes compile errors. Nobody has needed them from Python thus far,
# so just ignore them all for now.
for m in c.find('FindHandler').all():
m.ignore()
c.find('AddHandler').ignore()
c.find('CleanUpHandlers').ignore()
c.find('GetHandlers').ignore()
c.find('InsertHandler').ignore()
c.find('RemoveHandler').ignore()
# This one is called from the wx startup code, it's not needed in Python
# so nuke it too since we're nuking all the others.
c.find('InitStandardHandlers').ignore()
module.find('wxBitmapHandler').ignore()
#module.addItem(tools.wxListWrapperTemplate('wxList', 'wxBitmapHandler'))
#-----------------------------------------------------------------

View File

@@ -32,6 +32,12 @@ def run():
# Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings.
c = module.find('wxImageList')
assert isinstance(c, etgtools.ClassDef)
c.addPrivateCopyCtor()
c.addPrivateAssignOp()
#-----------------------------------------------------------------
tools.doCommonTweaks(module)
tools.addGetterSetterProps(module)

View File

@@ -36,6 +36,20 @@ def run():
c.find('IgnoreAppBuildSubDirs').ignore()
c.find('MSWGetShellDir').ignore()
c.find('SetInstallPrefix').setCppCode("""\
#ifdef __WXMSW__
#else
sipCpp->SetInstallPrefix(*prefix);
#endif
""")
c.find('GetInstallPrefix').setCppCode("""\
#ifdef __WXMSW__
sipRes = new wxString;
#else
sipRes = new wxString(sipCpp->GetInstallPrefix());
#endif
""")
#-----------------------------------------------------------------
tools.doCommonTweaks(module)
tools.addGetterSetterProps(module)

View File

@@ -139,8 +139,6 @@ extensions.append(
))
etg = loadETG('etg/_core.py')
ext = Extension('_core', getEtgSipCppFiles(etg) + rc_file,
depends = getEtgSipHeaders(etg),