Skip to content

Commit a6d96c9

Browse files
committed
Yes it is
1 parent ddc619b commit a6d96c9

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

setup.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,32 @@ def build_extension(self, ext: CMakeExtension):
123123
cwd=build_temp,
124124
)
125125

126+
# Copy TBB shared library if it exists (Linux only)
127+
if platform.system() == "Linux":
128+
print(f"Searching for TBB shared libraries in {build_temp}...")
129+
# Look for libtbb.so* recursively
130+
tbb_libs = list(build_temp.glob("**/libtbb.so*"))
131+
# Also look for libtbb_debug.so* if we are in debug mode or if that's what was built
132+
tbb_libs.extend(list(build_temp.glob("**/libtbb_debug.so*")))
133+
134+
if tbb_libs:
135+
print(f"Found TBB libraries: {tbb_libs}")
136+
for lib in tbb_libs:
137+
# We only want the real shared object, not symlinks if possible,
138+
# but copying everything matching the pattern is safer to ensure we get the versioned one.
139+
# However, we need to be careful not to overwrite if multiple matches found.
140+
# Usually we want the one that the linker linked against.
141+
# Since we set RPATH to $ORIGIN, we need the library in the same dir as the extension.
142+
143+
# Avoid copying if it's a symlink pointing to something we already copied?
144+
# simpler: just copy all of them.
145+
dest = extdir / lib.name
146+
if not dest.exists():
147+
shutil.copy2(lib, dest)
148+
print(f"Copied {lib} to {dest}")
149+
else:
150+
print("Warning: No TBB shared libraries found to copy.")
151+
126152
def pre_build(self):
127153
"""Extracts doxygen documentation from XML files and creates a C++ unordered_map"""
128154

0 commit comments

Comments
 (0)