Code Monkey home page Code Monkey logo

Comments (5)

skb666 avatar skb666 commented on June 21, 2024 2

在 component 里面 find吧,比如 examples/demo/main/CmakeLists.txt, 一般不需要编辑examples/demo/CmakeLists.txt

感谢,目前通过以下方法,已成功与 vcpkg 配合使用

  1. 在项目目录下 .config.mkconfig_defaults.mk 内配置 CONFIG_TOOLCHAIN_PATH="~/vcpkg/scripts/buildsystems/vcpkg.cmake"
  2. 新建组件目录 component/component_name
  3. 组件目录下 CMakeLists.txt 内引入包,如 curl
    find_package(CURL CONFIG REQUIRED)
    list(APPEND ADD_REQUIREMENTS CURL::libcurl)
    register_component()
  4. 项目目录下 main/CMakeLists.txtlist(APPEND ADD_REQUIREMENTS component_name)

from c_cpp_project_framework.

Neutree avatar Neutree commented on June 21, 2024

目前这个项目里面比较少考虑直接引用系统的包,值得探讨下实现方式。

  • 一种是像opencv这种直接提供了 cmake文件的,直接引用是最好的,可以把源码放在component下,也可以直接引用系统的,这是在 cmake 世界里面比较通用的方法,常用的开源项目应该都有人写过,搜一下应该就能找到
set (OpenCV_DIR opencv/lib/cmake/opencv4)
find_package(OpenCV REQUIRED)
  • 另外比较原始的方法就是可以直接将源码拉进来在cmakelists.txt文件加源码搜索路径,或者添加搜索 .so 和 .h 文件路径

from c_cpp_project_framework.

skb666 avatar skb666 commented on June 21, 2024

若使用 find_package 引入包,find_package 要在 project() 命令之后,我尝试将 include(${SDK_PATH}/tools/cmake/compile.cmake) 放到 project 之后,发现 python project.py build 未报错,但未编译出任何目标

from c_cpp_project_framework.

Neutree avatar Neutree commented on June 21, 2024

在 component 里面 find吧,比如 examples/demo/main/CmakeLists.txt, 一般不需要编辑examples/demo/CmakeLists.txt

from c_cpp_project_framework.

Neutree avatar Neutree commented on June 21, 2024

比如这样 https://github.com/sipeed/libmaix/blob/1b1f61c3f8864c4cad373b76797252298c58f9d6/examples/axpi_classification_cam/main/CMakeLists.txt#L3

from c_cpp_project_framework.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.