MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / build_extension

Method build_extension

external/sentencepiece/python/setup.py:87–117  ·  view source on GitHub ↗
(self, ext)

Source from the content-addressed store, hash-verified

85 """Override build_extension to run cmake."""
86
87 def build_extension(self, ext):
88 cflags, libs = get_cflags_and_libs('../build/root')
89
90 if len(libs) == 0:
91 if is_sentencepiece_installed():
92 cflags = cflags + run_pkg_config('cflags')
93 libs = run_pkg_config('libs')
94 else:
95 subprocess.check_call(['./build_bundled.sh', __version__])
96 cflags, libs = get_cflags_and_libs('./build/root')
97
98 # Fix compile on some versions of Mac OSX
99 # See: https://github.com/neulab/xnmt/issues/199
100 if sys.platform == 'darwin':
101 cflags.append('-mmacosx-version-min=10.9')
102 else:
103 if sys.platform == 'aix':
104 cflags.append('-Wl,-s')
105 libs.append('-Wl,-s')
106 else:
107 cflags.append('-Wl,-strip-all')
108 libs.append('-Wl,-strip-all')
109 if sys.platform == 'linux':
110 libs.append('-Wl,-Bsymbolic')
111 if is_gil_disabled():
112 cflags.append('-DPy_GIL_DISABLED')
113 print('## cflags={}'.format(' '.join(cflags)))
114 print('## libs={}'.format(' '.join(libs)))
115 ext.extra_compile_args = cflags
116 ext.extra_link_args = libs
117 _build_ext.build_extension(self, ext)
118
119
120def copy_package_data():

Callers

nothing calls this directly

Calls 6

get_cflags_and_libsFunction · 0.85
run_pkg_configFunction · 0.85
is_gil_disabledFunction · 0.85
printFunction · 0.85
formatMethod · 0.80

Tested by

no test coverage detected