@@ -84,17 +84,14 @@ def build_extension(self, ext: CMakeExtension):
8484 # Add macOS-specific CMake prefix paths for Homebrew dependencies
8585 if platform .system () == "Darwin" : # macOS
8686 try :
87- tbb_prefix = subprocess .check_output (
88- ["brew" , "--prefix" , "tbb" ], text = True
89- ).strip ()
9087 fmt_prefix = subprocess .check_output (
9188 ["brew" , "--prefix" , "fmt" ], text = True
9289 ).strip ()
9390 spdlog_prefix = subprocess .check_output (
9491 ["brew" , "--prefix" , "spdlog" ], text = True
9592 ).strip ()
9693
97- cmake_prefix_path = f"{ tbb_prefix } ; { fmt_prefix } ;{ spdlog_prefix } "
94+ cmake_prefix_path = f"{ fmt_prefix } ;{ spdlog_prefix } "
9895 cmake_args .append (f"-DCMAKE_PREFIX_PATH={ cmake_prefix_path } " )
9996 print (f"Added macOS Homebrew prefix paths: { cmake_prefix_path } " )
10097
@@ -126,65 +123,6 @@ def build_extension(self, ext: CMakeExtension):
126123 cwd = build_temp ,
127124 )
128125
129- # Copy TBB shared library if it exists (Linux and macOS)
130- if platform .system () == "Linux" or platform .system () == "Darwin" :
131- print (f"Searching for TBB shared libraries in { build_temp } ..." )
132-
133- tbb_libs = []
134- if platform .system () == "Linux" :
135- # Look for libtbb.so* recursively
136- tbb_libs = list (build_temp .glob ("**/libtbb.so*" ))
137- # Also look for libtbb_debug.so* if we are in debug mode or if that's what was built
138- tbb_libs .extend (list (build_temp .glob ("**/libtbb_debug.so*" )))
139- else : # macOS
140- # Look for libtbb.dylib* recursively
141- tbb_libs = list (build_temp .glob ("**/libtbb*.dylib" ))
142-
143- if tbb_libs :
144- print (f"Found TBB libraries: { tbb_libs } " )
145- for lib in tbb_libs :
146- # We only want the real shared object, not symlinks if possible,
147- # but copying everything matching the pattern is safer to ensure we get the versioned one.
148- # However, we need to be careful not to overwrite if multiple matches found.
149- # Usually we want the one that the linker linked against.
150- # Since we set RPATH to $ORIGIN (Linux) or @loader_path (macOS), we need the library in the same dir as the extension.
151-
152- # Avoid copying if it's a symlink pointing to something we already copied?
153- # simpler: just copy all of them.
154- dest = extdir / lib .name
155- if not dest .exists ():
156- shutil .copy2 (lib , dest )
157- print (f"Copied { lib } to { dest } " )
158- else :
159- print ("Warning: No TBB shared libraries found to copy." )
160-
161- elif platform .system () == "Windows" :
162- print (f"Searching for TBB DLLs in { build_temp } ..." )
163- # Look for tbb*.dll recursively
164- tbb_dlls = list (build_temp .glob ("**/tbb*.dll" ))
165-
166- if tbb_dlls :
167- print (f"Found TBB DLLs: { tbb_dlls } " )
168- # We want to copy them to the 'dsf' package directory so we can load them in __init__.py
169- # extdir is where dsf_cpp.pyd is (site-packages root usually)
170- # We want site-packages/dsf/
171-
172- # self.build_lib is usually the root of the build (e.g. build/lib.win...)
173- # So we can construct the path to dsf package
174- dsf_pkg_dir = Path (self .build_lib ) / "dsf"
175- dsf_pkg_dir .mkdir (parents = True , exist_ok = True )
176-
177- # Also copy to source directory for editable installs
178- source_dsf_dir = Path (__file__ ).parent / "src" / "dsf"
179-
180- for dll in tbb_dlls :
181- print (f"Copying { dll } to { dsf_pkg_dir } " )
182- shutil .copy2 (dll , dsf_pkg_dir )
183- print (f"Copying { dll } to { source_dsf_dir } " )
184- shutil .copy2 (dll , source_dsf_dir )
185- else :
186- print ("Warning: No TBB DLLs found. This might cause import errors." )
187-
188126 def pre_build (self ):
189127 """Extracts doxygen documentation from XML files and creates a C++ unordered_map"""
190128
0 commit comments