Make setup/configure scripts common between Linux/macOS

This commit is contained in:
Dan Paulat 2025-06-13 00:21:03 -05:00
parent d4b3c1869b
commit 9f7f1bf860
4 changed files with 31 additions and 17 deletions

View file

@ -1,5 +1,6 @@
#!/bin/bash
script_dir="$(dirname "$(readlink -f "$0")")"
script_source="${BASH_SOURCE[0]:-$0}"
script_dir="$(cd "$(dirname "${script_source}")" && pwd)"
cmake_args=(
-B "${build_dir}"

View file

@ -1,5 +1,6 @@
#!/bin/bash
script_dir="$(dirname "$(readlink -f "$0")")"
script_source="${BASH_SOURCE[0]:-$0}"
script_dir="$(cd "$(dirname "${script_source}")" && pwd)"
# Import common paths
source "${script_dir}/common-paths.sh"
@ -9,14 +10,14 @@ if [ -f "${script_dir}/user-setup.sh" ]; then
source "${script_dir}/user-setup.sh"
fi
# Activate Python Virtual Environment
# Activate python3 Virtual Environment
if [ -n "${venv_path:-}" ]; then
python -m venv "${venv_path}"
python3 -m venv "${venv_path}"
source "${venv_path}/bin/activate"
fi
# Detect if a Python Virtual Environment was specified above, or elsewhere
IN_VENV=$(python -c 'import sys; print(sys.prefix != getattr(sys, "base_prefix", sys.prefix))')
# Detect if a python3 Virtual Environment was specified above, or elsewhere
IN_VENV=$(python3 -c 'import sys; print(sys.prefix != getattr(sys, "base_prefix", sys.prefix))')
if [ "${IN_VENV}" = "True" ]; then
# In a virtual environment, don't use --user
@ -26,9 +27,9 @@ else
PIP_FLAGS="--upgrade --user"
fi
# Install Python packages
python -m pip install ${PIP_FLAGS} pip
pip install ${PIP_FLAGS} -r "${script_dir}/../../requirements.txt"
# Install python3 packages
python3 -m pip install ${PIP_FLAGS} pip
python3 -m pip install ${PIP_FLAGS} -r "${script_dir}/../../requirements.txt"
if [[ -n "${build_type}" ]]; then
# Install Conan profile and packages
@ -49,7 +50,7 @@ fi
# Run CMake Configure
"${script_dir}/run-cmake-configure.sh"
# Deactivate Python Virtual Environment
# Deactivate python3 Virtual Environment
if [ -n "${venv_path:-}" ]; then
deactivate
fi

View file

@ -1,5 +1,6 @@
#!/bin/bash
script_dir="$(dirname "$(readlink -f "$0")")"
script_source="${BASH_SOURCE[0]:-$0}"
script_dir="$(cd "$(dirname "${script_source}")" && pwd)"
# Configure default Conan profile
conan profile detect -e