1#!/bin/bash
2
3MYDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4cd $MYDIR
5
6# Build and install the cmake static library and headers into a subdirectory
7# Specifically: third_party/SDL2-2.0.3/build/linux64/{lib,include}
8#
9# This really should become an ExternalProject_Add inside the CMakelists.txt
10# and windows, linux, and osx should all use the same approach for building cmake.
11pushd third_party/SDL2-2.0.8
12    CMAKE_CMD='cmake
13    -D ARTS:BOOL=OFF
14    -D ALSA:BOOL=OFF
15    -D PULSEAUDIO:BOOL=OFF
16    -D OSS:BOOL=OFF
17    -D ESD:BOOL=OFF
18    -D SDL_SHARED:BOOL=OFF
19    -D CMAKE_INSTALL_PREFIX="../linux64"
20    -G "Unix Makefiles"
21    -D CMAKE_DEBUG_POSTFIX="_debug"
22    -D SDL_STATIC_PIC:BOOL=ON
23    '
24
25    mkdir -p build/linrelease
26    pushd build/linrelease
27        eval $CMAKE_CMD -D CMAKE_BUILD_TYPE="Debug" ../.. || exit 1
28        make -j install || exit 1
29    popd
30popd
31
32mkdir -p build
33cd build
34
35cmake $@ .. || exit 1
36make -j || exit 1
37