Skip to content

Commit

Permalink
osx external.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
francisdb committed Oct 21, 2024
1 parent 2886d69 commit fd1ef26
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions platforms/osx/x64/external.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash

set -e

SDL_VERSION=3.1.3

NUM_PROCS=$(nproc)

echo "Building external libraries..."
echo " SDL_VERSION: ${SDL_VERSION}"
echo ""

if [ -z "${BUILD_TYPE}" ]; then
BUILD_TYPE="Release"
fi

echo "Build type: ${BUILD_TYPE}"
echo "Procs: ${NUM_PROCS}"
echo ""

CACHE_DIR="external/cache/${BUILD_TYPE}"

rm -rf external/include external/lib
mkdir -p external/include external/lib ${CACHE_DIR}

rm -rf tmp
mkdir tmp
cd tmp

#
# build SDL3, SDL_image, SDL_ttf and copy to external
#

CACHE_NAME="SDL-${SDL_VERSION}_002"

if [ ! -f "../${CACHE_DIR}/${CACHE_NAME}.cache" ]; then
curl -sL https://github.com/libsdl-org/SDL/releases/download/preview-${SDL_VERSION}/SDL3-${SDL_VERSION}.tar.xz -o SDL3-${SDL_VERSION}.tar.xz
tar -xf SDL3-3.1.3.tar.xz
cd SDL3-3.1.3
cmake \
-DSDL_SHARED=ON \
-DSDL_STATIC=OFF \
-DSDL_TEST_LIBRARY=OFF \
-DSDL_OPENGLES=OFF \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-B build
cmake --build build -- -j${NUM_PROCS}
mkdir -p ../../${CACHE_DIR}/${CACHE_NAME}/include/SDL3
cp -r include/SDL3/* ../../${CACHE_DIR}/${CACHE_NAME}/include/SDL3
mkdir -p ../../${CACHE_DIR}/${CACHE_NAME}/lib
cp -a build/*.{so,so.*} ../../${CACHE_DIR}/${CACHE_NAME}/lib
cd ..

touch "../${CACHE_DIR}/${CACHE_NAME}.cache"
fi

mkdir -p ../external/include/SDL3
cp -r ../${CACHE_DIR}/${CACHE_NAME}/include/SDL3/* ../external/include/SDL3
cp -a ../${CACHE_DIR}/${CACHE_NAME}/lib/*.{so,so.*} ../external/lib

0 comments on commit fd1ef26

Please sign in to comment.