Skip to content

Commit

Permalink
add arm targets
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex313031 committed Mar 1, 2024
1 parent b40f964 commit b349eef
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 17 deletions.
47 changes: 46 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ displayHelp () {
printf "${bold}${GRE}Script to build Codium for Linux or Windows.${c0}\n" &&
printf "${bold}${YEL}Use the --deps flag to install build dependencies.${c0}\n" &&
printf "${bold}${YEL}Use the --linux flag to build for Linux.${c0}\n" &&
printf "${bold}${YEL}Use the --linux-arm flag to build for Linux (arm64).${c0}\n" &&
printf "${bold}${YEL}Use the --avx flag to build for Linux (AVX Version).${c0}\n" &&
printf "${bold}${YEL}Use the --win flag to build for Windows.${c0}\n" &&
printf "${bold}${YEL}Use the --mac flag to build for MacOS.${c0}\n" &&
printf "${bold}${YEL}Use the --mac-arm flag to build for MacOS (arm64).${c0}\n" &&
printf "${bold}${YEL}Use the --clean flag to remove all artifacts.\n" &&
printf "${bold}${YEL}Use the --help flag to show this help.${c0}\n" &&
printf "\n"
Expand Down Expand Up @@ -51,9 +54,11 @@ printf "\n" &&
printf "${bold}${GRE}Script to build Codium for Linux or Windows.${c0}\n" &&
printf "${bold}${YEL}Use the --deps flag to install build dependencies.${c0}\n" &&
printf "${bold}${YEL}Use the --linux flag to build for Linux.${c0}\n" &&
printf "${bold}${YEL}Use the --linux-arm flag to build for Linux (arm64).${c0}\n" &&
printf "${bold}${YEL}Use the --avx flag to build for Linux (AVX Version).${c0}\n" &&
printf "${bold}${YEL}Use the --win flag to build for Windows.${c0}\n" &&
printf "${bold}${YEL}Use the --mac flag to build for MacOS.${c0}\n" &&
printf "${bold}${YEL}Use the --mac-arm flag to build for MacOS (arm64).${c0}\n" &&
printf "${bold}${YEL}Use the --clean flag to remove all artifacts.\n" &&
printf "${bold}${YEL}Use the --help flag to show this help.${c0}\n" &&
printf "\n" &&
Expand All @@ -76,6 +81,23 @@ case $1 in
--linux) buildLinux; exit 0;;
esac

buildLinuxArm (){
printf "\n" &&
printf "${bold}${GRE}Building Codium for Linux...${c0}\n" &&
printf "\n" &&
tput sgr0 &&

export CFLAGS="-DNDEBUG -march=armv8-a+simd -O3 -g0 -s" &&
export CXXFLAGS="-DNDEBUG -march=armv8-a+simd -O3 -g0 -s" &&
export CPPFLAGS="-DNDEBUG -march=armv8-a+simd -O3 -g0 -s" &&
export LDFLAGS="-Wl,-O3 -march=armv8-a+simd -s" &&

. ./build/build.sh -s -a
}
case $1 in
--linux-arm) buildLinuxArm; exit 0;;
esac

buildLinuxAVX (){
printf "\n" &&
printf "${bold}${GRE}Building Codium for Linux (AVX Version)...${c0}\n" &&
Expand Down Expand Up @@ -115,7 +137,13 @@ tput sgr0 &&
# Set msvs_version for node-gyp on Windows
export MSVS_VERSION="2022" &&
export GYP_MSVS_VERSION="2022" &&
set MSVS_VERSION="2022" &&
set GYP_MSVS_VERSION="2022" &&

export CFLAGS="-DNDEBUG -msse3 -O3 -g0 -s" &&
export CXXFLAGS="-DNDEBUG -msse3 -O3 -g0 -s" &&
export CPPFLAGS="-DNDEBUG -msse3 -O3 -g0 -s" &&
export LDFLAGS="-Wl,-O3 -msse3 -s" &&
set CFLAGS="-DNDEBUG -msse3 -O3 -g0 -s" &&
set CXXFLAGS="-DNDEBUG -msse3 -O3 -g0 -s" &&
set CPPFLAGS="-DNDEBUG -msse3 -O3 -g0 -s" &&
Expand All @@ -129,7 +157,7 @@ esac

buildMac (){
printf "\n" &&
printf "${bold}${GRE}Building Codium for MacOS...${c0}\n" &&
printf "${bold}${GRE}Building Codium for MacOS (x86_64 version)...${c0}\n" &&
printf "\n" &&
tput sgr0 &&

Expand All @@ -144,4 +172,21 @@ case $1 in
--mac) buildMac; exit 0;;
esac

buildMacArm (){
printf "\n" &&
printf "${bold}${GRE}Building Codium for MacOS (arm64 version)...${c0}\n" &&
printf "\n" &&
tput sgr0 &&

export CFLAGS="-DNDEBUG -march=armv8.3-a+simd -O3 -g0 -s -Wno-unused-command-line-argument" &&
export CXXFLAGS="-DNDEBUG -march=armv8.3-a+simd -O3 -g0 -s -Wno-unused-command-line-argument" &&
export CPPFLAGS="-DNDEBUG -march=armv8.3-a+simd -O3 -g0 -s -Wno-unused-command-line-argument" &&
export LDFLAGS="-march=armv8.3-a+simd -s" &&

. ./build/build.sh -s -a
}
case $1 in
--mac-arm) buildMacArm; exit 0;;
esac

exit 0
25 changes: 14 additions & 11 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,17 @@ export VSCODE_LATEST="no"
export VSCODE_QUALITY="stable"
export VSCODE_SKIP_NODE_VERSION_CHECK="yes"

while getopts ":ilops" opt; do
UNAME_ARCH=$( uname -m )

if [[ "${UNAME_ARCH}" == "arm64" ]]; then
export VSCODE_ARCH="arm64"
elif [[ "${UNAME_ARCH}" == "ppc64le" ]]; then
export VSCODE_ARCH="ppc64le"
else
export VSCODE_ARCH="x64"
fi

while getopts ":ilopsa" opt; do
case "$opt" in
i)
export BINARY_NAME="codium-dev"
Expand All @@ -67,6 +77,9 @@ while getopts ":ilops" opt; do
s)
export SKIP_SOURCE="yes"
;;
a)
export VSCODE_ARCH="arm64"
;;
*)
;;
esac
Expand All @@ -84,16 +97,6 @@ case "${OSTYPE}" in
;;
esac

UNAME_ARCH=$( uname -m )

if [[ "${UNAME_ARCH}" == "arm64" ]]; then
export VSCODE_ARCH="arm64"
elif [[ "${UNAME_ARCH}" == "ppc64le" ]]; then
export VSCODE_ARCH="ppc64le"
else
export VSCODE_ARCH="x64"
fi

echo "OS_NAME=\"${OS_NAME}\""
echo "SKIP_SOURCE=\"${SKIP_SOURCE}\""
echo "SKIP_BUILD=\"${SKIP_BUILD}\""
Expand Down
5 changes: 0 additions & 5 deletions build/build_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ export SKIP_ASSETS="no"
export VSCODE_LATEST="no"
export VSCODE_QUALITY="stable"

export CFLAGS="-DNDEBUG -msse3 -O3 -g0 -s"
export CXXFLAGS="-DNDEBUG -msse3 -O3 -g0 -s"
export CPPFLAGS="-DNDEBUG -msse3 -O3 -g0 -s"
export LDFLAGS="-Wl,-O3 -msse3 -s"

while getopts ":ilp" opt; do
case "$opt" in
i)
Expand Down

0 comments on commit b349eef

Please sign in to comment.