-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_mac.bash
More file actions
executable file
·83 lines (69 loc) · 2.03 KB
/
Copy pathbuild_mac.bash
File metadata and controls
executable file
·83 lines (69 loc) · 2.03 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
# Before building, find the root directory where the .git folder exists.
while [ 1 ]
do
if [[ -d '.git' ]]
then
break
elif [[ $(pwd) = '/' ]]
then
echo "No git repository found, exiting"
exit 1
else
cd ..
fi
done
ROOT="$(pwd)"
SRC="$ROOT/src"
VENDOR="$ROOT/vendor"
SDL_DIR="SDL2-2.0.12"
# Check if appropriate vendor directorys exist.
VENDORS="$VENDOR/$SDL_DIR"
for vendor in $VENDORS
do
if [[ ! -d $vendor ]]
then
echo "Missing vendor directory $vendor... exiting"
exit 1
fi
done
# Setup a build directory.
if [[ ! -d "build" ]]
then
mkdir build
fi
cd build
# Check if SDL2 has been built. If not then build it.
if [[ ! -f "libSDL2.a" ]]
then
echo "========================"
echo "= BUILDING SDL2 ="
echo "========================\n"
# setup temp directory
mkdir sdl
cd sdl
# build
$VENDOR/$SDL_DIR/configure
make
# copy static lib and remove temp directory
cd ..
cp "sdl/build/.libs/libSDL2.a" .
rm -rf sdl
fi
SDL_INCLUDE="$VENDOR/$SDL_DIR/include"
SDL_LINK_FLAGS="-lm -liconv -lobjc"
SDL_LINK_FLAGS="$SDL_LINK_FLAGS -Wl,-framework,AVFoundation"
SDL_LINK_FLAGS="$SDL_LINK_FLAGS -Wl,-framework,AudioToolbox"
SDL_LINK_FLAGS="$SDL_LINK_FLAGS -Wl,-framework,CoreAudio"
SDL_LINK_FLAGS="$SDL_LINK_FLAGS -Wl,-framework,CoreVideo"
SDL_LINK_FLAGS="$SDL_LINK_FLAGS -Wl,-framework,CoreGraphics"
SDL_LINK_FLAGS="$SDL_LINK_FLAGS -Wl,-framework,CoreMotion"
SDL_LINK_FLAGS="$SDL_LINK_FLAGS -Wl,-framework,Cocoa"
SDL_LINK_FLAGS="$SDL_LINK_FLAGS -Wl,-framework,Carbon"
SDL_LINK_FLAGS="$SDL_LINK_FLAGS -Wl,-framework,Foundation"
SDL_LINK_FLAGS="$SDL_LINK_FLAGS -Wl,-framework,ForceFeedback"
SDL_LINK_FLAGS="$SDL_LINK_FLAGS -Wl,-framework,GameController"
SDL_LINK_FLAGS="$SDL_LINK_FLAGS -Wl,-framework,IOKit"
SDL_LINK_FLAGS="$SDL_LINK_FLAGS -Wl,-weak_framework,QuartzCore"
SDL_LINK_FLAGS="$SDL_LINK_FLAGS -Wl,-weak_framework,Metal"
clang -O2 -I $SDL_INCLUDE -L . -lSDL2 $SDL_LINK_FLAGS -std=c++11 -o cgol $SRC/main.cpp