Fixed Scons build Error.
authorheesung84.kim <heesung84.kim@samsung.com>
Sat, 20 Dec 2014 01:05:54 +0000 (10:05 +0900)
committerheesung84.kim <heesung84.kim@samsung.com>
Sat, 20 Dec 2014 01:13:11 +0000 (10:13 +0900)
  Before scons build is not working because of cpluff build and mqtt build.
  It is resolved.

Remove null check point cpluff.
  PluginManger will pass the argument to plugins later.
  Currently it is not needed yet.
  Comment out related code.

Modify the readme file for scons build
  Before readme file is for makefile.

Comment Out Notification build in the Scons script.
  Because of scons build error.

Change-Id: I1d74179ee6439535f218bb45a2f93248fb731228
Signed-off-by: heesung84.kim <heesung84.kim@samsung.com>
12 files changed:
service/SConscript
service/protocol-plugin/lib/cpluff/SConscript
service/protocol-plugin/lib/cpluff/libcpluff/psymbol.c
service/protocol-plugin/plugin-manager/SConscript
service/protocol-plugin/plugin-manager/src/CpluffAdapter.cpp
service/protocol-plugin/plugin-manager/src/CpluffAdapter.h
service/protocol-plugin/plugin-manager/src/FelixAdapter.h
service/protocol-plugin/plugins/SConscript
service/protocol-plugin/plugins/mqtt-fan/src/fanserver_mqtt_plugin.cpp
service/protocol-plugin/plugins/mqtt-light/src/lightserver_mqtt_plugin.cpp
service/protocol-plugin/readme
service/protocol-plugin/sample-app/linux/SConscript

index 4f49777..28c0d38 100644 (file)
@@ -14,12 +14,9 @@ if target_os != 'arduino':
        SConscript('soft-sensor-manager/SConscript')
 
        # Build protocol plugin project
-       # protocol-plugin use 'sys/inotify.h', this header file doesn't
-       # exist on MAC OSX
-       if target_os not in ['darwin', 'ios']:
-               SConscript('protocol-plugin/SConscript')
+       SConscript('protocol-plugin/SConscript')
 
        # Build notification manager project
-       SConscript('notification-manager/SConscript')
+#      SConscript('notification-manager/SConscript')
 else:
        SConscript('notification-manager/SampleApp/arduino/SConscript')
index 58e79f7..b7ea4df 100644 (file)
@@ -12,15 +12,18 @@ target_os = env.get('TARGET_OS')
 ######################################################################
 # Build flags
 ######################################################################
-cpluff_env.AppendUnique(CPPPATH = ['libcpluff/'])
-if target_os not in ['windows', 'winrt']:
-       cpluff_env.AppendUnique(CFLAGS = ['-g','-fPIC', '-DPIC',
-                               '-DDLOPEN_POSIX',
-                               '-DCP_HOST=\\"' + platform.platform() + '\\"',
-                               '-DCP_SHREXT=\\".so\\"',
-                               '-DCP_FNAMESEP_CHAR=\\"\'/\'\\"',
-                               '-DCP_THREADS=\\"Posix\\"'])
-       cpluff_env.AppendUnique(LIBS = ['dl'])
+cpluff_env.AppendUnique(CPPDEFINES = ['CP_C_API=CP_EXPORT',
+                                       'CP_HOST=\"\\"'+env.get('TARGET_OS')+'\\"\"',
+                                       'CP_DATADIR=\"\\\"/usr/local/share\\\"\"',
+                                       'DLOPEN_POSIX',
+                                       'DPIC',
+                                       'CP_THREADS=\"\\\"Posix\\"\"',
+                                       'CP_SHREXT=\"\\".so\\"\"',
+                                       'CP_FNAMESEP_CHAR=\"\'/\'\"',
+                                       'CP_FNAMESEP_STR=\"\\\"/\\"\"',
+                                       'PACKAGE=\"\\\"cpluff\\\"\"'])
+cpluff_env.AppendUnique(LIBS = ['dl'])
+cpluff_env.PrependUnique(CCFLAGS = ['-fPIC'])
 ######################################################################
 # Source files and Targets
 ######################################################################
