From acbe469322d0ab4aac863192ca5bf6fe1feedaed Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 24 Nov 2011 08:46:23 +0100 Subject: QtSensors: Fix compilation of examples/warnings on Windows. - Fix double->float truncation in tests - Use -rdynamic for g++ only - Introduce EXPORT macro in grue library for Windows to work - Add DESTDIR for the grue lib (to prevent it from ending up in the debug/release subfolders, respectively Change-Id: I3b902b501483c92639c0a6252240db4ed8a4a00d Sanity-Review: Qt Sanity Bot Reviewed-by: Lincoln Ramsay --- examples/sensors/grue/console_app/console_app.pro | 1 + examples/sensors/grue/import/import.pro | 2 +- examples/sensors/grue/lib/gruesensor.h | 12 +++++++++--- examples/sensors/grue/lib/lib.pro | 2 ++ examples/sensors/grue/plugin/main.cpp | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) (limited to 'examples/sensors/grue') diff --git a/examples/sensors/grue/console_app/console_app.pro b/examples/sensors/grue/console_app/console_app.pro index fefc0157..33d43176 100644 --- a/examples/sensors/grue/console_app/console_app.pro +++ b/examples/sensors/grue/console_app/console_app.pro @@ -1,5 +1,6 @@ TEMPLATE=app TARGET=detect_grue +CONFIG += console QT=core sensors SOURCES=main.cpp diff --git a/examples/sensors/grue/import/import.pro b/examples/sensors/grue/import/import.pro index f76b089d..0bb108f7 100644 --- a/examples/sensors/grue/import/import.pro +++ b/examples/sensors/grue/import/import.pro @@ -3,7 +3,7 @@ TARGETPATH = Grue include(qsensorsimport.pri) -QT = declarative sensors +QT = core gui declarative sensors INCLUDEPATH += $$PWD/../lib LIBS += -L$$OUT_PWD/../lib -lgruesensor diff --git a/examples/sensors/grue/lib/gruesensor.h b/examples/sensors/grue/lib/gruesensor.h index 48df1fd8..1465aaaa 100644 --- a/examples/sensors/grue/lib/gruesensor.h +++ b/examples/sensors/grue/lib/gruesensor.h @@ -45,7 +45,13 @@ class GrueSensorReadingPrivate; -class GrueSensorReading : public QSensorReading +#if defined(QT_BUILD_GRUE_LIB) +# define Q_GRUE_EXPORT Q_DECL_EXPORT +#else +# define Q_GRUE_EXPORT Q_DECL_IMPORT +#endif + +class Q_GRUE_EXPORT GrueSensorReading : public QSensorReading { Q_OBJECT Q_PROPERTY(qreal chanceOfBeingEaten READ chanceOfBeingEaten WRITE setChanceOfBeingEaten) @@ -57,7 +63,7 @@ public: // begin generated code -class GrueFilter : public QSensorFilter +class Q_GRUE_EXPORT GrueFilter : public QSensorFilter { public: virtual bool filter(GrueSensorReading *reading) = 0; @@ -65,7 +71,7 @@ private: bool filter(QSensorReading *reading) { return filter(static_cast(reading)); } }; -class GrueSensor : public QSensor +class Q_GRUE_EXPORT GrueSensor : public QSensor { Q_OBJECT public: diff --git a/examples/sensors/grue/lib/lib.pro b/examples/sensors/grue/lib/lib.pro index 1cce4dae..dcfd6895 100644 --- a/examples/sensors/grue/lib/lib.pro +++ b/examples/sensors/grue/lib/lib.pro @@ -1,6 +1,8 @@ TEMPLATE = lib TARGET = gruesensor +DESTDIR = $$OUT_PWD +DEFINES *= QT_BUILD_GRUE_LIB QT = core sensors HEADERS += gruesensor.h\ diff --git a/examples/sensors/grue/plugin/main.cpp b/examples/sensors/grue/plugin/main.cpp index 50333f2d..74a8900d 100644 --- a/examples/sensors/grue/plugin/main.cpp +++ b/examples/sensors/grue/plugin/main.cpp @@ -77,7 +77,7 @@ public: QStringList keys() const { return QStringList() << "grue";} }; -Q_EXPORT_PLUGIN2(libsensors_grueplugin, GrueSensorPlugin); +Q_EXPORT_PLUGIN2(libsensors_grueplugin, GrueSensorPlugin) #include "main.moc" -- cgit v1.2.3