forked from mmertama/Gempyre
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mingw_install.sh
executable file
·114 lines (81 loc) · 2.67 KB
/
mingw_install.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
#!/bin/bash
set -e
CMD_STR='$ ./mingw_install.sh [-all] [-dir <DIR>] [-debug] [-release]'
export PATH="/mingw64/bin/:$PATH"
if ! [ -x "$(command -v gcc)" ]; then
echo gcc not found, are you using msys terminal?
echo see $ pacman -S mingw-w64-x86_64-toolchain
echo $CMD_STR
echo DIR is optional and points to the install dir, defaults defined in GnuInstallDirs where the find_package should find it.
exit 1
fi
if ! [ -x "$(command -v git)" ]; then
echo git not found, do you have git installed for your msys terminal?
echo $CMD_STR
echo DIR is optional and points to the install dir, defaults defined in GnuInstallDirs where the find_package should find it.
exit 1
fi
if ! [ -x "$(command -v ninja)" ]; then
echo ninja not found
echo $CMD_STR
echo DIR is optional and points to the install dir, defaults defined in GnuInstallDirs where the find_package should find it.
exit 1
fi
if ! [ -x ${CMAKE} ]; then
echo ${CMAKE} not found
echo $CMD_STR
echo DIR is optional and points to the install dir, defaults defined in GnuInstallDirs where the find_package should find it.
exit 1
fi
ONOFF="OFF"
PREFIX=""
TARGET=""
while [ -n "$1" ]; do # while loop starts
if [ "$1" == '-all' ]; then
ONOFF="ON"
fi
if [ "$1" == '-dir' ]; then
PREFIX="$2"
shift
fi
if [ "$1" == '-debug' ]; then
TARGET="DEBUG"
fi
if [ "$1" == '-release' ]; then
TARGET="RELEASE"
fi
shift
done
if [[ $PREFIX -ne "" && ! -d $PREFIX ]]; then
echo "$PREFIX not found"
return
fi
if [[ $PREFIX -ne "" && -d $PREFIX ]]; then
PREFIX=-DCMAKE_INSTALL_PREFIX=$PREFIX
return
fi
mkdir -p mingw_build
pushd mingw_build
if [ -f "install.log" ]; then
rm install.log
fi
PWD=$(pwd)
BUILD_PATH=$(cygpath -w $PWD)
if [[ ! "$TARGET" == "RELEASE" ]]; then
cmake .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug -DHAS_AFFILIATES=$ONOFF -DHAS_TEST=$ONOFF -DHAS_EXAMPLES=$ONOFF $PREFIX
cmake --build . --config Debug
popd
echo Start an elevated prompt for an install.
powershell -Command "Start-Process scripts\win_inst.bat -Verb RunAs -ArgumentList ${BUILD_PATH},Debug"
pushd mingw_build
fi
if [[ ! "$TARGET" == "DEBUG" ]]; then
cmake .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DHAS_AFFILIATES=$ONOFF -DHAS_TEST=$ONOFF -DHAS_EXAMPLES=$ONOFF $PREFIX
cmake --build . --config Release
popd
echo Start an elevated prompt for an install.
powershell -Command "Start-Process scripts\win_inst.bat -Verb RunAs -ArgumentList ${BUILD_PATH}"
fi
echo "Run install test"
test/install_test/install_test.sh mingw_build $TARGET
echo done