]> sigrok.org Git - libsigrok.git/commitdiff
Makefile.am: Fix out-of-tree build for C++ and Java bindings
authorMarcus Comstedt <redacted>
Thu, 14 Aug 2014 21:07:45 +0000 (23:07 +0200)
committerMarcus Comstedt <redacted>
Sun, 17 Aug 2014 10:58:39 +0000 (12:58 +0200)
Makefile.am
bindings/cxx/Doxyfile
bindings/cxx/enums.py
bindings/java/Doxyfile
configure.ac

index aa162adcb03db8dfffd67a87fdc56442966d2c38..eb72a1468dafd940111fbf63463d4d8c07b6f1e5 100644 (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
index f0c8fd040851c1d03a1130b58e80150cdc014b6a..ed7bf5b78a536ada179fbf413551a0701d1907d2 100644 (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
index fdc8e8e3dcda46a68c0afeb3cdaf41a3b01e4227..380faf91d838dc68195fe623d73722e7b38b10d2 100644 (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! */"
index 625bb10659b1b3d6afe44c5dc78aa6333b88acfe..a32e480b7a616cfebd0667ee79c901277ad5e71d 100644 (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
index 9080e6a3f6e108868d5236570eaf11d03ea29a2d..38e021a49dde514e004b556f537ff3395c1f33ff 100644 (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.