CMake与BitBake以及特定的安装目录

huangapple go评论61阅读模式
英文:

cmake with bitbake and specific install directory

问题

I have an issue with installing my target to a specific directory by use of cmake managed build and bitbake (yocto).

在使用CMake管理构建和bitbake(Yocto)时,我遇到了一个将目标安装到特定目录的问题。

At CMakeLists.txt, I want to use the install() section to deploy my target to the specific directory e.g. /my/specific/directory.

在CMakeLists.txt中,我想使用install()部分将我的目标部署到特定目录,例如/my/specific/directory

At CMakeLists.txt this looks like:
install(TARGETS "${PROJECT_NAME}" RUNTIME DESTINATION my/specific/directory).
So, there would be no need at the bitbake recipe to implement an install section.

在CMakeLists.txt中,它看起来像这样:
install(TARGETS "${PROJECT_NAME}" RUNTIME DESTINATION my/specific/directory)
因此,在bitbake配方中不需要实现install部分。

By default, the cmake uses a prefix which derives from bitbake.conf and points to /usr. Therefore my target is installed to /usr/my/specific/directory.

默认情况下,CMake使用从bitbake.conf派生的prefix,并指向/usr。因此,我的目标被安装到/usr/my/specific/directory

At cmake documentation I have found to possibilities to modify the prefix:

  • Set the environment variable DESTDIR to overwrite the prefix
  • use cmake --install . --prefix /my/install/prefix

在CMake文档中,我发现了两种修改前缀的可能性:

  • 设置环境变量DESTDIR以覆盖前缀
  • 使用cmake --install . --prefix /my/install/prefix

In both cases I have no idea, how I have to implement this at the bitbake recipe that this would have an effect, when the do_install task is executed.

在这两种情况下,我不知道如何在bitbake配方中实现这一点,以使其在执行do_install任务时产生影响。

Has anyone of you a hint here?

你们中有人有提示吗?

英文:

I have an issue with installing my target to a specific directory by use of cmake managed build and bitbake (yocto).

At CMakeLists.txt, I want to use the install() section to deploy my target to the specific directory e.g. /my/specific/directory.

At CMakeLists.txt this looks like:
install(TARGETS "${PROJECT_NAME}" RUNTIME DESTINATION my/specific/directory).
So, there would be no need at the bitbake recipe to implement an install section.

By default, the cmake uses a prefix which derives from bitbake.conf and points to /usr. Therefore my target is installed to /usr/my/specific/directory.

At cmake documentation I have found to possibilities to modify the prefix:

  • Set the environment variable DESTDIR to overwrite the prefix
  • use cmake --install . --prefix /my/install/prefix

In both cases I have no idea, how I have to implement this at the bitbake recipe that this would have an effect, when the do_install task is executed.

Has anyone of you a hint here?

答案1

得分: 3

在你的BitBake配方中,你应该能够设置EXTRA_OECMAKE来传递选项给CMake,例如 EXTRA_OECMAKE= "--install-prefix /mydir"

但是,如果出现关于“Files/directories were installed but not shipped in any package:”的错误,你可以通过以下方式设置BitBake来安装这些文件:

FILES:${PN} = "/mydir"

(对于旧版本的Yocto,可以使用FILES_${PN})。参见这里

可能还有其他方法来实现相同的目标,我发现#yocto IRC频道可能会非常有帮助。

英文:

In your bitbake recipe you should be able to set EXTRA_OECMAKE to pass options to cmake e.g. EXTRA_OECMAKE= "--install-prefix /mydir".

But then with errors regarding Files/directories were installed but not shipped in any package: you can set bitbake to install the files by using:

FILES:${PN} = "/mydir"

(Or FILES_${PN} for older versions of Yocto). See here.

There may be other ways to achieve the same thing, the #yocto IRC channel can be quite helpful I find.

huangapple
  • 本文由 发表于 2023年5月11日 15:41:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/76225188.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定