dll pack & replace mt

This commit is contained in:
王劲鹏 2021-05-18 16:15:28 +08:00 committed by osborn
parent e82e598921
commit ada65c836f
44 changed files with 137 additions and 60 deletions

View File

@ -28,26 +28,14 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target !isEmpty(target.path): INSTALLS += target
win32:CONFIG(debug, debug|release): { win32:CONFIG(debug, debug|release): {
QMAKE_CFLAGS_DEBUG += -MTd
QMAKE_CXXFLAGS_DEBUG += -MTd
LIBS += -lwinmm LIBS += -lwinmm
LIBS += -lAdvapi32 LIBS += -lAdvapi32
LIBS += -lDbghelp LIBS += -lDbghelp
LIBS += -L$$PWD/../../v8/v8/win32/debug/
LIBS += -lv8_monolith
} }
else:win32:CONFIG(release, debug|release): { else:win32:CONFIG(release, debug|release): {
QMAKE_CFLAGS_RELEASE += -MT
QMAKE_CXXFLAGS_RELEASE += -MT
LIBS += -lwinmm LIBS += -lwinmm
LIBS += -lAdvapi32 LIBS += -lAdvapi32
LIBS += -lDbghelp LIBS += -lDbghelp
LIBS += -L$$PWD/../../v8/v8/win32/release/
LIBS += -lv8_monolith
} }
else:unix: { else:unix: {
LIBS += -L$$PWD/../../v8/v8/darwin/release/ LIBS += -L$$PWD/../../v8/v8/darwin/release/

View File

@ -4,12 +4,14 @@
#include <QQmlEngine> #include <QQmlEngine>
#include <QVariant> #include <QVariant>
#include "DoricExport.h"
#include "DoricInterfaceDriver.h" #include "DoricInterfaceDriver.h"
class DoricViewNode; class DoricViewNode;
class DoricRootNode; class DoricRootNode;
class DoricContext { class DORIC_EXPORT DoricContext {
private: private:
QString mContextId; QString mContextId;
QMap<QString, QObject *> mPluginMap; QMap<QString, QObject *> mPluginMap;

View File

@ -3,9 +3,11 @@
#include <QDebug> #include <QDebug>
#include "DoricExport.h"
#include "DoricContext.h" #include "DoricContext.h"
class DoricContextManager { class DORIC_EXPORT DoricContextManager {
private: private:
static DoricContextManager *local_instance; static DoricContextManager *local_instance;
DoricContextManager() {} DoricContextManager() {}

View File

@ -0,0 +1,10 @@
#ifndef DORICEXPORT_H
#define DORICEXPORT_H
#if defined(DORIC_LIBRARY)
# define DORIC_EXPORT Q_DECL_EXPORT
#else
# define DORIC_EXPORT Q_DECL_IMPORT
#endif
#endif // DORICEXPORT_H

View File

@ -3,10 +3,12 @@
#include <QDebug> #include <QDebug>
#include "DoricExport.h"
#include "DoricInterfaceDriver.h" #include "DoricInterfaceDriver.h"
#include "engine/DoricJSEngine.h" #include "engine/DoricJSEngine.h"
class DoricNativeDriver : public DoricInterfaceDriver { class DORIC_EXPORT DoricNativeDriver : public DoricInterfaceDriver {
private: private:
static DoricNativeDriver *local_instance; static DoricNativeDriver *local_instance;
DoricNativeDriver() {} DoricNativeDriver() {}

View File

@ -3,9 +3,11 @@
#include <QQuickItem> #include <QQuickItem>
#include "DoricExport.h"
#include "DoricContext.h" #include "DoricContext.h"
class DoricPanel { class DORIC_EXPORT DoricPanel {
private: private:
DoricContext *mContext; DoricContext *mContext;
int renderedWidth = -1; int renderedWidth = -1;

View File

@ -4,11 +4,13 @@
#include <QDebug> #include <QDebug>
#include <QString> #include <QString>
#include "DoricExport.h"
#include "utils/DoricObjectFactory.h" #include "utils/DoricObjectFactory.h"
class DoricLibrary; class DoricLibrary;
class DoricRegistry { class DORIC_EXPORT DoricRegistry {
private: private:
static DoricRegistry *local_instance; static DoricRegistry *local_instance;

View File

@ -3,12 +3,14 @@
#include <QJSValue> #include <QJSValue>
#include "DoricExport.h"
#include "DoricCallback.h" #include "DoricCallback.h"
#include "DoricSettableFuture.h" #include "DoricSettableFuture.h"
static QJSValue EMPTY(QJSValue::NullValue); static QJSValue EMPTY(QJSValue::NullValue);
class DoricAsyncResult { class DORIC_EXPORT DoricAsyncResult {
private: private:
QJSValue result = EMPTY; QJSValue result = EMPTY;
DoricCallback *callback; DoricCallback *callback;

View File

@ -3,9 +3,11 @@
#include <QJSValue> #include <QJSValue>
#include "DoricExport.h"
#include "utils/DoricCountDownLatch.h" #include "utils/DoricCountDownLatch.h"
class DoricSettableFuture { class DORIC_EXPORT DoricSettableFuture {
private: private:
QJSValue mResult; QJSValue mResult;
DoricCountDownLatch *mReadyLatch = new DoricCountDownLatch(); DoricCountDownLatch *mReadyLatch = new DoricCountDownLatch();

View File

@ -4,14 +4,13 @@ CONFIG += c++14
TARGET = DoricCore TARGET = DoricCore
TEMPLATE = lib TEMPLATE = lib
CONFIG += staticlib
# The following define makes your compiler emit warnings if you use # The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings # any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Refer to the documentation for the # depend on your compiler). Refer to the documentation for the
# deprecated API to know how to port your code away from it. # deprecated API to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS DEFINES += QT_DEPRECATED_WARNINGS
DEFINES += V8_COMPRESS_POINTERS DEFINES += DORIC_LIBRARY
# You can also make your code fail to compile if it uses deprecated APIs. # You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line. # In order to do so, uncomment the following line.
@ -92,6 +91,7 @@ HEADERS += \
Doric.h \ Doric.h \
DoricContext.h \ DoricContext.h \
DoricContextManager.h \ DoricContextManager.h \
DoricExport.h \
DoricInterfaceDriver.h \ DoricInterfaceDriver.h \
DoricLibrary.h \ DoricLibrary.h \
DoricNativeDriver.h \ DoricNativeDriver.h \

View File

@ -4,7 +4,9 @@
#include <QJSValue> #include <QJSValue>
#include <QObject> #include <QObject>
class DoricBridgeExtension : public QObject { #include "DoricExport.h"
class DORIC_EXPORT DoricBridgeExtension : public QObject {
Q_OBJECT Q_OBJECT
public: public:
explicit DoricBridgeExtension(QObject *parent = nullptr); explicit DoricBridgeExtension(QObject *parent = nullptr);

View File

@ -4,10 +4,12 @@
#include <QJSValue> #include <QJSValue>
#include <QThreadPool> #include <QThreadPool>
#include "DoricExport.h"
#include "../DoricRegistry.h" #include "../DoricRegistry.h"
#include "DoricInterfaceJSE.h" #include "DoricInterfaceJSE.h"
class DoricJSEngine : public QObject { class DORIC_EXPORT DoricJSEngine : public QObject {
Q_OBJECT Q_OBJECT
private: private:
DoricInterfaceJSE *mJSE; DoricInterfaceJSE *mJSE;

View File

@ -3,7 +3,9 @@
#include <QObject> #include <QObject>
class DoricNativeEmpty : public QObject { #include "DoricExport.h"
class DORIC_EXPORT DoricNativeEmpty : public QObject {
Q_OBJECT Q_OBJECT
public: public:

View File

@ -1,13 +1,15 @@
#ifndef NATIVE_JSE_H #ifndef NATIVE_JSE_H
#define NATIVE_JSE_H #define NATIVE_JSE_H
#include "DoricExport.h"
#include "DoricInterfaceJSE.h" #include "DoricInterfaceJSE.h"
#include "native/NativeExecutor.h" #include "native/NativeExecutor.h"
#include "v8/V8Executor.h" #include "v8/V8Executor.h"
enum class JSEType { V8, Native }; enum class JSEType { V8, Native };
class DoricNativeJSE : public DoricInterfaceJSE { class DORIC_EXPORT DoricNativeJSE : public DoricInterfaceJSE {
private: private:
JSEType mType; JSEType mType;

View File

@ -3,7 +3,9 @@
#include <QObject> #include <QObject>
class DoricNativeLog : public QObject { #include "DoricExport.h"
class DORIC_EXPORT DoricNativeLog : public QObject {
Q_OBJECT Q_OBJECT
public: public:

View File

@ -3,7 +3,9 @@
#include <QObject> #include <QObject>
class DoricNativeRequire : public QObject { #include "DoricExport.h"
class DORIC_EXPORT DoricNativeRequire : public QObject {
Q_OBJECT Q_OBJECT
public: public:

View File

@ -4,7 +4,9 @@
#include <QObject> #include <QObject>
#include <QSet> #include <QSet>
class DoricTimerExtension : public QObject { #include "DoricExport.h"
class DORIC_EXPORT DoricTimerExtension : public QObject {
Q_OBJECT Q_OBJECT
private: private:

View File

@ -1,9 +1,11 @@
#ifndef DORICMODALPLUGIN_H #ifndef DORICMODALPLUGIN_H
#define DORICMODALPLUGIN_H #define DORICMODALPLUGIN_H
#include "DoricExport.h"
#include "DoricNativePlugin.h" #include "DoricNativePlugin.h"
class DoricModalPlugin : public DoricNativePlugin { class DORIC_EXPORT DoricModalPlugin : public DoricNativePlugin {
Q_OBJECT Q_OBJECT
public: public:
using DoricNativePlugin::DoricNativePlugin; using DoricNativePlugin::DoricNativePlugin;

View File

@ -1,9 +1,11 @@
#ifndef DORICNETWORKPLUGIN_H #ifndef DORICNETWORKPLUGIN_H
#define DORICNETWORKPLUGIN_H #define DORICNETWORKPLUGIN_H
#include "DoricExport.h"
#include "DoricNativePlugin.h" #include "DoricNativePlugin.h"
class DoricNetworkPlugin : public DoricNativePlugin { class DORIC_EXPORT DoricNetworkPlugin : public DoricNativePlugin {
Q_OBJECT Q_OBJECT
public: public:
using DoricNativePlugin::DoricNativePlugin; using DoricNativePlugin::DoricNativePlugin;

View File

@ -1,13 +1,15 @@
#ifndef DORICPOPOVERPLUGIN_H #ifndef DORICPOPOVERPLUGIN_H
#define DORICPOPOVERPLUGIN_H #define DORICPOPOVERPLUGIN_H
#include "DoricNativePlugin.h"
#include <QQuickItem> #include <QQuickItem>
#include "DoricExport.h"
#include "DoricNativePlugin.h"
static QString TYPE = "popover"; static QString TYPE = "popover";
class DoricPopoverPlugin : public DoricNativePlugin { class DORIC_EXPORT DoricPopoverPlugin : public DoricNativePlugin {
Q_OBJECT Q_OBJECT
public: public:
using DoricNativePlugin::DoricNativePlugin; using DoricNativePlugin::DoricNativePlugin;

View File

@ -1,9 +1,11 @@
#ifndef SHADERPLUGIN_H #ifndef SHADERPLUGIN_H
#define SHADERPLUGIN_H #define SHADERPLUGIN_H
#include "DoricExport.h"
#include "DoricNativePlugin.h" #include "DoricNativePlugin.h"
class DoricShaderPlugin : public DoricNativePlugin { class DORIC_EXPORT DoricShaderPlugin : public DoricNativePlugin {
Q_OBJECT Q_OBJECT
public: public:
using DoricNativePlugin::DoricNativePlugin; using DoricNativePlugin::DoricNativePlugin;

View File

@ -1,9 +1,11 @@
#ifndef DORICSTORAGEPLUGIN_H #ifndef DORICSTORAGEPLUGIN_H
#define DORICSTORAGEPLUGIN_H #define DORICSTORAGEPLUGIN_H
#include "DoricExport.h"
#include "DoricNativePlugin.h" #include "DoricNativePlugin.h"
class DoricStoragePlugin : public DoricNativePlugin { class DORIC_EXPORT DoricStoragePlugin : public DoricNativePlugin {
Q_OBJECT Q_OBJECT
private: private:
static const QString PREF_NAME; static const QString PREF_NAME;

View File

@ -1,9 +1,11 @@
#ifndef DORICGROUPNODE_H #ifndef DORICGROUPNODE_H
#define DORICGROUPNODE_H #define DORICGROUPNODE_H
#include "DoricExport.h"
#include "DoricSuperNode.h" #include "DoricSuperNode.h"
class DoricGroupNode : public DoricSuperNode { class DORIC_EXPORT DoricGroupNode : public DoricSuperNode {
public: public:
using DoricSuperNode::DoricSuperNode; using DoricSuperNode::DoricSuperNode;

View File

@ -1,10 +1,11 @@
#ifndef DORICHLAYOUTNODE_H #ifndef DORICHLAYOUTNODE_H
#define DORICHLAYOUTNODE_H #define DORICHLAYOUTNODE_H
#include "DoricExport.h"
#include "DoricGroupNode.h" #include "DoricGroupNode.h"
class DoricHLayoutNode : public DoricGroupNode { class DORIC_EXPORT DoricHLayoutNode : public DoricGroupNode {
public: public:
using DoricGroupNode::DoricGroupNode; using DoricGroupNode::DoricGroupNode;

View File

@ -1,9 +1,11 @@
#ifndef DORICIMAGENODE_H #ifndef DORICIMAGENODE_H
#define DORICIMAGENODE_H #define DORICIMAGENODE_H
#include "DoricExport.h"
#include "DoricViewNode.h" #include "DoricViewNode.h"
class DoricImageNode : public DoricViewNode { class DORIC_EXPORT DoricImageNode : public DoricViewNode {
public: public:
using DoricViewNode::DoricViewNode; using DoricViewNode::DoricViewNode;

View File

@ -3,9 +3,11 @@
#include <QQuickItem> #include <QQuickItem>
#include "DoricExport.h"
#include "DoricStackNode.h" #include "DoricStackNode.h"
class DoricRootNode : public DoricStackNode { class DORIC_EXPORT DoricRootNode : public DoricStackNode {
public: public:
using DoricStackNode::DoricStackNode; using DoricStackNode::DoricStackNode;

View File

@ -1,9 +1,11 @@
#ifndef DORICSCROLLERNODE_H #ifndef DORICSCROLLERNODE_H
#define DORICSCROLLERNODE_H #define DORICSCROLLERNODE_H
#include "DoricExport.h"
#include "DoricSuperNode.h" #include "DoricSuperNode.h"
class DoricScrollerNode : public DoricSuperNode { class DORIC_EXPORT DoricScrollerNode : public DoricSuperNode {
private: private:
DoricViewNode *mChildNode = nullptr; DoricViewNode *mChildNode = nullptr;

View File

@ -1,9 +1,11 @@
#ifndef DORICSTACKNODE_H #ifndef DORICSTACKNODE_H
#define DORICSTACKNODE_H #define DORICSTACKNODE_H
#include "DoricExport.h"
#include "DoricGroupNode.h" #include "DoricGroupNode.h"
class DoricStackNode : public DoricGroupNode { class DORIC_EXPORT DoricStackNode : public DoricGroupNode {
public: public:
using DoricGroupNode::DoricGroupNode; using DoricGroupNode::DoricGroupNode;

View File

@ -3,9 +3,11 @@
#include <QJsonArray> #include <QJsonArray>
#include "DoricExport.h"
#include "DoricViewNode.h" #include "DoricViewNode.h"
class DoricSuperNode : public DoricViewNode { class DORIC_EXPORT DoricSuperNode : public DoricViewNode {
private: private:
QMap<QString, QJsonValue> subNodes; QMap<QString, QJsonValue> subNodes;

View File

@ -1,9 +1,11 @@
#ifndef DORICTEXTNODE_H #ifndef DORICTEXTNODE_H
#define DORICTEXTNODE_H #define DORICTEXTNODE_H
#include "DoricExport.h"
#include "DoricViewNode.h" #include "DoricViewNode.h"
class DoricTextNode : public DoricViewNode { class DORIC_EXPORT DoricTextNode : public DoricViewNode {
public: public:
using DoricViewNode::DoricViewNode; using DoricViewNode::DoricViewNode;

View File

@ -1,9 +1,11 @@
#ifndef DORICVLAYOUTNODE_H #ifndef DORICVLAYOUTNODE_H
#define DORICVLAYOUTNODE_H #define DORICVLAYOUTNODE_H
#include "DoricExport.h"
#include "DoricGroupNode.h" #include "DoricGroupNode.h"
class DoricVLayoutNode : public DoricGroupNode { class DORIC_EXPORT DoricVLayoutNode : public DoricGroupNode {
public: public:
using DoricGroupNode::DoricGroupNode; using DoricGroupNode::DoricGroupNode;

View File

@ -5,12 +5,14 @@
#include <QJsonValue> #include <QJsonValue>
#include <QQuickItem> #include <QQuickItem>
#include "DoricExport.h"
#include "../utils/DoricContextHolder.h" #include "../utils/DoricContextHolder.h"
#include "../utils/DoricLayouts.h" #include "../utils/DoricLayouts.h"
class DoricSuperNode; class DoricSuperNode;
class DoricViewNode : public DoricContextHolder { class DORIC_EXPORT DoricViewNode : public DoricContextHolder {
protected: protected:
QQuickItem *mView; QQuickItem *mView;

View File

@ -1,9 +1,11 @@
#ifndef DORICSLIDEITEMNODE_H #ifndef DORICSLIDEITEMNODE_H
#define DORICSLIDEITEMNODE_H #define DORICSLIDEITEMNODE_H
#include "DoricExport.h"
#include "shader/DoricStackNode.h" #include "shader/DoricStackNode.h"
class DoricSlideItemNode : public DoricStackNode { class DORIC_EXPORT DoricSlideItemNode : public DoricStackNode {
public: public:
using DoricStackNode::DoricStackNode; using DoricStackNode::DoricStackNode;
}; };

View File

@ -1,10 +1,12 @@
#ifndef DORICSLIDERNODE_H #ifndef DORICSLIDERNODE_H
#define DORICSLIDERNODE_H #define DORICSLIDERNODE_H
#include "DoricExport.h"
#include "DoricSlideItemNode.h" #include "DoricSlideItemNode.h"
#include "shader/DoricSuperNode.h" #include "shader/DoricSuperNode.h"
class DoricSliderNode : public DoricSuperNode { class DORIC_EXPORT DoricSliderNode : public DoricSuperNode {
private: private:
int itemCount = 0; int itemCount = 0;

View File

@ -3,7 +3,9 @@
#include <QString> #include <QString>
class DoricConstant { #include "DoricExport.h"
class DORIC_EXPORT DoricConstant {
public: public:
static const QString DORIC_BUNDLE_SANDBOX; static const QString DORIC_BUNDLE_SANDBOX;

View File

@ -1,9 +1,11 @@
#ifndef DORICCONTEXTHOLDER_H #ifndef DORICCONTEXTHOLDER_H
#define DORICCONTEXTHOLDER_H #define DORICCONTEXTHOLDER_H
#include "DoricExport.h"
#include "../DoricContext.h" #include "../DoricContext.h"
class DoricContextHolder : public QObject { class DORIC_EXPORT DoricContextHolder : public QObject {
protected: protected:
DoricContext *mContext = NULL; DoricContext *mContext = NULL;

View File

@ -3,7 +3,9 @@
#include <QObject> #include <QObject>
class DoricDialogBridge : public QObject { #include "DoricExport.h"
class DORIC_EXPORT DoricDialogBridge : public QObject {
Q_OBJECT Q_OBJECT
public: public:
explicit DoricDialogBridge(QObject *parent = nullptr); explicit DoricDialogBridge(QObject *parent = nullptr);

View File

@ -3,7 +3,9 @@
#include <QObject> #include <QObject>
class DoricImageBridge : public QObject { #include "DoricExport.h"
class DORIC_EXPORT DoricImageBridge : public QObject {
Q_OBJECT Q_OBJECT
public: public:
explicit DoricImageBridge(QObject *parent = nullptr); explicit DoricImageBridge(QObject *parent = nullptr);

View File

@ -3,7 +3,9 @@
#include <QQuickItem> #include <QQuickItem>
class DoricLayoutType { #include "DoricExport.h"
class DORIC_EXPORT DoricLayoutType {
public: public:
const static int DoricUndefined = 0; const static int DoricUndefined = 0;
const static int DoricStack = 1; const static int DoricStack = 1;
@ -11,14 +13,14 @@ public:
const static int DoricHLayout = 3; const static int DoricHLayout = 3;
}; };
class DoricLayoutSpec { class DORIC_EXPORT DoricLayoutSpec {
public: public:
const static int DoricLayoutJust = 0; const static int DoricLayoutJust = 0;
const static int DoricLayoutFit = 1; const static int DoricLayoutFit = 1;
const static int DoricLayoutMost = 2; const static int DoricLayoutMost = 2;
}; };
class DoricGravity { class DORIC_EXPORT DoricGravity {
public: public:
const static int DoricGravitySpecified = 1; const static int DoricGravitySpecified = 1;
const static int DoricGravityStart = 1 << 1; const static int DoricGravityStart = 1 << 1;
@ -41,7 +43,7 @@ public:
DoricGravityCenterX | DoricGravityCenterY; DoricGravityCenterX | DoricGravityCenterY;
}; };
class DoricLayouts : public QObject { class DORIC_EXPORT DoricLayouts : public QObject {
public: public:
explicit DoricLayouts(QObject *parent = nullptr); explicit DoricLayouts(QObject *parent = nullptr);

View File

@ -4,7 +4,9 @@
#include <QObject> #include <QObject>
#include <QVariant> #include <QVariant>
class DoricMouseAreaBridge : public QObject { #include "DoricExport.h"
class DORIC_EXPORT DoricMouseAreaBridge : public QObject {
Q_OBJECT Q_OBJECT
public: public:
explicit DoricMouseAreaBridge(QObject *parent = nullptr); explicit DoricMouseAreaBridge(QObject *parent = nullptr);

View File

@ -6,10 +6,12 @@
#include <QVariant> #include <QVariant>
#include <QtDebug> #include <QtDebug>
#include "DoricExport.h"
#include "yoga/Yoga.h" #include "yoga/Yoga.h"
#include "FlexLayoutConfig.h" #include "FlexLayoutConfig.h"
class FlexLayout : public QObject { class DORIC_EXPORT FlexLayout : public QObject {
Q_OBJECT Q_OBJECT
Q_PROPERTY(int flexShrink READ getFlexShrink WRITE setFlexShrink) Q_PROPERTY(int flexShrink READ getFlexShrink WRITE setFlexShrink)

View File

@ -4,9 +4,11 @@
#include <QObject> #include <QObject>
#include <QtDebug> #include <QtDebug>
#include "DoricExport.h"
#include "yoga/Yoga.h" #include "yoga/Yoga.h"
class FlexLayoutConfig : public QObject { class DORIC_EXPORT FlexLayoutConfig : public QObject {
Q_OBJECT Q_OBJECT
private: private:
YGConfigRef config; YGConfigRef config;

View File

@ -6,12 +6,14 @@
#include <QVariant> #include <QVariant>
#include <QtDebug> #include <QtDebug>
#include "DoricExport.h"
#include "FlexLayoutConfig.h" #include "FlexLayoutConfig.h"
#include "FlexLayout.h" #include "FlexLayout.h"
#include "yoga/Yoga.h" #include "yoga/Yoga.h"
class FlexLayoutService : public QObject { class DORIC_EXPORT FlexLayoutService : public QObject {
Q_OBJECT Q_OBJECT
private: private:
FlexLayoutConfig *config; FlexLayoutConfig *config;

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.14.2, 2021-05-18T14:22:08. --> <!-- Written by QtCreator 4.14.2, 2021-05-18T14:32:35. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>