diff options
author | Sayed Adel <seiko@imavr.com> | 2020-12-30 10:15:55 +0000 |
---|---|---|
committer | Sayed Adel <seiko@imavr.com> | 2021-01-03 05:36:30 +0000 |
commit | caec7f21ce3ca2672e93781a379734295c00debe (patch) | |
tree | c765f9be7fb17767f16ec95fe792d46b3474c9ea /numpy/distutils/command/build_ext.py | |
parent | 1b8b46b3f2f68f5be8e52e798eb91c2ac5952745 (diff) | |
download | numpy-caec7f21ce3ca2672e93781a379734295c00debe.tar.gz |
BUG, BLD: Generate the main dispatcher config header into the build dir
The new path becomes `build/src.*/numpy/distutils/include/npy_cpu_dispatch_config.h`
instead of `numpy/core/src/common/_cpu_dispatch.h`.
The new path allows other projects to re-use the CPU dispatcher
once we decide to expose the following headers:
- `numpy/core/src/common/npy_cpu_dispatch.h`
- `numpy/core/src/common/npy_cpu_features.h`
Diffstat (limited to 'numpy/distutils/command/build_ext.py')
-rw-r--r-- | numpy/distutils/command/build_ext.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/numpy/distutils/command/build_ext.py b/numpy/distutils/command/build_ext.py index ca6f8bcd2..448f7941c 100644 --- a/numpy/distutils/command/build_ext.py +++ b/numpy/distutils/command/build_ext.py @@ -146,11 +146,16 @@ class build_ext (old_build_ext): self.compiler.show_customization() if not self.disable_optimization: - opt_cache_path = os.path.abspath(os.path.join(self.build_temp, 'ccompiler_opt_cache_ext.py')) - self.compiler_opt = new_ccompiler_opt(compiler=self.compiler, - cpu_baseline=self.cpu_baseline, - cpu_dispatch=self.cpu_dispatch, - cache_path=opt_cache_path) + dispatch_hpath = os.path.join("numpy", "distutils", "include", "npy_cpu_dispatch_config.h") + dispatch_hpath = os.path.join(self.get_finalized_command("build_src").build_src, dispatch_hpath) + opt_cache_path = os.path.abspath( + os.path.join(self.build_temp, 'ccompiler_opt_cache_ext.py') + ) + self.compiler_opt = new_ccompiler_opt( + compiler=self.compiler, dispatch_hpath=dispatch_hpath, + cpu_baseline=self.cpu_baseline, cpu_dispatch=self.cpu_dispatch, + cache_path=opt_cache_path + ) if not self.compiler_opt.is_cached(): log.info("Detected changes on compiler optimizations, force rebuilding") self.force = True @@ -416,7 +421,12 @@ class build_ext (old_build_ext): copt_baseline_flags = [] copt_macros = [] if not self.disable_optimization: - copt_build_src = None if self.inplace else self.get_finalized_command("build_src").build_src + bsrc_dir = self.get_finalized_command("build_src").build_src + dispatch_hpath = os.path.join("numpy", "distutils", "include") + dispatch_hpath = os.path.join(bsrc_dir, dispatch_hpath) + include_dirs.append(dispatch_hpath) + + copt_build_src = None if self.inplace else bsrc_dir copt_c_sources = [ c_sources.pop(c_sources.index(src)) for src in c_sources[:] if src.endswith(".dispatch.c") |