Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
CMAKE_DIR='/c/Program Files/CMake/bin'
GCC_DIR=/c/msys64/mingw64/bin
DOXY_DIR='/c/Program Files/doxygen/bin'
PATH=$PATH:$GCC_DIR:$CMAKE_DIR:$DOXY_DIR
ROOT=/c/SFML
SFML_MASTER=$ROOT/sfml-master
SFML_BUILD=$SFML_MASTER/bin
VERSION=$1
if [[ $VERSION == '' ]]; then
VERSION="2.5.1"
fi
if [ ! -d $ROOT ]; then
mkdir -p $ROOT
fi
cd $ROOT
if [ ! -d $SFML_MASTER ]; then
git clone https://github.com/SFML/SFML.git $SFML_MASTER
else
cd $SFML_MASTER
git pull
git checkout master
fi
if [[ $VERSION != 'latest' ]]; then
git checkout $VERSION
fi
if [ ! -d $SFML_BUILD ]; then
mkdir -p $SFML_BUILD
fi
# =============================================================================
MAKE_EXE=$GCC_DIR/mingw32-make.exe
BLD_RELEASE_DIR=$SFML_BUILD/Release
BLD_DEBUG_DIR=$SFML_BUILD/Debug
if [ ! -d $BLD_RELEASE_DIR ]; then
mkdir -p $BLD_RELEASE_DIR
fi
if [ ! -d $BLD_DEBUG_DIR ]; then
mkdir -p $BLD_DEBUG_DIR
fi
cd $BLD_RELEASE_DIR
cmake -G "MinGW Makefiles" $SFML_MASTER -DCMAKE_SH="CMAKE_SH-NOTFOUND" -DSFML_BUILD_DOC=TRUE -DSFML_BUILD_EXAMPLES=TRUE
$MAKE_EXE -j8
cd $BLD_DEBUG_DIR
cmake -G "MinGW Makefiles" $SFML_MASTER -DCMAKE_SH="CMAKE_SH-NOTFOUND" -DCMAKE_BUILD_TYPE=Debug
$MAKE_EXE -j8
cd $BLD_RELEASE_DIR
cmake -G "MinGW Makefiles" $SFML_MASTER -DCMAKE_SH="CMAKE_SH-NOTFOUND" -DBUILD_SHARED_LIBS=FALSE
$MAKE_EXE -j8
cd $BLD_DEBUG_DIR
cmake -G "MinGW Makefiles" $SFML_MASTER -DCMAKE_SH="CMAKE_SH-NOTFOUND" -DBUILD_SHARED_LIBS=FALSE -DCMAKE_BUILD_TYPE=Debug
$MAKE_EXE -j8
OUT=/c/SFML/$VERSION
if [ ! -d $OUT ]; then
mkdir -p $OUT
else
rm -rf $OUT
mkdir -p $OUT
fi
mkdir -p $OUT/bin
mkdir -p $OUT/doc
mkdir -p $OUT/lib
ARCH=x86
DLIB_EXT=dll
cp -r $BLD_RELEASE_DIR/lib/*.$DLIB_EXT $OUT/bin
cp -r $BLD_DEBUG_DIR/lib/*.$DLIB_EXT $OUT/bin
cp -r $BLD_RELEASE_DIR/lib/*.a $OUT/lib
cp -r $BLD_DEBUG_DIR/lib/*.a $OUT/lib
cp -r $BLD_RELEASE_DIR/doc/html $OUT/doc
cp -r $SFML_MASTER/extlibs/libs-mingw/$ARCH/*.a $OUT/lib
cp -r $SFML_MASTER/extlibs/bin/$ARCH/*.$DLIB_EXT $OUT/bin
cp -r $SFML_MASTER/include $OUT
cp -r $SFML_MASTER/examples $OUT
cp -r $SFML_MASTER/license.md $OUT/license.md
cp -r $SFML_MASTER/readme.md $OUT/readme.md
cd $BLD_RELEASE_DIR/examples
for dir in *; do
cp -r ./$dir/$dir.exe $OUT/examples/$dir &> /dev/null
done
cp -r ./sound_capture/sound-capture.exe $OUT/examples/sound_capture &> /dev/null
mv -f $OUT/examples/sound_capture $OUT/examples/sound-capture
rm -rf $OUT/examples/CMakeLists.txt $OUT/examples/**/CMakeLists.txt $OUT/examples/X11 $OUT/examples/android $OUT/examples/assets $OUT/examples/cocoa
echo 'Did the stuff'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment