日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > windows >内容正文

windows

在windows上,用cmake 交叉编译arm程序

發布時間:2024/3/24 windows 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 在windows上,用cmake 交叉编译arm程序 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

在windows上,用cmake 交叉編譯arm程序。生成器用nijia(或用MinGW,此時, cmake執行時,指定生成器為 -G “MinGW Makefiles”, 編譯用make).

CMakeLists.txt

cmake_minimum_required(VERSION 3.6)project(testApp)file(WRITE main.cpp "int main(void) { return 0; }")set(testApp "testApp")list(APPEND testApp_sourcesmain.cpp )add_executable(${testApp}${testApp_sources} )

toolchain.cmake

set(CMAKE_SYSTEM_NAME Generic) set(CMAKE_SYSTEM_PROCESSOR arm)set(CMAKE_C_COMPILER "arm-none-eabi-gcc.exe") set(CMAKE_CXX_COMPILER "arm-none-eabi-g++.exe")set(CMAKE_EXE_LINKER_FLAGS "--specs=nosys.specs" CACHE INTERNAL "")set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

在cmd 執行

cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE:PATH="..\toolchain.cmake" ..-- The C compiler identification is GNU 8.3.0 -- The CXX compiler identification is GNU 8.3.0 -- Check for working C compiler: D:/sigmastar/flythings/sdk/platforms/ssd/toolchain/bin/arm-pc-linux-gnueabihf-gcc.exe -- Check for working C compiler: D:/sigmastar/flythings/sdk/platforms/ssd/toolchain/bin/arm-pc-linux-gnueabihf-gcc.exe -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: D:/sigmastar/flythings/sdk/platforms/ssd/toolchain/bin/arm-pc-linux-gnueabihf-g++.exe -- Check for working CXX compiler: D:/sigmastar/flythings/sdk/platforms/ssd/toolchain/bin/arm-pc-linux-gnueabihf-g++.exe -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: D:/work/clip/code/test/build

編譯

>ninja [2/2] Linking CXX executable testApp

說下遇到的問題,出現以下錯誤:

D:/sigmastar/flythings/sdk/platforms/ssd/toolchain/bin/arm-pc-linux-gnueabihf-gccis not a full path to an existing compiler tool.Tell CMake where to find the compiler by setting either the environmentvariable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path tothe compiler, or to the compiler name if it is in the PATH.

原因是在window下,要把后綴也寫上。下面是不行的。

set(CMAKE_C_COMPILER "D:/sigmastar/flythings/sdk/platforms/ssd/toolchain/bin/arm-pc-linux-gnueabihf-gcc")

改成

set(CMAKE_C_COMPILER "D:/sigmastar/flythings/sdk/platforms/ssd/toolchain/bin/arm-pc-linux-gnueabihf-gcc.exe")

您的支持是我持續創作的動力!

總結

以上是生活随笔為你收集整理的在windows上,用cmake 交叉编译arm程序的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。