avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sbana...@apache.org
Subject svn commit: r827822 - in /hadoop/avro/trunk: CHANGES.txt build.xml src/c++/Makefile.in src/c++/configure src/c++/configure.in src/c++/scripts/gen-cppcode.py src/c++/scripts/gen.py src/doc/content/xdocs/site.xml
Date Tue, 20 Oct 2009 22:31:36 GMT
Author: sbanacho
Date: Tue Oct 20 22:31:35 2009
New Revision: 827822

URL: http://svn.apache.org/viewvc?rev=827822&view=rev
Log:
 AVRO-148. Add ant target to build c++ project.  

Added:
    hadoop/avro/trunk/src/c++/scripts/gen-cppcode.py
      - copied unchanged from r827821, hadoop/avro/trunk/src/c++/scripts/gen.py
Removed:
    hadoop/avro/trunk/src/c++/scripts/gen.py
Modified:
    hadoop/avro/trunk/CHANGES.txt
    hadoop/avro/trunk/build.xml
    hadoop/avro/trunk/src/c++/Makefile.in
    hadoop/avro/trunk/src/c++/configure
    hadoop/avro/trunk/src/c++/configure.in
    hadoop/avro/trunk/src/doc/content/xdocs/site.xml

Modified: hadoop/avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/CHANGES.txt?rev=827822&r1=827821&r2=827822&view=diff
==============================================================================
--- hadoop/avro/trunk/CHANGES.txt (original)
+++ hadoop/avro/trunk/CHANGES.txt Tue Oct 20 22:31:35 2009
@@ -18,6 +18,8 @@
     AVRO-155. Make python avro.io.DataFileReader iterable.
     (Jeff Hammerbacher via sharad)
 
+    AVRO-148. Add ant target to build c++ project.  (sbanacho)
+
   OPTIMIZATIONS
 
   BUG FIXES

Modified: hadoop/avro/trunk/build.xml
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/build.xml?rev=827822&r1=827821&r2=827822&view=diff
==============================================================================
--- hadoop/avro/trunk/build.xml (original)
+++ hadoop/avro/trunk/build.xml Tue Oct 20 22:31:35 2009
@@ -36,8 +36,11 @@
   <property name="java.src.dir" value="${src.dir}/java"/>
   <property name="c.src.dir" value="${src.dir}/c"/>
   <property name="c.build.dir" value="${build.dir}/c/obj"/>
+  <property name="cpp.src.dir" value="${src.dir}/c++"/>
+  <property name="cpp.build.dir" value="${build.dir}/c++"/>
   <property name="lib.dir" value="${basedir}/lib"/>
   <property name="install.c" value="${build.dir}/c/install"/>
+  <property name="install.cpp" value="${build.dir}/c++/install"/>
   <property name="dist.dir" value="${build.dir}/${fullname}"/>
 
   <property name="build.classes" value="${build.dir}/classes"/>
@@ -45,6 +48,7 @@
   <property name="build.javadoc" value="${build.doc}/api/java"/>
   <property name="build.javadoc.log" value="${build.dir}/javadoc.log"/>
   <property name="build.cdoc" value="${build.doc}/api/c"/>
+  <property name="build.cppdoc" value="${build.doc}/api/cpp"/>
 
   <exec executable="sed" inputstring="${os.name}" outputproperty="nonspace.os">
      <arg value="s/ /_/g"/>
@@ -121,7 +125,7 @@
     </condition>
   </target>
 
-  <target name="compile" depends="compile-java,compile-c"/>
+  <target name="compile" depends="compile-java,compile-c,compile-cpp"/>
 
   <target name="compile-java" depends="schemata,ivy-retrieve">
     <java-compiler excludes="**/ipc/** **/*Requestor.java **/*Responder.java"/>
@@ -265,7 +269,7 @@
     </sequential>
   </macrodef>
 
-  <target name="test" depends="test-java,test-py,test-c,test-interop"/>
+  <target name="test" depends="test-java,test-py,test-c,test-cpp,test-interop"/>
 
   <macrodef name="test-runner">
     <attribute name="files.location" />
@@ -438,7 +442,7 @@
     </py-doc>
   </target>
 
-  <target name="doc" depends="forrest.check,javadoc,pydoc,cdoc" description="Generate
forrest-based documentation. To use, specify -Dforrest.home=&lt;base of Apache Forrest
installation&gt; on the command line." if="forrest.home">
+  <target name="doc" depends="forrest.check,javadoc,pydoc,cdoc,cppdoc" description="Generate
forrest-based documentation. To use, specify -Dforrest.home=&lt;base of Apache Forrest
installation&gt; on the command line." if="forrest.home">
     <echo  file="${build.dir}/avro.ent" append="false">
       &lt;!ENTITY AvroVersion "${version}"&gt;
     </echo>
