X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/016a3d4cee0ccf91904f01a89c417cdafea097d8..d136f2abf1674cb4005473509e52ef5e070cb3a0:/build/tools/build-wxwidgets.py diff --git a/build/tools/build-wxwidgets.py b/build/tools/build-wxwidgets.py index eec9109856..f04e15f1a8 100755 --- a/build/tools/build-wxwidgets.py +++ b/build/tools/build-wxwidgets.py @@ -26,6 +26,7 @@ contribDir = None options = None configure_opts = None exitWithException = True +nmakeCommand = 'nmake.exe' verbose = False @@ -54,10 +55,24 @@ def numCPUs(): return 1 # Default -def getXcodePath(): - return getoutput("xcode-select -print-path") +def getXcodePaths(): + base = getoutput("xcode-select -print-path") + return [base, base+"/Platforms/MacOSX.platform/Developer"] +def getVisCVersion(): + text = getoutput("cl.exe") + if 'Version 13' in text: + return '71' + if 'Version 15' in text: + return '90' + if 'Version 16' in text: + return '100' + # TODO: Add more tests to get the other versions... + else: + return 'FIXME' + + def exitIfError(code, msg): if code != 0: print(msg) @@ -157,6 +172,7 @@ def main(scriptName, args): global options global configure_opts global wxBuilder + global nmakeCommand scriptDir = os.path.dirname(os.path.abspath(scriptName)) wxRootDir = os.path.abspath(os.path.join(scriptDir, "..", "..")) @@ -203,6 +219,7 @@ def main(scriptName, args): "extra_make" : ("", "Extra args to pass on [n]make's command line."), "features" : ("", "A comma-separated list of wxUSE_XYZ defines on Win, or a list of configure flags on unix."), "verbose" : (False, "Print commands as they are run, (to aid with debugging this script)"), + "jom" : (False, "Use jom.exe instead of nmake for MSW builds."), } parser = optparse.OptionParser(usage="usage: %prog [options]", version="%prog 1.0") @@ -266,26 +283,26 @@ def main(scriptName, args): wxpy_configure_opts.append("--with-sdl") wxpy_configure_opts.append("--with-gnomeprint") - # Ensure that the Carbon build stays compatible back to 10.4 and - # for the Cocoa build allow running on 10.5 and newer. We only add - # them to the wxpy options because this is a hard-requirement for - # wxPython, but other cases it is optional and is left up to the - # developer. TODO: there should be a command line option to set - # the SDK... + # Try to use use lowest available SDK back to 10.5. Both Carbon and + # Cocoa builds require at least the 10.5 SDK now. We only add it to + # the wxpy options because this is a hard-requirement for wxPython, + # but other cases it is optional and is left up to the developer. + # TODO: there should be a command line option to set the SDK... if sys.platform.startswith("darwin"): - xcodePath = getXcodePath() - sdks = [ - xcodePath+"/SDKs/MacOSX10.5.sdk", - xcodePath+"/SDKs/MacOSX10.6.sdk", - xcodePath+"/SDKs/MacOSX10.7.sdk", - ] + for xcodePath in getXcodePaths(): + sdks = [ + xcodePath+"/SDKs/MacOSX10.5.sdk", + xcodePath+"/SDKs/MacOSX10.6.sdk", + xcodePath+"/SDKs/MacOSX10.7.sdk", + xcodePath+"/SDKs/MacOSX10.8.sdk", + ] - # use the lowest available sdk - for sdk in sdks: - if os.path.exists(sdk): - wxpy_configure_opts.append( - "--with-macosx-sdk=%s" % sdk) - break + # use the lowest available sdk + for sdk in sdks: + if os.path.exists(sdk): + wxpy_configure_opts.append( + "--with-macosx-sdk=%s" % sdk) + break if not options.mac_framework: if installDir and not prefixDir: @@ -329,7 +346,13 @@ def main(scriptName, args): shutil.rmtree(frameworkRootDir) if options.mac_universal_binary: - configure_opts.append("--enable-universal_binary=%s" % 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)) @@ -403,6 +426,7 @@ def main(scriptName, args): if options.wxpython: args.append("OFFICIAL_BUILD=1") + args.append("COMPILER_VERSION=%s" % getVisCVersion()) args.append("SHARED=1") args.append("MONOLITHIC=0") args.append("USE_OPENGL=1") @@ -420,8 +444,11 @@ def main(scriptName, args): args.append( "CPPFLAGS=/I%s" % os.path.join(os.environ.get("CAIRO_ROOT", ""), 'include\\cairo')) + + if options.jom: + nmakeCommand = 'jom.exe' - wxBuilder = builder.MSVCBuilder() + wxBuilder = builder.MSVCBuilder(commandName=nmakeCommand) if toolkit == "msvcProject": args = [] @@ -599,7 +626,7 @@ def main(scriptName, args): os.makedirs(packagedir) basename = os.path.basename(prefixDir.split(".")[0]) packageName = basename + "-" + getWxRelease() - packageMakerPath = getXcodePath()+"/usr/bin/packagemaker " + packageMakerPath = getXcodePaths()[0]+"/usr/bin/packagemaker " args = [] args.append("--root %s" % options.installdir) args.append("--id org.wxwidgets.%s" % basename.lower())