(src: Path, dst: Path)
| 121 | |
| 122 | |
| 123 | def _compile_cc(src: Path, dst: Path): |
| 124 | cmd = ["g++", str(src)] |
| 125 | default_include_paths = [ |
| 126 | tvm.libinfo.find_include_path(), |
| 127 | tvm_ffi.libinfo.find_include_path(), |
| 128 | tvm_ffi.libinfo.find_dlpack_include_path(), |
| 129 | ] |
| 130 | for include_path in default_include_paths: |
| 131 | cmd += ["-I", include_path] |
| 132 | cmd += [ |
| 133 | "-c", |
| 134 | "-std=c++17", |
| 135 | "-fPIC", |
| 136 | "-o", |
| 137 | str(dst), |
| 138 | ] |
| 139 | with subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) as proc: |
| 140 | (out, _) = proc.communicate() |
| 141 | if proc.returncode != 0: |
| 142 | msg = "Compilation error:\n" |
| 143 | msg += out.decode("utf-8", errors="replace") |
| 144 | msg += "\nCommand line: " + " ".join(cmd) |
| 145 | raise RuntimeError(msg) |
| 146 | |
| 147 | |
| 148 | def test_extern_object(): |
no test coverage detected
searching dependent graphs…