예제 #1
0
def __generate_help_message():

    separator = "=" * 79 + "\n"
    # SCons gets into some kind of infinite loop if this file is imported directly
    # as it is done with EpyDoc.

    ENV = DefaultEnvironment(variables=VARS)
    msg = "SCons for Symbian arguments:\n"
    msg += separator
    msg += VARS.GenerateHelpText(ENV).replace("\n    a", " | a")
    Help(msg)

    Help(separator)
예제 #2
0
파일: config.py 프로젝트: LightningAA/godot
def configure(env):
    platform = env["platform"]

    if platform not in supported_platforms:
        raise RuntimeError(
            "This module does not currently support building for this platform"
        )

    env.add_module_version_string("mono")

    from SCons.Script import BoolVariable, PathVariable, Variables, Help

    default_mono_static = platform in ["iphone", "javascript"]
    default_mono_bundles_zlib = platform in ["javascript"]

    envvars = Variables()
    envvars.Add(
        PathVariable(
            "mono_prefix",
            "Path to the Mono installation directory for the target platform and architecture",
            "",
            PathVariable.PathAccept,
        ))
    envvars.Add(
        PathVariable(
            "mono_bcl",
            "Path to a custom Mono BCL (Base Class Library) directory for the target platform",
            "",
            PathVariable.PathAccept,
        ))
    envvars.Add(
        BoolVariable("mono_static", "Statically link Mono",
                     default_mono_static))
    envvars.Add(
        BoolVariable("mono_glue", "Build with the Mono glue sources", True))
    envvars.Add(BoolVariable("build_cil", "Build C# solutions", True))
    envvars.Add(
        BoolVariable(
            "copy_mono_root",
            "Make a copy of the Mono installation directory to bundle with the editor",
            True))

    # TODO: It would be great if this could be detected automatically instead
    envvars.Add(
        BoolVariable(
            "mono_bundles_zlib",
            "Specify if the Mono runtime was built with bundled zlib",
            default_mono_bundles_zlib))

    envvars.Update(env)
    Help(envvars.GenerateHelpText(env))

    if env["mono_bundles_zlib"]:
        # Mono may come with zlib bundled for WASM or on newer version when built with MinGW.
        print(
            "This Mono runtime comes with zlib bundled. Disabling 'builtin_zlib'..."
        )
        env["builtin_zlib"] = False
        thirdparty_zlib_dir = "#thirdparty/zlib/"
        env.Prepend(CPPPATH=[thirdparty_zlib_dir])
예제 #3
0
def generate(env, **kw):
    """ Add this builder to the 'env'.
	Called by SCons internally.
	"""
    # Check for needed builders, else add it
    if not env['BUILDERS'].has_key('Download'):
        env.Tool('download_builder', toolpath=['../scons'])
    if not env['BUILDERS'].has_key('Extract'):
        env.Tool('extract_builder', toolpath=['../scons'])

    # Add command line option to the environment
    opts = Options(None)
    opts.Add(
        PathOption('LIBS_PREFIX',
                   help='Where all libraries are installed',
                   default=os.path.join(Dir('.').abspath, 'local'),
                   validator=PathOption.PathAccept))
    opts.Update(env)
    # Generate command line help
    Help(opts.GenerateHelpText(env))

    # Init LibBuilder properties repository
    if not env.has_key('LIB_BUILDER'):
        env['LIB_BUILDER'] = dict()

    # Add this builder to the env
    env['BUILDERS']['LibBuilder'] = Builder(
        action=action,
        emitter=emitter,
        target_factory=Alias,
        source_factory=Value,
    )
