summaryrefslogtreecommitdiff
path: root/numpy/distutils/command/build_ext.py
diff options
context:
space:
mode:
authorDeveloper-Ecosystem-Engineering <65677710+Developer-Ecosystem-Engineering@users.noreply.github.com>2021-11-18 14:31:58 -0800
committerGitHub <noreply@github.com>2021-11-18 14:31:58 -0800
commit5e9ce0c0529e3085498ac892941a020a65c7369a (patch)
treea70d9e941549b4a51b493f1b170ef33ce0d5a217 /numpy/distutils/command/build_ext.py
parent2ff7ab64d4e7d5928e96ca95b85350aa9caa2b63 (diff)
parent056abda14dab7fa8daf7a1ab44144aeb2250c216 (diff)
downloadnumpy-5e9ce0c0529e3085498ac892941a020a65c7369a.tar.gz
Merge branch 'numpy:main' into as_min_max
Diffstat (limited to 'numpy/distutils/command/build_ext.py')
-rw-r--r--numpy/distutils/command/build_ext.py57
1 files changed, 33 insertions, 24 deletions
diff --git a/numpy/distutils/command/build_ext.py b/numpy/distutils/command/build_ext.py
index b8378d473..7040a2411 100644
--- a/numpy/distutils/command/build_ext.py
+++ b/numpy/distutils/command/build_ext.py
@@ -243,7 +243,8 @@ class build_ext (old_build_ext):
if l and l != ext_language and ext.language:
log.warn('resetting extension %r language from %r to %r.' %
(ext.name, l, ext_language))
- ext.language = ext_language
+ if not ext.language:
+ ext.language = ext_language
# global language
all_languages.update(ext_languages)
@@ -376,6 +377,9 @@ class build_ext (old_build_ext):
log.info("building '%s' extension", ext.name)
extra_args = ext.extra_compile_args or []
+ extra_cflags = ext.extra_c_compile_args or []
+ extra_cxxflags = ext.extra_cxx_compile_args or []
+
macros = ext.define_macros[:]
for undef in ext.undef_macros:
macros.append((undef,))
@@ -462,38 +466,43 @@ class build_ext (old_build_ext):
macros=macros + copt_macros,
include_dirs=include_dirs,
debug=self.debug,
- extra_postargs=extra_args,
+ extra_postargs=extra_args + extra_cxxflags,
ccompiler=cxx_compiler,
**kws
)
if copt_c_sources:
log.info("compiling C dispatch-able sources")
- c_objects += self.compiler_opt.try_dispatch(copt_c_sources,
- output_dir=output_dir,
- src_dir=copt_build_src,
- macros=macros + copt_macros,
- include_dirs=include_dirs,
- debug=self.debug,
- extra_postargs=extra_args,
- **kws)
+ c_objects += self.compiler_opt.try_dispatch(
+ copt_c_sources,
+ output_dir=output_dir,
+ src_dir=copt_build_src,
+ macros=macros + copt_macros,
+ include_dirs=include_dirs,
+ debug=self.debug,
+ extra_postargs=extra_args + extra_cflags,
+ **kws)
if c_sources:
log.info("compiling C sources")
- c_objects += self.compiler.compile(c_sources,
- output_dir=output_dir,
- macros=macros + copt_macros,
- include_dirs=include_dirs,
- debug=self.debug,
- extra_postargs=extra_args + copt_baseline_flags,
- **kws)
+ c_objects += self.compiler.compile(
+ c_sources,
+ output_dir=output_dir,
+ macros=macros + copt_macros,
+ include_dirs=include_dirs,
+ debug=self.debug,
+ extra_postargs=(extra_args + copt_baseline_flags +
+ extra_cflags),
+ **kws)
if cxx_sources:
log.info("compiling C++ sources")
- c_objects += cxx_compiler.compile(cxx_sources,
- output_dir=output_dir,
- macros=macros + copt_macros,
- include_dirs=include_dirs,
- debug=self.debug,
- extra_postargs=extra_args + copt_baseline_flags,
- **kws)
+ c_objects += cxx_compiler.compile(
+ cxx_sources,
+ output_dir=output_dir,
+ macros=macros + copt_macros,
+ include_dirs=include_dirs,
+ debug=self.debug,
+ extra_postargs=(extra_args + copt_baseline_flags +
+ extra_cxxflags),
+ **kws)
extra_postargs = []
f_objects = []