提交 db025266 编写于 作者: M MizuhaHimuraki 提交者: LINGuanRen

support aarch64 compilation

上级 e0748037
......@@ -115,6 +115,10 @@ message(STATUS "DETECT BUILD ARCH: " ${ARCHITECTURE})
if(${ARCHITECTURE} STREQUAL "x86_64")
set(MTUNE_CFLAGS "-mtune=core2")
set(ARCH_LDFLAGS "")
elseif(${ARCHITECTURE} STREQUAL "aarch64")
set(MARCH_CFLAGS "-march=armv8-a+crc" )
set(MTUNE_CFLAGS "-mtune=generic" )
set(ARCH_LDFLAGS "-latomic")
else()
message(FATAL_ERROR "UNSUPPORT BUILD ARCH: ${ARCHITECTURE}")
endif()
......@@ -14,7 +14,8 @@ fi
source /etc/os-release || exit 1
PNAME=${PRETTY_NAME:-${NAME} ${VERSION}}
PNAME=${PRETTY_NAME:-"${NAME} ${VERSION}"}
PNAME="${PNAME} (${OS_ARCH})"
function compat_centos8() {
echo "[NOTICE] '$PNAME' is compatible with CentOS 8, use el8 dependencies list"
......@@ -35,42 +36,54 @@ function version_ge() {
}
function get_os_release() {
case "$ID" in
alios)
version_ge "8.0" && compat_centos8 && return
version_ge "7.2" && compat_centos7 && return
;;
anolis)
version_ge "8.0" && compat_centos8 && return
version_ge "7.0" && compat_centos7 && return
;;
ubuntu)
version_ge "16.04" && compat_centos7 && return
;;
centos)
version_ge "8.0" && OS_RELEASE=8 && return
version_ge "7.0" && OS_RELEASE=7 && return
;;
debian)
version_ge "9" && compat_centos7 && return
;;
fedora)
version_ge "33" && compat_centos7 && return
;;
opensuse-leap)
version_ge "15" && compat_centos7 && return
;;
#suse
sles)
version_ge "15" && compat_centos7 && return
;;
uos)
version_ge "20" && compat_centos7 && return
;;
alinux)
version_ge "2.1903" && compat_centos7 && return
;;
esac
if [[ "${OS_ARCH}x" == "x86_64x" ]]; then
case "$ID" in
alinux)
version_ge "2.1903" && compat_centos7 && return
;;
alios)
version_ge "8.0" && compat_centos8 && return
version_ge "7.2" && compat_centos7 && return
;;
anolis)
version_ge "8.0" && compat_centos8 && return
version_ge "7.0" && compat_centos7 && return
;;
ubuntu)
version_ge "16.04" && compat_centos7 && return
;;
centos)
version_ge "8.0" && OS_RELEASE=8 && return
version_ge "7.0" && OS_RELEASE=7 && return
;;
debian)
version_ge "9" && compat_centos7 && return
;;
fedora)
version_ge "33" && compat_centos7 && return
;;
opensuse-leap)
version_ge "15" && compat_centos7 && return
;;
#suse
sles)
version_ge "15" && compat_centos7 && return
;;
uos)
version_ge "20" && compat_centos7 && return
;;
esac
elif [[ "${OS_ARCH}x" == "aarch64x" ]]; then
case "$ID" in
alios)
version_ge "7.0" && compat_centos7 && return
;;
centos)
version_ge "8.0" && compat_centos7 && return
version_ge "7.0" && OS_RELEASE=7 && return
;;
esac
fi
not_supported && return 1
}
......
[target]
os=7
arch=aarch64
repo=http://mirrors.aliyun.com/oceanbase/development-kit/el/7/x86_64/
[deps]
devdeps-gtest-1.8.0-3.el7.aarch64.rpm
devdeps-isa-l-static-2.22.0-3.el7.aarch64.rpm
devdeps-libcurl-static-7.29.0-3.el7.aarch64.rpm
devdeps-libunwind-static-1.5.0-3.el7.aarch64.rpm
devdeps-mariadb-connector-c-3.1.12-3.el7.aarch64.rpm
devdeps-openssl-static-1.0.1e-3.el7.aarch64.rpm
devdeps-libaio-0.3.112-3.el7.aarch64.rpm
[tools]
obdevtools-bintuils-2.30-3.el7.aarch64.rpm
obdevtools-bison-2.4.1-3.el7.aarch64.rpm
obdevtools-ccache-3.7.12-3.el7.aarch64.rpm
obdevtools-cmake-3.20.2-3.el7.aarch64.rpm
obdevtools-flex-2.5.35-3.el7.aarch64.rpm
obdevtools-gcc-5.2.0-3.el7.aarch64.rpm
obdevtools-llvm-11.0.1-3.el7.aarch64.rpm
......@@ -26,10 +26,16 @@ target_include_directories(
${DEP_DIR}/include
)
set(EASY_ARCH_COMPILE_OPTIONS "")
if(${ARCHITECTURE} STREQUAL "aarch64")
set(EASY_ARCH_COMPILE_OPTIONS -Wno-tautological-constant-out-of-range-compare)
endif()
if (OB_USE_CLANG)
set(EASY_CC_WNO -fno-strict-aliasing -Wno-unused-variable -Wno-unused-function -fmax-type-align=8)
set(EASY_CC_WNO -fno-strict-aliasing -Wno-unused-variable -Wno-unused-function -fmax-type-align=8 ${EASY_ARCH_COMPILE_OPTIONS})
else()
set(EASY_CC_WNO -fno-strict-aliasing -Wno-unused-variable -Wno-implicit-function-declaration -Wno-unused-but-set-variable -Wno-unused-function)
set(EASY_CC_WNO -fno-strict-aliasing -Wno-unused-variable -Wno-implicit-function-declaration -Wno-unused-but-set-variable -Wno-unused-function ${EASY_ARCH_COMPILE_OPTIONS})
endif()
......
......@@ -10,6 +10,10 @@ target_include_directories(
${DEP_DIR}/include
)
set(ARCH_COMPILE_OPTIONS "")
if(${ARCHITECTURE} STREQUAL "aarch64")
set(ARCH_COMPILE_OPTIONS -Wno-extern-c-compat -Wno-atomic-alignment)
endif()
if (OB_USE_CLANG)
target_compile_options(oblib_base_base
INTERFACE
......@@ -24,14 +28,16 @@ if (OB_USE_CLANG)
-Wno-format-security -Wno-reserved-user-defined-literal -Wno-sometimes-uninitialized
-Wno-unused-value -Wno-self-assign -Wno-overloaded-virtual
-Wno-unused-private-field -Wno-mismatched-tags -Wno-unused-variable
-Wno-invalid-offsetof -Wno-tautological-compare -Wno-psabi -Wno-c99-designator)
-Wno-invalid-offsetof -Wno-tautological-compare -Wno-psabi -Wno-c99-designator
${ARCH_COMPILE_OPTIONS}
)
else()
target_compile_options(oblib_base_base
INTERFACE
-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
-D_NO_EXCEPTION -Wall -Wno-unused-parameter -Wextra -Wformat -Wno-deprecated
-fno-strict-aliasing -fno-omit-frame-pointer ${MARCH_CFLAGS} ${MTUNE_CFLAGS}
-Wno-psabi -Wno-sign-compare -Wno-unused-variable
-Wno-psabi -Wno-sign-compare -Wno-unused-variable ${ARCH_COMPILE_OPTIONS}
$<$<COMPILE_LANGUAGE:C>:-Wno-old-style-declaration>
$<$<COMPILE_LANGUAGE:CXX>:-Wno-literal-suffix -Wno-invalid-offsetof>)
endif()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册