1
0
mirror of https://github.com/postgres/postgres.git synced 2026-01-26 09:41:40 +03:00

Fix PL/Python build on MSVC with older Meson

Amendment for commit 2bc60f8621.  With older Meson versions, we need
to specify the Python include directory directly to cc.check_header
instead of relying on the dependency to pass it through.

Author: Bryan Green <dbryan.green@gmail.com>
Discussion: https://www.postgresql.org/message-id/0de98c41-4145-44c1-aac5-087cf5b3e4a9%40gmail.com
This commit is contained in:
Peter Eisentraut
2026-01-16 17:21:32 +01:00
parent 71379663fe
commit 6831cd9e3b

View File

@@ -1342,17 +1342,22 @@ if not pyopt.disabled()
# this internally:
# <https://github.com/mesonbuild/meson/issues/13824>.
if host_system == 'windows' and cc.get_id() == 'msvc'
python3_libdir = python3_inst.get_variable('prefix') / 'libs'
python3_prefix = python3_inst.get_variable('prefix')
python3_libdir = python3_prefix / 'libs'
python3_incdir = python3_prefix / 'include'
python3_lib = cc.find_library('python3', dirs: python3_libdir, required: pyopt)
python3_dep = declare_dependency(
include_directories: include_directories(python3_inst.get_variable('prefix') / 'include'),
include_directories: include_directories(python3_incdir),
dependencies: python3_lib,
)
# Explicit args needed for older Meson compatibility
python3_header_check_args = ['/I' + python3_incdir]
else
python3_dep = python3_inst.dependency(embed: true, required: pyopt)
python3_header_check_args = []
endif
# Remove this check after we depend on Meson >= 1.1.0
if not cc.check_header('Python.h', dependencies: python3_dep, required: pyopt, include_directories: postgres_inc)
if not cc.check_header('Python.h', args: python3_header_check_args, dependencies: python3_dep, required: pyopt, include_directories: postgres_inc)
python3_dep = not_found_dep
endif
endif