mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2024-12-25 06:05:34 +03:00
build.sh add help [skip ci]
This commit is contained in:
parent
f57f3d7bb9
commit
69b0003e3f
89
build.sh
89
build.sh
@ -1,39 +1,60 @@
|
||||
#!/bin/bash
|
||||
|
||||
CC=gcc
|
||||
CXX=g++
|
||||
main()
|
||||
{
|
||||
CC=gcc
|
||||
CXX=g++
|
||||
|
||||
n=0
|
||||
args=()
|
||||
for i in "$@"
|
||||
do
|
||||
case $i in
|
||||
-j=*|--jobs=*)
|
||||
jobs="-j${i#*=}"
|
||||
shift
|
||||
;;
|
||||
-c=*|--compiler=*)
|
||||
C="${i#*=}"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
args[$n]="$i"
|
||||
((++n))
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [[ "$*" =~ "--help" ]]; then
|
||||
help
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
case "$C" in
|
||||
("intel"|"icc") CC=icc CXX=icpc ;;
|
||||
("gcc"|"g++") CC=gcc CXX=g++ ;;
|
||||
("clang|llvm") CC=clang CXX=clang++ ;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
n=0
|
||||
args=()
|
||||
for i in "$@"
|
||||
do
|
||||
case $i in
|
||||
-j=*|--jobs=*)
|
||||
jobs="-j${i#*=}"
|
||||
shift
|
||||
;;
|
||||
-c=*|--compiler=*)
|
||||
C="${i#*=}"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
args[$n]="$i"
|
||||
((++n))
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
rm -rf build
|
||||
mkdir build
|
||||
pushd build &> /dev/null
|
||||
CC=$CC CXX=$CXX cmake ${args[@]} ..
|
||||
make ${jobs}
|
||||
popd > /dev/null
|
||||
case "$C" in
|
||||
("intel"|"icc") CC=icc CXX=icpc ;;
|
||||
("gcc"|"g++") CC=gcc CXX=g++ ;;
|
||||
("clang|llvm") CC=clang CXX=clang++ ;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
rm -rf build
|
||||
mkdir build
|
||||
pushd build &> /dev/null
|
||||
CC=$CC CXX=$CXX cmake ${args[@]} ..
|
||||
make ${jobs}
|
||||
popd > /dev/null
|
||||
}
|
||||
|
||||
help()
|
||||
{
|
||||
printf "Usage: ./build.sh <options>\n\n"
|
||||
printf " -c= | --compiler=<icc|gcc|clang> - Select preferred C/C++ compiler to build\n"
|
||||
printf " -j= | --jobs=<N> - Specifies the number of jobs (commands) to run simultaneously (For faster building)\n\n"
|
||||
}
|
||||
|
||||
# Initialize
|
||||
main $*
|
||||
|
||||
# Exit normally
|
||||
exit 0
|
||||
|
Loading…
Reference in New Issue
Block a user