Skip to content

Commit e53076d

Browse files
authored
Merge pull request #36 from bruvzg/mac_rename
2 parents 458ea33 + b1fee0d commit e53076d

File tree

18 files changed

+112
-24
lines changed

18 files changed

+112
-24
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
2727
- name: Generate Headers
2828
run: |
29-
./scripts/generate_headers.sh || true
29+
./scripts/generate_headers.sh 3.x || true
3030
3131
- name: Compile Plugins
3232
run: |

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,18 @@ If you choose this option, you can skip next the step which generates Godot head
3636

3737
- To generate Godot headers, you need to run the compilation command inside the `godot` submodule directory:
3838

39+
### For Godot 3.x:
40+
3941
```bash
4042
scons platform=iphone target=debug
4143
```
4244

45+
### For Godot 4.x:
46+
47+
```bash
48+
scons platform=ios target=debug
49+
```
50+
4351
You don't have to wait for full engine compilation, as header files are generated first.
4452
Once the actual compilation starts, you can stop this command by pressing <kbd>Ctrl + C</kbd>.
4553

SConstruct

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ env.Append(CCFLAGS=[
8282
# '-Wextra',
8383
])
8484

85-
env.Append(CCFLAGS=['-arch', env['arch'], "-isysroot", "$IPHONESDK", "-stdlib=libc++", '-isysroot', sdk_path])
85+
env.Append(CCFLAGS=['-arch', env['arch'], "-isysroot", "$IOS_SDK_PATH", "-stdlib=libc++", '-isysroot', sdk_path])
8686
env.Append(CCFLAGS=['-DPTRCALL_ENABLED'])
8787
env.Prepend(CXXFLAGS=[
8888
'-DNEED_LONG_INT', '-DLIBYUV_DISABLE_NEON',
89-
'-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DCOREAUDIO_ENABLED'
89+
'-DIOS_ENABLED', '-DUNIX_ENABLED', '-DCOREAUDIO_ENABLED'
9090
])
9191
env.Append(LINKFLAGS=["-arch", env['arch'], '-isysroot', sdk_path, '-F' + sdk_path])
9292

@@ -152,19 +152,26 @@ else:
152152
quit();
153153

154154
# Adding header files
155-
env.Append(CPPPATH=[
156-
'.',
157-
'godot',
158-
'godot/platform/iphone',
159-
])
155+
if env['version'] == '3.x':
156+
env.Append(CPPPATH=[
157+
'.',
158+
'godot',
159+
'godot/platform/iphone',
160+
])
161+
else:
162+
env.Append(CPPPATH=[
163+
'.',
164+
'godot',
165+
'godot/platform/ios',
166+
])
160167

161168
# tweak this if you want to use different folders, or more folders, to store your source code in.
162169
sources = Glob('plugins/' + env['plugin'] + '/*.cpp')
163170
sources.append(Glob('plugins/' + env['plugin'] + '/*.mm'))
164171
sources.append(Glob('plugins/' + env['plugin'] + '/*.m'))
165172

166-
# lib<plugin>.<arch>-<simulator|iphone>.<release|debug|release_debug>.a
167-
library_platform = env["arch"] + "-" + ("simulator" if env["simulator"] else "iphone")
173+
# lib<plugin>.<arch>-<simulator|ios>.<release|debug|release_debug>.a
174+
library_platform = env["arch"] + "-" + ("simulator" if env["simulator"] else "ios")
168175
library_name = env['plugin'] + "." + library_platform + "." + env["target"] + ".a"
169176
library = env.StaticLibrary(target=env['target_path'] + library_name, source=sources)
170177

plugins/apn/apn.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@
3131
#ifndef godot_apn_implementation_h
3232
#define godot_apn_implementation_h
3333

34+
#include "core/version.h"
35+
36+
#if VERSION_MAJOR == 4
37+
#include "core/object/class_db.h"
38+
#else
3439
#include "core/object.h"
40+
#endif
3541

