[Telepathy-commits] [telepathy-qt4/master] tests/: consistently build generated moc files in _gen
Simon McVittie
simon.mcvittie at collabora.co.uk
Fri Jan 9 07:34:24 PST 2009
Also, in every directory, generate moc files in such a way that we can
build them either from the .h (if there is one) or the .cpp (if not).
Rationale: if the QObject is entirely local to one test, we don't need
to bother making a header just for moc's benefit - we can just run moc
on the .cpp, which contains both declaration and definition. However,
for "library" code that already needs a header, like
tests/peregrine/lib.{h,cpp}, the declaration that moc needs is in the
header.
---
tests/Makefile.am | 11 ++++++++---
tests/dbus/Makefile.am | 6 +++---
tests/dbus/account-basics.cpp | 3 ++-
tests/dbus/do-nothing.cpp | 3 ++-
tests/key-file.cpp | 3 ++-
tests/manager-file.cpp | 3 ++-
6 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 04f2391..2d5f636 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -5,6 +5,7 @@ SUBDIRS = \
pinocchio \
prototype
+# Standalone tests that don't touch D-Bus
TESTS = \
test-key-file \
test-manager-file
@@ -18,8 +19,8 @@ test_manager_file_SOURCES = \
manager-file.cpp
BUILT_SOURCES = \
- key-file.moc.hpp \
- manager-file.moc.hpp
+ _gen/key-file.cpp.moc.hpp \
+ _gen/manager-file.cpp.moc.hpp
LDADD = \
$(QTCORE_LIBS) \
@@ -61,5 +62,9 @@ EXTRA_DIST = \
test-key-file.ini \
test-key-file-format-error.ini
-%.moc.hpp: %.cpp
+_gen/%.moc.hpp: %
+ $(mkdir_p) _gen
$(MOC) $(MOC_INCLUDES) -i $< -o $@
+
+distclean-local:
+ rm -rf _gen
diff --git a/tests/dbus/Makefile.am b/tests/dbus/Makefile.am
index 243f090..7fdc26e 100644
--- a/tests/dbus/Makefile.am
+++ b/tests/dbus/Makefile.am
@@ -4,9 +4,9 @@ TESTS = \
test-do-nothing
BUILT_SOURCES = \
- _gen/do-nothing.moc.hpp
+ _gen/do-nothing.cpp.moc.hpp
-_gen/%.moc.hpp: %.cpp
+_gen/%.moc.hpp: %
$(mkdir_p) _gen
$(MOC) $(MOC_INCLUDES) -i $< -o $@
@@ -21,7 +21,7 @@ TESTS += \
test-account-basics
BUILT_SOURCES += \
- _gen/account-basics.moc.hpp
+ _gen/account-basics.cpp.moc.hpp
test_account_basics_SOURCES = account-basics.cpp
endif
diff --git a/tests/dbus/account-basics.cpp b/tests/dbus/account-basics.cpp
index 20cdadb..420a884 100644
--- a/tests/dbus/account-basics.cpp
+++ b/tests/dbus/account-basics.cpp
@@ -92,4 +92,5 @@ void TestAccountBasics::cleanup()
}
QTEST_MAIN(TestAccountBasics)
-#include "_gen/account-basics.moc.hpp"
+
+#include "_gen/account-basics.cpp.moc.hpp"
diff --git a/tests/dbus/do-nothing.cpp b/tests/dbus/do-nothing.cpp
index db1e40c..cceb8fd 100644
--- a/tests/dbus/do-nothing.cpp
+++ b/tests/dbus/do-nothing.cpp
@@ -66,4 +66,5 @@ void TestDoNothing::cleanupTestCase()
QTEST_MAIN(TestDoNothing)
-#include "_gen/do-nothing.moc.hpp"
+
+#include "_gen/do-nothing.cpp.moc.hpp"
diff --git a/tests/key-file.cpp b/tests/key-file.cpp
index 48f7324..5d56ce8 100644
--- a/tests/key-file.cpp
+++ b/tests/key-file.cpp
@@ -51,4 +51,5 @@ void TestKeyFile::testKeyFile()
}
QTEST_MAIN(TestKeyFile)
-#include "key-file.moc.hpp"
+
+#include "_gen/key-file.cpp.moc.hpp"
diff --git a/tests/manager-file.cpp b/tests/manager-file.cpp
index 6343c68..ed7e821 100644
--- a/tests/manager-file.cpp
+++ b/tests/manager-file.cpp
@@ -111,4 +111,5 @@ const ParamSpec *getParam(const ParamSpecList ¶ms, const QString &name)
}
QTEST_MAIN(TestManagerFile)
-#include "manager-file.moc.hpp"
+
+#include "_gen/manager-file.cpp.moc.hpp"
--
1.5.6.5
More information about the Telepathy-commits
mailing list