This repository has been archived by the owner on Dec 29, 2024. It is now read-only.
forked from vittorioromeo/SSVOpenHexagon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-win-new.sh
executable file
·153 lines (135 loc) · 3.38 KB
/
build-win-new.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/bin/bash
WS_DIR=$(readlink -f ${1})
INIT="${2}"
function getAndBuildZlib
{
(
if [ -f "${WS_DIR}/zlib/zlib1.dll" ]; then
echo "ZLib already present"
else
cd "${WS_DIR}"
mkdir ./zlib; cd ./zlib
curl http://zlib.net/zlib128-dll.zip > ./zlib.zip
unzip ./zlib.zip
fi
)
}
function getAndBuildLua
{
(
if [ -f "${WS_DIR}/lua/lua52.dll" ]; then
echo "Lua binaries already present"
else
cd "${WS_DIR}"
mkdir ./lua; cd ./lua
curl http://joedf.users.sourceforge.net/luabuilds/lua-5.2.3_Win32_bin.zip > ./lua.zip
unzip ./lua.zip
fi
if [ -f "${WS_DIR}/lua/src/lua.h" ]; then
echo "Lua sources already present"
else
cd "${WS_DIR}"
mkdir ./lua; cd ./lua
curl http://www.lua.org/ftp/lua-5.2.4.tar.gz > ./lua.tar.gz
tar -xvf ./lua.tar.gz
cd ./lua-5.2.4/
cp -R ./* ../
cd ..
cp -R ./src/ ./include/
fi
)
}
function getAndBuildSFML
{
(
cd "${WS_DIR}"
git clone https://github.com/LaurentGomila/SFML
cd ./SFML
cmake . -G "MinGW Makefiles" \
-DCMAKE_MAKE_PROGRAM="C:/MinGW/bin/mingw32-make.exe" \
-DCMAKE_C_COMPILER="C:/MinGW/bin/gcc.exe" \
-DCMAKE_CXX_COMPILER="C:/MinGW/bin/g++.exe"
mingw32-make -j2 && mingw32-make install -j2
mkdir "${WS_DIR}/SFML/bin"
cp "C:/Program Files (x86)/SFML/bin/"sfml-*.dll "${WS_DIR}/SFML/bin"
)
}
function buildExtlib
{
(
echo "${1}"
cd ./"${1}"
mkdir ./build; cd ./build
cmake .. -G "MinGW Makefiles" \
-DCMAKE_MAKE_PROGRAM="C:/MinGW/bin/mingw32-make.exe" \
-DCMAKE_C_COMPILER="C:/MinGW/bin/gcc.exe" \
-DCMAKE_CXX_COMPILER="C:/MinGW/bin/g++.exe"
mingw32-make -j2 && mingw32-make install -j2
)
}
function buildAllExtlibs
{
(
cd ./extlibs
for dir in ./*; do
if [ -d "${dir}" ]; then
echo ""
git reset HEAD --hard
git pull origin master
fi
done
buildExtlib SSVUtils
buildExtlib SSVUtilsJson
buildExtlib SSVStart
buildExtlib SSVMenuSystem
buildExtlib SSVEntitySystem
buildExtlib SSVLuaWrapper
)
}
if [ "$INIT" = true ]; then
getAndBuildZlib
getAndBuildLua
getAndBuildSFML
fi
(
SFML_DIR="${WS_DIR}/SFML"
LUA_DIR="${WS_DIR}/lua"
ZLIB_DIR="${WS_DIR}/zlib"
cd "${WS_DIR}"
if [ "$INIT" = true ]; then
git clone https://github.com/SuperV1234/SSVOpenHexagon.git
fi
cd ./SSVOpenHexagon
if [ "$INIT" = true ]; then
./init-repository.sh
buildAllExtlibs
fi
mkdir ./build; cd ./build && rm ./CMakeCache*
cmake .. -G "MinGW Makefiles" \
-DCMAKE_MAKE_PROGRAM="C:/MinGW/bin/mingw32-make.exe" \
-DCMAKE_C_COMPILER="C:/MinGW/bin/gcc.exe" \
-DCMAKE_CXX_COMPILER="C:/MinGW/bin/g++.exe" \
-DSFML_INCLUDE_DIR="${SFML_DIR}/include" \
-DSFML_AUDIO_LIBRARY="${SFML_DIR}/bin/sfml-audio-2.dll" \
-DSFML_GRAPHICS_LIBRARY="${SFML_DIR}/bin/sfml-graphics-2.dll" \
-DSFML_WINDOW_LIBRARY="${SFML_DIR}/bin/sfml-window-2.dll" \
-DSFML_SYSTEM_LIBRARY="${SFML_DIR}/bin/sfml-system-2.dll" \
-DSFML_NETWORK_LIBRARY="${SFML_DIR}/bin/sfml-network-2.dll" \
-DLUA_LIBRARY="${LUA_DIR}/lua52.dll" \
-DZLIB_LIBRARY="${ZLIB_DIR}/zlib1.dll" \
-DCMAKE_CXX_FLAGS="-std=c++1y -w -fpermissive -O3 -DNDEBUG -lz -Wl,--stack,8194304" \
-DCMAKE_CXX_FLAGS_RELEASE=""
mingw32-make -j2 && mingw32-make install -j2
cp ./SSVOpenHexagon.exe ../_RELEASE/
)
(
cd ./_RELEASE/
cp ../../SFML/bin/*.dll .
cp ../../LUA/lib/*.dll .
cp ../../zlib/lib/*.dll .
strip ./*SSV*.dll -g -s
rm ./scores.json
rm ./log.txt
rm ./users.json
rm ./Profiles/*.json
)