annotate src/portaudio/build/scons/SConscript_opts @ 89:8a15ff55d9af

Add bzip2, zlib, liblo, portaudio sources
author Chris Cannam <cannam@all-day-breakfast.com>
date Wed, 20 Mar 2013 13:59:52 +0000
parents
children
rev   line source
cannam@89 1 import os.path, sys
cannam@89 2
cannam@89 3 def _PackageOption(pkgName, default=1):
cannam@89 4 """ Allow user to choose whether a package should be used if available. This results in a commandline option use<Pkgname>,
cannam@89 5 where Pkgname is the name of the package with a capitalized first letter.
cannam@89 6 @param pkgName: Name of package.
cannam@89 7 @param default: The default value for this option ("yes"/"no").
cannam@89 8 """
cannam@89 9 return BoolOption("use%s" % pkgName[0].upper() + pkgName[1:], "use %s if available" % (pkgName), default)
cannam@89 10
cannam@89 11 def _BoolOption(opt, explanation, default=1):
cannam@89 12 """ Allow user to enable/disable a certain option. This results in a commandline option enable<Option>, where Option
cannam@89 13 is the name of the option with a capitalized first letter.
cannam@89 14 @param opt: Name of option.
cannam@89 15 @param explanation: Explanation of option.
cannam@89 16 @param default: The default value for this option (1/0).
cannam@89 17 """
cannam@89 18 return BoolOption("enable%s" % opt[0].upper() + opt[1:], explanation, default)
cannam@89 19
cannam@89 20 def _EnumOption(opt, explanation, allowedValues, default):
cannam@89 21 """ Allow the user to choose among a set of values for an option. This results in a commandline option with<Option>,
cannam@89 22 where Option is the name of the option with a capitalized first letter.
cannam@89 23 @param opt: The name of the option.
cannam@89 24 @param explanation: Explanation of option.
cannam@89 25 @param allowedValues: The set of values to choose from.
cannam@89 26 @param default: The default value.
cannam@89 27 """
cannam@89 28 assert default in allowedValues
cannam@89 29 return EnumOption("with%s" % opt[0].upper() + opt[1:], explanation, default, allowed_values=allowedValues)
cannam@89 30
cannam@89 31 def _DirectoryOption(opt, explanation, default):
cannam@89 32 """ Allow the user to configure the location for a certain directory, for instance the prefix. This results in a
cannam@89 33 commandline option which is simply the name of this option.
cannam@89 34 @param opt: The configurable directory, for instance "prefix".
cannam@89 35 @param explanation: Explanation of option.
cannam@89 36 @param default: The default value for this option.
cannam@89 37 """
cannam@89 38 return PathOption(opt, explanation, default)
cannam@89 39 # Incompatible with the latest stable SCons
cannam@89 40 # return PathOption(path, help, default, PathOption.PathIsDir)
cannam@89 41
cannam@89 42 import SCons.Errors
cannam@89 43 try:
cannam@89 44 Import("Platform", "Posix")
cannam@89 45 except SCons.Errors.UserError:
cannam@89 46 # The common objects must be exported first
cannam@89 47 SConscript("SConscript_common")
cannam@89 48 Import("Platform", "Posix")
cannam@89 49
cannam@89 50 # Expose the options as a dictionary of sets of options
cannam@89 51 opts = {}
cannam@89 52
cannam@89 53 if Platform in Posix:
cannam@89 54 opts["Installation Dirs"] = [_DirectoryOption("prefix", "installation prefix", "/usr/local")]
cannam@89 55 elif Platform in Windows:
cannam@89 56 if Platform == "cygwin":
cannam@89 57 opts["Installation Dirs"] = [_DirectoryOption("prefix", "installation prefix", "/usr/local")]
cannam@89 58
cannam@89 59 opts["Build Targets"] = [_BoolOption("shared", "create shared library"), _BoolOption("static", "create static library"),
cannam@89 60 _BoolOption("tests", "build test programs")]
cannam@89 61
cannam@89 62 apis = []
cannam@89 63 if Platform in Posix:
cannam@89 64 apis.append(_PackageOption("OSS"))
cannam@89 65 apis.append(_PackageOption("JACK"))
cannam@89 66 apis.append(_PackageOption("ALSA", Platform == "linux"))
cannam@89 67 apis.append(_PackageOption("ASIHPI", Platform == "linux"))
cannam@89 68 apis.append(_PackageOption("COREAUDIO", Platform == "darwin"))
cannam@89 69 elif Platform in Windows:
cannam@89 70 if Platform == "cygwin":
cannam@89 71 apis.append(_EnumOption("winAPI", "Windows API to use", ("wmme", "directx", "asio"), "wmme"))
cannam@89 72
cannam@89 73 opts["Host APIs"] = apis
cannam@89 74
cannam@89 75 opts["Build Parameters"] = [\
cannam@89 76 _BoolOption("debug", "compile with debug symbols"),
cannam@89 77 _BoolOption("optimize", "compile with optimization", default=0),
cannam@89 78 _BoolOption("asserts", "runtime assertions are helpful for debugging, but can be detrimental to performance",
cannam@89 79 default=1),
cannam@89 80 _BoolOption("debugOutput", "enable debug output", default=0),
cannam@89 81 # _BoolOption("python", "create Python binding"),
cannam@89 82 ("customCFlags", "customize compilation of C code", ""),
cannam@89 83 ("customCxxFlags", "customize compilation of C++ code", ""),
cannam@89 84 ("customLinkFlags", "customize linking", ""),
cannam@89 85 ]
cannam@89 86
cannam@89 87 opts["Bindings"] = [\
cannam@89 88 _BoolOption("cxx", "build Merlijn Blaauw's PA C++ wrapper", default=0)
cannam@89 89 ]
cannam@89 90
cannam@89 91 Return("opts")