示例#1
0
def get_option_parser():
    """Return option parser for command line options and arguments.

    Returns:
        OptionParser
    """

    usage = """eval $(bde_setwafenv.py [set|list|unset] [-i INSTALL_DIR]
                     [-c COMPILER] [-t UFID])

set:   set environment variables (default)
list:  list available compilers
unset: unset environment variables"""
    parser = optparse.OptionParser(usage=usage)

    options = [
        (('c', 'compiler'),
         {'type': 'string',
          'default': None,
          'help': 'compiler'}),
        (('i', 'install-dir'),
         {'type': 'string',
          'default': None,
          'help': 'install directory'}),
        (('debug-opt-keys',),
         {'type': 'string',
          'default': None,
          'help': 'debug rules in the opts files for the specified '
                  '(comma separated) list of opts keys'})
    ]
    options += optionsutil.get_ufid_cmdline_options()
    cmdlineutil.add_options(parser, options)

    return parser
示例#2
0
def get_option_parser():
    """Return option parser for command line options and arguments.

    Returns:
        OptionParser
    """

    usage = """eval $(bde_build_env.py [set|list|unset]
                     [-c COMPILER] 
                     [-t UFID]
                     [-b BUILD_DIR]
                     [-i INSTALL_DIR])

set  : set environment variables (default)
unset: unset environment variables

list : list available compilers in the following order:
    1. Compilers found in the user configuration file ($HOME/.bdecompilerconfig)
    2. Compilers found in the system configuration file ($BDE_ROOT/etc/bdecompilerconfig)
    3. gcc and clang compilers detected on $PATH"""

    parser = optparse.OptionParser(usage=usage)

    options = [(('c', 'compiler'), {
        'type': 'string',
        'default': None,
        'help': 'compiler'
    }),
               (('i', 'install-dir'), {
                   'type': 'string',
                   'default': None,
                   'help': 'install directory'
               }),
               (('b', 'build-dir'), {
                   'type': 'string',
                   'default': None,
                   'help': 'build directory'
               })]
    options += optionsutil.get_ufid_cmdline_options()
    cmdlineutil.add_options(parser, options)

    return parser
示例#3
0
def get_option_parser():
    """Return option parser for command line options and arguments.

    Returns:
        OptionParser
    """

    usage = """eval $(bde_setwafenv.py [set|list|unset] [-i INSTALL_DIR]
                     [-c COMPILER] [-t UFID])

set:   set environment variables (default)
list:  list available compilers
unset: unset environment variables"""
    parser = optparse.OptionParser(usage=usage)

    options = [(('c', 'compiler'), {
        'type': 'string',
        'default': None,
        'help': 'compiler'
    }),
               (('i', 'install-dir'), {
                   'type': 'string',
                   'default': None,
                   'help': 'install directory'
               }),
               (('debug-opt-keys', ), {
                   'type':
                   'string',
                   'default':
                   None,
                   'help':
                   'debug rules in the opts files for the specified '
                   '(comma separated) list of opts keys'
               })]
    options += optionsutil.get_ufid_cmdline_options()
    cmdlineutil.add_options(parser, options)

    return parser
