diff --git a/Dockerfile b/Dockerfile index 143032e..2c8dcf4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -58,6 +58,13 @@ RUN wget -O /usr/share/keyrings/chaste.asc https://chaste.github.io/chaste.asc \ RUN apt-get update && \ apt-get install -y --no-install-recommends \ chaste-dependencies \ + xvfb \ + # python3-matplotlib \ + # python3-notebook \ + # python3-numpy \ + # python3-petsc4py \ + python3-vtk7 \ + # python3-xvfbwrapper \ cmake \ clang \ lldb \ @@ -93,6 +100,7 @@ ARG CHASTE_DIR="/home/${USER}" ARG CMAKE_BUILD_TYPE="Debug" ARG Chaste_ERROR_ON_WARNING="ON" ARG Chaste_UPDATE_PROVENANCE="OFF" +ARG Chaste_ENABLE_PYCHASTE="ON" # RUN source /home/chaste/scripts/set_env_vars.sh ENV USER=${USER} \ GROUP=${USER} \ @@ -101,6 +109,7 @@ ENV USER=${USER} \ CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ Chaste_ERROR_ON_WARNING=${Chaste_ERROR_ON_WARNING} \ Chaste_UPDATE_PROVENANCE=${Chaste_UPDATE_PROVENANCE} \ + Chaste_ENABLE_PYCHASTE=${Chaste_ENABLE_PYCHASTE} \ CHASTE_SOURCE_DIR="${CHASTE_DIR}/src" \ CHASTE_BUILD_DIR="${CHASTE_DIR}/build" \ CHASTE_TEST_OUTPUT="${CHASTE_DIR}/output" \ diff --git a/Makefile b/Makefile index cb942db..55d6194 100644 --- a/Makefile +++ b/Makefile @@ -64,18 +64,20 @@ develop main release: BUILD_ARGS += --build-arg GIT_TAG=$(GIT_TAG) \ --build-arg CMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) \ --build-arg Chaste_ERROR_ON_WARNING=$(Chaste_ERROR_ON_WARNING) \ --build-arg Chaste_UPDATE_PROVENANCE=$(Chaste_UPDATE_PROVENANCE) \ + --build-arg Chaste_ENABLE_PYCHASTE=${Chaste_ENABLE_PYCHASTE} \ --build-arg TEST_SUITE=$(TEST_SUITE) develop main: CMAKE_BUILD_TYPE="Debug" develop main: Chaste_ERROR_ON_WARNING="ON" develop main: Chaste_UPDATE_PROVENANCE="OFF" -develop main: GIT_TAG=$@ +develop main: GIT_TAG?=$@ release: CMAKE_BUILD_TYPE="Release" release: Chaste_ERROR_ON_WARNING="OFF" release: Chaste_UPDATE_PROVENANCE="ON" release: TEST_SUITE="Continuous" +develop main release: Chaste_ENABLE_PYCHASTE="ON" base develop main release: CHASTE_IMAGE = chaste/$@ base develop main release: DOCKER_TAGS = -t $(CHASTE_IMAGE) base develop main: DOCKER_TAGS += -t $(CHASTE_IMAGE):$(BASE) diff --git a/scripts/build_chaste.sh b/scripts/build_chaste.sh index 0f90ca8..dd63c27 100755 --- a/scripts/build_chaste.sh +++ b/scripts/build_chaste.sh @@ -42,14 +42,31 @@ else # if [ $VERSION = 'develop' ]; then echo "Chaste_ERROR_ON_WARNING=${Chaste_ERROR_ON_WARNING}" fi -# Only run if new files have been created +# # Only run if new files have been created cmake -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} \ -DChaste_ERROR_ON_WARNING:BOOL=${Chaste_ERROR_ON_WARNING} \ -DChaste_UPDATE_PROVENANCE:BOOL=${Chaste_UPDATE_PROVENANCE} \ + -DChaste_ENABLE_PYCHASTE:BOOL=${Chaste_ENABLE_PYCHASTE} \ -H$CHASTE_SOURCE_DIR \ -B$CHASTE_BUILD_DIR -make --no-print-directory -j$NCORES -C $CHASTE_BUILD_DIR # -f $CHASTE_BUILD_DIR/Makefile +# make --no-print-directory -j$NCORES -C $CHASTE_BUILD_DIR # -f $CHASTE_BUILD_DIR/Makefile + +if [ "$Chaste_ENABLE_PYCHASTE" = "ON" ]; then + # Build and install PyChaste + echo "Building PyChaste..." + # make --no-print-directory -j$NCORES -C $CHASTE_BUILD_DIR + make --no-print-directory -j$NCORES -C $CHASTE_BUILD_DIR pychaste + python -m pip install --no-cache-dir --user numpy matplotlib petsc4py jupyterlab xvfbwrapper + # python -m pip install --no-cache-dir --user --no-deps pychaste/package + python -m pip install --no-cache-dir --user --no-deps $CHASTE_BUILD_DIR/pychaste/package + + # Test PyChaste + # xvfb-run --server-args="-screen 0 1024x768x24" ctest -L pychaste +else + echo "PyChaste is not enabled." + make --no-print-directory -j$NCORES -C $CHASTE_BUILD_DIR # -f $CHASTE_BUILD_DIR/Makefile +fi # Save the build info get_chaste_info.sh > "${CHASTE_TEST_OUTPUT}/chaste-info.txt" diff --git a/scripts/get_chaste_info.sh b/scripts/get_chaste_info.sh index c7369d4..0572af2 100755 --- a/scripts/get_chaste_info.sh +++ b/scripts/get_chaste_info.sh @@ -1,4 +1,7 @@ #!/bin/bash set -e +cmake -H$CHASTE_SOURCE_DIR -B$CHASTE_BUILD_DIR +make --no-print-directory -j$(nproc) -C $CHASTE_BUILD_DIR $TEST_SUITE +#-j$(nproc) ( cd $CHASTE_BUILD_DIR && ctest --verbose -R TestChasteBuildInfo$ )