forked from Potion/Cinder-CEF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_cef.sh
executable file
·118 lines (92 loc) · 3.72 KB
/
build_cef.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
#!/bin/bash
# Set CEF Version
BIN_SOURCE="http://opensource.spotify.com/cefbuilds/"
CEF_VERSION="3.3282.1734.g8f26fe0"
# Enable bash strict mode
set -uo pipefail
IFS=$'\n\t'
# Detect OS
PLATFORM='unknown'
UNAMESTR=`uname`
if [[ "$UNAMESTR" == 'Darwin' ]]; then PLATFORM='mac'
elif [[ "$UNAMESTR" =~ ^MINGW ]]; then PLATFORM='win'
elif [[ "$UNAMESTR" == 'Linux' ]]; then PLATFORM='linux'
fi
if [[ "$PLATFORM" == 'linux' ]]; then
echo "Linux PLATFORM not supported"
exit 1
elif [[ "$PLATFORM" == 'unknown' ]]; then
echo "Please run this script with Terminal on Mac, or Git Bash/MINGW terminal on Windows"
exit 1
fi
if [[ "$PLATFORM" == 'mac' ]]; then
CEF_FILENAME="cef_binary_"$CEF_VERSION"_macosx64_minimal"
elif [[ "$PLATFORM" == 'win' ]]; then
CEF_FILENAME="cef_binary_"$CEF_VERSION"_windows64_minimal"
fi
# Get CEF binary release
DOWNLOAD_CEF=1
if [[ -e "$CEF_FILENAME.tar.bz2" ]]; then
echo "Found $CEF_FILENAME.tar.bz2 in the current directory"
read -p "Use this file? [y]/n: " -n 1 -r
if [[ ! $REPLY =~ ^[Nn]$ ]]; then DOWNLOAD_CEF=0; fi
fi
if [ $DOWNLOAD_CEF == 1 ]; then
echo "Downloading CEF binary release..."
echo "$BIN_SOURCE$CEF_FILENAME.tar.bz2"
curl -O "$BIN_SOURCE$CEF_FILENAME.tar.bz2"
if [ $? != 0 ]; then echo "Error downloading CEF binary release."; exit 1; fi
fi
echo "Unpacking..."
tar -xf "$CEF_FILENAME.tar.bz2"
if [ $? != 0 ]; then echo "Error unpacking CEF binary release."; exit 1; fi
rm -rf cef
mv "$CEF_FILENAME" cef
# Run cmake
echo "Building CEF...(cmake)"
cd cef
if [[ "$PLATFORM" == 'mac' ]]; then
cmake -G "Xcode"
elif [[ "$PLATFORM" == 'win' ]]; then
cmake -G "Visual Studio 14 2015 Win64" -DUSE_SANDBOX=Off
fi
if [ $? != 0 ]; then echo "Error preparing build files with cmake."; exit 1; fi
# Compile
echo "Building CEF...(compiling)"
if [[ "$PLATFORM" == 'mac' ]]; then
xcodebuild -quiet -target libcef_dll_wrapper -configuration Release -project cef.xcodeproj/
elif [[ "$PLATFORM" == 'win' ]]; then
'C:/Program Files (x86)/MSBuild/14.0/Bin/MSBuild.exe' -m -nologo -verbosity:quiet -target:libcef_dll_wrapper -p:"Configuration=Release;Platform=x64" cef.sln
'C:/Program Files (x86)/MSBuild/14.0/Bin/MSBuild.exe' -m -nologo -verbosity:quiet -target:libcef_dll_wrapper -p:"Configuration=Debug;Platform=x64" cef.sln
fi
cd ..
if [ $? != 0 ]; then echo "Error building CEF."; exit 1; fi
echo "Copying files to block lib folder..."
mkdir -p "libs/cef/include"
if [[ "$PLATFORM" == 'mac' ]]; then
mkdir -p "libs/cef/lib/osx"
mv "cef/include" "libs/cef/"
mv "cef/Release/Chromium Embedded Framework.framework" "libs/cef/lib/osx/"
mv "cef/libcef_dll_wrapper/Release/libcef_dll_wrapper.a" "libs/cef/lib/osx/"
echo "Building cef_helper_mac..."
cd libs/cef/
xcodebuild -quiet -target cef_helper_mac -configuration Release -project ../../cef_helper_mac/cef_helper_mac.xcodeproj/
if [ $? != 0 ]; then echo "Error building cef_helper_mac."; exit 1; fi
elif [[ "$PLATFORM" == 'win' ]]; then
rm -rf libs/cef/include/*
cp -r cef/include/* "libs/cef/include/"
mkdir -p "libs/cef/lib/vs/x64/Release"
cp "cef/Release/libcef.lib" "libs/cef/lib/vs/x64/Release"
cp "cef/libcef_dll_wrapper/Release/libcef_dll_wrapper.lib" "libs/cef/lib/vs/x64/Release/"
mkdir -p "libs/cef/lib/vs/x64/Debug"
cp "cef/Release/libcef.lib" "libs/cef/lib/vs/x64/Debug"
cp "cef/libcef_dll_wrapper/Debug/libcef_dll_wrapper.lib" "libs/cef/lib/vs/x64/Debug/"
cp -r cef/Release/* "libs/cef/export/vs/x64/"
cp -r cef/Resources/* "libs/cef/export/vs/x64/"
rm "libs/cef/export/vs/x64/libcef.lib"
rm "libs/cef/export/vs/x64/cef_sandbox.lib"
rm "libs/cef/export/vs/x64/widevinecdmadapter.dll"
fi
#echo "Cleaning up..."
#rm $CEF_FILENAME.tar.bz2
echo "Done!"