cmake_minimum_required( VERSION 2.8 ) project( UnitreeCameraSDK ) set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bins/) find_package(OpenCV 4 REQUIRED) if(OpenCV_FOUND) include_directories(${OpenCV_INCLUDE_DIR}) message(STATUS "OpenCV ${OpenCV_VERSION} FOUND") message(STATUS ${OpenCV_LIBS}) if(${OpenCV_VERSION_MAJOR} EQUAL 4) add_definitions(-DOPENCV_VERSION_4) elseif(${OpenCV_VERSION_MAJOR} LESS 4) add_definitions(-DOPENCV_VERSION_3) endif() else() message(FATAL_ERROR "OpenCV Library Not Found") endif() if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64") set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib/amd64/) link_directories(${PROJECT_SOURCE_DIR}/lib/amd64/) else() set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib/arm64/) link_directories(${PROJECT_SOURCE_DIR}/lib/arm64/) endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread") # add_subdirectory(${PROJECT_SOURCE_DIR}/examples) find_package(PythonInterp REQUIRED) find_package(PythonLibs REQUIRED) include_directories(${PYTHON_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/include) add_subdirectory(pybind11) set(SDKLIBS unitree_camera tstc_V4L2_xu_camera udev systemlog) # # Find the sources for each library # foreach(lib ${SDKLIBS}) # find_library(${lib}_LIBRARY NAMES ${lib} HINTS ${PROJECT_SOURCE_DIR}/lib/amd64/) # get_filename_component(${lib}_SOURCES "${${lib}_LIBRARY}" DIRECTORY) # endforeach() # # Build each library as a shared library # foreach(lib ${SDKLIBS}) # add_library(${lib} SHARED ${${lib}_SOURCES}) # set_target_properties(${lib} PROPERTIES LINKER_LANGUAGE CXX) # endforeach() pybind11_add_module(camera_interface cam_pyinterface.cpp) target_link_libraries(camera_interface ${SDKLIBS} ${PYTHON_LIBRARIES} ${OpenCV_LIBS}) # add_executable(camera_python_test cam_pyinterface.cpp) # target_link_libraries(camera_python_test ${SDKLIBS} ${PYTHON_LIBRARIES} ${OpenCV_LIBS})