Skip to content

Commit 305bd60

Browse files
authored
Update CMakeLists.txt
1 parent 130c8a4 commit 305bd60

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

yolox_ros_cpp/yolox_cpp/CMakeLists.txt

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,16 @@ if(YOLOX_USE_TFLITE)
6464
set(INCLUDES ${INCLUDES} ${TFLITE_INCLUDE_DIR})
6565
set(INCLUDES ${INCLUDES} ${ABSEIL_CPP_ICLUDE_DIR})
6666
set(INCLUDES ${INCLUDES} ${FLATBUFFERS_INCLUDE_DIR})
67+
set(TARGET_LIBS ${TFLITE_LIB_PATH}/libtensorflow-lite.so)
68+
target_include_directories(yolox_cpp PUBLIC ${INCLUDES})
6769
endif()
6870

6971
# onnxruntime
7072
if(YOLOX_USE_ONNXRUNTIME)
7173
find_library(ONNXRUNTIME NAMES onnxruntime)
7274
set(ENABLE_ONNXRUNTIME ON)
7375
set(TARGET_SRC src/yolox_onnxruntime.cpp)
76+
set(TARGET_LIBS onnxruntime)
7477
endif()
7578

7679
configure_file(
@@ -81,24 +84,13 @@ configure_file(
8184
ament_auto_add_library(yolox_cpp SHARED ${TARGET_SRC})
8285
ament_target_dependencies(yolox_cpp ${TARGET_DPENDENCIES})
8386
ament_export_dependencies(${TARGET_DPENDENCIES})
84-
85-
86-
if (YOLOX_USE_TENSORRT)
87-
target_link_libraries(yolox_cpp ${TARGET_LIBS})
88-
endif()
87+
target_link_libraries(yolox_cpp ${TARGET_LIBS})
8988

9089
if (YOLOX_USE_TFLITE)
91-
target_include_directories(yolox_cpp PUBLIC ${INCLUDES})
92-
target_link_libraries(yolox_cpp ${TFLITE_LIB_PATH}/libtensorflow-lite.so)
9390
ament_export_include_directories(${INCLUDES})
9491
install(DIRECTORY ${TFLITE_LIB_PATH}/ DESTINATION lib)
9592
endif()
9693

97-
if (YOLOX_USE_ONNXRUNTIME)
98-
target_link_libraries(yolox_cpp onnxruntime)
99-
endif()
100-
101-
10294
if(BUILD_TESTING)
10395
find_package(ament_lint_auto REQUIRED)
10496
ament_lint_auto_find_test_dependencies()

0 commit comments

Comments
 (0)