-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·130 lines (114 loc) · 2.96 KB
/
install.sh
File metadata and controls
executable file
·130 lines (114 loc) · 2.96 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
124
125
126
127
128
129
130
#!/bin/bash
set -e
CLEAN=0
CLEAN_CCACHE=0
USE_CONDA=0
USE_CUDA=0
CUDA_ARCH=""
CMAKE_ARGS_STR=""
ONLY_CPP=0
USE_UV=0
for arg in "$@"; do
case $arg in
--clean) CLEAN=1 ;;
--use-cuda)
USE_CUDA=1
;;
--clean-ccache)
CLEAN_CCACHE=1
echo "Cleaning ccache..."
ccache -C || echo "ccache not installed or clean failed."
;;
--cuda-arch=*)
CUDA_ARCH="${arg#*=}"
;;
--only-cpp)
ONLY_CPP=1
echo "Only building C++ components."
;;
--use-conda)
USE_CONDA=1
;;
--use-uv)
USE_UV=1
;;
*)
echo "Unknown option: $arg"
exit 1
;;
esac
done
if [[ $CLEAN -eq 1 ]]; then
rm -rf build ataraxai.egg-info dist _skbuild
rm -f ataraxai/*.so
[ -f clean.sh ] && ./clean.sh
fi
if [[ $USE_UV -eq 1 ]]; then
if ! command -v uv &>/dev/null; then
echo "Error: uv is not installed or not in PATH. Please install it first."
exit 1
fi
uv venv .venv -p 3.12 --clear
source .venv/bin/activate
uv pip install cmake scikit-build ninja
fi
if [[ $USE_CONDA -eq 1 ]]; then
if [[ -z $CONDA_PREFIX ]]; then
echo "Error: --use-conda specified, but CONDA_PREFIX is not set. Please activate your conda environment first."
exit 1
fi
echo "Configuring for Conda environment at $CONDA_PREFIX"
export CC="$CONDA_PREFIX/bin/x86_64-conda-linux-gnu-cc"
export CXX="$CONDA_PREFIX/bin/x86_64-conda-linux-gnu-c++"
export LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$LD_LIBRARY_PATH
fi
if [[ $USE_UV -eq 1 ]]; then
uv pip uninstall ataraxai || true
else
pip uninstall ataraxai -y || true
fi
if [[ $USE_CUDA -eq 1 ]]; then
echo "Configuring build for CUDA=ON"
CMAKE_ARGS_STR="-DATARAXAI_USE_CUDA=ON"
if [ -n "$CUDA_ARCH" ]; then
CMAKE_ARGS_STR+=" -DCMAKE_CUDA_ARCHITECTURES=${CUDA_ARCH}"
fi
else
echo "Configuring build for CUDA=OFF"
CMAKE_ARGS_STR="-DATARAXAI_USE_CUDA=OFF"
fi
CMAKE_ARGS_STR+=" -DBUILD_TESTING=ON"
CMAKE_ARGS_STR+=" -DCMAKE_POSITION_INDEPENDENT_CODE=ON"
export CMAKE_ARGS="${CMAKE_ARGS_STR}"
echo "CMake arguments for pip: ${CMAKE_ARGS}"
PYTHON_EXECUTABLE=$(which python3)
if [ -z "$PYTHON_EXECUTABLE" ]; then
echo "Error: python3 not found in PATH."
exit 1
fi
PYTHON_INCLUDE_DIR=$(python3 -c "import sysconfig; print(sysconfig.get_path('include'))")
echo "Configuring CMake..."
cmake -S . -B build \
-DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} \
-DPython_INCLUDE_DIR=${PYTHON_INCLUDE_DIR} \
${CMAKE_ARGS_STR}
echo "Building C++ targets (including tests)..."
cmake --build build --config Release -- -j $(nproc)
cmake --build build --target hegemonikon_tests --config Release
if [[ $ONLY_CPP -eq 1 ]]; then
echo "C++ build complete. Exiting due to --only-cpp flag."
[[ $USE_UV -eq 1 ]] && deactivate
exit 0
fi
echo "Installing Python package..."
if [[ $USE_UV -eq 1 ]]; then
uv pip install -e .
else
python3 -m pip install -e .
fi
echo "Verifying installation..."
python3 -c "from ataraxai import hegemonikon_py; print('[SUCCESS] Atarax-AI installed and core module is importable!')"
if [[ $USE_UV -eq 1 ]]; then
deactivate
echo "Build complete. Virtual environment deactivated."
fi