Skip to content

Commit

Permalink
cython setup: make sure arch tag is set in the name of compiled files…
Browse files Browse the repository at this point in the history
… for darwin platform
  • Loading branch information
jfranmatheu committed Feb 12, 2025
1 parent 73dd796 commit 332f528
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cy_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ def build_for_architecture(arch):
# Don't add -arch flag directly to compile/link args
if 'ARCHFLAGS' not in os.environ:
os.environ['ARCHFLAGS'] = f'-arch {arch}'
# Set platform tag for proper naming
os.environ['PLAT_NAME'] = f'darwin-{arch}'

shared_ext_kwargs = {
'extra_compile_args': extra_compile_args,
Expand Down Expand Up @@ -69,6 +71,13 @@ def build_for_architecture(arch):
zip_safe=False,
)

if platform.system() == 'Darwin':
# find all compiled files and rename them to include the platform tag
for file in os.listdir("retopoflow/cy"):
if file.endswith('darwin.so'):
os.rename(f"retopoflow/cy/{file}", f"retopoflow/cy/{file.split('.')[0]}-{os.environ['PLAT_NAME']}.so")


def main():
system = platform.system()

Expand Down

0 comments on commit 332f528

Please sign in to comment.