当前位置:网站首页>How to write compile scripts compatible with arm and x86 (Makefile, cmakelists.txt, shell script)
How to write compile scripts compatible with arm and x86 (Makefile, cmakelists.txt, shell script)
2022-07-06 03:11:00 【Charlotteck】
Compilation compatibility mainly includes 3 In terms of ,1. CMakeLists.txt compatible ,2. Makefile compatible ,3. shell compatible
- CMakeLists.txt
IF(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
SET(CMAKE_CXX_FLAGS "-fPIC -DLINUX -m64 -Wall -Wno-unused-function -Wno-unused-parameter -std=c++11 ")
ELSEIF(CMAKE_HOST_SYSTEM_PROCESSOR MATCHS "aarch64")
SET(CMAKE_CXX_FLAGS "-fPIC -DLINUX -march=armv8-a -mabi=lp64 -mtune=tsv110 -fsigned-char -Wall -Wno-unused-function -Wno-unused-parameter -std=c++11 ")
ELSE()
SET(CMAKE_CXX_FLAGS "-fPIC -DLINUX -Wall -Wno-unused-function -Wno-unused-parameter -std=c++11 ")
ENDIF()
- Makefile
ifeq ($(shell arc), aarch64)
CPPFLAGS=-g -O2 -march=armv8-a -mabi=lp64 -mtune=tsv110 -fsigned-char
else
CPPFLAGS=-g -O2 -m64
endif
- shell
!/bin/bash
get_arch=`arch`
if [[ $get_arch =~ "x86_64" ]];then
echo "this is x86_64"
elif [[ $get_arch =~ "aarch64" ]];then
echo "this is arm64"
elif [[ $get_arch =~ "mips64" ]];then
echo "this is mips64"
else
echo "unknown!!"
fi
边栏推荐
- 微服务注册与发现
- 张丽俊:穿透不确定性要靠四个“不变”
- Web security SQL injection vulnerability (1)
- Is there a completely independent localization database technology
- [padding] an error is reported in the prediction after loading the model weight attributeerror: 'model' object has no attribute '_ place‘
- 下一个行业风口:NFT 数字藏品,是机遇还是泡沫?
- Leetcode problem solving -- 98 Validate binary search tree
- How to do function test well
- The difference between sizeof and strlen in C language
- Huawei, H3C, Cisco command comparison, mind map form from the basic, switching, routing three directions [transferred from wechat official account network technology alliance station]
猜你喜欢
Mysql database operation
Introduction to robotframework (I) brief introduction and use
#PAT#day10
[concept] Web basic concept cognition
【若依(ruoyi)】设置主题样式
Software design principles
银行核心业务系统性能测试方法
华为、H3C、思科命令对比,思维导图形式从基础、交换、路由三大方向介绍【转自微信公众号网络技术联盟站】
OCR文字識別方法綜述
Deeply analyze the chain 2+1 mode, and subvert the traditional thinking of selling goods?
随机推荐
技术分享 | undo 太大了怎么办
1003 emergency (25 points), "DIJ deformation"
Communication between microservices
resulttype和resultmap的区别和应用场景
Introduction to robotframework (II) app startup of appui automation
Descriptor implements ORM model
[Yu Yue education] basic reference materials of digital electronic technology of Xi'an University of Technology
Analyze menu analysis
下一个行业风口:NFT 数字藏品,是机遇还是泡沫?
Is there a completely independent localization database technology
全国大学生信息安全赛创新实践赛初赛---misc(永恒的夜)
适合程序员学习的国外网站推荐
微服务注册与发现
Analyze 菜单分析
3857墨卡托坐标系转换为4326 (WGS84)经纬度坐标
Handwriting database client
How does yyds dry inventory deal with repeated messages in the consumption process?
2022工作中遇到的问题四
[ruoyi] ztree custom icon (iconskin attribute)
Audio audiorecord binder communication mechanism