From 0c078d0fab1d45b43ee2a43460cf99836fed1f1e Mon Sep 17 00:00:00 2001 From: "Mark A. Tsuchida" Date: Mon, 22 Jan 2024 17:12:19 -0600 Subject: [PATCH] wip - swig inc dir from subproject --- meson.build | 15 ++++----------- src/pymmcore/meson.build | 9 +++++++++ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/meson.build b/meson.build index 4a6016b..dcd2ba2 100644 --- a/meson.build +++ b/meson.build @@ -65,22 +65,15 @@ numpy_incdirs = include_directories(fs.relative_to(numpy_abs_incdir, '.')) swig = find_program('swig', native: true) # For now, use MMCore as a subproject. This may be changed to using as a -# proper dependency via a wrap if/when we have MMCore releases (and we have a -# way to compute SWIG -I args). -# Also note that we currently assume MMCore is always a static lib; this may -# change. +# proper dependency via a wrap, but that will likely require better SWIG +# support by Meson in order to get the SWIG include directories from the +# dependency object. mmcore_proj = subproject( 'MMCore', default_options: {'default_library': 'static'}, ) mmcore_dep = mmcore_proj.get_variable('mmcore') -# TODO Is there a better way to get these? It is not possible to extract -# include directories from a dependency or include_directories object. -subproject_dir = meson.project_source_root() / 'mmCoreAndDevices' -swig_incdir_args = [ - '-I' + (subproject_dir / 'MMDevice'), - '-I' + (subproject_dir / 'MMCore'), -] +swig_include_dirs = mmcore_proj.get_variable('swig_include_dirs') subdir('src/pymmcore') diff --git a/src/pymmcore/meson.build b/src/pymmcore/meson.build index 4f8a48b..3cf7979 100644 --- a/src/pymmcore/meson.build +++ b/src/pymmcore/meson.build @@ -15,6 +15,15 @@ # # Author: Mark A. Tsuchida +swig_incdir_args = [] +foreach abspath : swig_include_dirs + # Use relative path for readability only. + swig_incdir_args += '-I' + fs.relative_to( + abspath, + meson.project_build_root(), + ) +endforeach + swig_gen = custom_target( 'swig-pymmcore', input: 'pymmcore_swig.i',