forked from Telroshan/go-sfml
-
Notifications
You must be signed in to change notification settings - Fork 3
/
sfml.sh
executable file
·70 lines (64 loc) · 2.41 KB
/
sfml.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env bash
## [MacOS only]
## Clones and builds SFML & CSFML at the specified versions
## Untested afeter update to version 2.5
set -e
SFML="SFML"
SFML_VERSION="2.5.1"
SFML_CMAKE_OPTIONS=""
SFML_CMAKE_OPTIONS+=" -DBUILD_SHARED_LIBS=ON"
SFML_CMAKE_OPTIONS+=" -DCMAKE_BUILD_TYPE=Release"
SFML_CMAKE_OPTIONS+=" -DCMAKE_INSTALL_FRAMEWORK_PREFIX=$PWD/$SFML/frameworks/"
SFML_CMAKE_OPTIONS+=" -DCMAKE_INSTALL_PREFIX=$PWD/$SFML/libs"
SFML_CMAKE_OPTIONS+=" -DIBTOOL=$(which ibtool)"
SFML_CMAKE_OPTIONS+=" -DSFML_BUILD_DOC=OFF"
SFML_CMAKE_OPTIONS+=" -DSFML_BUILD_EXAMPLES=ON"
SFML_CMAKE_OPTIONS+=" -DSFML_BUILD_FRAMEWORKS=OFF"
SFML_CMAKE_OPTIONS+=" -DSFML_INSTALL_XCODE_TEMPLATES=OFF"
SFML_CMAKE_OPTIONS+=" -DSFML_OPENGL_ES=OFF"
CSFML="CSFML"
CSFML_VERSION="2.5"
CSFML_CMAKE_OPTIONS=""
CSFML_CMAKE_OPTIONS+=" -DBUILD_SHARED_LIBS=ON"
CSFML_CMAKE_OPTIONS+=" -DCMAKE_BUILD_TYPE=Release"
CSFML_CMAKE_OPTIONS+=" -DCMAKE_INSTALL_PREFIX=$PWD/$CSFML/libs"
CSFML_CMAKE_OPTIONS+=" -DCSFML_BUILD_DOC=OFF"
CSFML_CMAKE_OPTIONS+=" -DCSFML_LINK_SFML_STATICALLY=ON"
CSFML_CMAKE_OPTIONS+=" -DSFML_INCLUDE_DIR=$PWD/$SFML/include"
CSFML_CMAKE_OPTIONS+=" -DCMAKE_MODULE_PATH=$PWD/$SFML/cmake/Modules/"
CSFML_CMAKE_OPTIONS+=" -DSFML_SYSTEM_LIBRARY_RELEASE=$PWD/$SFML/lib/libsfml-system.dylib"
CSFML_CMAKE_OPTIONS+=" -DSFML_WINDOW_LIBRARY_RELEASE=$PWD/$SFML/lib/libsfml-window.dylib"
CSFML_CMAKE_OPTIONS+=" -DSFML_NETWORK_LIBRARY_RELEASE=$PWD/$SFML/lib/libsfml-network.dylib"
CSFML_CMAKE_OPTIONS+=" -DSFML_GRAPHICS_LIBRARY_RELEASE=$PWD/$SFML/lib/libsfml-graphics.dylib"
CSFML_CMAKE_OPTIONS+=" -DSFML_AUDIO_LIBRARY_RELEASE=$PWD/$SFML/lib/libsfml-audio.dylib"
clone_and_checkout() {
if [ ! -d "$1" ]; then
echo -n "cloning $1 v$2..."
git clone [email protected]:SFML/$1.git > /dev/null 2>&1
echo " OK."
else
echo "$1 has already been cloned, skipping."
fi
echo -n "checking out to $1's '$2' tag..."
git -C $1 checkout $2 > /dev/null 2>&1
echo " OK."
}
clone_and_checkout "$SFML" "$SFML_VERSION"
clone_and_checkout "$CSFML" "$CSFML_VERSION"
clean_and_build() {
cd "$1"
echo "temporary moved to $PWD/"
echo -en "\tcleansing $1..."
git clean -fd > /dev/null 2>&1
echo " OK."
echo -en "\tbuilding metatools for $1..."
cmake $2 . > /dev/null 2>&1
echo " OK."
echo -en "\tbuilding $1..."
make > /dev/null 2>&1
echo " OK."
cd - > /dev/null 2>&1
echo "moved back to $PWD/"
}
clean_and_build "$SFML" "$SFML_CMAKE_OPTIONS"
clean_and_build "$CSFML" "$CSFML_CMAKE_OPTIONS"