Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] [4.0] iOS Plugins #41230

Merged
merged 4 commits into from
Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 2 additions & 77 deletions misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -153,81 +153,6 @@
DevelopmentTeam = $team_id;
ProvisioningStyle = Automatic;
SystemCapabilities = {
com.apple.AccessWiFi = {
enabled = $access_wifi;
};
com.apple.ApplePay = {
enabled = 0;
};
com.apple.ApplicationGroups.iOS = {
enabled = 0;
};
com.apple.AutoFillCredentialProvider = {
enabled = 0;
};
com.apple.BackgroundModes = {
enabled = 0;
};
com.apple.ClassKit = {
enabled = 0;
};
com.apple.DataProtection = {
enabled = 0;
};
com.apple.GameCenter.iOS = {
enabled = $game_center;
};
com.apple.HealthKit = {
enabled = 0;
};
com.apple.HomeKit = {
enabled = 0;
};
com.apple.HotspotConfiguration = {
enabled = 0;
};
com.apple.InAppPurchase = {
enabled = $in_app_purchases;
};
com.apple.InterAppAudio = {
enabled = 0;
};
com.apple.Keychain = {
enabled = 0;
};
com.apple.Maps.iOS = {
enabled = 0;
};
com.apple.Multipath = {
enabled = 0;
};
com.apple.NearFieldCommunicationTagReading = {
enabled = 0;
};
com.apple.NetworkExtensions.iOS = {
enabled = 0;
};
com.apple.Push = {
enabled = $push_notifications;
};
com.apple.SafariKeychain = {
enabled = 0;
};
com.apple.Siri = {
enabled = 0;
};
com.apple.VPNLite = {
enabled = 0;
};
com.apple.WAC = {
enabled = 0;
};
com.apple.Wallet = {
enabled = 0;
};
com.apple.iCloud = {
enabled = 0;
};
};
};
};
Expand Down Expand Up @@ -393,7 +318,7 @@
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
"$(PROJECT_DIR)/**",
);
PRODUCT_BUNDLE_IDENTIFIER = $bundle_identifier;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -423,7 +348,7 @@
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
"$(PROJECT_DIR)/**",
);
PRODUCT_BUNDLE_IDENTIFIER = $bundle_identifier;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
9 changes: 8 additions & 1 deletion modules/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,14 @@ for name, path in env.module_list.items():

# Some modules are not linked automatically but can be enabled optionally
# on iOS, so we handle those specially.
if env["platform"] == "iphone" and name in ["arkit", "camera"]:
if env["platform"] == "iphone" and name in [
"arkit",
"camera",
"camera_iphone",
"gamecenter",
"inappstore",
"icloud",
]:
Comment on lines +50 to +57
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this new plugin system, would it be a good idea to move those outside the main engine repository and make them first-party plugins, like we did in Android for https://github.com/godotengine/godot-google-play-billing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it should :) This way plugins would be probably easier to fix and modify.
I think single repo for all godot's plugins should be enough.

continue

lib = env_modules.add_library("module_%s" % name, env.modules_sources)
Expand Down
18 changes: 18 additions & 0 deletions modules/arkit/arkit.gdip
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[config]
name="ARKit"
binary="arkit_lib.a"

initialization="register_arkit_types"
deinitialization="unregister_arkit_types"

[dependencies]
linked=[]
embedded=[]
system=["AVFoundation.framework", "ARKit.framework"]

capabilities=["arkit"]

files=[]

