cryptopp/extras/jni/README.md

56 lines
1.6 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

Android NDK build files
=======================
## Building independent library
CryptoPP library can be independently built using just one command:
cd <cryptopp-folder>
ndk-build NDK_PROJECT_PATH=`pwd`/extras
This will build shared library `libcryptopp_shared.so` in `extras/libs/`, static library `libcryptopp_static.a` in `extras/obj/`, and `cryptest.exe` binary.
## Integrate CryptoPP into application
It is also possible to integrate CryptoPP into applications build process.
For example, if application source has the following structure:
├── AndroidManifest.xml
├── java
│   ├── ...
│   └── ...
├── jni
│   ├── Android.mk
│   └── Application.mk
└── res
   ├── ...
   └── ...
- Copy CryptoPP source code (or create git submodule) in `jni/cryptopp`.
- In application's `Android.mk` add the desired version of the library.
For shared version:
LOCAL_PATH := $(call my-dir)
LOCAL_PATH_SAVED := $(LOCAL_PATH)
include $(CLEAR_VARS)
LOCAL_MODULE := my-local-module
LOCAL_SHARED_LIBRARIES := cryptopp_shared ...
include $(BUILD_SHARED_LIBRARY)
include $(LOCAL_PATH_SAVED)/cryptopp/extras/jni/cryptopp-shared.mk
For static version:
LOCAL_PATH := $(call my-dir)
LOCAL_PATH_SAVED := $(LOCAL_PATH)
include $(CLEAR_VARS)
LOCAL_MODULE := my-local-module
LOCAL_STATIC_LIBRARIES := cryptopp_static ...
include $(BUILD_SHARED_LIBRARY)
include $(LOCAL_PATH_SAVED)/cryptopp/extras/jni/cryptopp-static.mk