当前位置:网站首页>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
边栏推荐
- The difference between sizeof and strlen in C language
- Leetcode problem solving -- 98 Validate binary search tree
- Inherit day01
- Fault analysis | analysis of an example of MySQL running out of host memory
- 【Kubernetes 系列】一文學會Kubernetes Service安全的暴露應用
- Reverse repackaging of wechat applet
- Overview of OCR character recognition methods
- Era5 reanalysis data download strategy
- XSS challenges bypass the protection strategy for XSS injection
- 微服务注册与发现
猜你喜欢
![[Yu Yue education] basic reference materials of digital electronic technology of Xi'an University of Technology](/img/47/e895a75eb3af2aaeafc6ae76caafe4.jpg)
[Yu Yue education] basic reference materials of digital electronic technology of Xi'an University of Technology

How to choose PLC and MCU?

Eight super classic pointer interview questions (3000 words in detail)

Recommended foreign websites for programmers to learn

【RISC-V】外部中断
![Huawei, H3C, Cisco command comparison, mind map form from the basic, switching, routing three directions [transferred from wechat official account network technology alliance station]](/img/3b/385d19e51340ecd6281df47b39f40c.png)
Huawei, H3C, Cisco command comparison, mind map form from the basic, switching, routing three directions [transferred from wechat official account network technology alliance station]

【 kubernets series】 a Literature Study on the Safe exposure Applications of kubernets Service

StrError & PERROR use yyds dry inventory

Microservice registration and discovery

How to accurately identify master data?
随机推荐
Descriptor implements ORM model
MySQL advanced notes
codeforces每日5題(均1700)-第六天
微服务间通信
Linear regression and logistic regression
Zhang Lijun: penetrating uncertainty depends on four "invariants"
Leetcode problem solving -- 108 Convert an ordered array into a binary search tree
[pointer training - eight questions]
真机无法访问虚拟机的靶场,真机无法ping通虚拟机
[ruoyi] set theme style
Precautions for single chip microcomputer anti reverse connection circuit
微服务注册与发现
继承day01
Introduction to robotframework (III) Baidu search of webui automation
[unity3d] GUI control
Leetcode problem solving -- 98 Validate binary search tree
Solve 9 with C language × 9 Sudoku (personal test available) (thinking analysis)
I sorted out a classic interview question for my job hopping friends
What are the principles of software design (OCP)
jsscript