Skip to content

Commit e72caf3

Browse files
authored
Enable LTO on macOS ARM64 (#937)
1 parent 3dbc018 commit e72caf3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

setup.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import platform
23
import sys
34

45
from setuptools import setup
@@ -38,6 +39,9 @@
3839
extra_compile_args.extend(["-O0", "-g", "-UNDEBUG"])
3940
elif sys.platform != "win32":
4041
extra_compile_args.extend(["-g0"])
42+
if sys.platform == "darwin" and platform.machine().lower() == "arm64":
43+
extra_compile_args.extend(["-flto=thin"])
44+
extra_link_args.extend(["-flto=thin"])
4145

4246
# from https://py-free-threading.github.io/faq/#im-trying-to-build-a-library-on-windows-but-msvc-says-c-atomic-support-is-not-enabled
4347
if sys.platform == "win32":

0 commit comments

Comments
 (0)