From 5d9bf41f9be04f0f717ab1d135d755829998a111 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B8=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=92=D0=B0?= =?UTF-8?q?=D0=BB=D0=B5=D1=80=D0=B0?= Date: Wed, 21 Apr 2021 17:49:25 +1000 Subject: [PATCH 01/11] add request revwiew controller module --- plugins/storereviewcontroller/README.md | 5 ++ .../store_review_controller.h | 58 ++++++++++++++ .../store_review_controller.mm | 80 +++++++++++++++++++ .../store_review_controller_module.cpp | 54 +++++++++++++ .../store_review_controller_module.h | 32 ++++++++ .../storereviewcontroller.gdip | 17 ++++ 6 files changed, 246 insertions(+) create mode 100644 plugins/storereviewcontroller/README.md create mode 100644 plugins/storereviewcontroller/store_review_controller.h create mode 100644 plugins/storereviewcontroller/store_review_controller.mm create mode 100644 plugins/storereviewcontroller/store_review_controller_module.cpp create mode 100644 plugins/storereviewcontroller/store_review_controller_module.h create mode 100644 plugins/storereviewcontroller/storereviewcontroller.gdip diff --git a/plugins/storereviewcontroller/README.md b/plugins/storereviewcontroller/README.md new file mode 100644 index 0000000..d6ee3c6 --- /dev/null +++ b/plugins/storereviewcontroller/README.md @@ -0,0 +1,5 @@ +# Godot iOS InAppStore plugin + +## Methods + +`request_review` - Tells StoreKit to ask the user to rate or review the app, if appropriate, using the specified scene. diff --git a/plugins/storereviewcontroller/store_review_controller.h b/plugins/storereviewcontroller/store_review_controller.h new file mode 100644 index 0000000..8abbfda --- /dev/null +++ b/plugins/storereviewcontroller/store_review_controller.h @@ -0,0 +1,58 @@ +/*************************************************************************/ +/* store_review_controller.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 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. */ +/*************************************************************************/ + +#ifndef STORE_REVIEW_CONTROLLER_H +#define STORE_REVIEW_CONTROLLER_H + +#include "core/version.h" + +#if VERSION_MAJOR == 4 +#include "core/object/class_db.h" +#else +#include "core/object.h" +#endif + +class StoreReviewController : public Object { + + GDCLASS(StoreReviewController, Object); + + static StoreReviewController *instance; + static void _bind_methods(); + +public: + void request_review(); + + static StoreReviewController *get_singleton(); + + StoreReviewController(); + ~StoreReviewController(); +}; + +#endif diff --git a/plugins/storereviewcontroller/store_review_controller.mm b/plugins/storereviewcontroller/store_review_controller.mm new file mode 100644 index 0000000..db097e2 --- /dev/null +++ b/plugins/storereviewcontroller/store_review_controller.mm @@ -0,0 +1,80 @@ +/*************************************************************************/ +/* in_app_store.mm */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 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 "store_review_controller.h" + +#import +#import + + +StoreReviewController *StoreReviewController::instance = NULL; + + +void StoreReviewController::_bind_methods() { + ClassDB::bind_method(D_METHOD("request_review"), &StoreReviewController::request_review); +} + +void StoreReviewController::request_review { + //ios 14+ + if (@available(iOS 14.0, *)) { + UIScene *scene = [[[[UIApplication sharedApplication] connectedScenes] allObjects] firstObject]; + + if([scene.delegate conformsToProtocol:@protocol(UIWindowSceneDelegate)]){ + UIWindow *window = [(id )scene.delegate window]; + if (window) { + [SKStoreReviewController requestReviewInScene:window.windowScene]; + printf("request reviewed!\n"); + return; + } + } + printf("request review failed!\n"); + } + + //deperdicated + if (@available(iOS 10.3, *)) { + [SKStoreReviewController requestReview]; + printf("request reviewed! old variant\n"); + } +} + + + +StoreReviewController *StoreReviewController::get_singleton() { + return instance; +} + +StoreReviewController::StoreReviewController() { + ERR_FAIL_COND(instance != NULL); + instance = this; +} + + +StoreReviewController::~StoreReviewController() { +} diff --git a/plugins/storereviewcontroller/store_review_controller_module.cpp b/plugins/storereviewcontroller/store_review_controller_module.cpp new file mode 100644 index 0000000..65a2aa5 --- /dev/null +++ b/plugins/storereviewcontroller/store_review_controller_module.cpp @@ -0,0 +1,54 @@ +/*************************************************************************/ +/* store_review_controller_module.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 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 "store_review_controller_module.h" + +#include "core/version.h" + +#if VERSION_MAJOR == 4 +#include "core/config/engine.h" +#else +#include "core/engine.h" +#endif + +#include "store_review_controller.h" + +StoreReviewController *store_review_controller; + +void register_storereviewcontroller_types() { + store_review_controller = memnew(StoreReviewController); + Engine::get_singleton()->add_singleton(Engine::Singleton("StoreReviewController", store_review_controller)); +} + +void unregister_inappstore_types() { + if (store_review_controller) { + memdelete(store_review_controller); + } +} diff --git a/plugins/storereviewcontroller/store_review_controller_module.h b/plugins/storereviewcontroller/store_review_controller_module.h new file mode 100644 index 0000000..afc81e3 --- /dev/null +++ b/plugins/storereviewcontroller/store_review_controller_module.h @@ -0,0 +1,32 @@ +/*************************************************************************/ +/* store_review_controller_module.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 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_storereviewcontroller_types(); +void unregister_storereviewcontroller_types(); diff --git a/plugins/storereviewcontroller/storereviewcontroller.gdip b/plugins/storereviewcontroller/storereviewcontroller.gdip new file mode 100644 index 0000000..dbbd481 --- /dev/null +++ b/plugins/storereviewcontroller/storereviewcontroller.gdip @@ -0,0 +1,17 @@ +[config] +name="StoreReviewController" +binary="storereviewcontroller.xcframework" + +initialization="register_storereviewcontroller_types" +deinitialization="unregister_storereviewcontroller_types" + +[dependencies] +linked=[] +embedded=[] +system=["StoreKit.framework"] + +capabilities=[] + +files=[] + +[plist] From 510d3a797f42c3ffaf4fb3d95edd0a4985503636 Mon Sep 17 00:00:00 2001 From: "Pitanov V.V" Date: Wed, 21 Apr 2021 16:55:23 +1000 Subject: [PATCH 02/11] support promouting purchaces simple relese promoting purchace: https://developer.apple.com/app-store/promoting-in-app-purchases/ copy to my old code, from : https://github.com/Valeryn4/Godot-IOS-Services-Extend-Module/tree/dev add new event "purchase_deferred" initializing an out-of-game purchase sample: ```gdscript while iap.get_pending_event_count() > 0: var event = iap.pop_pending_event() if event.type == "purchase_deferred" : iap.purchase( { "product_id": event.product_id} ) #deferred purchase ``` Update README.md Revert "support promouting purchaces" This reverts commit 6f90954d8e99ecae47560b237cc0acd2056916ba. Revert "Revert "support promouting purchaces"" This reverts commit 205cd9e03a8eea1993634d77778fecd6d29ba578. Revert "Update README.md" This reverts commit a1068311f64c89881dd231af5357c948c7103bcd. remove store module and revert commits --- plugins/inappstore/in_app_store.mm | 9 +++ plugins/storereviewcontroller/README.md | 5 -- .../store_review_controller.h | 58 -------------- .../store_review_controller.mm | 80 ------------------- .../store_review_controller_module.cpp | 54 ------------- .../store_review_controller_module.h | 32 -------- .../storereviewcontroller.gdip | 17 ---- 7 files changed, 9 insertions(+), 246 deletions(-) delete mode 100644 plugins/storereviewcontroller/README.md delete mode 100644 plugins/storereviewcontroller/store_review_controller.h delete mode 100644 plugins/storereviewcontroller/store_review_controller.mm delete mode 100644 plugins/storereviewcontroller/store_review_controller_module.cpp delete mode 100644 plugins/storereviewcontroller/store_review_controller_module.h delete mode 100644 plugins/storereviewcontroller/storereviewcontroller.gdip diff --git a/plugins/inappstore/in_app_store.mm b/plugins/inappstore/in_app_store.mm index 6e4390c..273c136 100644 --- a/plugins/inappstore/in_app_store.mm +++ b/plugins/inappstore/in_app_store.mm @@ -231,6 +231,15 @@ - (void)finishTransactionWithProductID:(NSString *)productID { self.pendingTransactions[productID] = nil; } +- (BOOL)paymentQueue:(SKPaymentQueue *)queue shouldAddStorePayment:(SKPayment *)payment forProduct:(SKProduct *)product { + Dictionary ret; + ret["type"] = "purchase_deferred"; + ret["result"] = "ok"; + ret["product_id"] = String::utf8([payment.productIdentifier UTF8String]); + InAppStore::get_singleton()->_post_event(ret); + return false; +} + - (void)reset { [self.pendingTransactions removeAllObjects]; } diff --git a/plugins/storereviewcontroller/README.md b/plugins/storereviewcontroller/README.md deleted file mode 100644 index d6ee3c6..0000000 --- a/plugins/storereviewcontroller/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Godot iOS InAppStore plugin - -## Methods - -`request_review` - Tells StoreKit to ask the user to rate or review the app, if appropriate, using the specified scene. diff --git a/plugins/storereviewcontroller/store_review_controller.h b/plugins/storereviewcontroller/store_review_controller.h deleted file mode 100644 index 8abbfda..0000000 --- a/plugins/storereviewcontroller/store_review_controller.h +++ /dev/null @@ -1,58 +0,0 @@ -/*************************************************************************/ -/* store_review_controller.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 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. */ -/*************************************************************************/ - -#ifndef STORE_REVIEW_CONTROLLER_H -#define STORE_REVIEW_CONTROLLER_H - -#include "core/version.h" - -#if VERSION_MAJOR == 4 -#include "core/object/class_db.h" -#else -#include "core/object.h" -#endif - -class StoreReviewController : public Object { - - GDCLASS(StoreReviewController, Object); - - static StoreReviewController *instance; - static void _bind_methods(); - -public: - void request_review(); - - static StoreReviewController *get_singleton(); - - StoreReviewController(); - ~StoreReviewController(); -}; - -#endif diff --git a/plugins/storereviewcontroller/store_review_controller.mm b/plugins/storereviewcontroller/store_review_controller.mm deleted file mode 100644 index db097e2..0000000 --- a/plugins/storereviewcontroller/store_review_controller.mm +++ /dev/null @@ -1,80 +0,0 @@ -/*************************************************************************/ -/* in_app_store.mm */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 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 "store_review_controller.h" - -#import -#import - - -StoreReviewController *StoreReviewController::instance = NULL; - - -void StoreReviewController::_bind_methods() { - ClassDB::bind_method(D_METHOD("request_review"), &StoreReviewController::request_review); -} - -void StoreReviewController::request_review { - //ios 14+ - if (@available(iOS 14.0, *)) { - UIScene *scene = [[[[UIApplication sharedApplication] connectedScenes] allObjects] firstObject]; - - if([scene.delegate conformsToProtocol:@protocol(UIWindowSceneDelegate)]){ - UIWindow *window = [(id )scene.delegate window]; - if (window) { - [SKStoreReviewController requestReviewInScene:window.windowScene]; - printf("request reviewed!\n"); - return; - } - } - printf("request review failed!\n"); - } - - //deperdicated - if (@available(iOS 10.3, *)) { - [SKStoreReviewController requestReview]; - printf("request reviewed! old variant\n"); - } -} - - - -StoreReviewController *StoreReviewController::get_singleton() { - return instance; -} - -StoreReviewController::StoreReviewController() { - ERR_FAIL_COND(instance != NULL); - instance = this; -} - - -StoreReviewController::~StoreReviewController() { -} diff --git a/plugins/storereviewcontroller/store_review_controller_module.cpp b/plugins/storereviewcontroller/store_review_controller_module.cpp deleted file mode 100644 index 65a2aa5..0000000 --- a/plugins/storereviewcontroller/store_review_controller_module.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/*************************************************************************/ -/* store_review_controller_module.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 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 "store_review_controller_module.h" - -#include "core/version.h" - -#if VERSION_MAJOR == 4 -#include "core/config/engine.h" -#else -#include "core/engine.h" -#endif - -#include "store_review_controller.h" - -StoreReviewController *store_review_controller; - -void register_storereviewcontroller_types() { - store_review_controller = memnew(StoreReviewController); - Engine::get_singleton()->add_singleton(Engine::Singleton("StoreReviewController", store_review_controller)); -} - -void unregister_inappstore_types() { - if (store_review_controller) { - memdelete(store_review_controller); - } -} diff --git a/plugins/storereviewcontroller/store_review_controller_module.h b/plugins/storereviewcontroller/store_review_controller_module.h deleted file mode 100644 index afc81e3..0000000 --- a/plugins/storereviewcontroller/store_review_controller_module.h +++ /dev/null @@ -1,32 +0,0 @@ -/*************************************************************************/ -/* store_review_controller_module.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 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_storereviewcontroller_types(); -void unregister_storereviewcontroller_types(); diff --git a/plugins/storereviewcontroller/storereviewcontroller.gdip b/plugins/storereviewcontroller/storereviewcontroller.gdip deleted file mode 100644 index dbbd481..0000000 --- a/plugins/storereviewcontroller/storereviewcontroller.gdip +++ /dev/null @@ -1,17 +0,0 @@ -[config] -name="StoreReviewController" -binary="storereviewcontroller.xcframework" - -initialization="register_storereviewcontroller_types" -deinitialization="unregister_storereviewcontroller_types" - -[dependencies] -linked=[] -embedded=[] -system=["StoreKit.framework"] - -capabilities=[] - -files=[] - -[plist] From a4ef9e7fbe7893b9055afc1f3f6ee67cc12960d3 Mon Sep 17 00:00:00 2001 From: Sergey Minakov Date: Fri, 5 Nov 2021 16:50:56 +0300 Subject: [PATCH 03/11] 3.4-stable tvOs xcframework enabled! submodules fix tvOS --- godot | 2 +- scripts/generate_xcframework.sh | 24 ------------------------ scripts/generate_xcframework_iphone.sh | 24 ++++++++++++++++++++++++ scripts/generate_xcframework_tvos.sh | 22 ++++++++++++++++++++++ scripts/release_xcframework.sh | 23 ----------------------- scripts/release_xcframework_iphone.sh | 23 +++++++++++++++++++++++ scripts/release_xcframework_tvos.sh | 23 +++++++++++++++++++++++ 7 files changed, 93 insertions(+), 48 deletions(-) delete mode 100755 scripts/generate_xcframework.sh create mode 100644 scripts/generate_xcframework_iphone.sh create mode 100644 scripts/generate_xcframework_tvos.sh delete mode 100755 scripts/release_xcframework.sh create mode 100644 scripts/release_xcframework_iphone.sh create mode 100644 scripts/release_xcframework_tvos.sh diff --git a/godot b/godot index 207fb16..783a8a0 160000 --- a/godot +++ b/godot @@ -1 +1 @@ -Subproject commit 207fb165bfd1fefd1b4339c9427a569b19d0dcae +Subproject commit 783a8a07f7f938a9a6284eda599abc255142dd66 diff --git a/scripts/generate_xcframework.sh b/scripts/generate_xcframework.sh deleted file mode 100755 index 57b44a6..0000000 --- a/scripts/generate_xcframework.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -set -e - -# Compile static libraries - -# ARM64 Device -scons target=$2 arch=arm64 plugin=$1 version=$3 -# ARM7 Device -scons target=$2 arch=armv7 plugin=$1 version=$3 -# x86_64 Simulator -scons target=$2 arch=x86_64 simulator=yes plugin=$1 version=$3 -# ARM64 Simulator -scons target=$2 arch=arm64 simulator=yes plugin=$1 version=$3 - -# Creating a fat libraries for device and simulator -# lib.-..a -lipo -create "./bin/lib$1.x86_64-simulator.$2.a" "./bin/lib$1.arm64-simulator.$2.a" -output "./bin/$1-simulator.$2.a" -lipo -create "./bin/lib$1.armv7-iphone.$2.a" "./bin/lib$1.arm64-iphone.$2.a" -output "./bin/$1-device.$2.a" - -# Creating a xcframework -xcodebuild -create-xcframework \ - -library "./bin/$1-device.$2.a" \ - -library "./bin/$1-simulator.$2.a" \ - -output "./bin/$1.$2.xcframework" diff --git a/scripts/generate_xcframework_iphone.sh b/scripts/generate_xcframework_iphone.sh new file mode 100644 index 0000000..a78da48 --- /dev/null +++ b/scripts/generate_xcframework_iphone.sh @@ -0,0 +1,24 @@ +#!/bin/bash +set -e + +# Compile static libraries + +# ARM64 Device +scons platform=iphone target=$2 arch=arm64 plugin=$1 version=$3 +# ARM7 Device +scons platform=iphone target=$2 arch=armv7 plugin=$1 version=$3 +# x86_64 Simulator +scons platform=iphone target=$2 arch=x86_64 simulator=yes plugin=$1 version=$3 +# ARM64 Simulator +scons platform=iphone target=$2 arch=arm64 simulator=yes plugin=$1 version=$3 + +# Creating a fat libraries for device and simulator +# lib.-..a +lipo -create "./bin/iphone/lib$1.x86_64-simulator.$2.a" "./bin/iphone/lib$1.arm64-simulator.$2.a" -output "./bin/iphone/$1-simulator.$2.a" +lipo -create "./bin/iphone/lib$1.armv7-iphone.$2.a" "./bin/iphone/lib$1.arm64-iphone.$2.a" -output "./bin/iphone/$1-device.$2.a" + +# Creating a xcframework +xcodebuild -create-xcframework \ + -library "./bin/iphone/$1-device.$2.a" \ + -library "./bin/iphone/$1-simulator.$2.a" \ + -output "./bin/iphone/$1.$2.xcframework" diff --git a/scripts/generate_xcframework_tvos.sh b/scripts/generate_xcframework_tvos.sh new file mode 100644 index 0000000..f2895d0 --- /dev/null +++ b/scripts/generate_xcframework_tvos.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e + +# Compile static libraries + +# ARM64 Device +scons platform=tvos target=$2 arch=arm64 plugin=$1 version=$3 +# x86_64 Simulator +scons platform=tvos target=$2 arch=x86_64 simulator=yes plugin=$1 version=$3 +# ARM64 Simulator +scons platform=tvos target=$2 arch=arm64 simulator=yes plugin=$1 version=$3 + +# Creating a fat libraries for device and simulator +# lib.-..a +lipo -create "./bin/tvos/lib$1.x86_64-simulator.$2.a" "./bin/tvos/lib$1.arm64-simulator.$2.a" -output "./bin/tvos/$1-simulator.$2.a" +lipo -create "./bin/tvos/lib$1.armv7-iphone.$2.a" "./bin/tvos/lib$1.arm64-iphone.$2.a" -output "./bin/tvos/$1-device.$2.a" + +# Creating a xcframework +xcodebuild -create-xcframework \ + -library "./bin/tvos/$1-device.$2.a" \ + -library "./bin/tvos/$1-simulator.$2.a" \ + -output "./bin/tvos/$1.$2.xcframework" diff --git a/scripts/release_xcframework.sh b/scripts/release_xcframework.sh deleted file mode 100755 index dfd4c7c..0000000 --- a/scripts/release_xcframework.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -set -e - -GODOT_PLUGINS="gamecenter inappstore icloud camera arkit apn photo_picker" - -# Compile Plugin -for lib in $GODOT_PLUGINS; do - ./scripts/generate_xcframework.sh $lib release $1 - ./scripts/generate_xcframework.sh $lib release_debug $1 - mv ./bin/${lib}.release_debug.xcframework ./bin/${lib}.debug.xcframework -done - -# Move to release folder - -rm -rf ./bin/release -mkdir ./bin/release - -# Move Plugin -for lib in $GODOT_PLUGINS; do - mkdir ./bin/release/${lib} - mv ./bin/${lib}.{release,debug}.xcframework ./bin/release/${lib} - cp ./plugins/${lib}/${lib}.gdip ./bin/release/${lib} -done diff --git a/scripts/release_xcframework_iphone.sh b/scripts/release_xcframework_iphone.sh new file mode 100644 index 0000000..7fc1fdf --- /dev/null +++ b/scripts/release_xcframework_iphone.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -e + +GODOT_PLUGINS="gamecenter inappstore icloud camera arkit apn photo_picker" + +# Compile Plugin +for lib in $GODOT_PLUGINS; do + ./scripts/generate_xcframework_iphone.sh $lib release $1 + ./scripts/generate_xcframework_iphone.sh $lib release_debug $1 + mv ./bin/iphone/${lib}.release_debug.xcframework ./bin/iphone/${lib}.debug.xcframework +done + +# Move to release folder + +rm -rf ./bin/iphone/release +mkdir ./bin/iphone/release + +# Move Plugin +for lib in $GODOT_PLUGINS; do + mkdir ./bin/iphone/release/${lib} + mv ./bin/iphone/${lib}.{release,debug}.xcframework ./bin/iphone/release/${lib} + cp ./plugins/${lib}/${lib}.gdip ./bin/iphone/release/${lib} +done diff --git a/scripts/release_xcframework_tvos.sh b/scripts/release_xcframework_tvos.sh new file mode 100644 index 0000000..8a1eaf9 --- /dev/null +++ b/scripts/release_xcframework_tvos.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -e + +GODOT_PLUGINS="inappstore icloud" + +# Compile Plugin +for lib in $GODOT_PLUGINS; do + ./scripts/generate_xcframework_tvos.sh $lib release $1 + ./scripts/generate_xcframework_tvos.sh $lib release_debug $1 + mv ./bin/tvos/${lib}.release_debug.xcframework ./bin/tvos/${lib}.debug.xcframework +done + +# Move to release folder + +rm -rf ./bin/tvos/release +mkdir ./bin/tvos/release + +# Move Plugin +for lib in $GODOT_PLUGINS; do + mkdir ./bin/tvos/release/${lib} + mv ./bin/tvos/${lib}.{release,debug}.xcframework ./bin/tvos/release/${lib} + cp ./plugins/${lib}/${lib}.gdip ./bin/tvos/release/${lib} +done \ No newline at end of file From 4ee355bd4b2d121e6f448fe2b9723016cc5d644e Mon Sep 17 00:00:00 2001 From: Valerii Date: Thu, 27 Jan 2022 13:05:20 +1000 Subject: [PATCH 04/11] Add tvOS and refactory remove path 'core/platform', remove unused paths add tvos platfom add flag optional sdk_version - minimum sdk version target add argument on scripts --- SConstruct | 118 +++++++++++++----- scripts/generate_static_library.sh | 33 +++-- scripts/generate_xcframework.sh | 30 +++++ scripts/generate_xcframework_iphone.sh | 24 ---- scripts/generate_xcframework_tvos.sh | 22 ---- ...amework_tvos.sh => release_xcframework.sh} | 7 +- scripts/release_xcframework_iphone.sh | 23 ---- 7 files changed, 142 insertions(+), 115 deletions(-) create mode 100644 scripts/generate_xcframework.sh delete mode 100644 scripts/generate_xcframework_iphone.sh delete mode 100644 scripts/generate_xcframework_tvos.sh rename scripts/{release_xcframework_tvos.sh => release_xcframework.sh} (80%) delete mode 100644 scripts/release_xcframework_iphone.sh diff --git a/SConstruct b/SConstruct index f96fa46..e032f7f 100644 --- a/SConstruct +++ b/SConstruct @@ -19,6 +19,7 @@ opts = Variables([], ARGUMENTS) env = DefaultEnvironment() # Define our options +opts.Add(EnumVariable('platform', 'Platform build', 'iphone', ['', 'iphone', 'tvos'])) opts.Add(EnumVariable('target', "Compilation target", 'debug', ['debug', 'release', "release_debug"])) opts.Add(EnumVariable('arch', "Compilation Architecture", '', ['', 'arm64', 'armv7', 'x86_64'])) opts.Add(BoolVariable('simulator', "Compilation platform", 'no')) @@ -26,10 +27,17 @@ opts.Add(BoolVariable('use_llvm', "Use the LLVM / Clang compiler", 'no')) opts.Add(PathVariable('target_path', 'The path where the lib is installed.', 'bin/')) opts.Add(EnumVariable('plugin', 'Plugin to build', '', ['', 'apn', 'arkit', 'camera', 'icloud', 'gamecenter', 'inappstore', 'photo_picker'])) opts.Add(EnumVariable('version', 'Godot version to target', '', ['', '3.x', '4.0'])) +opts.Add('sdk_version', 'SDK version ', '10.0') +opts.Add('TOOLCHAIN_PATH', 'path tool chain xcode ', '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain') +opts.Add("triple", "Triple for tvOS toolchain", ""), # Updates the environment with the option variables. opts.Update(env) + +# Generates help for the -h scons option. +Help(opts.GenerateHelpText(env)) + # Process some arguments if env['use_llvm']: env['CC'] = 'clang' @@ -47,6 +55,15 @@ if env['version'] == '': print("No valid Godot version selected.") quit(); +if env['platform'] == '': + print("No valid platform selected.") + quit(); + +if env['sdk_version'] == '': + print("sdk version invalid.") + quit(); + + # For the reference: # - CCFLAGS are compilation flags shared between C and C++ # - CFLAGS are for C-specific compilation flags @@ -55,20 +72,45 @@ if env['version'] == '': # - CPPDEFINES are for pre-processor defines # - LINKFLAGS are for linking flags + # Enable Obj-C modules env.Append(CCFLAGS=["-fmodules", "-fcxx-modules"]) -if env['simulator']: - sdk_name = 'iphonesimulator' - env.Append(CCFLAGS=['-mios-simulator-version-min=10.0']) - env.Append(LINKFLAGS=["-mios-simulator-version-min=10.0"]) -else: - sdk_name = 'iphoneos' - env.Append(CCFLAGS=['-miphoneos-version-min=10.0']) - env.Append(LINKFLAGS=["-miphoneos-version-min=10.0"]) +##### OTHE FIND SDK + +compiler_path = "$TOOLCHAIN_PATH/usr/bin/${triple}" +s_compiler_path = "$TOOLCHAIN_PATH/Developer/usr/bin/" + +env["CC"] = compiler_path + "clang" +env["CXX"] = compiler_path + "clang++" +env["S_compiler"] = s_compiler_path + "gcc" +env["AR"] = compiler_path + "ar" +env["RANLIB"] = compiler_path + "ranlib" + + +if env['platform'] == 'iphone': + sdk_def_enable = '-DIPHONE_ENABLED' + sdk_def = 'IPHONESDK' + if env['simulator']: + sdk_name = 'iphonesimulator' + flag_version_min = '-mios-simulator-version-min=' + else: + sdk_name = 'iphoneos' + flag_version_min = '-miphoneos-version-min=' +elif env['platform'] == 'tvos' : + sdk_def_enable = '-DTVOS_ENABLED' + sdk_def = "TVOSSDK" + if env['simulator']: + sdk_name = 'appletvsimulator' + flag_version_min = '-mappletvsimulator-version-min=' + else: + sdk_name = 'appletvos' + flag_version_min = '-mappletvos-version-min=' try: sdk_path = decode_utf8(subprocess.check_output(['xcrun', '--sdk', sdk_name, '--show-sdk-path']).strip()) + if sdk_path : + env[sdk_def] = sdk_path #SDK IPHONESDK=sdk_path except (subprocess.CalledProcessError, OSError): raise ValueError("Failed to find SDK path while running xcrun --sdk {} --show-sdk-path.".format(sdk_name)) @@ -82,13 +124,18 @@ env.Append(CCFLAGS=[ # '-Wextra', ]) -env.Append(CCFLAGS=['-arch', env['arch'], "-isysroot", "$IPHONESDK", "-stdlib=libc++", '-isysroot', sdk_path]) + + +env.Append(CCFLAGS=['-isysroot', sdk_path, flag_version_min + env['sdk_version']]) +env.Append(LINKFLAGS=['-isysroot', sdk_path, flag_version_min + env['sdk_version'], '-F' + sdk_path]) + +env.Append(CCFLAGS=['-arch', env['arch'], '-stdlib=libc++']) env.Append(CCFLAGS=['-DPTRCALL_ENABLED']) env.Prepend(CXXFLAGS=[ '-DNEED_LONG_INT', '-DLIBYUV_DISABLE_NEON', - '-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DCOREAUDIO_ENABLED' + sdk_def_enable, '-DUNIX_ENABLED', '-DCOREAUDIO_ENABLED' ]) -env.Append(LINKFLAGS=["-arch", env['arch'], '-isysroot', sdk_path, '-F' + sdk_path]) +env.Append(LINKFLAGS=["-arch", env['arch'], '-F' + sdk_path]) if env['arch'] == 'armv7': env.Prepend(CXXFLAGS=['-fno-aligned-allocation']) @@ -97,6 +144,14 @@ if env['version'] == '3.x': env.Prepend(CFLAGS=['-std=gnu11']) env.Prepend(CXXFLAGS=['-DGLES_ENABLED', '-std=gnu++14']) + env.Prepend( + CPPPATH=[ + sdk_path + "/usr/include", + sdk_path + "/System/Library/Frameworks/OpenGLES.framework/Headers", + sdk_path + "/System/Library/Frameworks/AudioUnit.framework/Headers", + ] + ) + if env['target'] == 'debug': env.Prepend(CXXFLAGS=[ '-gdwarf-2', '-O0', @@ -151,33 +206,34 @@ else: print("No valid version to set flags for.") quit(); -# Adding header files -env.Append(CPPPATH=[ - '.', - 'godot', - 'godot/main', - 'godot/core', - 'godot/core/os', - 'godot/core/platform', - 'godot/platform/iphone', - 'godot/modules', - 'godot/scene', - 'godot/servers', - 'godot/drivers', - 'godot/thirdparty', -]) +if env['platform'] == 'iphone' : + + # Adding header files + env.Append(CPPPATH=[ + '.', + 'godot', + 'godot/platform/iphone', + ]) + +elif env['platform'] == 'tvos' : + # Adding header files + env.Append(CPPPATH=[ + '.', + 'godot', + 'godot/platform/tvos', + ]) + # tweak this if you want to use different folders, or more folders, to store your source code in. sources = Glob('plugins/' + env['plugin'] + '/*.cpp') sources.append(Glob('plugins/' + env['plugin'] + '/*.mm')) sources.append(Glob('plugins/' + env['plugin'] + '/*.m')) -# lib.-..a -library_platform = env["arch"] + "-" + ("simulator" if env["simulator"] else "iphone") -library_name = env['plugin'] + "." + library_platform + "." + env["target"] + ".a" +# lib.-...a +# lib.-..a +library_platform = env['arch'] + '-' + env['platform'] + ('.simulator' if env['simulator'] else '') +library_name = env['plugin'] + "." + library_platform + "." + env['target'] + '.a' library = env.StaticLibrary(target=env['target_path'] + library_name, source=sources) Default(library) -# Generates help for the -h scons option. -Help(opts.GenerateHelpText(env)) diff --git a/scripts/generate_static_library.sh b/scripts/generate_static_library.sh index 5f6f7bd..6efdb16 100755 --- a/scripts/generate_static_library.sh +++ b/scripts/generate_static_library.sh @@ -1,18 +1,27 @@ #!/bin/bash set -e -# Compile static libraries - # ARM64 Device -scons target=$2 arch=arm64 plugin=$1 version=$3 -# ARM7 Device -scons target=$2 arch=armv7 plugin=$1 version=$3 +scons platform=$4 target=$2 arch=arm64 plugin=$1 version=$3 +if [[$4 == "iphone"]] then; + #ARMv7 Device + scons platform=$4 target=$2 arch=arm7 plugin=$1 version=$3 +fi + # x86_64 Simulator -scons target=$2 arch=x86_64 simulator=yes plugin=$1 version=$3 +scons platform=$4 target=$2 arch=x86_64 simulator=yes plugin=$1 version=$3 +# ARM64 Simulator +scons platform=$4 target=$2 arch=arm64 simulator=yes plugin=$1 version=$3 -# Creating a fat libraries for device and simulator -# lib.-..a -lipo -create "./bin/lib$1.x86_64-simulator.$2.a" \ - "./bin/lib$1.armv7-iphone.$2.a" \ - "./bin/lib$1.arm64-iphone.$2.a" \ - -output "./bin/$1.$2.a" \ No newline at end of file +if [[$4 == "iphone"]] then; + lipo -create "./bin/lib$1.x86_64-$4.simulator.$2.a" \ + "./bin/lib$1.arm64-$4.simulator.$2.a" \ + "./bin/lib$1.arm64-$4.$2.a" \ + "./bin/lib$1.armv7-$4.$2.a" \ + -output "./bin/$1.$4-$2.a" +elif [[$4 == "tvos"]] then; + lipo -create "./bin/lib$1.x86_64-$4.simulator.$2.a" \ + "./bin/lib$1.arm64-$4.simulator.$2.a" \ + "./bin/lib$1.arm64-$4.$2.a" \ + -output "./bin/$1.$4-$2.a" +fi diff --git a/scripts/generate_xcframework.sh b/scripts/generate_xcframework.sh new file mode 100644 index 0000000..f7fa03d --- /dev/null +++ b/scripts/generate_xcframework.sh @@ -0,0 +1,30 @@ +#!/bin/bash +set -e + +# Compile static libraries + +# ARM64 Device +scons platform=$4 target=$2 arch=arm64 plugin=$1 version=$3 +if [[$4 == "iphone"]] then; + # ARMv7 Device + scons platform=$4 target=$2 arch=arm7 plugin=$1 version=$3 +fi + +# x86_64 Simulator +scons platform=$4 target=$2 arch=x86_64 simulator=yes plugin=$1 version=$3 +# ARM64 Simulator +scons platform=$4 target=$2 arch=arm64 simulator=yes plugin=$1 version=$3 + +# Creating a fat libraries for device and simulator +# lib.-...a +lipo -create "./bin/lib$1.x86_64-$4.simulator.$2.a" "./bin/lib$1.arm64-$4.simulator.$2.a" -output "./bin/$4/$1-simulator.$2.a" +if [[$4 == "iphone"]] then; + lipo -create "./bin/lib$1.arm64-$4.$2.a" "./bin/lib$1.armv7-$4.$2.a" -output "./bin/$4/$1-device.$2.a" +else + lipo -create "./bin/lib$1.arm64-$4.$2.a" -output "./bin/$4/$1-device.$2.a" +fi +# Creating a xcframework +xcodebuild -create-xcframework \ + -library "./bin/$4/$1-device.$2.a" \ + -library "./bin/$4/$1-simulator.$2.a" \ + -output "./bin/$4/$1.$2.xcframework" diff --git a/scripts/generate_xcframework_iphone.sh b/scripts/generate_xcframework_iphone.sh deleted file mode 100644 index a78da48..0000000 --- a/scripts/generate_xcframework_iphone.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -set -e - -# Compile static libraries - -# ARM64 Device -scons platform=iphone target=$2 arch=arm64 plugin=$1 version=$3 -# ARM7 Device -scons platform=iphone target=$2 arch=armv7 plugin=$1 version=$3 -# x86_64 Simulator -scons platform=iphone target=$2 arch=x86_64 simulator=yes plugin=$1 version=$3 -# ARM64 Simulator -scons platform=iphone target=$2 arch=arm64 simulator=yes plugin=$1 version=$3 - -# Creating a fat libraries for device and simulator -# lib.-..a -lipo -create "./bin/iphone/lib$1.x86_64-simulator.$2.a" "./bin/iphone/lib$1.arm64-simulator.$2.a" -output "./bin/iphone/$1-simulator.$2.a" -lipo -create "./bin/iphone/lib$1.armv7-iphone.$2.a" "./bin/iphone/lib$1.arm64-iphone.$2.a" -output "./bin/iphone/$1-device.$2.a" - -# Creating a xcframework -xcodebuild -create-xcframework \ - -library "./bin/iphone/$1-device.$2.a" \ - -library "./bin/iphone/$1-simulator.$2.a" \ - -output "./bin/iphone/$1.$2.xcframework" diff --git a/scripts/generate_xcframework_tvos.sh b/scripts/generate_xcframework_tvos.sh deleted file mode 100644 index f2895d0..0000000 --- a/scripts/generate_xcframework_tvos.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -set -e - -# Compile static libraries - -# ARM64 Device -scons platform=tvos target=$2 arch=arm64 plugin=$1 version=$3 -# x86_64 Simulator -scons platform=tvos target=$2 arch=x86_64 simulator=yes plugin=$1 version=$3 -# ARM64 Simulator -scons platform=tvos target=$2 arch=arm64 simulator=yes plugin=$1 version=$3 - -# Creating a fat libraries for device and simulator -# lib.-..a -lipo -create "./bin/tvos/lib$1.x86_64-simulator.$2.a" "./bin/tvos/lib$1.arm64-simulator.$2.a" -output "./bin/tvos/$1-simulator.$2.a" -lipo -create "./bin/tvos/lib$1.armv7-iphone.$2.a" "./bin/tvos/lib$1.arm64-iphone.$2.a" -output "./bin/tvos/$1-device.$2.a" - -# Creating a xcframework -xcodebuild -create-xcframework \ - -library "./bin/tvos/$1-device.$2.a" \ - -library "./bin/tvos/$1-simulator.$2.a" \ - -output "./bin/tvos/$1.$2.xcframework" diff --git a/scripts/release_xcframework_tvos.sh b/scripts/release_xcframework.sh similarity index 80% rename from scripts/release_xcframework_tvos.sh rename to scripts/release_xcframework.sh index 8a1eaf9..2c9912d 100644 --- a/scripts/release_xcframework_tvos.sh +++ b/scripts/release_xcframework.sh @@ -3,7 +3,7 @@ set -e GODOT_PLUGINS="inappstore icloud" -# Compile Plugin +# Compile Plugin for lib in $GODOT_PLUGINS; do ./scripts/generate_xcframework_tvos.sh $lib release $1 ./scripts/generate_xcframework_tvos.sh $lib release_debug $1 @@ -12,12 +12,13 @@ done # Move to release folder -rm -rf ./bin/tvos/release +rm -rf ./bin/tvos +mkdir ./bin/tvos mkdir ./bin/tvos/release # Move Plugin for lib in $GODOT_PLUGINS; do mkdir ./bin/tvos/release/${lib} mv ./bin/tvos/${lib}.{release,debug}.xcframework ./bin/tvos/release/${lib} - cp ./plugins/${lib}/${lib}.gdip ./bin/tvos/release/${lib} + cp ./plugins/${lib}/${lib}.gdip ./bin/tvos/release/${lib}/${lib}.gdatvp done \ No newline at end of file diff --git a/scripts/release_xcframework_iphone.sh b/scripts/release_xcframework_iphone.sh deleted file mode 100644 index 7fc1fdf..0000000 --- a/scripts/release_xcframework_iphone.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -set -e - -GODOT_PLUGINS="gamecenter inappstore icloud camera arkit apn photo_picker" - -# Compile Plugin -for lib in $GODOT_PLUGINS; do - ./scripts/generate_xcframework_iphone.sh $lib release $1 - ./scripts/generate_xcframework_iphone.sh $lib release_debug $1 - mv ./bin/iphone/${lib}.release_debug.xcframework ./bin/iphone/${lib}.debug.xcframework -done - -# Move to release folder - -rm -rf ./bin/iphone/release -mkdir ./bin/iphone/release - -# Move Plugin -for lib in $GODOT_PLUGINS; do - mkdir ./bin/iphone/release/${lib} - mv ./bin/iphone/${lib}.{release,debug}.xcframework ./bin/iphone/release/${lib} - cp ./plugins/${lib}/${lib}.gdip ./bin/iphone/release/${lib} -done From d1e113174003698759493a5d6b0855222caa888f Mon Sep 17 00:00:00 2001 From: Valerii Date: Thu, 27 Jan 2022 18:56:41 +1000 Subject: [PATCH 05/11] add platform change on scripts --- SConstruct | 18 +++--------------- scripts/release_static_library.sh | 25 ++++++++++++++++--------- scripts/release_xcframework.sh | 31 +++++++++++++++++++++---------- 3 files changed, 40 insertions(+), 34 deletions(-) diff --git a/SConstruct b/SConstruct index e032f7f..d79d869 100644 --- a/SConstruct +++ b/SConstruct @@ -13,7 +13,7 @@ else: # Most of the settings are taken from https://github.com/BastiaanOlij/gdnative_cpp_example -opts = Variables([], ARGUMENTS) +opts = Variable([], ARGUMENTS) # Gets the standard flags CC, CCX, etc. env = DefaultEnvironment() @@ -27,10 +27,9 @@ opts.Add(BoolVariable('use_llvm', "Use the LLVM / Clang compiler", 'no')) opts.Add(PathVariable('target_path', 'The path where the lib is installed.', 'bin/')) opts.Add(EnumVariable('plugin', 'Plugin to build', '', ['', 'apn', 'arkit', 'camera', 'icloud', 'gamecenter', 'inappstore', 'photo_picker'])) opts.Add(EnumVariable('version', 'Godot version to target', '', ['', '3.x', '4.0'])) -opts.Add('sdk_version', 'SDK version ', '10.0') -opts.Add('TOOLCHAIN_PATH', 'path tool chain xcode ', '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain') -opts.Add("triple", "Triple for tvOS toolchain", ""), + +opts.Add('sdk_version', 'SDK version ', '10.0') # Updates the environment with the option variables. opts.Update(env) @@ -76,17 +75,6 @@ if env['sdk_version'] == '': # Enable Obj-C modules env.Append(CCFLAGS=["-fmodules", "-fcxx-modules"]) -##### OTHE FIND SDK - -compiler_path = "$TOOLCHAIN_PATH/usr/bin/${triple}" -s_compiler_path = "$TOOLCHAIN_PATH/Developer/usr/bin/" - -env["CC"] = compiler_path + "clang" -env["CXX"] = compiler_path + "clang++" -env["S_compiler"] = s_compiler_path + "gcc" -env["AR"] = compiler_path + "ar" -env["RANLIB"] = compiler_path + "ranlib" - if env['platform'] == 'iphone': sdk_def_enable = '-DIPHONE_ENABLED' diff --git a/scripts/release_static_library.sh b/scripts/release_static_library.sh index 80758b8..eb34419 100755 --- a/scripts/release_static_library.sh +++ b/scripts/release_static_library.sh @@ -1,21 +1,28 @@ #!/bin/bash -GODOT_PLUGINS="gamecenter inappstore icloud camera arkit apn photo_picker" +if [[$1 == "tvos"]] then; + GODOT_PLUGINS="inappstore icloud" +elif [[$1 == "iphone"]] then; + GODOT_PLUGINS="gamecenter inappstore icloud camera arkit apn photo_picker" +fi -# Compile Plugin +rm -rf ./bin/$1 +mkdir ./bin/$1 + +# Compile Plugin for lib in $GODOT_PLUGINS; do - ./scripts/generate_static_library.sh $lib release $1 - ./scripts/generate_static_library.sh $lib release_debug $1 - mv ./bin/${lib}.release_debug.a ./bin/${lib}.debug.a + ./scripts/generate_static_library.sh $lib release $2 + ./scripts/generate_static_library.sh $lib release_debug $2 + mv ./bin/$1/${lib}.release_debug.a ./bin/$1/${lib}.debug.a done # Move to release folder -rm -rf ./bin/release -mkdir ./bin/release + +mkdir ./bin/$1/release # Move Plugin for lib in $GODOT_PLUGINS; do - mkdir ./bin/release/${lib} - mv ./bin/${lib}.{release,debug}.a ./bin/release/${lib} + mkdir ./bin/$1/release/${lib} + mv ./bin/$1/${lib}.{release,debug}.a ./bin/$1/release/${lib} done \ No newline at end of file diff --git a/scripts/release_xcframework.sh b/scripts/release_xcframework.sh index 2c9912d..2db0192 100644 --- a/scripts/release_xcframework.sh +++ b/scripts/release_xcframework.sh @@ -1,24 +1,35 @@ #!/bin/bash set -e -GODOT_PLUGINS="inappstore icloud" +#call ./scripts/releasexcframework.sh iphone 3.x +#call ./scripts/releasexcframework.sh tvos 3.x +#call ./scripts/releasexcframework.sh iphone 4.0 +#call ./scripts/releasexcframework.sh tvos 4.0 + +if [[$1 == "tvos"]] then; + GODOT_PLUGINS="inappstore icloud" +elif [[$1 == "iphone"]] then; + GODOT_PLUGINS="gamecenter inappstore icloud camera arkit apn photo_picker" +fi + +rm -rf ./bin/$1 +mkdir ./bin/$1 # Compile Plugin for lib in $GODOT_PLUGINS; do - ./scripts/generate_xcframework_tvos.sh $lib release $1 - ./scripts/generate_xcframework_tvos.sh $lib release_debug $1 - mv ./bin/tvos/${lib}.release_debug.xcframework ./bin/tvos/${lib}.debug.xcframework + ./scripts/generate_xcframework_$1.sh $lib release $2 + ./scripts/generate_xcframework_$1.sh $lib release_debug $2 + mv ./bin/$1/${lib}.release_debug.xcframework ./bin/$1/${lib}.debug.xcframework done # Move to release folder -rm -rf ./bin/tvos -mkdir ./bin/tvos -mkdir ./bin/tvos/release + +mkdir ./bin/$1/release # Move Plugin for lib in $GODOT_PLUGINS; do - mkdir ./bin/tvos/release/${lib} - mv ./bin/tvos/${lib}.{release,debug}.xcframework ./bin/tvos/release/${lib} - cp ./plugins/${lib}/${lib}.gdip ./bin/tvos/release/${lib}/${lib}.gdatvp + mkdir ./bin/$1/release/${lib} + mv ./bin/$1/${lib}.{release,debug}.xcframework ./bin/$1/release/${lib} + cp ./plugins/${lib}/${lib}.gdip ./bin/$1/release/${lib}/${lib}.gdatvp done \ No newline at end of file From 8ec73f5b1e8e54e343f37c48aa9020930ecf11a3 Mon Sep 17 00:00:00 2001 From: Valerii Date: Thu, 3 Feb 2022 13:24:33 +1000 Subject: [PATCH 06/11] add bit flag --- .gitignore | 1 + SConstruct | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index c7c4201..05359dd 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ ## User settings xcuserdata/ +.vscode/ ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) *.xcscmblueprint diff --git a/SConstruct b/SConstruct index d79d869..318700b 100644 --- a/SConstruct +++ b/SConstruct @@ -88,6 +88,11 @@ if env['platform'] == 'iphone': elif env['platform'] == 'tvos' : sdk_def_enable = '-DTVOS_ENABLED' sdk_def = "TVOSSDK" + + # tvOS requires Bitcode. + env.Append(CCFLAGS=["-fembed-bitcode"]) + env.Append(LINKFLAGS=["-bitcode_bundle"]) + if env['simulator']: sdk_name = 'appletvsimulator' flag_version_min = '-mappletvsimulator-version-min=' From c9d40816ba656875224fae09fa97b99a91bebc1e Mon Sep 17 00:00:00 2001 From: Valerii Date: Mon, 7 Feb 2022 15:07:15 +1000 Subject: [PATCH 07/11] tvOS update --- plugins/inappstore/in_app_store.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/inappstore/in_app_store.mm b/plugins/inappstore/in_app_store.mm index 05388b8..2d9c399 100644 --- a/plugins/inappstore/in_app_store.mm +++ b/plugins/inappstore/in_app_store.mm @@ -434,7 +434,6 @@ - (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)tran } InAppStore::InAppStore() { - ERR_FAIL_COND(instance != NULL); instance = this; products_request_delegate = [[GodotProductsDelegate alloc] init]; @@ -460,4 +459,6 @@ - (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)tran products_request_delegate = nil; [[SKPaymentQueue defaultQueue] removeTransactionObserver:transactions_observer]; transactions_observer = nil; + + instance = NULL; } From a98de09eb6d00e17b128b7cffbe3cad2aa8e002f Mon Sep 17 00:00:00 2001 From: Valerii Date: Mon, 7 Feb 2022 15:10:39 +1000 Subject: [PATCH 08/11] fix generate script --- scripts/release_xcframework.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/release_xcframework.sh b/scripts/release_xcframework.sh index 2db0192..3a937ce 100644 --- a/scripts/release_xcframework.sh +++ b/scripts/release_xcframework.sh @@ -17,8 +17,8 @@ mkdir ./bin/$1 # Compile Plugin for lib in $GODOT_PLUGINS; do - ./scripts/generate_xcframework_$1.sh $lib release $2 - ./scripts/generate_xcframework_$1.sh $lib release_debug $2 + ./scripts/generate_xcframework.sh $lib release $2 $1 + ./scripts/generate_xcframework.sh $lib release_debug $2 $1 mv ./bin/$1/${lib}.release_debug.xcframework ./bin/$1/${lib}.debug.xcframework done From 231942ee8be17d01ce3e68def975100a23cf9592 Mon Sep 17 00:00:00 2001 From: Valerii Date: Mon, 7 Feb 2022 15:13:23 +1000 Subject: [PATCH 09/11] need squash --- plugins/inappstore/in_app_store.mm | 1 + plugins/inappstore/register_types.cpp | 54 +++++++++++++++++++++++++++ scripts/generate_xcframework.sh | 2 +- scripts/release_xcframework.sh | 4 +- 4 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 plugins/inappstore/register_types.cpp diff --git a/plugins/inappstore/in_app_store.mm b/plugins/inappstore/in_app_store.mm index 2d9c399..5536f74 100644 --- a/plugins/inappstore/in_app_store.mm +++ b/plugins/inappstore/in_app_store.mm @@ -440,6 +440,7 @@ - (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)tran transactions_observer = [[GodotTransactionsObserver alloc] init]; [[SKPaymentQueue defaultQueue] addTransactionObserver:transactions_observer]; + NSLog(@"*** InAppStore init!"); } void InAppStore::finish_transaction(String product_id) { diff --git a/plugins/inappstore/register_types.cpp b/plugins/inappstore/register_types.cpp new file mode 100644 index 0000000..9b72a53 --- /dev/null +++ b/plugins/inappstore/register_types.cpp @@ -0,0 +1,54 @@ +/*************************************************************************/ +/* in_app_store_module.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 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 "register_types.h" + +#include "core/version.h" + +#if VERSION_MAJOR == 4 +#include "core/config/engine.h" +#else +#include "core/engine.h" +#endif + +#include "in_app_store.h" + +InAppStore* store_kit = NULL; + +void register_inappstore_types() { + store_kit = memnew(InAppStore); + Engine::get_singleton()->add_singleton(Engine::Singleton("InAppStore", store_kit)); +} + +void unregister_inappstore_types() { + if (store_kit) { + memdelete(store_kit); + } +} diff --git a/scripts/generate_xcframework.sh b/scripts/generate_xcframework.sh index f7fa03d..da414b1 100644 --- a/scripts/generate_xcframework.sh +++ b/scripts/generate_xcframework.sh @@ -1,7 +1,7 @@ #!/bin/bash set -e -# Compile static libraries +# Compile static libraries_ # ARM64 Device scons platform=$4 target=$2 arch=arm64 plugin=$1 version=$3 diff --git a/scripts/release_xcframework.sh b/scripts/release_xcframework.sh index 3a937ce..32f9191 100644 --- a/scripts/release_xcframework.sh +++ b/scripts/release_xcframework.sh @@ -3,8 +3,8 @@ set -e #call ./scripts/releasexcframework.sh iphone 3.x #call ./scripts/releasexcframework.sh tvos 3.x -#call ./scripts/releasexcframework.sh iphone 4.0 -#call ./scripts/releasexcframework.sh tvos 4.0 +#call ./scripts/releasexcframework.sh iphone 4.0 +#call ./scripts/releasexcframework.sh tvos 4.0 if [[$1 == "tvos"]] then; GODOT_PLUGINS="inappstore icloud" From 872309cc53c120903e9e08cc79f6df1dec6b1166 Mon Sep 17 00:00:00 2001 From: Valerii Date: Mon, 7 Feb 2022 15:31:46 +1000 Subject: [PATCH 10/11] upd scons --- SConstruct | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index 318700b..de41d9e 100644 --- a/SConstruct +++ b/SConstruct @@ -1,4 +1,7 @@ #!/usr/bin/env python + +EnsureSConsVersion(0, 98, 1) + import os import sys import subprocess @@ -13,7 +16,7 @@ else: # Most of the settings are taken from https://github.com/BastiaanOlij/gdnative_cpp_example -opts = Variable([], ARGUMENTS) +opts = Variables([], ARGUMENTS) # Gets the standard flags CC, CCX, etc. env = DefaultEnvironment() From 44fc8eaeeab2c92fde18be93cd33e9c66a285446 Mon Sep 17 00:00:00 2001 From: Valerii Date: Mon, 7 Feb 2022 15:34:32 +1000 Subject: [PATCH 11/11] upd scons --- plugins/inappstore/register_types.cpp | 54 --------------------------- 1 file changed, 54 deletions(-) delete mode 100644 plugins/inappstore/register_types.cpp diff --git a/plugins/inappstore/register_types.cpp b/plugins/inappstore/register_types.cpp deleted file mode 100644 index 9b72a53..0000000 --- a/plugins/inappstore/register_types.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/*************************************************************************/ -/* in_app_store_module.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 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 "register_types.h" - -#include "core/version.h" - -#if VERSION_MAJOR == 4 -#include "core/config/engine.h" -#else -#include "core/engine.h" -#endif - -#include "in_app_store.h" - -InAppStore* store_kit = NULL; - -void register_inappstore_types() { - store_kit = memnew(InAppStore); - Engine::get_singleton()->add_singleton(Engine::Singleton("InAppStore", store_kit)); -} - -void unregister_inappstore_types() { - if (store_kit) { - memdelete(store_kit); - } -}