From bf3d74fb213ac04b73d7439675d1a048e4369da6 Mon Sep 17 00:00:00 2001 From: Syping Date: Thu, 14 May 2020 14:09:07 +0200 Subject: [PATCH] add LuaEngineAddon --- .ci/luaengine.nsi | 46 ++++++------- .gitlab-ci.yml | 6 +- src/luaengine/luaengine.pro | 2 +- src/luaenginec/luaenginec.pro | 2 +- src/luaenginecore/luaengine/LuaEngineAddon.h | 70 ++++++++++++++++++++ src/luaenginecore/luaenginecore.pro | 3 +- src/luaenginegui/luaenginegui.pro | 2 +- src/luaengineio/luaengine/LuaEngineIO.cpp | 6 -- src/luaengineio/luaengine/LuaEngineIO.h | 4 +- src/luaengineio/luaengineio.pro | 2 +- src/luaengineos/luaengine/LuaEngineOS.cpp | 6 -- src/luaengineos/luaengine/LuaEngineOS.h | 4 +- 12 files changed, 105 insertions(+), 48 deletions(-) create mode 100644 src/luaenginecore/luaengine/LuaEngineAddon.h diff --git a/.ci/luaengine.nsi b/.ci/luaengine.nsi index 0fff031..058c550 100644 --- a/.ci/luaengine.nsi +++ b/.ci/luaengine.nsi @@ -4,7 +4,7 @@ !define COMP_NAME "Syping" !define WEB_SITE "https://luaengine.syping.de/" !define VERSION "0.1.0.0" -!define COPYRIGHT "Copyright © 2018-2019 Syping" +!define COPYRIGHT "Copyright © 2018-2020 Syping" !define DESCRIPTION "LuaEngine Runtime and Compiler" !define INSTALLER_NAME "luaengine_setup.exe" !define MAIN_APP_RUNTIME "luaengine.exe" @@ -108,25 +108,24 @@ File "luaenginec.exe" File "LuaEngineGui.dll" File "LuaEngineIO.dll" File "LuaEngineOS.dll" -File "/usr/lib/gcc/x86_64-w64-mingw32/8.3-win32/libgcc_s_seh-1.dll" -File "/usr/lib/gcc/x86_64-w64-mingw32/8.3-win32/libstdc++-6.dll" -File "/opt/windev/libjpeg-turbo-latest_qt64d/bin/libjpeg-62.dll" -File "/opt/windev/qt64d-latest/bin/Qt5Core.dll" -File "/opt/windev/qt64d-latest/bin/Qt5Gui.dll" -File "/opt/windev/qt64d-latest/bin/Qt5Svg.dll" -File "/opt/windev/qt64d-latest/bin/Qt5Widgets.dll" +File "/opt/llvm-mingw/x86_64-w64-mingw32/bin/libc++.dll" +File "/opt/llvm-mingw/x86_64-w64-mingw32/bin/libunwind.dll" +File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5Core.dll" +File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5Gui.dll" +File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5Svg.dll" +File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5Widgets.dll" SetOutPath "$INSTDIR\imageformats" -File "/opt/windev/qt64d-latest/plugins/imageformats/qgif.dll" -File "/opt/windev/qt64d-latest/plugins/imageformats/qicns.dll" -File "/opt/windev/qt64d-latest/plugins/imageformats/qico.dll" -File "/opt/windev/qt64d-latest/plugins/imageformats/qjpeg.dll" -File "/opt/windev/qt64d-latest/plugins/imageformats/qsvg.dll" -File "/opt/windev/qt64d-latest/plugins/imageformats/qtga.dll" -File "/opt/windev/qt64d-latest/plugins/imageformats/qtiff.dll" -File "/opt/windev/qt64d-latest/plugins/imageformats/qwbmp.dll" -File "/opt/windev/qt64d-latest/plugins/imageformats/qwebp.dll" +File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qgif.dll" +File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qicns.dll" +File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qico.dll" +File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qjpeg.dll" +File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qsvg.dll" +File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qtga.dll" +File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qtiff.dll" +File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qwbmp.dll" +File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qwebp.dll" SetOutPath "$INSTDIR\platforms" -File "/opt/windev/qt64d-latest/plugins/platforms/qwindows.dll" +File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/platforms/qwindows.dll" SetOutPath "$INSTDIR\scripts" File "scripts/luaenginec.lea" File "scripts/luaenginert.lea" @@ -134,9 +133,9 @@ SetOutPath "$INSTDIR\sstubs" File "sstubs/windows.json" File "windows.le" SetOutPath "$INSTDIR\styles" -File "/opt/windev/qt64d-latest/plugins/styles/qcleanlooksstyle.dll" -File "/opt/windev/qt64d-latest/plugins/styles/qplastiquestyle.dll" -File "/opt/windev/qt64d-latest/plugins/styles/qwindowsvistastyle.dll" +File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/styles/qcleanlooksstyle.dll" +File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/styles/qplastiquestyle.dll" +File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/styles/qwindowsvistastyle.dll" SectionEnd ###################################################################### @@ -195,9 +194,8 @@ Delete "$INSTDIR\luaenginec.exe" Delete "$INSTDIR\LuaEngineGui.dll" Delete "$INSTDIR\LuaEngineIO.dll" Delete "$INSTDIR\LuaEngineOS.dll" -Delete "$INSTDIR\libgcc_s_seh-1.dll" -Delete "$INSTDIR\libstdc++-6.dll" -Delete "$INSTDIR\libjpeg-62.dll" +Delete "$INSTDIR\libc++.dll" +Delete "$INSTDIR\libunwind.dll" Delete "$INSTDIR\Qt5Core.dll" Delete "$INSTDIR\Qt5Gui.dll" Delete "$INSTDIR\Qt5Svg.dll" diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c3cd46e..545abf4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,7 @@ stages: LuaEngine Windows: stage: runtime - image: syping/qt5-shared-mingw-openssl:5.12.8 + image: syping/qt5-shared-llvm-mingw:5.12.8 variables: QT_SELECT: "qt5-x86_64-w64-mingw32" script: @@ -63,7 +63,7 @@ LuaEngine Debian armhf: LuaEngine PE Windows: stage: portable - image: syping/qt5-static-mingw-openssl:5.12.8 + image: syping/qt5-static-llvm-mingw:5.12.8 variables: QT_SELECT: "qt5-x86_64-w64-mingw32" script: @@ -79,7 +79,7 @@ LuaEngine PE Windows: LuaEngine Setup: stage: deploy - image: syping/qt5-shared-mingw-openssl:5.12.8 + image: syping/qt5-shared-llvm-mingw:5.12.8 script: - apt-get update -qq - apt-get install nsis -qq diff --git a/src/luaengine/luaengine.pro b/src/luaengine/luaengine.pro index 0b89255..b7c87ef 100644 --- a/src/luaengine/luaengine.pro +++ b/src/luaengine/luaengine.pro @@ -53,6 +53,6 @@ win32 { RC_ICONS = ../../res/lua.ico QMAKE_TARGET_COMPANY = "Syping" QMAKE_TARGET_DESCRIPTION = "LuaEngine Runtime" - QMAKE_TARGET_COPYRIGHT = "Copyright (c) 2019 Syping" + QMAKE_TARGET_COPYRIGHT = "Copyright (c) 2019-2020 Syping" QMAKE_TARGET_PRODUCT = "luaengine" } diff --git a/src/luaenginec/luaenginec.pro b/src/luaenginec/luaenginec.pro index 154137d..977bf73 100644 --- a/src/luaenginec/luaenginec.pro +++ b/src/luaenginec/luaenginec.pro @@ -51,6 +51,6 @@ win32 { RC_ICONS = ../../res/lua.ico QMAKE_TARGET_COMPANY = "Syping" QMAKE_TARGET_DESCRIPTION = "LuaEngine Compiler" - QMAKE_TARGET_COPYRIGHT = "Copyright (c) 2019 Syping" + QMAKE_TARGET_COPYRIGHT = "Copyright (c) 2019-2020 Syping" QMAKE_TARGET_PRODUCT = "luaenginec" } diff --git a/src/luaenginecore/luaengine/LuaEngineAddon.h b/src/luaenginecore/luaengine/LuaEngineAddon.h new file mode 100644 index 0000000..81d88af --- /dev/null +++ b/src/luaenginecore/luaengine/LuaEngineAddon.h @@ -0,0 +1,70 @@ +/***************************************************************************** +* luaEngine Lua Engine for Qt +* Copyright (C) 2018-2020 Syping +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*****************************************************************************/ + +#ifndef LUAENGINEADDON_H +#define LUAENGINEADDON_H + +#include "LuaEngine_global.h" +#include "LuaEngine.h" + +class LUAENGINESHARED_EXPORT LuaEngineAddon : public QObject +{ + Q_OBJECT +public: + static void pushFunction(lua_State *L_p, const char *name, lua_CFunction function) { + LuaEngine::pushFunction(L_p, name, function); + } + static void pushPointer(lua_State *L_p, const char *name, void *pointer) { + LuaEngine::pushPointer(L_p, name, pointer); + } + static void pushPointer(lua_State *L_p, void *pointer) { + LuaEngine::pushPointer(L_p, pointer); + } + static void pushVariant(lua_State *L_p, const char *name, const QVariant &variant) { + LuaEngine::pushVariant(L_p, name, variant); + } + static void pushVariant(lua_State *L_p, const QVariant &variant) { + LuaEngine::pushVariant(L_p, variant); + } + static QVariant getVariant(lua_State *L_p, const char *name) { + return LuaEngine::getVariant(L_p, name); + } + static QVariant getVariant(lua_State *L_p, int index) { + return LuaEngine::getVariant(L_p, index); + } + static void* returnPointer(lua_State *L_p) { + return LuaEngine::returnPointer(L_p); + } + static void* getPointer(lua_State *L_p, const char* name) { + return LuaEngine::getPointer(L_p, name); + } + static void* getPointer(lua_State *L_p, int index) { + return LuaEngine::getPointer(L_p, index); + } + static QVariant returnVariant(lua_State *L_p) { + return LuaEngine::returnVariant(L_p); + } + static QVariantList getArguments(lua_State *L_p) { + return LuaEngine::getArguments(L_p); + } + static int getArgumentCount(lua_State *L_p) { + return LuaEngine::getArgumentCount(L_p); + } + +}; + +#endif // LUAENGINEADDON_H diff --git a/src/luaenginecore/luaenginecore.pro b/src/luaenginecore/luaenginecore.pro index e8fddfe..cd3aede 100644 --- a/src/luaenginecore/luaenginecore.pro +++ b/src/luaenginecore/luaenginecore.pro @@ -43,6 +43,7 @@ HEADERS += \ luaengine/LuaEngine.h \ luaengine/LuaEngine_global.h \ luaengine/LuaEngine_macro.h \ + luaengine/LuaEngineAddon.h \ luaengine/LuaEngineRegistry.h SOURCES += \ @@ -116,6 +117,6 @@ win32 { RC_LANG = 0x0 QMAKE_TARGET_COMPANY = "Syping" QMAKE_TARGET_DESCRIPTION = "LuaEngine Library" - QMAKE_TARGET_COPYRIGHT = "Copyright (c) 2018-2019 Syping" + QMAKE_TARGET_COPYRIGHT = "Copyright (c) 2018-2020 Syping" QMAKE_TARGET_PRODUCT = "LuaEngine" } diff --git a/src/luaenginegui/luaenginegui.pro b/src/luaenginegui/luaenginegui.pro index abe8bd5..4d0c7ac 100644 --- a/src/luaenginegui/luaenginegui.pro +++ b/src/luaenginegui/luaenginegui.pro @@ -55,6 +55,6 @@ win32 { RC_LANG = 0x0 QMAKE_TARGET_COMPANY = "Syping" QMAKE_TARGET_DESCRIPTION = "LuaEngine Gui Library" - QMAKE_TARGET_COPYRIGHT = "Copyright (c) 2018-2019 Syping" + QMAKE_TARGET_COPYRIGHT = "Copyright (c) 2018-2020 Syping" QMAKE_TARGET_PRODUCT = "LuaEngineGui" } diff --git a/src/luaengineio/luaengine/LuaEngineIO.cpp b/src/luaengineio/luaengine/LuaEngineIO.cpp index e7f4216..53ab333 100644 --- a/src/luaengineio/luaengine/LuaEngineIO.cpp +++ b/src/luaengineio/luaengine/LuaEngineIO.cpp @@ -32,12 +32,6 @@ #include "unistd.h" #endif -LuaEngineIO::LuaEngineIO(QObject *parent, bool loadBaseLibraries) : LuaEngine(parent, loadBaseLibraries) -{ - L = luaState(); - pushClass(L); -} - void LuaEngineIO::pushClass(lua_State *L_p) { // Directory diff --git a/src/luaengineio/luaengine/LuaEngineIO.h b/src/luaengineio/luaengine/LuaEngineIO.h index de44602..ba4b391 100644 --- a/src/luaengineio/luaengine/LuaEngineIO.h +++ b/src/luaengineio/luaengine/LuaEngineIO.h @@ -19,17 +19,17 @@ #define LUAENGINEIO_H #include "LuaEngineIO_global.h" +#include "LuaEngineAddon.h" #include "LuaEngine.h" #include #include #include #include -class LUAENGINEIOSHARED_EXPORT LuaEngineIO : public LuaEngine +class LUAENGINEIOSHARED_EXPORT LuaEngineIO : public LuaEngineAddon { Q_OBJECT public: - LuaEngineIO(QObject *parent = nullptr, bool loadBaseLibraries = true); static void pushClass(lua_State *L_p); static void pushClass(LuaEngine *luaEngine); static int checkDirectoryExists(lua_State *L_p); diff --git a/src/luaengineio/luaengineio.pro b/src/luaengineio/luaengineio.pro index efa3b91..b1d13fb 100644 --- a/src/luaengineio/luaengineio.pro +++ b/src/luaengineio/luaengineio.pro @@ -55,6 +55,6 @@ win32 { RC_LANG = 0x0 QMAKE_TARGET_COMPANY = "Syping" QMAKE_TARGET_DESCRIPTION = "LuaEngine I/O Library" - QMAKE_TARGET_COPYRIGHT = "Copyright (c) 2019 Syping" + QMAKE_TARGET_COPYRIGHT = "Copyright (c) 2019-2020 Syping" QMAKE_TARGET_PRODUCT = "LuaEngineIO" } diff --git a/src/luaengineos/luaengine/LuaEngineOS.cpp b/src/luaengineos/luaengine/LuaEngineOS.cpp index c42688b..7e2ead1 100644 --- a/src/luaengineos/luaengine/LuaEngineOS.cpp +++ b/src/luaengineos/luaengine/LuaEngineOS.cpp @@ -21,12 +21,6 @@ #include #include -LuaEngineOS::LuaEngineOS(QObject *parent, bool loadBaseLibraries) : LuaEngine(parent, loadBaseLibraries) -{ - L = luaState(); - pushClass(L); -} - void LuaEngineOS::pushClass(lua_State *L_p) { // Process diff --git a/src/luaengineos/luaengine/LuaEngineOS.h b/src/luaengineos/luaengine/LuaEngineOS.h index 8d2f2ad..9a60fab 100644 --- a/src/luaengineos/luaengine/LuaEngineOS.h +++ b/src/luaengineos/luaengine/LuaEngineOS.h @@ -19,15 +19,15 @@ #define LUAENGINEOS_H #include "LuaEngineOS_global.h" +#include "LuaEngineAddon.h" #include "LuaEngine.h" #include #include -class LUAENGINEOSSHARED_EXPORT LuaEngineOS : public LuaEngine +class LUAENGINEOSSHARED_EXPORT LuaEngineOS : public LuaEngineAddon { Q_OBJECT public: - LuaEngineOS(QObject *parent = nullptr, bool loadBaseLibraries = true); static void pushClass(lua_State *L_p); static void pushClass(LuaEngine *luaEngine); static int executeProcess(lua_State *L_p);