@@ -491,7 +495,7 @@
     <fail if="javadoc.warnings">Javadoc warnings!</fail>
   </target>
 
-  <target name="package" depends="jar, doc, package-c"
+  <target name="package" depends="jar, doc, package-c, package-cpp"
 	  description="Build distribution">
     <mkdir dir="${dist.dir}"/>
     <mkdir dir="${dist.dir}/lib"/>
@@ -506,6 +510,10 @@
       <fileset dir="${install.c}"/>
     </copy>
 
+    <copy todir="${dist.dir}/c++" includeEmptyDirs="false">
+      <fileset dir="${install.cpp}"/>
+    </copy>
+
     <copy todir="${dist.dir}"> 
       <fileset file="${build.dir}/${fullname}.jar"/>
     </copy>
@@ -632,4 +640,48 @@
   </target>
   <!-- End C Targets -->
 
+  <!-- C++ Targets -->
+  <target name="cppdoc" depends="configure-cpp">
+    <mkdir dir="${build.cppdoc}"/>
+    <exec dir="${cpp.build.dir}" executable="make" failonerror="true">
+      <env key="CPP_DOC_DIR" value="${build.cppdoc}" />
+      <arg line="doc" />
+    </exec>
+  </target>
+
+  <target name="configure-cpp-check">
+    <uptodate targetfile="${cpp.build.dir}/Makefile"
+	      srcfile="${cpp.src.dir}/configure"
+	      property="configure-cpp-not-needed"/>
+  </target>
+
+  <target name="configure-cpp" depends="configure-cpp-check"
+	  unless="configure-cpp-not-needed">
+    <mkdir dir="${cpp.build.dir}" />
+    <exec dir="${cpp.build.dir}" executable="sh" failonerror="true">
+      <arg line="${cpp.src.dir}/configure --prefix=${install.cpp}/${build.platform}"/>
+    </exec>
+  </target>
+
+  <target name="compile-cpp" depends="configure-cpp">
+    <exec dir="${cpp.build.dir}" executable="make" failonerror="true"/>
+  </target>
+
+  <target name="test-cpp" depends="compile-cpp">
+    <exec dir="${cpp.build.dir}" executable="make" failonerror="true">
+      <arg value="check"/>
+    </exec>
+  </target>
+
+  <target name="package-cpp" depends="compile-cpp">
+    <exec dir="${cpp.build.dir}" executable="make" failonerror="true">
+      <arg value="install"/>
+    </exec>
+  </target>
+
+  <target name="cpp-makefile-check">
+    <available file="${cpp.build.dir}/Makefile" property="cpp-makefile-present"/>
+  </target>
+  <!-- End C++ Targets -->
+
 </project>

Modified: hadoop/avro/trunk/src/c++/Makefile.in
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c%2B%2B/Makefile.in?rev=827822&r1=827821&r2=827822&view=diff
==============================================================================
--- hadoop/avro/trunk/src/c++/Makefile.in (original)
+++ hadoop/avro/trunk/src/c++/Makefile.in Tue Oct 20 22:31:35 2009
@@ -12,6 +12,8 @@
 infodir = $(prefix)/info
 libdir = $(prefix)/lib/gnudl
 mandir = $(prefix)/man/man1
+datarootdir = @datarootdir@
+docdir = @docdir@
 
 CXX = @CXX@
 CPPFLAGS = @CPPFLAGS@
@@ -22,6 +24,7 @@
 LEX = @LEX@
 YACC = @YACC@
 DOXYGEN = @DOXYGEN@
+PYTHON = @PYTHON@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
@@ -33,6 +36,8 @@
 AVROTEST = $(srcdir)/test
 AVROSCRIPTS = $(srcdir)/scripts
 
+AVRO_STATIC= $(OBJDIR)/libavrocpp.a
+
 EXECS = unittest testparser precompile testgen
 EXECSDIR = obj
 AVROEXECS = $(EXECS:%=$(EXECSDIR)/%)
@@ -57,20 +62,21 @@
 GENERATEDobjs = $(addsuffix .o, $(sort $(basename $(GENERATED))) )
 GENERATEDOBJS = $(GENERATEDobjs:%=$(OBJDIR)/%)
 
-all : $(OBJDIR)/avrolib.a 
+all : $(AVRO_STATIC) $(AVRO_DYNAMIC) $(AVROEXECS)
 
 check: $(AVROEXECS)
