build: Use common SWIG defines for Python and Java
Make the Python and Java bindings use the same set of preprocessor macros for the SWIG parsing stage, taken from a make variable. Add G_GNUC_{BEGIN,END}_IGNORE_DEPRECATIONS to that set.
This commit is contained in:
parent
e1172cf847
commit
8ebf1469a9
|
@ -581,6 +581,9 @@ $(CPPXMLDOC): bindings/cxx/include/libsigrokcxx/libsigrokcxx.hpp \
|
|||
bindings/cxx/enums.timestamp
|
||||
$(AM_V_GEN)cd $(srcdir)/bindings/cxx && BUILDDIR=$(abs_builddir)/bindings/cxx/ doxygen Doxyfile 2>/dev/null
|
||||
|
||||
# Macro definitions to be used by the SWIG parser.
|
||||
swig_defs = -Dnoexcept= -Dprivate=protected -DG_GNUC_BEGIN_IGNORE_DEPRECATIONS= -DG_GNUC_END_IGNORE_DEPRECATIONS=
|
||||
|
||||
if BINDINGS_PYTHON
|
||||
|
||||
PDIR = bindings/python
|
||||
|
@ -610,7 +613,7 @@ $(PDIR)/timestamp: $(PDIR)/sigrok/core/classes.i \
|
|||
$(nodist_bindings_cxx_libsigrokcxx_la_include_HEADERS) \
|
||||
@ORDER@ bindings/cxx/libsigrokcxx.la
|
||||
$(AM_V_at)$(setup_py) clean --all 2>/dev/null
|
||||
$(AM_V_GEN)$(setup_py) build_ext --swig "$(SWIG)" build_py
|
||||
$(AM_V_GEN)$(setup_py) build_ext --swig "$(SWIG)" --swig-opts '$(swig_defs)' build_py
|
||||
$(AM_V_at): >$@
|
||||
|
||||
python-install:
|
||||
|
@ -658,7 +661,7 @@ $(JCXX): $(srcdir)/$(JSWG) $(JDOC) bindings/swig/classes.i \
|
|||
$(bindings_cxx_libsigrokcxx_la_include_HEADERS) \
|
||||
$(nodist_bindings_cxx_libsigrokcxx_la_include_HEADERS)
|
||||
-$(AM_V_at)rm -f $(java_cleanfiles)
|
||||
$(AM_V_GEN)$(SWIG) -c++ -Dnoexcept= -Dprivate=protected \
|
||||
$(AM_V_GEN)$(SWIG) -c++ $(swig_defs) \
|
||||
-java -package org.sigrok.core.classes \
|
||||
-Ibindings -I$(JCLS) $(local_includes) -I$(srcdir) $(JNI_CPPFLAGS) \
|
||||
-outdir $(JCLS) -o $@ $(srcdir)/$(JSWG)
|
||||
|
|
|
@ -69,6 +69,10 @@ class build_py(_build_py):
|
|||
return _build_py.check_package(self, package, vpath(package_dir))
|
||||
|
||||
class build_ext(_build_ext):
|
||||
def finalize_options(self):
|
||||
_build_ext.finalize_options(self)
|
||||
self.swig_opts = ['-c++', '-threads', '-Isigrok/core', '-I..',
|
||||
'-I' + srcdir_parent] + ['-I%s' % i for i in includes] + self.swig_opts
|
||||
def spawn (self, cmd):
|
||||
cmd[1:-1] = [arg if arg.startswith('-') else unvpath(arg) for arg in
|
||||
cmd[1:-1]]
|
||||
|
@ -87,9 +91,6 @@ setup(
|
|||
ext_modules = [
|
||||
Extension('sigrok.core._classes',
|
||||
sources = [vpath('sigrok/core/classes.i')],
|
||||
swig_opts = ['-c++', '-threads', '-Dnoexcept=', '-Dprivate=protected',
|
||||
'-Isigrok/core', '-I..', '-I' + srcdir_parent] +
|
||||
['-I%s' % i for i in includes],
|
||||
extra_compile_args = ['-Wno-uninitialized'],
|
||||
include_dirs = includes,
|
||||
library_dirs = libdirs,
|
||||
|
|
Loading…
Reference in New Issue