forked from perses-games/konan-sfml
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·27 lines (21 loc) · 817 Bytes
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env bash
DIR=.
PATH=../kotlin-native/dist/bin:$PATH
# -lcsfml-graphics -lcsfml-audio -lcsfml-window -lcsfml-network -lcsfml-system
LINKER_ARGS_linux="-L/usr/lib/x86_64-linux-gnu -lcsfml-graphics -lcsfml-audio -lcsfml-window -lcsfml-network -lcsfml-system"
if [ x$TARGET == x ]; then
case "$OSTYPE" in
darwin*) TARGET=macbook ;;
linux*) TARGET=linux ;;
*) echo "unknown: $OSTYPE" && exit 1;;
esac
fi
var=CFLAGS_${TARGET}
CFLAGS=${!var}
var=LINKER_ARGS_${TARGET}
LINKER_ARGS=${!var}
var=COMPILER_ARGS_${TARGET}
COMPILER_ARGS=${!var} # add -opt for an optimized build.
IFS=$'\n';SOURCE_FILES=(`find $DIR/src -name '*.kt'`)
SOURCE_FILES=${SOURCE_FILES[*]}
konanc $COMPILER_ARGS -target $TARGET $SOURCE_FILES -library sfml.kt.bc -linkerArgs "$LINKER_ARGS" -o HelloSfml.kexe -opt || exit 1