TMSDK native部分的组成和native函数梳理


native主so的编译方式

主so位于jni_branchs/tcc_main_2.0.5目录下编译的脚本为jni_branchs/tcc_main_2.0.5/tcc/makefile/Android/ndk-build-tms2.bat 在使用该脚本前,要先根据自己NDK的安装配置下

@echo off
set NDK_BUILD=D:\android-ndk-r10c\ndk-build '根据自己NDK的安装路径修改
call %NDK_BUILD% -B -j4 NDK_APPLICATION_MK=jni-tms2/Application.mk
pause

修改so编译出的版本号,jni_branchs/tcc_main_2.0.5/tcc/makefile/Android/jni-tms2/Tmsdk2.mk

## n 合 1 SDK ##
include $(CLEAR_VARS)

ifeq ($(SDK_USE_CLASSIC_INTERFACE),true)
LOCAL_MODULE := Tmsdk-classic-2.0.4
else
LOCAL_MODULE := Tmsdk-2.0.7-mfr
endif

LOCAL_PATH := $(TCC_PATH)/src/jni-tms2

LOCAL_CFLAGS := $(GLOBAL_CFLAGS)

LOCAL_C_INCLUDES := $(GLOBAL_INCLUDES)

修改对应编译so的ABI jni_branchs/tcc_main_2.0.5/tcc/makefile/Android/jni-tms2/Application.mk

APP_PLATFORM := android-21
APP_BUILD_SCRIPT:=jni-tms2/Android.mk

##APP_ABI := armeabi armeabi-v7a x86
APP_ABI := armeabi
## APP_ABI := armeabi-v7a
## APP_ABI := x86
## APP_ABI := arm64-v8a

## 不用ndk自带的stlport了,自己的在tcc/extension/stlport
## APP_STL      := stlport_static

编译过程

具体的编译过程是在jni_branchs/tcc_main_2.0.5/tcc/makefile/Android/jni-tms2/Android.mk文件里控制的。主要部分如下:

MK_PATH:=$(abspath $(call my-dir))

include $(MK_PATH)/Config.mk

############# stlport #############
ifeq ($(USE_PREBUILT_STLPORT),true)
include $(STLPORT_PATH)/prebuilt/stlport_prebuilt.mk
else
include $(STLPORT_PATH)/Android.mk
endif

############# basic static modules #############
include $(MK_PATH)/TccJniCommon.mk
include $(MK_PATH)/Tcc.mk
##include $(MK_PATH)/zlib_static.mk
include $(MK_PATH)/bzip2.mk
include $(MK_PATH)/bspatch.mk

############# static modules #############
##include $(MK_PATH)/IPDialer_static.mk
include $(MK_PATH)/SmsChecker_static.mk
include $(MK_PATH)/TrafficSmsParser_static.mk
include $(MK_PATH)/NumberMarker_static.mk
include $(MK_PATH)/TelNumberLocator_static.mk
include $(MK_PATH)/TccDiff_static.mk
## TMSDK厂商合作不要以下功能,无需编译静态库
## include $(MK_PATH)/Sync_static.mk
## include $(MK_PATH)/PinYin_static.mk

############# shared modules #############
ifeq ($(SDK_ALL_IN_ONE),true)
include $(MK_PATH)/Tmsdk2.mk
else
include $(MK_PATH)/NativeInterface.mk
include $(MK_PATH)/TccCryptor.mk
include $(MK_PATH)/SmsChecker.mk
include $(MK_PATH)/TrafficSmsParser.mk
include $(MK_PATH)/NumberMarker.mk
#include $(MK_PATH)/LoginUtil.mk
#include $(MK_PATH)/PinyinMatch.mk
include $(MK_PATH)/TelNumberLocator.mk
endif
## libSync.so 暂时不是 TMSDK 的一部分
## include $(MK_PATH)/Sync.mk



Copyright © FengGuangtu 2017