Skip to content

Commit 171ff72

Browse files
committed
bug fix
1 parent 91a9a9e commit 171ff72

1 file changed

Lines changed: 36 additions & 16 deletions

File tree

setup.py

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -94,25 +94,45 @@ def detect_gcc_on_windows():
9494

9595
elif platform.system() == "Darwin":
9696
# Clang flags for macOS
97-
extra_compile_args = [
98-
"-Ofast",
99-
"-flto",
100-
"-march=native",
101-
"-ffast-math",
102-
"-funroll-loops",
103-
]
104-
extra_link_args = ["-flto"]
97+
if os.getenv("GITHUB_ACTIONS") == "true":
98+
# Safe flags for GitHub Actions (no -march=native for universal builds)
99+
extra_compile_args = [
100+
"-O3",
101+
"-ffast-math",
102+
"-funroll-loops",
103+
]
104+
extra_link_args = []
105+
else:
106+
# Local development with native optimization
107+
extra_compile_args = [
108+
"-Ofast",
109+
"-flto",
110+
"-march=native",
111+
"-ffast-math",
112+
"-funroll-loops",
113+
]
114+
extra_link_args = ["-flto"]
105115
compiler_type = "Clang"
106116
else:
107117
# GCC flags for Linux and other Unix-like systems
108-
extra_compile_args = [
109-
"-Ofast",
110-
"-flto",
111-
"-march=native",
112-
"-ffast-math",
113-
"-funroll-loops",
114-
]
115-
extra_link_args = ["-flto"]
118+
if os.getenv("GITHUB_ACTIONS") == "true":
119+
# Safe flags for GitHub Actions
120+
extra_compile_args = [
121+
"-O3",
122+
"-ffast-math",
123+
"-funroll-loops",
124+
]
125+
extra_link_args = []
126+
else:
127+
# Local development with native optimization
128+
extra_compile_args = [
129+
"-Ofast",
130+
"-flto",
131+
"-march=native",
132+
"-ffast-math",
133+
"-funroll-loops",
134+
]
135+
extra_link_args = ["-flto"]
116136
compiler_type = "GCC"
117137

118138
print(f"Building for {platform.system()} with {compiler_type}")

0 commit comments

Comments
 (0)