kloder-games / godot-admob

Module Admob for Godot engine
MIT License
360 stars 61 forks source link

Warrning. deprecated `can_build` signature. #118

Open Valeryn4 opened 4 years ago

Valeryn4 commented 4 years ago

OS target (Android/iOS): All

Godot version: 3.2+

Issue description:

Warning: module 'admob' uses a deprecated `can_build` signature in its config.py file, it should be `can_build(env, platform)`.
Warning: module 'share' uses a deprecated `can_build` signature in its config.py file, it should be `can_build(env, platform)`.

In all modules, obsolete functions are used. Why not fix it? It takes a few minutes.

before

def can_build(plat):
    return plat == "iphone" or plat == "android"

after

def can_build(env, platform):
    return platform == "iphone" or platform == "android"

I would also suggest modular compilation for the iPhone, and maybe this might work for the android. Further reducing compilation time and testing time. Now, if I change the modules - it takes a very long link and assembly

for example, you can take modules/arkit or modules/camera SCsub:


Import('env')
Import('env_modules')

env_my_modules = env_modules.Clone() ##create new module

if (env["platform"] == "iphone"):
   modules_sources = [] ##create array source files
   env_my_modules.add_source_files(modules_sources, "*.cpp") ##add all CPP
   env_my_modules.add_source_files(modules_sources, "ios/src/*.mm") ##add all MM

   mod_lib = env_modules.add_library('#bin/libgodot_my_module' + env['LIBSUFFIX'], #add lib
   modules_sources)

in console iphone after build

$ lipo -create bin/libgodot_my_module.iphone.opt.arm.a bin/libgodot_my_module.iphone.opt.arm64.a bin/libgodot_my_module.iphone.opt.x86.a bin/libgodot_my_module.iphone.opt.x86_64.a -output bin/libgodot_my_module.iphone.release.fat.a
$ cp bin/libgodot_my_module.iphone.release.fat.a ~/godot_template_iphone/
$ zip -r iphone_my_template.zip ~/godot_template_iphone/*

Copy file to template directory

pchasco commented 4 years ago

119 corrects this issue for Godot 3, but when building for Godot 2 the call to can_build fails the build. Essentially the Godot 2 source expects the signature can_build(platform), whereas the Godot 3 source expects can_build(env, platform). This change was applied to the 2.1.X branch also.

gumaciel commented 4 years ago

Will do that change @pchasco

gumaciel commented 4 years ago

@pchasco done, please test it