Skip to content

Commit

Permalink
#97: refactor use vtk_build script also on mac os runner
Browse files Browse the repository at this point in the history
  • Loading branch information
tlamonthezie committed Sep 3, 2024
1 parent 0f0b592 commit cc15236
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 23 deletions.
26 changes: 11 additions & 15 deletions .github/workflows/build-and-test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ jobs:
gcov: llvm-gcov,
python: ['3.8', '3.9', '3.10', '3.11', '3.12'],
vtk: '9.3.1'
},
{
base: ubuntu:latest,
compiler: { cc: gcc-13, cxx: g++-13 },
gcov: gcov,
python: ['3.8', '3.9', '3.10', '3.11', '3.12'],
vtk: '9.3.1'
}
]
runs-on: ${{ matrix.host.base }}
Expand Down Expand Up @@ -77,6 +84,7 @@ jobs:
${{ env.VTK_BUILD_DIR }}
${{ env.CONDA_PATH }}
~/.zshrc
~/.bash_profile
key: ${{ env.CACHE_KEY }}

- name: Setup Miniconda3
Expand All @@ -91,8 +99,10 @@ jobs:
bash ~/miniconda.sh -b -u -p ${{ env.CONDA_PATH }}
rm -rf ~/miniconda.sh
${{ env.CONDA_PATH }}/bin/conda init bash
${{ env.CONDA_PATH }}/bin/conda init zsh
. ~/.zshrc
. ~/.bash_profile
echo "Conda path: $(which conda)"
echo "Conda version: $(conda --version)"
Expand All @@ -116,21 +126,7 @@ jobs:
run: |
mkdir -p ${{ env.VTK_SRC_DIR }}
git clone --recursive --branch v${{ matrix.host.vtk }} https://gitlab.kitware.com/vtk/vtk.git ${{ env.VTK_SRC_DIR }}
cd ${{ env.VTK_SRC_DIR }}
cmake \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DBUILD_TESTING:BOOL=OFF \
-DCMAKE_C_COMPILER="${{ env.CC }}" \
-DCMAKE_CXX_COMPILER="${{ env.CXX }}" \
-DVTK_OPENGL_HAS_OSMESA:BOOL=OFF \
-DVTK_DEFAULT_RENDER_WINDOW_OFFSCREEN:BOOL=OFF \
-DVTK_USE_X:BOOL=OFF \
-DVTK_USE_COCOA:BOOL=ON \
-DVTK_USE_SDL2:BOOL=OFF \
-DVTK_Group_Rendering:BOOL=OFF \
-DBUILD_SHARED_LIBS:BOOL=ON \
-S ${{ env.VTK_SRC_DIR }} -B ${{ env.VTK_BUILD_DIR }}
cmake --build ${{ env.VTK_BUILD_DIR }} -j$(nproc)
VTK_DIR=${{ env.VTK_BUILD_DIR }} VTK_SRC_DIR=${{ env.VTK_SRC_DIR }} bash ${{ github.workspace }}/ci/build_vtk.sh
- name: Build
run: |
Expand Down
32 changes: 24 additions & 8 deletions ci/build_vtk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,36 @@

set -ex

. /etc/lsb-release
VTK_OPENGL_HAS_OSMESA=ON
VTK_OPENGL_HAS_OSMESA=OFF
VTK_USE_X=OFF
VTK_USE_COCOA=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
unameOut=$(uname -a)
case "${unameOut}" in
Linux*) OS="Linux";;
Darwin*) OS="MacOSX";;
*) OS="UNKNOWN:${unameOut}"
esac

if [ "$OS" == "Linux" ]; then
. /etc/lsb-release
# 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_USE_X=ON
else
VTK_OPENGL_HAS_OSMESA=ON
end
# MacOs
elif [ "$OS" == "MacOSX" ]; then
VTK_USE_COCOA=ON
else
VTK_OPENGL_HAS_OSMESA=ON
fi

cmake \
Expand All @@ -27,7 +43,7 @@ cmake \
-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_COCOA:BOOL=$VTK_USE_COCOA \
-DVTK_USE_SDL2:BOOL=OFF \
-DVTK_Group_Rendering:BOOL=OFF \
-DBUILD_SHARED_LIBS:BOOL=ON \
Expand Down

0 comments on commit cc15236

Please sign in to comment.