示例#4
0
def add_cmdline_options(ctx):
    """Add custom command-line options to an option context.

    Args:
        ctx (OptionContext): The option context.

    Returns:
        None
    """
    def print_version(option, opt, value, parser):
        print('BDE Tools version: %s' % BDE_TOOLS_VERSION)
        sys.exit(0)

    ctx.add_option('--bde-tools-version',
                   action='callback',
                   callback=print_version)

    configure_opts = [
        (('verify', ), {
            'action': 'store_true',
            'default': False,
            'help': 'perform additional checks to verify repository structure'
        }),
        (('use-dpkg-install', ), {
            'action':
            'store_true',
            'default':
            False,
            'help':
            "configure install options according to dpkg "
            "conventions (this options supercedes the options "
            "'use-flat-include-dir', 'libdir', and 'lib-suffix')"
        }),
        (('use-flat-include-dir', ), {
            'action':
            'store_true',
            'default':
            False,
            'help':
            'install all headers into $PREFIX/include '
            'instead of $PREFIX/include/<package_group>, and '
            'change .pc files accordingly'
        }),
        (('libdir', ), {
            'type':
            'string',
            'default':
            'lib',
            'dest':
            'libdir',
            'help':
            'the name of the directory under $PREFIX where '
            'library files are installed [default: %default]'
        }),
        (('bindir', ), {
            'type':
            'string',
            'default':
            'bin',
            'dest':
            'bindir',
            'help':
            'the name of the directory under $PREFIX where '
            'binaries are installed [default: %default]'
        }),
        (('lib-suffix', ), {
            'type':
            'string',
            'default':
            '',
            'help':
            '(deprecated) add a suffix to the names of the package '
            'group library files being built [default: %default]'
        }),
        (('debug-opt-keys', ), {
            'type':
            'string',
            'default':
            None,
            'help':
            'debug rules in the opts files for the specified '
            '(comma separated) list of opts keys'
        }),
        (('werror', ), {
            'choices': ('none', 'cpp'),
            'default':
            None,
            'help':
            'whether to treat all compiler warning as errors when '
            'building with clang or gcc (cpp/none). '
            "none: don't enable -Werror, "
            'cpp: enable -Werror for .cpp files but not .t.cpp files '
            '[default value depends on compiler]'
        })
    ]
    configure_group = ctx.get_option_group('configure options')
    configure_opts = optionsutil.get_ufid_cmdline_options() + configure_opts
    cmdlineutil.add_options(configure_group, configure_opts)

    waf_platform = Utils.unversioned_sys_platform()
    if waf_platform == 'win32':
        win_opts = [(('msvc-runtime-type', ), {
            'choices': ('static', 'dynamic'),
            'default':
            'dynamic',
            'help':
            'whether to build using the static or dynamic version '
            'of the C run-time library on Windows '
            '[default: %default]'
        })]
        cmdlineutil.add_options(configure_group, win_opts)

    install_group = ctx.get_option_group(
        'Installation and uninstallation options')
    install_opts = [
        (('install-dep', ), {
            'choices': ('yes', 'no'),
            'default':
            'yes',
            'help':
            'when doing a targeted install, whether to also '
            'install the dependencies of the targets (yes/no) '
            '[default: %default]'
        }),
        (('install-parts', ), {
            'choices': ('all', 'lib', 'bin', 'h', 'pc'),
            'default':
            'all',
            'help':
            'what parts to install (all/h/lib/pc). '
            'all -- everything, '
            'lib -- lib files only, '
            'bin - executable files only, '
            'h -- header files only, '
            'pc -- pkg-config files only '
            '[default: %default]'
        }),
    ]
    cmdlineutil.add_options(install_group, install_opts)

    build_group = ctx.get_option_group('build and install options')
    build_opts = [(('clang-compilation-database', ), {
        'action':
        'store_true',
        'default':
        False,
        'help':
        'Generate a clang compilation database '
        '(compile_commands.json) in the build output directory'
    })]
    cmdlineutil.add_options(build_group, build_opts)

    # Set the upper bound of the default number of jobs to 24
    jobs = ctx.parser.get_option('-j').default
    if jobs > 24:
        jobs = 24
        ctx.parser.remove_option('-j')
        ctx.parser.add_option('-j',
                              '--jobs',
                              dest='jobs',
                              default=jobs,
                              type='int',
                              help='amount of parallel jobs (%r)' % jobs)
示例#5
0
def add_cmdline_options(ctx):
    """Add custom command-line options to an option context.

    Args:
        ctx (OptionContext): The option context.

    Returns:
        None
    """
    def print_version(option, opt, value, parser):
        print('BDE Tools version: %s' % BDE_TOOLS_VERSION)
        sys.exit(0)

    ctx.add_option('--bde-tools-version',
                   action='callback', callback=print_version)

    configure_opts = [
        (('verify',),
         {'action': 'store_true',
          'default': False,
          'help': 'perform additional checks to verify repository structure'}),
        (('use-dpkg-install',),
         {'action': 'store_true',
          'default': False,
          'help': "configure install options according to dpkg "
                  "conventions (this options supercedes the options "
                  "'use-flat-include-dir', 'libdir', and 'lib-suffix')"}),
        (('use-flat-include-dir',),
         {'action': 'store_true',
          'default': False,
          'help': 'install all headers into $PREFIX/include '
                  'instead of $PREFIX/include/<package_group>, and '
                  'change .pc files accordingly'}),
        (('libdir',),
         {'type': 'string',
          'default': 'lib',
          'dest': 'libdir',
          'help': 'the name of the directory under $PREFIX where '
                  'library files are installed [default: %default]'}),
        (('bindir',),
         {'type': 'string',
          'default': 'bin',
          'dest': 'bindir',
          'help': 'the name of the directory under $PREFIX where '
                  'binaries are installed [default: %default]'}),
        (('lib-suffix',),
         {'type': 'string',
          'default': '',
          'help': '(deprecated) add a suffix to the names of the package '
                  'group library files being built [default: %default]'}),
        (('debug-opt-keys',),
         {'type': 'string',
          'default': None,
          'help': 'debug rules in the opts files for the specified '
                  '(comma separated) list of opts keys'}),
    ]
    configure_group = ctx.get_option_group('configure options')
    configure_opts = optionsutil.get_ufid_cmdline_options() + configure_opts
    cmdlineutil.add_options(configure_group, configure_opts)

    waf_platform = Utils.unversioned_sys_platform()
    if waf_platform == 'win32':
        win_opts = [
            (('msvc-runtime-type',),
             {'choices': ('static', 'dynamic'),
              'default': 'dynamic',
              'help': 'whether to build using the static or dynamic version '
                      'of the C run-time library on Windows '
                      '[default: %default]'})
        ]
        cmdlineutil.add_options(configure_group, win_opts)

    install_group = ctx.get_option_group(
        'Installation and uninstallation options')
    install_opts = [
        (('install-dep',),
         {'choices': ('yes', 'no'),
          'default': 'yes',
          'help': 'when doing a targeted install, whether to also '
                  'install the dependencies of the targets (yes/no) '
                  '[default: %default]'}),
        (('install-parts',),
         {'choices': ('all', 'lib', 'bin', 'h', 'pc'),
          'default': 'all',
          'help': 'what parts to install (all/h/lib/pc). '
                  'all -- everything, '
                  'lib -- lib files only, '
                  'bin - executable files only, '
                  'h -- header files only, '
                  'pc -- pkg-config files only '
                  '[default: %default]'}),
    ]
    cmdlineutil.add_options(install_group, install_opts)

    build_group = ctx.get_option_group('build and install options')
    build_opts = [
        (('clang-compilation-database',),
         {'action': 'store_true',
          'default': False,
          'help': 'Generate a clang compilation database '
                  '(compile_commands.json) in the build output directory'})
    ]
    cmdlineutil.add_options(build_group, build_opts)

    # Set the upper bound of the default number of jobs to 24
    jobs = ctx.parser.get_option('-j').default
    if jobs > 24:
        jobs = 24
        ctx.parser.remove_option('-j')
        ctx.parser.add_option('-j', '--jobs',
                              dest='jobs',
                              default=jobs,
                              type='int',
                              help='amount of parallel jobs (%r)' % jobs)
