X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Fcsdk%2FSConscript;h=9f887e9cc5da49cf17068eaf88637df20c16d50c;hb=966700a71110e415e8d3049cbe59c624929a9dff;hp=6de4c2d5992d45435ba1add236d6afe3f0b9a496;hpb=82df1923880170d846b24fd345a7d78f5049b084;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/csdk/SConscript b/resource/csdk/SConscript index 6de4c2d..9f887e9 100644 --- a/resource/csdk/SConscript +++ b/resource/csdk/SConscript @@ -1,7 +1,26 @@ +#****************************************************************** +# +# 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. +# +#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + ## # liboctbstack (share library) build script ## - Import('env') lib_env = env.Clone() @@ -10,6 +29,7 @@ SConscript(env.get('SRC_DIR') + '/resource/third_party_libs.scons', 'lib_env') liboctbstack_env = lib_env.Clone() target_os = env.get('TARGET_OS') +with_ra = env.get('WITH_RA') # As in the source code, it includes arduino Time library (C++) # It requires compile the .c with g++ if target_os == 'arduino': @@ -21,61 +41,106 @@ if target_os == 'arduino': ###################################################################### liboctbstack_env.PrependUnique(CPPPATH = [ '../../extlibs/cjson/', - 'ocsocket/include', + '../../extlibs/timer/', 'logger/include', 'ocrandom/include', - 'ocmalloc/include', - 'libcoap', - 'occoap/include', 'stack/include', 'stack/include/internal', - '../oc_logger/include' + '../oc_logger/include', + 'connectivity/lib/libcoap-4.1.1', + 'connectivity/inc', + 'connectivity/api', + 'connectivity/external/inc', + 'security/include', + 'security/include/internal', ]) +liboctbstack_env.AppendUnique(LIBS = ['ocsrm']) + if target_os not in ['arduino', 'windows', 'winrt']: liboctbstack_env.AppendUnique(CPPDEFINES = ['WITH_POSIX']) liboctbstack_env.AppendUnique(CFLAGS = ['-std=c99']) +if liboctbstack_env.get('ROUTING') == 'GW': + liboctbstack_env.AppendUnique(CPPDEFINES = ['ROUTING_GATEWAY']) +elif liboctbstack_env.get('ROUTING') == 'EP': + liboctbstack_env.AppendUnique(CPPDEFINES = ['ROUTING_EP']) + if target_os not in ['windows', 'winrt']: liboctbstack_env.AppendUnique(CFLAGS = ['-Wall']) -if target_os == 'android': - liboctbstack_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')]) - liboctbstack_env.AppendUnique(LIBS = ['coap', 'm']) +liboctbstack_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')]) + +if target_os in ['android', 'linux', 'tizen']: + liboctbstack_env.PrependUnique(LIBS = ['connectivity_abstraction']) + if with_ra: + liboctbstack_env.AppendUnique(LIBS = ['ra_xmpp']) + +liboctbstack_env.AppendUnique(LIBS = ['coap', 'm']) + +if target_os == 'tizen': + liboctbstack_env.ParseConfig("pkg-config --cflags --libs uuid") + +if target_os not in ['android', 'arduino', 'windows', 'winrt']: + liboctbstack_env.AppendUnique(LIBS = ['pthread']) if target_os == 'arduino': liboctbstack_env.AppendUnique(CPPDEFINES = ['NDEBUG', 'WITH_ARDUINO']) -else: +elif target_os not in ['darwin','ios']: liboctbstack_env.AppendUnique(CFLAGS = ['-fPIC']) - if target_os in ['darwin', 'ios']: + env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE']) liboctbstack_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE']) liboctbstack_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')]) - liboctbstack_env.AppendUnique(LIBS = ['coap']) +if target_os not in ['arduino']: + liboctbstack_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined']) -if not env.get('RELEASE'): +if env.get('SECURED') == '1': + liboctbstack_env.AppendUnique(LIBS = ['tinydtls']) + +if env.get('LOGGING'): liboctbstack_env.AppendUnique(CPPDEFINES = ['TB_LOG']) +liboctbstack_env.Append(LIBS = ['c_common']) + +if liboctbstack_env.get('ROUTING') in ['GW', 'EP']: + liboctbstack_env.Prepend(LIBS = ['routingmanager']) + ###################################################################### # Source files and Targets ###################################################################### OCTBSTACK_SRC = 'stack/src/' liboctbstack_src = [ '../../extlibs/cjson/cJSON.c', - 'occoap/src/occoap.c', - 'occoap/src/occoaphelper.c', + '../../extlibs/timer/timer.c', OCTBSTACK_SRC + 'ocstack.c', + OCTBSTACK_SRC + 'ocpayload.c', + OCTBSTACK_SRC + 'ocpayloadparse.c', + OCTBSTACK_SRC + 'ocpayloadconvert.c', OCTBSTACK_SRC + 'occlientcb.c', OCTBSTACK_SRC + 'ocresource.c', OCTBSTACK_SRC + 'ocobserve.c', - OCTBSTACK_SRC + 'ocserverrequest.c', + OCTBSTACK_SRC + 'ocserverrequest.c', OCTBSTACK_SRC + 'occollection.c', - OCTBSTACK_SRC + 'ocsecurity.c', - OCTBSTACK_SRC + 'oicgroup.c' + OCTBSTACK_SRC + 'oicgroup.c', + 'logger/src/logger.c', + 'ocrandom/src/ocrandom.c' ] -if target_os == 'arduino': - liboctbstack = liboctbstack_env.StaticLibrary('octbstack', liboctbstack_src) + +liboctbstack_src.extend(env['cbor_files']) + +if target_os in ['arduino','darwin','ios'] : + static_liboctbstack = liboctbstack_env.StaticLibrary('octbstack', liboctbstack_src) + liboctbstack_env.InstallTarget(static_liboctbstack, 'liboctbstack') + liboctbstack_env.UserInstallTargetLib(static_liboctbstack, 'liboctbstack') + liboctbstack_env.UserInstallTargetHeader('stack/include/ocstackconfig.h', 'resource', 'ocstackconfig.h') + liboctbstack_env.UserInstallTargetHeader('stack/include/octypes.h', 'resource', 'octypes.h') else: - liboctbstack = liboctbstack_env.SharedLibrary('octbstack', liboctbstack_src) + static_liboctbstack = liboctbstack_env.StaticLibrary('octbstack', liboctbstack_src) + shared_liboctbstack = liboctbstack_env.SharedLibrary('octbstack', liboctbstack_src) + liboctbstack_env.InstallTarget([static_liboctbstack, shared_liboctbstack], 'liboctbstack') + liboctbstack_env.UserInstallTargetLib([static_liboctbstack, shared_liboctbstack], 'liboctbstack') + liboctbstack_env.UserInstallTargetHeader('stack/include/ocstackconfig.h', 'resource', 'ocstackconfig.h') + liboctbstack_env.UserInstallTargetHeader('stack/include/octypes.h', 'resource', 'octypes.h') + liboctbstack_env.UserInstallTargetHeader('stack/include/ocstack.h', 'resource', 'ocstack.h') -liboctbstack_env.InstallTarget(liboctbstack, 'liboctbstack')