elixir-sqlite / exqlite

An SQLite3 driver for Elixir
https://hexdocs.pm/exqlite
MIT License
217 stars 48 forks source link

Support Android compilation #164

Closed dominicletz closed 3 years ago

dominicletz commented 3 years ago

Hey Guys

I'm using your SQLite nif for my android project https://github.com/elixir-desktop/android-example-app but found that for Android I need to link the nif explicitly again libm so I added that under the $crosscompile variable when set to 'android'

Additionally, I've added -Os to optimize the binary for size and -z global though that will not always be needed.

I'm not sure on the reuse of $crosscompile since I don't know for what use case you intended it, alternatively I was thinking of using the mix std environment variable MIX_TARGET e.g. such as in: ifeq ($(MIX_TARGET), Android)

warmwaffles commented 3 years ago

This would be cool if you could also add it to the https://github.com/elixir-sqlite/exqlite/blob/main/.github/workflows/ci.yml as well

warmwaffles commented 3 years ago

163 is adding the windows CI so it could be possible that we shim this in on top of that after we get it merged.

dominicletz commented 3 years ago

I don't think GitHub supports running Android code, does it? This issue only appears in runtime.

warmwaffles commented 3 years ago

@dominicletz I don't see why it couldn't. I'll explore adding it to the CI workflow. But for now can you confirm if this actually builds and works in your android environment? I have no ability to test this locally at the moment.

dominicletz commented 3 years ago

Yep it works, it's running on my phone right now

warmwaffles commented 3 years ago

@dominicletz this has been deployed in v0.7.2