From: Marcus Comstedt Date: Thu, 14 Aug 2014 21:07:45 +0000 (+0200) Subject: Makefile.am: Fix out-of-tree build for C++ and Java bindings X-Git-Tag: libsigrok-0.4.0~1143 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=33c84e81975c75b73002b038a0076f384ca13d63;p=libsigrok.git Makefile.am: Fix out-of-tree build for C++ and Java bindings --- diff --git a/Makefile.am b/Makefile.am index aa162adc..eb72a146 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/bindings/cxx/Doxyfile b/bindings/cxx/Doxyfile index f0c8fd04..ed7bf5b7 100644 --- a/bindings/cxx/Doxyfile +++ b/bindings/cxx/Doxyfile @@ -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 diff --git a/bindings/cxx/enums.py b/bindings/cxx/enums.py index fdc8e8e3..380faf91 100644 --- a/bindings/cxx/enums.py +++ b/bindings/cxx/enums.py @@ -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! */" diff --git a/bindings/java/Doxyfile b/bindings/java/Doxyfile index 625bb106..a32e480b 100644 --- a/bindings/java/Doxyfile +++ b/bindings/java/Doxyfile @@ -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 diff --git a/configure.ac b/configure.ac index 9080e6a3..38e021a4 100644 --- a/configure.ac +++ b/configure.ac @@ -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.