My goal is create a external library made in C/C++ which I can import in my Android Project.
I know how to import, I know how to create a library from C/C++ inside the project using JNI, Cmake, etc. But this is not my goal.
For this I'm using small steps, first with a simple library:
gmath.c
#include "gmath.h"
#if defined(__GNUC__) && __GNUC__ >= 4
#define GMATH_EXPORT __attribute__((visibility("default")))
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
#define GMATH_EXPORT __attribute__((visibility("default")))
#else
#define GMATH_EXPORT
#endif
GMATH_EXPORT unsigned gpower(unsigned n) {
return 44;
}
gmath.h
#ifndef __POWER_HPP__
#define __POWER_HPP__
/*
* return pow(2, n)
*/
#ifdef __cplusplus
extern "C"
#endif // __cplusplus
unsigned gpower(unsigned n);
#endif //__POWER_HPP__
What I'm using the create the library:
cmake
-DCMAKE_TOOLCHAIN_FILE=
/Users/vcanato/Library/Android/sdk/cmake/3.6.4111459/android.toolchain.cmake
-DCMAKE_MAKE_PROGRAM=
/Users/vcanato/Library/Android/sdk/ndk-bundle/ -DANDROID_ABI="arm64-v8a"
CMake
cmake_minimum_required(VERSION 3.4.1)
set(CMAKE_VERBOSE_MAKEFILE on)
set(CMAKE_TOOLCHAIN_FILE "/Users/vcanato/Library/Android/sdk/cmake/3.6.4111459/android.toolchain.cmake")
set(ANDROID_NDK "/Users/vcanato/Library/Android/sdk/ndk-bundle/")
add_library(gmath STATIC src/gmath.c)
set(distribution_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../distribution")
set_target_properties(gmath
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY
"${distribution_DIR}/gmath/lib/${ANDROID_ABI}")
The problem is, when I use the lipo -info libgmath.aby terminal it show a different ABI:
How can I build this external library to android using the rights parameters?
