Пример #1
0
def _configure_impl(ctx):
    _setup_log(ctx)

    ufid = configureutil.make_ufid(ctx)

    waf_platform = Utils.unversioned_sys_platform()
    if waf_platform == 'win32':
        if '64' in ufid.flags:
            ctx.options.msvc_targets = 'x64'
        else:
            ctx.options.msvc_targets = 'x86'
        msvc_version = configureutil.get_msvc_version_from_env()
        if msvc_version:
            ctx.options.msvc_version = 'msvc %s' % msvc_version
    else:
        if 'CXX' in ctx.environ and 'CC' not in ctx.environ:
            ctx.environ['CC'] = sysutil.get_other_compiler(
                ctx.environ['CXX'], sysutil.CompilerType.CXX)
        elif 'CC' in ctx.environ and 'CXX' not in ctx.environ:
            ctx.environ['CXX'] = sysutil.get_other_compiler(
                ctx.environ['CC'], sysutil.CompilerType.C)

    ctx.load('compiler_c')
    ctx.load('compiler_cxx')
    cc_ver = ctx.env.CC_VERSION
    cc_name = ctx.env.COMPILER_CC
    cxx_ver = ctx.env.CC_VERSION
    cxx_name = ctx.env.COMPILER_CXX

    if cxx_name in sysutil.CXX_C_COMP_MAP:
        exp_c_name = sysutil.CXX_C_COMP_MAP[cxx_name]
        if exp_c_name != cc_name:
            ctx.fatal('C compiler and C++ compiler must match. '
                      'Expected c compiler: %s' % exp_c_name)
        if cc_ver != cxx_ver:
            ctx.fatal('C compiler and C++ compiler must be the same version. '
                      'C compiler version: %s, '
                      'C++ compiler version: %s' % (cc_ver, cxx_ver))
    ctx.load('bdebuild.waf.bdeunittest')
    effective_uplid, actual_uplid = configureutil.make_uplid(ctx)

    # If UFID is not set by bde_setwafenv.py or the --ufid flag, use "cpp11" as
    # the default when appropriate.
    if (not os.getenv('BDE_WAF_UFID') and (ctx.options.ufid is None) and
        (ctx.options.cpp_std is None) and
        (optionsutil.get_default_cpp_std(effective_uplid.comp_type,
                                         effective_uplid.comp_ver) == "11")):
        ufid.flags.add('cpp11')

    helper = configurehelper.ConfigureHelper(ctx, ufid,
                                             effective_uplid, actual_uplid)
    helper.configure()
Пример #2
0
def _configure_impl(ctx):
    _setup_log(ctx)

    ufid = configureutil.make_ufid(ctx)

    waf_platform = Utils.unversioned_sys_platform()
    if waf_platform == 'win32':
        if '64' in ufid.flags:
            ctx.options.msvc_targets = 'x64'
        else:
            ctx.options.msvc_targets = 'x86'
        msvc_version = configureutil.get_msvc_version_from_env()
        if msvc_version:
            ctx.options.msvc_version = 'msvc %s' % msvc_version
    else:
        if 'CXX' in ctx.environ and 'CC' not in ctx.environ:
            ctx.environ['CC'] = sysutil.get_other_compiler(
                ctx.environ['CXX'], sysutil.CompilerType.CXX)
        elif 'CC' in ctx.environ and 'CXX' not in ctx.environ:
            ctx.environ['CXX'] = sysutil.get_other_compiler(
                ctx.environ['CC'], sysutil.CompilerType.C)

    ctx.load('compiler_c')
    ctx.load('compiler_cxx')
    cc_ver = ctx.env.CC_VERSION
    cc_name = ctx.env.COMPILER_CC
    cxx_ver = ctx.env.CC_VERSION
    cxx_name = ctx.env.COMPILER_CXX

    if cxx_name in sysutil.CXX_C_COMP_MAP:
        exp_c_name = sysutil.CXX_C_COMP_MAP[cxx_name]
        if exp_c_name != cc_name:
            ctx.fatal('C compiler and C++ compiler must match. '
                      'Expected c compiler: %s' % exp_c_name)
        if cc_ver != cxx_ver:
            ctx.fatal('C compiler and C++ compiler must be the same version. '
                      'C compiler version: %s, '
                      'C++ compiler version: %s' % (cc_ver, cxx_ver))
    ctx.load('bdebuild.waf.bdeunittest')
    effective_uplid, actual_uplid = configureutil.make_uplid(ctx)

    if (not os.getenv('BDE_WAF_UFID') and (ctx.options.cpp_std is None) and
        (optionsutil.get_default_cpp_std(effective_uplid.comp_type,
                                         effective_uplid.comp_ver) == "11")):
        ufid.flags.add('cpp11')

    helper = configurehelper.ConfigureHelper(ctx, ufid,
                                             effective_uplid, actual_uplid)
    helper.configure()
Пример #3
0
def _configure_impl(ctx):
    _setup_log(ctx)

    ufid = configureutil.make_ufid(ctx)

    waf_platform = Utils.unversioned_sys_platform()
    if waf_platform == 'win32':
        if '64' in ufid.flags:
            ctx.options.msvc_targets = 'x64'
        else:
            ctx.options.msvc_targets = 'x86'
        msvc_version = configureutil.get_msvc_version_from_env()
        if msvc_version:
            ctx.options.msvc_version = 'msvc %s' % msvc_version
    else:
        if 'CXX' in ctx.environ and 'CC' not in ctx.environ:
            ctx.environ['CC'] = sysutil.get_other_compiler(
                ctx.environ['CXX'], sysutil.CompilerType.CXX)
        elif 'CC' in ctx.environ and 'CXX' not in ctx.environ:
            ctx.environ['CXX'] = sysutil.get_other_compiler(
                ctx.environ['CC'], sysutil.CompilerType.C)

    ctx.load('compiler_c')
    ctx.load('compiler_cxx')
    cc_ver = ctx.env.CC_VERSION
    cc_name = ctx.env.COMPILER_CC
    cxx_ver = ctx.env.CC_VERSION
    cxx_name = ctx.env.COMPILER_CXX

    if cxx_name in sysutil.CXX_C_COMP_MAP:
        exp_c_name = sysutil.CXX_C_COMP_MAP[cxx_name]
        if exp_c_name != cc_name:
            ctx.fatal('C compiler and C++ compiler must match. '
                      'Expected c compiler: %s' % exp_c_name)
        if cc_ver != cxx_ver:
            ctx.fatal('C compiler and C++ compiler must be the same version. '
                      'C compiler version: %s, '
                      'C++ compiler version: %s' % (cc_ver, cxx_ver))
    ctx.load('bdebuild.waf.bdeunittest')
    effective_uplid, actual_uplid = configureutil.make_uplid(ctx)

    # If UFID is not set by bde_setwafenv.py or the --ufid flag, use "cpp11" as
    # the default when appropriate.
    if (not os.getenv('BDE_WAF_UFID') and (ctx.options.ufid is None)
            and (ctx.options.cpp_std is None)
            and (optionsutil.get_default_cpp_std(
                effective_uplid.comp_type, effective_uplid.comp_ver) == "11")):
        ufid.flags.add('cpp11')

    # Enable -Werror by default if the compiler is gcc-4.9 and build mode is
    # not 'opt'.
    if ctx.options.werror is None:
        if (effective_uplid.comp_type == 'gcc'
                and effective_uplid.comp_ver >= '4.9'
                and 'opt' not in ufid.flags):
            ctx.options.werror = 'cpp'
        else:
            ctx.options.werror = 'none'

    helper = configurehelper.ConfigureHelper(ctx, ufid, effective_uplid,
                                             actual_uplid)
    helper.configure()
Пример #4
0
def program():
    platform_str = sysutil.unversioned_platform()

    if platform_str not in ('win32', 'cygwin', 'linux', 'aix', 'sunos',
                            'darwin', 'freebsd'):
        print('Unsupported platform: %s' % platform_str, file=sys.stderr)
        sys.exit(1)

    if platform_str == 'win32' and not sysutil.is_mingw_environment():
        print('This tool is used to configure unix-style environment '
              'variables. On Windows platforms it must be run from a unix '
              'shell environment, either cygwin, or mingw/msys/msysgit')
        sys.exit(1)

    parser = cmdline.get_option_parser()

    options, args = parser.parse_args()

    if len(args) > 1:
        parser.print_help()
        sys.exit(1)

    if len(args) == 0:
        command = 'set'
    else:
        command = args[0]

    if command not in ('set', 'unset', 'list'):
        print('Invalid command: %s' % command, file=sys.stderr)
        parser.print_help()
        sys.exit(1)

    if command == 'unset':
        unset_command()
        sys.exit(0)

    compiler_infos = get_compilerinfos()

    if not compiler_infos:
        print('No valid compilers on this machine.', file=sys.stderr)
        sys.exit(1)

    if command == 'list':
        list_compilers(compiler_infos)
        sys.exit(0)

    # command == 'set'
    info = None
    if options.compiler is None:
        info = compiler_infos[0]
    elif sysutil.is_int_string(options.compiler):
        idx = int(options.compiler)
        if idx < len(compiler_infos):
            info = compiler_infos[idx]
    else:

        for c in compiler_infos:
            if c.key() == options.compiler:
                info = c

    if not info:
        print("Invalid compiler: %s" % options.compiler, file=sys.stderr)
        list_compilers(compiler_infos)
        sys.exit(1)

    if options.cpp_std is None:
        options.cpp_std = optionsutil.get_default_cpp_std(
            info.type_, info.version)
    print_envs(options, info)
