示例#1
0
def _build_empty_program_posix(context, fcomp):
    oldLINK = context.env["LINK"]
    # XXX: get the fortran compiler
    context.env["LINK"] = "$" + fcomp
    res = 0
    cnt = ""
    try:
        # We always want to do this build, and we do not want scons cache
        # to interfer. So we build a command executed directly through our
        # popen_wrapper, which output is captured.

        # XXX: does this scheme to get the program name always work ? Can
        # we use Scons to get the target name from the object name ?
        slast = str(context.lastTarget)
        dir = dirname(slast)
        test_prog = pjoin(dir, basename(slast).split(".")[0])
        cmd = context.env.subst("$LINKCOM", target=context.env.File(test_prog), source=context.lastTarget)
        st, out = popen_wrapper(cmd, merge=True)
        if st:
            res = 0
        else:
            res = 1
        cnt = out.split("\n")
    finally:
        context.env["LINK"] = oldLINK

    return res, cnt
示例#2
0
def _build_empty_program_posix(context, fcomp):
    oldLINK = context.env['LINK']
    # XXX: get the fortran compiler
    context.env['LINK'] = '$' + fcomp
    res = 0
    cnt = ''
    try:
        # We always want to do this build, and we do not want scons cache
        # to interfer. So we build a command executed directly through our
        # popen_wrapper, which output is captured.

        # XXX: does this scheme to get the program name always work ? Can
        # we use Scons to get the target name from the object name ?
        slast = str(context.lastTarget)
        dir = dirname(slast)
        test_prog = pjoin(dir, basename(slast).split('.')[0])
        cmd = context.env.subst('$LINKCOM',
                                target = context.env.File(test_prog),
                                source = context.lastTarget)
        st, out = popen_wrapper(cmd, merge = True)
        if st:
            res = 0
        else:
            res = 1
        cnt = out.split('\n')
    finally:
        context.env['LINK'] = oldLINK

    return res, cnt
def _is_compiler(path, cmdargs, parser):
    # cmdargs is a list of arguments to get verbose information
    cmd = [path] + cmdargs
    try:
        env = {'LC_ALL': 'C'}
        try:
            env['PATH'] = os.environ['PATH']
        except KeyError, e:
            pass
        st, cnt = popen_wrapper(cmd, merge=True, shell=False, env=env)
示例#4
0
def _is_compiler(path, cmdargs, parser):
    # cmdargs is a list of arguments to get verbose information
    cmd = [path] + cmdargs
    try:
        env={'LC_ALL': 'C'}
        try:
            env['PATH'] = os.environ['PATH']
        except KeyError, e:
            pass
        st, cnt = popen_wrapper(cmd, merge=True, shell=False, env=env)
示例#5
0
def get_sunperf_link_options(context, config):
    """If successefull, returns the link flags.

    Returns:
        - st: int
            0 : failed
            1 : succeeded
        - flags: dict
            dictionary of the options.
    """
    context.Message('Getting link options of sunperf ... ')

    opts = config
    test_code = cblas_sgemm
    env = context.env
    saved = save_and_set(env, opts)
    try:
        st = context.TryCompile(test_code, '.c')
    finally:
        restore(env, saved)

    if not st:
        return context.Result('Failed !'), None

    saved = save_and_set(env, opts)
    env.Append(LINKFLAGS = '-#')
    oldLINK = env['LINK']
    env['LINK'] = '$CC'
    try:
        # XXX: does this scheme to get the program name always work ? Can
        # we use Scons to get the target name from the object name ?
        slast = str(context.lastTarget)
        prdir = dirname(slast)
        test_prog = pjoin(prdir, basename(slast).split('.')[0])

        cmd = context.env.subst('$LINKCOM',
                            target = context.env.File(test_prog),
                            source = context.lastTarget)
        st, out = popen_wrapper(cmd, merge = True)
    finally:
        restore(env, saved)
        env['LINK'] = oldLINK

    # If getting the verbose output succeeds, parse the output
    if not st:
        return 1, sunperf_parser_link(out)
    else:
        return 0, None
示例#6
0
def _build_empty_program_ms(context, fcomp):
    # MS tools and g77/gfortran semantics are totally different, so we cannot
    # just compile a program replacing MS linker by g77/gfortran as we can for
    # all other platforms.
    slast = str(context.lastTarget)
    dir = dirname(slast)
    test_prog = pjoin(dir, basename(slast).split(".")[0])
    cmd = context.env.subst(
        "$%s -v -o $TARGET $SOURCES" % fcomp, target=context.env.File(test_prog), source=context.lastTarget
    )

    st, out = popen_wrapper(cmd, merge=True)
    if st:
        res = 0
    else:
        res = 1
    cnt = out.split("\n")
    return res, cnt
示例#7
0
def _build_empty_program_ms(context, fcomp):
    # MS tools and g77/gfortran semantics are totally different, so we cannot
    # just compile a program replacing MS linker by g77/gfortran as we can for
    # all other platforms.
    slast = str(context.lastTarget)
    dir = dirname(slast)
    test_prog = pjoin(dir, basename(slast).split('.')[0])
    cmd = context.env.subst("$%s -v -o $TARGET $SOURCES" % fcomp,
                            target = context.env.File(test_prog),
                            source = context.lastTarget)

    st, out = popen_wrapper(cmd, merge = True)
    if st:
        res = 0
    else:
        res = 1
    cnt = out.split('\n')
    return res, cnt