예제 #4
0
파일: config.py 프로젝트: langmm/sconsx
def ALEASolution(options, tools=[], dir=[]):
    from copy import deepcopy
    SConsignFile()

    env_compiler_options = {}
    if isinstance(platform, Win32):
        # Checking for compiler info first
        compileroptions = deepcopy(options)
        compilerconf = Config([], dir)
        compilerconf.UpdateOptions(compileroptions)
        compilerenv = Environment()
        compileroptions.Update(compilerenv)
        compilerconf.Update(compilerenv)
        if compilerenv['compiler'] == 'msvc':
            if compilerenv['MSVC_VERSION'] != '':
                env_compiler_options['MSVC_VERSION'] = compilerenv[
                    'MSVC_VERSION']
                env_compiler_options['TARGET_ARCH'] = compilerenv[
                    'TARGET_ARCH']
        elif compilerenv['compiler'] == 'mingw':
            env_compiler_options['tools'] = ['mingw']
            env_compiler_options['ENV'] = {
                'PATH':
                [find_executable_path_from_env('gcc.exe', strip_bin=False)],
                'TMP': os.environ['TMP']
            }

    conf = Config(tools, dir)
    conf.UpdateOptions(options)

    if len(env_compiler_options) > 0:
        print(('Force environment with compiler options : ' +
               str(env_compiler_options)))
        env = Environment(options=options, **env_compiler_options)
    else:
        env = Environment(options=options)

    options.Update(env)
    conf.Update(env)

    Help(options.GenerateHelpText(env))

    prefix = env['build_prefix']
    VariantDir(prefix, '.')

    env.Prepend(CPPPATH='$build_includedir')
    env.Prepend(LIBPATH='$build_libdir')

    # If scons is run in a conda environment, append paths
    if CONDA_ENV:
        PREFIX = CONDA_PREFIX
        env.Prepend(CPPPATH=pj(PREFIX, 'include'))
        env.Prepend(LIBPATH=pj(PREFIX, 'lib'))

    return env
예제 #5
0
def configure(env):
    platform = env['platform']

    if platform not in supported_platforms:
        raise RuntimeError(
            'This module does not currently support building for this platform'
        )

    env.use_ptrcall = True
    env.add_module_version_string('mono')

    from SCons.Script import BoolVariable, PathVariable, Variables, Help

    default_mono_static = platform in ['iphone', 'javascript']
    default_mono_bundles_zlib = platform in ['javascript']

    envvars = Variables()
    envvars.Add(
        PathVariable(
            'mono_prefix',
            'Path to the mono installation directory for the target platform and architecture',
            '', PathVariable.PathAccept))
    envvars.Add(
        BoolVariable('mono_static', 'Statically link mono',
                     default_mono_static))
    envvars.Add(
        BoolVariable('mono_glue', 'Build with the mono glue sources', True))
    envvars.Add(
        BoolVariable(
            'copy_mono_root',
            'Make a copy of the mono installation directory to bundle with the editor',
            False))
    envvars.Add(
        BoolVariable('xbuild_fallback',
                     'If MSBuild is not found, fallback to xbuild', False))

    # TODO: It would be great if this could be detected automatically instead
    envvars.Add(
        BoolVariable(
            'mono_bundles_zlib',
            'Specify if the Mono runtime was built with bundled zlib',
            default_mono_bundles_zlib))

    envvars.Update(env)
    Help(envvars.GenerateHelpText(env))

    if env['mono_bundles_zlib']:
        # Mono may come with zlib bundled for WASM or on newer version when built with MinGW.
        print(
            'This Mono runtime comes with zlib bundled. Disabling \'builtin_zlib\'...'
        )
        env['builtin_zlib'] = False
        thirdparty_zlib_dir = "#thirdparty/zlib/"
        env.Prepend(CPPPATH=[thirdparty_zlib_dir])
예제 #6
0
def _init_environment(args):
    from numscons.core.numpyenv import NumpyEnvironment
    from SCons.Defaults import DefaultEnvironment
    from SCons.Script import Help

    opts = GetNumpyOptions(args)
    env = NumpyEnvironment(options=opts)

    set_bootstrap(env)

    # We explicily set DefaultEnvironment to avoid wasting time on initializing
    # tools a second time.
    DefaultEnvironment(tools=[])

    Help(opts.GenerateHelpText(env))

    return env
예제 #7
0
def configure(env):
    from SCons.Script import Variables, BoolVariable, Help

    opts = Variables()
    opts.Add(
        BoolVariable(
            "anl_use_long_period",
            "Use a long-period hash for noise (>256) to avoid having repeated patterns "
            "in exchange of a slight decrease in performance.", False))

    opts.Add(
        BoolVariable(
            'anl_use_expressions_camelcase',
            "Use 'camelCase' by default over the 'snake_case' for noise expressions.",
            False))
    opts.Update(env)
    Help(opts.GenerateHelpText(env))
