Skip to content

Commit

Permalink
Add CUDA to Flatpak (#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
istori1 authored Jul 5, 2022
1 parent 42eda48 commit d19c883
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 56 deletions.
30 changes: 6 additions & 24 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,38 +159,21 @@ jobs:

build_linux_flatpak:
name: Linux Flatpak
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
needs: check_changelog

steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 2048
swap-size-mb: 8192
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'

- name: Cache flatpak-builder
uses: actions/cache@v3
with:
path: ./build/.flatpak-builder/build
key: ${{ runner.os }}-flatpak-builder

- name: Checkout
uses: actions/checkout@v3

- name: Setup Dependencies Linux Flatpak
run: |
sudo add-apt-repository ppa:flatpak/stable -y
sudo apt-get update -y
sudo apt-get install -y \
cmake \
flatpak \
flatpak-builder
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
sudo flatpak install flathub org.freedesktop.Platform//21.08 org.freedesktop.Sdk//21.08 -y
flatpak
sudo su $(whoami) -c 'flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo'
sudo su $(whoami) -c 'flatpak install --user flathub org.flatpak.Builder org.freedesktop.Platform//21.08 org.freedesktop.Sdk//21.08 -y'
- name: Configure Flatpak Manifest
run: |
Expand Down Expand Up @@ -222,9 +205,8 @@ jobs:
- name: Build Linux Flatpak
working-directory: build
run: |
sudo flatpak-builder build-dir com.github.sunshinestream.sunshine.yml
sudo flatpak-builder --repo=repo --force-clean build-dir com.github.sunshinestream.sunshine.yml
sudo flatpak build-bundle ./repo ../artifacts/sunshine.flatpak com.github.sunshinestream.sunshine
sudo su $(whoami) -c 'flatpak run org.flatpak.Builder --repo=repo --force-clean build-sunshine com.github.sunshinestream.sunshine.yml'
sudo su $(whoami) -c 'flatpak build-bundle ./repo ../artifacts/sunshine.flatpak com.github.sunshinestream.sunshine'
- name: Upload Artifacts
uses: actions/upload-artifact@v3
Expand Down
67 changes: 35 additions & 32 deletions packaging/linux/flatpak/com.github.sunshinestream.sunshine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ finish-args:
- --socket=pulseaudio
- --share=network
- --device=all
- --persist=.
- --persist=.config/sunshine
- --system-talk-name=org.freedesktop.Avahi
- --env=PULSE_PROP_media.category=Manager

Expand All @@ -24,36 +24,37 @@ cleanup:
- /share

modules:
# - name: cuda
# buildsystem: simple
# only-arches:
# - x86_64
# - aarch64
# cleanup:
# - '*'
# build-commands:
# - chmod u+x ./cuda.run
# - ./cuda.run --silent --toolkit --toolkitpath=/app --no-opengl-libs --no-man-page --no-drm
# - rm ./cuda.run
# - rm -r /app/nsight-systems-2021.3.2
# sources:
# - type: file
# only-arches:
# - x86_64
# url: https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda_11.4.2_470.57.02_linux.run
# sha256: bbd87ca0e913f837454a796367473513cddef555082e4d86ed9a38659cc81f0a
# dest-filename: cuda.run
# - type: file
# only-arches:
# - aarch64
# url: https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda_11.4.2_470.57.02_linux_sbsa.run
# sha256: f2c4a52e06329606c8dfb7c5ea3f4cb4c0b28f9d3fdffeeb734fcc98daf580d8
# dest-filename: cuda.run
- name: cuda
disabled: false
buildsystem: simple
only-arches:
- x86_64
- aarch64
cleanup:
- '*'
build-commands:
- chmod u+x ./cuda.run
- ./cuda.run --silent --toolkit --toolkitpath=$FLATPAK_DEST/cuda --no-opengl-libs --no-man-page --no-drm --tmpdir=$FLATPAK_BUILDER_BUILDDIR
- rm -r $FLATPAK_DEST/cuda/nsight-systems-2021.3.2
- rm ./cuda.run
sources:
- type: file
only-arches:
- x86_64
url: https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda_11.4.2_470.57.02_linux.run
sha256: bbd87ca0e913f837454a796367473513cddef555082e4d86ed9a38659cc81f0a
dest-filename: cuda.run
- type: file
only-arches:
- aarch64
url: https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda_11.4.2_470.57.02_linux_sbsa.run
sha256: f2c4a52e06329606c8dfb7c5ea3f4cb4c0b28f9d3fdffeeb734fcc98daf580d8
dest-filename: cuda.run

- name: boost
buildsystem: simple
build-commands:
- ./bootstrap.sh --prefix=/app --with-libraries=system,thread,log
- ./bootstrap.sh --prefix=$FLATPAK_DEST --with-libraries=system,thread,log
- ./b2 install variant=release link=static,shared runtime-link=shared cxxflags="$CXXFLAGS" linkflags="$LDFLAGS" -j $FLATPAK_BUILDER_N_JOBS
sources:
- type: archive
Expand Down Expand Up @@ -81,8 +82,9 @@ modules:
# - --enable-nonfree
# - --enable-cuda-nvcc
# - --enable-libnpp
# - --extra-cflags=-I/app/include
# - --extra-ldflags=-L/app/lib64
# - --extra-cflags=-I${FLATPAK_DEST}/cuda/include
# - --extra-ldflags=-L${FLATPAK_DEST}/cuda/lib64
# - --nvccflags="-gencode arch=compute_52,code=sm_52 -O2"
cleanup:
- /share/ffmpeg/examples
sources:
Expand Down Expand Up @@ -118,10 +120,10 @@ modules:
- type: archive
url: https://bitbucket.org/multicoreware/x265_git/downloads/x265_3.5.tar.gz
sha256: e70a3335cacacbba0b3a20ec6fecd6783932288ebc8163ad74bcc9606477cae8
- name: nv-codec-headers
- name: ffnvcodec
no-autogen: true
make-install-args:
- PREFIX=/app
- PREFIX=${FLATPAK_DEST}
cleanup:
- '*'
sources:
Expand Down Expand Up @@ -196,7 +198,8 @@ modules:
cxxflags: -I${C_INCLUDE_PATH}/libevdev-1.0
config-opts:
- -DCMAKE_BUILD_TYPE=Release
- -DCMAKE_INSTALL_PREFIX='/app'
- -DCMAKE_INSTALL_PREFIX=/app
- -DCMAKE_CUDA_COMPILER=/app/cuda/bin/nvcc
- -DSUNSHINE_ASSETS_DIR=assets
- -DSUNSHINE_CONFIG_DIR=config
- -DSUNSHINE_EXECUTABLE_PATH=/app/bin/sunshine
Expand Down

0 comments on commit d19c883

Please sign in to comment.