コード例 #1
0
ファイル: compiler.py プロジェクト: ognarb/benchbuild
def cxx(project, detect_project=False):
    """
    Return a clang++ that hides CFLAGS and LDFLAGS.

    This will generate a wrapper script in the current directory
    and return a complete plumbum command to it.

    Args:
        cflags: The CFLAGS we want to hide.
        ldflags: The LDFLAGS we want to hide.
        func (optional): A function that will be pickled alongside the compiler.
            It will be called before the actual compilation took place. This
            way you can intercept the compilation process with arbitrary python
            code.

    Returns (benchbuild.utils.cmd):
        Path to the new clang command.
    """
    from benchbuild.utils import cmd

    cxx_name = str(CFG["compiler"]["cxx"])
    wrap_cc(cxx_name,
            compiler(cxx_name),
            project,
            detect_project=detect_project)
    return cmd["./{name}".format(name=cxx_name)]
コード例 #2
0
ファイル: compiler.py プロジェクト: simbuerg/benchbuild
def wrap_cc_in_uchroot(cflags, ldflags, func=None, cc_name='clang'):
    """
    Generate a clang wrapper that may be called from within a uchroot.

    This basically does the same as lt_clang/lt_clang_cxx. However, we do not
    create a valid plumbum command. The generated script will only work
    inside a uchroot environment that has is root at the current working
    directory, when calling this function.

    Args:
        cflags: The CFLAGS we want to hide
        ldflags: The LDFLAGS we want to hide
        func (optional): A function that will be pickled alongside the compiler.
            It will be called before the actual compilation took place. This
            way you can intercept the compilation process with arbitrary python
            code.
        uchroot_path: Prefix path of the compiler inside the uchroot.
        cc_name: Name of the generated script.
    """
    from os import path
    from plumbum import local

    def compiler():  # pylint:  disable=C0111
        pi = __get_compiler_paths()
        cc = local["/usr/bin/env"]
        cc = cc[cc_name]
        cc = cc.with_env(LD_LIBRARY_PATH=pi["ld_library_path"])
        return cc

    def gen_compiler_extension(ext):  # pylint:  disable=C0111
        return path.join("/", cc_name + ext)
    wrap_cc(cc_name, cflags, ldflags, compiler, func, gen_compiler_extension,
            python="/usr/bin/env python3")
コード例 #3
0
ファイル: compiler.py プロジェクト: simbuerg/benchbuild
def lt_clang_cxx(cflags, ldflags, func=None):
    """
    Return a clang++ that hides CFLAGS and LDFLAGS.

    This will generate a wrapper script in the current directory
    and return a complete plumbum command to it.

    Args:
        cflags: The CFLAGS we want to hide.
        ldflags: The LDFLAGS we want to hide.
        func (optional): A function that will be pickled alongside the compiler.
            It will be called before the actual compilation took place. This
            way you can intercept the compilation process with arbitrary python
            code.

    Returns (benchbuild.utils.cmd):
        Path to the new clang command.
    """
    from plumbum import local

    wrap_cc("clang++", cflags, ldflags, clang_cxx, func)
    return local["./clang++"]
コード例 #4
0
def wrap_cc_in_uchroot(project, cc_name='cc'):
    """
    Generate a clang wrapper that may be called from within a uchroot.

    This basically does the same as cc/cxx. However, we do not
    create a valid plumbum command. The generated script will only work
    inside a uchroot environment that has is root at the current working
    directory, when calling this function.

    Args:
        project: The project we generate this compiler for.
        cc_name: Name of the generated script.
    """
    from os import path

    def gen_compiler_extension(ext):
        return path.join("/", cc_name + ext)

    wrap_cc(cc_name,
            compiler,
            project,
            gen_compiler_extension,
            python="/usr/bin/env python3")
コード例 #5
0
ファイル: compiler.py プロジェクト: PolyJIT/benchbuild
def cc(project, detect_project=False):
    """
    Return a clang that hides CFLAGS and LDFLAGS.

    This will generate a wrapper script in the current directory
    and return a complete plumbum command to it.

    Args:
        cflags: The CFLAGS we want to hide.
        ldflags: The LDFLAGS we want to hide.
        func (optional): A function that will be pickled alongside the compiler.
            It will be called before the actual compilation took place. This
            way you can intercept the compilation process with arbitrary python
            code.

    Returns (benchbuild.utils.cmd):
        Path to the new clang command.
    """
    from benchbuild.utils import cmd

    cc_name = str(CFG["compiler"]["c"])
    wrap_cc(cc_name, compiler(cc_name), project, detect_project=detect_project)
    return cmd["./{}".format(cc_name)]