当前位置:网站首页>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
边栏推荐
- 4. File modification
- Recommended foreign websites for programmers to learn
- MySQL learning notes-10-tablespace recycling
- Daily question brushing plan-2-13 fingertip life
- Modeling specifications: naming conventions
- 【 kubernets series】 a Literature Study on the Safe exposure Applications of kubernets Service
- Precautions for single chip microcomputer anti reverse connection circuit
- 1003 emergency (25 points), "DIJ deformation"
- Analyze 菜单分析
- 技术分享 | undo 太大了怎么办
猜你喜欢

Introduction to robotframework (I) brief introduction and use

My C language learning record (blue bridge) -- under the pointer

Analyze menu analysis

Jenkins basic knowledge ----- detailed explanation of 03pipeline code

华为、H3C、思科命令对比,思维导图形式从基础、交换、路由三大方向介绍【转自微信公众号网络技术联盟站】

StrError & PERROR use yyds dry inventory

What is the investment value of iFLYTEK, which does not make money?

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

故障分析 | MySQL 耗尽主机内存一例分析

mysqldump数据备份
随机推荐
SD卡报错“error -110 whilst initialising SD card
【概念】Web 基础概念认知
Polymorphic day02
The next industry outlet: NFT digital collection, is it an opportunity or a foam?
[unity3d] GUI control
JS regular filtering and adding image prefixes in rich text
Performance analysis of user login TPS low and CPU full
XSS challenges绕过防护策略进行 XSS 注入
My C language learning records (blue bridge) -- files and file input and output
Descriptor implements ORM model
Pat 1046 shortest distance (20 points) simulation
Codeworks 5 questions per day (1700 average) - day 6
Mysql database operation
What are the principles of software design (OCP)
[ruoyi] enable Mini navigation bar
银行核心业务系统性能测试方法
Summary of Bible story reading
Selenium share
Leetcode problem solving -- 98 Validate binary search tree
Leetcode problem solving -- 108 Convert an ordered array into a binary search tree