Skip to content

Commit

Permalink
Merge pull request #190 from MikeMirzayanov/dev-mikemirzayanov
Browse files Browse the repository at this point in the history
support TESTLIB_COMPILER_OPTIMIZATION_OPT env, passed to -O<opt> in compilation
  • Loading branch information
MikeMirzayanov authored Sep 29, 2023
2 parents 8fa873c + 02adee7 commit c59428d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/scripts/compile
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,23 @@ rm -f "$exe_file"

EXTRA_ARGS=""

if [[ -z "${TESTLIB_COMPILER_OPTIMIZATION_OPT}" ]]; then
OPTIMIZATION="2"
else
OPTIMIZATION="${TESTLIB_COMPILER_OPTIMIZATION_OPT}"
fi

if [[ "$CPP" == "cl.exe" ]]; then
echo "Compiling $src_file, running:" "$CPP" "$CPP_STANDARD" "-F268435456" "-EHsc" "-O2" -I"${CPP_INCLUDE_DIR}" -Fe"$exe_file" "$src_file"
"$CPP" "$CPP_STANDARD" "-F268435456" "-EHsc" "-O2" -I"${CPP_INCLUDE_DIR}" -Fe"$exe_file" "$src_file"
echo "Compiling $src_file, running:" "$CPP" "$CPP_STANDARD" "-F268435456" "-EHsc" "-O${OPTIMIZATION}" -I"${CPP_INCLUDE_DIR}" -Fe"$exe_file" "$src_file"
"$CPP" "$CPP_STANDARD" "-F268435456" "-EHsc" "-O${OPTIMIZATION}" -I"${CPP_INCLUDE_DIR}" -Fe"$exe_file" "$src_file"
else
"$CPP" --version
dir=$(dirname "$CPP")
if [[ "$dir" == *"/bin" ]] || [[ "$MACHINE" == "Windows" ]]; then
EXTRA_ARGS="${EXTRA_ARGS} -static"
fi
echo "Compiling $src_file, running:" "$CPP" "$CPP_OPTS" "$CPP_STANDARD" -Wpedantic -Werror -I"${CPP_INCLUDE_DIR}""$EXTRA_ARGS" -o"$exe_file" -O2 "$src_file"
eval "$CPP" "$CPP_OPTS" "$CPP_STANDARD" -Wpedantic -Werror -I"${CPP_INCLUDE_DIR}""$EXTRA_ARGS" -o"$exe_file" -O2 "$src_file"
echo "Compiling $src_file, running:" "$CPP" "$CPP_OPTS" "$CPP_STANDARD" -Wpedantic -Werror -I"${CPP_INCLUDE_DIR}""$EXTRA_ARGS" -o"$exe_file" "-O${OPTIMIZATION}" "$src_file"
eval "$CPP" "$CPP_OPTS" "$CPP_STANDARD" -Wpedantic -Werror -I"${CPP_INCLUDE_DIR}""$EXTRA_ARGS" -o"$exe_file" "-O${OPTIMIZATION}" "$src_file"
fi

rm -f ./*.o ./*.obj
Expand Down

0 comments on commit c59428d

Please sign in to comment.