diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index 713faec..36f8d50 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -68,3 +68,7 @@ add_subdirectory(device) # samples above uvc layer add_subdirectory(uvc) + +# tutorials + +add_subdirectory(tutorials) diff --git a/samples/tutorials/CMakeLists.txt b/samples/tutorials/CMakeLists.txt new file mode 100644 index 0000000..47a6d03 --- /dev/null +++ b/samples/tutorials/CMakeLists.txt @@ -0,0 +1,41 @@ +get_filename_component(DIR_NAME ${CMAKE_CURRENT_LIST_DIR} NAME) + +set_outdir( + "${OUT_DIR}/lib/${DIR_NAME}" + "${OUT_DIR}/lib/${DIR_NAME}" + "${OUT_DIR}/bin/${DIR_NAME}" +) + +# make_executable(NAME +# [SRCS src1 src2 ...]) +# [WITH_OPENCV]) +macro(make_executable NAME) + set(options WITH_OPENCV) + set(oneValueArgs) + set(multiValueArgs SRCS) + cmake_parse_arguments(THIS "${options}" "${oneValueArgs}" + "${multiValueArgs}" ${ARGN}) + + set(__link_libs mynteye) + set(__dll_search_paths ${PRO_DIR}/_install/bin) + if(THIS_WITH_OPENCV) + list(APPEND __link_libs ${OpenCV_LIBS}) + list(APPEND __dll_search_paths ${OpenCV_LIB_SEARCH_PATH}) + endif() + + add_executable(${NAME} ${THIS_SRCS}) + target_link_libraries(${NAME} ${__link_libs}) + target_create_scripts(${NAME} DLL_SEARCH_PATHS ${__dll_search_paths}) + + if(OS_WIN) + target_compile_definitions(${NAME} + PUBLIC GLOG_NO_ABBREVIATED_SEVERITIES + ) + endif() +endmacro() + +if(WITH_API) + +make_executable(get_device_info SRCS get_device_info.cc) + +endif() diff --git a/samples/tutorials/get_device_info.cc b/samples/tutorials/get_device_info.cc new file mode 100644 index 0000000..140a94b --- /dev/null +++ b/samples/tutorials/get_device_info.cc @@ -0,0 +1,20 @@ +#include + +#include "mynteye/api.h" + +MYNTEYE_USE_NAMESPACE + +int main(int argc, char *argv[]) { + auto &&api = API::Create(argc, argv); + + LOG(INFO) << "Device name: " << api->GetInfo(Info::DEVICE_NAME); + LOG(INFO) << "Serial number: " << api->GetInfo(Info::SERIAL_NUMBER); + LOG(INFO) << "Firmware version: " << api->GetInfo(Info::FIRMWARE_VERSION); + LOG(INFO) << "Hardware version: " << api->GetInfo(Info::HARDWARE_VERSION); + LOG(INFO) << "Spec version: " << api->GetInfo(Info::SPEC_VERSION); + LOG(INFO) << "Lens type: " << api->GetInfo(Info::LENS_TYPE); + LOG(INFO) << "IMU type: " << api->GetInfo(Info::IMU_TYPE); + LOG(INFO) << "Nominal baseline: " << api->GetInfo(Info::NOMINAL_BASELINE); + + return 0; +}