Skip to content

Commit

Permalink
[export] Make export variables global
Browse files Browse the repository at this point in the history
[android] Build for all archs by default
[android] Strip 64 bit libs on export by default
[plugin/json] Auto integrate on iOS
  • Loading branch information
hgy29 committed Jun 12, 2017
1 parent 52ea98f commit b3262cb
Show file tree
Hide file tree
Showing 42 changed files with 122 additions and 68 deletions.
2 changes: 1 addition & 1 deletion android/lib/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
APP_STL := c++_static
APP_CPPFLAGS += -fexceptions -frtti
APP_PLATFORM := android-9
APP_ABI := armeabi armeabi-v7a x86
APP_ABI := all
APP_OPTIM := release
APP_UNIFIED_HEADERS := true

4 changes: 2 additions & 2 deletions gdrexport/ExportLua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ static int getProperty(lua_State* L)
if (!currentXml)
return 0;
const char *prop=luaL_checkstring(L,1);
lua_pushstring(L,currentXml->props[QString(prop)].toStdString().c_str());
lua_pushstring(L,currentXml->GetProperty(QString(prop)).toStdString().c_str());
return 1;
}

Expand All @@ -26,7 +26,7 @@ static int setProperty(lua_State* L)
return 0;
const char *prop=luaL_checkstring(L,1);
const char *val=luaL_checkstring(L,2);
currentXml->props[QString(prop)]=QString(val);
currentXml->SetProperty(QString(prop),QString(val));
return 0;
}

