def METHOD_NAME(
    cc,
    cxx,
    sources,
    targetprefix,
    targetname,
    targetsuffix,
    libs,
    libdirs,
    includes,
    eca,
    ela,
    defines,
    installpath="",
):
    import shutil
    import subprocess
    from os.path import basename
    from sysconfig import get_paths as gp
    log.info(f"building cpp target {targetname}...")
    include_dir_plat = ["-I" + incdir for incdir in includes]
    if IS_WIN:
        eca += ["/EHsc"]
        lib_prefix = ""
        lib_suffix = ".lib"
        obj_ext = ".obj"
        libdirs += [jp(gp()["data"], "libs")]
        library_dir_plat = ["/link"] + [f"/LIBPATH:{libdir}" for libdir in libdirs]
        additional_linker_opts = [
            "/DLL",
            f"/OUT:{targetprefix}{targetname}{targetsuffix}",
        ]
    else:
        eca += ["-fPIC"]
        ela += ["-shared"]
        lib_prefix = "-l"
        lib_suffix = ""
        obj_ext = ".o"
        library_dir_plat = ["-L" + libdir for libdir in libdirs]
        additional_linker_opts = ["-o", f"{targetprefix}{targetname}{targetsuffix}"]
    eca += ["-c"]
    libs = [f"{lib_prefix}{str(item)}{lib_suffix}" for item in libs]
    d4p_dir = os.getcwd()
    build_dir = os.path.join(d4p_dir, f"build_{targetname}")
    if os.path.exists(build_dir):
        shutil.rmtree(build_dir)
    os.mkdir(build_dir)
    os.chdir(build_dir)
    objfiles = [basename(f).replace(".cpp", obj_ext) for f in sources]
    for i, cppfile in enumerate(sources):
        if IS_WIN:
            out = [f"/Fo{objfiles[i]}"]
        else:
            out = ["-o", objfiles[i]]
        cmd = [cc] + include_dir_plat + eca + [f"{d4p_dir}/{cppfile}"] + out + defines
        log.info(subprocess.list2cmdline(cmd))
        subprocess.check_call(cmd)
    if IS_WIN:
        cmd = [cxx] + ela + objfiles + library_dir_plat + libs + additional_linker_opts
    else:
        cmd = [cxx] + objfiles + library_dir_plat + ela + libs + additional_linker_opts
    log.info(subprocess.list2cmdline(cmd))
    subprocess.check_call(cmd)
    shutil.copy(
        f"{targetprefix}{targetname}{targetsuffix}", os.path.join(d4p_dir, installpath)
    )
    if IS_WIN:
        target_lib_suffix = targetsuffix.replace(".dll", ".lib")
        shutil.copy(
            f"{targetprefix}{targetname}{target_lib_suffix}",
            os.path.join(d4p_dir, installpath),
        )
    os.chdir(d4p_dir)