+	$(EXECSDIR)/testparser < $(AVROSCHEMAS)/bigrecord
 	$(EXECSDIR)/unittest
 	$(EXECSDIR)/testgen $(AVROSCHEMAS)/bigrecord
 
-CXXFLAGS = -Wall -g $(CPPFLAGS)
+CXXFLAGS = -Wall -g -fPIC $(CPPFLAGS)
 
-$(OBJDIR)/avrolib.a : $(OBJS) $(GENERATEDOBJS)
+$(AVRO_STATIC) : $(OBJS) $(GENERATEDOBJS)
 	ar ruc $@ $^ 
 	ranlib $@
 
-$(EXECSDIR)/unittest : $(AVROTEST)/unittest.cc $(OBJDIR)/avrolib.a $(HEADERS)
-	$(CXX) $(CXXFLAGS) $(INCFLAGS) -o $@ $< $(OBJDIR)/avrolib.a $(LIBS)
+$(EXECSDIR)/unittest : $(AVROTEST)/unittest.cc $(AVRO_STATIC) $(HEADERS)
+	$(CXX) $(CXXFLAGS) $(INCFLAGS) -o $@ $< $(AVRO_STATIC) $(LIBS)
 
 $(OBJDIR)/%.o : $(AVROSOURCES)/%.cc
 	$(CXX) $(CXXFLAGS) $(INCFLAGS) -c -o $@ $<
@@ -91,26 +97,33 @@
 $(OBJDIR)/lex.yy.o : $(OBJDIR)/lex.yy.cc
 	$(CXX) $(CXXFLAGS)  -Wno-unused $(INCFLAGS) -c -o $@ $< 
 
-$(EXECSDIR)/testparser: $(AVROTEST)/testparser.cc $(OBJDIR)/avrolib.a 
-	$(CXX) $(CXXFLAGS) $(INCFLAGS) -o $@ $^ $(LIBS)
+$(EXECSDIR)/testparser: $(AVROTEST)/testparser.cc $(AVRO_STATIC)
+	$(CXX) $(CXXFLAGS) $(INCFLAGS) -o $@ $^ $(LIBS) 
 
-$(EXECSDIR)/precompile: $(AVROTEST)/precompile.cc $(OBJDIR)/avrolib.a 
+$(EXECSDIR)/precompile: $(AVROTEST)/precompile.cc $(AVRO_STATIC)
 	$(CXX) $(CXXFLAGS) $(INCFLAGS) -o $@ $^ $(LIBS)
 
-$(AVROTEST)/code.hh: $(AVROSCRIPTS)/gen.py $(EXECSDIR)/precompile $(AVROSCHEMAS)/bigrecord
+$(AVROTEST)/code.hh: $(AVROSCRIPTS)/gen-cppcode.py $(EXECSDIR)/precompile $(AVROSCHEMAS)/bigrecord
 	$(EXECSDIR)/precompile < $(AVROSCHEMAS)/bigrecord > obj/bigrecord.flat
-	python $(AVROSCRIPTS)/gen.py < obj/bigrecord.flat > $(AVROTEST)/code.hh
+	$(PYTHON) $(AVROSCRIPTS)/gen-cppcode.py < obj/bigrecord.flat > $(AVROTEST)/code.hh
 
-$(EXECSDIR)/testgen: $(AVROTEST)/code.hh $(AVROTEST)/testgen.cc $(OBJDIR)/avrolib.a 
+$(EXECSDIR)/testgen: $(AVROTEST)/code.hh $(AVROTEST)/testgen.cc $(AVRO_STATIC)
 	$(CXX) $(CXXFLAGS) $(INCFLAGS) -o $@ $^ $(LIBS)
 
-doc/html/index.html: $(SOURCES) $(HEADERS) ./Doxyfile
-	$(DOXYGEN) ./Doxyfile
+CPP_DOC_DIR ?= "./doc"
 
-.PHONY: doc
-doc: doc/html/index.html
+$(CPP_DOC_DIR)/html/index.html: $(SOURCES) $(HEADERS) $(srcdir)/Doxyfile
+	(cat $(srcdir)/Doxyfile; echo "OUTPUT_DIRECTORY=$(CPP_DOC_DIR)";  echo "INPUT=$(HEADERS)")
| $(DOXYGEN) - ;
+
+doc: $(CPP_DOC_DIR)/html/index.html
 
 -include $(DEPENDS)
 
