Replies: 1 comment 1 reply
-
|
对于 cmake 项目可以自己编写 cross.cmake 定义工具链位置、参数等,示例如下 if (NOT DEFINED TRIMUI_PREFIX)
set(TRIMUI_PREFIX /usr/local/aarch64-linux-gnu-7.5.0-linaro/)
endif ()
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(CMAKE_FIND_ROOT_PATH ${TRIMUI_PREFIX})
set(CMAKE_PREFIX_PATH ${TRIMUI_PREFIX}include/dbus-1.0;${TRIMUI_PREFIX}lib/dbus-1.0)
set(TRIMUI_TOOL_PREFIX ${CMAKE_SYSTEM_PROCESSOR}-linux-gnu-)
# Specify the cross compiler
set(CMAKE_C_COMPILER ${TRIMUI_TOOL_PREFIX}gcc)
set(CMAKE_CXX_COMPILER ${TRIMUI_TOOL_PREFIX}g++)
set(STRIP ${TRIMUI_TOOL_PREFIX}strip)
# Search for programs in the build host directories
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)编译参数例子 cmake -B build-wiliwili -G Ninja -S src/wiliwili -DCMAKE_TOOLCHAIN_FILE=cross.cmake \
-DCMAKE_BUILD_TYPE=Release -DPLATFORM_DESKTOP=ON相关文档 https://cmake.org/cmake/help/book/mastering-cmake/chapter/Cross%20Compiling%20With%20CMake.html |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
我看到了原本是支持linux系统上编译的,但是我想在交叉编译给另外的嵌入式linux系统上去用,看了下readme里的介绍,似乎并没有说怎么指定交叉编译工具链、交叉编译库啥的路径配置啥的。
想参考switch这类的编译,发现编译规则隐藏的又比较深,不知道是否有啥统一的地方可以做这种配置,让人可以很容易移植到其它linux系统上。
Beta Was this translation helpful? Give feedback.
All reactions