mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-11-14 10:39:05 +00:00
fix bashscript
This commit is contained in:
parent
3713351e3e
commit
3e33de25eb
3 changed files with 29 additions and 29 deletions
|
@ -18,7 +18,7 @@ namespace darkcult {
|
|||
//
|
||||
SPROUT_STATIC_CONSTEXPR auto object = sprout::make_tuple(
|
||||
objects::make_aa_plane(
|
||||
sprout::darkroom::objects::aa_plane_direction::y,
|
||||
objects::aa_plane_direction::y,
|
||||
-2.0,
|
||||
materials::make_plaid_material_image(
|
||||
colors::rgb_f(1.0, 0.0, 0.0),
|
||||
|
|
|
@ -20,7 +20,7 @@ version_specific_options=(
|
|||
compile() {
|
||||
echo ": $1-$2 compile..."
|
||||
/usr/local/$1-$2/bin/${1/%cc}++ -Wall -pedantic -std=c++11 -o ${stagedir}/test_$1${2//.} $4 $3
|
||||
let "succ_$1${2//.} = $?"
|
||||
let "succ_$1${2//.}=$?"
|
||||
}
|
||||
|
||||
execute() {
|
||||
|
@ -36,15 +36,15 @@ execute() {
|
|||
fi
|
||||
}
|
||||
|
||||
args=`getopt -o d:D:f -l stagedir:,gcc-version:,clang-version:,define:,force -- "$@"`
|
||||
args=`getopt -o S:D:f -l stagedir:,gcc-version:,clang-version:,define:,force -- "$@"`
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo >&2 -e ": \e[31musage: $0 [-d|--stagedir=path] [--gcc-version=versions] [--clang-version=versions] [-D|--define=identifier]* [-f|-force]\e[m"
|
||||
echo >&2 -e ": \e[31musage: $0 [-S|--stagedir=path] [--gcc-version=versions] [--clang-version=versions] [-D|--define=identifier]* [-f|-force]\e[m"
|
||||
exit 1
|
||||
fi
|
||||
eval set -- ${args}
|
||||
while [ -n "$1" ]; do
|
||||
case $1 in
|
||||
-d|--stagedir) stagedir=$2; shift 2;;
|
||||
-S|--stagedir) stagedir=$2; shift 2;;
|
||||
--gcc-version) gcc_version="$2"; shift 2;;
|
||||
--clang-version) clang_version="$2"; shift 2;;
|
||||
-D|--define) user_macros=(${user_macros[@]} "$2"); shift 2;;
|
||||
|
@ -54,7 +54,7 @@ while [ -n "$1" ]; do
|
|||
esac
|
||||
done
|
||||
echo ": settings"
|
||||
echo ": stagedir = ${stagedir}"
|
||||
echo ": stagedir = \"${stagedir}\""
|
||||
echo ": gcc-version = (${gcc_version})"
|
||||
echo ": clang-version = (${clang_version})"
|
||||
echo ": user-macros = (${user_macros[*]})"
|
||||
|
@ -62,7 +62,7 @@ echo ": force = ${force}"
|
|||
|
||||
if [ -d "${stagedir}" ]; then
|
||||
if [ ${force} -eq 0 ]; then
|
||||
echo >&2 -e ": \e[31mstagedir(${stagedir}) is already exist.\e[m"
|
||||
echo >&2 -e ": \e[31mstagedir(${stagedir}) already exists.\e[m"
|
||||
exit 1
|
||||
else
|
||||
rm -f -r ${stagedir}/*
|
||||
|
|
|
@ -17,16 +17,16 @@ tile_width=16
|
|||
tile_height=16
|
||||
force=0
|
||||
|
||||
args=`getopt -o s:d:w:h:W:H:f -l source:,stagedir:,width:,height:,tile-width:,tile-height:,force -- "$@"`
|
||||
args=`getopt -o s:S:w:h:W:H:f -l source:,stagedir:,width:,height:,tile-width:,tile-height:,force -- "$@"`
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo >&2 -e ": \e[31musage: $0 -s|--source=file [-d|--stagedir=path] [-w|--width=value] [-h|--height=value] [-W|--tile-width=value] [-H|--tile-height=value] [-f|-force]\e[m"
|
||||
echo >&2 -e ": \e[31musage: $0 [-s|--source=file] [-S|--stagedir=path] [-w|--width=value] [-h|--height=value] [-W|--tile-width=value] [-H|--tile-height=value] [-f|-force]\e[m"
|
||||
exit 1
|
||||
fi
|
||||
eval set -- ${args}
|
||||
while [ -n "$1" ]; do
|
||||
case $1 in
|
||||
-s|--source) src=$2; shift 2;;
|
||||
-d|--stagedir) stagedir=$2; shift 2;;
|
||||
-S|--stagedir) stagedir=$2; shift 2;;
|
||||
-w|--width) width=$2; shift 2;;
|
||||
-h|--height) height=$2; shift 2;;
|
||||
-W|--tile-width) tile_width=$2; shift 2;;
|
||||
|
@ -38,8 +38,8 @@ while [ -n "$1" ]; do
|
|||
done
|
||||
|
||||
echo ": settings"
|
||||
echo ": source = ${src}"
|
||||
echo ": stagedir = ${stagedir}"
|
||||
echo ": source = \"${src}\""
|
||||
echo ": stagedir = \"${stagedir}\""
|
||||
echo ": width = ${width}"
|
||||
echo ": height = ${height}"
|
||||
echo ": tile-width = ${tile_width}"
|
||||
|
@ -47,13 +47,13 @@ echo ": tile-height = ${tile_height}"
|
|||
echo ": force = ${force}"
|
||||
|
||||
if [ ! -f "${src}" -a ! -f "$(cd $(dirname $0); pwd)/${src}" ]; then
|
||||
echo >&2 -e ": \e[31msource(${src}) is not exist.\e[m"
|
||||
echo >&2 -e ": \e[31msource(${src}) not exists.\e[m"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -d "${stagedir}" ]; then
|
||||
if [ ${force} -eq 0 ]; then
|
||||
echo >&2 -e ": \e[31mstagedir(${stagedir}) is already exist.\e[m"
|
||||
echo >&2 -e ": \e[31mstagedir(${stagedir}) already exists.\e[m"
|
||||
exit 1
|
||||
else
|
||||
rm -f -r ${stagedir}/*
|
||||
|
@ -62,15 +62,16 @@ else
|
|||
mkdir -p ${stagedir}
|
||||
fi
|
||||
|
||||
echo ": rendering..."
|
||||
start=$SECONDS
|
||||
echo ": start."
|
||||
start=${SECONDS}
|
||||
|
||||
for ((y=0; y<height; y+=tile_height)); do
|
||||
y_start=$SECONDS
|
||||
echo ": rendering(${y}/${height})..."
|
||||
y_start=${SECONDS}
|
||||
|
||||
for ((x=0; x<width; x+=tile_width)); do
|
||||
mkdir -p ${stagedir}/${y}/
|
||||
binname=${stagedir}/${x}.${y}.out
|
||||
binname=${stagedir}/${y}/${x}.out
|
||||
g++ -o ${binname} -std=c++11 \
|
||||
-DDARKROOM_SOURCE="\"${src}\"" \
|
||||
-DDARKROOM_TOTAL_WIDTH=${width} \
|
||||
|
@ -81,19 +82,18 @@ for ((y=0; y<height; y+=tile_height)); do
|
|||
-DDARKROOM_OFFSET_Y=${y} \
|
||||
$(cd $(dirname $0); pwd)/darkcult.cpp && ${binname} > ${stagedir}/${y}/${x}.ppm
|
||||
# rm ${binname}
|
||||
done;
|
||||
pushd ${stagedir}/${y}/
|
||||
done
|
||||
pushd ${stagedir}/${y}/ > /dev/null
|
||||
convert +append $(ls *.ppm | sort -n) ../${y}.ppm
|
||||
popd
|
||||
popd > /dev/null
|
||||
|
||||
let y_elapsed=$SECONDS-$y_start
|
||||
echo ": elapsed(${y}) = ${y_elapsed}s"
|
||||
done;
|
||||
pushd ${stagedir}
|
||||
let "y_elapsed=${SECONDS}-${y_start}"
|
||||
echo ": elapsed = ${y_elapsed}s"
|
||||
done
|
||||
pushd ${stagedir} > /dev/null
|
||||
convert -append $(ls *.ppm | sort -n) out.ppm
|
||||
popd
|
||||
|
||||
let elapsed=$SECONDS-$start
|
||||
echo ": elapsed = ${elapsed}s"
|
||||
popd > /dev/null
|
||||
|
||||
let "elapsed=${SECONDS}-${start}"
|
||||
echo ": elapsed(total) = ${elapsed}s"
|
||||
echo ": finished."
|
||||
|
|
Loading…
Reference in a new issue