Cleaning things-manager service build scripts.
authorHarish Kumara Marappa <h.marappa@samsung.com>
Tue, 26 May 2015 14:55:41 +0000 (20:25 +0530)
committerUze Choi <uzchoi@samsung.com>
Wed, 27 May 2015 10:17:20 +0000 (10:17 +0000)
Removed all unnecessary header file inclusion and libraries linking in
things-manager service build scripts. Changed Android.mk file to copy all the required libraries to "libs/armeabi" folder for building TM java layer.

Specified the connectivity_abstraction library instead of coap in SSM's
Android.mk file

Change-Id: Ie31387f77f3452b7d8420489a569a315be7301a2
Signed-off-by: Harish Kumara Marappa <h.marappa@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1108
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: RadhaBhavani <radha.p@samsung.com>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/soft-sensor-manager/SampleApp/android/SSMTesterApp/jni/Android.mk
service/things-manager/SConscript
service/things-manager/sdk/inc/ThingsManager.h
service/things-manager/sdk/java/jni/Android.mk
service/things-manager/sdk/java/jni/Application.mk
service/things-manager/sdk/java/jni/SConscript

index 3910a38..3c9560b 100644 (file)
@@ -1,8 +1,8 @@
 LOCAL_PATH := $(call my-dir)
 
 include $(CLEAR_VARS)
-LOCAL_MODULE := coap
-LOCAL_SRC_FILES := ../libs/libcoap.so
+LOCAL_MODULE := ca
+LOCAL_SRC_FILES := ../libs/libconnectivity_abstraction.so
 include $(PREBUILT_SHARED_LIBRARY)
 
 include $(CLEAR_VARS)
index 00fbf5b..ccd9b1c 100644 (file)
@@ -42,7 +42,7 @@ if target_os not in ['windows', 'winrt']:
 
 if target_os == 'android':
     things_manager_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
-    things_manager_env.PrependUnique(LIBS = ['oc', 'octbstack', 'gnustl_shared', 'android_cpp11_compat', 'log'])
+    things_manager_env.PrependUnique(LIBS = ['oc', 'octbstack', 'gnustl_shared'])
 
 ######################################################################
 # Source files and Targets
@@ -53,6 +53,10 @@ tgmsdk_shared = things_manager_env.SharedLibrary('TGMSDKLibrary', tgm_src)
 
 things_manager_env.InstallTarget([tgmsdk_static,tgmsdk_shared], 'libTGMSDK')
 
+# Build JNI layer
+#if target_os == 'android':
+#    SConscript(os.path.join('sdk', 'java', 'jni', 'SConscript'))
+
 #Go to build sample apps
 SConscript('sampleapp/SConscript')
 
index 1aa9465..5ec0a20 100644 (file)
@@ -35,7 +35,6 @@
 #include <ActionSet.h>
 #include "OCPlatform.h"
 #include "OCApi.h"
-#include "GroupManager.h"
 
 using namespace OC;
 
index 395d11f..2d17144 100644 (file)
@@ -1,56 +1,69 @@
 LOCAL_PATH := $(call my-dir)
 
