-
Notifications
You must be signed in to change notification settings - Fork 20
/
pack_app.sh
125 lines (102 loc) · 3.65 KB
/
pack_app.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
#!/bin/bash
#./pack_app.sh PolyVR
#./pack_app.sh FinancialFolder conceptV1.pvr /c/Users/Victor/Projects/financialocean
#./pack_app.sh PoscarViewer poscarImport.pvr /c/Users/Victor/Projects/surfacechemistry
appName=$1
appProject=$2
appFolder=$3
pckFolder="packages/"$appName
vcpkgLibs="/c/usr/vcpkg/installed/x64-windows/lib"
pyPath="/c/usr/vcpkg/installed/x64-windows/share/python2/Lib"
redistPath="/c/Program Files (x86)/Windows Kits/10/Redist/10.0.19041.0/ucrt/DLLs/x64"
signtoolPath="/c/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0/x64/signtool.exe"
check_signature() {
"$signtoolPath" verify -pa "$1" &> /dev/null
if [ $? -eq 0 ]; then
echo "checked signature of $1, it is signed"
return 0 # "The executable is signed."
else
echo "checked signature of $1, it is NOT signed"
return 1 # "The executable is not signed."
fi
}
sign_polyvr() {
check_signature build/Release/polyvr.exe
if [ $? -eq 1 ]; then
if [ -e codeSigning/sign_polyvr.sh ]; then
echo "sign polyvr!"
cd codeSigning
./sign_polyvr.sh
cd ..
fi
fi
}
if [ ! -e $pckFolder ]; then
mkdir -p $pckFolder
fi
rm -rf $pckFolder/*
sign_polyvr
if [ -n "$appFolder" ]; then # check is appFolder given
echo " copy app data"
cp -r $appFolder/* $pckFolder/
fi
echo " copy polyvr"
mkdir $pckFolder/engine
mkdir $pckFolder/engine/src
cp -r build/Release/* $pckFolder/engine/
cp -r src/cluster $pckFolder/engine/src/cluster
cp -r ressources $pckFolder/engine/ressources
cp -r setup $pckFolder/engine/setup
cp -r shader $pckFolder/engine/shader
cp -r examples $pckFolder/engine/examples
echo " copy libs"
cp -r $pyPath $pckFolder/engine/pyLibs
mkdir -p $pckFolder/engine/libs
cp -r "$redistPath"/* $pckFolder/engine/libs/
cp -r /c/Windows/system32/MSVCP140.dll $pckFolder/engine/libs/
cp -r /c/Windows/system32/VCRUNTIME140.dll $pckFolder/engine/libs/
cp -r /c/Windows/system32/VCRUNTIME140_1.dll $pckFolder/engine/libs/
cp -r /c/usr/lib/opensg/* $pckFolder/engine/libs/
cp -r /c/usr/lib/cef/* $pckFolder/engine/libs/
cp -r /c/usr/lib/oce/* $pckFolder/engine/libs/
cp -r /c/usr/lib/ifc/* $pckFolder/engine/libs/
cp -r /c/usr/lib/openvr/* $pckFolder/engine/libs/
cp -r /c/usr/lib/collada/* $pckFolder/engine/libs/
cp -r "$vcpkgLibs"/* $pckFolder/engine/libs/
echo " cleanup"
rm $pckFolder/engine/polyvr.pdb
rm $pckFolder/engine/libs/*.pdb
rm -rf $pckFolder/engine/ressources/cef
rm -rf $pckFolder/engine/ressources/cef18
if [ -n "$appProject" ]; then # check is appProject given
cat <<EOT >> $pckFolder/startApp.bat
@echo off
set PATH=%PATH%;%~f0\..\engine\libs;
set PYTHONPATH=%PYTHONPATH%;%~f0\..\engine\pyLibs
cd engine
polyvr.exe --dofailcheck=0 --maximized=1 --application ../$appProject
EOT
cat <<EOT >> $pckFolder/startAppNoTerm.vbs
Set WshShell = CreateObject("WScript.Shell")
WshShell.Environment("Process")("PATH") = WshShell.Environment("Process")("PATH") & ";" & WshShell.CurrentDirectory & "\engine\libs"
WshShell.Environment("Process")("PYTHONPATH") = WshShell.Environment("Process")("PYTHONPATH") & ";" & WshShell.CurrentDirectory & "\engine\pyLibs"
WshShell.CurrentDirectory = WshShell.CurrentDirectory & "\engine"
WshShell.Run "polyvr.exe --dofailcheck=0 --maximized=1 --application ../$appProject", 0
Set WshShell = Nothing
EOT
else
cat <<EOT >> $pckFolder/startApp.bat
@echo off
set PATH=%PATH%;%~f0\..\engine\libs;
set PYTHONPATH=%PYTHONPATH%;%~f0\..\engine\pyLibs
cd engine
polyvr.exe
EOT
fi
if [ -e $pckFolder/deploy/cleanup.sh ]; then
/bin/bash $pckFolder/deploy/cleanup.sh
fi
#polyvr.exe --standalone=1 --fullscreen=1 --application ../$appProject
#polyvr.exe --standalone=1 --application ../$appProject
echo " done"
# package the folder $pckFolder with inno setup compiler