Skip to content

Commit 274a66d

Browse files
Add script build for macOS
1 parent a8a09b9 commit 274a66d

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

scripts/ci_macos.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
build_entry="build"
3+
opt_flags="-O3 -march=native -flto -funroll-loops -fomit-frame-pointer -fstrict-aliasing -ftree-vectorize -fvisibility=hidden"
4+
5+
install_homebrew() {
6+
if ! command -v brew > /dev/null; then
7+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
8+
fi
9+
}
10+
11+
setup_env() {
12+
eval "$(/opt/homebrew/bin/brew shellenv)"
13+
}
14+
15+
install_dependencies() {
16+
brew install qt@6 cmake ninja
17+
18+
export PATH="/opt/homebrew/opt/qt@6/bin:$PATH"
19+
export QT_DIR="/opt/homebrew/opt/qt@6"
20+
}
21+
22+
create_dir() {
23+
mkdir -p "$build_entry"
24+
cd "$build_entry" || exit
25+
}
26+
27+
cfg_and_build() {
28+
cmake \
29+
-DCMAKE_BUILD_TYPE=Release \
30+
-DCMAKE_CXX_COMPILER=clang++ \
31+
-DCMAKE_CXX_FLAGS="$opt_flags" \
32+
-G "Ninja" \
33+
..
34+
35+
ninja
36+
}
37+
38+
match_options() {
39+
case $1 in
40+
"install-base") install_homebrew ;;
41+
"install-libs") install_dependencies ;;
42+
"setup-build") create_build_dir ;;
43+
"build-release") cfg_and_build ;;
44+
45+
*) echo "Missing arg: $1" && exit 1 ;;
46+
esac
47+
}
48+
49+
match_options "$1"

0 commit comments

Comments
 (0)