Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cffi: Use the distutils preprocessor when available #179

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions make_cffi.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,24 @@
# environment variables like CC.
distutils.sysconfig.customize_compiler(compiler)

# Distutils doesn't set compiler.preprocessor, so invoke the preprocessor
# manually.
# Distutils doesn't always set compiler.preprocessor, so invoke the
# preprocessor manually when needed.
args = getattr(compiler, "preprocessor", None)
if compiler.compiler_type == "unix":
# Using .compiler respects the CC environment variable.
args = [compiler.compiler[0]]
if not args:
# Using .compiler respects the CC environment variable.
args = [compiler.compiler[0], "-E"]
args.extend(
[
"-E",
"-DZSTD_STATIC_LINKING_ONLY",
"-DZDICT_STATIC_LINKING_ONLY",
]
)
elif compiler.compiler_type == "msvc":
args = [compiler.cc]
if not args:
args = [compiler.cc, "/EP"]
args.extend(
[
"/EP",
"/DZSTD_STATIC_LINKING_ONLY",
"/DZDICT_STATIC_LINKING_ONLY",
]
Expand Down