fix bashscript: add --compiler option

This commit is contained in:
bolero-MURAKAMI 2013-09-23 21:10:58 +09:00
parent 6d5bc5762c
commit abfa6082b4
2 changed files with 12 additions and 6 deletions

View file

@ -82,7 +82,7 @@ if [ ${use_help} -ne 0 ]; then
fi fi
echo "settings:" echo "settings:"
echo " stagedir = \"${stagedir}\"" echo " stagedir = '${stagedir}'"
echo " gcc-version = (${gcc_version})" echo " gcc-version = (${gcc_version})"
echo " clang-version = (${clang_version})" echo " clang-version = (${clang_version})"
if [ ${#user_macros[*]} -gt 0 ]; then if [ ${#user_macros[*]} -gt 0 ]; then

View file

@ -12,6 +12,7 @@
src="../../example/darkroom/two_spheres.hpp" src="../../example/darkroom/two_spheres.hpp"
stagedir="darkroom" stagedir="darkroom"
output="out.ppm" output="out.ppm"
compiler="g++"
width=16 width=16
height=16 height=16
tile_width=16 tile_width=16
@ -23,7 +24,7 @@ include_paths=()
force=0 force=0
use_help=0 use_help=0
args=`getopt -o s:S:o:w:h:W:H:D:I:f -l source:,stagedir:,output:,width:,height:,tile-width:,tile-height:,define:,include:,force,help -- "$@"` args=`getopt -o s:S:o:C:w:h:W:H:D:I:f -l source:,stagedir:,output:,compiler:,width:,height:,tile-width:,tile-height:,define:,include:,force,help -- "$@"`
if [ "$?" -ne 0 ]; then if [ "$?" -ne 0 ]; then
echo >&2 "error: options parse error. see 'darkcult.sh --help'" echo >&2 "error: options parse error. see 'darkcult.sh --help'"
exit 1 exit 1
@ -34,6 +35,7 @@ while [ -n "$1" ]; do
-s|--source) src=$2; shift 2;; -s|--source) src=$2; shift 2;;
-S|--stagedir) stagedir=$2; shift 2;; -S|--stagedir) stagedir=$2; shift 2;;
-o|--output) output=$2; shift 2;; -o|--output) output=$2; shift 2;;
-C|--compiler) compiler=$2; shift 2;;
-w|--width) width=$2; shift 2;; -w|--width) width=$2; shift 2;;
-h|--height) height=$2; shift 2;; -h|--height) height=$2; shift 2;;
-W|--tile-width) tile_width=$2; shift 2;; -W|--tile-width) tile_width=$2; shift 2;;
@ -59,6 +61,9 @@ if [ ${use_help} -ne 0 ]; then
echo " -o, --output=<file> Output file of the result." echo " -o, --output=<file> Output file of the result."
echo " Default; 'out.ppm'" echo " Default; 'out.ppm'"
echo "" echo ""
echo " -C, --compiler=<command> Compiler to use."
echo " Default; 'g++'"
echo ""
echo " -w, --width=<value> Output width of rendering." echo " -w, --width=<value> Output width of rendering."
echo " Default; 16" echo " Default; 16"
echo "" echo ""
@ -82,9 +87,10 @@ if [ ${use_help} -ne 0 ]; then
fi fi
echo "settings:" echo "settings:"
echo " source = \"${src}\"" echo " source = '${src}'"
echo " stagedir = \"${stagedir}\"" echo " stagedir = '${stagedir}'"
echo " output = \"${output}\"" echo " output = '${output}'"
echo " compiler = '${compiler}'"
echo " width = ${width}" echo " width = ${width}"
echo " height = ${height}" echo " height = ${height}"
echo " tile-width = ${tile_width}" echo " tile-width = ${tile_width}"
@ -133,7 +139,7 @@ for ((y=0; y<height; y+=tile_height)); do
for ((x=0; x<width; x+=tile_width)); do for ((x=0; x<width; x+=tile_width)); do
echo -n "(${x}/${height})..." echo -n "(${x}/${height})..."
binname=${stagedir}/${y}/${x}.out binname=${stagedir}/${y}/${x}.out
g++ -o ${binname} -std=c++11 \ ${compiler} -o ${binname} -std=c++11 \
${define_options} ${include_options} \ ${define_options} ${include_options} \
-DDARKROOM_SOURCE="\"${src}\"" \ -DDARKROOM_SOURCE="\"${src}\"" \
-DDARKROOM_TOTAL_WIDTH=${width} \ -DDARKROOM_TOTAL_WIDTH=${width} \