Skip to content

Commit cfecc97

Browse files
committed
Update make script to allow for debug and release configurations
1 parent 4e9feff commit cfecc97

2 files changed

Lines changed: 56 additions & 32 deletions

File tree

make.sh

Lines changed: 55 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,57 @@
11
#!/bin/bash
2-
if [[ -z "$LD_LIBRARY_PATH" ]]; then
3-
echo "Must provide LD_LIBRARY_PATH in environment" 1>&2
4-
exit 1
2+
CONFIG=${1:-debug}
3+
FILENAME=$(basename -- "$0")
4+
case $FILENAME in
5+
"run.sh")
6+
MODE="run";;
7+
"make.sh")
8+
MODE="build";;
9+
*)
10+
# Terminate on error after message
11+
echo "Expected filename to be either 'make.sh' or 'run.sh'"
12+
exit 1;;
13+
esac
14+
15+
16+
if [[ "$CONFIG" =~ ^(debug|release)$ ]]; then
17+
if [[ -z "$LD_LIBRARY_PATH" ]]; then
18+
echo "Must provide LD_LIBRARY_PATH in environment" 1>&2
19+
exit 1
20+
fi
21+
22+
if [ "$CONFIG" == "debug" ]; then
23+
if [[ -z "$IGIS_LIBRARY_DEBUG_PATH" ]]; then
24+
echo "Must provide IGIS_LIBRARY_DEBUG_PATH in environment" 1>&2
25+
exit 1
26+
fi
27+
if [[ -z "$SCENES_LIBRARY_DEBUG_PATH" ]]; then
28+
echo "Must provide SCENES_LIBRARY_DEBUG_PATH in environment" 1>&2
29+
exit 1
30+
fi
31+
32+
echo "LD_LIBRARY_PATH at $LD_LIBRARY_PATH"
33+
echo "IGIS_LIBRARY_DEBUG_PATH at $IGIS_LIBRARY_DEBUG_PATH"
34+
echo "SCENES_LIBRARY_DEBUG_PATH at $SCENES_LIBRARY_DEBUG_PATH"
35+
echo "Building debug configuration..."
36+
swift $MODE -c debug -Xswiftc -I -Xswiftc $IGIS_LIBRARY_DEBUG_PATH -Xswiftc -L -Xswiftc $IGIS_LIBRARY_DEBUG_PATH -Xswiftc -I -Xswiftc $SCENES_LIBRARY_DEBUG_PATH -Xswiftc -L -Xswiftc $SCENES_LIBRARY_DEBUG_PATH -Xswiftc -lIgis -Xswiftc -lScenes
37+
else
38+
if [[ -z "$IGIS_LIBRARY_RELEASE_PATH" ]]; then
39+
echo "Must provide IGIS_LIBRARY_RELEASE_PATH in environment" 1>&2
40+
exit 1
41+
fi
42+
if [[ -z "$SCENES_LIBRARY_RELEASE_PATH" ]]; then
43+
echo "Must provide SCENES_LIBRARY_RELEASE_PATH in environment" 1>&2
44+
exit 1
45+
fi
46+
47+
echo "LD_LIBRARY_PATH at $LD_LIBRARY_PATH"
48+
echo "IGIS_LIBRARY_RELEASE_PATH at $IGIS_LIBRARY_RELEASE_PATH"
49+
echo "SCENES_LIBRARY_RELEASE_PATH at $SCENES_LIBRARY_RELEASE_PATH"
50+
echo "Building release configuration..."
51+
swift $MODE -c release -Xswiftc -I -Xswiftc $IGIS_LIBRARY_RELEASE_PATH -Xswiftc -L -Xswiftc $IGIS_LIBRARY_RELEASE_PATH -Xswiftc -I -Xswiftc $SCENES_LIBRARY_RELEASE_PATH -Xswiftc -L -Xswiftc $SCENES_LIBRARY_RELEASE_PATH -Xswiftc -lIgis -Xswiftc -lScenes
52+
fi
53+
else
54+
# Terminate on error after message
55+
echo "Argument specified must be either 'debug' or 'release'"
56+
exit 1;
557
fi
6-
if [[ -z "$IGIS_LIBRARY_PATH" ]]; then
7-
echo "Must provide IGIS_LIBRARY_PATH in environment" 1>&2
8-
exit 1
9-
fi
10-
if [[ -z "$SCENES_LIBRARY_PATH" ]]; then
11-
echo "Must provide SCENES_LIBRARY_PATH in environment" 1>&2
12-
exit 1
13-
fi
14-
echo "IGIS_LIBRARY_PATH at $IGIS_LIBRARY_PATH"
15-
echo "SCENES_LIBRARY_PATH at $SCENES_LIBRARY_PATH"
16-
echo "LD_LIBRARY_PATH at $LD_LIBRARY_PATH"
17-
swift build -Xswiftc -I -Xswiftc $IGIS_LIBRARY_PATH -Xswiftc -L -Xswiftc $IGIS_LIBRARY_PATH -Xswiftc -I -Xswiftc $SCENES_LIBRARY_PATH -Xswiftc -L -Xswiftc $SCENES_LIBRARY_PATH -Xswiftc -lIgis -Xswiftc -lScenes

run.sh

Lines changed: 0 additions & 17 deletions
This file was deleted.

run.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
make.sh

0 commit comments

Comments
 (0)