学习记录-CmakeLists.txt

#
# Copyright 2020 Xilinx Inc.
#
# 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.5)
project(In_Depth_Tutorial VERSION 1.2.0 LANGUAGES C CXX)
#引入外部依赖包,每个模块都会定义以下几个变量,<LibaryName>_FOUND,<LibaryName>_INCLUDE_DIR or <LibaryName>_INCLUDES 
#<LibaryName>_LIBRARY or <LibaryName>_LIBRARIES
find_package(OpenCV COMPONENTS opencv_core opencv_video opencv_videoio opencv_imgproc opencv_imgcodecs opencv_highgui),比如下边的OpenCV_FOUND
if(NOT OpenCV_FOUND)
  find_package(OpenCV_LIBS opencv_core opencv_video opencv_videoio opencv_imgproc opencv_imgcodecs opencv_highgui)
endif(NOT OpenCV_FOUND)
#对子文件夹项目进行cmake编译
add_subdirectory(myV4L2)
#控制代码的开启和关闭, cmake -DUSE_DRM=1表示打开
add_definitions("-DUSE_DRM")
find_path(DRM_PATH drm)
if(NOT ${DRM_PATH} EQUAL "DRM_PATH-NOTFOUND")
  set(CMAKE_REQUIRED_INCLUDES ${DRM_PATH}/drm)
endif()
message(STATUS "CMAKE_SYSROOT is ${CMAKE_SYSROOT}")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/app/include" "${CMAKE_SYSROOT}/usr/include/drm/" "${CMAKE_CURRENT_SOURCE_DIR}/myV4L2/include")
add_definitions()
#告诉工程生成一个可执行文件
add_executable(usb_input_multi_threads_refinedet_drm ${CMAKE_CURRENT_SOURCE_DIR}/app/test/usb_input_multi_threads_refinedet.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/app/src/decodethread.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/app/src/dputhread.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/app/src/guithread.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/app/src/sortthread.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/app/src/mythread.cpp

)
#该指令的作用为将目标文件与库文件进行链接
target_link_libraries(usb_input_multi_threads_refinedet_drm ${OpenCV}
 my_v4l2s
vitis_ai_library-refinedet
vitis_ai_library-model_config
json-c
glog
pthread
drm
vart-runner
xnnpp-xnnpp
)

猜你喜欢

转载自blog.csdn.net/wzx_numberone/article/details/121257642
今日推荐