-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathinstall.cmake.sh
More file actions
executable file
·123 lines (97 loc) · 2.92 KB
/
Copy pathinstall.cmake.sh
File metadata and controls
executable file
·123 lines (97 loc) · 2.92 KB
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
#!/bin/bash
# ========= Architecture =========
# Detect OS and Architecture
OS=$(uname -s)
ARCH=$(uname -m)
echo "$OS - $ARCH"
# ========= paramter cofig =========
FORCE_MAC_X86=false
BUILD_UNIVERSAL=false
while [[ $# -gt 0 ]]; do
case "$1" in
--force-x86)
FORCE_MAC_X86=true
ARCH="x86_64"
shift
;;
--universal)
BUILD_UNIVERSAL=true
shift
;;
*)
echo "Not known parameter: $1"
exit 1
;;
esac
done
echo "After mofidifying: $OS - $ARCH"
# ========= libtorch path =========
cmake_prefix_path_tmp="subprojects/libtorch/share/cmake"
echo "Default Torch path: $cmake_prefix_path_tmp"
# ========= clone submodules =========
git submodule update --init --recursive
# ========= libtorch =========
# current version not needed
# ./download_libtorch_unix.sh
# ========= Icon =========
## generate icon for PretextViewAI
## which is already finished and pushed to the repo
# cd ico_design && cd ico_design && iconutil -c icns icon_v2.iconset && cd ..
# ========= fmt =========
cd subprojects/fmt
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=${ARCH} -S . -B build
cmake --build build --target fmt --config Release || {
echo "fmt: compile failed!"
exit 1
}
cd ../../
# ========= libdeflate =========
cd subprojects/libdeflate
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=${ARCH} -S . -B build
cmake --build build --target libdeflate_static --config Release || {
echo "libdeflate: compile failed!"
exit 1
}
cd ../../
# ========= CMake compile and install =========
# Finished: there are still problem for installation as the app can not find the LC_RPATH, need to fix this
build_dir="build_cmake"
install_path="app"
if [[ "$OS" == "Darwin" || "$OS" == "Linux" ]]; then
rm -rf ${build_dir} ${install_path}
else
echo "Unsupported platform: $OS"
exit 1
fi
CMAKE_OPTIONS=(
-DCMAKE_BUILD_TYPE=Release
-DGLFW_BUILD_WAYLAND=OFF
# -DGLFW_BUILD_X11=OFF
-DWITH_TORCH=OFF
-DCMAKE_INSTALL_PREFIX="$install_path"
-DCMAKE_PREFIX_PATH="$cmake_prefix_path_tmp"
-DCMAKE_OSX_ARCHITECTURES=${ARCH}
-DPYTHON_SCOPED_INTERPRETER=OFF
)
if [[ "$OS" == "Darwin" ]]; then
if [[ "$FORCE_MAC_X86" == true ]]; then
CMAKE_OPTIONS+=(
-DFORCE_MAC_X86=ON
)
elif [[ "$BUILD_UNIVERSAL" == true ]]; then
CMAKE_OPTIONS+=(
-DBUILD_UNIVERSAL=ON
)
fi
fi
cmake "${CMAKE_OPTIONS[@]}" -S . -B ${build_dir} || {
echo "PretextView: configure failed!"
exit 1
}
cmake --build ${build_dir} --target package || {
echo "PretextView: compile failed!"
exit 1
}
# PretextViewAI.app/Contents/MacOS/PretextViewAI /Users/sg35/auto-curation/log/learning_notes/hic_curation/13 idLinTess1_1\ auto-curation/aPelFus1_1.pretext
# test
# install_name_tool -add_rpath subprojects/libtorch/lib app/bin/PretextView