Build pass without glog
This commit is contained in:
parent
02856194a0
commit
94ecacef6c
|
@ -44,6 +44,17 @@ message(STATUS "CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
|
||||||
|
|
||||||
# packages
|
# packages
|
||||||
|
|
||||||
|
find_package(Threads QUIET)
|
||||||
|
|
||||||
|
macro(target_link_threads NAME)
|
||||||
|
if(THREADS_HAVE_PTHREAD_ARG)
|
||||||
|
target_compile_options(PUBLIC ${NAME} "-pthread")
|
||||||
|
endif()
|
||||||
|
if(CMAKE_THREAD_LIBS_INIT)
|
||||||
|
target_link_libraries(${NAME} "${CMAKE_THREAD_LIBS_INIT}")
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
LIST(APPEND CMAKE_MODULE_PATH cmake)
|
LIST(APPEND CMAKE_MODULE_PATH cmake)
|
||||||
|
|
||||||
include(CMakePackageConfigHelpers)
|
include(CMakePackageConfigHelpers)
|
||||||
|
@ -176,6 +187,7 @@ endif()
|
||||||
|
|
||||||
add_library(${MYNTEYE_NAME} SHARED ${MYNTEYE_SRCS})
|
add_library(${MYNTEYE_NAME} SHARED ${MYNTEYE_SRCS})
|
||||||
target_link_libraries(${MYNTEYE_NAME} ${MYNTEYE_LINKLIBS})
|
target_link_libraries(${MYNTEYE_NAME} ${MYNTEYE_LINKLIBS})
|
||||||
|
target_link_threads(${MYNTEYE_NAME})
|
||||||
|
|
||||||
if(OS_WIN)
|
if(OS_WIN)
|
||||||
target_compile_definitions(${MYNTEYE_NAME}
|
target_compile_definitions(${MYNTEYE_NAME}
|
||||||
|
|
|
@ -29,7 +29,7 @@ option(WITH_DEVICE_INFO_REQUIRED "Build with device info required" ON)
|
||||||
option(WITH_BOOST "Include Boost support" ON)
|
option(WITH_BOOST "Include Boost support" ON)
|
||||||
|
|
||||||
# `make 3rdparty` could build glog submodule
|
# `make 3rdparty` could build glog submodule
|
||||||
option(WITH_GLOG "Include glog support" ON)
|
option(WITH_GLOG "Include glog support" OFF)
|
||||||
|
|
||||||
|
|
||||||
# packages
|
# packages
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
#define MYNTEYE_LOGGER_H_
|
#define MYNTEYE_LOGGER_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef WITH_GLOG
|
||||||
|
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
|
|
||||||
/** Helper to init glog with args. */
|
/** Helper to init glog with args. */
|
||||||
|
@ -62,4 +64,34 @@ struct glog_init {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
struct glog_init {
|
||||||
|
glog_init(int argc, char *argv[]) {
|
||||||
|
(void)argc;
|
||||||
|
(void)argv;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#define LOG(severity) std::cout
|
||||||
|
#define LOG_IF(severity, condition) std::cout
|
||||||
|
|
||||||
|
#define VLOG(verboselevel) std::cout
|
||||||
|
#define VLOG_IS_ON(verboselevel) false
|
||||||
|
|
||||||
|
#define CHECK(val) std::cout
|
||||||
|
|
||||||
|
#define CHECK_EQ(val1, val2) std::cout
|
||||||
|
#define CHECK_NE(val1, val2)
|
||||||
|
#define CHECK_LE(val1, val2)
|
||||||
|
#define CHECK_LT(val1, val2)
|
||||||
|
#define CHECK_GE(val1, val2)
|
||||||
|
#define CHECK_GT(val1, val2)
|
||||||
|
|
||||||
|
#define CHECK_NOTNULL(val)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // MYNTEYE_LOGGER_H_
|
#endif // MYNTEYE_LOGGER_H_
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <iostream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "mynteye/logger.h"
|
#include "mynteye/logger.h"
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,9 @@
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -27,6 +30,7 @@
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user