diff --git a/projects/mtg/bin/Res/createResourceZip.py b/projects/mtg/bin/Res/createResourceZip.py index ff5ed73d5..19e758263 100644 --- a/projects/mtg/bin/Res/createResourceZip.py +++ b/projects/mtg/bin/Res/createResourceZip.py @@ -42,6 +42,39 @@ def getFilename(): filename = 'core_' + major + minor + point return filename +def createQrcFile(): + utilities = ZipUtilities() + print "Creating Qt Resource File" + filename = "core.qrc" + f = open(filename, 'w') + f.seek(0,0) + f.write("""\n\n""") + rename = False + if not os.path.isfile('settings/options.txt'): + os.rename('settings/options.orig.txt', 'settings/options.txt') + remame = True + if not os.path.isfile('player/options.txt'): + os.rename('player/options.orig.txt', 'player/options.txt') + rename = True + utilities.addFolderToQrc(f, 'themes') + utilities.addFolderToQrc(f, 'sound') + utilities.addFolderToQrc(f, 'settings') + utilities.addFolderToQrc(f, 'sets') + utilities.addFolderToQrc(f, 'rules') + utilities.addFolderToQrc(f, 'player') + utilities.addFolderToQrc(f, 'packs') + utilities.addFolderToQrc(f, 'lang') + utilities.addFolderToQrc(f, 'graphics') + utilities.addFolderToQrc(f, 'campaigns') + utilities.addFolderToQrc(f, 'ai') + if rename: + os.rename('settings/options.txt', 'settings/options.orig.txt') + os.rename('player/options.txt', 'player/options.orig.txt') + + f.seek(0,2) + f.write('\n\n') + f.close + print >> sys.stderr, 'Created Resource Package for Qt projects: {0}'.format( filename) def createStandardResFile(): @@ -84,20 +117,37 @@ class ZipUtilities: print 'Entering folder: ' + str(full_path) self.addFolderToZip(zip_file, full_path) + def addFolderToQrc(self, qrc, folder): + qrc.seek(0,2) + for file in os.listdir(folder): + if file != '.svn': + full_path = os.path.join(folder, file) + if os.path.isfile(full_path): + print 'File added: ' + str(full_path) + qrc.write('') + qrc.write(full_path) + qrc.write('\n') + elif os.path.isdir(full_path): + print 'Entering folder: ' + str(full_path) + self.addFolderToQrc(qrc, full_path) + def main(): ## using optparse instead of argParse for now since python 2.7 may not be installed. parser = OptionParser() - parser.add_option("-p", "--platform", help="PLATFORM: specify custom build. (eg ios, android, etc)", metavar="PLATFORM", dest="platform") + parser.add_option("-p", "--platform", help="PLATFORM: specify custom build. (eg qt, ios, android, etc)", metavar="PLATFORM", dest="platform") (options, args) = parser.parse_args() if (options.platform): - if (options.platform == "ios"): - createIosResFile() + print "reading %s..." % options.platform + if (options.platform == 'ios'): + createIosResFile() + elif (options.platform == 'qt'): + createQrcFile() else: - createStandardResFile() + createStandardResFile() else: createStandardResFile() diff --git a/projects/mtg/wagic-qt.pro b/projects/mtg/wagic-qt.pro index 487557c3f..80768da6d 100644 --- a/projects/mtg/wagic-qt.pro +++ b/projects/mtg/wagic-qt.pro @@ -15,8 +15,9 @@ CONFIG(console, graphics|console){ } else:CONFIG(graphics, graphics|console){ folder_01.source = qml/QmlWagic - folder_01.target = /usr/share + folder_01.target = qml DEPLOYMENTFOLDERS = folder_01 + RESOURCES = bin/Res/core.qrc QT += core gui opengl network QT -= declarative quick qml #maemo5:DEFINES += QT_WIDGET diff --git a/projects/mtg/wagic.pri b/projects/mtg/wagic.pri index 88733dbac..6fc7a131f 100644 --- a/projects/mtg/wagic.pri +++ b/projects/mtg/wagic.pri @@ -371,110 +371,3 @@ HEADERS += \ ../../JGE/src/tinyxml/tinystr.h\ ../../JGE/src/tinyxml/tinyxml.h\ ../../JGE/include/vram.h - -# maemo 5 packaging -maemo5: { - # Variables - BINDIR = /opt/wagic/bin - RESDIR = /home/user/wagic/Res - USERDIR = MyDocs/.Wagic - ICONDIR = /usr/share - - DEFINES += RESDIR=\\\"$$RESDIR\\\" - DEFINES += USERDIR=\\\"$$USERDIR\\\" - - INSTALLS += target \ - desktop \ - icon - - target.path = $$BINDIR - - desktop.path = $$ICONDIR/applications/hildon - desktop.files += wagic.desktop - - icon.path = $$ICONDIR/icons/hicolor/64x64/apps - icon.files += wagic-64x64.png - -# Meego/maemo 6 packaging (no launcher) -} else:contains(MEEGO_EDITION,harmattan): { - # Variables - BINDIR = /opt/wagic/bin - RESDIR = /opt/wagic/Res - USERDIR = MyDocs/.Wagic - ICONDIR = /usr/share - - DEFINES += RESDIR=\\\"$$RESDIR\\\" - DEFINES += USERDIR=\\\"$$USERDIR\\\" - - INSTALLS += target \ - desktop \ - icon \ - policy - - target.path = $$BINDIR - - desktop.path = /usr/share/applications - desktop.files += debian_harmattan/wagic.desktop - - icon.files = wagic-80x80.png - icon.path = /usr/share/icons/hicolor/64x64/apps - - policy.files = debian_harmattan/wagic.conf - policy.path = /usr/share/policy/etc/syspart.conf.d - -} else:symbian { - TARGET.UID3 = 0xE1D807D3 - - # Smart Installer package's UID - # This UID is from the protected range - # and therefore the package will fail to install if self-signed - # By default qmake uses the unprotected range value if unprotected UID is defined for the application - # and 0x2002CCCF value if protected UID is given to the application - #symbian:DEPLOYMENT.installer_header = 0x2002CCCF - - # Allow network access on Symbian... that's probably pointless - TARGET.CAPABILITY += NetworkServices - - RESDIR = some/res/dir - USERDIR = .Wagic - DEFINES += RESDIR=\"$$RESDIR\" - DEFINES += USERDIR=\"$$USERDIR\" - ICON = wagic.svg -} else:android { - DEFINES += Q_WS_ANDROID - RESDIR = Res - USERDIR = /sdcard/Wagic/Res - DEFINES += RESDIR=\\\"$$RESDIR\\\" - DEFINES += USERDIR=\\\"$$USERDIR\\\" -} else:unix { - # Variables - BINDIR = /usr/bin - ICONDIR = /usr/share - RESDIR = Res - USERDIR = .Wagic - - DEFINES += RESDIR=\\\"$$RESDIR\\\" - DEFINES += USERDIR=\\\"$$USERDIR\\\" - - target.path = $$BINDIR - - desktop.path = $$ICONDIR/applications - desktop.files += wagic.desktop - - icon.path = $$ICONDIR/icons/hicolor/64x64/apps - icon.files += wagic-64x64.png - - INSTALLS += target \ - desktop \ - icon - -} else:windows { - RESDIR = ./Res - USERDIR = .Wagic - DEFINES += RESDIR=\\\"$$RESDIR\\\" - DEFINES += USERDIR=\\\"$$USERDIR\\\" -} - - - - diff --git a/travis-script.sh b/travis-script.sh index f3dd372fa..5a171e88c 100755 --- a/travis-script.sh +++ b/travis-script.sh @@ -14,6 +14,7 @@ cd ../.. # we create resource package cd projects/mtg/bin/Res python createResourceZip.py +python createResourceZip.py —-platform=qt # if we let the zip here, Wagic will use it in the testsuite # and we'll get 51 failed test cases mv core_*.zip ../../../../core.zip @@ -59,12 +60,14 @@ qmake projects/mtg/wagic-qt.pro CONFIG+=console CONFIG+=debug DEFINES+=CAPTURE_S make -j 8 # we're cross-compiling a Qt Windows version here, -# PATH is only set here to prevent colision +# PATH is only set here to prevent collision export PATH="$PATH:/opt/mingw32/bin" mkdir build cd build mkdir win-cross cd win-cross +mv ../../projects/mtg/bin/Res/settings/options.orig.txt ../../projects/mtg/bin/Res/settings/options.txt +mv ../../projects/mtg/bin/Res/player/options.orig.txt ../../projects/mtg/bin/Res/player/options.txt /opt/mingw32/bin/qmake ../../projects/mtg/wagic-qt.pro CONFIG+=release CONFIG+=graphics make -j 8 cd release @@ -77,6 +80,8 @@ cp ../../../projects/mtg/bin/zlib1.dll . cp /opt/mingw32/bin/libpng15-15.dll . cd .. zip win-cross.zip -r release/ +mv ../../projects/mtg/bin/Res/settings/options.txt ../../projects/mtg/bin/Res/settings/options.orig.txt +mv ../../projects/mtg/bin/Res/player/options.txt ../../projects/mtg/bin/Res/player/options.orig.txt cd ../.. # Now we run the testsuite (Res needs to be in the working directory)