ncnn

作者: 张亦风 | 来源:发表于2019-10-22 14:20 被阅读0次

    NCNN

    cmake 编写

    cmake_minimum_required(VERSION 3.5)
    include(CheckCXXCompilerFlag)
    CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
    CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
    if(COMPILER_SUPPORTS_CXX11)
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") 
    elseif(COMPILER_SUPPORTS_CXX0X)
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
    else()
        message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
    endif()
    find_package(OpenCV QUIET COMPONENTS core highgui imgproc imgcodecs)
    if(NOT OpenCV_FOUND)
        find_package(OpenCV REQUIRED COMPONENTS core highgui imgproc)
    endif()
    FIND_PACKAGE( OpenMP REQUIRED)
    if(OPENMP_FOUND)
        message("OPENMP FOUND")
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
        set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
    endif()
    include_directories(/disk2/face/ncnn/src
                    /disk2/face/LFFD-with-ncnn-master/src                    
    )
    include_directories(/disk2/face/ncnn/build/src)
    link_directories(/disk2/face/ncnn/build/install/lib)
    set(NCNN_EXAMPLE_LINK_LIBRARIES ncnn ${OpenCV_LIBS})
    if(NCNN_VULKAN)
        list(APPEND NCNN_EXAMPLE_LINK_LIBRARIES ${Vulkan_LIBRARY})
    endif()
    
    add_executable(squeeze1 test1.cpp )
    target_link_libraries(squeeze1 ${NCNN_EXAMPLE_LINK_LIBRARIES})
    
    

    相关文章

      网友评论

          本文标题:ncnn

          本文链接:https://www.haomeiwen.com/subject/ersqvctx.html