diff --git a/README b/README index 7adaba5..0d39b63 100644 --- a/README +++ b/README @@ -24,14 +24,17 @@ licenses/ Building ======== -Configure project with qmake: - qmake CONFIG+=release +Configure project with qmake. On Windows by default both debug and release +versions are built. On other platforms you need to specify the version +(default is debug): + (Windows) qmake + (Other platforms) qmake CONFIG+=release Build poject with make: (Linux) make (Windows with MinGw) mingw32-make (Visual Studio) nmake - (OSX) make + (OSX) make If you want to install the libraries to your Qt library directory use: make install @@ -39,6 +42,12 @@ If you want to install the libraries to your Qt library directory use: If you want to uninstall the libraries make uninstall +Building as a statically linked library +======================================= + +The same as above applies you will just have to add staticlib to the CONFIG: + qmake CONFIG+=staticlib + Documentation ============= diff --git a/config.pri b/config.pri index 0bd00d1..a790acd 100644 --- a/config.pri +++ b/config.pri @@ -83,6 +83,10 @@ INCLUDEPATH += $$CHART_BUILD_PUBLIC_HEADER_DIR LIBS += -l$$LIBRARY_NAME +# This will undefine Q_DECL_EXPORT/Q_DECL_IMPORT at qchartglobal.h +# They should not be used for staticlib builds. +staticlib:DEFINES+=QTCOMMERCIALCHART_STATICLIB + ##################### UNIT TESTS ############################################################## CONFIG(debug, debug|release) { diff --git a/demos/demos.pri b/demos/demos.pri index 88e4078..2bb792d 100644 --- a/demos/demos.pri +++ b/demos/demos.pri @@ -9,4 +9,7 @@ UI_DIR = $$CHART_BUILD_DIR/demos/$$TARGET RCC_DIR = $$CHART_BUILD_DIR/demos/$$TARGET TEMPLATE = app -QT += core gui \ No newline at end of file +QT += core gui + +# staticlib config causes problems when building executables +staticlib: CONFIG-=staticlib diff --git a/examples/examples.pri b/examples/examples.pri index 19832d8..5a5c6ce 100644 --- a/examples/examples.pri +++ b/examples/examples.pri @@ -9,4 +9,7 @@ UI_DIR = $$CHART_BUILD_DIR/examples/$$TARGET RCC_DIR = $$CHART_BUILD_DIR/examples/$$TARGET TEMPLATE = app -QT += core gui \ No newline at end of file +QT += core gui + +# staticlib config causes problems when building executables +staticlib: CONFIG-=staticlib diff --git a/plugins/plugins.pri b/plugins/plugins.pri index 25ce2d7..3124550 100644 --- a/plugins/plugins.pri +++ b/plugins/plugins.pri @@ -11,3 +11,6 @@ OBJECTS_DIR = $$CHART_BUILD_DIR/plugins/$$TARGET MOC_DIR = $$CHART_BUILD_DIR/plugins/$$TARGET UI_DIR = $$CHART_BUILD_DIR/plugins/$$TARGET RCC_DIR = $$CHART_BUILD_DIR/plugins/$$TARGET + +# staticlib config causes problems when building executables +staticlib: CONFIG-=staticlib diff --git a/src/qchartglobal.h b/src/qchartglobal.h index 5187b51..3bf998c 100644 --- a/src/qchartglobal.h +++ b/src/qchartglobal.h @@ -31,32 +31,38 @@ #endif #if defined(BUILD_PRIVATE_UNIT_TESTS) && defined(QTCOMMERCIALCHART_LIBRARY) -# define QTCOMMERCIALCHART_AUTOTEST_EXPORT Q_DECL_EXPORT +# define QTCOMMERCIALCHART_AUTOTEST_EXPORT Q_DECL_EXPORT #elif defined(BUILD_PRIVATE_UNIT_TESTS) && !defined(QTCOMMERCIALCHART_LIBRARY) -# define QTCOMMERCIALCHART_AUTOTEST_EXPORT Q_DECL_IMPORT +# define QTCOMMERCIALCHART_AUTOTEST_EXPORT Q_DECL_IMPORT #else -# define QTCOMMERCIALCHART_AUTOTEST_EXPORT +# define QTCOMMERCIALCHART_AUTOTEST_EXPORT +#endif + +#ifdef QTCOMMERCIALCHART_STATICLIB +# undef QTCOMMERCIALCHART_EXPORT +# undef QTCOMMERCIALCHART_AUTOTEST_EXPORT +# define QTCOMMERCIALCHART_EXPORT +# define QTCOMMERCIALCHART_AUTOTEST_EXPORT #endif #define QTCOMMERCIALCHART_NAMESPACE QtCommercialChart #ifdef QTCOMMERCIALCHART_NAMESPACE -# define QTCOMMERCIALCHART_BEGIN_NAMESPACE namespace QTCOMMERCIALCHART_NAMESPACE { -# define QTCOMMERCIALCHART_END_NAMESPACE } -# define QTCOMMERCIALCHART_USE_NAMESPACE using namespace QTCOMMERCIALCHART_NAMESPACE; +# define QTCOMMERCIALCHART_BEGIN_NAMESPACE namespace QTCOMMERCIALCHART_NAMESPACE { +# define QTCOMMERCIALCHART_END_NAMESPACE } +# define QTCOMMERCIALCHART_USE_NAMESPACE using namespace QTCOMMERCIALCHART_NAMESPACE; #else -# define QTCOMMERCIALCHART_BEGIN_NAMESPACE -# define QTCOMMERCIALCHART_END_NAMESPACE -# define QTCOMMERCIALCHART_USE_NAMESPACE +# define QTCOMMERCIALCHART_BEGIN_NAMESPACE +# define QTCOMMERCIALCHART_END_NAMESPACE +# define QTCOMMERCIALCHART_USE_NAMESPACE #endif #if defined(DEVELOPMENT_BUILD) && !defined(QT_NO_DEBUG) -#define CHART_DEBUG chartDebug(3,__LINE__,__FILE__,__FUNCTION__) - - #include #include +#define CHART_DEBUG chartDebug(3,__LINE__,__FILE__,__FUNCTION__) + static inline QDebug chartDebug(int numargs,...) { va_list valist; @@ -69,4 +75,5 @@ static inline QDebug chartDebug(int numargs,...) return qDebug()<