From: Jens Thiele Date: Mon, 27 Nov 2006 16:44:20 +0000 (+0000) Subject: test support of group having multiple .cpp files X-Git-Tag: v0.2~87 X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=commitdiff_plain;h=c5e54ff222d1174d0c99265f2812cd84fa320986 test support of group having multiple .cpp files --- diff --git a/example-codegen/Makefile.am b/example-codegen/Makefile.am index 4318ca6..b8c4c1c 100644 --- a/example-codegen/Makefile.am +++ b/example-codegen/Makefile.am @@ -4,6 +4,9 @@ LDADD = $(top_builddir)/src/libt2n.la @BOOST_SERIALIZATION_LIB@ @BOOST_LDFLAGS@ CMDGROUPS = default other +default_GROUP = default.cpp +other_GROUP = other-1.cpp other-2.cpp + # unfortunately we can't set those from variables # because they are parsed by automake @@ -15,8 +18,8 @@ client_SOURCES = client.cpp client_LDADD = $(LDADD) libdefault.la libother.la server_SOURCES = server.cpp \ - other.cpp other_server.cpp \ - default.cpp default_server.cpp \ + $(other_GROUP) other_server.cpp \ + $(default_GROUP) default_server.cpp \ foo.hxx noinst_PROGRAMS = client server @@ -24,27 +27,28 @@ noinst_PROGRAMS = client server # always the same: -codegen.stamp: $(CMDGROUPS:%=%.cpp) $(top_builddir)/codegen/codegen -# assuming we have some unix like shell +IFILES=$(foreach i, $(CMDGROUPS), $(foreach j, $($(i)_GROUP), $(j))) +STAMPS=$(CMDGROUPS:=.stamp) +$(STAMPS): %.stamp : $(IFILES) $(top_builddir)/codegen/codegen Makefile.am +# assuming we have some unix like shell (maybe even bash) + echo IFILES: $(IFILES) echo BUILT_SOURCES: $(BUILT_SOURCES) - for i in $(CMDGROUPS); do \ - cp -v $(top_srcdir)/codegen/codegen-stubhead.hxx $${i}_common.hxx; \ - cp -v $(top_srcdir)/codegen/codegen-stubhead.hxx $${i}_server.hxx; \ - done + cp -v $(top_srcdir)/codegen/codegen-stubhead.hxx $*_common.hxx; + cp -v $(top_srcdir)/codegen/codegen-stubhead.hxx $*_server.hxx; # todo use tmp file for xml file - for i in $(CMDGROUPS); do \ - gccxml $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $${i}.cpp -fxml=$${i}.xml; \ - $(top_builddir)/codegen/codegen $${i}.cpp $${i} $${i}.xml; \ - done; touch $@ + for i in $($*_GROUP); do \ + gccxml $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $${i} -fxml=$${i%*.cpp}.xml; \ + done; \ + $(top_builddir)/codegen/codegen $*.cpp $* $($*_GROUP:.cpp=.xml) && touch $@ # assuming we have gnu make? BUILT_SOURCES = $(foreach i, $(CMDGROUPS), $(foreach j, _common.hxx _common.cpp _client.hxx _client.cpp _server.hxx _server.cpp, $(i)$(j)) ) -$(BUILT_SOURCES) : codegen.stamp +$(BUILT_SOURCES) : $(STAMPS) TESTS = test -CLEANFILES = $(BUILT_SOURCES) codegen.stamp +CLEANFILES = $(BUILT_SOURCES) $(STAMPS) # TODO: # howto generate Makefile(.in) from something like this: diff --git a/example-codegen/other.cpp b/example-codegen/other-1.cpp similarity index 88% rename from example-codegen/other.cpp rename to example-codegen/other-1.cpp index c84fcdc..568082d 100644 --- a/example-codegen/other.cpp +++ b/example-codegen/other-1.cpp @@ -31,9 +31,3 @@ LIBT2N_EXPORT bool t3(const std::vector &i) { return (i.size()==1) && (i[0]==10); } - -//! test own type -LIBT2N_EXPORT bool t3(const Foo &foo) -{ - return (foo.i==foo.j); -} diff --git a/example-codegen/other-2.cpp b/example-codegen/other-2.cpp new file mode 100644 index 0000000..05ccc4b --- /dev/null +++ b/example-codegen/other-2.cpp @@ -0,0 +1,21 @@ +#include +// serialization of string +#include +// serialization of pair +#include + +// std::vector +#include +#include + +#include "foo.hxx" + +#include "other_common.hxx" + +using namespace std; + +//! test own type +LIBT2N_EXPORT bool t3(const Foo &foo) +{ + return (foo.i==foo.j); +}