Expand Down
75 changes: 47 additions & 28 deletions gdrexport/ExportXml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,39 +56,42 @@ void ExportXml::SetupProperties(ExportContext *ctx)
{
this->ctx = ctx;
ctx->basews = Utilities::RemoveSpaces(ctx->base, false);
if (ctx->props.empty())
{
//Fill properties: System
#ifdef Q_OS_WIN32
props["sys.exeExtension"]=".exe";
ctx->props["sys.exeExtension"]=".exe";
#else
props["sys.exeExtension"] = "";
ctx->props["sys.exeExtension"] = "";
#endif
props["sys.cacheDir"] = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
props["sys.giderosDir"] = QDir::currentPath();
props["sys.homeDir"] = QDir::homePath();
props["sys.exportDir"] = ctx->exportDir.absolutePath();
props["sys.exportType"]=QString(ctx->player?"player":(ctx->assetsOnly?"assets":"full"));
ctx->props["sys.cacheDir"] = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
ctx->props["sys.giderosDir"] = QDir::currentPath();
ctx->props["sys.homeDir"] = QDir::homePath();
ctx->props["sys.exportDir"] = ctx->exportDir.absolutePath();
ctx->props["sys.exportType"]=QString(ctx->player?"player":(ctx->assetsOnly?"assets":"full"));
//Fill properties: Project
props["project.name"] = ctx->base;
props["project.namews"] = ctx->basews;
props["project.package"] = ctx->properties.packageName;
props["project.version"] = ctx->properties.version;
props["project.platform"] = ctx->platform;
props["project.app_name"] = ctx->appName;
props["project.version_code"] = QString::number(
ctx->props["project.name"] = ctx->base;
ctx->props["project.namews"] = ctx->basews;
ctx->props["project.package"] = ctx->properties.packageName;
ctx->props["project.version"] = ctx->properties.version;
ctx->props["project.platform"] = ctx->platform;
ctx->props["project.app_name"] = ctx->appName;
ctx->props["project.version_code"] = QString::number(
ctx->properties.version_code);
props["project.build_number"] = QString::number(
ctx->props["project.build_number"] = QString::number(
ctx->properties.build_number);
props["project.autorotation"] = QString::number(
ctx->props["project.autorotation"] = QString::number(
ctx->properties.autorotation);
props["project.orientation"] = QString::number(ctx->properties.orientation);
props["project.disableSplash"] = QString::number(ctx->properties.disableSplash?1:0);
props["project.backgroundColor"] = ctx->properties.backgroundColor;
props["project.ios_bundle"] = ctx->properties.ios_bundle;
ctx->props["project.orientation"] = QString::number(ctx->properties.orientation);
ctx->props["project.disableSplash"] = QString::number(ctx->properties.disableSplash?1:0);
ctx->props["project.backgroundColor"] = ctx->properties.backgroundColor;
ctx->props["project.ios_bundle"] = ctx->properties.ios_bundle;

//Fill in passed arguments
QHash<QString, QString>::iterator i;
for (i = ctx->args.begin(); i != ctx->args.end(); ++i)
props["args."+i.key()] = i.value();
ctx->props["args."+i.key()] = i.value();
}
}

bool ExportXml::Process(ExportContext *ctx) {
Expand All @@ -97,7 +100,7 @@ bool ExportXml::Process(ExportContext *ctx) {
QDomElement rules;
QDir xmlDir=QFileInfo(xmlFile).dir();
if (isPlugin) {
props["sys.pluginDir"] = xmlDir.path();
lprops["sys.pluginDir"] = xmlDir.path();
//Fill properties: Plugin
for (QSet<ProjectProperties::Plugin>::const_iterator it =
ctx->properties.plugins.begin();
Expand All @@ -106,7 +109,7 @@ bool ExportXml::Process(ExportContext *ctx) {
for (QMap<QString, QString>::const_iterator mit =
(*it).properties.begin(); mit != (*it).properties.end();
mit++)
props[QString("plugin.").append(mit.key())] = mit.value();
lprops[QString("plugin.").append(mit.key())] = mit.value();
}
//Lookup target
QDomNodeList targets = exporter.elementsByTagName("target");
Expand All @@ -119,7 +122,7 @@ bool ExportXml::Process(ExportContext *ctx) {
}
} else {
//Fill properties: Export
props["sys.exportDir"] = xmlDir.path();
ctx->props["sys.exporterDir"] = xmlDir.path();
rules = exporter.firstChildElement("rules");
for (QSet<ProjectProperties::Export>::const_iterator it =
ctx->properties.exports.begin();
Expand All @@ -128,7 +131,7 @@ bool ExportXml::Process(ExportContext *ctx) {
for (QMap<QString, QString>::const_iterator mit =
(*it).properties.begin(); mit != (*it).properties.end();
mit++)
props[QString("export.").append(mit.key())] = mit.value();
ctx->props[QString("export.").append(mit.key())] = mit.value();
}
}
//Run rules
Expand Down Expand Up @@ -404,7 +407,7 @@ QString ExportXml::ReplaceAttributes(QString text) {
int ac = args.count();
QString rep;
if (ac == 1)
rep = props[args[0]];
rep = GetProperty(args[0]);
else if (ac == 2)
rep = ComputeUnary(args[0], args[1]);
else if (ac == 3)
Expand Down Expand Up @@ -483,7 +486,7 @@ bool ExportXml::RuleIf(QString cond, QDomElement rule) {
bool ExportXml::RuleSet(QString key, QString val) {
ExportCommon::exportInfo("Set: %s -> %s\n", key.toStdString().c_str(),
SecretVal(key,val).toStdString().c_str());
props[key] = val;
SetProperty(key,val);
return true;
}

Expand All @@ -497,10 +500,26 @@ bool ExportXml::RuleAsk(QDomElement rule) {
free(ret);
ExportCommon::exportInfo("Ask: %s -> %s\n", key.toStdString().c_str(),
SecretVal(key,val).toStdString().c_str());
props[key] = val;
SetProperty(key,val);
return true;
}

void ExportXml::SetProperty(QString k,QString v)
{
if (!(ctx->props[k].isEmpty()))
ctx->props[k]=v;
else
lprops[k]=v;
}

QString ExportXml::GetProperty(QString k)
{
if (!(ctx->props[k].isEmpty()))
return ctx->props[k];
return lprops[k];
}


QString ExportXml::XmlAttributeOrElement(QDomElement elm,QString name)
{
QString value=elm.attribute(name);
Expand Down
4 changes: 3 additions & 1 deletion gdrexport/ExportXml.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ class ExportXml {
public:
ExportXml(QString xmlFile,bool isPlugin=false);
ExportXml();
void SetProperty(QString k,QString v);
QString GetProperty(QString k);
void SetupProperties(ExportContext *ctx);
bool Process(ExportContext *ctx);
bool ProcessRuleString(const char *xml);
bool isPlugin;
QMap<QString,QString> props;
QMap<QString,QString> lprops;
QString xmlFile;
static bool exportXml(QString xmlFile,bool plugin,ExportContext *ctx);
static QMap<QString, QString> availableTargets();
Expand Down
2 changes: 2 additions & 0 deletions gdrexport/exportcontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ struct ExportContext
QImage *tvicon;
QImage *splash_h_image;
QImage *splash_v_image;
//XML
QMap<QString,QString> props; //global properties
// LUA
lua_State *L;
};
Expand Down
2 changes: 1 addition & 1 deletion libgvfs/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
APP_STL := gnustl_static
APP_CPPFLAGS += -fexceptions -frtti
APP_PLATFORM := android-9
APP_ABI := armeabi armeabi-v7a x86
APP_ABI := all
APP_OPTIM := release


2 changes: 2 additions & 0 deletions libgvfs/vfscanf.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@
#endif

#ifdef __ANDROID__
#if UINTPTR_MAX == 0xffffffff //For 32bit target only
static long double strtold(const char *s, char **sp)
{
return strtod(s, sp);
}
#endif
#endif

#ifdef WINSTORE
#define __signed
Expand Down
2 changes: 1 addition & 1 deletion lua/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
APP_STL := gnustl_static
APP_CPPFLAGS += -fexceptions -frtti
APP_PLATFORM := android-9
APP_ABI := armeabi armeabi-v7a x86
APP_ABI := all
APP_OPTIM := release


6 changes: 6 additions & 0 deletions luabinding/texturebasebinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ TextureBaseBinder::TextureBaseBinder(lua_State* L)
lua_setfield(L, -2, "RGBA4444");
lua_pushstring(L, "rgba5551");
lua_setfield(L, -2, "RGBA5551");
lua_pushstring(L, "y8");
lua_setfield(L, -2, "Y8");
lua_pushstring(L, "a8");
lua_setfield(L, -2, "A8");
lua_pushstring(L, "ya8");
lua_setfield(L, -2, "YA8");
lua_pop(L, 1);
}

Expand Down
6 changes: 6 additions & 0 deletions luabinding/texturebinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ int TextureBinder::create(lua_State* L)
format = eRGBA4444;
else if (strcmp(formatstr, "rgba5551") == 0)
format = eRGBA5551;
else if (strcmp(formatstr, "y8") == 0)
format = eY8;
else if (strcmp(formatstr, "a8") == 0)
format = eA8;
else if (strcmp(formatstr, "ya8") == 0)
format = eYA8;
else
{
GStatus status(2008, "format"); // Error #2008: Parameter %s must be one of the accepted values.
Expand Down
2 changes: 1 addition & 1 deletion plugins/Facebook/source/Android/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
APP_STL := c++_static
APP_CPPFLAGS += -fexceptions -frtti
APP_PLATFORM := android-9
APP_ABI := armeabi armeabi-v7a x86
APP_ABI := all
APP_OPTIM := release


2 changes: 1 addition & 1 deletion plugins/ads/source/Android/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
APP_STL := c++_static
APP_CPPFLAGS += -fexceptions -frtti
APP_PLATFORM := android-9
APP_ABI := armeabi armeabi-v7a x86
APP_ABI := all
APP_OPTIM := release


2 changes: 1 addition & 1 deletion plugins/bitop/source/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
APP_STL := c++_static
APP_CPPFLAGS += -fexceptions -frtti
APP_PLATFORM := android-9
APP_ABI := armeabi armeabi-v7a x86
APP_ABI := all
APP_OPTIM := release
2 changes: 1 addition & 1 deletion plugins/camera/source/Android/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
APP_STL := c++_static
APP_CPPFLAGS += -fexceptions -frtti
APP_PLATFORM := android-9
APP_ABI := armeabi armeabi-v7a x86
APP_ABI := all
APP_OPTIM := release


2 changes: 1 addition & 1 deletion plugins/clipper/source/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
APP_STL := c++_static
APP_CPPFLAGS += -fexceptions -frtti
APP_PLATFORM := android-9
APP_ABI := armeabi armeabi-v7a x86
APP_ABI := all
APP_OPTIM := release


2 changes: 1 addition & 1 deletion plugins/controller/source/Android/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
APP_STL := c++_static
APP_CPPFLAGS += -fexceptions -frtti
APP_PLATFORM := android-9
APP_ABI := armeabi armeabi-v7a x86
APP_ABI := all
APP_OPTIM := release


2 changes: 1 addition & 1 deletion plugins/countly/source/Android/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
APP_STL := c++_static
APP_CPPFLAGS += -fexceptions -frtti
APP_PLATFORM := android-9
APP_ABI := armeabi armeabi-v7a x86
APP_ABI := all
APP_OPTIM := release


2 changes: 1 addition & 1 deletion plugins/exampleplugin/source/Android/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
APP_STL := c++_static
APP_CPPFLAGS += -fexceptions -frtti
APP_PLATFORM := android-9
APP_ABI := armeabi armeabi-v7a x86
APP_ABI := all
APP_OPTIM := release


2 changes: 1 addition & 1 deletion plugins/flurry/source/Android/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
APP_STL := c++_static
APP_CPPFLAGS += -fexceptions -frtti
APP_PLATFORM := android-9
APP_ABI := armeabi armeabi-v7a x86
APP_ABI := all
APP_OPTIM := release
2 changes: 1 addition & 1 deletion plugins/gaming/source/Android/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
APP_STL := c++_static
APP_CPPFLAGS += -fexceptions -frtti
APP_PLATFORM := android-9
APP_ABI := armeabi armeabi-v7a x86
APP_ABI := all
APP_OPTIM := release


2 changes: 1 addition & 1 deletion plugins/giftiz/source/Android/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
APP_STL := c++_static
APP_CPPFLAGS += -fexceptions -frtti
APP_PLATFORM := android-9
APP_ABI := armeabi armeabi-v7a x86
APP_ABI := all
APP_OPTIM := release


2 changes: 1 addition & 1 deletion plugins/gmedia/source/Android/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
APP_STL := c++_static
APP_CPPFLAGS += -fexceptions -frtti
APP_PLATFORM := android-9
APP_ABI := armeabi armeabi-v7a x86
APP_ABI := all
APP_OPTIM := release


2 changes: 1 addition & 1 deletion plugins/googlebilling/source/Android/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
APP_STL := c++_static
APP_CPPFLAGS += -fexceptions -frtti
APP_PLATFORM := android-9
APP_ABI := armeabi armeabi-v7a x86
APP_ABI := all
APP_OPTIM := release
2 changes: 1 addition & 1 deletion plugins/googlelicensing/source/Android/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
APP_STL := c++_static
APP_CPPFLAGS += -fexceptions -frtti
APP_PLATFORM := android-9
APP_ABI := armeabi armeabi-v7a x86
APP_ABI := all
APP_OPTIM := release


2 changes: 1 addition & 1 deletion plugins/googleplay/source/Android/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
APP_STL := c++_static
APP_CPPFLAGS += -fexceptions -frtti
APP_PLATFORM := android-9
APP_ABI := armeabi armeabi-v7a x86
APP_ABI := all
APP_OPTIM := release


2 changes: 1 addition & 1 deletion plugins/iab/source/Android/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
APP_STL := c++_static
APP_CPPFLAGS += -fexceptions -frtti
APP_PLATFORM := android-9
APP_ABI := armeabi armeabi-v7a x86
APP_ABI := all
APP_OPTIM := release


Loading

0 comments on commit b3262cb

Please sign in to comment.