--- /dev/null
+#******************************************************************
+#
+# Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+##
+# Examples build script
+##
+Import('env')
+# Add third party libraries
+lib_env = env.Clone()
+SConscript(env.get('SRC_DIR') + '/resource/third_party_libs.scons', 'lib_env')
+
+jni_env = lib_env.Clone()
+
+######################################################################
+# Build flags
+######################################################################
+jni_env.AppendUnique(CPPPATH = [
+ env.get('SRC_DIR') + '/resource/csdk/connectivity/api',
+ env.get('SRC_DIR') + '/resource/include',
+ env.get('SRC_DIR') + '/resource/c_common',
+ env.get('SRC_DIR') + '/resource/c_common/oic_string/include',
+ env.get('SRC_DIR') + '/resource/c_common/oic_malloc/include',
+ env.get('SRC_DIR') + '/resource/csdk/stack/include',
+ env.get('SRC_DIR') + '/resource/csdk/ocsocket/include',
++ env.get('SRC_DIR') + '/resource/csdk/resource-directory/include',
+ env.get('SRC_DIR') + '/resource/oc_logger/include',
+ env.get('SRC_DIR') + '/resource/csdk/logger/include',
+ env.get('SRC_DIR') + '/resource/../extlibs/boost/boost_1_58_0',
+ env.get('SRC_DIR') + '/resource/../build_common/android/compatibility',
+ env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include',
+ env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/oxm',
+ env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/internal',
+ env.get('SRC_DIR') + '/resource/csdk/security/include',
+ env.get('SRC_DIR') + '/resource/csdk/connectivity/lib/libcoap-4.1.1/include'
+ ])
+
+target_os = env.get('TARGET_OS')
+jni_env.AppendUnique(CCFLAGS = ['-Wno-error', '-Wno-comment', '-Wno-unused-function', '-Wno-unused-parameter'])
+if target_os not in ['windows', 'winrt']:
+ jni_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
+
+ # Note: 'pthread' is in libc for android. On other platform, if use
+ # new gcc(>4.9?) it isn't required, otherwise, it's required
+ if target_os != 'android':
+ jni_env.AppendUnique(LIBS = ['-lpthread'])
+
+jni_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
+jni_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
+jni_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction'])
+if env.get('SECURED') == '1':
+# jni_env.AppendUnique(CPPDEFINES= ['__WITH_TLS__'])
+ jni_env.PrependUnique(LIBS = ['tinydtls', 'ocprovision', 'ocpmapi'])
+ jni_env.AppendUnique(CPPPATH = ['#resource/csdk/security/include/internal',
+ '#extlibs/cjson',
+ '#resource/csdk/security/provisioning/include/cloud'])
+
+if target_os == 'android':
+ jni_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
+ jni_env.AppendUnique(LIBS = ['gnustl_shared'])
+
+ if not env.get('RELEASE'):
+ jni_env.AppendUnique(LIBS = ['log'])
+
+if target_os in ['darwin', 'ios']:
+ jni_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
+
+if env.get('WITH_CLOUD'):
+ jni_env.AppendUnique(CPPDEFINES = ['WITH_CLOUD'])
+
+if env.get('WITH_TCP'):
+ jni_env.AppendUnique(CPPDEFINES = ['WITH_TCP', '__WITH_TLS__'])
+
+with_mq = env.get('WITH_MQ')
+if 'SUB' in with_mq:
+ jni_env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ'])
+if 'PUB' in with_mq:
+ jni_env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ'])
+if 'BROKER' in with_mq:
+ jni_env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ'])
+######################################################################
+# Source files and Targets
+######################################################################
+
+ca_interface = jni_env.SharedLibrary('ca-interface', ['JniCaInterface.c'])
+
+ocstack_files = [
+ 'JniOcStack.cpp',
+ 'JniUtils.cpp',
+ 'JniEntityHandler.cpp',
+ 'JniOnResourceFoundListener.cpp',
+ 'JniOnDeviceInfoListener.cpp',
+ 'JniOnPlatformInfoListener.cpp',
+ 'JniOnPresenceListener.cpp',
+ 'JniOnGetListener.cpp',
+ 'JniOnPutListener.cpp',
+ 'JniOnPostListener.cpp',
+ 'JniOnDeleteListener.cpp',
+ 'JniOnObserveListener.cpp',
+ 'JniOcRepresentation.cpp',
+ 'JniOcResourceHandle.cpp',
+ 'JniOcPresenceHandle.cpp',
+ 'JniOcRequestHandle.cpp',
+ 'JniOcResourceRequest.cpp',
+ 'JniOcResourceResponse.cpp',
+ 'JniOcPlatform.cpp',
+ 'JniOcResource.cpp',
+ 'JniOcResourceIdentifier.cpp',
+ 'JniOcSecurity.cpp',
+ 'JniOnDPDevicesFoundListener.cpp',
+ 'JniOnDirectPairingListener.cpp',
+ 'JniOcDirectPairDevice.cpp',
+ 'JniOnPublishResourceListener.cpp',
+ 'JniOnDeleteResourceListener.cpp',
++ 'JniOcRDClient.cpp',
+ ]
+if ['SUB', 'PUB', 'BROKER'] in with_mq:
+ ocstack_files += [
+ 'JniOnMQTopicFoundListener.cpp',
+ 'JniOnMQSubscribeListener.cpp'
+ ]
+if env.get('SECURED') == '1':
+ ocstack_files += [
+ 'JniOcSecureResource.cpp',
+ 'JniOcProvisioning.cpp',
+ 'JniSecureUtils.cpp',
+ 'JniProvisionResultListner.cpp',
+ 'JniPinCheckListener.cpp',
+ 'JniDisplayPinListener.cpp'
+ ]
+if env.get('WITH_CLOUD'):
+ ocstack_files += [
+ 'JniOcAccountManager.cpp'
+ ]
+if env.get('WITH_TCP') or env.get('SECURED') == '1':
+ ocstack_files += [
+ 'JniOcCloudResultListener.cpp',
+ 'JniGetAclIdByDeviceListener.cpp'
+ ]
+if env.get('WITH_TCP'):
+ ocstack_files += ['JniOcCloudProvisioning.cpp']
+ocstack_jni = jni_env.SharedLibrary('ocstack-jni', ocstack_files)
+
+jni_env.InstallTarget(ocstack_jni, 'ocstack-jni')
+jni_env.InstallTarget(ca_interface, 'ca-interface')
+
+env.AppendTarget('ocstack-jni')