summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@gmail.com>2009-02-22 21:44:09 +0000
committerDamien Lespiau <damien.lespiau@gmail.com>2009-02-22 22:46:56 +0000
commite788f256569eb0855e0020a19a6a91fe35ca824a (patch)
treecb3909b503656a980b6cd706b047db9496ef8412
parent1978ee86293710e767d1bad60473cafb673b1b17 (diff)
Fix CXX support
The case where shave was directly called by the Makefile (ie without libtool) for CXX was broken. The test-cxx example library was taken from openimus: http://www.openismus.com/documents/linux/building_libraries/building_libraries.shtml Signed-off-by: Damien Lespiau <damien.lespiau@gmail.com>
-rw-r--r--.gitignore1
-rw-r--r--README3
-rw-r--r--shave/shave.in16
-rw-r--r--test-cxx/AUTHORS4
-rw-r--r--test-cxx/Makefile.am10
-rw-r--r--test-cxx/configure.ac18
-rw-r--r--test-cxx/examplelib-1.0.pc.in11
-rw-r--r--test-cxx/examplelib/Makefile.am16
-rw-r--r--test-cxx/examplelib/examplelib.h30
-rw-r--r--test-cxx/examplelib/something.cc21
-rw-r--r--test-cxx/examplelib/something.h44
-rw-r--r--test-cxx/examplelib/sub/Makefile.am13
-rw-r--r--test-cxx/examplelib/sub/sub.cc20
-rw-r--r--test-cxx/examplelib/sub/sub.h41
-rw-r--r--test-cxx/tools/.gitignore1
-rw-r--r--test-cxx/tools/Makefile.am5
-rw-r--r--test-cxx/tools/tool0.cc13
17 files changed, 261 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
index 747bb5c..4101c90 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,4 +20,5 @@ stamp-*
*.o
*.lo
*.la
+*.pc
.*.sw?
diff --git a/README b/README
index 7e827e8..b90d4fc 100644
--- a/README
+++ b/README
@@ -3,7 +3,8 @@ shave transforms the messy ouput of autotools into a pretty Kbuild-like one.
shave : the actual thing
test-flat-nolt: flat layout, no use of litool (broken!)
test-flat-lt : flat layout, use of libtool
-test-lt : common layout, libtooled, with noinst libs
+test : common layout, libtooled, with noinst libs
+test-cxx : common layout, libtooled, with noinst libs, C++
To use the tests:
* cd $test
diff --git a/shave/shave.in b/shave/shave.in
index 97ff947..0c349d7 100644
--- a/shave/shave.in
+++ b/shave/shave.in
@@ -20,6 +20,7 @@ shift
REEL_TOOL="$1"
shift
+hint_cxx=0
pass_through=0
preserved_args=
while test "$#" -gt 0; do
@@ -34,6 +35,10 @@ while test "$#" -gt 0; do
lt_output="$1"
preserved_args="$preserved_args $opt"
;;
+ g++)
+ hint_cxx=1
+ preserved_args="$preserved_args $opt"
+ ;;
*)
preserved_args="$preserved_args $opt"
;;
@@ -45,13 +50,14 @@ case "$mode,$tool" in
link,*)
pass_through=1
;;
-compile,cxx)
+*,cxx)
Q=" CXX "
;;
-compile,cc|*,*)
- # no "libtool" mode has been given, we are called by the Makefile:
- # -> assume compilation
- mode=compile
+*,cc)
+ Q=" CC "
+ ;;
+*,*)
+ # should not happen
Q=" CC "
;;
esac
diff --git a/test-cxx/AUTHORS b/test-cxx/AUTHORS
new file mode 100644
index 0000000..57fa308
--- /dev/null
+++ b/test-cxx/AUTHORS
@@ -0,0 +1,4 @@
+Murray Cumming <murrayc@usa.net>
+
+Based on the GtkExtra-- project files created by
+Cedric Gustin <gustin@pcpm.ucl.ac.be>
diff --git a/test-cxx/Makefile.am b/test-cxx/Makefile.am
new file mode 100644
index 0000000..3168a29
--- /dev/null
+++ b/test-cxx/Makefile.am
@@ -0,0 +1,10 @@
+## top directory
+
+ACLOCAL_AMFLAGS = -I ../shave
+
+#Build in these directories:
+SUBDIRS= examplelib tools
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = examplelib-1.0.pc
+
diff --git a/test-cxx/configure.ac b/test-cxx/configure.ac
new file mode 100644
index 0000000..6eac7d7
--- /dev/null
+++ b/test-cxx/configure.ac
@@ -0,0 +1,18 @@
+AC_INIT([testflat], [1.0], [damien.lespiauAgmailDcom])
+AM_INIT_AUTOMAKE([foreign])
+AC_CONFIG_MACRO_DIR([../shave])
+AC_CONFIG_HEADERS([config.h])
+AC_PROG_LIBTOOL
+AC_PROG_CC
+AC_PROG_CXX
+SHAVE_INIT([../shave])
+AC_CONFIG_FILES([
+ ../shave/shave
+ ../shave/shave-libtool
+ Makefile
+ examplelib-1.0.pc
+ tools/Makefile
+ examplelib/Makefile
+ examplelib/sub/Makefile
+])
+AC_OUTPUT
diff --git a/test-cxx/examplelib-1.0.pc.in b/test-cxx/examplelib-1.0.pc.in
new file mode 100644
index 0000000..0ae593d
--- /dev/null
+++ b/test-cxx/examplelib-1.0.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: bakery
+Description: Example C++ library.
+Version: @VERSION@
+Libs: -L${libdir} -l@GENERIC_LIBRARY_NAME@-@GENERIC_API_VERSION@
+Cflags: -I${includedir}/@GENERIC_LIBRARY_NAME@-@GENERIC_API_VERSION@ -I${libdir}/@GENERIC_LIBRARY_NAME@-@GENERIC_API_VERSION@/include
+
diff --git a/test-cxx/examplelib/Makefile.am b/test-cxx/examplelib/Makefile.am
new file mode 100644
index 0000000..428471c
--- /dev/null
+++ b/test-cxx/examplelib/Makefile.am
@@ -0,0 +1,16 @@
+## Source directory
+
+SUBDIRS = sub
+
+h_sources = examplelib.h something.h
+cc_sources = something.cc
+
+library_includedir=$(includedir)/$(GENERIC_LIBRARY_NAME)-$(GENERIC_API_VERSION)/$(GENERIC_LIBRARY_NAME)
+library_include_HEADERS = $(h_sources)
+
+INCLUDES = -I$(top_srcdir)
+
+lib_LTLIBRARIES= libexamplelib-1.0.la
+libexamplelib_1_0_la_SOURCES= $(h_sources) $(cc_sources)
+libexamplelib_1_0_la_LIBADD= sub/libsub.la
+
diff --git a/test-cxx/examplelib/examplelib.h b/test-cxx/examplelib/examplelib.h
new file mode 100644
index 0000000..53e60a6
--- /dev/null
+++ b/test-cxx/examplelib/examplelib.h
@@ -0,0 +1,30 @@
+
+/* examplelib.h
+ *
+ * Copyright (C) Murray Cumming
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef EXAMPLELIB_H
+#define EXAMPLELIB_H
+
+//This is a main header - it inludes everything else.
+
+#include "examplelib/something.h"
+#include "examplelib/sub/sub.h"
+
+#endif // EXAMPLELIB_H
+
diff --git a/test-cxx/examplelib/something.cc b/test-cxx/examplelib/something.cc
new file mode 100644
index 0000000..aeb14ce
--- /dev/null
+++ b/test-cxx/examplelib/something.cc
@@ -0,0 +1,21 @@
+#include "examplelib/something.h"
+#include "config.h"
+
+namespace examplelib
+{
+
+Something::Something()
+{
+}
+
+Something::~Something()
+{
+}
+
+
+void Something::doSomething()
+{
+ m_Sub.doSomethingElse();
+}
+
+} //namespace \ No newline at end of file
diff --git a/test-cxx/examplelib/something.h b/test-cxx/examplelib/something.h
new file mode 100644
index 0000000..6136f08
--- /dev/null
+++ b/test-cxx/examplelib/something.h
@@ -0,0 +1,44 @@
+
+/* examplelib.h
+ *
+ * Copyright (C) Murray Cumming
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef EXAMPLELIB_SOMETHING_H
+#define EXAMPLELIB_SOMETHING_H
+
+#include "sub/sub.h"
+
+namespace examplelib
+{
+
+class Something
+{
+public:
+ Something();
+ virtual ~Something();
+
+ virtual void doSomething();
+
+protected:
+ Sub m_Sub;
+};
+
+} //namespace
+
+#endif // EXAMPLELIB_SOMETHING_H
+
diff --git a/test-cxx/examplelib/sub/Makefile.am b/test-cxx/examplelib/sub/Makefile.am
new file mode 100644
index 0000000..940be2c
--- /dev/null
+++ b/test-cxx/examplelib/sub/Makefile.am
@@ -0,0 +1,13 @@
+## sub directory
+
+h_sources = sub.h
+cc_sources = sub.cc
+
+#Install the headers in a versioned directory - e.g. examplelib-1.0:
+library_includedir=$(includedir)/$(GENERIC_LIBRARY_NAME)-$(GENERIC_API_VERSION)/$(GENERIC_LIBRARY_NAME)/sub
+library_include_HEADERS = $(h_sources)
+
+INCLUDES = -I$(top_srcdir)
+
+noinst_LTLIBRARIES= libsub.la
+libsub_la_SOURCES= $(h_sources) $(cc_sources)
diff --git a/test-cxx/examplelib/sub/sub.cc b/test-cxx/examplelib/sub/sub.cc
new file mode 100644
index 0000000..eefae87
--- /dev/null
+++ b/test-cxx/examplelib/sub/sub.cc
@@ -0,0 +1,20 @@
+#include "examplelib/sub/sub.h"
+
+namespace examplelib
+{
+
+Sub::Sub()
+{
+}
+
+Sub::~Sub()
+{
+}
+
+
+void Sub::doSomethingElse()
+{
+ printf("Hello\n");
+}
+
+} //namespace \ No newline at end of file
diff --git a/test-cxx/examplelib/sub/sub.h b/test-cxx/examplelib/sub/sub.h
new file mode 100644
index 0000000..3434ba7
--- /dev/null
+++ b/test-cxx/examplelib/sub/sub.h
@@ -0,0 +1,41 @@
+
+/* sub.h
+ *
+ * Copyright (C) Murray Cumming
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef EXAMPLELIB_SUB_H
+#define EXAMPLELIB_SUB_H
+
+#include <stdio.h>
+
+namespace examplelib
+{
+
+class Sub
+{
+public:
+ Sub();
+ virtual ~Sub();
+
+ virtual void doSomethingElse();
+};
+
+} //namespace
+
+#endif // EXAMPLELIB_SUB_H
+
diff --git a/test-cxx/tools/.gitignore b/test-cxx/tools/.gitignore
new file mode 100644
index 0000000..02362c7
--- /dev/null
+++ b/test-cxx/tools/.gitignore
@@ -0,0 +1 @@
+tool0
diff --git a/test-cxx/tools/Makefile.am b/test-cxx/tools/Makefile.am
new file mode 100644
index 0000000..ae9e421
--- /dev/null
+++ b/test-cxx/tools/Makefile.am
@@ -0,0 +1,5 @@
+bin_PROGRAMS = tool0
+
+tool0_SOURCES = tool0.cc
+tool0_CPPFLAGS = -I$(top_srcdir)/examplelib
+tool0_LDADD = $(top_builddir)/examplelib/libexamplelib-1.0.la
diff --git a/test-cxx/tools/tool0.cc b/test-cxx/tools/tool0.cc
new file mode 100644
index 0000000..27a8dcf
--- /dev/null
+++ b/test-cxx/tools/tool0.cc
@@ -0,0 +1,13 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "something.h"
+
+using namespace examplelib;
+
+main()
+{
+ Something aThing;
+ aThing.doSomething();
+}