diff --git a/CMakeLists.txt b/CMakeLists.txt index dbb634d..d2f16df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,6 +44,17 @@ message(STATUS "CXX_FLAGS: ${CMAKE_CXX_FLAGS}") # 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) include(CMakePackageConfigHelpers) @@ -176,6 +187,7 @@ endif() add_library(${MYNTEYE_NAME} SHARED ${MYNTEYE_SRCS}) target_link_libraries(${MYNTEYE_NAME} ${MYNTEYE_LINKLIBS}) +target_link_threads(${MYNTEYE_NAME}) if(OS_WIN) target_compile_definitions(${MYNTEYE_NAME} diff --git a/cmake/Option.cmake b/cmake/Option.cmake index 8a414fd..e50601a 100644 --- a/cmake/Option.cmake +++ b/cmake/Option.cmake @@ -29,7 +29,7 @@ option(WITH_DEVICE_INFO_REQUIRED "Build with device info required" ON) option(WITH_BOOST "Include Boost support" ON) # `make 3rdparty` could build glog submodule -option(WITH_GLOG "Include glog support" ON) +option(WITH_GLOG "Include glog support" OFF) # packages diff --git a/include/mynteye/logger.h b/include/mynteye/logger.h index a3f24d2..cedb8ec 100644 --- a/include/mynteye/logger.h +++ b/include/mynteye/logger.h @@ -15,6 +15,8 @@ #define MYNTEYE_LOGGER_H_ #pragma once +#ifdef WITH_GLOG + #include /** Helper to init glog with args. */ @@ -62,4 +64,34 @@ struct glog_init { } }; +#else + +#include + +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_ diff --git a/src/internal/types.cc b/src/internal/types.cc index 2f05409..c5aa1e7 100644 --- a/src/internal/types.cc +++ b/src/internal/types.cc @@ -15,7 +15,7 @@ #include #include -#include +#include #include "mynteye/logger.h" diff --git a/src/uvc/uvc-v4l2.cc b/src/uvc/uvc-v4l2.cc index d99a85b..292804c 100755 --- a/src/uvc/uvc-v4l2.cc +++ b/src/uvc/uvc-v4l2.cc @@ -16,6 +16,9 @@ #include #include #include +#include +#include + #include #include #include @@ -27,6 +30,7 @@ #include #include +#include #include #include