github actions: Always set ITK_DIR (also when retrieved from cache) #18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Build open_iA" | |
| on: | |
| # manual triggering allowed: | |
| workflow_dispatch: | |
| # currently disable any other automatic triggering: | |
| #push: | |
| # branches: [ "main" ] | |
| #pull_request: | |
| # branches: [ "main" ] | |
| # required for manual triggering when not in main branch: | |
| pull_request: | |
| push: | |
| branches: | |
| - '**' | |
| schedule: | |
| # trigger automatic build Mon-Sat at 4:39 UTC: | |
| - cron: '39 4 * * 1-6' | |
| env: | |
| BUILD_TYPE: Release | |
| VTK_CMAKE_OPTIONS: -DBUILD_SHARED_LIBS=ON -DVTK_BUILD_EXAMPLES=OFF -DVTK_BUILD_TESTING=OFF -DVTK_LEGACY_REMOVE:BOOL=ON -DVTK_MODULE_ENABLE_VTK_GUISupportQt:STRING=YES -DVTK_MODULE_ENABLE_VTK_GUISupportQtSQL:STRING=NO -DVTK_MODULE_ENABLE_VTK_RenderingQt:STRING=YES -DVTK_MODULE_ENABLE_VTK_ViewsQt:STRING=YES -DVTK_MODULE_ENABLE_VTK_RenderingContextOpenGL2:STRING=YES | |
| # optional: -DVTK_SMP_IMPLEMENTATION_TYPE:STRING=${VTK_SMP_TYPE} | |
| # Qt: -DQt6_DIR:PATH=${Qt6_DIR} -DQt6WidgetsTools_DIR:PATH=${Qt6_DIR}WidgetsTools -DQt6CoreTools_DIR:PATH=${Qt6_DIR}CoreTools -DQt6GuiTools_DIR:PATH=${Qt6_DIR}GuiTools | |
| # Compiler: -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} | |
| ITK_CMAKE_OPTIONS: -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING:BOOL=OFF -DITK_USE_GPU:BOOL=OFF -DITK_USE_64BITS_IDS:BOOL=ON -DModule_ITKReview:BOOL=ON -DModule_HigherOrderAccurateGradient:BOOL=ON -DModule_SplitComponents:BOOL=ON -DModule_ITKVtkGlue:BOOL=On | |
| OPENIA_CMAKE_OPTIONS: -DopeniA_CUDA_ENABLED:BOOL=OFF -DModule_CommonImageFilters:BOOL=ON -DModule_FeatureCharacteristics:BOOL=ON -DModule_MetaFilters:BOOL=ON -DModule_Metrics:BOOL=ON -DModule_Segmentation:BOOL=ON -DModule_Surfaces:BOOL=ON -DModule_4DCT:BOOL=ON -DModule_BoneThickness:BOOL=ON -DModule_CompVis:BOOL=ON -DModule_DynamicVolumeLines:BOOL=ON -DModule_FeatureAnalyzer:BOOL=ON -DModule_FeatureAnalyzerComputation:BOOL=ON -DModule_FeatureScout:BOOL=ON -DModule_FiAKEr:BOOL=ON -DModule_FilterPreview:BOOL=ON -DModule_FoamCharacterization:BOOL=ON -DModule_FuzzyFeatureTracking:BOOL=ON -DModule_GEMSe:BOOL=ON -DModule_InSpectr:BOOL=ON -DModule_Labelling:BOOL=ON -DModule_NModalTF:BOOL=ON -DModule_Remote:BOOL=ON -DModule_TripleHistogramTF:BOOL=ON -DModule_Uncertainty:BOOL=ON -DModule_VolumePlayer:BOOL=ON | |
| QT_VERSION: 6.8.2 | |
| VTK_VERSION: 9.4.1 | |
| VTK_SHORTVER: 9.4 | |
| ITK_VERSION: 5.4.2 | |
| ITK_SHORTVER: 5.4 | |
| jobs: | |
| build: | |
| name: Build open_iA | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| # , macos-latest | |
| permissions: | |
| # required for all workflows | |
| security-events: write | |
| steps: | |
| ################################################################## | |
| # open_iA | |
| - name: Checkout open_iA | |
| uses: actions/checkout@v4 | |
| - name: Qt install | |
| # see https://github.com/marketplace/actions/install-qt for details | |
| uses: jurplel/install-qt-action@v4 | |
| with: | |
| version: ${{env.QT_VERSION}} | |
| modules: 'qtcharts qthttpserver qtwebsockets' | |
| setup-python: false | |
| cache: true | |
| cache-key-prefix: Qt | |
| ################################################################## | |
| # VTK | |
| - name: Check cache for VTK build | |
| id: cache-vtk | |
| uses: actions/cache@v4 | |
| with: | |
| path: vtk-${{ env.VTK_VERSION }} | |
| key: ${{ runner.os }}-qt${{env.QT_VERSION}}-vtk-${{ env.VTK_VERSION }} | |
| - if: ${{ ( runner.os == 'Linux' && steps.cache-vtk.outputs.cache-hit != 'true' ) }} | |
| name: VTK install prerequisites (Linux) | |
| run: | | |
| sudo apt update && sudo apt install libopengl-dev libglx-dev libglw-dev | |
| - if: steps.cache-vtk.outputs.cache-hit != 'true' | |
| name: VTK download, extract, configure, build, install | |
| run: | | |
| mkdir vtk | |
| curl https://vtk.org/files/release/${{ env.VTK_SHORTVER }}/VTK-${{ env.VTK_VERSION }}.tar.gz --output vtk/src-${{ env.VTK_VERSION }}.tar.gz | |
| cd vtk | |
| tar -xzf src-${{ env.VTK_VERSION }}.tar.gz | |
| mkdir bin-${{ env.VTK_VERSION }} | |
| cd bin-${{ env.VTK_VERSION }} | |
| cmake -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{env.VTK_CMAKE_OPTIONS}} -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/vtk-${{ env.VTK_VERSION }} ../VTK-${{ env.VTK_VERSION }} | |
| cmake --build . --config ${{env.BUILD_TYPE}} -j 4 | |
| cmake --install . --config ${{env.BUILD_TYPE}} | |
| cd ../.. | |
| rm -r vtk | |
| ################################################################## | |
| # ITK | |
| - name: Check cache for ITK build | |
| id: cache-itk | |
| uses: actions/cache@v4 | |
| with: | |
| path: itk-${{ env.ITK_VERSION }} | |
| key: ${{ runner.os }}-qt${{env.QT_VERSION}}-itk-${{ env.ITK_VERSION }} | |
| - if: runner.os == 'Windows' | |
| # Since ITK install is currently broken on Windows (see below), we also need to cache source folder here: | |
| name: Check cache for ITK source folder | |
| id: cache-itk-src | |
| uses: actions/cache@v4 | |
| with: | |
| path: itk-src-${{ env.ITK_VERSION }} | |
| key: ${{ runner.os }}-qt${{env.QT_VERSION}}-itk-src-${{ env.ITK_VERSION }} | |
| - if: steps.cache-itk.outputs.cache-hit != 'true' | |
| name: ITK download and extract | |
| run: | | |
| curl -L https://github.com/InsightSoftwareConsortium/ITK/archive/refs/tags/v${{ env.ITK_VERSION }}.tar.gz --output itk-src-${{ env.ITK_VERSION }}.tar.gz | |
| tar -xzf itk-src-${{ env.ITK_VERSION }}.tar.gz | |
| mv ITK-${{ env.ITK_VERSION }} itk-src-${{ env.ITK_VERSION }} | |
| - if: ${{ runner.os == 'Linux' && steps.cache-itk.outputs.cache-hit != 'true' }} | |
| # TODO: maybe just set a environment variable or something to the build directory depending on OS? | |
| name: ITK configure, build, install (Linux) | |
| run: | | |
| mkdir -p itk-bin-${{ env.ITK_VERSION }} | |
| cd itk-bin-${{ env.ITK_VERSION }} | |
| cmake -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{env.ITK_CMAKE_OPTIONS}} -DVTK_DIR:PATH=${{github.workspace}}/vtk-${{ env.VTK_VERSION }}/lib/cmake/vtk-${{ env.VTK_SHORTVER }} -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/itk-${{ env.ITK_VERSION }} ../itk-src-${{ env.ITK_VERSION }} | |
| cmake --build . --config ${{env.BUILD_TYPE}} -j 4 | |
| cmake --install . --config ${{env.BUILD_TYPE}} | |
| cd .. | |
| rm -r itk-src-${{ env.ITK_VERSION }} itk-bin-${{ env.ITK_VERSION }} | |
| - if: runner.os == 'Linux' | |
| name: set ITK_DIR (Linux) | |
| run: | | |
| echo "ITK_DIR=${{github.workspace}}/itk-${{ env.ITK_VERSION }}/lib/cmake/ITK-${{ env.ITK_SHORTVER }}" >> "$GITHUB_ENV" | |
| - if: ${{ runner.os == 'Windows' && (steps.cache-itk.outputs.cache-hit != 'true' || steps.cache-itk-src.outputs.cache-hit != 'true') }} | |
| # ITK install is currently broken on Windows, see https://discourse.itk.org/t/7414 | |
| # therefore, we build ITK instead at the location to which we would otherwise install it, and keep the build and source folder (see also src cache step above): | |
| name: ITK configure, build (Windows) | |
| run: | | |
| mkdir itk-${{ env.ITK_VERSION }} | |
| cd itk-${{ env.ITK_VERSION }} | |
| cmake -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{env.ITK_CMAKE_OPTIONS}} -DVTK_DIR:PATH=${{github.workspace}}/vtk-${{ env.VTK_VERSION }}/lib/cmake/vtk-${{ env.VTK_SHORTVER }} ../itk-src-${{ env.ITK_VERSION }} | |
| cmake --build . --config ${{env.BUILD_TYPE}} -j 4 | |
| cd .. | |
| rm itk-src-${{ env.ITK_VERSION }}.tar.gz | |
| - if: runner.os == 'Windows' | |
| name: set ITK_DIR (Windows) | |
| run: | | |
| echo "ITK_DIR=${{github.workspace}}/itk-${{ env.ITK_VERSION }}" >> "$GITHUB_ENV" | |
| - name: Install npm | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| ################################################################## | |
| # open_iA | |
| # dependencies stated in superbuild: libgl1-mesa-dev libxt-dev libxt-dev libxcursor-dev libsdl2-dev | |
| # VR: libboost-dev libopenvr-dev libopenxr-dev | |
| # OpenCL: ocl-icd-opencl-dev opencl-headers opencl-clhpp-headers | |
| # clang: clang libomp-dev | |
| # if: runner.os == 'Linux' only runs on ubuntu currently anyway | |
| - name: open_iA build | |
| shell: bash | |
| run: | | |
| mkdir bin | |
| cd bin | |
| cmake -B . -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{env.OPENIA_CMAKE_OPTIONS}} -DITK_DIR=${{env.ITK_DIR}} .. | |
| cmake --build . --config ${{env.BUILD_TYPE}} -j 4 | |
| cmake --install . --config ${{env.BUILD_TYPE}} --prefix ${{github.workspace}}/install | |
| - name: Create zip archive | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: open_iA-${{runner.os}}-latest.zip | |
| path: ${{github.workspace}}/install | |
| if-no-files-found: error | |
| overwrite: true |