From 96bb960e29623d63d616d5b0f3c9336b8de0a32f Mon Sep 17 00:00:00 2001 From: Anthonin Bonnefoy Date: Thu, 13 Nov 2025 09:51:45 +0100 Subject: Meson: Fix include path for llvmjit_types.bc When building llvmjit_types.bc, include path currently only provides src/include and src/backend/utils/misc. However, additional include paths may be provided with extra_include_dirs, and if they are necessary, then llvmjit_types.bc will fail due to missing the include paths. This patch replaces the hardcoded include paths of llvmjit_types.bc custom_target, by using postgres_inc_d, which will include the extra_include_dirs. Include of src/backend/utils/misc was also removed as it's unnecessary for the compilation of llvmjit_types.bc. BUILD_ROOT and SOURCE_ROOT were replaced by their project_x_root counterpart. BUILD_ROOT and SOURCE_ROOT provides the source root of the main project if called from a subproject, preventing the use of postgres as a subproject. --- src/backend/jit/llvm/meson.build | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/backend/jit/llvm/meson.build b/src/backend/jit/llvm/meson.build index 805fbd69006..dffdb32fbbc 100644 --- a/src/backend/jit/llvm/meson.build +++ b/src/backend/jit/llvm/meson.build @@ -64,11 +64,12 @@ bitcode_cflags = ['-fno-strict-aliasing', '-fwrapv'] bitcode_cflags += get_option('c_args') bitcode_cflags += cppflags -# XXX: Worth improving on the logic to find directories here -bitcode_cflags += '-I@BUILD_ROOT@/src/include' -bitcode_cflags += '-I@BUILD_ROOT@/src/backend/utils/misc' -bitcode_cflags += '-I@SOURCE_ROOT@/src/include' - +foreach inc_d : postgres_inc_d + # If inc_d is an absolute path, '/' drops everything before. + bitcode_cflags += ['-I' + meson.project_source_root() / inc_d] +endforeach +# For generated header pg_config.h +bitcode_cflags += ['-I' + meson.project_build_root() / 'src/include'] # Note this is intentionally not installed to bitcodedir, as it's not for # inlining -- 2.51.0