Skip to content

Commit 58e7034

Browse files
feat-wip: translate activate_conda and config.bat to .sh files for macos compatibility
1 parent a09d7a4 commit 58e7034

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

cmake/activate_conda.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/zsh
2+
########################################################################
3+
# check if conda is available
4+
# check that diff_check environment is available
5+
# activate it
6+
########################################################################
7+
8+
# Check if conda command is available
9+
echo "Checking if conda command is available..."
10+
if ! command -v conda >/dev/null 2>&1; then
11+
echo "conda command not found, you won't be able to build the python wrap for diffcheck. Please install Anaconda or Miniconda first."
12+
exit 1
13+
fi
14+
echo "Conda command is available."
15+
16+
# Check if the diff_check environment is available
17+
if ! conda env list | grep -q 'diff_check'; then
18+
echo "diff_check environment not found, you should create one by running:"
19+
echo "$ conda env create -f environment.mac.yml"
20+
exit 1
21+
else
22+
echo "diff_check environment is available, updating it now..."
23+
if conda env update --name diff_check --file environment.mac.yml --prune; then
24+
echo "Environment updated successfully."
25+
else
26+
echo "Failed to update diff_check environment, please check the environment.mac.yml file."
27+
exit 1
28+
fi
29+
fi
30+
echo "diff_check environment is up to date."
31+
32+
# Check if a different environment than diff_check is activated, if so deactivate it
33+
active_env_name=$(conda info --envs | awk '/\*/ {print $1}')
34+
if [[ "$active_env_name" != "diff_check" && -n "$active_env_name" ]]; then
35+
echo "You should deactivate $active_env_name first with 'conda deactivate' and 'conda activate diff_check' before running this script."
36+
exit 1
37+
fi
38+
39+
echo "You can start the cmake config now ..."

cmake/config.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# activate the conda diff_check environment otherwise the python wrap won't work
2+
call cmake/activate_conda.sh
3+
4+
#configure the project
5+
conda run --name diff_check --no-capture-output cmake -S . -B build -DCMAKE_BUILD_TYPE=Release

0 commit comments

Comments
 (0)