From 7ec5e6f533da42e85fcc095c215ce5242e689c42 Mon Sep 17 00:00:00 2001 From: Ramin Yaghoubzadeh <ryaghoubzadeh@uni-bielefeld.de> Date: Mon, 18 Nov 2013 16:26:51 +0100 Subject: [PATCH] === ADVANCED TO RSB WITH STABLE VERSION 0.9 === Tested on Mac and Linux. Please report any issues. Please update the rsb project first. Also, please update the soa script and run "soa fix". --- ipaacalib/cpp/CMakeLists.txt | 8 +++---- ipaacalib/cpp/include/ipaaca/ipaaca.h | 1 + ipaacalib/cpp/src/ipaaca.cc | 33 +++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/ipaacalib/cpp/CMakeLists.txt b/ipaacalib/cpp/CMakeLists.txt index 3d4c8a0..037c76e 100644 --- a/ipaacalib/cpp/CMakeLists.txt +++ b/ipaacalib/cpp/CMakeLists.txt @@ -25,13 +25,13 @@ include_directories(${PROTOBUF_INCLUDE_DIRS}) #set(RSBLIBS rsc rsbcore) # add for for each new rsb version -include_directories( ${PROJECT_SOURCE_DIR}/../../deps/include/rsc0.8 ) -include_directories( ${PROJECT_SOURCE_DIR}/../../deps/include/rsb0.8 ) +include_directories( ${PROJECT_SOURCE_DIR}/../../deps/include/rsc0.9 ) +include_directories( ${PROJECT_SOURCE_DIR}/../../deps/include/rsb0.9 ) # change for each new rsb version if (DEFINED APPLE) -set(RSBLIBS rsc.0.8 rsb.0.8) +set(RSBLIBS rsc0.9 rsb.0.9) else(DEFINED APPLE) -set(RSBLIBS ${PROJECT_SOURCE_DIR}/../../deps/lib/librsc.so.0.8 ${PROJECT_SOURCE_DIR}/../../deps/lib/librsb.so.0.8 ) +set(RSBLIBS ${PROJECT_SOURCE_DIR}/../../deps/lib/librsc0.9.so ${PROJECT_SOURCE_DIR}/../../deps/lib/librsb.so.0.9 ) endif(DEFINED APPLE) #set(LIBS ${LIBS} ${BOOSTLIBS} ${PROTOLIBS} ${RSBLIBS}) diff --git a/ipaacalib/cpp/include/ipaaca/ipaaca.h b/ipaacalib/cpp/include/ipaaca/ipaaca.h index d33783a..057ff19 100644 --- a/ipaacalib/cpp/include/ipaaca/ipaaca.h +++ b/ipaacalib/cpp/include/ipaaca/ipaaca.h @@ -459,6 +459,7 @@ class Initializer { public: static void initialize_ipaaca_rsb_if_needed(); + static void initialize_updated_default_config(); static bool initialized(); protected: static bool _initialized; diff --git a/ipaacalib/cpp/src/ipaaca.cc b/ipaacalib/cpp/src/ipaaca.cc index 541b96c..3226416 100644 --- a/ipaacalib/cpp/src/ipaaca.cc +++ b/ipaacalib/cpp/src/ipaaca.cc @@ -32,6 +32,7 @@ #include <ipaaca/ipaaca.h> #include <cstdlib> +#include <glob.h> namespace ipaaca { @@ -57,6 +58,9 @@ bool Initializer::initialized() { return _initialized; } void Initializer::initialize_ipaaca_rsb_if_needed() { if (_initialized) return; + + initialize_updated_default_config(); + // RYT FIXME This configuration stuff has been simply removed in rsb! //ParticipantConfig config = ParticipantConfig::fromConfiguration(); //getFactory().setDefaultParticipantConfig(config); @@ -86,6 +90,35 @@ void Initializer::initialize_ipaaca_rsb_if_needed() //IPAACA_TODO("initialize all converters") } +void Initializer::initialize_updated_default_config() +{ + // quick hack to iterate through the pwd parents + // and find the closest rsb plugin dir + // + // but only if not yet defined + const char* plugin_path = getenv("RSB_PLUGINS_CPP_PATH"); + if (!plugin_path) { + LOG_IPAACA_CONSOLE("RSB_PLUGINS_CPP_PATH not set; looking here and up to 7 dirs up.") + std::string pathstr = "./"; + for (int i=0; i< 8 /* depth EIGHT (totally arbitrary..) */ ; i++) { + std::string where_str = pathstr+"deps/lib/rsb*/plugins"; + const char* where = where_str.c_str(); + glob_t g; + glob(where, 0, NULL, &g); + if (g.gl_pathc>0) { + const char* found_path = g.gl_pathv[0]; + LOG_IPAACA_CONSOLE("Found an RSB plugin dir which will be used automatically: " << found_path) + setenv("RSB_PLUGINS_CPP_PATH", found_path, 1); + break; + } // else keep going + globfree(&g); + pathstr += "../"; + } + } else { + LOG_IPAACA_CONSOLE("RSB_PLUGINS_CPP_PATH already defined: " << plugin_path) + } +} + std::string generate_uuid_string() { uuid_t uuidt; -- GitLab