예제 #8
0
def help_emitter(target, source, env):
    if env.has_key('default_pack') or env.has_key('problem'):
        default_pack = env.get('problem', env.get('default_pack'))
        help_name = default_pack['name']
        if help_name in help_names:
            return target, source
        else:
            help_names.add(help_name)

        Help("Help for %(help_name)s\n" % vars())
        Help("eg.\n" % vars())
        Help("Solve( target, source, problem=%(help_name)s,\n" % vars())
        Help("                       ...params... ,\n" % vars())
        Help("     )\n\n" % vars())

        keys = default_pack.keys()
        keys.sort()
        for item in keys:
            val = default_pack[item]
            if item in ['doc', 'name']:
                continue
            doc = default_pack['doc'].get(item)
            if doc is None:
                if isroutine(val):
                    doc = val.__doc__
                if doc is None:
                    doc = "No doc for %(item)s" % vars()
                else:
                    pars = getattr(val, '__additional_dependancies__', [])
                    doc = "Depends on %s\n" % pars + doc

            doc = doc.strip()
            doc = "\n\t".join([line.strip() for line in doc.split('\n')])
            if isroutine(val):
                name = (val.__name__)
                try:
                    stuff = (val.__name__, repr(getsourcefile(val)),
                             getsourcelines(val)[-1])
                except IOError:
                    val = "<function %s in ???>" % name
                else:
                    val = "<function %s in %s at line %s>" % stuff

            Help("  %(item)s: default=%(val)s" % vars())
            Help("\n\n\t%(doc)s\n\n" % vars())

    return target, source
예제 #9
0
파일: config.py 프로젝트: t-mw/godot
def configure(env):
    if env["platform"] not in [
            "windows", "osx", "linuxbsd", "server", "android", "haiku",
            "javascript"
    ]:
        raise RuntimeError(
            "This module does not currently support building for this platform"
        )

    env.use_ptrcall = True
    env.add_module_version_string("mono")

    from SCons.Script import BoolVariable, PathVariable, Variables, Help

    envvars = Variables()
    envvars.Add(
        PathVariable(
            "mono_prefix",
            "Path to the mono installation directory for the target platform and architecture",
            "",
            PathVariable.PathAccept,
        ))
    envvars.Add(BoolVariable("mono_static", "Statically link mono", False))
    envvars.Add(
        BoolVariable("mono_glue", "Build with the mono glue sources", True))
    envvars.Add(
        BoolVariable(
            "copy_mono_root",
            "Make a copy of the mono installation directory to bundle with the editor",
            False))
    envvars.Add(
        BoolVariable("xbuild_fallback",
                     "If MSBuild is not found, fallback to xbuild", False))
    envvars.Update(env)
    Help(envvars.GenerateHelpText(env))

    if env["platform"] == "javascript":
        # Mono wasm already has zlib builtin, so we need this workaround to avoid symbol collisions
        print("Compiling with Mono wasm disables 'builtin_zlib'")
        env["builtin_zlib"] = False
        thirdparty_zlib_dir = "#thirdparty/zlib/"
        env.Prepend(CPPPATH=[thirdparty_zlib_dir])
예제 #10
0
def configure(env):
    from SCons.Script import Variables, Help

    opts = Variables()

    opts.Add("geomtools_scale_factor", 
        "The precision used for converting between integer and float coordinates throughout " +
        "poly backends implementations for computational robustness purposes.", "1e5")

    opts.Update(env)
    
    def help_format(env, opt, help, default, actual, aliases):
        if opt == "geomtools_scale_factor":
            fmt = "\n%s: %s.\n    default: %s (based on CMP_EPSILON)\n    actual: %s\n"
        else:
            fmt = "\n%s: %s.\n    default: %s\n    actual: %s\n"
        return fmt % (opt, help, default, actual)
    
    opts.FormatVariableHelpText = help_format
    Help(opts.GenerateHelpText(env))
