From 262533dae9c42ba6b3896b7baad76b0c5a3366d7 Mon Sep 17 00:00:00 2001 From: Syping Date: Mon, 14 Oct 2019 21:37:35 +0200 Subject: [PATCH] improve LuaEngineApp build --- .gitlab-ci.yml | 2 +- src/luaengineapp/luaengineapp.pro | 8 ++++---- src/luaengineapp/main.cpp | 22 +++++++++++----------- src/luaenginec/luaenginec.pro | 8 ++++++++ 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 84ecece..647575a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -36,7 +36,7 @@ LuaEngineApp: script: - mkdir -p build - cd build - - qmake-static CONFIG+=WITH_LUAENGINEAPP DEFINES+=LUAENGINE_FOOTER_SCRIPT ../luaengine.pro + - qmake-static CONFIG+=WITH_LUAENGINEAPP ../luaengine.pro - make -j4 - cp -Rf src/luaengineapp/release/LuaEngineApp.exe ../windows.le - cd .. diff --git a/src/luaengineapp/luaengineapp.pro b/src/luaengineapp/luaengineapp.pro index 42cf37f..5319a7f 100644 --- a/src/luaengineapp/luaengineapp.pro +++ b/src/luaengineapp/luaengineapp.pro @@ -40,8 +40,8 @@ OTHER_FILES += \ app.lua \ app.rc - -!defined(LUAENGINE_FOOTER_SCRIPT) { - win32: HEADERS += resource.h - win32: RC_FILE = app.rc +win32: CONFIG(LUAENGINE_RESOURCE_SCRIPT) { + DEFINES += LUAENGINE_RESOURCE_SCRIPT + HEADERS += resource.h + RC_FILE = app.rc } diff --git a/src/luaengineapp/main.cpp b/src/luaengineapp/main.cpp index 60a87cf..2d14219 100644 --- a/src/luaengineapp/main.cpp +++ b/src/luaengineapp/main.cpp @@ -42,7 +42,17 @@ int main(int argc, char *argv[]) QByteArray luaScript; #ifdef Q_OS_WIN -#ifdef LUAENGINE_FOOTER_SCRIPT +#ifdef LUAENGINE_RESOURCE_SCRIPT + { + HMODULE handle = GetModuleHandleW(NULL); + HRSRC resource = FindResourceW(handle, MAKEINTRESOURCE(IDR_SCRIPT1), L"SCRIPT"); + HGLOBAL resourceData = LoadResource(handle, resource); + DWORD size = SizeofResource(handle, resource); + const char *data = static_cast(LockResource(resourceData)); + luaScript = QByteArray(data, size); + } +} +#else { QFile executable(a.arguments().at(0)); if (executable.open(QIODevice::ReadOnly)) { @@ -62,16 +72,6 @@ int main(int argc, char *argv[]) } } } -#else - { - HMODULE handle = GetModuleHandleW(NULL); - HRSRC resource = FindResourceW(handle, MAKEINTRESOURCE(IDR_SCRIPT1), L"SCRIPT"); - HGLOBAL resourceData = LoadResource(handle, resource); - DWORD size = SizeofResource(handle, resource); - const char *data = static_cast(LockResource(resourceData)); - luaScript = QByteArray(data, size); - } - } #endif #endif diff --git a/src/luaenginec/luaenginec.pro b/src/luaenginec/luaenginec.pro index a43d05b..b60be0a 100644 --- a/src/luaenginec/luaenginec.pro +++ b/src/luaenginec/luaenginec.pro @@ -32,3 +32,11 @@ INCLUDEPATH += \ SOURCES += \ main.cpp + +win32 { + RC_LANG = 0x0 + QMAKE_TARGET_COMPANY = "Syping" + QMAKE_TARGET_DESCRIPTION = "LuaEngine Compiler" + QMAKE_TARGET_COPYRIGHT = "Copyright (c) 2019 Syping" + QMAKE_TARGET_PRODUCT = "luaenginec" +}