-ifeq ($(strip $(ANDROID_NDK)),)
-$(error ANDROID_NDK is not set!)
-endif
+include $(CLEAR_VARS)
+OIC_LIB_PATH := ../../../../../out/android/$(TARGET_ARCH_ABI)/release
+LOCAL_MODULE := android-oc_logger
+LOCAL_SRC_FILES := $(OIC_LIB_PATH)/liboc_logger.so
+include $(PREBUILT_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+OIC_LIB_PATH := ../../../../../out/android/$(TARGET_ARCH_ABI)/release
+LOCAL_MODULE := android-octbstack
+LOCAL_SRC_FILES := $(OIC_LIB_PATH)/liboctbstack.so
+include $(PREBUILT_SHARED_LIBRARY)
 
 include $(CLEAR_VARS)
-OIC_LIB_PATH := ../../../../../dep/android/$(TARGET_ARCH_ABI)/usr/lib
-LOCAL_MODULE := libandroid-boost_system
-LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libboost_system.a
-include $(PREBUILT_STATIC_LIBRARY)
+OIC_LIB_PATH := ../../../../../out/android/$(TARGET_ARCH_ABI)/release
+LOCAL_MODULE := android-oc
+LOCAL_SRC_FILES := $(OIC_LIB_PATH)/liboc.so
+include $(PREBUILT_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+OIC_LIB_PATH := ../../../../../out/android/$(TARGET_ARCH_ABI)/release
+LOCAL_MODULE := android-connectivity_abstraction
+LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libconnectivity_abstraction.so
+include $(PREBUILT_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+OIC_LIB_PATH := ../../../../../android/android_api/base/libs/$(TARGET_ARCH_ABI)
+LOCAL_MODULE := android-ocstack-jni
+LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libocstack-jni.so
+include $(PREBUILT_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+OIC_LIB_PATH := ../../../../../android/android_api/base/libs/$(TARGET_ARCH_ABI)
+LOCAL_MODULE := android-ca-interface
+LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libca-interface.so
+include $(PREBUILT_SHARED_LIBRARY)
 
 include $(CLEAR_VARS)
 OIC_LIB_PATH := ../../../../../out/android/$(TARGET_ARCH_ABI)/release
-LOCAL_MODULE := libandroid-thingsmanager
+LOCAL_MODULE := android-thingsmanager
 LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libTGMSDKLibrary.so
 include $(PREBUILT_SHARED_LIBRARY)
 
 include $(CLEAR_VARS)
-OIC_LIB_PATH := ../../../../out/android/$(TARGET_ARCH_ABI)/release
-BASE_LIB_PATH := ../../../../android/android_api/base/libs/$(TARGET_ARCH_ABI)
-OIC_RESOURCE_PATH := ../../../../resource
-OIC_SERVICE_PATH := ../../../../service
-OIC_OUT_PATH := ../../../../out
+OIC_SRC_DIR := ../../../..
 LOCAL_MODULE    := things-manager-jni
 
-LOCAL_C_INCLUDES := $(OIC_RESOURCE_PATH)/include \
-                    $(OIC_RESOURCE_PATH)/csdk/stack/include \
-                    $(OIC_RESOURCE_PATH)/csdk/ocsocket/include \
-                    $(OIC_RESOURCE_PATH)/oc_logger/include \
-                    $(OIC_RESOURCE_PATH)/android/include \
-                    $(OIC_RESOURCE_PATH)/dependencies/cereal/include \
-                    $(OIC_RESOURCE_PATH)/../extlibs/boost/boost_1_58_0 \
-                    $(OIC_RESOURCE_PATH)/../extlibs/timer \
-                    $(OIC_SERVICE_PATH)/things-manager/sdk/inc \
-                    $(OIC_SERVICE_PATH)/things-manager/sdk/src \
-                    $(OIC_SERVICE_PATH)/../android/android_api/base/jni \
-                    $(OIC_SERVICE_PATH)/../build_common/android/compatibility \
-                    $(LOCAL_PATH)/jniutil/inc \
-                    $(LOCAL_PATH)/tm/inc \
-                    $(LOCAL_PATH)/tm/src \
-                    $(LOCAL_PATH)/tm/src/base \
-                    $(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/$(TOOLCHAIN_VERSION)/include \
-                    $(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/$(TOOLCHAIN_VERSION)/libs/$(TARGET_ARCH_ABI)/include \
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/jniutil/inc \
+                    $(OIC_SRC_DIR)/android/android_api/base/jni \
+                    $(OIC_SRC_DIR)/resource/include \
+                    $(OIC_SRC_DIR)/resource/csdk/stack/include \
+                    $(OIC_SRC_DIR)/resource/oc_logger/include \
+                    $(OIC_SRC_DIR)/extlibs/boost/boost_1_58_0 \
+                    $(OIC_SRC_DIR)/extlibs/timer \
+                    $(OIC_SRC_DIR)/service/things-manager/sdk/inc \
+                    $(LOCAL_PATH)/tm/inc
 
 LOCAL_SRC_FILES += $(patsubst $(LOCAL_PATH)/%, %, $(wildcard $(LOCAL_PATH)/jniutil/src/*.cpp))
 LOCAL_SRC_FILES += $(patsubst $(LOCAL_PATH)/%, %, $(wildcard $(LOCAL_PATH)/tm/src/*.cpp))
 
 LOCAL_CPPFLAGS := -std=c++0x -frtti -fexceptions
 
-LOCAL_LDLIBS := -llog -L$(BASE_LIB_PATH) -locstack-jni -L$(OIC_LIB_PATH) -loc -loctbstack -lcoap -loc_logger
-LOCAL_LDLIBS += -L$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/$(TOOLCHAIN_VERSION)/libs/$(TARGET_ARCH_ABI) -lgnustl_shared
-LOCAL_SHARED_LIBRARIES := android-thingsmanager
-LOCAL_STATIC_LIBRARIES := android-boost_system
+LOCAL_LDLIBS := -llog
+LOCAL_SHARED_LIBRARIES := android-ocstack-jni
+LOCAL_SHARED_LIBRARIES += android-thingsmanager
+LOCAL_SHARED_LIBRARIES += android-oc
 
 include $(BUILD_SHARED_LIBRARY)
index d02cd64..c177a13 100644 (file)
@@ -1,2 +1,2 @@
 NDK_TOOLCHAIN_VERSION := 4.9
-#APP_STL               := gnustl_shared
+APP_STL               := gnustl_shared
index bad2e0b..5a70deb 100644 (file)
@@ -2,6 +2,7 @@
 # Things manager service JNI build script
 ##
 
+import os
 Import('env')
 
 # Add third party libraries
@@ -9,31 +10,45 @@ lib_env = env.Clone()
 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', exports = 'lib_env')
 
 tm_jni_env = lib_env.Clone()
-target_os = env.get('TARGET_OS')
-tm_sdk = env.get('SRC_DIR') + '/service/things-manager/sdk'
-base_jni = env.get('SRC_DIR') + '/android/android_api/base/jni'
+target_os = tm_jni_env.get('TARGET_OS')
+tm_sdk = tm_jni_env.get('SRC_DIR') + '/service/things-manager/sdk'
+base_jni = tm_jni_env.get('SRC_DIR') + '/android/android_api/base/jni'
+extlibs = tm_jni_env.get('SRC_DIR') + '/extlibs'
 
 ######################################################################
 # Build flags
 ######################################################################
 tm_jni_env.AppendUnique(CXXFLAGS = ['-Wall', '-DLINUX', '-DNDEBUG'])
-tm_jni_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
-tm_jni_env.AppendUnique(LIBPATH = [base_jni+'/../libs/'+env.get('TARGET_ARCH')])
-tm_jni_env.PrependUnique(LIBS = ['ocstack-jni', 'TGMSDKLibrary', 'oc', 'octbstack', 'boost_system', 'gnustl_shared', 'compatibility', 'log'])
+tm_jni_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions', '-std=c++0x'])
+tm_jni_env.AppendUnique(LIBPATH = [base_jni+'/../libs/'+tm_jni_env.get('TARGET_ARCH')])
+tm_jni_env.PrependUnique(LIBS = ['ocstack-jni', 'TGMSDKLibrary', 'oc', 'gnustl_shared', 'log'])
 
-tm_jni_env.AppendUnique(CPPPATH = [tm_sdk+'/inc', tm_sdk+'/src'])
+tm_jni_env.AppendUnique(CPPPATH = [tm_sdk+'/inc'])
 tm_jni_env.AppendUnique(CPPPATH = [base_jni])
-tm_jni_env.AppendUnique(CPPPATH = ['tm/inc', 'tm/src', 'jniutil/inc', 'jniutil/src', '../../../../../extlibs/timer/'])
+tm_jni_env.AppendUnique(CPPPATH = ['tm/inc', 'jniutil/inc', extlibs+'/timer/'])
 
 ######################################################################
 # Source files and Targets
 ######################################################################
-tm_jni_src = [env.Glob('tm/src/*.cpp'), env.Glob('jniutil/src/*.cpp')]
+tm_jni_src = [tm_jni_env.Glob('tm/src/*.cpp'), tm_jni_env.Glob('jniutil/src/*.cpp')]
 tm_jni = tm_jni_env.SharedLibrary('things-manager-jni', tm_jni_src)
 
 tm_jni_env.InstallTarget(tm_jni, 'libthings-manager-jni')
 
 # Install the libraries to /libs/<TARGET_ARCH> directory
-tm_jni_env.Install(tm_sdk+'/java/libs/'+env.get('TARGET_ARCH'),env.get('BUILD_DIR')+'/libTGMSDKLibrary.so')
-tm_jni_env.Install(tm_sdk+'/java/libs/'+env.get('TARGET_ARCH'),tm_jni)
+tm_jni_env.Install(tm_sdk+'/java/libs/'+tm_jni_env.get('TARGET_ARCH'),tm_jni_env.get('BUILD_DIR')+'/liboc_logger.so')
+tm_jni_env.Install(tm_sdk+'/java/libs/'+tm_jni_env.get('TARGET_ARCH'),tm_jni_env.get('BUILD_DIR')+'/liboctbstack.so')
+tm_jni_env.Install(tm_sdk+'/java/libs/'+tm_jni_env.get('TARGET_ARCH'),tm_jni_env.get('BUILD_DIR')+'/liboc.so')
+tm_jni_env.Install(tm_sdk+'/java/libs/'+tm_jni_env.get('TARGET_ARCH'),tm_jni_env.get('BUILD_DIR')+'/libconnectivity_abstraction.so')
+tm_jni_env.Install(tm_sdk+'/java/libs/'+tm_jni_env.get('TARGET_ARCH'),base_jni+'/../libs/'+tm_jni_env.get('TARGET_ARCH')+'/libocstack-jni.so')
+tm_jni_env.Install(tm_sdk+'/java/libs/'+tm_jni_env.get('TARGET_ARCH'),base_jni+'/../libs/'+tm_jni_env.get('TARGET_ARCH')+'/libca-interface.so')
+tm_jni_env.Install(tm_sdk+'/java/libs/'+tm_jni_env.get('TARGET_ARCH'),tm_jni_env.get('BUILD_DIR')+'/libTGMSDKLibrary.so')
+tm_jni_env.Install(tm_sdk+'/java/libs/'+tm_jni_env.get('TARGET_ARCH'),tm_jni)
+
+gnu_lib_paths = env.get('LIBPATH')
+for gnu_lib_path in gnu_lib_paths:
+    gnu_lib_path = gnu_lib_path + '/libgnustl_shared.so'
+    if os.path.exists(gnu_lib_path):
+        tm_jni_env.Install(tm_sdk+'/java/libs/'+tm_jni_env.get('TARGET_ARCH'), gnu_lib_path)
+        break