mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-05 03:20:08 +01:00
Some tweaks to fix multi-architecture builds on maxOS
This commit is contained in:
11
build.py
11
build.py
@@ -1450,8 +1450,14 @@ def cmd_build_wx(options, args):
|
|||||||
|
|
||||||
if not os.path.exists(BUILD_DIR):
|
if not os.path.exists(BUILD_DIR):
|
||||||
os.makedirs(BUILD_DIR)
|
os.makedirs(BUILD_DIR)
|
||||||
if isDarwin and options.mac_arch:
|
if isDarwin:
|
||||||
|
if options.osx_cocoa:
|
||||||
|
build_options.append("--osx_cocoa")
|
||||||
|
|
||||||
|
if options.mac_arch:
|
||||||
build_options.append("--mac_universal_binary=%s" % options.mac_arch)
|
build_options.append("--mac_universal_binary=%s" % options.mac_arch)
|
||||||
|
else:
|
||||||
|
build_options.append("--mac_universal_binary=default")
|
||||||
|
|
||||||
if options.no_config:
|
if options.no_config:
|
||||||
build_options.append('--no_config')
|
build_options.append('--no_config')
|
||||||
@@ -1468,9 +1474,6 @@ def cmd_build_wx(options, args):
|
|||||||
else:
|
else:
|
||||||
build_options.append("--no_config")
|
build_options.append("--no_config")
|
||||||
|
|
||||||
if isDarwin and options.osx_cocoa:
|
|
||||||
build_options.append("--osx_cocoa")
|
|
||||||
|
|
||||||
#if options.install:
|
#if options.install:
|
||||||
# build_options.append('--installdir=%s' % DESTDIR)
|
# build_options.append('--installdir=%s' % DESTDIR)
|
||||||
# build_options.append("--install")
|
# build_options.append("--install")
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ def main(wxDir, args):
|
|||||||
"gtk3" : (True, "On Linux build for gtk3"),
|
"gtk3" : (True, "On Linux build for gtk3"),
|
||||||
"mac_distdir" : (None, "If set on Mac, will create an installer package in the specified dir."),
|
"mac_distdir" : (None, "If set on Mac, will create an installer package in the specified dir."),
|
||||||
"mac_universal_binary"
|
"mac_universal_binary"
|
||||||
: ("", "Comma separated list of architectures to include in the Mac universal binary"),
|
: ("default", "Comma separated list of architectures to include in the Mac universal binary"),
|
||||||
"mac_framework" : (False, "Install the Mac build as a framework"),
|
"mac_framework" : (False, "Install the Mac build as a framework"),
|
||||||
"mac_framework_prefix"
|
"mac_framework_prefix"
|
||||||
: (defFwPrefix, "Prefix where the framework should be installed. Default: %s" % defFwPrefix),
|
: (defFwPrefix, "Prefix where the framework should be installed. Default: %s" % defFwPrefix),
|
||||||
@@ -292,25 +292,50 @@ def main(wxDir, args):
|
|||||||
"--enable-autoidman",
|
"--enable-autoidman",
|
||||||
]
|
]
|
||||||
|
|
||||||
if sys.platform.startswith("darwin"):
|
if not sys.platform.startswith("darwin"):
|
||||||
#wxpy_configure_opts.append("--enable-monolithic")
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
wxpy_configure_opts.append("--with-sdl")
|
wxpy_configure_opts.append("--with-sdl")
|
||||||
|
|
||||||
# Set the minimum supported OSX version.
|
|
||||||
# TODO: Add a CLI option to set this.
|
|
||||||
if sys.platform.startswith("darwin"):
|
if sys.platform.startswith("darwin"):
|
||||||
|
universalCapable = False
|
||||||
|
|
||||||
|
# Set the minimum supported OSX version.
|
||||||
|
# TODO: Add a CLI option to set this.
|
||||||
wxpy_configure_opts.append("--with-macosx-version-min=10.10")
|
wxpy_configure_opts.append("--with-macosx-version-min=10.10")
|
||||||
# for xcodePath in getXcodePaths():
|
|
||||||
# sdks = [ xcodePath+"/SDKs/MacOSX10.{}.sdk".format(n)
|
# find the newest SDK available on this system
|
||||||
# for n in range(9, 15) ]
|
SDK = 'none found'
|
||||||
# # use the lowest available sdk on the build machine
|
for xcodePath in getXcodePaths():
|
||||||
# for sdk in sdks:
|
possibles = [(major, minor) for major in [10, 11, 12] for minor in range(16)]
|
||||||
# if os.path.exists(sdk):
|
for major, minor in reversed(possibles):
|
||||||
# wxpy_configure_opts.append(
|
sdk = os.path.join(xcodePath, "SDKs/MacOSX{}.{}.sdk".format(major, minor))
|
||||||
# "--with-macosx-sdk=%s" % sdk)
|
if os.path.exists(sdk):
|
||||||
# break
|
wxpy_configure_opts.append("--with-macosx-sdk=%s" % sdk)
|
||||||
|
universalCapable = major >= 11
|
||||||
|
SDK = sdk
|
||||||
|
break
|
||||||
|
|
||||||
|
# Now cross check that if a universal build was requested that it's
|
||||||
|
# possible to do with the selected SDK.
|
||||||
|
arch = ''
|
||||||
|
if options.mac_universal_binary:
|
||||||
|
if options.mac_universal_binary == 'default':
|
||||||
|
if universalCapable:
|
||||||
|
arch = "arm64,x86_64"
|
||||||
|
else:
|
||||||
|
arch = "x86_64"
|
||||||
|
else:
|
||||||
|
# otherwise assume the user klnows what they are doing and just use what they gave us.
|
||||||
|
arch = options.mac_universal_binary
|
||||||
|
configure_opts.append("--enable-universal_binary=%s" % arch)
|
||||||
|
|
||||||
|
print("SDK Path: {}".format(SDK))
|
||||||
|
print("Universal Capable: {}".format(universalCapable))
|
||||||
|
print("Architectures: {}".format(arch))
|
||||||
|
|
||||||
|
# Using 'builtin' has problems with universal builds, make sure to
|
||||||
|
# force use of system regex library in case configure would
|
||||||
|
# otherwise try to use builtin
|
||||||
|
# wxpy_configure_opts.append("--with-regex=sys")
|
||||||
|
|
||||||
if not options.mac_framework:
|
if not options.mac_framework:
|
||||||
if installDir and not prefixDir:
|
if installDir and not prefixDir:
|
||||||
@@ -353,16 +378,6 @@ def main(wxDir, args):
|
|||||||
if os.path.exists(frameworkRootDir):
|
if os.path.exists(frameworkRootDir):
|
||||||
shutil.rmtree(frameworkRootDir)
|
shutil.rmtree(frameworkRootDir)
|
||||||
|
|
||||||
if options.mac_universal_binary:
|
|
||||||
if options.mac_universal_binary == 'default':
|
|
||||||
if options.osx_cocoa:
|
|
||||||
configure_opts.append("--enable-universal_binary=i386,x86_64")
|
|
||||||
else:
|
|
||||||
configure_opts.append("--enable-universal_binary")
|
|
||||||
else:
|
|
||||||
configure_opts.append("--enable-universal_binary=%s" % options.mac_universal_binary)
|
|
||||||
|
|
||||||
|
|
||||||
print("Configure options: " + repr(configure_opts))
|
print("Configure options: " + repr(configure_opts))
|
||||||
wxBuilder = builder.AutoconfBuilder()
|
wxBuilder = builder.AutoconfBuilder()
|
||||||
if not options.no_config and not options.clean:
|
if not options.no_config and not options.clean:
|
||||||
@@ -604,13 +619,13 @@ def main(wxDir, args):
|
|||||||
|
|
||||||
# put info about the framework into wx-config
|
# put info about the framework into wx-config
|
||||||
os.chdir(frameworkRootDir)
|
os.chdir(frameworkRootDir)
|
||||||
text = file('lib/wx/config/%s' % configname).read()
|
text = open('lib/wx/config/%s' % configname).read()
|
||||||
text = text.replace("MAC_FRAMEWORK=", "MAC_FRAMEWORK=%s" % getFrameworkName(options))
|
text = text.replace("MAC_FRAMEWORK=", "MAC_FRAMEWORK=%s" % getFrameworkName(options))
|
||||||
if options.mac_framework_prefix not in ['/Library/Frameworks',
|
if options.mac_framework_prefix not in ['/Library/Frameworks',
|
||||||
'/System/Library/Frameworks']:
|
'/System/Library/Frameworks']:
|
||||||
text = text.replace("MAC_FRAMEWORK_PREFIX=",
|
text = text.replace("MAC_FRAMEWORK_PREFIX=",
|
||||||
"MAC_FRAMEWORK_PREFIX=%s" % options.mac_framework_prefix)
|
"MAC_FRAMEWORK_PREFIX=%s" % options.mac_framework_prefix)
|
||||||
file('lib/wx/config/%s' % configname, 'w').write(text)
|
open('lib/wx/config/%s' % configname, 'w').write(text)
|
||||||
|
|
||||||
# The framework is finished!
|
# The framework is finished!
|
||||||
print("wxWidgets framework created at: " +
|
print("wxWidgets framework created at: " +
|
||||||
|
|||||||
Reference in New Issue
Block a user