Skip to content

Commit 914cd40

Browse files
fix: osx build
1 parent dc68535 commit 914cd40

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

sciencemode/_cffi.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373
"-U__i386__",
7474
"-U__MINGW32__",
7575
"-DNT_INCLUDED",
76-
"-D_MSC_VER=1900",
7776
# Minimal bool support - just enough for pycparser to understand modern headers
7877
"-D_Bool=_Bool",
7978
"-Dbool=_Bool",
@@ -92,11 +91,30 @@
9291

9392
# Add platform-specific defines
9493
if platform.system() == "Windows":
95-
DEFINE_ARGS.append("-D_WIN32")
94+
DEFINE_ARGS.extend(["-D_WIN32", "-D_MSC_VER=1900"])
9695
elif platform.system() == "Linux":
9796
DEFINE_ARGS.append("-D__linux__")
9897
elif platform.system() == "Darwin":
99-
DEFINE_ARGS.append("-D__APPLE__")
98+
DEFINE_ARGS.extend(
99+
[
100+
"-D__APPLE__",
101+
"-D__MACH__",
102+
# Avoid problematic macros that can cause unbalanced conditionals
103+
"-U_MSC_VER", # Don't pretend to be MSVC on macOS
104+
"-U_WIN32",
105+
"-UWIN32",
106+
# Define away problematic Apple-specific macros
107+
"-D__builtin_available(...)=1",
108+
"-D__has_feature(x)=0",
109+
"-D__has_extension(x)=0",
110+
"-D__has_attribute(x)=0",
111+
# Let macOS use its standard bool handling instead of our bool redefinition
112+
"-Ubool", # Undefine our bool override
113+
"-U_Bool", # Undefine our _Bool override
114+
"-Utrue", # Undefine our true override
115+
"-Ufalse", # Undefine our false override
116+
]
117+
)
100118

101119
FUNCTION_BLACKLIST = {}
102120

0 commit comments

Comments
 (0)