Skip to content

Commit

Permalink
ci: add vita job
Browse files Browse the repository at this point in the history
  • Loading branch information
madebr committed Jul 28, 2024
1 parent 5617ce2 commit 44f1f81
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 2 deletions.
93 changes: 93 additions & 0 deletions .github/actions/setup-vita-gles/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: 'Setup GLES for PlayStation Vita'
description: 'Setup GLES (PVR and PIB)'
inputs:
pib-version:
description: 'PIB version'
default: '1.1.4'
pvr-version:
description: 'PVR_PSP2 version'
default: '3.9'
type:
description: '"pib" or "pvr"'
default: ''
runs:
using: 'composite'
steps:
- name: 'Calculate variables'
id: calc
shell: sh
run: |
if test "x${VITASDK}" = "x"; then
echo "VITASKD must be defined"
exit 1;
fi
case "x${{ inputs.type }}" in
"xpvr")
echo "cache-key=SDL-vita-gles-pvr-${{ inputs.pvr-version}}" >> ${GITHUB_OUTPUT}
;;
"xpib")
echo "cache-key=SDL-vita-gles-pib-${{ inputs.pib-version}}" >> ${GITHUB_OUTPUT}
;;
*)
echo "Invalid type. Must be 'pib' or 'pvr'."
exit 1
;;
esac
- uses: actions/cache/restore@v4
id: restore-cache
with:
path: /vita/dependencies
key: '${{ steps.calc.outputs.cache-key }}'
- name: 'Download PVR_PSP2 (GLES)'
if: ${{ !steps.restore-cache.outputs.cache-hit && inputs.type == 'pvr' }}
shell: sh
run: |
pvr_psp2_version=${{ inputs.pvr-version }}
mkdir -p /vita/dependencies/include
mkdir -p /vita/dependencies/lib
# Configure PVR_PSP2 headers
wget https://github.com/GrapheneCt/PVR_PSP2/archive/refs/tags/v$pvr_psp2_version.zip -P/tmp
unzip /tmp/v$pvr_psp2_version.zip -d/tmp
cp -r /tmp/PVR_PSP2-$pvr_psp2_version/include/* /vita/dependencies/include
rm /tmp/v$pvr_psp2_version.zip
# include guard of PVR_PSP2's khrplatform.h does not match the usual one
sed -i -e s/__drvkhrplatform_h_/__khrplatform_h_/ /vita/dependencies/include/KHR/khrplatform.h
# Configure PVR_PSP2 stub libraries
wget https://github.com/GrapheneCt/PVR_PSP2/releases/download/v$pvr_psp2_version/vitasdk_stubs.zip -P/tmp
unzip /tmp/vitasdk_stubs.zip -d/tmp/pvr_psp2_stubs
find /tmp/pvr_psp2_stubs -type f -name "*.a" -exec cp {} /vita/dependencies/lib \;
rm /tmp/vitasdk_stubs.zip
rm -rf /tmp/pvr_psp2_stubs
- name: 'Download gl4es4vita (OpenGL)'
if: ${{ !steps.restore-cache.outputs.cache-hit && inputs.type == 'pib' }}
shell: sh
run: |
gl4es4vita_version=${{ inputs.pib-version }}
mkdir -p /vita/dependencies/include
mkdir -p /vita/dependencies/lib
# Configure gl4es4vita headers
wget https://github.com/SonicMastr/gl4es4vita/releases/download/v$gl4es4vita_version-vita/include.zip -P/tmp
unzip -o /tmp/include.zip -d/vita/dependencies/include
rm /tmp/include.zip
# Configure gl4es4vita stub libraries
wget https://github.com/SonicMastr/gl4es4vita/releases/download/v$gl4es4vita_version-vita/vitasdk_stubs.zip -P/tmp
unzip /tmp/vitasdk_stubs.zip -d/vita/dependencies/lib
- uses: actions/cache/save@v4
if: ${{ !steps.restore-cache.outputs.cache-hit }}
with:
path: /vita/dependencies
key: '${{ steps.calc.outputs.cache-key }}'

- name: Copy PVR_PSP2 (GLES) or gl4es4vita (OpenGL) to vita toolchain dir
shell: sh
run: |
cp -rv /vita/dependencies/* ${VITASDK}/arm-vita-eabi
33 changes: 33 additions & 0 deletions .github/workflows/create-test-plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class SdlPlatform(Enum):
PowerPC64 = "powerpc64"
Ps2 = "ps2"
Psp = "psp"
Vita = "vita"
Riscos = "riscos"
FreeBSD = "freebsd"
NetBSD = "netbsd"
Expand All @@ -67,6 +68,11 @@ class IntelCompiler(Enum):
Icx = "icx"


class VitaGLES(Enum):
Pib = "pib"
Pvr = "pvr"


@dataclasses.dataclass(slots=True)
class JobSpec:
name: str
Expand All @@ -89,6 +95,7 @@ class JobSpec:
msvc_arch: Optional[MsvcArch] = None
clang_cl: bool = False
uwp: bool = False
vita_gles: Optional[VitaGLES] = None


JOB_SPECS = {
Expand Down Expand Up @@ -124,6 +131,8 @@ class JobSpec:
"ppc64": JobSpec(name="PowerPC64", os=JobOs.UbuntuLatest, platform=SdlPlatform.PowerPC64, artifact="SDL-ppc64le", container="dockcross/linux-ppc64le:latest", ),
"ps2": JobSpec(name="Sony PlayStation 2", os=JobOs.UbuntuLatest, platform=SdlPlatform.Ps2, artifact="SDL-ps2", container="ps2dev/ps2dev:latest", ),
"psp": JobSpec(name="Sony PlayStation Portable", os=JobOs.UbuntuLatest, platform=SdlPlatform.Psp, artifact="SDL-psp", container="pspdev/pspdev:latest", ),
"vita-pib": JobSpec(name="Sony PlayStation Vita (GLES w/ pib)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Vita, artifact="SDL-vita-pib", container="vitasdk/vitasdk:latest", vita_gles=VitaGLES.Pib, ),
"vita-pvr": JobSpec(name="Sony PlayStation Vita (GLES w/ PVR_PSP2)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Vita, artifact="SDL-vita-pvr", container="vitasdk/vitasdk:latest", vita_gles=VitaGLES.Pvr, ),
"riscos": JobSpec(name="RISC OS", os=JobOs.UbuntuLatest, platform=SdlPlatform.Riscos, artifact="SDL-riscos", container="riscosdotinfo/riscos-gccsdk-4.7:latest", ),
"netbsd": JobSpec(name="NetBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.NetBSD, artifact="SDL-netbsd-x64", ),
"freebsd": JobSpec(name="FreeBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.FreeBSD, artifact="SDL-freebsd-x64", ),
Expand Down Expand Up @@ -187,6 +196,7 @@ class JobDetails:
cpactions_arch: str = ""
cpactions_setup_cmd: str = ""
cpactions_install_cmd: str = ""
setup_vita_gles_type: str = ""

def to_workflow(self) -> dict[str, str|bool]:
data = {
Expand Down Expand Up @@ -242,6 +252,7 @@ def to_workflow(self) -> dict[str, str|bool]:
"cpactions-arch": self.cpactions_arch,
"cpactions-setup-cmd": self.cpactions_setup_cmd,
"cpactions-install-cmd": self.cpactions_install_cmd,
"setup-vita-gles-type": self.setup_vita_gles_type,
}
return {k: v for k, v in data.items() if v != ""}

Expand Down Expand Up @@ -476,6 +487,28 @@ def spec_to_job(spec: JobSpec) -> JobDetails:
job.cc = "psp-gcc"
job.ldflags = ["-L${PSPDEV}/lib", "-L${PSPDEV}/psp/lib", "-L${PSPDEV}/psp/sdk/lib", ]
job.pollute_directories = ["${PSPDEV}/include", "${PSPDEV}/psp/include", "${PSPDEV}/psp/sdk/include", ]
case SdlPlatform.Vita:
job.sudo = ""
job.apt_packages = []
job.apk_packages = ["cmake", "ninja", "pkgconf", "bash", "tar"]
job.cmake_toolchain_file = "${VITASDK}/share/vita.toolchain.cmake"
assert spec.vita_gles is not None
job.setup_vita_gles_type = {
VitaGLES.Pib: "pib",
VitaGLES.Pvr: "pvr",
}[spec.vita_gles]
job.cmake_arguments.extend((
f"-DVIDEO_VITA_PIB={ 'true' if spec.vita_gles == VitaGLES.Pib else 'false' }",
f"-DVIDEO_VITA_PVR={ 'true' if spec.vita_gles == VitaGLES.Pvr else 'false' }",
"-DSDL_ARMNEON=ON",
"-DSDL_ARMSIMD=ON",
))
# Fix vita.toolchain.cmake (https://github.com/vitasdk/vita-toolchain/pull/253)
job.source_cmd = "sed -i -E 's/set\( PKG_CONFIG_EXECUTABLE \"\$\{VITASDK}\/bin\/arm-vita-eabi-pkg-config\" )/set( PKG_CONFIG_EXECUTABLE \"${VITASDK}\/bin\/arm-vita-eabi-pkg-config\" CACHE PATH \"Path of pkg-config executable\" )/' ${VITASDK}/share/vita.toolchain.cmake"
job.clang_tidy = False
job.run_tests = False
job.shared = False
job.cc = "arm-vita-eabi-gcc"
case SdlPlatform.Haiku:
fpic = False
job.run_tests = False
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/generic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ jobs:
- name: 'Set up ninja'
if: ${{ matrix.platform.setup-ninja }}
uses: ./.github/actions/setup-ninja
- name: 'Set up libusb'
id: libusb
- name: 'Set up libusb for MSVC'
if: ${{ matrix.platform.setup-libusb-arch != '' }}
uses: ./.github/actions/setup-msvc-libusb
with:
Expand Down Expand Up @@ -114,6 +113,11 @@ jobs:
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
brew update
brew install ${{ matrix.platform.brew-packages }}
- name: 'Set up GLES for VITA' # Must be after apk
if: ${{ matrix.platform.setup-vita-gles-type != '' }}
uses: ./.github/actions/setup-vita-gles
with:
type: ${{ matrix.platform.setup-vita-gles-type }}

- name: 'Pollute toolchain with "bad SDL headers'
if: ${{ matrix.platform.pollute-directories != '' }}
Expand Down

0 comments on commit 44f1f81

Please sign in to comment.