Use the "standalone toolchain" - this is a tool to reuse generic makefiles for Android. It is well described in the docs that you installed with the NDK.
Using C library in Android NDK with external dependency
-
30-05-2022 - |
Question
I have an OCR library written in C that I wish to run on Android using the Native Development Kit (NDK). I am an experienced Android developer, but not with the NDK (or C for that matter). I have set-up numerous hello world sample programs, and now I think that the first question I need to answer is:
The OCR library requires another dependency in the makefile: libtiff, which provides support for .TIFF image files. How can I add this dependency to the project and represent it in an Android.mk file? Can anyone link to any similar examples?
Here is some code from the OCR makefile:
TIFF = {your_tiff_path}/libtiff.a
INCLUDES= {your_tiff_path}/include
DEFS = -DDO_USE_32BIT -DLUT_POPCNT -DTIFF_FORMAT
OPT = -O3
CFLAGS = $(OPT) -g $(INCLUDES) $(PROFILE) $(DEFS)
# Add -m32 to build 32bit on 64bit machine
CC = gcc -m32
LDFLAGS = $(OPT) $(PROFILE)
OBJECTS = cputime.o BitArr.o bits.o chardat.o symbol.o page.o get_skew.o \
ccrx.o readtiff.o label.o glyph.o loadcontrols.o loadbestfont.o \
qsegment.o makeBnodes.o makeLnodes.o runocr.o lineocr.o extract.o \
splitchars.o compare.o scoreit.o lm_class.o lmdp.o \
ocrfont.o glyphsubs.o binio.o ocrmain.o unicode.o
TARGET = ccr8
$(TARGET): $(OBJECTS)
$(CC) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(TIFF) -lm -lc
label.o: label.c page.h CCR.h BitArr.h bits.h
...
...
...
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow