55# 2. VTK >= 9.0.0
66# (on Ubuntu 24.04, you can install them using the command: sudo apt install -y libvtk9-dev libembree-dev)
77
8+ # Check if the script is run with bash
9+ if [ -z " $BASH_VERSION " ]; then
10+ echo " This script must be run with bash. Please run it using: bash install_ViennaPS_linux.sh <-v|--verbose>"
11+ exit 1
12+ fi
13+
14+ # Check if verbose mode is enabled
15+ verbose_flag=" "
16+ if [[ " $1 " == " -v" || " $1 " == " --verbose" ]]; then
17+ echo " Verbose mode is enabled."
18+ verbose_flag=" -v"
19+ else
20+ echo " Verbose mode is disabled."
21+ fi
22+
823# Directory for the virtual environment
924read -r -p " Enter the path to the virtual environment directory (default: .venv): " venv_dir
1025if [ -z " $venv_dir " ]; then
5873source $venv_dir /bin/activate
5974
6075# Check if ViennaLS Python package is installed
76+ viennals_version_required=" 4.3.2"
6177if ! pip show ViennaLS & > /dev/null; then
6278 echo " ViennaLS Python package is not installed. Local ViennaLS build is required."
63- read -r -p " Enter the path to the ViennaLS directory (e.g., /path/to/ViennaLS): " viennals_dir
79+ read -r -p " Enter the path to the ViennaLS directory (e.g., /path/to/ViennaLS, press enter to download ): " viennals_dir
6480 if [ -z " $viennals_dir " ]; then
65- echo " No ViennaLS directory specified. Please provide a path."
66- exit 1
81+ echo " No ViennaLS directory specified. Downloading version $viennals_version_required ."
82+ mkdir ViennaLS_tmp_install
83+ git clone https://github.com/ViennaTools/ViennaLS.git ViennaLS_tmp_install
84+ cd ViennaLS_tmp_install || { echo " Failed to change directory to ViennaLS_tmp_install" ; exit 1; }
85+ git checkout v$viennals_version_required & > /dev/null
86+ CC=gcc-12 CXX=g++-12 pip install . $verbose_flag
87+ cd ..
88+ rm -rf ViennaLS_tmp_install
6789 fi
6890 cd " $viennals_dir " || { echo " Failed to change directory to $viennals_dir " ; exit 1; }
69- CC=gcc-12 CXX=g++-12 pip install .
91+ CC=gcc-12 CXX=g++-12 pip install . $verbose_flag
7092else
71- echo " ViennaLS Python package is already installed. Local build is required."
72- echo " If you want to reinstall, please uninstall it first using: pip uninstall ViennaLS"
93+ viennals_version=$( pip show ViennaLS | grep Version | awk ' {print $2}' )
94+ echo -e " \033[1;33m" " ViennaLS Python package is already installed ($viennals_version ). Local build is required.\033[0m"
95+ echo -e " \033[1;33m" " If you want to reinstall, please uninstall it first using: pip uninstall ViennaLS\033[0m"
96+ read -r -p " Continue with the current version ($viennals_version )? (y/n): " continue_install
97+ if [[ " $continue_install " != " y" && " $continue_install " != " Y" ]]; then
98+ echo " Installation aborted."
99+ exit 1
100+ fi
101+ if [ " $viennals_version " != " $viennals_version_required " ]; then
102+ echo -e " \033[1;33m" " Note: The version of ViennaLS is not $viennals_version_required , which may cause compatibility issues.\033[0m"
103+ echo -e " \033[1;33m" " Please ensure you have the correct version installed.\033[0m"
104+ exit 1
105+ fi
73106fi
74107
75108# Check if current directory is ViennaPS
@@ -84,7 +117,7 @@ if [ "$viennaps_dir" != "ViennaPS" ]; then
84117fi
85118
86119# Install ViennaPS with GPU support (using gcc-12 and g++-12)
87- OptiX_INSTALL_DIR=$optix_dir CC=gcc-12 CXX=g++-12 CMAKE_ARGS=-DVIENNAPS_FORCE_GPU=ON pip install . -v
120+ OptiX_INSTALL_DIR=$optix_dir CC=gcc-12 CXX=g++-12 CMAKE_ARGS=-DVIENNAPS_FORCE_GPU=ON pip install . $verbose_flag
88121
89122echo " Installation complete. To activate the virtual environment, run:"
90123echo " source $venv_dir /bin/activate"
0 commit comments