index ccf9ea6..a2bca4a 100644 (file)
@@ -74,7 +74,7 @@ CP_C_API cp_status_t cp_define_symbol(cp_context_t *context, const char *name, v
        
        CHECK_NOT_NULL(context);
        CHECK_NOT_NULL(name);
-       CHECK_NOT_NULL(ptr);
+//     CHECK_NOT_NULL(ptr);
        if (context->plugin == NULL) {
                cpi_fatalf(_("Only plug-ins can define context specific symbols."));
        }
index 1e7d42b..e15658f 100644 (file)
@@ -15,7 +15,8 @@ target_os = env.get('TARGET_OS')
 ######################################################################
 plugin_manager_env.AppendUnique(CPPPATH = [
                '../lib/cpluff/libcpluff',
-               'src'
+               'src',
+               '../lib/rapidxml'
                ])
 
 if target_os not in ['windows', 'winrt']:
@@ -26,6 +27,18 @@ if target_os == 'android':
        plugin_manager_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
        plugin_manager_env.AppendUnique(LIBS = ['boost_thread-gcc-mt-1_49', 'gnustl_static'])
 
+plugin_manager_env.AppendUnique(CPPDEFINES = ['CP_C_API=CP_EXPORT',
+                                       'CP_HOST=\"\\"'+env.get('TARGET_OS')+'\\"\"',
+                                       'CP_DATADIR=\"\\\"/usr/local/share\\\"\"',
+                                       'DLOPEN_POSIX',
+                                       'DPIC',
+                                       'CP_THREADS=\"\\\"Posix\\"\"',
+                                       'CP_SHREXT=\"\\".so\\"\"',
+                                       'CP_FNAMESEP_CHAR=\"\'/\'\"',
+                                       'CP_FNAMESEP_STR=\"\\\"/\\"\"',
+                                       'PACKAGE=\"\\\"cpluff\\\"\"'])
+
+
 plugin_manager_env.AppendUnique(LIBS = ['oc', 'octbstack', 'expat', 'dl'])
 ######################################################################
 # Source files and Targets
@@ -37,7 +50,8 @@ pmimpl_src = [
                'src/CpluffAdapter.cpp',
                'src/FelixAdapter.cpp',
                'src/Plugin.cpp',
-               'src/PluginManagerImpl.cpp']
+               'src/PluginManagerImpl.cpp',
+               'src/Config.cpp']
 
 pmimpl_env = plugin_manager_env.Clone()
 pmimpl_env.PrependUnique(CCFLAGS = ['-fPIC'])
