Building a ParaView plugin for the binary release of ParaView

Building a ParaView plugin in order to redistribute it for it to be loaded with the binary release of ParaView (downloadable  from paraview.org/download) is not trivial.

It used to be impossible but thanks to the ParaViewPluginBuilder (PPB), it has been possible to do so locally for some time. However, using the PPB is slow, can sometimes be complex and sadly not supported starting with ParaView 5.10.0.

Indeed, the approach used in the PPB was specific to the way the ParaView release was created. This was completely reworked before ParaView 5.9 and the process is now completely open and visible on the ParaView-superbuild.  

This means that it is now possible to use this method to build docker images containing the ParaView binary release which would support building a binary compatible plugin against it.

This is why we are very happy to introduce the paraview_org-plugin-devel dockerhub repository.

These docker images can be used to build binary-compatible ParaView plugins in your CI, as well as locally, for the same goal.

How to use on gitlab

If you are using GitLab, your .gitlab-ci.yml file may look like:

build-plugin-release:
  image: kitware/paraview_org-plugin-devel:5.10.1
  stage: build
  script:
      # This is needed because the build of ParaView use some absolute path
    - ln -s /paraview/gitlab-kitware-sciviz-ci/ /builds/gitlab-kitware-sciviz-ci
    - mkdir -p build
    - cd build
    - cmake -DParaView_DIR=/builds/gitlab-kitware-sciviz-ci/build/install/lib/cmake/paraview-5.10/ ..
    - cmake --build . --config Release --parallel 2
  tags: 
    - docker
    - linux
    - paraview
  artifacts:
    expire_in: 1h
    when: always
    paths:
      - build/

You can take a look at the example project on gitlab.

How to use on github

If you are using github, your ci.yml file may look like:

  build_binary:
    if: github.event.pull_request.draft == false

    runs-on: ubuntu-latest
    container: kitware/paraview_org-plugin-devel:5.10.1

    steps:

    - name: Checkout
      uses: actions/checkout@v2
      with:
        path: 'source'
        fetch-depth: 0
        lfs: 'true'

    - name: Setup Directories
      working-directory: ${{github.workspace}}
      run: mkdir build

    - name: Configure
      working-directory: ${{github.workspace}}/build
      run: cmake -DParaView_DIR=/builds/gitlab-kitware-sciviz-ci/build/install/lib/cmake/paraview-5.10/ -DCMAKE_BUILD_TYPE=Release ../source

    - name: Build
      working-directory: ${{github.workspace}}/build
      run: cmake --build . --parallel 2

    - name: Upload Artifacts
      uses: actions/upload-artifact@v2
      with:
        path: ./build/*
        name: build

You can take a look at the example project on github.

How to use locally

While you can of course create your own docker based script to build your plugin, the ParaViewPluginBuilder has been replaced with the ParaViewEasyPluginBuilder !

Easier to use and faster, it will just pull the docker image containing ParaView and build your plugin against it, with a single command:

./run_build_plugin.sh -d /path/to/plugin/directory releaseTag

Once the command is completed, your binary compatible plugin will be present in the output directory.

The only limitation is that the tag should already exist on the dockerhub repository.

Special Thanks to Brad King, Khaled Hadj-Tahar and Tom Suchel for their help with this work !

Leave a Reply