Has anyone had any luck compiling source without copying it into the
NDK directory structure? We have an established body of source with
its own directory structure, and copying it into the Android setup is
going to be a real pain. I'd be very grateful for any pointers, or
warnings of pitfalls that are going to bite me.
Thanks!
paul.butcher->msgCount++
Sorry - upon rereading this, I realise that I wasn't as clear as I
might be. I know that I can symlink instead of copy. What I'm
wondering is whether anyone has had any luck compiling something which
is outside of the NDK structure entirely?
Thanks!
paul.butcher->msgCount++
I'm in the same situation as you. None of my source is in the NDK
structure because it exists already on my HD for other platforms and
would be a nightmare to move. I put their makefile into Verbose mode
and copied the flags that the NDK sets up and then I wrote my own
makefile. I did that because I wanted complete control over the
compiler/linker but if you just want to have your structure live
elsewhere, that's simple. Just put a file called Application.mk in the
NDK/Apps/YourApp folder and have it point to your source path by
adding these 2 lines:
APP_PROJECT_PATH := $(call my-dir)/Path/To/Your/Source
APP_MODULES := name_of_your_module
There's more information about how to do this in the NDK docs folder
on your hard drive.
Hope that helps,
Chris
$NDKROOT/build/prebuilt/darwin-x86/arm-eabi-4.2.1/bin/arm-eabi-gcc \
--sysroot $NDKROOT/build/platforms/android-3/arch-arm -fPIC -mandroid
-g -O2 \
-DNDEBUG -Wall -c /path/to/my/source.c -o /path/to/my/obj.o
$NDKROOT/build/prebuilt/darwin-x86/arm-eabi-4.2.1/bin/arm-eabi-gcc
-nostdlib \
-Wl,-shared,-Bsymbolic -Wl,--no-undefined -Wl,-z,defs \
$NDKROOT/build/platforms/android-3/arch-arm/usr/lib/libc.so \
$NDKROOT/build/platforms/android-3/arch-arm/usr/lib/libstdc++.so \
$NDKROOT/build/platforms/android-3/arch-arm/usr/lib/libm.so \
-L$NDKROOT/build/platforms/android-3/arch-arm/usr/lib \
-Wl,-rpath-link=$NDKROOT/build/platforms/android-3/arch-arm/usr/lib \
$NDKROOT/build/prebuilt/darwin-x86/arm-eabi-4.2.1/lib/gcc/arm-eabi/4.2.1/interwork/libgcc.a
\
-shared -fPIC -o /path/to/my/lib.so /path/to/my/obj.o
Note that's not supported by android team and therefore official
makefiles could be changed in the future (new options could be
added/removed) without notification so you'll need to monitor situation
on your own.
Dmitry Moskalchuk
Many thanks for your replies - that's exactly what I was looking for.
I'll have a play and see how I get on.
Thanks again,
paul.butcher->msgCount++