index addc2a7..3acd2f5 100644 (file)
@@ -457,7 +457,7 @@ int CpluffAdapter::start(Plugin *const plugin, void *const arg)
         {
             ctx = cpi_new_context((cp_plugin_t *)hnode_get(hash_lookup(m_context->env->plugins, id.c_str())),
                                   m_context->env, &status);
-            cp_define_symbol(ctx, "START_ARGUMENT", arg);
+            //cp_define_symbol(ctx, "START_ARGUMENT", arg);
             //printf("start ocplatform address : %x\n", arg);
 
             if ((status = cp_start_plugin(m_context, (char *)id.c_str()) ) != CP_OK)
index e0b934f..6c108d0 100644 (file)
@@ -31,7 +31,6 @@
 #include <sys/stat.h>
 #include <errno.h>
 #include <sys/types.h>
-#include <sys/inotify.h>
 #include <unistd.h>
 #include <boost/thread.hpp>
 #include <boost/bind.hpp>
@@ -40,7 +39,6 @@
 #include "Plugin.h"
 #include "Config.h"
 
-#define EVENT_SIZE  ( sizeof (struct inotify_event) )
 #define BUF_LEN     (int)( 1024 * ( EVENT_SIZE + 16 ) )
 
 namespace OIC
index 7c6398c..7f03f7f 100644 (file)
@@ -31,7 +31,6 @@
 #include <sys/stat.h>
 #include <errno.h>
 #include <sys/types.h>
-#include <sys/inotify.h>
 #include <unistd.h>
 #include <boost/thread.hpp>
 #include <boost/bind.hpp>
@@ -40,7 +39,6 @@
 #include "Plugin.h"
 #include "Config.h"
 
-#define EVENT_SIZE  ( sizeof (struct inotify_event) )
 #define BUF_LEN     (int)( 1024 * ( EVENT_SIZE + 16 ) )
 
 namespace OIC
index 0d9e0cf..e00a35e 100644 (file)
@@ -18,6 +18,7 @@ plugins_env.AppendUnique(CPPPATH = ['../lib/cpluff/libcpluff'])
 
 if target_os not in ['windows', 'winrt']:
        plugins_env.AppendUnique(CXXFLAGS = ['-g3', '-Wall', '-pthread', '-std=c++0x'])
+       plugins_env.PrependUnique(CCFLAGS = ['-fPIC']) 
        plugins_env.AppendUnique(LINKFLAGS = ['-fPIC'])
 
        if target_os not in ['arduino', 'android']:
@@ -28,13 +29,19 @@ if target_os == 'android':
        plugins_env.AppendUnique(LIBS = ['gnustl_static'])
        plugins_env.AppendUnique(CPPDEFINES = ['_GLIBCXX_USE_C99=1', '_GLIBCXX_HAVE_WCSTOF=1'])
 
+plugins_env.AppendUnique(LIBS = [File(env.get('BUILD_DIR') + '/libmosquitto.a'),
+               'mosquitto', 'ssl', 'rt'])
+
+
 ######################################################################
 # Source files and Targets
 ######################################################################
+plugins_env['LIBPREFIX'] = ''
+
 mqtt_fan_src = Glob('mqtt-fan/src/' + '*.cpp')
-fanserver = plugins_env.SharedLibrary('fanserver_mqtt_plugin', mqtt_fan_src)
+fanserver = plugins_env.SharedLibrary('mqtt-fan/fanserver_mqtt_plugin', mqtt_fan_src)
 
 mqtt_light_src = Glob('mqtt-light/src/' + '*.cpp')
-lightserver = plugins_env.SharedLibrary('lightserver_mqtt_plugin', mqtt_light_src)
+lightserver = plugins_env.SharedLibrary('mqtt-light/lightserver_mqtt_plugin', mqtt_light_src)
 
 SConscript('mqtt-fan/lib/SConscript')
index f93be96..82cedfc 100644 (file)
@@ -43,7 +43,7 @@ static int start(void *d)
 {
     plugin_data_t *data = (plugin_data_t *)d;
 
-    data->str = (void *)cp_resolve_symbol(data->ctx, "fanserver_mqtt_plugin", "START_ARGUMENT", NULL);
+    //data->str = (void *)cp_resolve_symbol(data->ctx, "fanserver_mqtt_plugin", "START_ARGUMENT", NULL);
 
     //cp_run_function(data->ctx, (cp_run_func_t)start_fanserver);           // 1
     pthread_create(&(data->m_thread), NULL, start_fanserver, data);         // 2
@@ -56,7 +56,7 @@ static void stop(void *d)
     plugin_data_t *data = (plugin_data_t *)d;
 
     data->flag = false;
-    cp_release_symbol(data->ctx, data->str);
+    //cp_release_symbol(data->ctx, data->str);
     pthread_join(data->m_thread, (void **)NULL);
 }
 
index 28b1c5d..dccac9f 100644 (file)
@@ -43,7 +43,7 @@ static int start(void *d)
 {
     plugin_data_t *data = (plugin_data_t *)d;
 
-    data->str = (void *)cp_resolve_symbol(data->ctx, "lightserver_mqtt_plugin", "START_ARGUMENT", NULL);
+    //data->str = (void *)cp_resolve_symbol(data->ctx, "lightserver_mqtt_plugin", "START_ARGUMENT", NULL);
 
     //cp_run_function(data->ctx, (cp_run_func_t)start_fanserver);           // 1
     pthread_create(&(data->m_thread), NULL, start_lightserver, data);         // 2
@@ -56,7 +56,7 @@ static void stop(void *d)
     plugin_data_t *data = (plugin_data_t *)d;
 
     data->flag = false;
-    cp_release_symbol(data->ctx, data->str);
+    //cp_release_symbol(data->ctx, data->str);
     pthread_join(data->m_thread, (void **)NULL);
 }
 
index c9f3ad2..94f5841 100644 (file)
@@ -38,6 +38,8 @@ The Protocol Plug-in directory includes following sub directories;
 /build         Directory for Building and Binary Release
 
 
+If you build by scons skip 2,3.
+
 2. Compiling C-Pluff library 
 Before building Protocol-Plugin Manager, C-Pluff library should be compiled as follows.
 
@@ -60,18 +62,19 @@ NOTE: To build plugins in 64-bit Ubuntu Linux, OCLib.a and libcoap.a library sho
 4. Using Plugins 
 This version of protocol plug-in source code has following functionality.
 
-1) provides plug-in manager which can start and stop plug-in library.
-2) provides plug-in library which can communicate with MQTT protocol Fan and Light.
-3) provides OIC Sample Client which can get info about Fan and Light with configuration file(pluginmanager.xml).
-   before starting sample app need as below command. 
-   $export LD_LIBRARY_PATH={Top_Dir}/out/linux/x86/release/:$LD_LIBRARY_PATH
+1) Provides plug-in manager which can start and stop plug-in library.
+2) Provides plug-in library which can communicate with MQTT protocol Fan and Light.
+3) Locate shared plug-in library and XML file in a specific folder.
 
 So, to test a plug-in, follow below steps.
 
