当前位置:网站首页>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
边栏推荐
- ArabellaCPC 2019(补题)
- Derivation of anti Park transform and anti Clarke transform formulas for motor control
- Single instance mode of encapsulating PDO with PHP in spare time
- 【若依(ruoyi)】启用迷你导航栏
- Redis cluster deployment based on redis5
- CSP date calculation
- Redis cache breakdown, cache penetration, cache avalanche
- 下一个行业风口:NFT 数字藏品,是机遇还是泡沫?
- Performance test method of bank core business system
- Pat 1046 shortest distance (20 points) simulation
猜你喜欢

Codeworks 5 questions per day (1700 average) - day 6

Problems encountered in 2022 work IV

JS regular filtering and adding image prefixes in rich text

mysqldump数据备份

【Kubernetes 系列】一文學會Kubernetes Service安全的暴露應用

OCR文字識別方法綜述

Performance analysis of user login TPS low and CPU full
How to do function test well

MySQL advanced notes

Microservice registration and discovery
随机推荐
Overview of OCR character recognition methods
BUUCTF刷题笔记——[极客大挑战 2019]EasySQL 1
3857 Mercator coordinate system converted to 4326 (WGS84) longitude and latitude coordinates
ArabellaCPC 2019(补题)
Web security SQL injection vulnerability (1)
Function knowledge points
[unity3d] GUI control
【 kubernets series】 a Literature Study on the Safe exposure Applications of kubernets Service
Analyze menu analysis
Analyze 菜单分析
Game theory matlab
Differences and application scenarios between resulttype and resultmap
Descriptor implements ORM model
What are the principles of software design (OCP)
The next industry outlet: NFT digital collection, is it an opportunity or a foam?
4. File modification
Add one to non negative integers in the array
JS regular filtering and adding image prefixes in rich text
Crazy, thousands of netizens are exploding the company's salary
My C language learning record (blue bridge) -- under the pointer