diff --git a/include/QtiHanClient/DeviceModel.h b/include/QtiHanClient/DeviceModel.h index 8f1a51c..5a5084a 100644 --- a/include/QtiHanClient/DeviceModel.h +++ b/include/QtiHanClient/DeviceModel.h @@ -9,6 +9,7 @@ #include #include #include +#include "QtiHanClientDefs.h" #include "iHanClient/varcontainer.hpp" #include "iHanClient/MessageBus.hpp" #include "iHanClient/MsgTypes.hpp" @@ -35,7 +36,7 @@ private: }; -class DeviceModel_t : public QAbstractItemModel { +class QTIHANCLIENT_EXPORT DeviceModel_t : public QAbstractItemModel { Q_OBJECT public: enum DeviceRoles { @@ -97,7 +98,7 @@ typedef QMap VarList_t; Q_DECLARE_METATYPE(DeviceModel_t*) Q_DECLARE_METATYPE(VarList_t); -class VarStorageElement: public QObject { +class QTIHANCLIENT_EXPORT VarStorageElement: public QObject { Q_OBJECT public: VarStorageElement() {}; @@ -358,7 +359,7 @@ public: VarStorage var; }; -class VarStorageHelper_t { +class QTIHANCLIENT_EXPORT VarStorageHelper_t { public: VarStorageHelper_t(VarStorage value, VarStorage descriptor, QString Serial); ~VarStorageHelper_t(); diff --git a/include/QtiHanClient/MessageHandler.h b/include/QtiHanClient/MessageHandler.h index 1496b17..3771101 100644 --- a/include/QtiHanClient/MessageHandler.h +++ b/include/QtiHanClient/MessageHandler.h @@ -20,11 +20,12 @@ #include "iHanClient/varcontainer.hpp" #include "iHanClient/MessageBus.hpp" #include "iHanClient/MsgTypes.hpp" +#include "QtiHanClientDefs.h" class QTcpDataIO; typedef enum State_e {S_DISCONNECTED, S_CONNECTED, S_READY} State_e; -class MessageHandler : public QObject, public muscle::AbstractGatewayMessageReceiver +class QTIHANCLIENT_EXPORT MessageHandler : public QObject, public muscle::AbstractGatewayMessageReceiver { Q_OBJECT public: diff --git a/include/QtiHanClient/QtiHanClient.h b/include/QtiHanClient/QtiHanClient.h index 165da6f..50ce482 100644 --- a/include/QtiHanClient/QtiHanClient.h +++ b/include/QtiHanClient/QtiHanClient.h @@ -35,7 +35,9 @@ #include #include -class QtiHanClient : public QObject { +#include "QtiHanClientDefs.h" + +class QTIHANCLIENT_EXPORT QtiHanClient : public QObject { Q_OBJECT public: diff --git a/include/QtiHanClient/QtiHanClientDefs.h b/include/QtiHanClient/QtiHanClientDefs.h new file mode 100644 index 0000000..4ecfe6c --- /dev/null +++ b/include/QtiHanClient/QtiHanClientDefs.h @@ -0,0 +1,51 @@ +/* controlpanel - QtiHanClientDefs.h +** Copyright (c) 2010 Justin Hammond +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program 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 General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +** USA +** +** controlpanel SVN Identification: +** $Rev$ +*/ + +/** @file QtiHanClientDefs.h + * @brief + */ + +#ifndef QTIHANCLIENTDEF_H_ +#define QTIHANCLIENTDEF_H_ + +#include + + +#if (defined _WINDOWS || defined WIN32 || defined _MSC_VER) && !defined MINGW +# if defined QTIHANCLIENT_MAKEDLL // Create the dynamic library. +# define QTIHANCLIENT_EXPORT Q_DECL_EXPORT +# elif defined QTIHANCLIENT_USEDLL // Use the dynamic library +# define QTIHANCLIENT_EXPORT Q_DECL_IMPORT +# else // Create/Use the static library +# define QTIHANCLIENT_EXPORT +# endif +// Disable export warnings +# define QTIHANCLIENT_EXPORT_WARNINGS_OFF __pragma( warning(push) )\ + __pragma( warning(disable: 4251 4275) ) +# define QTIHANCLIENT_EXPORT_WARNINGS_ON __pragma( warning(pop) ) +#else +# define QTIHANCLIENT_EXPORT +# define QTIHANCLIENT_EXPORT_WARNINGS_OFF +# define QTIHANCLIENT_EXPORT_WARNINGS_ON +#endif + +#endif \ No newline at end of file diff --git a/include/QtiHanClient/kdescendantsproxymodel.h b/include/QtiHanClient/kdescendantsproxymodel.h index 8004961..0e1d039 100644 --- a/include/QtiHanClient/kdescendantsproxymodel.h +++ b/include/QtiHanClient/kdescendantsproxymodel.h @@ -25,6 +25,7 @@ class KDescendantsProxyModelPrivate; #include "kitemmodels_export.h" +#include "QtiHanClientDefs.h" /** @brief Proxy Model for restructuring a Tree into a list. @@ -66,7 +67,7 @@ view->setModel(descProxy); @since 4.6 @author Stephen Kelly */ -class KITEMMODELS_EXPORT KDescendantsProxyModel : public QAbstractProxyModel +class QTIHANCLIENT_EXPORT KDescendantsProxyModel : public QAbstractProxyModel { Q_OBJECT diff --git a/libqtihanclient.pri b/libqtihanclient.pri index edf767d..658dfe7 100644 --- a/libqtihanclient.pri +++ b/libqtihanclient.pri @@ -1,7 +1,7 @@ INCLUDEPATH += $$PWD/include/ DEPENDPATH += $$PWD -DEFINES += MUSCLE_SINGLE_THREAD_ONLY +DEFINES += MUSCLE_SINGLE_THREAD_ONLY KITEMMODELS_STATIC_DEFINE SOURCES += $$PWD/src/DeviceModel.cpp \ $$PWD/src/MessageHandler.cpp \ diff --git a/libqtihanclient.pro b/libqtihanclient.pro index a9286a2..1900a27 100644 --- a/libqtihanclient.pro +++ b/libqtihanclient.pro @@ -4,8 +4,7 @@ # #------------------------------------------------- -QT += core gui widgets - +QT += core gui widgets network include (qtihanclientconfig.pri) @@ -13,41 +12,66 @@ include (qtihanclientconfig.pri) TARGET = qt$${QT_MAJOR_VERSION}ihanclient TEMPLATE = lib -CONFIG += lib_bundle c++11 shared link_pkgconfig create_pc create_prl no_install_prl silent +CONFIG += lib_bundle c++11 shared silent debug_and_release -!isEmpty(IHANCLIENTPATH) { - #message($$IHANCLIENTPATH/include/iHanClient/MsgTypes.hpp) - exists($$IHANCLIENTPATH/include/iHanClient/MsgTypes.hpp) { - message("Using Custom Path to iHanClient") - INCLUDEPATH += $$IHANCLIENTPATH/include/ $$IHANCLIENTPATH/muscle/ - LIBS += -L$$IHANCLIENTPATH -lihanclient - CONFIG += staticlib - CONFIG -= create_pc create_prl no_install_prl +unix { + CONFIG += link_pkgconfig create_pc create_prl no_install_prl +} +win32 { + DEFINES += NOMINMAX QTIHANCLIENT_MAKEDLL +} + +unix { + !isEmpty(IHANCLIENTPATH) { + #message($$IHANCLIENTPATH/include/iHanClient/MsgTypes.hpp) + exists($$IHANCLIENTPATH/include/iHanClient/MsgTypes.hpp) { + message("Using Custom Path to iHanClient") + INCLUDEPATH += $$IHANCLIENTPATH/include/ $$IHANCLIENTPATH/muscle/ + LIBS += -L$$IHANCLIENTPATH -lihanclient + CONFIG += staticlib + CONFIG -= create_pc create_prl no_install_prl + } + } else { + PKGCONFIG += libihanclient + } +} +win32 { + exists(ihanclient/include/iHanClient/MsgTypes.hpp) { + message("Using iHanClient Export at ihanclient") + INCLUDEPATH += ihanclient/include/ ihanclient/include/muscle/ + CONFIG(debug, debug|release) { + LIBS += -Lihanclient/Debug/libs/ -lihanclient + } + CONFIG(release, debug|release) { + LIBS += -Lihanclient/Release/libs/ -lihanclient + } + message("Using Libs: $${LIBS}") + } else { + error("ihanclient headers and libs not at $$PWD/ihanclient") } -} else { - PKGCONFIG += libihanclient } + + include (libqtihanclient.pri) +unix { + target.path = $${QIC_INSTALL_LIBS} + headers.files = $${HEADERS} + headers.path = $${QIC_INSTALL_HEADERS} -target.path = $${QIC_INSTALL_LIBS} -headers.files = $${HEADERS} -headers.path = $${QIC_INSTALL_HEADERS} + docs.path = $${QIC_INSTALL_DOCS} + docs.files = README AUTHORS ChangeLog COPYING NEWS + pkgconfig.path = $${QIC_INSTALL_PC} -docs.path = $${QIC_INSTALL_DOCS} -docs.files = README AUTHORS ChangeLog COPYING NEWS -pkgconfig.path = $${QIC_INSTALL_PC} + QMAKE_PKGCONFIG_NAME = libQTiHanClient + QMAKE_PKGCONFIG_DESCRIPTION = Qt bindings for the iHanClient Library + QMAKE_PKGCONFIG_PREFIX = $$INSTALLBASE + QMAKE_PKGCONFIG_LIBDIR = $$target.path + QMAKE_PKGCONFIG_INCDIR = $$QIC_HEADERS_PATH + QMAKE_PKGCONFIG_VERSION = $$VERSION + QMAKE_PKGCONFIG_DESTDIR = pkgconfig -QMAKE_PKGCONFIG_NAME = libQTiHanClient -QMAKE_PKGCONFIG_DESCRIPTION = Qt bindings for the iHanClient Library -QMAKE_PKGCONFIG_PREFIX = $$INSTALLBASE -QMAKE_PKGCONFIG_LIBDIR = $$target.path -QMAKE_PKGCONFIG_INCDIR = $$QIC_HEADERS_PATH -QMAKE_PKGCONFIG_VERSION = $$VERSION -QMAKE_PKGCONFIG_DESTDIR = pkgconfig + INSTALLS += target headers docs - - - -INSTALLS += target headers docs +} diff --git a/qtihanclientconfig.pri b/qtihanclientconfig.pri index 815ab2c..c4f9d0d 100644 --- a/qtihanclientconfig.pri +++ b/qtihanclientconfig.pri @@ -1,9 +1,3 @@ - - -isEmpty(PREFIX) { - PREFIX=/usr/local -} - QIC_VER_MAJ = 0 QIC_VER_MIN = 1 isEmpty(QIC_VER_PAT) { @@ -11,30 +5,39 @@ isEmpty(QIC_VER_PAT) { } VERSION = $${QIC_VER_MAJ}.$${QIC_VER_MIN}.$${QIC_VER_PAT} -isEmpty(DOCDIR) { - QIC_INSTALL_DOCS = $${PREFIX}/share/doc/Qt$${QT_MAJOR_VERSION}iHanClient-$${VERSION}/ -} else { - QIC_INSTALL_DOCS = $${DOCDIR}/Qt$${QT_MAJOR_VERSION}iHanClient-$${VERSION} -} -isEmpty(INCDIR) { - QIC_INSTALL_HEADERS = $${PREFIX}/include/qt$${QT_MAJOR_VERSION}/QtiHanClient - QIC_HEADERS_PATH = $${PREFIX}/include/qt$${QT_MAJOR_VERSION} -} else { - QIC_INSTALL_HEADERS = $${INCDIR}/qt$${QT_MAJOR_VERSION}/QtiHanClient - QIC_HEADERS_PATH = $${INCDIR}/qt$${QT_MAJOR_VERSION} -} -isEmpty(LIBDIR) { - QIC_INSTALL_LIBS = $${PREFIX}/lib64/ -} else { - QIC_INSTALL_LIBS = $${LIBDIR} -} -isEmpty(PKGCONFIGDIR) { - TMP_PATH = $$system(pkg-config pkg-config --variable=pc_path) - QIC_INSTALL_PC = $$section(TMP_PATH, :, 0, 0) -} else { - QIC_INSTALL_PC = $${PKGCONFIGDIR} -} -message(Docs Install Path: $${QIC_INSTALL_DOCS}) -message(Include Install Path: $${QIC_INSTALL_HEADERS}) -message(Lib Install Path: $${QIC_INSTALL_LIBS}) -message(PkgConfig Path: $${QIC_INSTALL_PC}) \ No newline at end of file + + +unix { + isEmpty(PREFIX) { + PREFIX=/usr/local + } + + + isEmpty(DOCDIR) { + QIC_INSTALL_DOCS = $${PREFIX}/share/doc/Qt$${QT_MAJOR_VERSION}iHanClient-$${VERSION}/ + } else { + QIC_INSTALL_DOCS = $${DOCDIR}/Qt$${QT_MAJOR_VERSION}iHanClient-$${VERSION} + } + isEmpty(INCDIR) { + QIC_INSTALL_HEADERS = $${PREFIX}/include/qt$${QT_MAJOR_VERSION}/QtiHanClient + QIC_HEADERS_PATH = $${PREFIX}/include/qt$${QT_MAJOR_VERSION} + } else { + QIC_INSTALL_HEADERS = $${INCDIR}/qt$${QT_MAJOR_VERSION}/QtiHanClient + QIC_HEADERS_PATH = $${INCDIR}/qt$${QT_MAJOR_VERSION} + } + isEmpty(LIBDIR) { + QIC_INSTALL_LIBS = $${PREFIX}/lib64/ + } else { + QIC_INSTALL_LIBS = $${LIBDIR} + } + isEmpty(PKGCONFIGDIR) { + TMP_PATH = $$system(pkg-config pkg-config --variable=pc_path) + QIC_INSTALL_PC = $$section(TMP_PATH, :, 0, 0) + } else { + QIC_INSTALL_PC = $${PKGCONFIGDIR} + } + message(Docs Install Path: $${QIC_INSTALL_DOCS}) + message(Include Install Path: $${QIC_INSTALL_HEADERS}) + message(Lib Install Path: $${QIC_INSTALL_LIBS}) + message(PkgConfig Path: $${QIC_INSTALL_PC}) +} \ No newline at end of file