MCPcopy Index your code
hub / github.com/apache/tvm / create_dylib

Function create_dylib

python/tvm/support/xcode.py:64–103  ·  view source on GitHub ↗

Create dynamic library. Parameters ---------- output : str The target shared library. objects : list List of object files. options : str The additional options. arch : str Target major architectures sdk : str The sdk to be used

(output, objects, arch, sdk="macosx", min_os_version=None)

Source from the content-addressed store, hash-verified

62
63
64def create_dylib(output, objects, arch, sdk="macosx", min_os_version=None):
65 """Create dynamic library.
66
67 Parameters
68 ----------
69 output : str
70 The target shared library.
71
72 objects : list
73 List of object files.
74
75 options : str
76 The additional options.
77
78 arch : str
79 Target major architectures
80
81 sdk : str
82 The sdk to be used.
83 """
84 clang = xcrun(["-sdk", sdk, "-find", "clang"])
85 sdk_path = xcrun(["-sdk", sdk, "--show-sdk-path"])
86 cmd = [clang]
87 cmd += ["-dynamiclib"]
88 cmd += ["-arch", arch]
89 cmd += ["-isysroot", sdk_path]
90 cmd += [__get_min_os_version_cmd(sdk, min_os_version)]
91 cmd += ["-o", output]
92 if isinstance(objects, str):
93 cmd += [objects]
94 else:
95 cmd += objects
96
97 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
98 (out, _) = proc.communicate()
99
100 if proc.returncode != 0:
101 msg = "Compilation error:\n"
102 msg += out.decode("utf-8", errors="replace")
103 raise RuntimeError(msg)
104
105
106# assign so as default output format

Callers

nothing calls this directly

Calls 3

xcrunFunction · 0.85
__get_min_os_version_cmdFunction · 0.85
decodeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…