improve LuaEngineApp build

This commit is contained in:
Syping 2019-10-14 21:37:35 +02:00
parent eec5071578
commit 262533dae9
4 changed files with 24 additions and 16 deletions

View file

@ -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 ..

View file

@ -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
}

View file

@ -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<const char*>(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<const char*>(LockResource(resourceData));
luaScript = QByteArray(data, size);
}
}
#endif
#endif

View file

@ -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"
}