Bitbake 从本地来源创建 cmake 配方
Bitbake create cmake recipe from local sources
我正在尝试使用 cmake 配方构建一个 helloworld 包示例。我的问题是 bitbake 给我一个错误,因为它在 /tmp/work/core2-64-poky-linux/helloworld/0.1-r0 文件夹中找不到 CMakeLists.txt。
错误:
helloworld-0.1-r0 do_configure: Execution of '/path-to-tmp/tmp/work/core2-64-poky-linux/helloworld/0.1-r0/temp/run.do_configure.28001' failed with exit code 1:
CMake Error: The source directory "/path-to-tmp/tmp/work/core2-64-poky-linux/helloworld/0.1-r0/files" does not appear to contain CMakeLists.txt.
我的包裹在我的层meta-mylayer/recipes-core/helloworld :
meta-mylayer/
├── conf
│ └── layer.conf
├── COPYING.MIT
├── README
└── recipes-core
└── helloworld
├── files
│ ├── CMakeLists.txt
│ └── main_helloworld.c
└── helloworld_0.1.bb
我的 CMakeLists.txt :
cmake_minimum_required(VERSION 2.4)
project(helloworld)
file(GLOB_RECURSE files/*.c)
add_executable(app ${src_files})
install(TARGETS helloworld DESTINATION bin)
我的 helloworld_0.1.bb :
PN="helloworld"
PV="0.1"
P="${PN}-${PV}"
DESCRIPTION="This is my package helloworld"
LICENSE="CLOSED"
FILESEXTRAPATHS_prepend:="${THISDIR}/${PN}:"
RDEPENDS_${PN}+=""
DEPENDS+=""
DEPENDS+="cmake"
SRC_URI+="file://CMakeLists.txt file://main_helloworld.c"
S="${WORKDIR}/files"
inherit pkgconfig cmake
我在 /path-to-tmp/tmp/work/core2-64-poky-linux/helloworld/0.1-r0/*
中找不到我的文件
为什么没有复制文件?我正在使用 yocto Dunfell。
感谢您的帮助。
当您在 SRC_URI
中有文件时,它们会安装在 ${WORKDIR}
中。
以下食谱可以解决问题:
DESCRIPTION="This is my package helloworld"
LICENSE="CLOSED"
SRC_URI+="file://CMakeLists.txt file://main_helloworld.c"
S="${WORKDIR}"
inherit pkgconfig cmake
此外,您的 CMakeLists.txt
不应在 files
目录中找到文件。
S
设置为 ${WORKDIR}
,因为这是默认放置来自 file://
提取器的文件的地方。
DEPENDS
已经从您继承的 cmake bbclass 中获得了 cmake-native。你不需要依赖cmake,因为你依赖cmake-native(你需要在构建时执行 cmake,你不需要cmake headers或来源)。
添加的 FILESEXTRAPATHS
已经被 bitbake 默认使用(而且它也不匹配您的目录布局)。
PN
和PV
是从bb食谱的文件名中获取的,不需要重新设置。
我正在尝试使用 cmake 配方构建一个 helloworld 包示例。我的问题是 bitbake 给我一个错误,因为它在 /tmp/work/core2-64-poky-linux/helloworld/0.1-r0 文件夹中找不到 CMakeLists.txt。
错误:
helloworld-0.1-r0 do_configure: Execution of '/path-to-tmp/tmp/work/core2-64-poky-linux/helloworld/0.1-r0/temp/run.do_configure.28001' failed with exit code 1:
CMake Error: The source directory "/path-to-tmp/tmp/work/core2-64-poky-linux/helloworld/0.1-r0/files" does not appear to contain CMakeLists.txt.
我的包裹在我的层meta-mylayer/recipes-core/helloworld :
meta-mylayer/
├── conf
│ └── layer.conf
├── COPYING.MIT
├── README
└── recipes-core
└── helloworld
├── files
│ ├── CMakeLists.txt
│ └── main_helloworld.c
└── helloworld_0.1.bb
我的 CMakeLists.txt :
cmake_minimum_required(VERSION 2.4)
project(helloworld)
file(GLOB_RECURSE files/*.c)
add_executable(app ${src_files})
install(TARGETS helloworld DESTINATION bin)
我的 helloworld_0.1.bb :
PN="helloworld"
PV="0.1"
P="${PN}-${PV}"
DESCRIPTION="This is my package helloworld"
LICENSE="CLOSED"
FILESEXTRAPATHS_prepend:="${THISDIR}/${PN}:"
RDEPENDS_${PN}+=""
DEPENDS+=""
DEPENDS+="cmake"
SRC_URI+="file://CMakeLists.txt file://main_helloworld.c"
S="${WORKDIR}/files"
inherit pkgconfig cmake
我在 /path-to-tmp/tmp/work/core2-64-poky-linux/helloworld/0.1-r0/*
中找不到我的文件为什么没有复制文件?我正在使用 yocto Dunfell。
感谢您的帮助。
当您在 SRC_URI
中有文件时,它们会安装在 ${WORKDIR}
中。
以下食谱可以解决问题:
DESCRIPTION="This is my package helloworld"
LICENSE="CLOSED"
SRC_URI+="file://CMakeLists.txt file://main_helloworld.c"
S="${WORKDIR}"
inherit pkgconfig cmake
此外,您的 CMakeLists.txt
不应在 files
目录中找到文件。
S
设置为 ${WORKDIR}
,因为这是默认放置来自 file://
提取器的文件的地方。
DEPENDS
已经从您继承的 cmake bbclass 中获得了 cmake-native。你不需要依赖cmake,因为你依赖cmake-native(你需要在构建时执行 cmake,你不需要cmake headers或来源)。
添加的 FILESEXTRAPATHS
已经被 bitbake 默认使用(而且它也不匹配您的目录布局)。
PN
和PV
是从bb食谱的文件名中获取的,不需要重新设置。