• cmakelist 添加第三方库


    在libtorch工程中添加一个dcn的库,编译出来的库名字是
    /data_4/everyday/0902/snake/snake-refinenet/dcn_cpp_plugin/myinstall/lib/libdcn_v2_cuda_forward_v2.so

    下面是完成的总的完成的正确的:

    cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
    project(snake-refinenet)
    
    
    SET(CMAKE_BUILD_TYPE "Debug")
    
    set(CMAKE_PREFIX_PATH "/data_4/everyday/0901/pytorch/torch")
    find_package(Torch REQUIRED)
    
    set(CMAKE_PREFIX_PATH "/home/yhl/software_install/opencv3.2")
    find_package(OpenCV REQUIRED)
    
    #include_directories("/data_4/everyday/0902/snake/snake-refinenet/dcn_cpp_plugin/dcn_v2.h")
    #link_directories("/data_4/everyday/0902/snake/snake-refinenet/dcn_cpp_plugin/myinstall/lib/libdcn_v2_cuda_forward_v2.so")
    #link_libraries(libdcn_v2_cuda_forward_v2)
    
    set(INC_DIR /data_4/everyday/0902/snake/snake-refinenet/dcn_cpp_plugin)
    set(LINK_DIR /data_4/everyday/0902/snake/snake-refinenet/dcn_cpp_plugin/myinstall/lib)
    include_directories(${INC_DIR})
    link_directories(${LINK_DIR})
    link_libraries(dcn_v2_cuda_forward_v2)
    
    
    add_executable(example-app example-app.cpp refine_det.cpp)
    target_link_libraries(example-app "${TORCH_LIBRARIES}")
    #target_link_libraries(example-app ${Boost_LIBRARIES})
    target_link_libraries(example-app ${OpenCV_LIBS})
    target_link_libraries(example-app dcn_v2_cuda_forward_v2)
    set_property(TARGET example-app PROPERTY CXX_STANDARD 11)
    
    

    一开始报错找不到
    /usr/bin/ld: 找不到 -llibdcn_v2_cuda_forward_v2
    /usr/bin/ld: 找不到 -llibdcn_v2_cuda_forward_v2

    原来是要把lib去掉啊
    link_libraries(dcn_v2_cuda_forward_v2)
    target_link_libraries(example-app dcn_v2_cuda_forward_v2)

  • 相关阅读:
    Nightwatch的介绍
    reduce的用法及实例
    什么是声明式渲染?
    H5自带的表单验证
    Flex弹性布局
    JS中的forEach,for in,for of和for的遍历优缺点及区别
    将博客搬至CSDN
    9 外观模式(Facade)
    8 代理模式(Proxy)
    7 装饰模式(Decorator)
  • 原文地址:https://www.cnblogs.com/yanghailin/p/13602395.html
Copyright © 2020-2023  润新知