Skip to content

Commit

Permalink
#97: try fix dockerfile syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
tlamonthezie committed Sep 2, 2024
1 parent 795d411 commit 040b06a
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pushbasedockerimage_tmp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- 97-add-more-environments-to-test-in-ci

jobs:
jobs:
push_to_registry:
name: Build & Push
runs-on: ubuntu-latest
Expand Down
39 changes: 39 additions & 0 deletions ci/build_vtk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

# This script builds vtk using Mesa

set -ex

. /etc/lsb-release
VTK_OPENGL_HAS_OSMESA=ON
VTK_USE_X=OFF
VTK_SRC_DIR=${VTK_SRC_DIR:-"/opt/src/vtk"}
VTK_DIR=${VTK_DIR:-"/opt/build/vtk"}

mkdir -p $VTK_DIR
pushd $VTK_DIR

# Issue with Ubuntu 24.04 / OSMESA : glew build error. Use X instead.
if [ "$DISTRIB_ID" == "Ubuntu" -a "$DISTRIB_RELEASE" == "24.04" ]; then
echo "Disabling VTK_OPENGL_HAS_OSMESA (not supported in Ubuntu 24.04). Using DVTK_USE_X instead."
VTK_OPENGL_HAS_OSMESA=OFF
VTK_USE_X=ON
fi

cmake \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DBUILD_TESTING:BOOL=OFF \
-DVTK_OPENGL_HAS_OSMESA:BOOL=$VTK_OPENGL_HAS_OSMESA \
-DVTK_DEFAULT_RENDER_WINDOW_OFFSCREEN:BOOL=ON \
-DVTK_USE_X:BOOL=$VTK_USE_X \
-DVTK_USE_WIN32_OPENGL:BOOL=OFF \
-DVTK_USE_COCOA:BOOL=OFF \
-DVTK_USE_SDL2:BOOL=OFF \
-DVTK_Group_Rendering:BOOL=OFF \
-DBUILD_SHARED_LIBS:BOOL=ON \
-S "$VTK_SRC_DIR" -B "$VTK_DIR"
cmake --build "$VTK_DIR" -j$(nproc)

echo "VTK build success"

popd
20 changes: 3 additions & 17 deletions ci/docker/make-base-ubuntu.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,22 +83,8 @@ RUN mkdir -p /opt/src/vtk
RUN git clone --recursive --branch v${VTK_VERSION} https://gitlab.kitware.com/vtk/vtk.git /opt/src/vtk

# Build VTK
# Note: Ubuntu 24.04 currently encounters inner glew build error when OPENGL_HAS_OSMESA is true.
# but successfully build using X.
RUN mkdir -p ${VTK_DIR}
WORKDIR ${VTK_DIR}
RUN cmake \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DBUILD_TESTING:BOOL=OFF \
-DVTK_OPENGL_HAS_OSMESA:BOOL=$([ "${BASE_IMAGE}" == "ubuntu:24.04" ] && echo "OFF" || echo "ON") \
-DVTK_DEFAULT_RENDER_WINDOW_OFFSCREEN:BOOL=ON \
-DVTK_USE_X:BOOL=$([ "${BASE_IMAGE}" == "ubuntu:24.04" ] && echo "ON" || echo "OFF") \
-DVTK_USE_WIN32_OPENGL:BOOL=OFF \
-DVTK_USE_COCOA:BOOL=OFF \
-DVTK_USE_SDL2:BOOL=OFF \
-DVTK_Group_Rendering:BOOL=OFF \
-DBUILD_SHARED_LIBS:BOOL=ON \
-S /opt/src/vtk -B ${VTK_DIR}
RUN cmake --build ${VTK_DIR} -j$(nproc)
RUN mkdir -p /opt/scripts
COPY ci/build_vtk.sh /opt/scripts/build_vtk.sh
RUN VTK_DIR=${VTK_DIR} bash /opt/scripts/build_vtk.sh

RUN echo "Base creation success"

0 comments on commit 040b06a

Please sign in to comment.