-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathenvironment.sh
More file actions
122 lines (86 loc) · 2.99 KB
/
environment.sh
File metadata and controls
122 lines (86 loc) · 2.99 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
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
#!/bin/sh
set -e
#--------------------------------------------------------------------------------------------------
# Settings
#--------------------------------------------------------------------------------------------------
thirdparty="../3rdparty"
#--------------------------------------------------------------------------------------------------
# environment
compiler_win="mingw"
qt="qt6"
vlc="vlc3"
mobile="simulator"
#--------------------------------------------------------------------------------------------------
# Functions
#--------------------------------------------------------------------------------------------------
replace()
{
expression='s/'"$1"'=\"'"$2"'"/'"$1"'=\"'"$3"'"/g'
apply $expression environment.sh
apply $expression 3rdparty.sh
apply $expression configure.sh
apply $expression build.sh
apply $expression deploy.sh
apply $expression dist/shaders/generate.sh
}
apply()
{
if [ $host = "macOS" ]; then
sed -i "" $1 $2
else
sed -i $1 $2
fi
}
#--------------------------------------------------------------------------------------------------
getOs()
{
case `uname` in
Darwin*) echo "macOS";;
*) echo "other";;
esac
}
#--------------------------------------------------------------------------------------------------
# Syntax
#--------------------------------------------------------------------------------------------------
if [ $# != 1 -a $# != 2 ] \
|| \
[ $1 != "mingw" -a $1 != "msvc" -a \
$1 != "qt4" -a $1 != "qt5" -a $1 != "qt6" -a \
$1 != "vlc3" -a $1 != "vlc4" -a \
$1 != "simulator" -a $1 != "device" ] \
|| \
[ $# = 2 -a "$2" != "all" ]; then
echo "Usage: environment <mingw | msvc"
echo " qt4 | qt5 | qt6 |"
echo " vlc3 | vlc4 |"
echo " simulator | device> [all]"
exit 1
fi
#--------------------------------------------------------------------------------------------------
# Configuration
#--------------------------------------------------------------------------------------------------
host=$(getOs)
#--------------------------------------------------------------------------------------------------
# 3rdparty
#--------------------------------------------------------------------------------------------------
if [ "$2" = "all" ]; then
echo "ENVIRONMENT 3rdparty"
echo "--------------------"
cd "$thirdparty"
sh environment.sh $1
cd -
echo "--------------------"
echo ""
fi
#--------------------------------------------------------------------------------------------------
# Replacements
#--------------------------------------------------------------------------------------------------
if [ $1 = "msvc" -o $1 = "mingw" ]; then
replace compiler_win $compiler_win $1
elif [ $1 = "qt4" -o $1 = "qt5" -o $1 = "qt6" ]; then
replace qt $qt $1
elif [ $1 = "vlc3" -o $1 = "vlc4" ]; then
replace vlc $vlc $1
else
replace mobile $mobile $1
fi