+install: $(AVRO_STATIC) 
+	mkdir -p $(prefix)/lib
+	mkdir -p $(prefix)/include/avro
+	cp $(AVRO_STATIC) $(prefix)/lib
+	cp $(HEADERS) $(prefix)/include/avro
+
 clean :
-	rm -rf $(AVROEXECS) $(OBJS) $(OBJDIR)/avrolib.a $(GENERATEDSRCS) $(GENERATEDOBJS) core
+	rm -rf $(AVROEXECS) $(OBJS) $(AVRO_STATIC) $(GENERATEDSRCS) $(GENERATEDOBJS) core

Modified: hadoop/avro/trunk/src/c++/configure
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c%2B%2B/configure?rev=827822&r1=827821&r2=827822&view=diff
==============================================================================
--- hadoop/avro/trunk/src/c++/configure (original)
+++ hadoop/avro/trunk/src/c++/configure Tue Oct 20 22:31:35 2009
@@ -669,6 +669,7 @@
 YACC
 YFLAGS
 DOXYGEN
+PYTHON
 BOOST_CPPFLAGS
 BOOST_LDFLAGS
 BOOST_REGEX_LIB
@@ -1726,7 +1727,6 @@
 
 
 
-# AC_CONFIG_HEADER([config.h])
 
 # Checks for programs.
 ac_ext=cpp
@@ -3394,6 +3394,43 @@
 fi
 
 
+# Extract the first word of "python", so it can be a program name with args.
+set dummy python; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_PYTHON+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$PYTHON"; then
+  ac_cv_prog_PYTHON="$PYTHON" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext";
}; then
+    ac_cv_prog_PYTHON="python"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+PYTHON=$ac_cv_prog_PYTHON
+if test -n "$PYTHON"; then
+  { echo "$as_me:$LINENO: result: $PYTHON" >&5
+echo "${ECHO_T}$PYTHON" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
 
 # Checks for libraries.
 
@@ -7778,6 +7815,7 @@
 YACC!$YACC$ac_delim
 YFLAGS!$YFLAGS$ac_delim
 DOXYGEN!$DOXYGEN$ac_delim
+PYTHON!$PYTHON$ac_delim
 BOOST_CPPFLAGS!$BOOST_CPPFLAGS$ac_delim
 BOOST_LDFLAGS!$BOOST_LDFLAGS$ac_delim
 BOOST_REGEX_LIB!$BOOST_REGEX_LIB$ac_delim
@@ -7789,7 +7827,7 @@
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 63; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 64; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

Modified: hadoop/avro/trunk/src/c++/configure.in
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c%2B%2B/configure.in?rev=827822&r1=827821&r2=827822&view=diff
==============================================================================
--- hadoop/avro/trunk/src/c++/configure.in (original)
+++ hadoop/avro/trunk/src/c++/configure.in Tue Oct 20 22:31:35 2009
@@ -5,7 +5,6 @@
 AC_INIT([avro], [1.0], [avro-devel@apache.org])
 AC_CONFIG_SRCDIR([api/AvroParse.hh])
 AC_CONFIG_MACRO_DIR([m4])
-# AC_CONFIG_HEADER([config.h])
 
 # Checks for programs.
 AC_PROG_CXX
@@ -15,6 +14,7 @@
 AC_PROG_YACC
 
 AC_CHECK_PROG(DOXYGEN, doxygen, doxygen)
+AC_CHECK_PROG(PYTHON, python, python)
 
 # Checks for libraries.
 AX_BOOST_BASE([1.32.0])

Modified: hadoop/avro/trunk/src/doc/content/xdocs/site.xml
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/doc/content/xdocs/site.xml?rev=827822&r1=827821&r2=827822&view=diff
==============================================================================
--- hadoop/avro/trunk/src/doc/content/xdocs/site.xml (original)
+++ hadoop/avro/trunk/src/doc/content/xdocs/site.xml Tue Oct 20 22:31:35 2009
@@ -43,6 +43,7 @@
     <overview   label="Overview"          href="index.html" />
     <spec       label="Specification"     href="spec.html" />
     <c-api      label="C API"             href="ext:api/c/index" />
+    <cpp-api    label="C++ API"           href="ext:api/cpp/index" />
     <java-api   label="Java API"          href="ext:api/java/index" />
     <py-api     label="Python API"        href="ext:api/py/index" />
     <wiki       label="Wiki"              href="ext:wiki" />
@@ -66,6 +67,9 @@
       <c href="c/">
 	<index href="html/index.html" />
       </c>
+      <cpp href="cpp/">
+	    <index href="html/index.html" />
+      </cpp>
       <java href="java/">
 	<index href="index.html" />
       </java>



Mime
View raw message