Add CUDA to Flatpak (#218)

This commit is contained in:
istori1 2022-07-05 19:27:14 -04:00 committed by GitHub
parent 42eda48ce4
commit d19c883067
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 41 additions and 56 deletions

View File

@ -159,38 +159,21 @@ jobs:
build_linux_flatpak: build_linux_flatpak:
name: Linux Flatpak name: Linux Flatpak
runs-on: ubuntu-18.04 runs-on: ubuntu-latest
needs: check_changelog needs: check_changelog
steps: 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 - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Setup Dependencies Linux Flatpak - name: Setup Dependencies Linux Flatpak
run: | run: |
sudo add-apt-repository ppa:flatpak/stable -y
sudo apt-get update -y sudo apt-get update -y
sudo apt-get install -y \ sudo apt-get install -y \
cmake \ cmake \
flatpak \ flatpak
flatpak-builder sudo su $(whoami) -c 'flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo'
sudo flatpak remote-add --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'
sudo flatpak install flathub org.freedesktop.Platform//21.08 org.freedesktop.Sdk//21.08 -y
- name: Configure Flatpak Manifest - name: Configure Flatpak Manifest
run: | run: |
@ -222,9 +205,8 @@ jobs:
- name: Build Linux Flatpak - name: Build Linux Flatpak
working-directory: build working-directory: build
run: | run: |
sudo flatpak-builder build-dir com.github.sunshinestream.sunshine.yml sudo su $(whoami) -c 'flatpak run org.flatpak.Builder --repo=repo --force-clean build-sunshine com.github.sunshinestream.sunshine.yml'
sudo flatpak-builder --repo=repo --force-clean build-dir com.github.sunshinestream.sunshine.yml sudo su $(whoami) -c 'flatpak build-bundle ./repo ../artifacts/sunshine.flatpak com.github.sunshinestream.sunshine'
sudo flatpak build-bundle ./repo ../artifacts/sunshine.flatpak com.github.sunshinestream.sunshine
- name: Upload Artifacts - name: Upload Artifacts
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3

View File

@ -11,7 +11,7 @@ finish-args:
- --socket=pulseaudio - --socket=pulseaudio
- --share=network - --share=network
- --device=all - --device=all
- --persist=. - --persist=.config/sunshine
- --system-talk-name=org.freedesktop.Avahi - --system-talk-name=org.freedesktop.Avahi
- --env=PULSE_PROP_media.category=Manager - --env=PULSE_PROP_media.category=Manager
@ -24,36 +24,37 @@ cleanup:
- /share - /share
modules: modules:
# - name: cuda - name: cuda
# buildsystem: simple disabled: false
# only-arches: buildsystem: simple
# - x86_64 only-arches:
# - aarch64 - x86_64
# cleanup: - aarch64
# - '*' cleanup:
# build-commands: - '*'
# - chmod u+x ./cuda.run build-commands:
# - ./cuda.run --silent --toolkit --toolkitpath=/app --no-opengl-libs --no-man-page --no-drm - chmod u+x ./cuda.run
# - rm ./cuda.run - ./cuda.run --silent --toolkit --toolkitpath=$FLATPAK_DEST/cuda --no-opengl-libs --no-man-page --no-drm --tmpdir=$FLATPAK_BUILDER_BUILDDIR
# - rm -r /app/nsight-systems-2021.3.2 - rm -r $FLATPAK_DEST/cuda/nsight-systems-2021.3.2
# sources: - rm ./cuda.run
# - type: file sources:
# only-arches: - type: file
# - x86_64 only-arches:
# url: https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda_11.4.2_470.57.02_linux.run - x86_64
# sha256: bbd87ca0e913f837454a796367473513cddef555082e4d86ed9a38659cc81f0a url: https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda_11.4.2_470.57.02_linux.run
# dest-filename: cuda.run sha256: bbd87ca0e913f837454a796367473513cddef555082e4d86ed9a38659cc81f0a
# - type: file dest-filename: cuda.run
# only-arches: - type: file
# - aarch64 only-arches:
# url: https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda_11.4.2_470.57.02_linux_sbsa.run - aarch64
# sha256: f2c4a52e06329606c8dfb7c5ea3f4cb4c0b28f9d3fdffeeb734fcc98daf580d8 url: https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda_11.4.2_470.57.02_linux_sbsa.run
# dest-filename: cuda.run sha256: f2c4a52e06329606c8dfb7c5ea3f4cb4c0b28f9d3fdffeeb734fcc98daf580d8
dest-filename: cuda.run
- name: boost - name: boost
buildsystem: simple buildsystem: simple
build-commands: 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 - ./b2 install variant=release link=static,shared runtime-link=shared cxxflags="$CXXFLAGS" linkflags="$LDFLAGS" -j $FLATPAK_BUILDER_N_JOBS
sources: sources:
- type: archive - type: archive
@ -81,8 +82,9 @@ modules:
# - --enable-nonfree # - --enable-nonfree
# - --enable-cuda-nvcc # - --enable-cuda-nvcc
# - --enable-libnpp # - --enable-libnpp
# - --extra-cflags=-I/app/include # - --extra-cflags=-I${FLATPAK_DEST}/cuda/include
# - --extra-ldflags=-L/app/lib64 # - --extra-ldflags=-L${FLATPAK_DEST}/cuda/lib64
# - --nvccflags="-gencode arch=compute_52,code=sm_52 -O2"
cleanup: cleanup:
- /share/ffmpeg/examples - /share/ffmpeg/examples
sources: sources:
@ -118,10 +120,10 @@ modules:
- type: archive - type: archive
url: https://bitbucket.org/multicoreware/x265_git/downloads/x265_3.5.tar.gz url: https://bitbucket.org/multicoreware/x265_git/downloads/x265_3.5.tar.gz
sha256: e70a3335cacacbba0b3a20ec6fecd6783932288ebc8163ad74bcc9606477cae8 sha256: e70a3335cacacbba0b3a20ec6fecd6783932288ebc8163ad74bcc9606477cae8
- name: nv-codec-headers - name: ffnvcodec
no-autogen: true no-autogen: true
make-install-args: make-install-args:
- PREFIX=/app - PREFIX=${FLATPAK_DEST}
cleanup: cleanup:
- '*' - '*'
sources: sources:
@ -196,7 +198,8 @@ modules:
cxxflags: -I${C_INCLUDE_PATH}/libevdev-1.0 cxxflags: -I${C_INCLUDE_PATH}/libevdev-1.0
config-opts: config-opts:
- -DCMAKE_BUILD_TYPE=Release - -DCMAKE_BUILD_TYPE=Release
- -DCMAKE_INSTALL_PREFIX='/app' - -DCMAKE_INSTALL_PREFIX=/app
- -DCMAKE_CUDA_COMPILER=/app/cuda/bin/nvcc
- -DSUNSHINE_ASSETS_DIR=assets - -DSUNSHINE_ASSETS_DIR=assets
- -DSUNSHINE_CONFIG_DIR=config - -DSUNSHINE_CONFIG_DIR=config
- -DSUNSHINE_EXECUTABLE_PATH=/app/bin/sunshine - -DSUNSHINE_EXECUTABLE_PATH=/app/bin/sunshine