godotengine / godot-ios-plugins

MIT License
126 stars 48 forks source link

How to check if its exporting for `release_debug` or `debug` by the code #23

Closed gumaciel closed 2 years ago

gumaciel commented 2 years ago

Hi, I was wondering if there was any way to check if you're exporting to release_debug or just release, directly from the code, so I could create specific conditions for whether it's release_debug or release

Something like this: https://docs.microsoft.com/en-us/cpp/preprocessor/hash-if-hash-elif-hash-else-and-hash-endif-directives-c-cpp?view=msvc-160#preprocessor-operators

gumaciel commented 2 years ago

Created a proposal here but don't know for sure if already exists for Android/iOS:

https://github.com/godotengine/godot-proposals/issues/3174

naithar commented 2 years ago

You should be able to use Godot's release/debug feature from GDScript with OS.has_feature.

gumaciel commented 2 years ago

Thank you! this should work, but theres no way to do that directly on the plugin? If not, it's ok

naithar commented 2 years ago

It should work the same way it does with Godot's source, since plugins are using same compilation flags: https://github.com/godotengine/godot/blob/8f7f5846397297fff6e8a08f89bc60ce658699cc/platform/osx/godot_main_osx.mm#L53-L58

DEBUG_ENABLED flag is defined for both debug and release_debug, so you can use it. You can also define your own flags to separate functionality between specific version of plugin: https://github.com/godotengine/godot-ios-plugins/blob/master/SConstruct#L100-L120

gumaciel commented 2 years ago

Thank you!