arrayfire / arrayfire/arrayfire

Cross-compilation fixes patch

未关闭
#2,262 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
build discuss
主要语言
C++
星标
4.9k
派生
555
平均合并
1 小时 24 分钟
30 天内合并 PR
1

描述

Here is a patch with modifications to allow building AF with cross-compilation for release 3.6.1.

[0001-fix-cmakelists-txt-for-yocto-build.patch.zip](https://github.com/arrayfire/arrayfire/files/2262781/0001-fix-cmakelists-txt-for-yocto-build.patch.zip)

I introduced 2 new flags:
- AF_BIN2CPP_ONLY
- AF_SKIP_PACKAGE

If AF_BIN2CPP_ONLY is ON, only bin2cpp is configured. Reason for this is that bin2cpp is a host binary compiled for the build machine architecture. In my case the build machine does not have all the necessary dependencies allowing a successful configure (cuda, opencl, freeimage, etc), and it sounds a bit silly to satisfy them when they are not used. I do have all the dependencies but for aarch64 only.

bitbake environment declares some flags upsetting CMake. Since I'm installing the binaries via a bitbake recipe, I don't need the CMake packaging and disabled it completely with AF_SKIP_PACKAGE set to ON.

Finally include(CTest) throws an error:
```
| CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
| THREADS_PTHREAD_ARG (advanced)
```
Since I build without test and run the arrayfire-python unit test instead, I moved include(CTest) inside the if(BUILD_TEST) ... statement.

This now allows me to build AF in my yocto stack.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。