Beispiel #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()
Beispiel #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()
Beispiel #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)
    helper = configurehelper.ConfigureHelper(ctx, ufid,
                                             effective_uplid, actual_uplid)
    helper.configure()
Beispiel #4
0
    def test_get_other_compiler(self):
        test_data = (
            (sysutil.CompilerType.C, '/o/bin/gcc', '/o/bin/g++'),
            (sysutil.CompilerType.C, '/o/bin/gcc-4', '/o/bin/g++-4'),
            (sysutil.CompilerType.C, '/o/bin/gcc-4.1', '/o/bin/g++-4.1'),
            (sysutil.CompilerType.C, '/o/bin/gcc-4.1.2', '/o/bin/g++-4.1.2'),
            (sysutil.CompilerType.C, '/o/bin/gcc-blah', None),
            (sysutil.CompilerType.C, '/o/bin/whatisthis', None),
            (sysutil.CompilerType.CXX, '/o/bin/gcc', None),
            (sysutil.CompilerType.CXX, '/o/bin/clang++', '/o/bin/clang'),
            (sysutil.CompilerType.CXX, '/o/bin/CC', '/o/bin/cc'),
            (sysutil.CompilerType.CXX,
             '/o/bin/xlC_r-12.3', '/o/bin/xlc_r-12.3'),
        )

        for row in test_data:
            comp_type = row[0]
            comp_path = row[1]
            exp_other_path = row[2]
            other_path = sysutil.get_other_compiler(comp_path, comp_type)
            self.assertEqual(other_path, exp_other_path)
Beispiel #5
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()