当前位置:网站首页>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
边栏推荐
- [ruoyi] set theme style
- XSS challenges绕过防护策略进行 XSS 注入
- [kubernetes series] learn the exposed application of kubernetes service security
- Problems encountered in 2022 work IV
- NR modulation 1
- Overview of OCR character recognition methods
- Deeply analyze the chain 2+1 mode, and subvert the traditional thinking of selling goods?
- Handwriting database client
- The next industry outlet: NFT digital collection, is it an opportunity or a foam?
- Apt installation ZABBIX
猜你喜欢
PMP practice once a day | don't get lost in the exam -7.5
How to do function test well
Codeworks 5 questions per day (1700 average) - day 6
Performance test method of bank core business system
深入探究指针及指针类型
OCR文字识别方法综述
[kubernetes series] learn the exposed application of kubernetes service security
Is there a completely independent localization database technology
Analyze menu analysis
Taobao focus map layout practice
随机推荐
StrError & PERROR use yyds dry inventory
【Unity3D】GUI控件
深度解析指针与数组笔试题
NR modulation 1
Handwriting database client
[kubernetes series] learn the exposed application of kubernetes service security
The next industry outlet: NFT digital collection, is it an opportunity or a foam?
Leetcode problem solving -- 173 Binary search tree iterator
BUUCTF刷题笔记——[极客大挑战 2019]EasySQL 1
全国大学生信息安全赛创新实践赛初赛---misc(永恒的夜)
Era5 reanalysis data download strategy
SD卡报错“error -110 whilst initialising SD card
C language - Blue Bridge Cup - promised score
Solution: attributeerror: 'STR' object has no attribute 'decode‘
[ruoyi] set theme style
Derivation of anti Park transform and anti Clarke transform formulas for motor control
Analyze menu analysis
Introduction to robotframework (III) Baidu search of webui automation
How to choose PLC and MCU?
Résumé des méthodes de reconnaissance des caractères ocr