diff --git a/.gitea/workflows/build_and_test.yml b/.gitea/workflows/build_and_test.yml index 864a33d2..e71a1fd7 100644 --- a/.gitea/workflows/build_and_test.yml +++ b/.gitea/workflows/build_and_test.yml @@ -110,6 +110,52 @@ jobs: python gitea_upload_file.py $file.FullName if ($LASTEXITCODE -ne 0) { throw "Upload failed for $($file.Name)" } } + build-viewer-tgz: + name: build:viewer-tgz:${{ matrix.variant }} + runs-on: jfjoch_rocky8 + timeout-minutes: 120 + strategy: + fail-fast: false + matrix: + include: + - variant: cuda + use_cuda: 'ON' + - variant: cpu + use_cuda: 'OFF' + steps: + - uses: actions/checkout@v4 + - name: Configure viewer build + shell: bash + run: | + mkdir -p build + cd build + cmake -G Ninja -DJFJOCH_VIEWER_ONLY=ON -DJFJOCH_USE_CUDA=${{ matrix.use_cuda }} ${{ env.MARCH_CMAKE_FLAGS }} -DCMAKE_BUILD_TYPE=Release .. + - name: Build viewer tgz + shell: bash + run: | + cd build + ninja -j16 jfjoch_viewer + cpack + - name: Upload viewer tgz to release + if: github.ref_type == 'tag' + shell: bash + env: + TOKEN: ${{ secrets.PIP_REPOSITORY_API_TOKEN }} + run: | + set -euo pipefail + shopt -s nullglob + # CMakeLists.txt names the archive jfjoch_viewer--linux-{cuda|cpu}.tar.gz; + # rename to .tgz (matching the Windows installer's release naming) before upload. + files=(build/jfjoch_viewer-*.tar.gz) + if [ ${#files[@]} -eq 0 ]; then + echo "No viewer archive found in build/" + exit 1 + fi + for file in "${files[@]}"; do + tgz="${file%.tar.gz}.tgz" + mv "$file" "$tgz" + python3 gitea_upload_file.py "$tgz" + done build-rpm: name: build:rpm (${{ matrix.distro }}) if: github.ref_type != 'workflow_dispatch' @@ -207,16 +253,19 @@ jobs: cd .. + # The viewer is shipped to the release as a Linux-version-agnostic .tgz by the + # build-viewer-tgz job; only the writer (and the XDS plugin .so on rocky8) go to the + # release as distro packages here. if [ "${{ matrix.distro }}" = "rocky8_nocuda" ]; then - for file in build/jfjoch-viewer*.rpm build/jfjoch-writer*rpm build/xds-plugin/libjfjoch_xds_plugin.so.*; do + for file in build/jfjoch-writer*rpm build/xds-plugin/libjfjoch_xds_plugin.so.*; do python3 gitea_upload_file.py "$file" done elif [ "${{ matrix.distro }}" = "rocky9_nocuda" ]; then - for file in build/jfjoch-viewer*.rpm build/jfjoch-writer*rpm; do + for file in build/jfjoch-writer*rpm; do python3 gitea_upload_file.py "$file" done elif [ "${{ matrix.distro }}" = "ubuntu2204_nocuda" ]; then - for file in build/jfjoch*viewer*.deb build/jfjoch*writer*.deb; do + for file in build/jfjoch*writer*.deb; do python3 gitea_upload_file.py "$file" done fi diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a5c6fcc..dfe8d7b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -406,6 +406,19 @@ elseif (WIN32) # backslash there ("bin\jfjoch...") is an invalid escape that cmake 4.x (CMP0010 strict, e.g. the # VS-bundled cmake) rejects when cpack re-parses it. Windows accepts the forward slash at runtime. set(CPACK_NSIS_INSTALLED_ICON_NAME "bin/jfjoch_viewer.exe") +elseif (JFJOCH_VIEWER_ONLY) + # Linux portable viewer: a single self-contained .tar.gz of jfjoch_viewer (Qt is linked + # statically here, so there is nothing external to ship alongside the binary). Built on the + # oldest supported distro (RHEL 8) for a low glibc floor, so the archive runs on any newer + # Linux -- unlike the per-distro .rpm/.deb this is meant to replace in the release. Named to + # mirror the Windows/macOS artifacts, with the same -cuda/-cpu tag so the (larger) GPU + # build is self-identifying. CI renames the .tar.gz to .tgz before upload. + set(CPACK_GENERATOR "TGZ") + if (JFJOCH_CUDA_AVAILABLE) + set(CPACK_PACKAGE_FILE_NAME "jfjoch_viewer-${JFJOCH_VERSION}-linux-cuda${CUDAToolkit_VERSION_MAJOR}") + else() + set(CPACK_PACKAGE_FILE_NAME "jfjoch_viewer-${JFJOCH_VERSION}-linux-cpu") + endif() elseif (EXISTS "/etc/debian_version") set(CPACK_PACKAGE_LICENSE "GPL-3.0-only") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")