From 806b994263369d28941aa1495a0a3b54d5249cd5 Mon Sep 17 00:00:00 2001 From: Tim Kourt Date: Thu, 13 Aug 2015 12:35:30 -0700 Subject: [PATCH] Enabled x86_64 build for Android. Change-Id: Iaf4384cc4a1c3ec35ec00b3b0b88b19f5c73609c Signed-off-by: Tim Kourt Reviewed-on: https://gerrit.iotivity.org/gerrit/2201 Reviewed-by: Erich Keane Tested-by: jenkins-iotivity Reviewed-by: Jon A. Cruz --- android/BuildInstructionsForAndroidAPI.txt | 5 +-- auto_build.sh | 5 +++ build_common/android/compatibility/c_compat.c | 13 ------- resource/third_party_libs.scons | 4 +- .../org/iotivity/service/ssm/DataReader.java | 4 +- .../org/iotivity/service/ssm/ModelData.java | 6 +-- .../org/iotivity/service/ssm/QueryEngine.java | 8 ++-- .../SSMCore/src/SSMInterface/SSMCore_JNI.cpp | 38 ++++++++++--------- .../SSMCore/src/SSMInterface/SSMCore_JNI.h | 22 +++++------ service/third_party_libs.scons | 4 +- 10 files changed, 52 insertions(+), 57 deletions(-) diff --git a/android/BuildInstructionsForAndroidAPI.txt b/android/BuildInstructionsForAndroidAPI.txt index 1b0f239e1..a30df4202 100644 --- a/android/BuildInstructionsForAndroidAPI.txt +++ b/android/BuildInstructionsForAndroidAPI.txt @@ -10,11 +10,10 @@ Build Instructions for Android-API: def ndkBuild = new File(System.env.ANDROID_NDK_HOME, 'ndk-build.cmd') 4.Build scons for android and your targeted architecture (This will also build Android API): - a.scons TARGET_OS=android TARGET_ARCH= TARGET_TRANSPORT=IP RELEASE=1 - where can be armeabi, armeabi-v7a, x86. + a.scons TARGET_OS=android TARGET_ARCH= TARGET_TRANSPORT= RELEASE=1 + where can be armeabi, armeabi-v7a, x86, x86_64. Note: To build in debug mode, use RELEASE=0. Note: The minimum SDK version supported is 21. - Note: Only TARGET_TRANSPORT currently supported is IP b.If the project is setup correctly, you should see a BUILD SUCCESSFUL message on the terminal c.You should see the .aar files generated inside of '/android/android_api/base/build/outputs/aar' directory. The .aar files contain jni directory and also a .jar file diff --git a/auto_build.sh b/auto_build.sh index 806bf6a33..750f641ab 100755 --- a/auto_build.sh +++ b/auto_build.sh @@ -72,6 +72,11 @@ function build_android() scons TARGET_OS=android TARGET_ARCH=x86 RELEASE=$1 TARGET_TRANSPORT=BT $2 scons TARGET_OS=android TARGET_ARCH=x86 RELEASE=$1 TARGET_TRANSPORT=BLE $2 + echo "*********** Build for android x86_64 *************" + scons TARGET_OS=android TARGET_ARCH=x86_64 RELEASE=$1 TARGET_TRANSPORT=IP $2 + scons TARGET_OS=android TARGET_ARCH=x86_64 RELEASE=$1 TARGET_TRANSPORT=BT $2 + scons TARGET_OS=android TARGET_ARCH=x86_64 RELEASE=$1 TARGET_TRANSPORT=BLE $2 + echo "*********** Build for android armeabi *************" scons TARGET_OS=android TARGET_ARCH=armeabi RELEASE=$1 TARGET_TRANSPORT=IP $2 scons TARGET_OS=android TARGET_ARCH=armeabi RELEASE=$1 TARGET_TRANSPORT=BT $2 diff --git a/build_common/android/compatibility/c_compat.c b/build_common/android/compatibility/c_compat.c index 000428a77..b76c73953 100644 --- a/build_common/android/compatibility/c_compat.c +++ b/build_common/android/compatibility/c_compat.c @@ -45,16 +45,3 @@ void srandom(unsigned int __s) { srand48(__s); } - -/* from unistd.h */ -int getpagesize(void) -{ - extern unsigned int __page_size; - return __page_size; -} - -int __getpageshift(void) -{ - extern unsigned int __page_shift; - return __page_shift; -} diff --git a/resource/third_party_libs.scons b/resource/third_party_libs.scons index 46b80bd9b..bac4cfb2a 100644 --- a/resource/third_party_libs.scons +++ b/resource/third_party_libs.scons @@ -57,11 +57,11 @@ if target_os == 'android': if target_arch == 'armeabi-v7a-hard': target_arch = 'armeabi-v7a' - if target_arch not in ['x86', 'armeabi', 'armeabi-v7a']: + if target_arch not in ['x86', 'x86_64','armeabi', 'armeabi-v7a']: if not env.GetOption('help') and not env.GetOption('clean'): print ''' *********************************** Warning *********************************** -* current only x86, armeabi, armeabi-v7a libraries are provided! * +* current only x86, x86_64, armeabi, armeabi-v7a libraries are provided! * ******************************************************************************* ''' else: diff --git a/service/soft-sensor-manager/SDK/java/org/iotivity/service/ssm/DataReader.java b/service/soft-sensor-manager/SDK/java/org/iotivity/service/ssm/DataReader.java index 267985095..21717539b 100644 --- a/service/soft-sensor-manager/SDK/java/org/iotivity/service/ssm/DataReader.java +++ b/service/soft-sensor-manager/SDK/java/org/iotivity/service/ssm/DataReader.java @@ -37,9 +37,9 @@ import java.util.List; public class DataReader { - private int pDataReaderInstance; + private long pDataReaderInstance; - public DataReader(int dataReaderInstance) + private DataReader(long dataReaderInstance) { pDataReaderInstance = dataReaderInstance; } diff --git a/service/soft-sensor-manager/SDK/java/org/iotivity/service/ssm/ModelData.java b/service/soft-sensor-manager/SDK/java/org/iotivity/service/ssm/ModelData.java index c276f8326..fc408da95 100644 --- a/service/soft-sensor-manager/SDK/java/org/iotivity/service/ssm/ModelData.java +++ b/service/soft-sensor-manager/SDK/java/org/iotivity/service/ssm/ModelData.java @@ -36,9 +36,9 @@ package org.iotivity.service.ssm; public class ModelData { - private int pIModelDataInstance; + private long pIModelDataInstance; - public ModelData(int iModelDataInstance) + private ModelData(long iModelDataInstance) { pIModelDataInstance = iModelDataInstance; } @@ -97,4 +97,4 @@ public class ModelData return CoreController.getInstance().getPropertyValue( pIModelDataInstance, propertyIndex); } -} \ No newline at end of file +} diff --git a/service/soft-sensor-manager/SDK/java/org/iotivity/service/ssm/QueryEngine.java b/service/soft-sensor-manager/SDK/java/org/iotivity/service/ssm/QueryEngine.java index 348e51d71..8acc1a9bc 100644 --- a/service/soft-sensor-manager/SDK/java/org/iotivity/service/ssm/QueryEngine.java +++ b/service/soft-sensor-manager/SDK/java/org/iotivity/service/ssm/QueryEngine.java @@ -36,9 +36,9 @@ package org.iotivity.service.ssm; */ public class QueryEngine { - private int pQueryEngineInstance; + private long pQueryEngineInstance; - public QueryEngine(int queryEngineInstance) + private QueryEngine(long queryEngineInstance) { pQueryEngineInstance = queryEngineInstance; } @@ -50,7 +50,7 @@ public class QueryEngine * @return int - Instance of the query engine object, set on object's creation * */ - public int getQueryEngineInstance() + public long getQueryEngineInstance() { return pQueryEngineInstance; } @@ -100,4 +100,4 @@ public class QueryEngine CoreController.getInstance().killContextQuery(pQueryEngineInstance, cqid); } -} \ No newline at end of file +} diff --git a/service/soft-sensor-manager/SSMCore/src/SSMInterface/SSMCore_JNI.cpp b/service/soft-sensor-manager/SSMCore/src/SSMInterface/SSMCore_JNI.cpp index f088ed2ae..05ec0d6de 100644 --- a/service/soft-sensor-manager/SSMCore/src/SSMInterface/SSMCore_JNI.cpp +++ b/service/soft-sensor-manager/SSMCore/src/SSMInterface/SSMCore_JNI.cpp @@ -109,14 +109,18 @@ class QueryEngineEventReceiver env->GetMethodID(g_ClassQueryEngineEvent, "onQueryEngineEvent", "(ILorg/iotivity/service/ssm/DataReader;)V"); - jmethodID cid_DataReader = env->GetMethodID(g_ClassDataReader, "", "(I)V"); + jmethodID cid_DataReader = env->GetMethodID(g_ClassDataReader, "", "(J)V"); if (cid_DataReader == NULL) return SSM_E_FAIL; - env->CallVoidMethod(m_objQueryEngineEvent, midQueryEngineEvent, + env->CallVoidMethod(m_objQueryEngineEvent, + midQueryEngineEvent, (jint)cqid, - env->NewObject(g_ClassDataReader, cid_DataReader, (jint)pResult)); + env->NewObject( + g_ClassDataReader, + cid_DataReader, + reinterpret_cast(pResult))); DETACH_CURRENT_THREAD(g_JVM); @@ -240,12 +244,12 @@ JNIEXPORT jobject JNICALL Java_org_iotivity_service_ssm_CoreController_createQue return NULL; } - jmethodID cid_QueryEngine = env->GetMethodID(g_ClassQueryEngine, "", "(I)V"); + jmethodID cid_QueryEngine = env->GetMethodID(g_ClassQueryEngine, "", "(J)V"); if (cid_QueryEngine == NULL) return NULL; - return env->NewObject(g_ClassQueryEngine, cid_QueryEngine, (jint)pQueryEngine); + return env->NewObject(g_ClassQueryEngine, cid_QueryEngine, reinterpret_cast(pQueryEngine)); } JNIEXPORT jint JNICALL Java_org_iotivity_service_ssm_CoreController_releaseQueryEngine @@ -265,7 +269,7 @@ JNIEXPORT jint JNICALL Java_org_iotivity_service_ssm_CoreController_releaseQuery } JNIEXPORT jint JNICALL Java_org_iotivity_service_ssm_CoreController_executeContextQuery -(JNIEnv *env, jclass clz, jint pQueryEngineInstance, jstring jstrContextQuery) +(JNIEnv *env, jclass clz, jlong pQueryEngineInstance, jstring jstrContextQuery) { int cqid = -1; if (jstrContextQuery == NULL) @@ -289,7 +293,7 @@ JNIEXPORT jint JNICALL Java_org_iotivity_service_ssm_CoreController_executeConte } JNIEXPORT void JNICALL Java_org_iotivity_service_ssm_CoreController_registerQueryEvent -(JNIEnv *env, jclass clz, jint pQueryEngineInstance, jobject queryEngineEvent) +(JNIEnv *env, jclass clz, jlong pQueryEngineInstance, jobject queryEngineEvent) { IQueryEngine *pQueryEngine = (IQueryEngine *)pQueryEngineInstance; @@ -304,7 +308,7 @@ JNIEXPORT void JNICALL Java_org_iotivity_service_ssm_CoreController_registerQuer } JNIEXPORT void JNICALL Java_org_iotivity_service_ssm_CoreController_killContextQuery -(JNIEnv *env, jclass clz, jint pQueryEngineInstance, jint cqid) +(JNIEnv *env, jclass clz, jlong pQueryEngineInstance, jint cqid) { IQueryEngine *pQueryEngine = (IQueryEngine *)pQueryEngineInstance; @@ -315,7 +319,7 @@ JNIEXPORT void JNICALL Java_org_iotivity_service_ssm_CoreController_killContextQ } JNIEXPORT jint JNICALL Java_org_iotivity_service_ssm_CoreController_getDataId -(JNIEnv *env, jclass clz, jint pDataReaderInstance) +(JNIEnv *env, jclass clz, jlong pDataReaderInstance) { IModelData *pDataReader = (IModelData *)pDataReaderInstance; @@ -323,7 +327,7 @@ JNIEXPORT jint JNICALL Java_org_iotivity_service_ssm_CoreController_getDataId } JNIEXPORT jint JNICALL Java_org_iotivity_service_ssm_CoreController_getPropertyCount -(JNIEnv *env, jclass clz, jint pIModelDataInstance ) +(JNIEnv *env, jclass clz, jlong pIModelDataInstance ) { IModelData *pModelData = (IModelData *)pIModelDataInstance; @@ -331,7 +335,7 @@ JNIEXPORT jint JNICALL Java_org_iotivity_service_ssm_CoreController_getPropertyC } JNIEXPORT jstring JNICALL Java_org_iotivity_service_ssm_CoreController_getPropertyName -(JNIEnv *env, jclass clz, jint pIModelDataInstance, jint propertyIndex ) +(JNIEnv *env, jclass clz, jlong pIModelDataInstance, jint propertyIndex ) { IModelData *pModelData = (IModelData *)pIModelDataInstance; @@ -339,7 +343,7 @@ JNIEXPORT jstring JNICALL Java_org_iotivity_service_ssm_CoreController_getProper } JNIEXPORT jstring JNICALL Java_org_iotivity_service_ssm_CoreController_getPropertyValue -(JNIEnv *env, jclass clz, jint pIModelDataInstance, jint propertyIndex ) +(JNIEnv *env, jclass clz, jlong pIModelDataInstance, jint propertyIndex ) { IModelData *pModelData = (IModelData *)pIModelDataInstance; @@ -347,7 +351,7 @@ JNIEXPORT jstring JNICALL Java_org_iotivity_service_ssm_CoreController_getProper } JNIEXPORT jobject JNICALL Java_org_iotivity_service_ssm_CoreController_getAffectedModels -(JNIEnv *env, jclass clz, jint pDataReaderInstance) +(JNIEnv *env, jclass clz, jlong pDataReaderInstance) { IDataReader *pDataReader = (IDataReader *)pDataReaderInstance; std::vector affectedModels; @@ -372,7 +376,7 @@ JNIEXPORT jobject JNICALL Java_org_iotivity_service_ssm_CoreController_getAffect } JNIEXPORT jint JNICALL Java_org_iotivity_service_ssm_CoreController_getModelDataCount -(JNIEnv *env, jclass clz, jint pDataReaderInstance, jstring jstrModelName) +(JNIEnv *env, jclass clz, jlong pDataReaderInstance, jstring jstrModelName) { IDataReader *pDataReader = (IDataReader *)pDataReaderInstance; int modelCount = 0; @@ -389,7 +393,7 @@ JNIEXPORT jint JNICALL Java_org_iotivity_service_ssm_CoreController_getModelData } //return IModelData JNIEXPORT jobject JNICALL Java_org_iotivity_service_ssm_CoreController_getModelData -(JNIEnv *env, jclass clz, jint pDataReaderInstance, jstring jstrModelName, jint jintDataIndex ) +(JNIEnv *env, jclass clz, jlong pDataReaderInstance, jstring jstrModelName, jint jintDataIndex ) { IDataReader *pDataReader = (IDataReader *)pDataReaderInstance; IModelData *pModelData = NULL; @@ -401,12 +405,12 @@ JNIEXPORT jobject JNICALL Java_org_iotivity_service_ssm_CoreController_getModelD return NULL; } - jmethodID cid_ModelData = env->GetMethodID(g_ClassModelData, "", "(I)V"); + jmethodID cid_ModelData = env->GetMethodID(g_ClassModelData, "", "(J)V"); if (cid_ModelData == NULL) return NULL; - return env->NewObject(g_ClassModelData, cid_ModelData, (jint)pModelData); + return env->NewObject(g_ClassModelData, cid_ModelData, reinterpret_cast(pModelData)); } JNIEXPORT void JNICALL Java_org_iotivity_service_ssm_CoreController_registerReportReceiver diff --git a/service/soft-sensor-manager/SSMCore/src/SSMInterface/SSMCore_JNI.h b/service/soft-sensor-manager/SSMCore/src/SSMInterface/SSMCore_JNI.h index d950bce53..1d4a7076b 100644 --- a/service/soft-sensor-manager/SSMCore/src/SSMInterface/SSMCore_JNI.h +++ b/service/soft-sensor-manager/SSMCore/src/SSMInterface/SSMCore_JNI.h @@ -45,34 +45,34 @@ JNIEXPORT jint JNICALL Java_org_iotivity_service_ssm_CoreController_releaseQuery (JNIEnv *env, jclass clz, jobject queryEngine); JNIEXPORT jint JNICALL Java_org_iotivity_service_ssm_CoreController_executeContextQuery -(JNIEnv *env, jclass clz, jint pQueryEngineInstance, jstring jstrContextQuery); +(JNIEnv *env, jclass clz, jlong pQueryEngineInstance, jstring jstrContextQuery); JNIEXPORT void JNICALL Java_org_iotivity_service_ssm_CoreController_registerQueryEvent -(JNIEnv *env, jclass clz, jint pQueryEngineInstance, jobject queryEngineEvent); +(JNIEnv *env, jclass clz, jlong pQueryEngineInstance, jobject queryEngineEvent); JNIEXPORT void JNICALL Java_org_iotivity_service_ssm_CoreController_killContextQuery -(JNIEnv *env, jclass clz, jint pQueryEngineInstance, jint cqid); +(JNIEnv *env, jclass clz, jlong pQueryEngineInstance, jint cqid); JNIEXPORT jint JNICALL Java_org_iotivity_service_ssm_CoreController_getDataId -(JNIEnv *env, jclass clz, jint pDataReaderInstance); +(JNIEnv *env, jclass clz, jlong pDataReaderInstance); JNIEXPORT jobject JNICALL Java_org_iotivity_service_ssm_CoreController_getAffectedModels -(JNIEnv *env, jclass clz, jint pDataReaderInstance); +(JNIEnv *env, jclass clz, jlong pDataReaderInstance); JNIEXPORT jint JNICALL Java_org_iotivity_service_ssm_CoreController_getModelDataCount -(JNIEnv *env, jclass clz, jint pDataReaderInstance, jstring jstrModelName); +(JNIEnv *env, jclass clz, jlong pDataReaderInstance, jstring jstrModelName); JNIEXPORT jobject JNICALL Java_org_iotivity_service_ssm_CoreController_getModelData -(JNIEnv *env, jclass clz, jint pDataReaderInstance, jstring jstrModelName, jint jintDataIndex ); +(JNIEnv *env, jclass clz, jlong pDataReaderInstance, jstring jstrModelName, jint jintDataIndex ); JNIEXPORT jint JNICALL Java_org_iotivity_service_ssm_CoreController_getPropertyCount -(JNIEnv *env, jclass clz, jint pIModelDataInstance ); +(JNIEnv *env, jclass clz, jlong pIModelDataInstance ); JNIEXPORT jstring JNICALL Java_org_iotivity_service_ssm_CoreController_getPropertyName -(JNIEnv *env, jclass clz, jint pIModelDataInstance, jint propertyIndex ); +(JNIEnv *env, jclass clz, jlong pIModelDataInstance, jint propertyIndex ); JNIEXPORT jstring JNICALL Java_org_iotivity_service_ssm_CoreController_getPropertyValue -(JNIEnv *env, jclass clz, jint pIModelDataInstance, jint propertyIndex ); +(JNIEnv *env, jclass clz, jlong pIModelDataInstance, jint propertyIndex ); JNIEXPORT void JNICALL Java_org_iotivity_service_ssm_CoreController_registerReportReceiver (JNIEnv *env, jclass clz, jobject reportReceiver ); @@ -81,4 +81,4 @@ JNIEXPORT void JNICALL Java_org_iotivity_service_ssm_CoreController_registerRepo } #endif -#endif \ No newline at end of file +#endif diff --git a/service/third_party_libs.scons b/service/third_party_libs.scons index 6ddeebcaf..6fda8506a 100644 --- a/service/third_party_libs.scons +++ b/service/third_party_libs.scons @@ -78,11 +78,11 @@ if target_os == 'android': if target_arch == 'armeabi-v7a-hard': target_arch = 'armeabi-v7a' - if target_arch not in ['x86', 'armeabi', 'armeabi-v7a']: + if target_arch not in ['x86', 'x86_64','armeabi', 'armeabi-v7a']: if not env.GetOption('help') and not env.GetOption('clean'): print ''' *********************************** Warning *********************************** -* current only x86, armeabi, armeabi-v7a libraries are provided! * +* current only x86, x86_64, armeabi, armeabi-v7a libraries are provided! * ******************************************************************************* ''' else: -- 2.34.1