示例#6
0
def add_cmdline_options(ctx):
    """Add custom command-line options to an option context.

    Args:
        ctx (OptionContext): The option context.

    Returns:
        None
    """

    configure_opts = [
        (('verify', ), {
            'action': 'store_true',
            'default': False,
            'help': 'perform additional checks to verify repository structure'
        }),
        (('use-dpkg-install', ), {
            'action':
            'store_true',
            'default':
            False,
            'help':
            "configure install options according to dpkg "
            "conventions (this options supercedes the options "
            "'use-flat-include-dir', 'libdir', and 'lib-suffix')"
        }),
        (('use-flat-include-dir', ), {
            'action':
            'store_true',
            'default':
            False,
            'help':
            'install all headers into $PREFIX/include '
            'instead of $PREFIX/include/<package_group>, and '
            'change .pc files accordingly'
        }),
        (('libdir', ), {
            'type':
            'string',
            'default':
            'lib',
            'dest':
            'lib_dir',
            'help':
            'the name of the directory under $PREFIX where '
            'library files are installed [default: %default]'
        }),
        (('bindir', ), {
            'type':
            'string',
            'default':
            'bin',
            'help':
            'the name of the directory under $PREFIX where '
            'binaries are installed [default: %default]'
        }),
        (('lib-suffix', ), {
            'type':
            'string',
            'default':
            '',
            'help':
            '(deprecated) add a suffix to the names of the package '
            'group library files being built [default: %default]'
        }),
        (('debug-opt-keys', ), {
            'type':
            'string',
            'default':
            None,
            'help':
            'debug rules in the opts files for the specified '
            '(comma separated) list of opts keys'
        }),
    ]
    configure_group = ctx.get_option_group('configure options')
    configure_opts = optionsutil.get_ufid_cmdline_options() + configure_opts
    cmdlineutil.add_options(configure_group, configure_opts)

    waf_platform = Utils.unversioned_sys_platform()
    if waf_platform == 'win32':
        win_opts = [(('msvc-runtime-type', ), {
            'choices': ('static', 'dynamic'),
            'default':
            'dynamic',
            'help':
            'whether to build using the static or dynamic version '
            'of the C run-time library on Windows '
            '[default: %default]'
        })]
        cmdlineutil.add_options(configure_group, win_opts)

    install_group = ctx.get_option_group(
        'Installation and uninstallation options')
    install_opts = [
        (('install-dep', ), {
            'choices': ('yes', 'no'),
            'default':
            'yes',
            'help':
            'when doing a targeted install, whether to also '
            'install the dependencies of the targets (yes/no) '
            '[default: %default]'
        }),
        (('install-parts', ), {
            'choices': ('all', 'h', 'lib', 'pc'),
            'default':
            'all',
            'help':
            'what parts to install (all/h/lib/pc). '
            'all -- everything, h -- header files only, '
            'lib -- lib files only, pc -- pkg-config files only '
            '[default: %default]'
        }),
    ]
    cmdlineutil.add_options(install_group, install_opts)

    # Set the upper bound of the default number of jobs to 24
    jobs = ctx.parser.get_option('-j').default
    if jobs > 24:
        jobs = 24
        ctx.parser.remove_option('-j')
        ctx.parser.add_option('-j',
                              '--jobs',
                              dest='jobs',
                              default=jobs,
                              type='int',
                              help='amount of parallel jobs (%r)' % jobs)