diff --git a/Lib/include/CMakeLists.txt b/Lib/include/CMakeLists.txt new file mode 100644 index 0000000..0ac7863 --- /dev/null +++ b/Lib/include/CMakeLists.txt @@ -0,0 +1,123 @@ +# Copyright (c) 2017-2025 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +cmake_minimum_required(VERSION 3.0.2) +project(movidius_ncs_lib) + +# Find required packages +find_package(catkin REQUIRED COMPONENTS + roscpp + std_msgs +) + +# Find OpenCV (required for image processing) +find_package(OpenCV REQUIRED) + +# Find Intel Movidius NCS SDK +find_path(MVNC_INCLUDE_DIR mvnc.h + HINTS /opt/movidius/nc-sdk/include + PATHS /usr/include /usr/local/include +) + +find_library(MVNC_LIBRARY mvnc + HINTS /opt/movidius/nc-sdk/lib + PATHS /usr/lib /usr/local/lib +) + +if(NOT MVNC_INCLUDE_DIR OR NOT MVNC_LIBRARY) + message(WARNING "Intel Movidius NCS SDK not found. Please install it for full functionality.") +endif() + +# Catkin package configuration +catkin_package( + INCLUDE_DIRS include + LIBRARIES ${PROJECT_NAME} + CATKIN_DEPENDS roscpp std_msgs + DEPENDS OpenCV +) + +# Include directories +include_directories( + include + ${catkin_INCLUDE_DIRS} + ${OpenCV_INCLUDE_DIRS} + ${MVNC_INCLUDE_DIR} +) + +# Source files +set(SOURCES + ../src cpp/device.cpp + ../src cpp/exception.cpp + ../src cpp/exception_util.cpp + ../src cpp/graph.cpp + ../src cpp/ncs.cpp + ../src cpp/ncs_manager.cpp + ../src cpp/result.cpp + ../src cpp/tensor.cpp +) + +# Header files +set(HEADERS + include/lib/device.h + include/lib/exception.h + include/lib/exception_util.h + include/lib/graph.h + include/lib/mvnc_cpp.h + include/lib/ncs.h + include/lib/ncs_manager.h + include/lib/result.h + include/lib/tensor.h +) + +# Create library +add_library(${PROJECT_NAME} ${SOURCES}) + +# Link libraries +target_link_libraries(${PROJECT_NAME} + ${catkin_LIBRARIES} + ${OpenCV_LIBRARIES} + ${MVNC_LIBRARY} +) + +# Set compiler flags +set_target_properties(${PROJECT_NAME} PROPERTIES + CXX_STANDARD 14 + CXX_STANDARD_REQUIRED ON +) + +# Install headers +install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} +) + +# Install library +install(TARGETS ${PROJECT_NAME} + ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} +) + +# Export library for other packages to use +export(TARGETS ${PROJECT_NAME} + FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake" +) + +# Generate package configuration files +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/${PROJECT_NAME}-config.cmake.in" + "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" @ONLY) + +install(FILES + "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" + DESTINATION "${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake" +) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000..45343ab --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,71 @@ +# Copyright (c) 2017-2025 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +cmake_minimum_required(VERSION 3.0.2) + +# Find required packages +find_package(catkin REQUIRED COMPONENTS + roscpp + sensor_msgs + cv_bridge + image_transport + movidius_ncs_lib +) + +# Find OpenCV +find_package(OpenCV REQUIRED) + +# Include directories +include_directories( + ${catkin_INCLUDE_DIRS} + ${OpenCV_INCLUDE_DIRS} + ../Lib/include +) + +# Example applications +set(EXAMPLE_APPS + image_classification_example + image_detection_example + stream_classification_example + stream_detection_example + batch_processing_example + multi_camera_example + performance_benchmark_example + calibration_example +) + +# Build each example +foreach(app ${EXAMPLE_APPS}) + add_executable(${app} ${app}.cpp) + target_link_libraries(${app} + ${catkin_LIBRARIES} + ${OpenCV_LIBRARIES} + movidius_ncs_lib + ) + set_target_properties(${app} PROPERTIES + CXX_STANDARD 14 + CXX_STANDARD_REQUIRED ON + ) +endforeach() + +# Install examples +install(TARGETS ${EXAMPLE_APPS} + RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} +) + +# Install launch files +install(DIRECTORY ../ + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} + FILES_MATCHING PATTERN "*_example.launch" +) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..caac5d8 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,97 @@ +# Copyright (c) 2017-2025 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +cmake_minimum_required(VERSION 3.0.2) + +# Only build tests if testing is enabled +if(CATKIN_ENABLE_TESTING) + +# Find required packages for testing +find_package(catkin REQUIRED COMPONENTS + rostest + roscpp + sensor_msgs + cv_bridge + image_transport + movidius_ncs_lib +) + +find_package(OpenCV REQUIRED) +find_package(GTest REQUIRED) + +include_directories( + ${catkin_INCLUDE_DIRS} + ${OpenCV_INCLUDE_DIRS} + ${GTEST_INCLUDE_DIRS} + ../Lib/include +) + +# Unit tests +set(UNIT_TESTS + test_device + test_tensor + test_result + test_ncs_manager + test_exception_handling + test_performance +) + +# Integration tests +set(INTEGRATION_TESTS + test_image_classification + test_image_detection + test_stream_processing + test_multi_device +) + +# Build unit tests +foreach(test ${UNIT_TESTS}) + add_executable(${test} ${test}.cpp) + target_link_libraries(${test} + ${catkin_LIBRARIES} + ${OpenCV_LIBRARIES} + ${GTEST_LIBRARIES} + movidius_ncs_lib + pthread + ) + add_test(${test} ${test}) +endforeach() + +# Build integration tests +foreach(test ${INTEGRATION_TESTS}) + add_executable(${test} ${test}.cpp) + target_link_libraries(${test} + ${catkin_LIBRARIES} + ${OpenCV_LIBRARIES} + ${GTEST_LIBRARIES} + movidius_ncs_lib + pthread + ) +endforeach() + +# Add rostests +add_rostest(test_image_classification.test) +add_rostest(test_image_detection.test) +add_rostest(test_stream_processing.test) + +# Install test files +install(FILES + test_image_classification.test + test_image_detection.test + test_stream_processing.test + test_all.test + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/tests +) + +endif(CATKIN_ENABLE_TESTING) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt new file mode 100644 index 0000000..8fb3e7d --- /dev/null +++ b/tools/CMakeLists.txt @@ -0,0 +1,59 @@ +# Copyright (c) 2017-2025 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +cmake_minimum_required(VERSION 3.0.2) + +# Find required packages +find_package(catkin REQUIRED COMPONENTS + roscpp + sensor_msgs + cv_bridge + movidius_ncs_lib +) + +find_package(OpenCV REQUIRED) + +# Include directories +include_directories( + ${catkin_INCLUDE_DIRS} + ${OpenCV_INCLUDE_DIRS} + ../Lib/include +) + +# Tool applications +set(TOOL_APPS + performance_analyzer + model_converter + device_manager + thermal_monitor +) + +# Build each tool +foreach(app ${TOOL_APPS}) + add_executable(${app} ${app}.cpp) + target_link_libraries(${app} + ${catkin_LIBRARIES} + ${OpenCV_LIBRARIES} + movidius_ncs_lib + ) + set_target_properties(${app} PROPERTIES + CXX_STANDARD 14 + CXX_STANDARD_REQUIRED ON + ) +endforeach() + +# Install tools +install(TARGETS ${TOOL_APPS} + RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} +)