Skip to content

Commit 954bf9a

Browse files
committed
up
1 parent 0a97d53 commit 954bf9a

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

setup.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -318,12 +318,10 @@ def build_cmake(self, ext):
318318
os.makedirs(self.build_temp)
319319

320320
# Get the expected extension file name that Python will look for
321+
# We force CMake to use this library name
321322
ext_filename = os.path.basename(self.get_ext_filename(ext.name))
322323
ext_basename = os.path.splitext(ext_filename)[0]
323324

324-
# Add TORCHAO_CMAKE_EXT_SO_NAME is used in CMake to name the library
325-
# to something the python extension expects
326-
print("EXTENSION NAME", ext_basename)
327325
subprocess.check_call(
328326
[
329327
"cmake",
@@ -332,24 +330,12 @@ def build_cmake(self, ext):
332330
+ ext.cmake_args
333331
+ [
334332
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=" + extdir,
335-
f"-DTORCHAO_CMAKE_EXT_SO_NAME={ext_basename}",
333+
"-DTORCHAO_CMAKE_EXT_SO_NAME=" + ext_basename,
336334
],
337335
cwd=self.build_temp,
338336
)
339337
subprocess.check_call(["cmake", "--build", "."], cwd=self.build_temp)
340338

341-
# # Handle the case where the file is created with .dylib extension instead of .so
342-
# # This is needed because Python expects .so files on macOS, but CMake might create .dylib
343-
# if ext.name == "torchao.experimental":
344-
# # Get the expected extension file name
345-
# ext_path = os.path.join(extdir, ext_filename)
346-
# dylib_path = os.path.join(extdir, f"{ext_basename}.dylib")
347-
348-
# # If the .dylib exists but the .so doesn't, rename it
349-
# if os.path.exists(dylib_path) and not os.path.exists(ext_path):
350-
# print(f"Renaming {dylib_path} to {ext_path}")
351-
# os.rename(dylib_path, ext_path)
352-
353339

354340
class CMakeExtension(Extension):
355341
def __init__(

0 commit comments

Comments
 (0)