mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 22:40:05 +00:00
Make setup/configure scripts common between Linux/macOS
This commit is contained in:
parent
d4b3c1869b
commit
9f7f1bf860
4 changed files with 31 additions and 17 deletions
|
|
@ -1,8 +1,19 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
script_dir="$(dirname "$(readlink -f "$0")")"
|
script_source="${BASH_SOURCE[0]:-$0}"
|
||||||
|
script_dir="$(cd "$(dirname "${script_source}")" && pwd)"
|
||||||
|
|
||||||
# Assign user-specified Python Virtual Environment
|
# Assign user-specified Python Virtual Environment
|
||||||
[ "${1:-}" = "none" ] && unset venv_path || export venv_path="$(readlink -f "${1:-${script_dir}/../.venv}")"
|
if [ "${1:-}" = "none" ]; then
|
||||||
|
unset venv_path
|
||||||
|
else
|
||||||
|
venv_arg="${1:-${script_dir}/../.venv}"
|
||||||
|
# Portable way to get absolute path without requiring the directory to exist
|
||||||
|
case "${venv_arg}" in
|
||||||
|
/*) venv_path="${venv_arg}" ;;
|
||||||
|
*) venv_path="$(cd "$(dirname "${venv_arg}")" && pwd)/$(basename "${venv_arg}")" ;;
|
||||||
|
esac
|
||||||
|
export venv_path
|
||||||
|
fi
|
||||||
|
|
||||||
# Load custom build settings
|
# Load custom build settings
|
||||||
if [ -f "${script_dir}/lib/user-setup.sh" ]; then
|
if [ -f "${script_dir}/lib/user-setup.sh" ]; then
|
||||||
|
|
@ -11,12 +22,12 @@ fi
|
||||||
|
|
||||||
# Activate Python Virtual Environment
|
# Activate Python Virtual Environment
|
||||||
if [ -n "${venv_path:-}" ]; then
|
if [ -n "${venv_path:-}" ]; then
|
||||||
python -m venv "${venv_path}"
|
python3 -m venv "${venv_path}"
|
||||||
source "${venv_path}/bin/activate"
|
source "${venv_path}/bin/activate"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Detect if a Python Virtual Environment was specified above, or elsewhere
|
# 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))')
|
IN_VENV=$(python3 -c 'import sys; print(sys.prefix != getattr(sys, "base_prefix", sys.prefix))')
|
||||||
|
|
||||||
if [ "${IN_VENV}" = "True" ]; then
|
if [ "${IN_VENV}" = "True" ]; then
|
||||||
# In a virtual environment, don't use --user
|
# In a virtual environment, don't use --user
|
||||||
|
|
@ -27,8 +38,8 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install Python packages
|
# Install Python packages
|
||||||
python -m pip install ${PIP_FLAGS} --upgrade pip
|
python3 -m pip install ${PIP_FLAGS} --upgrade pip
|
||||||
pip install ${PIP_FLAGS} -r "${script_dir}/../requirements.txt"
|
python3 -m pip install ${PIP_FLAGS} -r "${script_dir}/../requirements.txt"
|
||||||
|
|
||||||
# Configure default Conan profile
|
# Configure default Conan profile
|
||||||
conan profile detect -e
|
conan profile detect -e
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
script_dir="$(dirname "$(readlink -f "$0")")"
|
script_source="${BASH_SOURCE[0]:-$0}"
|
||||||
|
script_dir="$(cd "$(dirname "${script_source}")" && pwd)"
|
||||||
|
|
||||||
cmake_args=(
|
cmake_args=(
|
||||||
-B "${build_dir}"
|
-B "${build_dir}"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
script_dir="$(dirname "$(readlink -f "$0")")"
|
script_source="${BASH_SOURCE[0]:-$0}"
|
||||||
|
script_dir="$(cd "$(dirname "${script_source}")" && pwd)"
|
||||||
|
|
||||||
# Import common paths
|
# Import common paths
|
||||||
source "${script_dir}/common-paths.sh"
|
source "${script_dir}/common-paths.sh"
|
||||||
|
|
@ -9,14 +10,14 @@ if [ -f "${script_dir}/user-setup.sh" ]; then
|
||||||
source "${script_dir}/user-setup.sh"
|
source "${script_dir}/user-setup.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Activate Python Virtual Environment
|
# Activate python3 Virtual Environment
|
||||||
if [ -n "${venv_path:-}" ]; then
|
if [ -n "${venv_path:-}" ]; then
|
||||||
python -m venv "${venv_path}"
|
python3 -m venv "${venv_path}"
|
||||||
source "${venv_path}/bin/activate"
|
source "${venv_path}/bin/activate"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Detect if a Python Virtual Environment was specified above, or elsewhere
|
# Detect if a python3 Virtual Environment was specified above, or elsewhere
|
||||||
IN_VENV=$(python -c 'import sys; print(sys.prefix != getattr(sys, "base_prefix", sys.prefix))')
|
IN_VENV=$(python3 -c 'import sys; print(sys.prefix != getattr(sys, "base_prefix", sys.prefix))')
|
||||||
|
|
||||||
if [ "${IN_VENV}" = "True" ]; then
|
if [ "${IN_VENV}" = "True" ]; then
|
||||||
# In a virtual environment, don't use --user
|
# In a virtual environment, don't use --user
|
||||||
|
|
@ -26,9 +27,9 @@ else
|
||||||
PIP_FLAGS="--upgrade --user"
|
PIP_FLAGS="--upgrade --user"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install Python packages
|
# Install python3 packages
|
||||||
python -m pip install ${PIP_FLAGS} pip
|
python3 -m pip install ${PIP_FLAGS} pip
|
||||||
pip install ${PIP_FLAGS} -r "${script_dir}/../../requirements.txt"
|
python3 -m pip install ${PIP_FLAGS} -r "${script_dir}/../../requirements.txt"
|
||||||
|
|
||||||
if [[ -n "${build_type}" ]]; then
|
if [[ -n "${build_type}" ]]; then
|
||||||
# Install Conan profile and packages
|
# Install Conan profile and packages
|
||||||
|
|
@ -49,7 +50,7 @@ fi
|
||||||
# Run CMake Configure
|
# Run CMake Configure
|
||||||
"${script_dir}/run-cmake-configure.sh"
|
"${script_dir}/run-cmake-configure.sh"
|
||||||
|
|
||||||
# Deactivate Python Virtual Environment
|
# Deactivate python3 Virtual Environment
|
||||||
if [ -n "${venv_path:-}" ]; then
|
if [ -n "${venv_path:-}" ]; then
|
||||||
deactivate
|
deactivate
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#!/bin/bash
|
#!/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
|
# Configure default Conan profile
|
||||||
conan profile detect -e
|
conan profile detect -e
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue