[DEV] update Cmake and ROS log

This commit is contained in:
Edouard DUPIN 2015-03-16 07:14:20 +01:00
parent cf7a98f8a4
commit 51bc7746e4
3 changed files with 55 additions and 25 deletions

View File

@ -54,7 +54,7 @@ add_library(${PROJECT_NAME}
../${PROJECT_NAME}/archive/Zip.cpp
)
set(CMAKE_CXX_FLAGS "-std=c++11 -DDEBUG_LEVEL=3 -DDEBUG=1 -D__CPP_VERSION__=2011 -D__TARGET_OS__Linux")
set(CMAKE_CXX_FLAGS "-std=c++11 -DDEBUG_LEVEL=3 -DDEBUG=1 -D__CPP_VERSION__=2011 -D__TARGET_OS__Linux -DETK_EXTERN_FRAMEWORK_ROS")
## Add cmake target dependencies of the executable/library

View File

@ -16,6 +16,9 @@
#if defined(__TARGET_OS__Android)
# include <android/log.h>
#endif
#if defined(ETK_EXTERN_FRAMEWORK_ROS)
#include <ros/ros.h>
#endif
#include <etk/logIOs.h>
@ -351,11 +354,13 @@ void etk::log::logChar(int32_t _id, int32_t _level, int32_t _ligne, const char*
}
pointer = handle+strlen(handle);
}
if(getTime() == true) {
getDisplayTime(pointer);
pointer = handle+strlen(handle);
}
#if !defined(__TARGET_OS__Android)
#if !defined(ETK_EXTERN_FRAMEWORK_ROS)
if(getTime() == true) {
getDisplayTime(pointer);
pointer = handle+strlen(handle);
}
#endif
#if !defined(__TARGET_OS__Android) && !defined(ETK_EXTERN_FRAMEWORK_ROS)
switch(_level) {
default:
strcat(pointer, "[?] ");
@ -459,35 +464,61 @@ void etk::log::logChar(int32_t _id, int32_t _level, int32_t _ligne, const char*
}
g_lock.lock();
#if defined(__TARGET_OS__Android)
// TODO : Set package name instead of ewol ...
#if defined(ETK_EXTERN_FRAMEWORK_ROS)
switch(_level) {
default:
__android_log_print(ANDROID_LOG_VERBOSE, "EWOL", "%s", handle);
//ROS_VERBOSE_STREAM(handle);
break;
case logLevelCritical:
__android_log_print(ANDROID_LOG_FATAL, "EWOL", "%s", handle);
ROS_FATAL_STREAM(handle);
break;
case logLevelError:
__android_log_print(ANDROID_LOG_ERROR, "EWOL", "%s", handle);
ROS_ERROR_STREAM(handle);
break;
case logLevelWarning:
__android_log_print(ANDROID_LOG_WARN, "EWOL", "%s", handle);
ROS_WARN_STREAM(handle);
break;
case logLevelInfo:
__android_log_print(ANDROID_LOG_INFO, "EWOL", "%s", handle);
ROS_INFO_STREAM(handle);
break;
case logLevelDebug:
__android_log_print(ANDROID_LOG_DEBUG, "EWOL", "%s", handle);
ROS_DEBUG_STREAM(handle);
break;
case logLevelVerbose:
__android_log_print(ANDROID_LOG_VERBOSE, "EWOL", "%s", handle);
//ROS_VERBOSE_STREAM(handle);
break;
}
#elif defined(__TARGET_OS__IOs)
iosNSLog(handle);
#else
std::cout << handle << std::endl;
#if defined(__TARGET_OS__Android)
// TODO : Set package name instead of ewol ...
switch(_level) {
default:
__android_log_print(ANDROID_LOG_VERBOSE, "EWOL", "%s", handle);
break;
case logLevelCritical:
__android_log_print(ANDROID_LOG_FATAL, "EWOL", "%s", handle);
break;
case logLevelError:
__android_log_print(ANDROID_LOG_ERROR, "EWOL", "%s", handle);
break;
case logLevelWarning:
__android_log_print(ANDROID_LOG_WARN, "EWOL", "%s", handle);
break;
case logLevelInfo:
__android_log_print(ANDROID_LOG_INFO, "EWOL", "%s", handle);
break;
case logLevelDebug:
__android_log_print(ANDROID_LOG_DEBUG, "EWOL", "%s", handle);
break;
case logLevelVerbose:
__android_log_print(ANDROID_LOG_VERBOSE, "EWOL", "%s", handle);
break;
}
#elif defined(__TARGET_OS__IOs)
iosNSLog(handle);
#else
std::cout << handle << std::endl;
#endif
#endif
g_lock.unlock();
if (_level == logLevelCritical) {

View File

@ -420,19 +420,18 @@ std::string etk::getUserRunFolder() {
#ifdef __TARGET_OS__Android
bool etk::FSNode::loadDataZip()
{
if (NULL == s_APKArchive) {
bool etk::FSNode::loadDataZip() {
if (s_APKArchive == nullptr) {
return false;
}
if (NULL != m_zipContent) {
if (m_zipContent != nullptr) {
return true;
}
if (false == s_APKArchive->exist(m_systemFileName)) {
return false;
}
m_zipContent = &s_APKArchive->getContent(m_systemFileName);
if (NULL != m_zipContent) {
if (m_zipContent != nullptr) {
return true;
}
return false;
@ -602,7 +601,7 @@ void etk::FSNode::privateSetName(const std::string& _newName) {
isRootFolder = destFilename[0] == '/';
#endif
if( start_with(destFilename, "ROOT:") == true
|| start_with(destFilename, "root:") == true ) {
|| start_with(destFilename, "root:") == true ) {
TK_DBG_MODE(" ==> detect root 2 ");
destFilename.erase(0, 5);
m_type = etk::FSN_TYPE_DIRECT;
@ -655,7 +654,7 @@ void etk::FSNode::privateSetName(const std::string& _newName) {
}
m_type = etk::FSN_TYPE_RELATIF;
} else if(start_with(destFilename, baseRunPath) == true) {
TK_DBG_MODE(" ==> detect relatif 3");
TK_DBG_MODE(" ==> detect relatif 3 (run path=" << baseRunPath << ")");
destFilename.erase(0, baseRunPath.size());
while (destFilename.size()>0 && destFilename[0] == '/') {
destFilename.erase(0, 1);