Activates qt resources into graphics Qt build
This commit is contained in:
@@ -42,6 +42,39 @@ def getFilename():
|
|||||||
filename = 'core_' + major + minor + point
|
filename = 'core_' + major + minor + point
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
|
def createQrcFile():
|
||||||
|
utilities = ZipUtilities()
|
||||||
|
print "Creating Qt Resource File"
|
||||||
|
filename = "core.qrc"
|
||||||
|
f = open(filename, 'w')
|
||||||
|
f.seek(0,0)
|
||||||
|
f.write("""<!DOCTYPE RCC><RCC version="1.0">\n<qresource>\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('</qresource>\n</RCC>\n')
|
||||||
|
f.close
|
||||||
|
print >> sys.stderr, 'Created Resource Package for Qt projects: {0}'.format( filename)
|
||||||
|
|
||||||
|
|
||||||
def createStandardResFile():
|
def createStandardResFile():
|
||||||
@@ -84,20 +117,37 @@ class ZipUtilities:
|
|||||||
print 'Entering folder: ' + str(full_path)
|
print 'Entering folder: ' + str(full_path)
|
||||||
self.addFolderToZip(zip_file, 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('<file>')
|
||||||
|
qrc.write(full_path)
|
||||||
|
qrc.write('</file>\n')
|
||||||
|
elif os.path.isdir(full_path):
|
||||||
|
print 'Entering folder: ' + str(full_path)
|
||||||
|
self.addFolderToQrc(qrc, full_path)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
## using optparse instead of argParse for now since python 2.7 may not be installed.
|
## using optparse instead of argParse for now since python 2.7 may not be installed.
|
||||||
|
|
||||||
parser = OptionParser()
|
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()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
if (options.platform):
|
if (options.platform):
|
||||||
if (options.platform == "ios"):
|
print "reading %s..." % options.platform
|
||||||
createIosResFile()
|
if (options.platform == 'ios'):
|
||||||
|
createIosResFile()
|
||||||
|
elif (options.platform == 'qt'):
|
||||||
|
createQrcFile()
|
||||||
else:
|
else:
|
||||||
createStandardResFile()
|
createStandardResFile()
|
||||||
else:
|
else:
|
||||||
createStandardResFile()
|
createStandardResFile()
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,9 @@ CONFIG(console, graphics|console){
|
|||||||
}
|
}
|
||||||
else:CONFIG(graphics, graphics|console){
|
else:CONFIG(graphics, graphics|console){
|
||||||
folder_01.source = qml/QmlWagic
|
folder_01.source = qml/QmlWagic
|
||||||
folder_01.target = /usr/share
|
folder_01.target = qml
|
||||||
DEPLOYMENTFOLDERS = folder_01
|
DEPLOYMENTFOLDERS = folder_01
|
||||||
|
RESOURCES = bin/Res/core.qrc
|
||||||
QT += core gui opengl network
|
QT += core gui opengl network
|
||||||
QT -= declarative quick qml
|
QT -= declarative quick qml
|
||||||
#maemo5:DEFINES += QT_WIDGET
|
#maemo5:DEFINES += QT_WIDGET
|
||||||
|
|||||||
@@ -371,110 +371,3 @@ HEADERS += \
|
|||||||
../../JGE/src/tinyxml/tinystr.h\
|
../../JGE/src/tinyxml/tinystr.h\
|
||||||
../../JGE/src/tinyxml/tinyxml.h\
|
../../JGE/src/tinyxml/tinyxml.h\
|
||||||
../../JGE/include/vram.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\\\"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ cd ../..
|
|||||||
# we create resource package
|
# we create resource package
|
||||||
cd projects/mtg/bin/Res
|
cd projects/mtg/bin/Res
|
||||||
python createResourceZip.py
|
python createResourceZip.py
|
||||||
|
python createResourceZip.py —-platform=qt
|
||||||
# if we let the zip here, Wagic will use it in the testsuite
|
# if we let the zip here, Wagic will use it in the testsuite
|
||||||
# and we'll get 51 failed test cases
|
# and we'll get 51 failed test cases
|
||||||
mv core_*.zip ../../../../core.zip
|
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
|
make -j 8
|
||||||
|
|
||||||
# we're cross-compiling a Qt Windows version here,
|
# 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"
|
export PATH="$PATH:/opt/mingw32/bin"
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
mkdir win-cross
|
mkdir win-cross
|
||||||
cd 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
|
/opt/mingw32/bin/qmake ../../projects/mtg/wagic-qt.pro CONFIG+=release CONFIG+=graphics
|
||||||
make -j 8
|
make -j 8
|
||||||
cd release
|
cd release
|
||||||
@@ -77,6 +80,8 @@ cp ../../../projects/mtg/bin/zlib1.dll .
|
|||||||
cp /opt/mingw32/bin/libpng15-15.dll .
|
cp /opt/mingw32/bin/libpng15-15.dll .
|
||||||
cd ..
|
cd ..
|
||||||
zip win-cross.zip -r release/
|
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 ../..
|
cd ../..
|
||||||
|
|
||||||
# Now we run the testsuite (Res needs to be in the working directory)
|
# Now we run the testsuite (Res needs to be in the working directory)
|
||||||
|
|||||||
Reference in New Issue
Block a user