예제 #11
0
def configure(env):
    if env['platform'] not in [
            'windows', 'osx', 'linuxbsd', 'server', 'android', 'haiku',
            'javascript'
    ]:
        raise RuntimeError(
            'This module does not currently support building for this platform'
        )

    env.use_ptrcall = True
    env.add_module_version_string('mono')

    from SCons.Script import BoolVariable, PathVariable, Variables, Help

    envvars = Variables()
    envvars.Add(
        PathVariable(
            'mono_prefix',
            'Path to the mono installation directory for the target platform and architecture',
            '', PathVariable.PathAccept))
    envvars.Add(BoolVariable('mono_static', 'Statically link mono', False))
    envvars.Add(
        BoolVariable('mono_glue', 'Build with the mono glue sources', True))
    envvars.Add(
        BoolVariable(
            'copy_mono_root',
            'Make a copy of the mono installation directory to bundle with the editor',
            False))
    envvars.Add(
        BoolVariable('xbuild_fallback',
                     'If MSBuild is not found, fallback to xbuild', False))
    envvars.Update(env)
    Help(envvars.GenerateHelpText(env))

    if env['platform'] == 'javascript':
        # Mono wasm already has zlib builtin, so we need this workaround to avoid symbol collisions
        print('Compiling with Mono wasm disables \'builtin_zlib\'')
        env['builtin_zlib'] = False
        thirdparty_zlib_dir = "#thirdparty/zlib/"
        env.Prepend(CPPPATH=[thirdparty_zlib_dir])
예제 #12
0
def configure(env):
    from SCons.Script import Variables, BoolVariable, Help, Exit
    import goost

    opts = Variables()
    for name in goost.get_components():
        opts.Add(
            BoolVariable("goost_%s_enabled" % (name),
                         "Build %s component." % (name), True))

    opts.Add(
        "goost_scale_factor",
        "The precision used for converting between integer and float coordinates.",
        "1e5")

    opts.Update(env)

    # Get a list of components which got disabled.
    disabled = []
    for name in goost.get_components():
        if not env["goost_%s_enabled" % (name)]:
            disabled.append(name)

    # Implicitly disable child components.
    for name in disabled:
        children = goost.get_child_components(name)
        for child_name in children:
            print("Goost: disabling `%s` component (%s)." % (child_name, name))
            env["goost_%s_enabled" % (child_name)] = False

    def help_format(env, opt, help, default, actual, aliases):
        if opt == "goost_scale_factor":
            fmt = "\n%s: %s.\n    default: %s (based on CMP_EPSILON)\n    actual: %s\n"
        else:
            fmt = "\n%s: %s.\n    default: %s\n    actual: %s\n"
        return fmt % (opt, help, default, actual)

    opts.FormatVariableHelpText = help_format
    Help(opts.GenerateHelpText(env))
예제 #13
0
 def __add_build_vars(env, build_type_names):
     """
     Return Variables instance.
     """
     assert isinstance(env, Environment)
     vs = Variables(None, ARGUMENTS)
     vs.Add(
         ListVariable(key='build',
                      help=buildtype.help_msg(build_type_names),
                      default=buildtype.default(build_type_names),
                      names=build_type_names,
                      map={}))
     vs.Add(
         EnumVariable(key='stage',
                      help='build stage',
                      default='compile',
                      allowed_values=('compile', 'link'),
                      map={},
                      ignorecase=0))
     vs.Update(env)
     Help(vs.GenerateHelpText(env))
     pass
예제 #14
0
파일: config.py 프로젝트: goostengine/goost
def configure(env):
    from SCons.Script import Variables, BoolVariable, Help

    opts = Variables()

    # Config.
    components_config = {}
    components_enabled_by_default = True
    classes_config = {}
    classes_enabled_by_default = True

    # From `custom.py` file.
    try:
        import custom
        if hasattr(custom, "components"):
            components_config = custom.components
        if hasattr(custom, "components_enabled_by_default"):
            components_enabled_by_default = custom.components_enabled_by_default
        if hasattr(custom, "classes"):
            classes_config = custom.classes
        if hasattr(custom, "classes_enabled_by_default"):
            classes_enabled_by_default = custom.classes_enabled_by_default
    except ImportError:
        pass

    # From command-line (CLI arguments override arguments specified via file).
    opts.Add(
        BoolVariable(
            "goost_components_enabled",
            "Set to `no` to disable all components by default, and enable each component of interest manually",
            True))

    # Get a list of all components and add them, regardless of configuration.
    for name in goost.get_components()["enabled"]:  # All enabled by default.
        opts.Add(
            BoolVariable("goost_%s_enabled" % (name),
                         "Build %s component." % (name), True))

    # Math/Geometry.
    opts.Add(
        "goost_scale_factor",
        "The precision used for converting between integer and float coordinates.",
        "1e5")

    def help_format(env, opt, help, default, actual, aliases):
        if opt == "goost_scale_factor":
            fmt = "\n%s: %s.\n    default: %s (based on CMP_EPSILON)\n    actual: %s\n"
        else:
            fmt = "\n%s: %s.\n    default: %s\n    actual: %s\n"
        return fmt % (opt, help, default, actual)

    opts.FormatVariableHelpText = help_format

    # Must update environment to override `components_config` from CLI/file.
    # Do not call this method afterwards as the environment is going to be
    # updated manually. If you need to add more options not related to
    # components/classes, add them above.
    opts.Update(env)

    components = configure_components(env, components_config,
                                      components_enabled_by_default)
    classes = configure_classes(env, classes_config,
                                classes_enabled_by_default)

    if env["verbose"]:
        for class_name in classes["enabled"]:
            # Report rightmost child components only.
            for component_name in reversed(
                    goost.get_class_components(class_name)):
                skip = False
                if component_name in components["disabled"]:
                    print(
                        "Goost: Skipping class `%s`, because component `%s` is disabled."
                        % (class_name, component_name))
                    skip = True
                if skip:
                    break

    # Generate help text.
    Help(opts.GenerateHelpText(env))
