From 4f9be948dfe4c0b890b9edf483c529cef4e94ad1 Mon Sep 17 00:00:00 2001 From: aspel Date: Fri, 17 Nov 2023 18:48:51 +0200 Subject: [PATCH] ci: fix darwin Signed-off-by: aspel --- .github/workflows/main.yaml | 51 ++++++++++----------- Makefile | 60 +++++++++++++++++++++++++ Makefile.darwin | 60 ------------------------- Makefile.linux | 54 ----------------------- README.md | 1 + main.cpp | 88 +++++++++++++++++++++---------------- main.h | 1 - meson.build | 21 ++++++--- mesonInstaller.sh | 5 --- pobwindow.hpp | 13 +----- 10 files changed, 151 insertions(+), 203 deletions(-) create mode 100644 Makefile delete mode 100644 Makefile.darwin delete mode 100644 Makefile.linux delete mode 100755 mesonInstaller.sh diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 4085634..c1af1f4 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -6,8 +6,8 @@ on: schedule: - cron: '30 13 * * 5' jobs: - build-linux: - runs-on: ubuntu-latest + build-linux-amd64: + runs-on: ubuntu-22.04 steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - id: time @@ -15,21 +15,19 @@ jobs: time=nightly-$(date +'%Y/%m/%d') echo "time=${time}" >> $GITHUB_OUTPUT - uses: actions/checkout@v4 - - run: sudo apt-get install xvfb build-essential ninja-build x11-apps imagemagick libcurl4-openssl-dev - - run: make -f Makefile.linux clean - - run: make -f Makefile.linux tools - - run: make -f Makefile.linux + - run: make - name: Package tar.xz archive - run: tar -cf - -C ${GITHUB_WORKSPACE}/PathOfBuilding/src $(ls -A ${GITHUB_WORKSPACE}"/PathOfBuilding/src") | xz -c > PathOfBuilding.linux.tar.xz + run: tar -cf - -C ${GITHUB_WORKSPACE}/PathOfBuilding $(ls -A ${GITHUB_WORKSPACE}"/PathOfBuilding") | xz -c > PathOfBuilding.linux.amd64.tar.xz - name: Cheking GUI env: IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }} GIT_TOKEN: ${{ secrets.GIT_TOKEN }} DISPLAY: :10 + if: github.ref != 'refs/heads/master' run: | - pushd ${GITHUB_WORKSPACE}/PathOfBuilding/src + pushd ${GITHUB_WORKSPACE}/PathOfBuilding Xvfb :10 -screen 0 1024x768x24 & - sleep 10 + sleep 15 ./PathOfBuilding & sleep 10 xwd -root -silent -display :10 | convert xwd:- png:/tmp/sl.png @@ -41,9 +39,9 @@ jobs: -d "{\"body\":\"![Screenshot Linux](${IMG_URL})\n${GITHUB_SHA} : Linux\"}" popd echo $IMG_URL - if: github.ref != 'refs/heads/master' - - run: tar -tvf PathOfBuilding.linux.tar.xz + - run: tar -tvf PathOfBuilding.linux.amd64.tar.xz - name: Update release tag + if: github.ref == 'refs/heads/master' run: | git config --local user.name "${GITHUB_ACTOR}" git config --local user.email "aspellip@gmail.com" @@ -51,18 +49,17 @@ jobs: git remote add gh https://$GITHUB_ACTOR:$GIT_TOKEN@github.com/$GITHUB_REPOSITORY.git git push -f gh PathOfBuilding git remote remove gh - if: github.ref == 'refs/heads/master' - name: Upload Linux artifacts into Github + if: github.ref == 'refs/heads/master' uses: ncipollo/release-action@v1 with: - artifacts: "PathOfBuilding.linux.tar.xz" + artifacts: "PathOfBuilding.linux.amd64.tar.xz" token: ${{ secrets.GITHUB_TOKEN }} - allowUpdates: true + removeArtifacts: true tag: PathOfBuilding body: "${{steps.time.outputs.time}}" - if: github.ref == 'refs/heads/master' - build-macos: - runs-on: macos-latest + build-macos-amd64: + runs-on: macos-12 steps: - id: time run: | @@ -70,19 +67,18 @@ jobs: echo "time=${time}" >> $GITHUB_OUTPUT # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v4 - - run: brew install make ninja - - run: make -f Makefile.darwin clean - - run: make -f Makefile.darwin tools - - run: make -f Makefile.darwin + - run: brew install make + - run: make - name: Package tar.xz archive - run: tar -cf - PathOfBuilding.app | xz -c > PathOfBuilding.darwin.tar.xz + run: tar -cf - PathOfBuilding.app | xz -c > PathOfBuilding.darwin.amd64.tar.xz - name: Cheking GUI env: IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }} GIT_TOKEN: ${{ secrets.GIT_TOKEN }} + if: github.ref != 'refs/heads/master' run: | ./PathOfBuilding.app/Contents/MacOS/pobWrapper.sh & - sleep 10 + sleep 15 screencapture /tmp/sl.png export IMG_URL=`curl -L -X POST https://api.imgur.com/3/image -H "Authorization: Client-ID ${IMGUR_CLIENT_ID}" -F image=@/tmp/sl.png | jq '.data | .link' | tr -d '"'` pull_number=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") @@ -91,15 +87,14 @@ jobs: https://api.github.com/repos/aspel/pobfrontend/issues/${pull_number}/comments \ -d "{\"body\":\"![Screenshot MacOS](${IMG_URL})\n${GITHUB_SHA} : MacOS\"}" echo $IMG_URL - if: github.ref != 'refs/heads/master' - - run: tar -tvf PathOfBuilding.darwin.tar.xz + - run: tar -tvf PathOfBuilding.darwin.amd64.tar.xz - name: Upload MacOS artifacts into Github + if: github.ref == 'refs/heads/master' uses: ncipollo/release-action@v1 with: - artifacts: "PathOfBuilding.darwin.tar.xz" + artifacts: "PathOfBuilding.darwin.amd64.tar.xz" token: ${{ secrets.GITHUB_TOKEN }} - allowUpdates: true + removeArtifacts: true tag: PathOfBuilding body: "${{steps.time.outputs.time}}" - if: github.ref == 'refs/heads/master' diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f86519f --- /dev/null +++ b/Makefile @@ -0,0 +1,60 @@ +DIR := ${CURDIR} +SHELL := /bin/bash +OS_NAME := $(shell uname -s) +.ONESHELL: # Applies to every targets in the file! +.SHELLFLAGS := -o pipefail -eucx + +# Build based on OS name +all: $(OS_NAME) + +Darwin: pob + LDFLAGS='-L/usr/local/opt/qt@5/lib' \ + CPPFLAGS='-I/usr/local/opt/qt@5/include' \ + PKG_CONFIG_PATH='/usr/local/opt/qt@5/lib/pkgconfig' \ + meson setup --buildtype=release --prefix=${DIR}/PathOfBuilding.app --bindir=Contents/MacOS build + meson compile -C build + meson install -C build + /usr/local/opt/qt@5/bin/macdeployqt ${DIR}/PathOfBuilding.app + cp ${DIR}/Info.plist.sh ${DIR}/PathOfBuilding.app/Contents/Info.plist + echo "Finished $(OS_NAME)" + +Linux: pob + meson setup --buildtype=release build + meson compile -C build + mv build/PathOfBuilding PathOfBuilding/ + echo "Finished $(OS_NAME)" + +pob: clear tools_$(OS_NAME) load_pob luacurl + pushd PathOfBuilding && \ + unzip runtime-win32.zip lua/xml.lua lua/base64.lua lua/sha1.lua && \ + mv lua/*.lua . && \ + rmdir lua && \ + cp ../lcurl.so . && \ + mv src/* . && \ + rmdir src && \ + popd + +load_pob: + git clone --branch dev --single-branch --depth 1 https://github.com/PathOfBuildingCommunity/PathOfBuilding.git PathOfBuilding && \ + pushd PathOfBuilding && \ + rm -rf .git && \ + popd + +luacurl: + git clone --branch v0.3.13 --single-branch --depth 1 https://github.com/Lua-cURL/Lua-cURLv3.git Lua-cURLv3 && \ + pushd Lua-cURLv3 && \ + sed -i -e 's/\?= lua$$/\?= luajit/' Makefile && \ + make && \ + mv lcurl.so ../lcurl.so && \ + popd + +clear: + rm -rf PathOfBuilding PathOfBuilding.app Lua-cURLv3 lcurl.so build + +tools_Darwin: + brew install jq qt5 luajit zlib meson curl dylibbundler + +tools_Linux: + sudo apt update && sudo apt -y install qtbase5-dev qt5-qmake \ + qtcreator luajit libluajit-5.1-dev zlib1g zlib1g-dev meson \ + xvfb build-essential ninja-build x11-apps imagemagick libcurl4-openssl-dev \ No newline at end of file diff --git a/Makefile.darwin b/Makefile.darwin deleted file mode 100644 index 06deb3b..0000000 --- a/Makefile.darwin +++ /dev/null @@ -1,60 +0,0 @@ -DIR := ${CURDIR} -export PATH := /usr/local/opt/qt@5/bin:$(PATH) -export LDFLAGS := -L/usr/local/opt/qt@5/lib -export CPPFLAGS := -I/usr/local/opt/qt@5/include -export PKG_CONFIG_PATH := /usr/local/opt/qt@5/lib/pkgconfig - -all: frontend pob - pushd build; \ - ninja install; \ - popd; \ - macdeployqt ${DIR}/PathOfBuilding.app; \ - cp ${DIR}/Info.plist.sh ${DIR}/PathOfBuilding.app/Contents/Info.plist; \ - echo 'Finished' - -pob: load_pob luacurl frontend - pushd PathOfBuilding; \ - unzip runtime-win32.zip lua/xml.lua lua/base64.lua lua/sha1.lua; \ - mv lua/*.lua .; \ - rmdir lua; \ - cp ../lcurl.so .; \ - mv src/* .; \ - rmdir src; \ - popd - -frontend: - meson -Dbuildtype=release --prefix=${DIR}/PathOfBuilding.app --bindir=Contents/MacOS build - -load_pob: - git clone --depth 1 https://github.com/PathOfBuildingCommunity/PathOfBuilding.git; \ - pushd PathOfBuilding; \ - rm -rf .git; \ - popd - -luacurl: - git clone --depth 1 https://github.com/Lua-cURL/Lua-cURLv3.git; \ - pushd Lua-cURLv3; \ - sed -i '' 's/\?= lua/\?= luajit/' Makefile; \ - make; \ - mv lcurl.so ../lcurl.so; \ - popd - -tools: qt lua zlib meson jq - -jq: - brew install jq - -qt: - brew install qt5 - -lua: - brew install luajit - -zlib: - brew install zlib - -meson: - brew install meson - -clean: - rm -rf PathOfBuilding PathOfBuilding.app Lua-cURLv3 lcurl.so build diff --git a/Makefile.linux b/Makefile.linux deleted file mode 100644 index adc1988..0000000 --- a/Makefile.linux +++ /dev/null @@ -1,54 +0,0 @@ -DIR := ${CURDIR} -SHELL = /bin/bash - -all: frontend pob - pushd build; \ - ninja; \ - popd; \ - mv build/PathOfBuilding PathOfBuilding/src; \ - echo 'Finished' - -pob: load_pob luacurl frontend - pushd PathOfBuilding; \ - unzip runtime-win32.zip lua/xml.lua lua/base64.lua lua/sha1.lua; \ - mv lua/*.lua src/; \ - rmdir lua; \ - cp ../lcurl.so src/; \ - popd - -frontend: - meson -Dbuildtype=release build - -load_pob: - git clone --depth 1 https://github.com/PathOfBuildingCommunity/PathOfBuilding.git; \ - pushd PathOfBuilding; \ - rm -rf .git; \ - popd - -luacurl: - git clone --depth 1 https://github.com/Lua-cURL/Lua-cURLv3.git; \ - pushd Lua-cURLv3; \ - sed -i -e's/\?= lua/\?= luajit/' Makefile; \ - make; \ - mv lcurl.so ../lcurl.so; \ - popd - -tools: qt lua zlib meson - -qt: - sudo apt -y install qtbase5-dev qt5-qmake \ - qtcreator - -lua: - sudo apt -y install luajit; \ - sudo apt -y install libluajit-5.1-dev - -zlib: - sudo apt -y install zlib1g; \ - sudo apt -y install zlib1g-dev - -meson: - sudo apt -y install meson - -clean: - rm -rf PathOfBuilding Lua-cURLv3 lcurl.so build diff --git a/README.md b/README.md index 65520a6..8f7d30e 100644 --- a/README.md +++ b/README.md @@ -96,3 +96,4 @@ On mac you need to invoke meson with some extra flags, per the luajit documentat ```bash LDFLAGS="-pagezero_size 10000 -image_base 100000000" meson pobfrontend build ``` + diff --git a/main.cpp b/main.cpp index 5b53640..97b4233 100644 --- a/main.cpp +++ b/main.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -36,12 +37,6 @@ void pushCallback(const char* name) { lua_insert(L, -2); } -void POBWindow::triggerUpdate() { - if (isActive()) { - update(); - } -} - void POBWindow::initializeGL() { QImage wimg{1, 1, QImage::Format_Mono}; wimg.fill(1); @@ -70,15 +65,20 @@ void POBWindow::paintGL() { glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glColor4f(0, 0, 0, 0); - for (auto& layer : layers) { - layer.second.clear(); + pushCallback("OnFrame"); + int result = lua_pcall(L, 1, 0, 0); + if (result != 0) { + lua_error(L); } + + // Hack: PoB doesn't recalculate stats until the frame _after_ some changes (e.g. config). Just call OnFrame twice. + layers.clear(); dscount = 0; curLayer = 0; curSubLayer = 0; pushCallback("OnFrame"); - int result = lua_pcall(L, 1, 0, 0); + result = lua_pcall(L, 1, 0, 0); if (result != 0) { lua_error(L); } @@ -87,8 +87,8 @@ void POBWindow::paintGL() { pobwindow->stringCache.setMaxCost(dscount); } - for (auto& layer : layers) { - for (auto& cmd : layer.second) { + for (auto layer : layers) { + for (auto cmd : layer) { cmd->execute(); } } @@ -109,6 +109,8 @@ void POBWindow::subScriptFinished() { if (clean) { subScriptList.clear(); } + + update(); } void POBWindow::mouseMoveEvent(QMouseEvent *event) { @@ -123,7 +125,7 @@ void pushMouseString(QMouseEvent *event) { case Qt::RightButton: lua_pushstring(L, "RIGHTBUTTON"); break; - case Qt::MiddleButton: + case Qt::MidButton: lua_pushstring(L, "MIDDLEBUTTON"); break; default: @@ -139,6 +141,7 @@ void POBWindow::mousePressEvent(QMouseEvent *event) { if (result != 0) { lua_error(L); } + update(); } void POBWindow::mouseReleaseEvent(QMouseEvent *event) { @@ -148,6 +151,7 @@ void POBWindow::mouseReleaseEvent(QMouseEvent *event) { if (result != 0) { lua_error(L); } + update(); } void POBWindow::mouseDoubleClickEvent(QMouseEvent *event) { @@ -158,6 +162,7 @@ void POBWindow::mouseDoubleClickEvent(QMouseEvent *event) { if (result != 0) { lua_error(L); } + update(); } void POBWindow::wheelEvent(QWheelEvent *event) { @@ -174,6 +179,7 @@ void POBWindow::wheelEvent(QWheelEvent *event) { if (result != 0) { lua_error(L); } + update(); } bool pushKeyString(int keycode) { @@ -218,9 +224,6 @@ bool pushKeyString(int keycode) { case Qt::Key_PageDown: lua_pushstring(L, "PAGEDOWN"); break; - case Qt::Key_F6: - lua_pushstring(L, "F6"); - break; default: return false; } @@ -253,6 +256,7 @@ void POBWindow::keyPressEvent(QKeyEvent *event) { if (result != 0) { lua_error(L); } + update(); } void POBWindow::keyReleaseEvent(QKeyEvent *event) { @@ -265,6 +269,7 @@ void POBWindow::keyReleaseEvent(QKeyEvent *event) { if (result != 0) { lua_error(L); } + update(); } void POBWindow::LAssert(lua_State* L, int cond, const char* fmt, ...) { @@ -299,11 +304,16 @@ void POBWindow::SetDrawLayer(int layer, int subLayer) { curLayer = layer; curSubLayer = subLayer; + QPair key{layer, subLayer}; + if (layers.contains(key)) { + return; + } + layers[key] = QList>{}; } -void POBWindow::AppendCmd(std::unique_ptr cmd) { - layers[{curLayer, curSubLayer}].emplace_back(std::move(cmd)); +void POBWindow::AppendCmd(std::shared_ptr cmd) { + layers[{curLayer, curSubLayer}].append(cmd); } void POBWindow::DrawColor(const float col[4]) { @@ -318,7 +328,7 @@ void POBWindow::DrawColor(const float col[4]) { drawColor[2] = 1.0f; drawColor[3] = 1.0f; } - AppendCmd(std::make_unique(drawColor)); + AppendCmd(std::shared_ptr{new ColorCmd(drawColor)}); } void POBWindow::DrawColor(uint32_t col) { @@ -621,9 +631,9 @@ static int l_SetViewport(lua_State* L) for (int i = 1; i <= 4; i++) { pobwindow->LAssert(L, lua_isnumber(L, i), "SetViewport() argument %d: expected number, got %t", i, i); } - pobwindow->AppendCmd(std::make_unique((int)lua_tointeger(L, 1), (int)lua_tointeger(L, 2), (int)lua_tointeger(L, 3), (int)lua_tointeger(L, 4))); + pobwindow->AppendCmd(std::shared_ptr(new ViewportCmd((int)lua_tointeger(L, 1), (int)lua_tointeger(L, 2), (int)lua_tointeger(L, 3), (int)lua_tointeger(L, 4)))); } else { - pobwindow->AppendCmd(std::make_unique(0, 0, pobwindow->width, pobwindow->height)); + pobwindow->AppendCmd(std::shared_ptr(new ViewportCmd(0, 0, pobwindow->width, pobwindow->height))); } return 0; } @@ -681,13 +691,13 @@ static int l_DrawImage(lua_State* L) pobwindow->LAssert(L, lua_isnumber(L, i), "DrawImage() argument %d: expected number, got %t", i, i); arg[i-2] = (float)lua_tonumber(L, i); } - pobwindow->AppendCmd(std::make_unique(hnd, arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], arg[6], arg[7])); + pobwindow->AppendCmd(std::shared_ptr(new DrawImageCmd(hnd, arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], arg[6], arg[7]))); } else { for (int i = 2; i <= 5; i++) { pobwindow->LAssert(L, lua_isnumber(L, i), "DrawImage() argument %d: expected number, got %t", i, i); arg[i-2] = (float)lua_tonumber(L, i); } - pobwindow->AppendCmd(std::make_unique(hnd, arg[0], arg[1], arg[2], arg[3])); + pobwindow->AppendCmd(std::shared_ptr(new DrawImageCmd(hnd, arg[0], arg[1], arg[2], arg[3]))); } return 0; } @@ -732,20 +742,20 @@ static int l_DrawImageQuad(lua_State* L) pobwindow->LAssert(L, lua_isnumber(L, i), "DrawImageQuad() argument %d: expected number, got %t", i, i); arg[i-2] = (float)lua_tonumber(L, i); } - pobwindow->AppendCmd(std::make_unique(hnd, arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], arg[6], arg[7], arg[8], arg[9], arg[10], arg[11], arg[12], arg[13], arg[14], arg[15])); + pobwindow->AppendCmd(std::shared_ptr(new DrawImageQuadCmd(hnd, arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], arg[6], arg[7], arg[8], arg[9], arg[10], arg[11], arg[12], arg[13], arg[14], arg[15]))); } else { for (int i = 2; i <= 9; i++) { pobwindow->LAssert(L, lua_isnumber(L, i), "DrawImageQuad() argument %d: expected number, got %t", i, i); arg[i-2] = (float)lua_tonumber(L, i); } - pobwindow->AppendCmd(std::make_unique(hnd, arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], arg[6], arg[7])); + pobwindow->AppendCmd(std::shared_ptr(new DrawImageQuadCmd(hnd, arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], arg[6], arg[7]))); } return 0; } DrawStringCmd::DrawStringCmd(float X, float Y, int Align, int Size, int Font, const char *Text) : text(Text) { dscount++; - if (text.size() >= 2 && text[0] == '^') { + if (text[0] == '^') { switch(text[1].toLatin1()) { case '0': setCol(0.0f, 0.0f, 0.0f); @@ -886,10 +896,10 @@ static int l_DrawString(lua_State* L) pobwindow->LAssert(L, lua_isstring(L, 6), "DrawString() argument 6: expected string, got %t", 6); static const char* alignMap[6] = { "LEFT", "CENTER", "RIGHT", "CENTER_X", "RIGHT_X", nullptr }; static const char* fontMap[4] = { "FIXED", "VAR", "VAR BOLD", nullptr }; - pobwindow->AppendCmd(std::make_unique( + pobwindow->AppendCmd(std::shared_ptr(new DrawStringCmd( (float)lua_tonumber(L, 1), (float)lua_tonumber(L, 2), luaL_checkoption(L, 3, "LEFT", alignMap), (int)lua_tointeger(L, 4), luaL_checkoption(L, 5, "FIXED", fontMap), lua_tostring(L, 6) - )); + ))); return 0; } @@ -1201,12 +1211,10 @@ static int l_Deflate(lua_State* L) deflateEnd(&z); if (err == Z_STREAM_END) { lua_pushlstring(L, (const char*)out, z.total_out); - delete[] out; return 1; } else { lua_pushnil(L); lua_pushstring(L, zError(err)); - delete[] out; return 2; } } @@ -1238,7 +1246,7 @@ static int l_Inflate(lua_State* L) out = newOut; } else { // PANIC - delete[] out; + delete out; return 0; } z.next_out = out + outSz; @@ -1249,20 +1257,18 @@ static int l_Inflate(lua_State* L) inflateEnd(&z); if (err == Z_STREAM_END) { lua_pushlstring(L, (const char*)out, z.total_out); - delete[] out; return 1; } else { lua_pushnil(L); lua_pushstring(L, zError(err)); - delete[] out; return 2; } } static int l_GetTime(lua_State* L) { - qint64 ms = QDateTime::currentDateTime().toMSecsSinceEpoch() - pobwindow->baseTime; - lua_pushinteger(L, ms); + qint64 ms = QDateTime::currentDateTime().toMSecsSinceEpoch(); + lua_pushinteger(L, ms / 1000); return 1; } @@ -1633,7 +1639,6 @@ int main(int argc, char **argv) int ff = args[1].toInt(&ok); if (ok) { pobwindow->fontFudge = ff; - args.removeAt(1); // Remove our hacky font factor from the arglist passed on to the script } } @@ -1747,13 +1752,20 @@ int main(int argc, char **argv) lua_pushcfunction(L, l_Exit); lua_setfield(L, -2, "exit"); lua_pop(L, 1); // Pop 'os' table - lua_createtable(L, args.size() - 1, 1); - for (int i = 0; i < args.size(); i++) { - lua_pushstring(L, args[i].toStdString().c_str()); + + lua_newtable(L); + for (int i = 0; i < argc; i++) { + lua_pushstring(L, argv[i]); lua_rawseti(L, -2, i); } lua_setglobal(L, "arg"); + std::string basePath = pobwindow->basePath.toStdString(); + std::string extraPathCommand = "package.path = package.path .. \";" + + basePath + + "/runtime/lua/?.lua\""; + luaL_dostring(L, extraPathCommand.c_str()); + int result = luaL_dofile(L, "Launch.lua"); if (result != 0) { lua_error(L); diff --git a/main.h b/main.h index 93b40d1..224a15a 100644 --- a/main.h +++ b/main.h @@ -34,7 +34,6 @@ enum r_texFlag_e { class Cmd { public: - virtual ~Cmd() = default; virtual void execute() = 0; }; diff --git a/meson.build b/meson.build index a69c93d..9aba4f5 100644 --- a/meson.build +++ b/meson.build @@ -6,6 +6,7 @@ lua_dep = dependency('luajit') # LDFLAGS="-pagezero_size 10000 -image_base 100000000" meson pobfrontend build if build_machine.system() == 'darwin' gl_dep = dependency('appleframeworks', modules: ['OpenGL']) + curl_dep = dependency('libcurl') else gl_dep = dependency('gl') endif @@ -16,15 +17,23 @@ zlib_dep = dependency('zlib') qt5 = import('qt5') prep = qt5.preprocess(moc_headers : ['subscript.hpp', 'pobwindow.hpp']) -executable('PathOfBuilding', - sources : ['main.cpp', prep], - dependencies : [qt5_dep, gl_dep, zlib_dep, lua_dep], - install : true) - +if build_machine.system() == 'darwin' + executable('PathOfBuilding', + sources : ['main.cpp', prep], + dependencies : [qt5_dep, gl_dep, zlib_dep, lua_dep, curl_dep], + install : true) +else + executable('PathOfBuilding', + sources : ['main.cpp', prep], + dependencies : [qt5_dep, gl_dep, zlib_dep, lua_dep], + install : true) +endif if build_machine.system() == 'darwin' install_data('pobLogo.icns', install_dir : 'Contents/Resources') install_data('Info.plist', install_dir : 'Contents') install_data('pobWrapper.sh', install_dir : 'Contents/MacOS') - meson.add_install_script('mesonInstaller.sh') + install_subdir('PathOfBuilding', install_dir : 'Contents/MacOS', strip_directory : true) + install_subdir('Frameworks', install_dir: 'Contents') + meson.add_install_script('bash', '-xc', 'cd ${MESON_INSTALL_PREFIX}/Contents && dylibbundler --overwrite-dir --create-dir --bundle-deps --fix-file MacOS/lcurl.so') endif diff --git a/mesonInstaller.sh b/mesonInstaller.sh deleted file mode 100755 index 13f287e..0000000 --- a/mesonInstaller.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -cp -r ${MESON_SOURCE_ROOT}/PathOfBuilding/* ${MESON_INSTALL_PREFIX}/Contents/MacOS/ - -mkdir -p ${MESON_INSTALL_PREFIX}/Contents/Frameworks \ No newline at end of file diff --git a/pobwindow.hpp b/pobwindow.hpp index e4fc4e4..cd88f54 100644 --- a/pobwindow.hpp +++ b/pobwindow.hpp @@ -1,9 +1,7 @@ #include -#include #include #include #include -#include #include #include "main.h" @@ -32,16 +30,12 @@ class POBWindow : public QOpenGLWindow { // theformat.setAlphaBufferSize(8); // std::cout << theformat.hasAlpha() << std::endl; // setFormat(theformat); - baseTime = QDateTime::currentDateTime().toMSecsSinceEpoch(); scriptPath = QDir::currentPath(); scriptWorkDir = QDir::currentPath(); basePath = QDir::currentPath(); userPath = QDir::currentPath(); fontFudge = 0; - - connect(&updateTimer, &QTimer::timeout, this, QOverload<>::of(&POBWindow::triggerUpdate)); - updateTimer.start(100); } // POBWindow() : QOpenGLWindow() { @@ -70,10 +64,9 @@ class POBWindow : public QOpenGLWindow { void SetDrawSubLayer(int subLayer) { SetDrawLayer(curLayer, subLayer); } - void AppendCmd(std::unique_ptr cmd); + void AppendCmd(std::shared_ptr cmd); void DrawColor(const float col[4] = NULL); void DrawColor(uint32_t col); - qint64 baseTime; QString scriptPath; QString scriptWorkDir; QString basePath; @@ -86,10 +79,8 @@ class POBWindow : public QOpenGLWindow { bool isDrawing; QString fontName; float drawColor[4]; - std::map, std::vector>> layers; + QMap, QList>> layers; QList> subScriptList; std::shared_ptr white; QCache> stringCache; - QTimer updateTimer; - void triggerUpdate(); };