Makefile.am: Fix out-of-tree build for C++ and Java bindings

This commit is contained in:
Marcus Comstedt 2014-08-14 23:07:45 +02:00
parent 7f82ec4d72
commit 33c84e8197
5 changed files with 18 additions and 13 deletions

View File

@ -439,7 +439,7 @@ CPPXMLDOC = bindings/cxx/doxy/xml/index.xml
$(CPPXMLDOC): bindings/cxx/include/libsigrok/libsigrok.hpp \
bindings/cxx/enums.timestamp
$(AM_V_GEN)cd bindings/cxx && doxygen Doxyfile 2>/dev/null
$(AM_V_GEN)cd $(srcdir)/bindings/cxx && BUILDDIR=$(abs_builddir)/bindings/cxx/ doxygen Doxyfile 2>/dev/null
if BINDINGS_PYTHON
@ -485,7 +485,7 @@ JDIR = bindings/java
JPKG = org/sigrok/core
JCLS = $(JDIR)/$(JPKG)/classes
JINT = $(JDIR)/$(JPKG)/interfaces
JSRC = $(JCLS)/*.java $(JINT)/*.java
JSRC = $(JCLS)/*.java $(srcdir)/$(JINT)/*.java
JSWG = $(JCLS)/classes.i
JDOC = $(JCLS)/doc.i
JCXX = $(JCLS)/classes_wrap.cxx
@ -495,14 +495,15 @@ JJAR = $(JDIR)/sigrok-core.jar
java-build: $(JJAR) $(JLIB)
$(JDOC): bindings/swig/doc.py $(CPPXMLDOC)
$(AM_V_GEN)python bindings/swig/doc.py java $(CPPXMLDOC) > $@
$(AM_V_at)test -d $(JCLS) || mkdir -p $(JCLS)
$(AM_V_GEN)python $< java $(CPPXMLDOC) > $@
$(JCXX): $(JSWG) $(JDOC) bindings/swig/classes.i $(library_include_HEADERS)
$(AM_V_GEN)swig -c++ -java -package org.sigrok.core.classes \
-Iinclude -Ibindings/cxx/include -outdir $(JCLS) $(JSWG)
-I$(srcdir)/include -I$(srcdir)/bindings/cxx/include -I$(srcdir) -I$(JCLS) -Ibindings/cxx/include -outdir $(JCLS) -o $@ $<
$(JJAR): $(JCXX)
$(AM_V_GEN)$(JAVAC) -sourcepath $(JDIR) $(JSRC)
$(AM_V_GEN)$(JAVAC) -sourcepath $(JDIR) -d $(JDIR) $(JSRC)
$(AM_V_at)jar cf $(JJAR) -C $(JDIR) $(JPKG)
$(JLIB): $(JCXX) bindings/cxx/libsigrokxx.la $(library_include_HEADERS)
@ -526,7 +527,7 @@ java-clean:
rm -rf $(JDIR)/doxy/
java-doc:
$(AM_v_at)cd $(JDIR) && doxygen Doxyfile 2>/dev/null
$(AM_V_at)cd $(srcdir)/$(JDIR) && BUILDDIR=$(abs_builddir)/$(JDIR)/ doxygen Doxyfile 2>/dev/null
BUILD_EXTRA += java-build
INSTALL_EXTRA += java-install

View File

@ -58,7 +58,7 @@ PROJECT_LOGO = ../../contrib/sigrok-logo-notext.png
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.
OUTPUT_DIRECTORY = doxy
OUTPUT_DIRECTORY = $(BUILDDIR)doxy
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
# directories (in 2 levels) under the output directory of each output format and
@ -1917,7 +1917,7 @@ SEARCH_INCLUDES = YES
# preprocessor.
# This tag requires that the tag SEARCH_INCLUDES is set to YES.
INCLUDE_PATH =
INCLUDE_PATH = $(BUILDDIR)include/libsigrok
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
# patterns (like *.h and *.hpp) to filter out the header-files in the

View File

@ -26,6 +26,10 @@ index_file = sys.argv[1]
# Get directory this script is in.
dirname = os.path.dirname(os.path.realpath(__file__))
outdirname = "bindings/cxx"
if not os.path.exists(os.path.join(outdirname, 'include/libsigrok')):
os.makedirs(os.path.join(outdirname, 'include/libsigrok'))
mapping = dict([
('sr_loglevel', ('LogLevel', 'Log verbosity level')),
('sr_packettype', ('PacketType', 'Type of datafeed packet')),
@ -60,8 +64,8 @@ for compound in index.findall('compound'):
if name in mapping:
classes[member] = mapping[name]
header = open(os.path.join(dirname, 'include/libsigrok/enums.hpp'), 'w')
code = open(os.path.join(dirname, 'enums.cpp'), 'w')
header = open(os.path.join(outdirname, 'include/libsigrok/enums.hpp'), 'w')
code = open(os.path.join(outdirname, 'enums.cpp'), 'w')
for file in (header, code):
print >> file, "/* Generated file - edit enums.py instead! */"

View File

@ -58,7 +58,7 @@ PROJECT_LOGO = ../../contrib/sigrok-logo-notext.png
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.
OUTPUT_DIRECTORY = doxy
OUTPUT_DIRECTORY = $(BUILDDIR)doxy
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
# directories (in 2 levels) under the output directory of each output format and
@ -743,7 +743,7 @@ WARN_LOGFILE =
# spaces.
# Note: If this tag is empty the current directory is searched.
INPUT = org/sigrok/core
INPUT = org/sigrok/core $(BUILDDIR)org/sigrok/core
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses

View File

@ -405,7 +405,7 @@ AC_CHECK_HEADERS([sys/mman.h sys/ioctl.h], [], [HW_BEAGLELOGIC="no"])
AC_SUBST(SR_PKGLIBS)
CFLAGS="$CFLAGS -Iinclude/libsigrok -I${srcdir}/include/libsigrok $LIB_CFLAGS"
CXXFLAGS="$CXXFLAGS -Iinclude/libsigrok -I${srcdir}/include -I${srcdir}/bindings/cxx/include $LIB_CFLAGS"
CXXFLAGS="$CXXFLAGS -Iinclude/libsigrok -I${srcdir}/include -Ibindings/cxx -Ibindings/cxx/include/libsigrok -I${srcdir}/bindings/cxx/include $LIB_CFLAGS"
# Find Java compiler and JNI includes for Java bindings.