From 370114db37468e546d60c377f6e71fa5aeb92799 Mon Sep 17 00:00:00 2001 From: wanpiqiu123 <46051943+wanpiqiu123@users.noreply.github.com> Date: Sat, 6 Jul 2019 10:42:23 +0800 Subject: [PATCH] verified something and made it possible to run on a OSX machine (videos input only) --- CMakeLists.txt | 5 +++++ main.cpp | 6 +++--- others/include/camera/camera_wrapper.h | 2 +- others/include/serial/serial.h | 2 +- others/src/serial/serial.cpp | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dae52f9..e54c7c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,8 @@ FIND_PACKAGE(Eigen3 REQUIRED) FIND_PACKAGE(OpenCV 3 REQUIRED) FIND_PACKAGE(Threads) +LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/others) + INCLUDE_DIRECTORIES(${EIGEN3_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/energy/include) INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/armor/include) @@ -42,6 +44,9 @@ IF (CMAKE_SYSTEM_NAME MATCHES "Linux") ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Windows") MESSAGE(STATUS "current platform: Windows") TARGET_LINK_LIBRARIES(${BIN_NAME} "${PROJECT_SOURCE_DIR}/others/MVCAMSDK_X64.lib") +ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Darwin") + MESSAGE(STATUS "current platform: Mac") + TARGET_LINK_LIBRARIES(${BIN_NAME} "${PROJECT_SOURCE_DIR}/others/libmvsdk.dylib") ELSE () MESSAGE(STATUS "Unsupport platform: ${CMAKE_SYSTEM_NAME}") ENDIF() diff --git a/main.cpp b/main.cpp index 624fb61..9ad9f28 100644 --- a/main.cpp +++ b/main.cpp @@ -26,7 +26,7 @@ using namespace std; mcu_data mcuData = { 0, 0, - ARMOR_STATE, + BIG_ENERGY_STATE, 0, 1, ENEMY_RED, @@ -56,8 +56,8 @@ int main(int argc, char *argv[]) { video_gimble = new CameraWrapper(0, "armor"); video_chassis = new CameraWrapper(1, "energy"); } else { - video_gimble = new VideoWrapper("/home/sun/项目/energy_video/energy_test.avi"); - video_chassis = new VideoWrapper("/home/sun/项目/energy_video/energy_test.avi"); + video_gimble = new VideoWrapper("/Users/leo/Desktop/videos/170.avi"); + video_chassis = new VideoWrapper("/Users/leo/Desktop/videos/170.avi"); } if (video_gimble->init()) { LOGM("video_armor source initialization successfully."); diff --git a/others/include/camera/camera_wrapper.h b/others/include/camera/camera_wrapper.h index e6f9d75..06496a8 100644 --- a/others/include/camera/camera_wrapper.h +++ b/others/include/camera/camera_wrapper.h @@ -16,7 +16,7 @@ #include "camera/wrapper_head.h" #ifdef Windows #include "camera/CameraApi.h" -#elif defined(Linux) +#elif defined(Linux) || defined(Darwin) #include "camera/camera_api.h" #endif diff --git a/others/include/serial/serial.h b/others/include/serial/serial.h index e6a525b..5419604 100644 --- a/others/include/serial/serial.h +++ b/others/include/serial/serial.h @@ -29,7 +29,7 @@ private: DWORD dwCommEvents; }; -#elif defined(Linux) +#elif defined(Linux) || defined(Darwin) #include #include diff --git a/others/src/serial/serial.cpp b/others/src/serial/serial.cpp index b292f97..f9c1507 100644 --- a/others/src/serial/serial.cpp +++ b/others/src/serial/serial.cpp @@ -174,7 +174,7 @@ bool Serial::ReadData(unsigned char *buffer, unsigned int length) { return bResult; } -#elif defined(Linux) +#elif defined(Linux) || defined(Darwin) #include