Update api & link libs
This commit is contained in:
parent
cd28fa58d3
commit
1fd44f7f0c
|
@ -34,6 +34,17 @@ LIST(APPEND CMAKE_PREFIX_PATH third_party/glog/_build)
|
||||||
find_package(glog REQUIRED)
|
find_package(glog REQUIRED)
|
||||||
message(STATUS "Found glog: ${glog_VERSION}")
|
message(STATUS "Found glog: ${glog_VERSION}")
|
||||||
|
|
||||||
|
if(WITH_API)
|
||||||
|
find_package(OpenCV REQUIRED)
|
||||||
|
message(STATUS "Found OpenCV: ${OpenCV_VERSION}")
|
||||||
|
|
||||||
|
if(OpenCV_VERSION VERSION_LESS 3.0)
|
||||||
|
add_definitions(-DUSE_OPENCV2)
|
||||||
|
else()
|
||||||
|
add_definitions(-DUSE_OPENCV3)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
LIST(APPEND CMAKE_MODULE_PATH cmake)
|
LIST(APPEND CMAKE_MODULE_PATH cmake)
|
||||||
|
|
||||||
include(CMakePackageConfigHelpers)
|
include(CMakePackageConfigHelpers)
|
||||||
|
@ -136,6 +147,9 @@ set(MYNTEYE_LINKLIBS
|
||||||
glog::glog
|
glog::glog
|
||||||
${UVC_LIB}
|
${UVC_LIB}
|
||||||
)
|
)
|
||||||
|
if(WITH_API)
|
||||||
|
list(APPEND MYNTEYE_LINKLIBS ${OpenCV_LIBS})
|
||||||
|
endif()
|
||||||
#message(STATUS "MYNTEYE_LINKLIBS: ${MYNTEYE_LINKLIBS}")
|
#message(STATUS "MYNTEYE_LINKLIBS: ${MYNTEYE_LINKLIBS}")
|
||||||
|
|
||||||
add_library(${MYNTEYE_NAME} SHARED ${MYNTEYE_SRCS})
|
add_library(${MYNTEYE_NAME} SHARED ${MYNTEYE_SRCS})
|
||||||
|
|
|
@ -21,6 +21,17 @@ make samples
|
||||||
|
|
||||||
## Run
|
## Run
|
||||||
|
|
||||||
|
Camera with api layer,
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./samples/_output/bin/api/camera_a
|
||||||
|
|
||||||
|
# Windows
|
||||||
|
.\samples\_output\bin\api\camera_a.bat
|
||||||
|
```
|
||||||
|
|
||||||
|
Camera with device layer,
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./samples/_output/bin/device/camera_d
|
./samples/_output/bin/device/camera_d
|
||||||
|
|
||||||
|
|
|
@ -7,5 +7,7 @@ MYNTEYE_USE_NAMESPACE
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
glog_init _(argc, argv);
|
glog_init _(argc, argv);
|
||||||
|
|
||||||
|
auto &&api = API::Create();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,13 @@
|
||||||
|
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
#include "mynteye/utils.h"
|
||||||
|
|
||||||
|
#include "device/device.h"
|
||||||
|
|
||||||
MYNTEYE_BEGIN_NAMESPACE
|
MYNTEYE_BEGIN_NAMESPACE
|
||||||
|
|
||||||
API::API() {
|
API::API(std::shared_ptr<Device> device) : device_(device) {
|
||||||
VLOG(2) << __func__;
|
VLOG(2) << __func__;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,4 +16,12 @@ API::~API() {
|
||||||
VLOG(2) << __func__;
|
VLOG(2) << __func__;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<API> API::Create() {
|
||||||
|
return Create(device::select());
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<API> API::Create(std::shared_ptr<Device> device) {
|
||||||
|
return std::make_shared<API>(device);
|
||||||
|
}
|
||||||
|
|
||||||
MYNTEYE_END_NAMESPACE
|
MYNTEYE_END_NAMESPACE
|
||||||
|
|
|
@ -2,14 +2,24 @@
|
||||||
#define MYNTEYE_API_H_
|
#define MYNTEYE_API_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "mynteye/mynteye.h"
|
#include "mynteye/mynteye.h"
|
||||||
|
|
||||||
MYNTEYE_BEGIN_NAMESPACE
|
MYNTEYE_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class Device;
|
||||||
|
|
||||||
class MYNTEYE_API API {
|
class MYNTEYE_API API {
|
||||||
public:
|
public:
|
||||||
API();
|
explicit API(std::shared_ptr<Device> device);
|
||||||
~API();
|
/*virtual*/ ~API();
|
||||||
|
|
||||||
|
static std::shared_ptr<API> Create();
|
||||||
|
static std::shared_ptr<API> Create(std::shared_ptr<Device> device);
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::shared_ptr<Device> device_;
|
||||||
};
|
};
|
||||||
|
|
||||||
MYNTEYE_END_NAMESPACE
|
MYNTEYE_END_NAMESPACE
|
||||||
|
|
Loading…
Reference in New Issue
Block a user