Skip to content

Commit

Permalink
Merge pull request #24468 from seiko2plus/issue_24450
Browse files Browse the repository at this point in the history
BUG: Fix meson build failure due to unchanged inplace auto-generated dispatch config headers
  • Loading branch information
mattip committed Aug 21, 2023
2 parents 3c04e81 + 16f7374 commit e8e523f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,6 @@ tools/swig/test/Array.py

# SIMD generated files #
###################################
# config headers of dispatchable sources
*.dispatch.h
# wrapped sources of dispatched targets, e.g. *.dispatch.avx2.c
*.dispatch.*.c
*.dispatch.*.cpp
# _simd module
numpy/core/src/_simd/_simd.dispatch.c
numpy/core/src/_simd/_simd_data.inc
Expand Down
4 changes: 2 additions & 2 deletions numpy/distutils/command/build_clib.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,8 @@ def build_a_library(self, build_info, lib_name, libraries):
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_build_src = None if self.inplace else bsrc_dir
copt_build_src = bsrc_dir
for _srcs, _dst, _ext in (
((c_sources,), copt_c_sources, ('.dispatch.c',)),
((c_sources, cxx_sources), copt_cxx_sources,
Expand Down
13 changes: 12 additions & 1 deletion numpy/distutils/command/build_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,18 @@ def build_extension(self, ext):
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_build_src = None if self.inplace else bsrc_dir
# Always generate the generated config files and
# dispatch-able sources inside the build directory,
# even if the build option `inplace` is enabled.
# This approach prevents conflicts with Meson-generated
# config headers. Since `spin build --clean` will not remove
# these headers, they might overwrite the generated Meson headers,
# causing compatibility issues. Maintaining separate directories
# ensures compatibility between distutils dispatch config headers
# and Meson headers, avoiding build disruptions.
# See gh-24450 for more details.
copt_build_src = bsrc_dir
for _srcs, _dst, _ext in (
((c_sources,), copt_c_sources, ('.dispatch.c',)),
((c_sources, cxx_sources), copt_cxx_sources,
Expand Down

0 comments on commit e8e523f

Please sign in to comment.