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_clib.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_clib.py')
-rw-r--r-- | numpy/distutils/command/build_clib.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/numpy/distutils/command/build_clib.py b/numpy/distutils/command/build_clib.py index a0db6f31f..1b3004c2f 100644 --- a/numpy/distutils/command/build_clib.py +++ b/numpy/distutils/command/build_clib.py @@ -118,12 +118,15 @@ class build_clib(old_build_clib): self.compiler.show_customization() if not self.disable_optimization: + 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_clib.py' - )) + os.path.join(self.build_temp, 'ccompiler_opt_cache_clib.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 + 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") @@ -271,7 +274,12 @@ class build_clib(old_build_clib): 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") |