On Tuesday, 31 December 2019 at 03:59:58 UTC, Adam D. Ruppe wrote:
On Wednesday, 18 December 2019 at 15:53:14 UTC, kinke wrote:
Heh, it looks like the Wiki page (https://wiki.dlang.org/Cross-compiling_with_LDC - I've added an exemplary Android section there as well, using `-gcc` to specify the NDK's preconfigured clang) needs some overhaul then if not even you guys seem to find the relevant information.


Well, I worked this into my setup program. It changes ldc2.conf so then you can just

        dub build --compiler=ldc2 -a i386-none-linux-android
@mv libdubtest.so BasicActivity/app/src/main/jniLibs/x86 || true
        #
        dub build --compiler=ldc2 -a armv7a-none-linux-android
@mv libdubtest.so BasicActivity/app/src/main/jniLibs/armeabi-v7a || true
        #
        dub build --compiler=ldc2 -a x86_64-none-linux-android
@mv libdubtest.so BasicActivity/app/src/main/jniLibs/x86_64 || true
        #
        dub build --compiler=ldc2 -a aarch64-none-linux-android
@mv libdubtest.so BasicActivity/app/src/main/jniLibs/arm64-v8a || true

I really wish dub had a way to specify the output directory on its command line which would eliminate the need for those ugly mv commands :(

but meh now it works without the helper programs - just a setup step.



Meanwhile, I wrote a class/jar -> D interface converter and it works beautifully. Alas, dmd is giving me "forward reference" errors in there :(

so the crtp trick is triggering a bunch of internal compiler bugs.

ugh.

I have to check in detail if I can find some free time, but maybe in dub.json of d_android a postGenerateCommands line could be defined which calls a dub single package responsible for copying the binary to the right place depending on the actual architecture.

"preGenerateCommands": ["$DUB copy.d"]

Inside of the coding of copy.d all needed information can be retrieved from environment variables (see list of environment variables here https://dub.pm/package-format-json.html#environment-variables).

Kind regards
Andre

Reply via email to