Пример #5
0
def program():
    platform_str = sysutil.unversioned_platform()

    if platform_str not in ('win32', 'cygwin', 'linux', 'aix', 'sunos',
                            'darwin'):
        print('Unsupported platform: %s' % platform_str, file=sys.stderr)
        sys.exit(1)

    if platform_str == 'win32' and not sysutil.is_mingw_environment():
        print('This tool is used to configure unix-style environment '
              'variables. On Windows platforms it must be run from a unix '
              'shell environment, either cygwin, or mingw/msys/msysgit')
        sys.exit(1)

    parser = cmdline.get_option_parser()

    options, args = parser.parse_args()

    if len(args) > 1:
        parser.print_help()
        sys.exit(1)

    if len(args) == 0:
        command = 'set'
    else:
        command = args[0]

    if command not in ('set', 'unset', 'list'):
        print('Invalid command: %s' % command, file=sys.stderr)
        parser.print_help()
        sys.exit(1)

    if command == 'unset':
        unset_command()
        sys.exit(0)

    compiler_infos = get_compilerinfos()

    if not compiler_infos:
        print('No valid compilers on this machine.', file=sys.stderr)
        sys.exit(1)

    if command == 'list':
        list_compilers(compiler_infos)
        sys.exit(0)

    # command == 'set'
    info = None
    if options.compiler is None:
        info = compiler_infos[0]
    elif sysutil.is_int_string(options.compiler):
        idx = int(options.compiler)
        if idx < len(compiler_infos):
            info = compiler_infos[idx]
    else:

        for c in compiler_infos:
            if c.key() == options.compiler:
                info = c

    if not info:
        print("Invalid compiler: %s" % options.compiler, file=sys.stderr)
        list_compilers(compiler_infos)
        sys.exit(1)

    if options.cpp_std is None:
        options.cpp_std = optionsutil.get_default_cpp_std(info.type_, info.version)
    print_envs(options, info)
Пример #6
0
def program():
    platform_str = sysutil.unversioned_platform()

    if platform_str not in (
            "win32",
            "cygwin",
            "linux",
            "aix",
            "sunos",
            "darwin",
            "freebsd",
    ):
        print("Unsupported platform: %s" % platform_str, file=sys.stderr)
        sys.exit(1)

    if platform_str == "win32" and not sysutil.is_mingw_environment():
        print("This tool is used to configure unix-style environment "
              "variables. On Windows platforms it must be run from a unix "
              "shell environment, either cygwin, or mingw/msys/msysgit")
        sys.exit(1)

    parser = cmdline.get_option_parser()

    options, args = parser.parse_args()

    if len(args) > 1:
        parser.print_help()
        sys.exit(1)

    if len(args) == 0:
        command = "set"
    else:
        command = args[0]

    if command not in ("set", "unset", "list"):
        print("Invalid command: %s" % command, file=sys.stderr)
        parser.print_help()
        sys.exit(1)

    if command == "unset":
        unset_command()
        sys.exit(0)

    compiler_infos = get_compilerinfos()

    if not compiler_infos:
        print("No valid compilers on this machine.", file=sys.stderr)
        sys.exit(1)

    if command == "list":
        list_compilers(compiler_infos)
        sys.exit(0)

    # command == 'set'
    info = None
    if options.compiler is None:
        info = compiler_infos[0]
    elif sysutil.is_int_string(options.compiler):
        idx = int(options.compiler)
        if idx < len(compiler_infos):
            info = compiler_infos[idx]
    else:
        for c in compiler_infos:
            if c.key().startswith(options.compiler):
                info = c
                break

    if not info:
        print("Invalid compiler: %s" % options.compiler, file=sys.stderr)
        list_compilers(compiler_infos)
        sys.exit(1)

    if options.cpp_std is None:
        options.cpp_std = optionsutil.get_default_cpp_std(
            info.type_, info.version)
    print_envs(options, info)