当前位置:网站首页>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
边栏推荐
- [Yu Yue education] basic reference materials of digital electronic technology of Xi'an University of Technology
- ERA5再分析资料下载攻略
- 【Unity3D】GUI控件
- My C language learning record (blue bridge) -- on the pointer
- Linear regression and logistic regression
- SD卡报错“error -110 whilst initialising SD card
- Pat 1046 shortest distance (20 points) simulation
- js 正则过滤和增加富文本中图片前缀
- Linear programming matlab
- 【若依(ruoyi)】启用迷你导航栏
猜你喜欢
[pointer training - eight questions]
Buuctf question brushing notes - [geek challenge 2019] easysql 1
Eight super classic pointer interview questions (3000 words in detail)
Linear regression and logistic regression
The real machine cannot access the shooting range of the virtual machine, and the real machine cannot Ping the virtual machine
[ruoyi] enable Mini navigation bar
如何做好功能测试
Performance test method of bank core business system
下一个行业风口:NFT 数字藏品,是机遇还是泡沫?
XSS challenges绕过防护策略进行 XSS 注入
随机推荐
银行核心业务系统性能测试方法
Problems encountered in 2022 work IV
2.12 simulation
建模规范:命名规范
CobaltStrike-4.4-K8修改版安装使用教程
Taobao focus map layout practice
Distributed service framework dobbo
Codeforces 5 questions par jour (1700 chacune) - jour 6
Derivation of anti Park transform and anti Clarke transform formulas for motor control
下一个行业风口:NFT 数字藏品,是机遇还是泡沫?
3857墨卡托坐标系转换为4326 (WGS84)经纬度坐标
Prototype design
[network security interview question] - how to penetrate the test file directory through
真机无法访问虚拟机的靶场,真机无法ping通虚拟机
SD card reports an error "error -110 whilst initializing SD card
Maturity of master data management (MDM)
Audio-AudioRecord Binder通信机制
Some problem records of AGP gradle
原型图设计
These are not very good