replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / resource / csdk / stack / samples / linux / SimpleClientServer / SConscript
index 7fb7e44..6f4dd48 100644 (file)
@@ -1,32 +1,71 @@
+#******************************************************************
+#
+# 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.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
-Import('env')
+thread_env = SConscript('#build_common/thread.scons')
+samples_env = thread_env.Clone()
+target_os = samples_env.get('TARGET_OS')
+with_ra = samples_env.get ('WITH_RA')
 
-samples_env = env.Clone()
 ######################################################################
 # Build flags
 ######################################################################
+with_upstream_libcoap = samples_env.get('WITH_UPSTREAM_LIBCOAP')
+if with_upstream_libcoap == '1':
+       # For bring up purposes only, we manually copy the forked version to where the unforked version is downloaded.
+       samples_env.AppendUnique(CPPPATH = ['#extlibs/libcoap/libcoap/include'])
+else:
+       # For bring up purposes only, the forked version will live here.
+       samples_env.AppendUnique(CPPPATH = ['../../../../../connectivity/lib/libcoap-4.1.1/include'])
+
 samples_env.PrependUnique(CPPPATH = [
-               '../../../../ocsocket/include',
                '../../../../logger/include',
                '../../../../stack/include',
-               '../../../../ocmalloc/include',
+               '../../../../security/include',
                '../../../../../../extlibs/cjson',
-               '../../../../../oc_logger/include'
+               '../../../../../../extlibs/boost/boost',
+               '../../../../../oc_logger/include',
                ])
 
-samples_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
-samples_env.AppendUnique(LIBS = ['-lpthread'])
-samples_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-samples_env.PrependUnique(LIBS = ['oc', 'm', 'octbstack', 'coap', 'coap_csdk', 'oc_logger', 'connectivity_abstraction'])
+compiler = samples_env.get('CXX')
+if 'g++' in compiler:
+       samples_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
+
+samples_env.AppendUnique(RPATH = [samples_env.get('BUILD_DIR')])
+samples_env.AppendUnique(LIBPATH = [samples_env.get('BUILD_DIR')])
+
+samples_env.PrependUnique(LIBS = ['octbstack', 'ocsrm', 'connectivity_abstraction', 'coap'])
 
-samples_env.ParseConfig('pkg-config --libs glib-2.0');
+if target_os not in ['arduino', 'windows', 'darwin', 'ios', 'msys_nt']:
+       samples_env.AppendUnique(LIBS = ['rt'])
 
-samples_env.AppendUnique(CPPDEFINES = ['CA_INT', 'TB_LOG'])
+if target_os not in ['windows']:
+       samples_env.PrependUnique(LIBS = ['m'])
+
+samples_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
 
 ######################################################################
 # Source files and Targets
 ######################################################################
 ocserver         = samples_env.Program('ocserver', ['ocserver.cpp', 'common.cpp'])
+if samples_env.get('ROUTING') == 'GW':
+       ocrouting        = samples_env.Program('ocrouting', ['ocrouting.cpp', 'common.cpp'])
 occlient         = samples_env.Program('occlient', ['occlient.cpp', 'common.cpp'])
 ocserverslow     = samples_env.Program('ocserverslow', ['ocserverslow.cpp', 'common.cpp'])
 occlientslow     = samples_env.Program('occlientslow', ['occlientslow.cpp', 'common.cpp'])
@@ -34,12 +73,19 @@ ocservercoll     = samples_env.Program('ocservercoll', ['ocservercoll.cpp', 'com
 occlientcoll     = samples_env.Program('occlientcoll', ['occlientcoll.cpp', 'common.cpp'])
 ocserverbasicops = samples_env.Program('ocserverbasicops', ['ocserverbasicops.cpp', 'common.cpp'])
 occlientbasicops = samples_env.Program('occlientbasicops', ['occlientbasicops.cpp', 'common.cpp'])
+if with_ra:
+       ocremoteaccessclient = samples_env.Program('ocremoteaccessclient',
+                                               ['ocremoteaccessclient.cpp','common.cpp'])
 
-Alias("samples", [ocserver, occlient,
+list_of_samples = [ocserver, occlient,
                                ocservercoll, occlientcoll,
                                ocserverbasicops, occlientbasicops,
                                ocserverslow, occlientslow
-                ])
+                ]
+if with_ra:
+       list_of_samples.append (ocremoteaccessclient)
+Alias("samples", list_of_samples)
+
+samples_env.AppendTarget('samples')
 
-env.AppendTarget('samples')