@@ -27,10 +27,6 @@ opts.Add(PathVariable('target_path', 'The path where the lib is installed.', 'bi
2727opts .Add (EnumVariable ('plugin' , 'Plugin to build' , '' , ['' , 'arkit' , 'camera' , 'icloud' , 'gamecenter' , 'inappstore' ]))
2828opts .Add (EnumVariable ('version' , 'Godot version to target' , '' , ['' , '3.2' , '4.0' ]))
2929
30- # Local dependency paths, adapt them to your setup
31- godot_path = "godot/"
32- godot_library = "ios.fat.a"
33-
3430# Updates the environment with the option variables.
3531opts .Update (env )
3632
@@ -94,6 +90,9 @@ env.Prepend(CXXFLAGS=[
9490])
9591env .Append (LINKFLAGS = ["-arch" , env ['arch' ], '-isysroot' , sdk_path , '-F' + sdk_path ])
9692
93+ if env ['arch' ] == 'armv7' :
94+ env .Prepend (CXXFLAGS = ['-fno-aligned-allocation' ])
95+
9796if env ['version' ] == '3.2' :
9897 env .Prepend (CFLAGS = ['-std=gnu11' ])
9998 env .Prepend (CXXFLAGS = ['-DGLES_ENABLED' , '-std=gnu++14' ])
@@ -106,16 +105,22 @@ if env['version'] == '3.2':
106105 '-DPTRCALL_ENABLED' ,
107106 ])
108107 elif env ['target' ] == 'release_debug' :
109- env .Prepend (CXXFLAGS = ['-O2' , '-ftree-vectorize' , '-fomit-frame-pointer' ,
108+ env .Prepend (CXXFLAGS = ['-O2' , '-ftree-vectorize' ,
110109 '-DNDEBUG' , '-DNS_BLOCK_ASSERTIONS=1' , '-DDEBUG_ENABLED' ,
111110 '-DPTRCALL_ENABLED' ,
112111 ])
112+
113+ if env ['arch' ] != 'armv7' :
114+ env .Prepend (CXXFLAGS = ['-fomit-frame-pointer' ])
113115 else :
114116 env .Prepend (CXXFLAGS = [
115- '-O2' , '-ftree-vectorize' , '-fomit-frame-pointer' ,
117+ '-O2' , '-ftree-vectorize' ,
116118 '-DNDEBUG' , '-DNS_BLOCK_ASSERTIONS=1' ,
117119 '-DPTRCALL_ENABLED' ,
118120 ])
121+
122+ if env ['arch' ] != 'armv7' :
123+ env .Prepend (CXXFLAGS = ['-fomit-frame-pointer' ])
119124elif env ['version' ] == '4.0' :
120125 env .Prepend (CFLAGS = ['-std=gnu11' ])
121126 env .Prepend (CXXFLAGS = ['-DVULKAN_ENABLED' , '-std=gnu++17' ])
@@ -128,38 +133,44 @@ elif env['version'] == '4.0':
128133 ])
129134 elif env ['target' ] == 'release_debug' :
130135 env .Prepend (CXXFLAGS = [
131- '-O2' , '-ftree-vectorize' , '-fomit-frame-pointer' ,
136+ '-O2' , '-ftree-vectorize' ,
132137 '-DNDEBUG' , '-DNS_BLOCK_ASSERTIONS=1' , '-DDEBUG_ENABLED' ,
133138 ])
139+
140+ if env ['arch' ] != 'armv7' :
141+ env .Prepend (CXXFLAGS = ['-fomit-frame-pointer' ])
134142 else :
135143 env .Prepend (CXXFLAGS = [
136- '-O2' , '-ftree-vectorize' , '-fomit-frame-pointer' ,
144+ '-O2' , '-ftree-vectorize' ,
137145 '-DNDEBUG' , '-DNS_BLOCK_ASSERTIONS=1' ,
138146 ])
147+
148+ if env ['arch' ] != 'armv7' :
149+ env .Prepend (CXXFLAGS = ['-fomit-frame-pointer' ])
139150else :
140151 print ("No valid version to set flags for." )
141152 quit ();
142153
143154# Adding header files
144155env .Append (CPPPATH = [
145156 '.' ,
146- 'godot_headers ' ,
147- 'godot_headers /main' ,
148- 'godot_headers /core' ,
149- 'godot_headers /core/os' ,
150- 'godot_headers /core/platform' ,
151- 'godot_headers /platform/iphone' ,
152- 'godot_headers /modules' ,
153- 'godot_headers /scene' ,
154- 'godot_headers /servers' ,
155- 'godot_headers /drivers' ,
156- 'godot_headers /thirdparty' ,
157+ 'godot ' ,
158+ 'godot /main' ,
159+ 'godot /core' ,
160+ 'godot /core/os' ,
161+ 'godot /core/platform' ,
162+ 'godot /platform/iphone' ,
163+ 'godot /modules' ,
164+ 'godot /scene' ,
165+ 'godot /servers' ,
166+ 'godot /drivers' ,
167+ 'godot /thirdparty' ,
157168])
158169
159170# tweak this if you want to use different folders, or more folders, to store your source code in.
160- sources = Glob (env ['plugin' ] + '/*.cpp' )
161- sources .append (Glob (env ['plugin' ] + '/*.mm' ))
162- sources .append (Glob (env ['plugin' ] + '/*.m' ))
171+ sources = Glob ('plugins/' + env ['plugin' ] + '/*.cpp' )
172+ sources .append (Glob ('plugins/' + env ['plugin' ] + '/*.mm' ))
173+ sources .append (Glob ('plugins/' + env ['plugin' ] + '/*.m' ))
163174
164175# lib<plugin>.<arch>-<simulator|iphone>.<release|debug|release_debug>.a
165176library_platform = env ["arch" ] + "-" + ("simulator" if env ["simulator" ] else "iphone" )
0 commit comments