Skip to content

Commit

Permalink
wip - swig inc dir from subproject
Browse files Browse the repository at this point in the history
  • Loading branch information
marktsuchida committed Jan 22, 2024
1 parent 8c5d2b3 commit 0c078d0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
15 changes: 4 additions & 11 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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')
9 changes: 9 additions & 0 deletions src/pymmcore/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 0c078d0

Please sign in to comment.