-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathci_build.sh
64 lines (53 loc) · 1.55 KB
/
ci_build.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
#!/usr/bin/env bash
# build.sh <action> ...
# ci_platform: windows
# ci_action: dependencies|generate|build|install|test
# ci_source_dir: source code directory
# ci_build_dir: cmake cache directory
# ci_native_sdk_dir: native SDK (linux) installation directory
# ci_target_sdk_dir: target SDK (web) installation directory
ci_action=$1; shift;
ci_source_dir=${ci_source_dir%/}; # remove trailing slash if any
echo "ci_platform=$ci_platform"
echo "ci_action=$ci_action"
echo "ci_source_dir=$ci_source_dir"
echo "ci_build_dir=$ci_build_dir"
echo "ci_native_sdk_dir=$ci_native_sdk_dir"
echo "ci_target_sdk_dir=$ci_target_sdk_dir"
declare -A build_config=(
[web]='Release'
[windows]='RelWithDebInfo'
)
function action-dependencies() {
:
}
function action-generate() {
local params=(
"-B"
"$ci_build_dir"
"-S"
"$ci_source_dir"
"-DREBELFORK_SDK=$ci_target_sdk_dir"
)
if [[ "$ci_platform" == "windows" ]]; then
params+=(
"-G"
"Visual Studio 17 2022"
"-A"
"x64"
"-DCMAKE_BUILD_TYPE=${build_config[$ci_platform]}"
)
fi
cmake "${params[@]}"
}
function action-build() {
cmake --build $ci_build_dir --parallel $(nproc) --config ${build_config[$ci_platform]}
}
function action-prepare() {
if [[ "$ci_platform" == "windows" ]]; then
cd $ci_build_dir/${build_config[$ci_platform]}
mkdir $ci_build_dir/upload/
cp *.dll *.lib *.exp *.pdb $ci_build_dir/upload/
fi
}
action-$ci_action