Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build-artifacts的cmake集成问题 #1671

Closed
wsw0108 opened this issue Sep 14, 2021 · 10 comments
Closed

build-artifacts的cmake集成问题 #1671

wsw0108 opened this issue Sep 14, 2021 · 10 comments
Milestone

Comments

@wsw0108
Copy link
Contributor

wsw0108 commented Sep 14, 2021

描述问题

Windows平台,以下配置,xmake f -c -v -D编译magnum时失败

add_requireconfs("*", {build = true})
add_requires("magnum-plugins", {configs = {plugin_static = true, tinygltfimporter = true, stbimageimporter = true}})
add_requireconfs("magnum-plugins.magnum", {configs = {plugin_static = true, deprecated = false, glfw = true, anysceneimporter = true, anyimageimporter = true}})

因为magnum-plugins的tinygltfimporter 依赖 magnum的anyimageimporter,所以必须得有第二个requireconfs

期待的结果

magnum依赖的glfw能够通过{build = true}从源码编译。

错误信息

如果是xmake相关编译问题,请加上-vD参数运行,并给出完整编译输出信息以及执行的完整命令,例如:

$ xmake f -vD -c
CMake Error at D:/packages/xmake/g/glfw/3.3.4/b28486932c4340c9b8517e00cf266130/lib/cmake/glfw3/glfw3Targets.cmake:68 (message):
  The imported target "glfw" references the file

     "C:/Users/runneradmin/AppData/Local/.xmake/packages/g/glfw/3.3.4/b28486932c4340c9b8517e00cf266130/lib/glfw3.lib"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "D:/packages/xmake/g/glfw/3.3.4/b28486932c4340c9b8517e00cf266130/lib/cmake/glfw3/glfw3Targets.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  D:/packages/xmake/g/glfw/3.3.4/b28486932c4340c9b8517e00cf266130/lib/cmake/glfw3/glfw3Config.cmake:1 (include)
  modules/FindGLFW.cmake:52 (find_package)
  src/Magnum/Platform/CMakeLists.txt:222 (find_package)


-- Configuring incomplete, errors occurred!
$ xmake -vD
logs...

如果日志太多,可以上传附件,但必须完整,否则一率标记为 Invalid。

相关环境

请提供编译和运行环境信息,下面是一些必须填写的基础信息,便于我们针对性排查问题:

  • xmake版本:2.5.7
  • xmake运行平台:Windows
  • xmake目标平台:Windows

其他信息

从build-artifacts下载的glfw,D:/packages/xmake/g/glfw/3.3.4/b28486932c4340c9b8517e00cf266130/lib/cmake/glfw3/glfw3Targets.cmake中的glfw的安装路径和本地的不匹配。

@waruqi waruqi added this to the v2.5.8 milestone Sep 14, 2021
@waruqi
Copy link
Member

waruqi commented Sep 14, 2021

add_requireconfs("*", {build = true})

包依赖路径以 . 分隔,例如 foo.bar.zyx,而 * 只能单级匹配,你要匹配所有,需要用 **

比如试下:

add_requireconfs("**.glfw", {build = true})

或者

add_requireconfs("magnum-plugins.*.glfw", {build = true})

@waruqi
Copy link
Member

waruqi commented Sep 14, 2021

从build-artifacts下载的glfw,D:/packages/xmake/g/glfw/3.3.4/b28486932c4340c9b8517e00cf266130/lib/cmake/glfw3/glfw3Targets.cmake中的glfw的安装路径和本地的不匹配。

这个问题,我回头会改进下

@wsw0108
Copy link
Contributor Author

wsw0108 commented Sep 15, 2021

add_requireconfs("*", {build = true})

包依赖路径以 . 分隔,例如 foo.bar.zyx,而 * 只能单级匹配,你要匹配所有,需要用 **

比如试下:

add_requireconfs("**.glfw", {build = true})

或者

add_requireconfs("magnum-plugins.*.glfw", {build = true})

感谢。这个可以的。

@waruqi
Copy link
Member

waruqi commented Sep 17, 2021

从build-artifacts下载的glfw,D:/packages/xmake/g/glfw/3.3.4/b28486932c4340c9b8517e00cf266130/lib/cmake/glfw3/glfw3Targets.cmake中的glfw的安装路径和本地的不匹配。

这个问题,我也修复了,安装后会自动修复下里面的路径。。xmake update -s dev

@waruqi waruqi closed this as completed Sep 17, 2021
@xq114
Copy link
Contributor

xq114 commented Sep 17, 2021

从build-artifacts下载的glfw,D:/packages/xmake/g/glfw/3.3.4/b28486932c4340c9b8517e00cf266130/lib/cmake/glfw3/glfw3Targets.cmake中的glfw的安装路径和本地的不匹配。

这个问题,我也修复了,安装后会自动修复下里面的路径。。xmake update -s dev

这个修复还不够,

local filepaths = {path.join(librarydir, "cmake", "*", "*.cmake")}

https://cmake.org/cmake/help/latest/command/find_package.html#search-procedure

这里的search procedure能找到的文件都应该要修复的;或者也可以在package中手动指定要修复的文件

@waruqi
Copy link
Member

waruqi commented Sep 17, 2021

他这个也有点不对么,win下的这些,怎么没 lib/cmake/*/*.cmake 的?

<prefix>/                                                       (W)
<prefix>/(cmake|CMake)/                                         (W)
<prefix>/<name>*/                                               (W)
<prefix>/<name>*/(cmake|CMake)/                                 (W)
<prefix>/<name>*/(lib/<arch>|lib*|share)/cmake/<name>*/         (W/U)
<prefix>/<name>*/(lib/<arch>|lib*|share)/<name>*/               (W/U)
<prefix>/<name>*/(lib/<arch>|lib*|share)/<name>*/(cmake|CMake)/ (W/U)

@xq114
Copy link
Contributor

xq114 commented Sep 17, 2021

The tables below show the directories searched. Each entry is meant for installation trees following Windows (W), UNIX (U), or Apple (A) conventions.

意思是这个表里面都会找,后面的括号表示是哪一种convention(用其他系统的convention也能找到)。另外package import/export也要修复一下

@waruqi
Copy link
Member

waruqi commented Sep 17, 2021

好麻烦,我直接改成全量查找了

    local filepaths = {path.join(package:installdir(), "**.cmake")}

@xq114
Copy link
Contributor

xq114 commented Sep 17, 2021

好麻烦,我直接改成全量查找了

    local filepaths = {path.join(package:installdir(), "**.cmake")}

其实排除include文件夹就够了,一般一个package 90%文件在include下面(除非doc也被包括了)

@waruqi
Copy link
Member

waruqi commented Sep 17, 2021

排除了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants