Skip to content

Commit 9d6dc8a

Browse files
Merge pull request #37
Added all missing CMakeLists file
2 parents 801fb2f + e00dbfc commit 9d6dc8a

4 files changed

Lines changed: 350 additions & 0 deletions

File tree

Lib/include/CMakeLists.txt

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Copyright (c) 2017-2025 Intel Corporation
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
cmake_minimum_required(VERSION 3.0.2)
16+
project(movidius_ncs_lib)
17+
18+
# Find required packages
19+
find_package(catkin REQUIRED COMPONENTS
20+
roscpp
21+
std_msgs
22+
)
23+
24+
# Find OpenCV (required for image processing)
25+
find_package(OpenCV REQUIRED)
26+
27+
# Find Intel Movidius NCS SDK
28+
find_path(MVNC_INCLUDE_DIR mvnc.h
29+
HINTS /opt/movidius/nc-sdk/include
30+
PATHS /usr/include /usr/local/include
31+
)
32+
33+
find_library(MVNC_LIBRARY mvnc
34+
HINTS /opt/movidius/nc-sdk/lib
35+
PATHS /usr/lib /usr/local/lib
36+
)
37+
38+
if(NOT MVNC_INCLUDE_DIR OR NOT MVNC_LIBRARY)
39+
message(WARNING "Intel Movidius NCS SDK not found. Please install it for full functionality.")
40+
endif()
41+
42+
# Catkin package configuration
43+
catkin_package(
44+
INCLUDE_DIRS include
45+
LIBRARIES ${PROJECT_NAME}
46+
CATKIN_DEPENDS roscpp std_msgs
47+
DEPENDS OpenCV
48+
)
49+
50+
# Include directories
51+
include_directories(
52+
include
53+
${catkin_INCLUDE_DIRS}
54+
${OpenCV_INCLUDE_DIRS}
55+
${MVNC_INCLUDE_DIR}
56+
)
57+
58+
# Source files
59+
set(SOURCES
60+
../src cpp/device.cpp
61+
../src cpp/exception.cpp
62+
../src cpp/exception_util.cpp
63+
../src cpp/graph.cpp
64+
../src cpp/ncs.cpp
65+
../src cpp/ncs_manager.cpp
66+
../src cpp/result.cpp
67+
../src cpp/tensor.cpp
68+
)
69+
70+
# Header files
71+
set(HEADERS
72+
include/lib/device.h
73+
include/lib/exception.h
74+
include/lib/exception_util.h
75+
include/lib/graph.h
76+
include/lib/mvnc_cpp.h
77+
include/lib/ncs.h
78+
include/lib/ncs_manager.h
79+
include/lib/result.h
80+
include/lib/tensor.h
81+
)
82+
83+
# Create library
84+
add_library(${PROJECT_NAME} ${SOURCES})
85+
86+
# Link libraries
87+
target_link_libraries(${PROJECT_NAME}
88+
${catkin_LIBRARIES}
89+
${OpenCV_LIBRARIES}
90+
${MVNC_LIBRARY}
91+
)
92+
93+
# Set compiler flags
94+
set_target_properties(${PROJECT_NAME} PROPERTIES
95+
CXX_STANDARD 14
96+
CXX_STANDARD_REQUIRED ON
97+
)
98+
99+
# Install headers
100+
install(DIRECTORY include/${PROJECT_NAME}/
101+
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
102+
)
103+
104+
# Install library
105+
install(TARGETS ${PROJECT_NAME}
106+
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
107+
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
108+
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
109+
)
110+
111+
# Export library for other packages to use
112+
export(TARGETS ${PROJECT_NAME}
113+
FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake"
114+
)
115+
116+
# Generate package configuration files
117+
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/${PROJECT_NAME}-config.cmake.in"
118+
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" @ONLY)
119+
120+
install(FILES
121+
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
122+
DESTINATION "${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake"
123+
)

examples/CMakeLists.txt

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Copyright (c) 2017-2025 Intel Corporation
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
cmake_minimum_required(VERSION 3.0.2)
16+
17+
# Find required packages
18+
find_package(catkin REQUIRED COMPONENTS
19+
roscpp
20+
sensor_msgs
21+
cv_bridge
22+
image_transport
23+
movidius_ncs_lib
24+
)
25+
26+
# Find OpenCV
27+
find_package(OpenCV REQUIRED)
28+
29+
# Include directories
30+
include_directories(
31+
${catkin_INCLUDE_DIRS}
32+
${OpenCV_INCLUDE_DIRS}
33+
../Lib/include
34+
)
35+
36+
# Example applications
37+
set(EXAMPLE_APPS
38+
image_classification_example
39+
image_detection_example
40+
stream_classification_example
41+
stream_detection_example
42+
batch_processing_example
43+
multi_camera_example
44+
performance_benchmark_example
45+
calibration_example
46+
)
47+
48+
# Build each example
49+
foreach(app ${EXAMPLE_APPS})
50+
add_executable(${app} ${app}.cpp)
51+
target_link_libraries(${app}
52+
${catkin_LIBRARIES}
53+
${OpenCV_LIBRARIES}
54+
movidius_ncs_lib
55+
)
56+
set_target_properties(${app} PROPERTIES
57+
CXX_STANDARD 14
58+
CXX_STANDARD_REQUIRED ON
59+
)
60+
endforeach()
61+
62+
# Install examples
63+
install(TARGETS ${EXAMPLE_APPS}
64+
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
65+
)
66+
67+
# Install launch files
68+
install(DIRECTORY ../
69+
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
70+
FILES_MATCHING PATTERN "*_example.launch"
71+
)

