Skip to content

Commit 18abab7

Browse files
committed
added profile option to build.sh
1 parent 25be850 commit 18abab7

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

build.sh

+8-3
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,28 @@ autorun=false
33
yesconsole=false
44
static=false
55
release=false
6+
profile=false
67

78
plainimg_version=$(cat VERSION.txt)
89

9-
while getopts "hrays" OPTION; do
10+
while getopts "hprays" OPTION; do
1011
case $OPTION in
1112
a) autorun=true ;;
1213
y) yesconsole=true ;;
1314
s) static=true ;;
1415
r) release=true ;;
15-
h) echo -e "\nUsage: $0 [-a] [-y] [-s]\n-a | autorun | autoruns the built executable\n-y | yesconsole | removes the -mwindows flag from gcc, which is on by default\n-s | static | adds the -static flag to gcc (builds standalone)" ; exit 1 ;;
16+
p) profile=true ;;
17+
h) echo -e "\nUsage: $0 [-a] [-y] [-s] [-r] [-p]\n-a | autorun | autoruns the built executable\n-y | yesconsole | removes the -mwindows flag from gcc, which is on by default\n-s | static | adds the -static flag to gcc (builds standalone)" ; exit 1 ;;
1618
\?) echo "Invalid option. See the help menu with '-h'" >&2; exit 1;;
1719
esac
1820
done
1921

2022
args=()
2123
! $yesconsole && args+=("-mwindows")
2224
$static && args+=("-lwinmm" "-lole32" "-lsetupapi" "-limm32" "-lversion" "-loleaut32" "-luuid" "-lmfplat")
25+
$profile && args+=("-no-pie" "-pg") #-g -pg
26+
#https://stackoverflow.com/questions/42620074/gprof-produces-empty-output
27+
# to profile, run "./build.sh -s -p", "cd build/debug", "./plainIMG_static.exe", "gprof plainIMG_static.exe gmon.out > analysis.txt"
2328

2429
windres -i src/plainIMG.rc --input-format=rc -o src/plainIMG_rc.res -O coff
2530

@@ -92,4 +97,4 @@ else
9297
fi
9398
fi
9499

95-
echo "build complete"
100+
echo "build complete"

0 commit comments

Comments
 (0)