-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·32 lines (32 loc) · 1.1 KB
/
install.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
#!/bin/bash
# Check if conda is installed.
if ! command -v conda >/dev/null 2>&1; then
echo "Install error: 'conda' is not installed or cannot be found. Please make sure that 'conda' is available."
exit 1
fi
# Add module path to PYTHONPATH variable to make napy globally accessible.
export PYTHONPATH="${PYTHONPATH}:$(pwd)/module"
# Create conda environment and build directory for cmake.
source "$(conda info --base)/etc/profile.d/conda.sh"
echo "Installing conda environment for NApy..."
conda env create -f environment.yml
conda activate napy
mkdir -p build
cd build
# Init CMake and compile C++ files.
echo "Initializing make file..."
cmake ..
echo "Building C++ part of NApy..."
make
# Move module file to suitable directory.
if ls libnanpy.cpython* &>/dev/null; then
cp libnanpy.cpython* ../module
# Check if a file ending with '.so' exists.
elif ls *.so &>/dev/null; then
cp *.so ../module
# If neither condition is met, compilation has failed.
else
echo "Compilation error: no matching module file has been found in the build directory."
exit 1
fi
echo "NApy installation finished successfully!"