[plist]
NSCameraUsageDescription="Device camera is used for some functionality"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*************************************************************************/
/* register_types.cpp */
/* arkit_module.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
Expand Down Expand Up @@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/

#include "register_types.h"
#include "arkit_module.h"

#include "arkit_interface.h"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*************************************************************************/
/* register_types.h */
/* arkit_module.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
Expand Down
12 changes: 1 addition & 11 deletions modules/camera/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,7 @@ Import("env_modules")

env_camera = env_modules.Clone()

if env["platform"] == "iphone":
# (iOS) Enable module support
env_camera.Append(CCFLAGS=["-fmodules", "-fcxx-modules"])

# (iOS) Build as separate static library
modules_sources = []
env_camera.add_source_files(modules_sources, "register_types.cpp")
env_camera.add_source_files(modules_sources, "camera_ios.mm")
mod_lib = env_modules.add_library("#bin/libgodot_camera_module" + env["LIBSUFFIX"], modules_sources)

elif env["platform"] == "windows":
if env["platform"] == "windows":
env_camera.add_source_files(env.modules_sources, "register_types.cpp")
env_camera.add_source_files(env.modules_sources, "camera_win.cpp")

Expand Down
2 changes: 1 addition & 1 deletion modules/camera/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
def can_build(env, platform):
return platform == "iphone" or platform == "osx" or platform == "windows"
return platform == "osx" or platform == "windows"


def configure(env):
Expand Down
6 changes: 0 additions & 6 deletions modules/camera/register_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
#if defined(WINDOWS_ENABLED)
#include "camera_win.h"
#endif
#if defined(IPHONE_ENABLED)
#include "camera_ios.h"
#endif
#if defined(OSX_ENABLED)
#include "camera_osx.h"
#endif
Expand All @@ -44,9 +41,6 @@ void register_camera_types() {
#if defined(WINDOWS_ENABLED)
CameraServer::make_default<CameraWindows>();
#endif
#if defined(IPHONE_ENABLED)
CameraServer::make_default<CameraIOS>();
#endif
#if defined(OSX_ENABLED)
CameraServer::make_default<CameraOSX>();
#endif
Expand Down
15 changes: 15 additions & 0 deletions modules/camera_iphone/SCsub
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env python

Import("env")
Import("env_modules")

env_camera = env_modules.Clone()

# (iOS) Enable module support
env_camera.Append(CCFLAGS=["-fmodules", "-fcxx-modules"])

# (iOS) Build as separate static library
modules_sources = []
env_camera.add_source_files(modules_sources, "*.cpp")
env_camera.add_source_files(modules_sources, "*.mm")
mod_lib = env_modules.add_library("#bin/libgodot_camera_module" + env["LIBSUFFIX"], modules_sources)
18 changes: 18 additions & 0 deletions modules/camera_iphone/camera.gdip
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[config]
name="Camera"
binary="camera_lib.a"

initialization="register_camera_types"
deinitialization="unregister_camera_types"

[dependencies]
linked=[]
embedded=[]
system=["AVFoundation.framework"]

capabilities=[]

files=[]

[plist]
NSCameraUsageDescription="Device camera is used for some functionality"
File renamed without changes.
File renamed without changes.
40 changes: 40 additions & 0 deletions modules/camera_iphone/camera_module.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*************************************************************************/
/* camera_module.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/

#include "camera_module.h"

#include "camera_ios.h"

void register_camera_types() {
CameraServer::make_default<CameraIOS>();
}

void unregister_camera_types() {
}
32 changes: 32 additions & 0 deletions modules/camera_iphone/camera_module.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*************************************************************************/
/* camera_module.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/

void register_camera_types();
void unregister_camera_types();
6 changes: 6 additions & 0 deletions modules/camera_iphone/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def can_build(env, platform):
return platform == "iphone"


def configure(env):
pass
15 changes: 15 additions & 0 deletions modules/gamecenter/SCsub
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env python

Import("env")
Import("env_modules")

env_gamecenter = env_modules.Clone()

# (iOS) Enable module support
env_gamecenter.Append(CCFLAGS=["-fmodules", "-fcxx-modules"])

# (iOS) Build as separate static library
modules_sources = []
env_gamecenter.add_source_files(modules_sources, "*.cpp")
env_gamecenter.add_source_files(modules_sources, "*.mm")
mod_lib = env_modules.add_library("#bin/libgodot_gamecenter_module" + env["LIBSUFFIX"], modules_sources)
6 changes: 6 additions & 0 deletions modules/gamecenter/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def can_build(env, platform):
return platform == "iphone"


def configure(env):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/

#ifdef GAME_CENTER_ENABLED

#ifndef GAME_CENTER_H
#define GAME_CENTER_H

Expand Down Expand Up @@ -71,5 +69,3 @@ class GameCenter : public Object {
};

#endif

#endif
Loading