Remove submodule glog
This commit is contained in:
parent
2096f93a92
commit
4021c565d2
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -1,9 +1,6 @@
|
|||
[submodule "test/gtest"]
|
||||
path = test/gtest
|
||||
url = https://github.com/google/googletest.git
|
||||
[submodule "third_party/glog"]
|
||||
path = third_party/glog
|
||||
url = https://github.com/google/glog.git
|
||||
[submodule "tools/linter"]
|
||||
path = tools/linter
|
||||
url = https://github.com/slightech/linter.git
|
||||
|
|
11
Makefile
11
Makefile
|
@ -24,7 +24,6 @@ help:
|
|||
@echo " make apidoc make api doc"
|
||||
@echo " make opendoc open api doc (html)"
|
||||
@echo " make init init project"
|
||||
@echo " make 3rdparty build 3rdparty: glog"
|
||||
@echo " make build build project"
|
||||
@echo " make install install project"
|
||||
@echo " make test build test and run"
|
||||
|
@ -61,15 +60,7 @@ opendoc: apidoc
|
|||
|
||||
submodules:
|
||||
@git submodule update --init
|
||||
|
||||
third_party: submodules
|
||||
@$(call echo,Make $@)
|
||||
@$(call echo,Make glog,33)
|
||||
@$(call cmake_build,./third_party/glog/_build)
|
||||
|
||||
3rdparty: third_party
|
||||
|
||||
.PHONY: submodules third_party 3rdparty
|
||||
.PHONY: submodules
|
||||
|
||||
# init
|
||||
|
||||
|
|
|
@ -17,4 +17,6 @@ option(WITH_API "Build with API layer, need OpenCV" ON)
|
|||
message(STATUS "Options:")
|
||||
message(STATUS " WITH_API: ${WITH_API}")
|
||||
|
||||
# How to install glog?
|
||||
# Ubuntu: `sudo apt-get install libgoogle-glog-dev`
|
||||
option(WITH_GLOG "Include glog support" OFF)
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
#include "mynteye/mynteye.h"
|
||||
|
||||
#ifdef MYNTEYE_OS_ANDROID
|
||||
# include <android/log.h>
|
||||
#include <android/log.h>
|
||||
#endif // ANDROID
|
||||
|
||||
// Log severity level constants.
|
||||
|
@ -144,13 +144,10 @@ const int INFO = ::INFO;
|
|||
class MYNTEYE_API LogSink {
|
||||
public:
|
||||
virtual ~LogSink() {}
|
||||
virtual void send(LogSeverity severity,
|
||||
const char* full_filename,
|
||||
const char* base_filename,
|
||||
int line,
|
||||
const struct tm* tm_time,
|
||||
const char* message,
|
||||
size_t message_len) = 0;
|
||||
virtual void send(
|
||||
LogSeverity severity, const char *full_filename,
|
||||
const char *base_filename, int line, const struct tm *tm_time,
|
||||
const char *message, size_t message_len) = 0;
|
||||
virtual void WaitTillSent() = 0;
|
||||
};
|
||||
|
||||
|
@ -160,7 +157,7 @@ MYNTEYE_API extern std::set<LogSink *> log_sinks_global;
|
|||
// Added by chachi - a runtime global maximum log level. Defined in logging.cc
|
||||
MYNTEYE_API extern int log_severity_global;
|
||||
|
||||
inline void InitGoogleLogging(char */*argv*/) {
|
||||
inline void InitGoogleLogging(char * /*argv*/) {
|
||||
// Do nothing; this is ignored.
|
||||
}
|
||||
|
||||
|
@ -208,8 +205,8 @@ class MYNTEYE_API MessageLogger {
|
|||
|
||||
// Bound the logging level.
|
||||
const int kMaxVerboseLevel = 2;
|
||||
int android_level_index = std::min(std::max(FATAL, severity_),
|
||||
kMaxVerboseLevel) - FATAL;
|
||||
int android_level_index =
|
||||
std::min(std::max(FATAL, severity_), kMaxVerboseLevel) - FATAL;
|
||||
int android_log_level = android_log_levels[android_level_index];
|
||||
|
||||
// Output the log string the Android log at the appropriate level.
|
||||
|
@ -217,9 +214,7 @@ class MYNTEYE_API MessageLogger {
|
|||
|
||||
// Indicate termination if needed.
|
||||
if (severity_ == FATAL) {
|
||||
__android_log_write(ANDROID_LOG_FATAL,
|
||||
tag_.c_str(),
|
||||
"terminating.\n");
|
||||
__android_log_write(ANDROID_LOG_FATAL, tag_.c_str(), "terminating.\n");
|
||||
}
|
||||
#else
|
||||
// If not building on Android, log all output to std::cerr.
|
||||
|
@ -237,21 +232,24 @@ class MYNTEYE_API MessageLogger {
|
|||
}
|
||||
|
||||
// Return the stream associated with the logger object.
|
||||
std::stringstream &stream() { return stream_; }
|
||||
std::stringstream &stream() {
|
||||
return stream_;
|
||||
}
|
||||
|
||||
private:
|
||||
void LogToSinks(int severity) {
|
||||
time_t rawtime;
|
||||
struct tm* timeinfo;
|
||||
struct tm *timeinfo;
|
||||
|
||||
time (&rawtime);
|
||||
timeinfo = localtime(&rawtime);
|
||||
std::set<google::LogSink*>::iterator iter;
|
||||
time(&rawtime);
|
||||
timeinfo = localtime_r(&rawtime);
|
||||
std::set<google::LogSink *>::iterator iter;
|
||||
// Send the log message to all sinks.
|
||||
for (iter = google::log_sinks_global.begin();
|
||||
iter != google::log_sinks_global.end(); ++iter) {
|
||||
(*iter)->send(severity, file_.c_str(), filename_only_.c_str(), line_,
|
||||
timeinfo, stream_.str().c_str(), stream_.str().size());
|
||||
(*iter)->send(
|
||||
severity, file_.c_str(), filename_only_.c_str(), line_, timeinfo,
|
||||
stream_.str().c_str(), stream_.str().size());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -307,17 +305,19 @@ class MYNTEYE_API MessageLogger {
|
|||
// is not used" and "statement has no effect".
|
||||
class MYNTEYE_API LoggerVoidify {
|
||||
public:
|
||||
LoggerVoidify() { }
|
||||
LoggerVoidify() {}
|
||||
// This has to be an operator with a precedence lower than << but
|
||||
// higher than ?:
|
||||
void operator&(const std::ostream &/*s*/) { }
|
||||
void operator&(const std::ostream & /*s*/) {}
|
||||
};
|
||||
|
||||
// Log only if condition is met. Otherwise evaluates to void.
|
||||
#define LOG_IF(severity, condition) \
|
||||
(static_cast<int>(severity) > google::log_severity_global || !(condition)) ? \
|
||||
(void) 0 : LoggerVoidify() & \
|
||||
MessageLogger((char *)__FILE__, __LINE__, "native", severity).stream()
|
||||
(static_cast<int>(severity) > google::log_severity_global || !(condition)) \
|
||||
? (void)0 \
|
||||
: LoggerVoidify() & \
|
||||
MessageLogger((char *)__FILE__, __LINE__, "native", severity) \
|
||||
.stream()
|
||||
|
||||
// Log only if condition is NOT met. Otherwise evaluates to void.
|
||||
#define LOG_IF_FALSE(severity, condition) LOG_IF(severity, !(condition))
|
||||
|
@ -326,23 +326,23 @@ class MYNTEYE_API LoggerVoidify {
|
|||
// google3 code is discouraged and the following shortcut exists for
|
||||
// backward compatibility with existing code.
|
||||
#ifdef MYNTEYE_MAX_LOG_LEVEL
|
||||
# define LOG(n) LOG_IF(n, (n <= MYNTEYE_MAX_LOG_LEVEL))
|
||||
# define VLOG(n) LOG_IF(n, (n <= MYNTEYE_MAX_LOG_LEVEL))
|
||||
# define LG LOG_IF(INFO, (INFO <= MYNTEYE_MAX_LOG_LEVEL))
|
||||
# define VLOG_IF(n, condition) \
|
||||
#define LOG(n) LOG_IF(n, (n <= MYNTEYE_MAX_LOG_LEVEL))
|
||||
#define VLOG(n) LOG_IF(n, (n <= MYNTEYE_MAX_LOG_LEVEL))
|
||||
#define LG LOG_IF(INFO, (INFO <= MYNTEYE_MAX_LOG_LEVEL))
|
||||
#define VLOG_IF(n, condition) \
|
||||
LOG_IF(n, (n <= MYNTEYE_MAX_LOG_LEVEL) && condition)
|
||||
#else
|
||||
# define LOG(n) LOG_IF(n, true)
|
||||
# define VLOG(n) LOG_IF(n, true)
|
||||
# define LG LOG_IF(INFO, true)
|
||||
# define VLOG_IF(n, condition) LOG_IF(n, condition)
|
||||
#define LOG(n) LOG_IF(n, true)
|
||||
#define VLOG(n) LOG_IF(n, true)
|
||||
#define LG LOG_IF(INFO, true)
|
||||
#define VLOG_IF(n, condition) LOG_IF(n, condition)
|
||||
#endif
|
||||
|
||||
// Currently, VLOG is always on for levels below MYNTEYE_MAX_LOG_LEVEL.
|
||||
#ifndef MYNTEYE_MAX_LOG_LEVEL
|
||||
# define VLOG_IS_ON(x) (1)
|
||||
#define VLOG_IS_ON(x) (1)
|
||||
#else
|
||||
# define VLOG_IS_ON(x) (x <= MYNTEYE_MAX_LOG_LEVEL)
|
||||
#define VLOG_IS_ON(x) (x <= MYNTEYE_MAX_LOG_LEVEL)
|
||||
#endif
|
||||
|
||||
#ifdef MYNTEYE_OS_WIN // INFO is 2, change VLOG(2) to VLOG(4)
|
||||
|
@ -351,32 +351,34 @@ class MYNTEYE_API LoggerVoidify {
|
|||
#undef VLOG_IS_ON
|
||||
|
||||
#ifdef MYNTEYE_MAX_LOG_LEVEL
|
||||
# define VLOG(n) LOG_IF(n+2, (n+2 <= MYNTEYE_MAX_LOG_LEVEL))
|
||||
# define VLOG_IF(n, condition) \
|
||||
LOG_IF(n+2, (n+2 <= MYNTEYE_MAX_LOG_LEVEL) && condition)
|
||||
#define VLOG(n) LOG_IF(n + 2, (n + 2 <= MYNTEYE_MAX_LOG_LEVEL))
|
||||
#define VLOG_IF(n, condition) \
|
||||
LOG_IF(n + 2, (n + 2 <= MYNTEYE_MAX_LOG_LEVEL) && condition)
|
||||
#else
|
||||
# define VLOG(n) LOG_IF(n+2, true)
|
||||
# define VLOG_IF(n, condition) LOG_IF(n+2, condition)
|
||||
#define VLOG(n) LOG_IF(n + 2, true)
|
||||
#define VLOG_IF(n, condition) LOG_IF(n + 2, condition)
|
||||
#endif
|
||||
|
||||
#ifndef MYNTEYE_MAX_LOG_LEVEL
|
||||
# define VLOG_IS_ON(x) (1+2)
|
||||
#define VLOG_IS_ON(x) (1 + 2)
|
||||
#else
|
||||
# define VLOG_IS_ON(x) (x+2 <= MYNTEYE_MAX_LOG_LEVEL)
|
||||
#define VLOG_IS_ON(x) (x + 2 <= MYNTEYE_MAX_LOG_LEVEL)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef NDEBUG
|
||||
# define DLOG LOG
|
||||
#define DLOG LOG
|
||||
#else
|
||||
# define DLOG(severity) true ? (void) 0 : LoggerVoidify() & \
|
||||
MessageLogger((char *)__FILE__, __LINE__, "native", severity).stream()
|
||||
#define DLOG(severity) \
|
||||
true ? (void)0 \
|
||||
: LoggerVoidify() & \
|
||||
MessageLogger((char *)__FILE__, __LINE__, "native", severity) \
|
||||
.stream()
|
||||
#endif
|
||||
|
||||
|
||||
// Log a message and terminate.
|
||||
template<class T>
|
||||
template <class T>
|
||||
void LogMessageFatal(const char *file, int line, const T &message) {
|
||||
MessageLogger(file, line, "native", FATAL).stream() << message;
|
||||
}
|
||||
|
@ -384,24 +386,26 @@ void LogMessageFatal(const char *file, int line, const T &message) {
|
|||
// ---------------------------- CHECK macros ---------------------------------
|
||||
|
||||
// Check for a given boolean condition.
|
||||
#define CHECK(condition) LOG_IF_FALSE(FATAL, condition) \
|
||||
<< "Check failed: " #condition " "
|
||||
#define CHECK(condition) \
|
||||
LOG_IF_FALSE(FATAL, condition) << "Check failed: " #condition " "
|
||||
|
||||
#ifndef NDEBUG
|
||||
// Debug only version of CHECK
|
||||
# define DCHECK(condition) LOG_IF_FALSE(FATAL, condition) \
|
||||
<< "Check failed: " #condition " "
|
||||
#define DCHECK(condition) \
|
||||
LOG_IF_FALSE(FATAL, condition) << "Check failed: " #condition " "
|
||||
#else
|
||||
// Optimized version - generates no code.
|
||||
# define DCHECK(condition) if (false) LOG_IF_FALSE(FATAL, condition) \
|
||||
<< "Check failed: " #condition " "
|
||||
#define DCHECK(condition) \
|
||||
if (false) \
|
||||
LOG_IF_FALSE(FATAL, condition) << "Check failed: " #condition " "
|
||||
#endif // NDEBUG
|
||||
|
||||
// ------------------------- CHECK_OP macros ---------------------------------
|
||||
|
||||
// Generic binary operator check macro. This should not be directly invoked,
|
||||
// instead use the binary comparison macros defined below.
|
||||
#define CHECK_OP(val1, val2, op) LOG_IF_FALSE(FATAL, (val1 op val2)) \
|
||||
#define CHECK_OP(val1, val2, op) \
|
||||
LOG_IF_FALSE(FATAL, (val1 op val2)) \
|
||||
<< "Check failed: " #val1 " " #op " " #val2 " "
|
||||
|
||||
// Check_op macro definitions
|
||||
|
@ -414,20 +418,32 @@ void LogMessageFatal(const char *file, int line, const T &message) {
|
|||
|
||||
#ifndef NDEBUG
|
||||
// Debug only versions of CHECK_OP macros.
|
||||
# define DCHECK_EQ(val1, val2) CHECK_OP(val1, val2, ==)
|
||||
# define DCHECK_NE(val1, val2) CHECK_OP(val1, val2, !=)
|
||||
# define DCHECK_LE(val1, val2) CHECK_OP(val1, val2, <=)
|
||||
# define DCHECK_LT(val1, val2) CHECK_OP(val1, val2, <)
|
||||
# define DCHECK_GE(val1, val2) CHECK_OP(val1, val2, >=)
|
||||
# define DCHECK_GT(val1, val2) CHECK_OP(val1, val2, >)
|
||||
#define DCHECK_EQ(val1, val2) CHECK_OP(val1, val2, ==)
|
||||
#define DCHECK_NE(val1, val2) CHECK_OP(val1, val2, !=)
|
||||
#define DCHECK_LE(val1, val2) CHECK_OP(val1, val2, <=)
|
||||
#define DCHECK_LT(val1, val2) CHECK_OP(val1, val2, <)
|
||||
#define DCHECK_GE(val1, val2) CHECK_OP(val1, val2, >=)
|
||||
#define DCHECK_GT(val1, val2) CHECK_OP(val1, val2, >)
|
||||
#else
|
||||
// These versions generate no code in optimized mode.
|
||||
# define DCHECK_EQ(val1, val2) if (false) CHECK_OP(val1, val2, ==)
|
||||
# define DCHECK_NE(val1, val2) if (false) CHECK_OP(val1, val2, !=)
|
||||
# define DCHECK_LE(val1, val2) if (false) CHECK_OP(val1, val2, <=)
|
||||
# define DCHECK_LT(val1, val2) if (false) CHECK_OP(val1, val2, <)
|
||||
# define DCHECK_GE(val1, val2) if (false) CHECK_OP(val1, val2, >=)
|
||||
# define DCHECK_GT(val1, val2) if (false) CHECK_OP(val1, val2, >)
|
||||
#define DCHECK_EQ(val1, val2) \
|
||||
if (false) \
|
||||
CHECK_OP(val1, val2, ==)
|
||||
#define DCHECK_NE(val1, val2) \
|
||||
if (false) \
|
||||
CHECK_OP(val1, val2, !=)
|
||||
#define DCHECK_LE(val1, val2) \
|
||||
if (false) \
|
||||
CHECK_OP(val1, val2, <=)
|
||||
#define DCHECK_LT(val1, val2) \
|
||||
if (false) \
|
||||
CHECK_OP(val1, val2, <)
|
||||
#define DCHECK_GE(val1, val2) \
|
||||
if (false) \
|
||||
CHECK_OP(val1, val2, >=)
|
||||
#define DCHECK_GT(val1, val2) \
|
||||
if (false) \
|
||||
CHECK_OP(val1, val2, >)
|
||||
#endif // NDEBUG
|
||||
|
||||
// ---------------------------CHECK_NOTNULL macros ---------------------------
|
||||
|
@ -435,7 +451,7 @@ void LogMessageFatal(const char *file, int line, const T &message) {
|
|||
// Helpers for CHECK_NOTNULL(). Two are necessary to support both raw pointers
|
||||
// and smart pointers.
|
||||
template <typename T>
|
||||
T& CheckNotNullCommon(const char *file, int line, const char *names, T& t) {
|
||||
T &CheckNotNullCommon(const char *file, int line, const char *names, T &t) {
|
||||
if (t == NULL) {
|
||||
LogMessageFatal(file, line, std::string(names));
|
||||
}
|
||||
|
@ -443,12 +459,12 @@ T& CheckNotNullCommon(const char *file, int line, const char *names, T& t) {
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
T* CheckNotNull(const char *file, int line, const char *names, T* t) {
|
||||
T *CheckNotNull(const char *file, int line, const char *names, T *t) {
|
||||
return CheckNotNullCommon(file, line, names, t);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T& CheckNotNull(const char *file, int line, const char *names, T& t) {
|
||||
T &CheckNotNull(const char *file, int line, const char *names, T &t) {
|
||||
return CheckNotNullCommon(file, line, names, t);
|
||||
}
|
||||
|
||||
|
@ -462,7 +478,8 @@ T& CheckNotNull(const char *file, int line, const char *names, T& t) {
|
|||
CheckNotNull(__FILE__, __LINE__, "'" #val "' Must be non NULL", (val))
|
||||
#else
|
||||
// Optimized version - generates no code.
|
||||
#define DCHECK_NOTNULL(val) if (false)\
|
||||
#define DCHECK_NOTNULL(val) \
|
||||
if (false) \
|
||||
CheckNotNull(__FILE__, __LINE__, "'" #val "' Must be non NULL", (val))
|
||||
#endif // NDEBUG
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
// limitations under the License.
|
||||
#include <opencv2/highgui/highgui.hpp>
|
||||
|
||||
#include "mynteye/logger.h"
|
||||
#include "mynteye/api.h"
|
||||
#include "mynteye/logger.h"
|
||||
#include "mynteye/times.h"
|
||||
|
||||
MYNTEYE_USE_NAMESPACE
|
||||
|
|
|
@ -90,7 +90,9 @@ bool dir_exists(const std::string &p) {
|
|||
|
||||
std::vector<std::string> get_plugin_paths() {
|
||||
std::string info_path(MYNTEYE_SDK_INSTALL_DIR);
|
||||
info_path.append(MYNTEYE_OS_SEP "share" MYNTEYE_OS_SEP "mynteye" MYNTEYE_OS_SEP "build.info");
|
||||
info_path.append(
|
||||
MYNTEYE_OS_SEP "share" MYNTEYE_OS_SEP "mynteye" MYNTEYE_OS_SEP
|
||||
"build.info");
|
||||
|
||||
cv::FileStorage fs(info_path, cv::FileStorage::READ);
|
||||
if (!fs.isOpened()) {
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
#include <gflags/gflags.h>
|
||||
#endif
|
||||
|
||||
#include "mynteye/mynteye.h"
|
||||
#include "mynteye/logger.h"
|
||||
#include "mynteye/mynteye.h"
|
||||
|
||||
int main(int /*argc*/, char *argv[]) {
|
||||
// Set whether log messages go to stderr instead of logfiles
|
||||
|
|
1
third_party/glog
vendored
1
third_party/glog
vendored
|
@ -1 +0,0 @@
|
|||
Subproject commit 8d7a107d68c127f3f494bb7807b796c8c5a97a82
|
|
@ -20,8 +20,8 @@
|
|||
|
||||
#include "mynteye/device.h"
|
||||
#include "mynteye/files.h"
|
||||
#include "mynteye/types.h"
|
||||
#include "mynteye/logger.h"
|
||||
#include "mynteye/types.h"
|
||||
|
||||
#include "internal/types.h"
|
||||
|
||||
|
@ -231,7 +231,8 @@ void DeviceWriter::SaveAllInfos(const std::string &dir) {
|
|||
}
|
||||
SaveDeviceInfo(*device_->GetInfo(), dir + MYNTEYE_OS_SEP "device.info");
|
||||
SaveImgParams(
|
||||
*device_->GetInfo(), device_->GetImgParams(), dir + MYNTEYE_OS_SEP "img.params");
|
||||
*device_->GetInfo(), device_->GetImgParams(),
|
||||
dir + MYNTEYE_OS_SEP "img.params");
|
||||
auto &&m_in = device_->GetMotionIntrinsics();
|
||||
SaveImuParams(
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user