summaryrefslogtreecommitdiff
path: root/modules/gdnative
diff options
context:
space:
mode:
authorRuslan Mustakov <r.mustakov@gmail.com>2017-09-04 20:10:03 +0700
committerRuslan Mustakov <r.mustakov@gmail.com>2017-09-26 00:18:08 +0700
commitf5b3b24c22186f50b3e57fc162ef9790f288c704 (patch)
tree7c828580f53b83a847fc676b6f1c70e3da7bec60 /modules/gdnative
parent14b4ad931f54c73aff9021a1314943278295e602 (diff)
Enhance iOS export
- The export process now builds complete .ipa on macOS, instead of just creating XCode project. - The project includes Capabilities games usually require: Game Center, Push Notifications, In-App Purchase. - Icons and launch screens can be specified in export preset.
Diffstat (limited to 'modules/gdnative')
-rw-r--r--modules/gdnative/SCsub2
-rw-r--r--modules/gdnative/gdnative.cpp5
-rw-r--r--modules/gdnative/include/gdnative/gdnative.h4
-rw-r--r--modules/gdnative/include/nativescript/godot_nativescript.h4
-rw-r--r--modules/gdnative/nativescript/SCsub3
5 files changed, 12 insertions, 6 deletions
diff --git a/modules/gdnative/SCsub b/modules/gdnative/SCsub
index f386f2b542..39f5ec5378 100644
--- a/modules/gdnative/SCsub
+++ b/modules/gdnative/SCsub
@@ -11,7 +11,7 @@ gdn_env.add_source_files(env.modules_sources, "nativescript/*.cpp")
gdn_env.Append(CPPFLAGS=['-DGDAPI_BUILT_IN'])
gdn_env.Append(CPPPATH=['#modules/gdnative/include/'])
-if "platform" in env and env["platform"] == "x11": # there has to be a better solution?
+if "platform" in env and env["platform"] in ["x11", "iphone"]:
env.Append(LINKFLAGS=["-rdynamic"])
env.use_ptrcall = True
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index 93a9bac11c..11856e4ffb 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -234,8 +234,11 @@ bool GDNative::initialize() {
ERR_PRINT("No library set for this platform");
return false;
}
-
+#ifdef IPHONE_ENABLED
+ String path = lib_path.replace("res://", "dylibs/");
+#else
String path = ProjectSettings::get_singleton()->globalize_path(lib_path);
+#endif
Error err = OS::get_singleton()->open_dynamic_library(path, native_handle);
if (err != OK) {
return false;
diff --git a/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h
index 18d51daeb3..19dd030637 100644
--- a/modules/gdnative/include/gdnative/gdnative.h
+++ b/modules/gdnative/include/gdnative/gdnative.h
@@ -49,8 +49,8 @@ extern "C" {
#elif defined(__APPLE__)
#include "TargetConditionals.h"
#if TARGET_OS_IPHONE
-#define GDCALLINGCONV
-#define GDAPI
+#define GDCALLINGCONV __attribute__((visibility("default")))
+#define GDAPI GDCALLINGCONV
#elif TARGET_OS_MAC
#define GDCALLINGCONV __attribute__((sysv_abi))
#define GDAPI GDCALLINGCONV
diff --git a/modules/gdnative/include/nativescript/godot_nativescript.h b/modules/gdnative/include/nativescript/godot_nativescript.h
index 96f213ead7..5095b7a83e 100644
--- a/modules/gdnative/include/nativescript/godot_nativescript.h
+++ b/modules/gdnative/include/nativescript/godot_nativescript.h
@@ -51,8 +51,8 @@ extern "C" {
#elif defined(__APPLE__)
#include "TargetConditionals.h"
#if TARGET_OS_IPHONE
-#define GDCALLINGCONV
-#define GDAPI
+#define GDCALLINGCONV __attribute__((visibility("default")))
+#define GDAPI GDCALLINGCONV
#elif TARGET_OS_MAC
#define GDCALLINGCONV __attribute__((sysv_abi))
#define GDAPI GDCALLINGCONV
diff --git a/modules/gdnative/nativescript/SCsub b/modules/gdnative/nativescript/SCsub
index e980e40e8e..178afec64a 100644
--- a/modules/gdnative/nativescript/SCsub
+++ b/modules/gdnative/nativescript/SCsub
@@ -7,4 +7,7 @@ mod_env.add_source_files(env.modules_sources, "*.cpp")
mod_env.Append(CPPPATH='#modules/gdnative')
mod_env.Append(CPPFLAGS=['-DGDAPI_BUILT_IN'])
+if "platform" in env and env["platform"] in ["x11", "iphone"]:
+ env.Append(LINKFLAGS=["-rdynamic"])
+
Export('mod_env')