3642
class APNPlugin : public Object {
3743
GDCLASS(APNPlugin, Object);

plugins/apn/apn.mm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,13 @@
3232

3333
#import <Foundation/Foundation.h>
3434

35+
#if VERSION_MAJOR == 4
36+
#include "core/object/class_db.h"
37+
#include "core/config/project_settings.h"
38+
#else
3539
#include "core/class_db.h"
3640
#include "core/project_settings.h"
41+
#endif
3742

3843
#import "godot_apn_delegate.h"
3944

plugins/apn/apn_plugin.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@
3131
#import "apn_plugin.h"
3232
#import "apn.h"
3333

34+
#if VERSION_MAJOR == 4
35+
#import "core/config/engine.h"
36+
#else
3437
#import "core/engine.h"
38+
#endif
3539

3640
APNPlugin *plugin;
3741

plugins/apn/godot_apn_delegate.mm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@
3333
#include "apn.h"
3434

3535
#import "godot_user_notification_delegate.h"
36+
37+
#if VERSION_MAJOR == 4
38+
#import "platform/ios/godot_app_delegate.h"
39+
#else
3640
#import "platform/iphone/godot_app_delegate.h"
41+
#endif
3742

3843
struct APNSInitializer {
3944

plugins/apn/godot_app_delegate_extension.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@
2828
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
2929
/*************************************************************************/
3030

31+
#include "core/version.h"
32+
33+
#if VERSION_MAJOR == 4
34+
#import "platform/ios/godot_app_delegate.h"
35+
#else
3136
#import "platform/iphone/godot_app_delegate.h"
37+
#endif
3238

3339
@interface GodotApplicalitionDelegate (PushNotifications)
3440

plugins/arkit/arkit_interface.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ typedef PoolVector<uint8_t> GodotUInt8Vector;
6060
/**
6161
@author Bastiaan Olij <[email protected]>
6262
63-
ARKit interface between iPhone and Godot
63+
ARKit interface between iOS and Godot
6464
*/
6565

6666
// forward declaration for some needed objects
@@ -142,7 +142,7 @@ class ARKitInterface : public GodotBaseARInterface {
142142

143143
virtual void process() GODOT_ARKIT_OVERRIDE;
144144

145-
// called by delegate (void * because C++ and Obj-C don't always mix, should really change all platform/iphone/*.cpp files to .mm)
145+
// called by delegate (void * because C++ and Obj-C don't always mix, should really change all platform/ios/*.cpp files to .mm)
146146
void _add_or_update_anchor(GodotARAnchor *p_anchor);
147147
void _remove_anchor(GodotARAnchor *p_anchor);
148148

plugins/camera/camera_ios.mm

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
2929
/*************************************************************************/
3030

31-
///@TODO this is a near duplicate of CameraOSX, we should find a way to combine those to minimize code duplication!!!!
31+
///@TODO this is a near duplicate of CameraMacOS, we should find a way to combine those to minimize code duplication!!!!
3232
// If you fix something here, make sure you fix it there as wel!
3333

3434
#include "camera_ios.h"
@@ -182,12 +182,12 @@ - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CM
182182
#if VERSION_MAJOR == 4
183183
uint8_t *w = img_data[0].ptrw();
184184
memcpy(w, dataY, new_width * new_height);
185+
img[0].instantiate();
185186
#else
186187
GodotUInt8Vector::Write w = img_data[0].write();
187188
memcpy(w.ptr(), dataY, new_width * new_height);
188-
#endif
189-
190189
img[0].instance();
190+
#endif
191191
img[0]->create(new_width, new_height, 0, Image::FORMAT_R8, img_data[0]);
192192
}
193193

@@ -205,13 +205,14 @@ - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CM
205205
#if VERSION_MAJOR == 4
206206
uint8_t *w = img_data[1].ptrw();
207207
memcpy(w, dataCbCr, 2 * new_width * new_height);
208+
img[1].instantiate();
208209
#else
209210
GodotUInt8Vector::Write w = img_data[1].write();
210211
memcpy(w.ptr(), dataCbCr, 2 * new_width * new_height);
212+
img[1].instance();
211213
#endif
212214

213215
///TODO GLES2 doesn't support FORMAT_RG8, need to do some form of conversion
214-
img[1].instance();
215216
img[1]->create(new_width, new_height, 0, Image::FORMAT_RG8, img_data[1]);
216217
}
217218

@@ -358,7 +359,7 @@ - (void)dealloc {
358359
MyDeviceNotifications *device_notifications = nil;
359360

360361
//////////////////////////////////////////////////////////////////////////
361-
// CameraIOS - Subclass for our camera server on iPhone
362+
// CameraIOS - Subclass for our camera server on iOS
362363

363364
void CameraIOS::update_feeds() {
364365
// this way of doing things is deprecated but still works,
@@ -410,7 +411,11 @@ - (void)dealloc {
410411

411412
if (!found) {
412413
Ref<CameraFeedIOS> newfeed;
414+
#if VERSION_MAJOR == 4
415+
newfeed.instantiate();
416+
#else
413417
newfeed.instance();
418+
#endif
414419
newfeed->set_device(device);
415420
add_feed(newfeed);
416421
}

0 commit comments

Comments
 (0)