-
Notifications
You must be signed in to change notification settings - Fork 12
/
build_windows.sh
executable file
·55 lines (45 loc) · 1.48 KB
/
build_windows.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
#!/bin/bash
# Cross compile for Windows from Linux
TEMP_PATH="$(pwd)/winpath"
set -e
# Compile and build zlib
if [ -d "zlib" ]; then
cd zlib && git pull
else
git clone https://github.com/madler/zlib && cd zlib
fi
mkdir -p build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../cmake/toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=$TEMP_PATH ..
make -j4
make install
cd ../..
# Clone and build ligpng
if [ -d "libpng" ]; then
cd libpng && git pull
else
git clone https://github.com/glennrp/libpng && cd libpng
fi
mkdir -p build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../cmake/toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=$TEMP_PATH ..
make -j4
make install
cd ../..
# Download libsndfile
if [ ! -d "libsndfile-1.0.29-win64" ]; then
wget https://github.com/erikd/libsndfile/releases/download/v1.0.29/libsndfile-1.0.29-win64.zip
unzip libsndfile-1.0.29-win64.zip
fi
cp "libsndfile-1.0.29-win64/bin/sndfile.dll" $TEMP_PATH/bin/sndfile.dll
cp "libsndfile-1.0.29-win64/include/sndfile.h" $TEMP_PATH/include/sndfile.h
cp "libsndfile-1.0.29-win64/lib/sndfile.lib" $TEMP_PATH/lib/sndfile.lib
# Copy DLL's into root for CPack
cp $TEMP_PATH/bin/*.dll ../
buildtype="Debug"
if [[ "$1" == "Release" ]]; then
buildtype="Release"
fi
# Build aptdec
mkdir -p winbuild && cd winbuild
cmake -DCMAKE_BUILD_TYPE=$buildtype -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=$TEMP_PATH ..
make -j 4
make package