tests/CMakeLists.txt

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Copyright (c) 2017-2025 Intel Corporation
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
cmake_minimum_required(VERSION 3.0.2)
16+
17+
# Only build tests if testing is enabled
18+
if(CATKIN_ENABLE_TESTING)
19+
20+
# Find required packages for testing
21+
find_package(catkin REQUIRED COMPONENTS
22+
rostest
23+
roscpp
24+
sensor_msgs
25+
cv_bridge
26+
image_transport
27+
movidius_ncs_lib
28+
)
29+
30+
find_package(OpenCV REQUIRED)
31+
find_package(GTest REQUIRED)
32+
33+
include_directories(
34+
${catkin_INCLUDE_DIRS}
35+
${OpenCV_INCLUDE_DIRS}
36+
${GTEST_INCLUDE_DIRS}
37+
../Lib/include
38+
)
39+
40+
# Unit tests
41+
set(UNIT_TESTS
42+
test_device
43+
test_tensor
44+
test_result
45+
test_ncs_manager
46+
test_exception_handling
47+
test_performance
48+
)
49+
50+
# Integration tests
51+
set(INTEGRATION_TESTS
52+
test_image_classification
53+
test_image_detection
54+
test_stream_processing
55+
test_multi_device
56+
)
57+
58+
# Build unit tests
59+
foreach(test ${UNIT_TESTS})
60+
add_executable(${test} ${test}.cpp)
61+
target_link_libraries(${test}
62+
${catkin_LIBRARIES}
63+
${OpenCV_LIBRARIES}
64+
${GTEST_LIBRARIES}
65+
movidius_ncs_lib
66+
pthread
67+
)
68+
add_test(${test} ${test})
69+
endforeach()
70+
71+
# Build integration tests
72+
foreach(test ${INTEGRATION_TESTS})
73+
add_executable(${test} ${test}.cpp)
74+
target_link_libraries(${test}
75+
${catkin_LIBRARIES}
76+
${OpenCV_LIBRARIES}
77+
${GTEST_LIBRARIES}
78+
movidius_ncs_lib
79+
pthread
80+
)
81+
endforeach()
82+
83+
# Add rostests
84+
add_rostest(test_image_classification.test)
85+
add_rostest(test_image_detection.test)
86+
add_rostest(test_stream_processing.test)
87+
88+
# Install test files
89+
install(FILES
90+
test_image_classification.test
91+
test_image_detection.test
92+
test_stream_processing.test
93+
test_all.test
94+
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/tests
95+
)
96+
97+
endif(CATKIN_ENABLE_TESTING)

tools/CMakeLists.txt

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Copyright (c) 2017-2025 Intel Corporation
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
cmake_minimum_required(VERSION 3.0.2)
16+
17+
# Find required packages
18+
find_package(catkin REQUIRED COMPONENTS
19+
roscpp
20+
sensor_msgs
21+
cv_bridge
22+
movidius_ncs_lib
23+
)
24+
25+
find_package(OpenCV REQUIRED)
26+
27+
# Include directories
28+
include_directories(
29+
${catkin_INCLUDE_DIRS}
30+
${OpenCV_INCLUDE_DIRS}
31+
../Lib/include
32+
)
33+
34+
# Tool applications
35+
set(TOOL_APPS
36+
performance_analyzer
37+
model_converter
38+
device_manager
39+
thermal_monitor
40+
)
41+
42+
# Build each tool
43+
foreach(app ${TOOL_APPS})
44+
add_executable(${app} ${app}.cpp)
45+
target_link_libraries(${app}
46+
${catkin_LIBRARIES}
47+
${OpenCV_LIBRARIES}
48+
movidius_ncs_lib
49+
)
50+
set_target_properties(${app} PROPERTIES
51+
CXX_STANDARD 14
52+
CXX_STANDARD_REQUIRED ON
53+
)
54+
endforeach()
55+
56+
# Install tools
57+
install(TARGETS ${TOOL_APPS}
58+
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
59+
)

0 commit comments

Comments
 (0)