예제 #15
0
def CreateEnvironment(vars):

    # add a variable to handle RELEASE/DEBUG mode
    vars.Add(
        EnumVariable('mode',
                     'Release versus debug mode',
                     'debug',
                     allowed_values=('release', 'debug')))

    # add a variable to handle warnings
    vars.Add(BoolVariable('Wall', 'Enable all compilation warnings', 1))

    # shared or static libraries
    libraryDefault = 'shared'

    vars.Add(
        EnumVariable('library',
                     'Build shared or static library',
                     libraryDefault,
                     allowed_values=('shared', 'static')))

    # add a variable to treat warnings as errors
    vars.Add(BoolVariable('Werror', 'Treat warnings as errors', 1))

    # add a variable to determine the install path
    default_install_path = '/usr/local'

    if 'LIBCUXX_INSTALL_PATH' in os.environ:
        default_install_path = os.environ['LIBCUXX_INSTALL_PATH']

    vars.Add(
        PathVariable('install_path', 'The libcuxx install path',
                     default_install_path, PathVariable.PathIsDirCreate))

    vars.Add(
        BoolVariable(
            'install', 'Include libcuxx install path in default '
            'targets that will be built and configure to install in the '
            'install_path (defaults to false unless one of the targets is '
            '"install")', 0))

    # create an Environment
    env = Environment(ENV = importEnvironment(), \
     tools = getTools(), variables = vars)

    updateEnvironment(env)

    # set the version
    env.Replace(VERSION=getVersion("0.1"))

    # always link with the c++ compiler
    if os.name != 'nt':
        env['LINK'] = env['CXX']

    # get C compiler switches
    env.AppendUnique(CFLAGS = getCFLAGS(env['mode'], env['Wall'], \
     env['Werror'], env.subst('$CC')))

    # get CXX compiler switches
    env.AppendUnique(CXXFLAGS = getCXXFLAGS(env['mode'], env['Wall'], \
     env['Werror'], env.subst('$CXX')))

    # get linker switches
    env.AppendUnique(LINKFLAGS=getLINKFLAGS(env['mode'], env.subst('$LINK')))

    # Install paths
    if env['install']:
        env.Replace(INSTALL_PATH=os.path.abspath(env['install_path']))
    else:
        env.Replace(INSTALL_PATH=os.path.abspath('.'))

    # set the build path
    env.Replace(BUILD_ROOT=str(env.Dir('.')))
    env.Replace(CPPPATH=[env['BUILD_ROOT']])

    # get libc++
    if env['CXX'] == 'c++':
        env.AppendUnique(CPPPATH=[getLibCXXPaths()[0]])

    # set extra libs
    env.Replace(EXTRA_LIBS=getExtraLibs())

    # set libcuxx include path
    env.AppendUnique(LIBPATH=os.path.abspath('.'))

    # we need librt on linux
    if sys.platform == 'linux2':
        env.AppendUnique(EXTRA_LIBS=['-lrt'])

    # we need libdl on max and linux
    if os.name != 'nt':
        env.AppendUnique(EXTRA_LIBS=['-ldl'])

    # generate help text
    Help(vars.GenerateHelpText(env))

    return env