1 #******************************************************************
3 # Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
5 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
19 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
22 # Examples build script
25 # Add third party libraries
27 SConscript(env.get('SRC_DIR') + '/resource/third_party_libs.scons', 'lib_env')
29 jni_env = lib_env.Clone()
31 ######################################################################
33 ######################################################################
34 jni_env.AppendUnique(CPPPATH = [
35 env.get('SRC_DIR') + '/resource/csdk/connectivity/api',
36 env.get('SRC_DIR') + '/resource/include',
37 env.get('SRC_DIR') + '/resource/c_common',
38 env.get('SRC_DIR') + '/resource/c_common/oic_string/include',
39 env.get('SRC_DIR') + '/resource/c_common/oic_malloc/include',
40 env.get('SRC_DIR') + '/resource/csdk/stack/include',
41 env.get('SRC_DIR') + '/resource/csdk/ocsocket/include',
42 env.get('SRC_DIR') + '/resource/oc_logger/include',
43 env.get('SRC_DIR') + '/resource/csdk/logger/include',
44 env.get('SRC_DIR') + '/resource/../extlibs/boost/boost_1_58_0',
45 env.get('SRC_DIR') + '/resource/../build_common/android/compatibility',
46 env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include',
47 env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/oxm',
48 env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/internal',
49 env.get('SRC_DIR') + '/resource/csdk/security/include'
53 target_os = env.get('TARGET_OS')
54 jni_env.AppendUnique(CCFLAGS = ['-Wno-error', '-Wno-comment', '-Wno-unused-function', '-Wno-unused-parameter'])
55 if target_os not in ['windows', 'winrt']:
56 jni_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
58 # Note: 'pthread' is in libc for android. On other platform, if use
59 # new gcc(>4.9?) it isn't required, otherwise, it's required
60 if target_os != 'android':
61 jni_env.AppendUnique(LIBS = ['-lpthread'])
63 jni_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
64 jni_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
65 jni_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction'])
66 if env.get('SECURED') == '1':
67 jni_env.AppendUnique(LIBS = ['tinydtls', 'ocprovision', 'ocpmapi'])
69 if target_os == 'android':
70 jni_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
71 jni_env.AppendUnique(LIBS = ['gnustl_shared'])
73 if not env.get('RELEASE'):
74 jni_env.AppendUnique(LIBS = ['log'])
76 if target_os in ['darwin', 'ios']:
77 jni_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
79 ######################################################################
80 # Source files and Targets
81 ######################################################################
84 ca_interface = jni_env.SharedLibrary('ca-interface', ['JniCaInterface.c'])
89 'JniEntityHandler.cpp',
90 'JniOnResourceFoundListener.cpp',
91 'JniOnDeviceInfoListener.cpp',
92 'JniOnPlatformInfoListener.cpp',
93 'JniOnPresenceListener.cpp',
94 'JniOnGetListener.cpp',
95 'JniOnPutListener.cpp',
96 'JniOnPostListener.cpp',
97 'JniOnDeleteListener.cpp',
98 'JniOnObserveListener.cpp',
99 'JniOcRepresentation.cpp',
100 'JniOcResourceHandle.cpp',
101 'JniOcPresenceHandle.cpp',
102 'JniOcRequestHandle.cpp',
103 'JniOcResourceRequest.cpp',
104 'JniOcResourceResponse.cpp',
107 'JniOcResourceIdentifier.cpp',
110 if env.get('SECURED') == '1':
112 'JniOcSecureResource.cpp',
113 'JniOcProvisioning.cpp',
114 'JniSecureUtils.cpp',
115 'JniProvisionResultListner.cpp',
116 'JniPinCheckListener.cpp',
117 'JniDisplayPinListener.cpp'
120 ocstack_jni = jni_env.SharedLibrary('ocstack-jni', ocstack_files)
122 jni_env.InstallTarget(ocstack_jni, 'ocstack-jni')
123 jni_env.InstallTarget(ca_interface, 'ca-interface')
125 env.AppendTarget('ocstack-jni')