-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add bash_build.sh for no cmake environment.
- Loading branch information
tzhu
committed
Mar 14, 2024
1 parent
72a5691
commit 03ff66a
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
RED=$(tput setaf 1) | ||
GREEN=$(tput setaf 2) | ||
NCOLOR=$(tput sgr0) | ||
|
||
set -e | ||
set -o pipefail | ||
lib_name=pt_os | ||
build_dir=build | ||
|
||
#test g++ and git has been installed | ||
g++ --version | ||
git --version | ||
|
||
#remove the build dir and make it. | ||
if [ -d ${build_dir} ];then | ||
rm -rf ${build_dir}/* | ||
else | ||
mkdir ${build_dir} | ||
fi | ||
pushd ${build_dir} | ||
|
||
#clone the dependency repo | ||
git clone https://github.com/ZhuLingQing/protothreads.git | ||
#build the os static library | ||
g++ -g -o ${lib_name}.o -c ../pt-os.cpp -I./protothreads | ||
ar -rv lib${lib_name}.a ${lib_name}.o | ||
#build the test | ||
g++ -g -o test_pt_os ../tests/*.cpp -I./protothreads -I.. -L. -l${lib_name} | ||
#run the test | ||
./test_pt_os | ||
rc=$? | ||
if [ ${rc} -eq 0 ];then | ||
echo "${GREEN}test pass${NCOLOR}" | ||
else | ||
echo "${RED}test failed ${rc} ${NCOLOR}" | ||
fi | ||
|
||
popd |