Skip to content

Instantly share code, notes, and snippets.

@ultimateprogramer
Last active December 18, 2023 17:59
Show Gist options
  • Select an option

  • Save ultimateprogramer/5aead76ef0a38c2db76ee71ae37ec309 to your computer and use it in GitHub Desktop.

Select an option

Save ultimateprogramer/5aead76ef0a38c2db76ee71ae37ec309 to your computer and use it in GitHub Desktop.
Multiple Defold Build Targets

One way of doing this is to build using the command line tool and change your project dependencies depending on which platform/portal you are building for.

You can have project setting "stub" files, like this:

poki.settings configuration:

[project]
dependencies#0 = https://github.com/defold/extension-poki-sdk/archive/refs/tags/1.4.3.zip

Building:

# build for poki
java -jar bob.jar --settings=poki.properties --platform=js-web --archive build bundle

# build for another platform
java -jar bob.jar --settings=another_platform.properties --platform=js-web --archive build bundle

This will then replace the fields you have in your main game.project file with the fields from the "stub" file you are using. And then in your code you have a wrapper or check which SDK is present and call the appropriate functions.

if poki_sdk then
    poki_sdk.gameplay_start()
elseif my_other_sdk then
    my_other_sdk.start()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment