-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·66 lines (56 loc) · 1.74 KB
/
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
65
66
#!/bin/bash
build_linux() {
echo "Building for Linux..."
cargo build --release
}
build_windows() {
echo "Building for Windows..."
# Why this has to be so hard?
# I bricked my gnome, trying to compile this shit, still nothing
# TODO: Create VM for compiling Windows application
# export PKG_CONFIG_ALLOW_CROSS=1
# export PKG_CONFIG_PATH="/usr/lib/pkgconfig"
# export PKG_CONFIG_SYSROOT_DIR="/opt/gtk/builddir"
# # MinGW paths
# export PATH="/usr/x86_64-w64-mingw32/bin:$PATH"
# export LIBRARY_PATH="/usr/x86_64-w64-mingw32/lib"
# export C_INCLUDE_PATH="/usr/x86_64-w64-mingw32/include"
# export CPLUS_INCLUDE_PATH="/usr/x86_64-w64-mingw32/include"
# # Set cross-compilation tools
# export CC_x86_64_pc_windows_gnu=x86_64-w64-mingw32-gcc
# export CXX_x86_64_pc_windows_gnu=x86_64-w64-mingw32-g++
# export AR_x86_64_pc_windows_gnu=x86_64-w64-mingw32-ar
# export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=x86_64-w64-mingw32-gcc
rustup target add x86_64-pc-windows-gnu
cargo build --release --target x86_64-pc-windows-gnu
# Optionally, strip the resulting executable
# strip target/x86_64-pc-windows-gnu/release/qr2m.exe
}
build_macos() {
echo "Building for macOS..."
rustup target add x86_64-apple-darwin
cargo build --release --target x86_64-apple-darwin
}
build_all() {
build_linux
build_windows
build_macos
}
if [ "$1" == "--os" ]; then
case $2 in
linux)
build_linux
;;
win)
build_windows
;;
mac)
build_macos
;;
*)
echo "Invalid OS specified. Use 'linux', 'win', or 'mac'."
;;
esac
# else
# build_all
fi