Skip to content

Commit

Permalink
Merge pull request #183 from ZhouBox/main
Browse files Browse the repository at this point in the history
add build type
  • Loading branch information
fengzeroz authored May 8, 2024
2 parents e5a6294 + be23415 commit 6be0418
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 12 deletions.
21 changes: 15 additions & 6 deletions cross-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ cross=false
user=emqx
smart=false
clib=glibc
build_type=Release

while getopts ":a:v:b:c:u:s:l:" OPT; do
while getopts ":a:v:b:c:u:s:l:d:" OPT; do
case ${OPT} in
a)
arch=$OPTARG
Expand All @@ -36,10 +37,18 @@ while getopts ":a:v:b:c:u:s:l:" OPT; do
l)
clib=$OPTARG
;;
d)
build_type=$OPTARG
;;
esac
done

neuron_dir=$home/$bdb/Program/$vendor
case $build_type in
(Release)
neuron_dir=$home/$bdb/Program/$vendor;;
(Debug)
neuron_dir=$home/$bdb/Program_Debug/$vendor;;
esac

case $cross in
(true)
Expand All @@ -58,19 +67,19 @@ function compile_source_with_tag() {
cd $repo
git submodule update --init
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DDISABLE_UT=ON \
cmake .. -DCMAKE_BUILD_TYPE=$build_type -DDISABLE_UT=ON \
-DTOOL_DIR=$tool_dir -DCOMPILER_PREFIX=$vendor \
-DCMAKE_SYSTEM_PROCESSOR=$arch -DLIBRARY_DIR=$library \
-DCMAKE_TOOLCHAIN_FILE=../cmake/cross.cmake

case $smart in
(true)
cmake .. -DSMART_LINK=1 -DCMAKE_BUILD_TYPE=Release -DDISABLE_UT=ON \
cmake .. -DSMART_LINK=1 -DCMAKE_BUILD_TYPE=$build_type -DDISABLE_UT=ON \
-DTOOL_DIR=$tool_dir -DCOMPILER_PREFIX=$vendor \
-DCMAKE_SYSTEM_PROCESSOR=$arch -DLIBRARY_DIR=$library \
-DCMAKE_TOOLCHAIN_FILE=../cmake/cross.cmake;;
(false)
cmake .. -DCMAKE_BUILD_TYPE=Release -DDISABLE_UT=ON \
cmake .. -DCMAKE_BUILD_TYPE=$build_type -DDISABLE_UT=ON \
-DTOOL_DIR=$tool_dir -DCOMPILER_PREFIX=$vendor \
-DCMAKE_SYSTEM_PROCESSOR=$arch -DLIBRARY_DIR=$library \
-DCMAKE_TOOLCHAIN_FILE=../cmake/cross.cmake;;
Expand All @@ -80,7 +89,7 @@ function compile_source_with_tag() {
(glibc)
;;
(*)
cmake .. -DCMAKE_BUILD_TYPE=Release -DDISABLE_UT=ON \
cmake .. -DCMAKE_BUILD_TYPE=$build_type -DDISABLE_UT=ON \
-DTOOL_DIR=$tool_dir -DCOMPILER_PREFIX=$vendor \
-DCMAKE_SYSTEM_PROCESSOR=$arch -DLIBRARY_DIR=$library \
-DCLIB=\'\"$clib\"\' \
Expand Down
46 changes: 40 additions & 6 deletions cross-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ arch=?
version=?
cnc=false
custom=default
build_type=Release

while getopts ":a:v:o:c:n:" OPT; do
while getopts ":a:v:o:c:n:d:" OPT; do
case ${OPT} in
a)
arch=$OPTARG
Expand All @@ -27,12 +28,25 @@ while getopts ":a:v:o:c:n:" OPT; do
n)
cnc=$OPTARG
;;
d)
build_type=$OPTARG
;;
esac
done

neuron_dir=$home/$branch/Program/$vendor/neuron
neuron_modules_dir=$home/$branch/Program/$vendor/neuron-modules
package_dir=$home/$branch/Program/$vendor/package/neuron

case $build_type in
(Release)
neuron_dir=$home/$branch/Program/$vendor/neuron;
neuron_modules_dir=$home/$branch/Program/$vendor/neuron-modules;
package_dir=$home/$branch/Program/$vendor/package/neuron;;
(Debug)
neuron_dir=$home/$branch/Program_Debug/$vendor/neuron;
neuron_modules_dir=$home/$branch/Program_Debug/$vendor/neuron-modules;
package_dir=$home/$branch/Program_Debug/$vendor/package/neuron;;
esac


library=$home/$branch/libs/$vendor
script_dir="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"

Expand Down Expand Up @@ -153,9 +167,29 @@ case $custom in
echo "no custom";;
esac

case $build_type in
(Debug)
if [ $vendor == "x86_64-neuron-linux-gnu" ]; then
cp /home/neuron/buildroot/$vendor/output/host/usr/$vendor/lib64/libasan.so.2.0.0 $package_dir/
cd $package_dir
ln -s ./libasan.so.2.0.0 libasan.so.2
fi;;
(Release)
echo "release";;
esac


cd $package_dir/..
rm -rf neuron*.tar.gz

tar czf neuron-$version-linux-$arch.tar.gz neuron
echo "neuron-$version-linux-$arch.tar.gz"

case $build_type in
(Release)
tar czf neuron-$version-linux-$arch.tar.gz neuron;
echo "neuron-$version-linux-$arch.tar.gz";;
(Debug)
tar czf neuron-$version-debug-linux-$arch.tar.gz neuron;
echo "neuron-$version-debug-linux-$arch.tar.gz";;
esac


0 comments on commit 6be0418

Please sign in to comment.