Update macros
This commit is contained in:
@@ -16,72 +16,70 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef _WIN32
|
||||
#define OS_WIN
|
||||
#ifdef _WIN64
|
||||
#define OS_WIN64
|
||||
#else
|
||||
#define OS_WIN32
|
||||
#endif
|
||||
#if defined(__MINGW32__) || defined(__MINGW64__)
|
||||
#define OS_MINGW
|
||||
#ifdef __MINGW64__
|
||||
#define OS_MINGW64
|
||||
#else
|
||||
#define OS_MINGW32
|
||||
#endif
|
||||
#elif defined(__CYGWIN__) || defined(__CYGWIN32__)
|
||||
#define OS_CYGWIN
|
||||
#endif
|
||||
#define MYNTEYE_OS_WIN
|
||||
#ifdef _WIN64
|
||||
#define MYNTEYE_OS_WIN64
|
||||
#else
|
||||
#define MYNTEYE_OS_WIN32
|
||||
#endif
|
||||
#if defined(__MINGW32__) || defined(__MINGW64__)
|
||||
#define MYNTEYE_OS_MINGW
|
||||
#ifdef __MINGW64__
|
||||
#define MYNTEYE_OS_MINGW64
|
||||
#else
|
||||
#define MYNTEYE_OS_MINGW32
|
||||
#endif
|
||||
#elif defined(__CYGWIN__) || defined(__CYGWIN32__)
|
||||
#define MYNTEYE_OS_CYGWIN
|
||||
#endif
|
||||
#elif __APPLE__
|
||||
#include "TargetConditionals.h"
|
||||
#if TARGET_IPHONE_SIMULATOR
|
||||
#define OS_IPHONE
|
||||
#define OS_IPHONE_SIMULATOR
|
||||
#elif TARGET_OS_IPHONE
|
||||
#define OS_IPHONE
|
||||
#elif TARGET_OS_MAC
|
||||
#define OS_MAC
|
||||
#else
|
||||
#error "Unknown Apple platform"
|
||||
#endif
|
||||
#include <TargetConditionals.h>
|
||||
#if TARGET_IPHONE_SIMULATOR
|
||||
#define MYNTEYE_OS_IPHONE
|
||||
#define MYNTEYE_OS_IPHONE_SIMULATOR
|
||||
#elif TARGET_OS_IPHONE
|
||||
#define MYNTEYE_OS_IPHONE
|
||||
#elif TARGET_OS_MAC
|
||||
#define MYNTEYE_OS_MAC
|
||||
#else
|
||||
#error "Unknown Apple platform"
|
||||
#endif
|
||||
#elif __ANDROID__
|
||||
#define OS_ANDROID
|
||||
#define MYNTEYE_OS_ANDROID
|
||||
#elif __linux__
|
||||
#define OS_LINUX
|
||||
#define MYNTEYE_OS_LINUX
|
||||
#elif __unix__
|
||||
#define OS_UNIX
|
||||
#define MYNTEYE_OS_UNIX
|
||||
#elif defined(_POSIX_VERSION)
|
||||
#define OS_POSIX
|
||||
#define MYNTEYE_OS_POSIX
|
||||
#else
|
||||
#error "Unknown compiler"
|
||||
#error "Unknown compiler"
|
||||
#endif
|
||||
|
||||
#ifdef OS_WIN
|
||||
#define DECL_EXPORT __declspec(dllexport)
|
||||
#define DECL_IMPORT __declspec(dllimport)
|
||||
#define DECL_HIDDEN
|
||||
#ifdef MYNTEYE_OS_WIN
|
||||
#define MYNTEYE_DECL_EXPORT __declspec(dllexport)
|
||||
#define MYNTEYE_DECL_IMPORT __declspec(dllimport)
|
||||
#define MYNTEYE_DECL_HIDDEN
|
||||
#else
|
||||
#define DECL_EXPORT __attribute__((visibility("default")))
|
||||
#define DECL_IMPORT __attribute__((visibility("default")))
|
||||
#define DECL_HIDDEN __attribute__((visibility("hidden")))
|
||||
#define MYNTEYE_DECL_EXPORT __attribute__((visibility("default")))
|
||||
#define MYNTEYE_DECL_IMPORT __attribute__((visibility("default")))
|
||||
#define MYNTEYE_DECL_HIDDEN __attribute__((visibility("hidden")))
|
||||
#endif
|
||||
|
||||
#if defined(OS_WIN) && !defined(OS_MINGW) && !defined(OS_CYGWIN)
|
||||
#define OS_SEP "\\"
|
||||
#if defined(MYNTEYE_OS_WIN) && !defined(MYNTEYE_OS_MINGW) && \
|
||||
!defined(MYNTEYE_OS_CYGWIN)
|
||||
#define MYNTEYE_OS_SEP "\\"
|
||||
#else
|
||||
#define OS_SEP "/"
|
||||
#define MYNTEYE_OS_SEP "/"
|
||||
#endif
|
||||
|
||||
#define STRINGIFY_HELPER(X) #X
|
||||
#define STRINGIFY(X) STRINGIFY_HELPER(X)
|
||||
#define MYNTEYE_STRINGIFY_HELPER(X) #X
|
||||
#define MYNTEYE_STRINGIFY(X) MYNTEYE_STRINGIFY_HELPER(X)
|
||||
|
||||
#define DISABLE_COPY(Class) \
|
||||
#define MYNTEYE_DISABLE_COPY(Class) \
|
||||
Class(const Class &) = delete; \
|
||||
Class &operator=(const Class &) = delete;
|
||||
|
||||
#define UNUSED(x) (void)x;
|
||||
|
||||
template <typename... T>
|
||||
void unused(T &&...) {}
|
||||
#define MYNTEYE_UNUSED(x) (void)x;
|
||||
|
||||
#endif // MYNTEYE_GLOBAL_H_
|
||||
|
||||
@@ -74,7 +74,7 @@ struct glog_init {
|
||||
}
|
||||
};
|
||||
|
||||
#define MAX_LOG_LEVEL google::INFO
|
||||
#define MYNTEYE_MAX_LOG_LEVEL google::INFO
|
||||
|
||||
#include "mynteye/miniglog.h"
|
||||
|
||||
|
||||
@@ -91,14 +91,6 @@
|
||||
#ifndef MYNTEYE_MINIGLOG_H_
|
||||
#define MYNTEYE_MINIGLOG_H_
|
||||
|
||||
#ifdef ANDROID
|
||||
# include <android/log.h>
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#endif // ANDROID
|
||||
|
||||
#include <algorithm>
|
||||
#include <ctime>
|
||||
#include <fstream>
|
||||
@@ -108,6 +100,18 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "mynteye/global.h"
|
||||
|
||||
#if defined(MYNTEYE_OS_ANDROID)
|
||||
#include <android/log.h>
|
||||
#elif defined(MYNTEYE_OS_WIN)
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#endif // ANDROID
|
||||
|
||||
// For appropriate definition of CERES_EXPORT macro.
|
||||
// Modified from ceres miniglog version [begin] -------------------------------
|
||||
//#include "ceres/internal/port.h"
|
||||
@@ -187,7 +191,7 @@ class CERES_EXPORT MessageLogger {
|
||||
~MessageLogger() {
|
||||
stream_ << "\n";
|
||||
|
||||
#ifdef ANDROID
|
||||
#if defined(MYNTEYE_OS_ANDROID)
|
||||
static const int android_log_levels[] = {
|
||||
ANDROID_LOG_FATAL, // LOG(FATAL)
|
||||
ANDROID_LOG_ERROR, // LOG(ERROR)
|
||||
@@ -362,11 +366,11 @@ class CERES_EXPORT LoggerVoidify {
|
||||
// LG is a convenient shortcut for LOG(INFO). Its use is in new
|
||||
// google3 code is discouraged and the following shortcut exists for
|
||||
// backward compatibility with existing code.
|
||||
#ifdef MAX_LOG_LEVEL
|
||||
# define LOG(n) LOG_IF(n, n <= MAX_LOG_LEVEL)
|
||||
# define VLOG(n) LOG_IF(n, n <= MAX_LOG_LEVEL)
|
||||
# define LG LOG_IF(INFO, INFO <= MAX_LOG_LEVEL)
|
||||
# define VLOG_IF(n, condition) LOG_IF(n, (n <= MAX_LOG_LEVEL) && condition)
|
||||
#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) LOG_IF(n, (n <= MYNTEYE_MAX_LOG_LEVEL) && condition)
|
||||
#else
|
||||
# define LOG(n) MessageLogger((char *)__FILE__, __LINE__, "native", n).stream() // NOLINT
|
||||
# define VLOG(n) MessageLogger((char *)__FILE__, __LINE__, "native", n).stream() // NOLINT
|
||||
@@ -374,11 +378,11 @@ class CERES_EXPORT LoggerVoidify {
|
||||
# define VLOG_IF(n, condition) LOG_IF(n, condition)
|
||||
#endif
|
||||
|
||||
// Currently, VLOG is always on for levels below MAX_LOG_LEVEL.
|
||||
#ifndef MAX_LOG_LEVEL
|
||||
// Currently, VLOG is always on for levels below MYNTEYE_MAX_LOG_LEVEL.
|
||||
#ifndef MYNTEYE_MAX_LOG_LEVEL
|
||||
# define VLOG_IS_ON(x) (1)
|
||||
#else
|
||||
# define VLOG_IS_ON(x) (x <= MAX_LOG_LEVEL)
|
||||
# define VLOG_IS_ON(x) (x <= MYNTEYE_MAX_LOG_LEVEL)
|
||||
#endif
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
# define MYNTEYE_API
|
||||
#else
|
||||
# ifdef MYNTEYE_EXPORTS
|
||||
# define MYNTEYE_API DECL_EXPORT
|
||||
# define MYNTEYE_API MYNTEYE_DECL_EXPORT
|
||||
# else
|
||||
# define MYNTEYE_API DECL_IMPORT
|
||||
# define MYNTEYE_API MYNTEYE_DECL_IMPORT
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -61,4 +61,11 @@ MYNTEYE_API_VERSION_CHECK( \
|
||||
const char MYNTEYE_SDK_ROOT_DIR[] = "@MYNTEYE_SDK_ROOT_DIR@";
|
||||
const char MYNTEYE_SDK_INSTALL_DIR[] = "@MYNTEYE_SDK_INSTALL_DIR@";
|
||||
|
||||
MYNTEYE_BEGIN_NAMESPACE
|
||||
|
||||
template <typename... T>
|
||||
void UNUSED(T &&...) {}
|
||||
|
||||
MYNTEYE_END_NAMESPACE
|
||||
|
||||
#endif // MYNTEYE_MYNTEYE_H_
|
||||
|
||||
Reference in New Issue
Block a user