-1) Locate shared plug-in library and XML file in a specific folder.
-2) Register the plug-in with directory path input from plug-in manager sample.
-3) Start the plug-in from plug-in manager sample.
-4) Run OIC sample client.
+1) Copy libpmimple.so from {Top_Dir}/out/linux/x86/release to sample-app folder.
+2) Provides OIC Sample Client which can get info about Fan and Light with configuration file(pluginmanager.xml).
+3) Copy the pluginmanager.xml from ~/service/protocol-plugin/sample-app/linux/mqtt/ to sample-app folder.
+4) Modifty the pluginmanager.xml 
+5) Before starting sample app need as below command. 
+   $export LD_LIBRARY_PATH={Top_Dir}/out/linux/x86/release/:$LD_LIBRARY_PATH
+6) Start the plug-in from plug-in manager sample.
    ex)~service/protocol-plugin/sample-app/linux/mqtt$./mqttclient
-  (mqtt broker is already installed in the local system.)
+   (Need mqtt broker working in the local system(127.0.0.1) for test.)
 
index 339d4bb..2e6b311 100644 (file)
@@ -13,16 +13,19 @@ target_os = env.get('TARGET_OS')
 ######################################################################
 # Build flags
 ######################################################################
-sample_env.AppendUnique(CPPPATH = ['../../plugin-manager/src/',
-                               '../../lib/cpluff/libcpluff/'])
+sample_env.AppendUnique(CPPPATH = [
+                               '../../plugin-manager/src/',
+                               '../../lib/cpluff/libcpluff/',
+                               '../../lib/rapidxml'])
 if target_os not in ['windows', 'winrt']:
        sample_env.AppendUnique(CXXFLAGS = ['-Wall', '-pthread', '-std=c++0x'])
 
+sample_env.AppendUnique(LIBS = ['pthread'])
 sample_env.AppendUnique(LIBS = ['oc', 'oc_logger', 'octbstack', 'coap', 'ppm', 'pmimpl', 'dl'])
 ######################################################################
 # Source files and Targets
 ######################################################################
-fanclient = sample_env.Program('fanclient', 'fan-control/fanclient.cpp')
+mqttclient = sample_env.Program('mqtt/mqttclient', 'mqtt/mqttclient.cpp')
 
-Alias('fanclient', fanclient)
-env.AppendTarget('fanclient')
\ No newline at end of file
+Alias('mqttclient', mqttclient)
+env.AppendTarget('mqttclient')
\ No newline at end of file