diff options
Diffstat (limited to 'src/contrib/SDL-3.2.20/.github')
11 files changed, 2385 insertions, 0 deletions
diff --git a/src/contrib/SDL-3.2.20/.github/PULL_REQUEST_TEMPLATE.md b/src/contrib/SDL-3.2.20/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..533be85 --- /dev/null +++ b/src/contrib/SDL-3.2.20/.github/PULL_REQUEST_TEMPLATE.md | |||
@@ -0,0 +1,7 @@ | |||
1 | <!--- Provide a general summary of your changes in the Title above --> | ||
2 | |||
3 | ## Description | ||
4 | <!--- Describe your changes in detail --> | ||
5 | |||
6 | ## Existing Issue(s) | ||
7 | <!--- If it fixes an open issue, please link to the issue here. --> | ||
diff --git a/src/contrib/SDL-3.2.20/.github/actions/setup-gdk-desktop/action.yml b/src/contrib/SDL-3.2.20/.github/actions/setup-gdk-desktop/action.yml new file mode 100644 index 0000000..10427ac --- /dev/null +++ b/src/contrib/SDL-3.2.20/.github/actions/setup-gdk-desktop/action.yml | |||
@@ -0,0 +1,82 @@ | |||
1 | name: 'Setup GDK (Game Development Kit) for Windows Desktop' | ||
2 | description: 'Download GDK and install into MSBuild' | ||
3 | inputs: | ||
4 | # Keep edition and ref in sync! | ||
5 | edition: | ||
6 | description: 'GDK edition' | ||
7 | default: '240601' # YYMMUU (Year Month Update) | ||
8 | ref: | ||
9 | description: 'Git reference' | ||
10 | default: 'June_2024_Update_1' | ||
11 | folder: | ||
12 | description: 'Folder where to create Directory.Build.props' | ||
13 | required: true | ||
14 | default: '${{ github.workspace }}' | ||
15 | runs: | ||
16 | using: 'composite' | ||
17 | steps: | ||
18 | - uses: actions/setup-python@main | ||
19 | with: | ||
20 | python-version: 3.x | ||
21 | - name: 'Calculate variables' | ||
22 | id: calc | ||
23 | shell: pwsh | ||
24 | run: | | ||
25 | $vs_folder=@(vswhere -latest -property installationPath) | ||
26 | echo "vs-folder=${vs_folder}" >> $Env:GITHUB_OUTPUT | ||
27 | |||
28 | echo "gdk-path=${{ runner.temp }}\GDK-${{ inputs.edition }}" >> $Env:GITHUB_OUTPUT | ||
29 | |||
30 | echo "cache-key=gdk-${{ inputs.ref }}-${{ inputs.edition }}" >> $Env:GITHUB_OUTPUT | ||
31 | - name: 'Restore cached GDK' | ||
32 | id: cache-restore | ||
33 | uses: actions/cache/restore@v4 | ||
34 | with: | ||
35 | path: '${{ steps.calc.outputs.gdk-path }}' | ||
36 | key: ${{ steps.calc.outputs.cache-key }} | ||
37 | - name: 'Download GDK' | ||
38 | if: ${{ !steps.cache-restore.outputs.cache-hit }} | ||
39 | shell: pwsh | ||
40 | run: | | ||
41 | python build-scripts/setup-gdk-desktop.py ` | ||
42 | --download ` | ||
43 | --temp-folder "${{ runner.temp }}" ` | ||
44 | --gdk-path="${{ steps.calc.outputs.gdk-path }}" ` | ||
45 | --ref-edition "${{ inputs.ref }},${{ inputs.edition }}" ` | ||
46 | --vs-folder="${{ steps.calc.outputs.vs-folder }}" ` | ||
47 | --no-user-props | ||
48 | - name: 'Extract GDK' | ||
49 | if: ${{ !steps.cache-restore.outputs.cache-hit }} | ||
50 | shell: pwsh | ||
51 | run: | | ||
52 | python build-scripts/setup-gdk-desktop.py ` | ||
53 | --extract ` | ||
54 | --ref-edition "${{ inputs.ref }},${{ inputs.edition }}" ` | ||
55 | --temp-folder "${{ runner.temp }}" ` | ||
56 | --gdk-path="${{ steps.calc.outputs.gdk-path }}" ` | ||
57 | --vs-folder="${{ steps.calc.outputs.vs-folder }}" ` | ||
58 | --no-user-props | ||
59 | - name: 'Cache GDK' | ||
60 | if: ${{ !steps.cache-restore.outputs.cache-hit }} | ||
61 | uses: actions/cache/save@v4 | ||
62 | with: | ||
63 | path: '${{ steps.calc.outputs.gdk-path }}' | ||
64 | key: ${{ steps.calc.outputs.cache-key }} | ||
65 | - name: 'Copy MSBuild files into GDK' | ||
66 | shell: pwsh | ||
67 | run: | | ||
68 | python build-scripts/setup-gdk-desktop.py ` | ||
69 | --ref-edition "${{ inputs.ref }},${{ inputs.edition }}" ` | ||
70 | --gdk-path="${{ steps.calc.outputs.gdk-path }}" ` | ||
71 | --vs-folder="${{ steps.calc.outputs.vs-folder }}" ` | ||
72 | --copy-msbuild ` | ||
73 | --no-user-props | ||
74 | - name: 'Write user props' | ||
75 | shell: pwsh | ||
76 | run: | | ||
77 | python build-scripts/setup-gdk-desktop.py ` | ||
78 | --ref-edition "${{ inputs.ref }},${{ inputs.edition }}" ` | ||
79 | --temp-folder "${{ runner.temp }}" ` | ||
80 | --vs-folder="${{ steps.calc.outputs.vs-folder }}" ` | ||
81 | --gdk-path="${{ steps.calc.outputs.gdk-path }}" ` | ||
82 | "--props-folder=${{ inputs.folder }}" | ||
diff --git a/src/contrib/SDL-3.2.20/.github/actions/setup-loongarch64-toolchain/action.yml b/src/contrib/SDL-3.2.20/.github/actions/setup-loongarch64-toolchain/action.yml new file mode 100644 index 0000000..e7f9ddc --- /dev/null +++ b/src/contrib/SDL-3.2.20/.github/actions/setup-loongarch64-toolchain/action.yml | |||
@@ -0,0 +1,53 @@ | |||
1 | name: 'Setup LoongArch64 toolchain' | ||
2 | description: 'Download Linux LoongArch64 toolchain and set output variables' | ||
3 | inputs: | ||
4 | version: | ||
5 | description: 'LoongArch64 version' | ||
6 | default: '2023.08.08' | ||
7 | outputs: | ||
8 | prefix: | ||
9 | description: "LoongArch toolchain prefix" | ||
10 | value: ${{ steps.final.outputs.prefix }} | ||
11 | cc: | ||
12 | description: "LoongArch C compiler" | ||
13 | value: ${{ steps.final.outputs.cc }} | ||
14 | cxx: | ||
15 | description: "LoongArch C++ compiler" | ||
16 | value: ${{ steps.final.outputs.cxx }} | ||
17 | runs: | ||
18 | using: 'composite' | ||
19 | steps: | ||
20 | - uses: actions/cache/restore@v4 | ||
21 | id: restore-cache | ||
22 | with: | ||
23 | path: /opt/cross-tools | ||
24 | key: loongarch64-${{ inputs.version }} | ||
25 | |||
26 | - name: 'Download LoongArch64 gcc+glibc toolchain' | ||
27 | if: ${{ !steps.restore-cache.outputs.cache-hit }} | ||
28 | shell: bash | ||
29 | run: | | ||
30 | url="https://github.com/loongson/build-tools/releases/download/${{ inputs.version }}/CLFS-loongarch64-8.1-x86_64-cross-tools-gcc-glibc.tar.xz" | ||
31 | |||
32 | wget "$url" -O /tmp/toolchain.tar.xz | ||
33 | |||
34 | mkdir -p /opt | ||
35 | tar -C /opt -x -f /tmp/toolchain.tar.xz | ||
36 | |||
37 | - uses: actions/cache/save@v4 | ||
38 | if: ${{ !steps.restore-cache.outputs.cache-hit }} | ||
39 | with: | ||
40 | path: /opt/cross-tools | ||
41 | key: loongarch64-${{ inputs.version }} | ||
42 | - name: 'Set output vars' | ||
43 | id: final | ||
44 | shell: bash | ||
45 | run: | | ||
46 | prefix=/opt/cross-tools | ||
47 | echo "prefix=${prefix}" >> $GITHUB_OUTPUT | ||
48 | cc="${prefix}/bin/loongarch64-unknown-linux-gnu-gcc" | ||
49 | cxx="${prefix}/bin/loongarch64-unknown-linux-gnu-g++" | ||
50 | echo "cc=${cc}" >> $GITHUB_OUTPUT | ||
51 | echo "cxx=${cxx}" >> $GITHUB_OUTPUT | ||
52 | echo "LOONGARCH64_CC=${cc}" >>$GITHUB_ENV | ||
53 | echo "LOONGARCH64_CXX=${cxx}" >>$GITHUB_ENV | ||
diff --git a/src/contrib/SDL-3.2.20/.github/actions/setup-msvc-libusb/action.yml b/src/contrib/SDL-3.2.20/.github/actions/setup-msvc-libusb/action.yml new file mode 100644 index 0000000..cbbf098 --- /dev/null +++ b/src/contrib/SDL-3.2.20/.github/actions/setup-msvc-libusb/action.yml | |||
@@ -0,0 +1,71 @@ | |||
1 | name: 'Setup libusb for MSVC' | ||
2 | description: 'Download libusb sdk for MSVC, and set output/environment variables' | ||
3 | inputs: | ||
4 | version: | ||
5 | description: 'libusb version' | ||
6 | required: true | ||
7 | default: '1.0.27' | ||
8 | arch: | ||
9 | description: "libusb architecture (x86 or x64)" | ||
10 | rqeuired: true | ||
11 | outputs: | ||
12 | root: | ||
13 | description: "libusb root directory" | ||
14 | value: ${{ steps.final.outputs.root }} | ||
15 | runs: | ||
16 | using: 'composite' | ||
17 | steps: | ||
18 | - name: 'Restore cached libusb-${{ inputs.version }}.7z' | ||
19 | id: cache-restore | ||
20 | uses: actions/cache/restore@v4 | ||
21 | with: | ||
22 | path: 'C:\temp\libusb-${{ inputs.version }}.7z' | ||
23 | key: libusb-msvc-${{ inputs.version }} | ||
24 | - name: 'Download libusb ${{ inputs.version }}' | ||
25 | if: ${{ !steps.cache-restore.outputs.cache-hit }} | ||
26 | shell: pwsh | ||
27 | run: | | ||
28 | Invoke-WebRequest "https://github.com/libusb/libusb/releases/download/v${{ inputs.version }}/libusb-${{ inputs.version }}.7z" -OutFile "C:\temp\libusb-${{ inputs.version }}.7z" | ||
29 | - name: 'Cache libusb-${{ inputs.version }}.7z' | ||
30 | if: ${{ !steps.cache-restore.outputs.cache-hit }} | ||
31 | uses: actions/cache/save@v4 | ||
32 | with: | ||
33 | path: 'C:\temp\libusb-${{ inputs.version }}.7z' | ||
34 | key: libusb-msvc-${{ inputs.version }} | ||
35 | - name: 'Extract libusb' | ||
36 | shell: pwsh | ||
37 | run: | | ||
38 | 7z "-oC:\temp\libusb-${{ inputs.version }}" x "C:\temp\libusb-${{ inputs.version }}.7z" | ||
39 | - name: 'Set output vars' | ||
40 | id: final | ||
41 | shell: pwsh | ||
42 | run: | | ||
43 | if ('${{ inputs.arch }}' -eq 'x86') { | ||
44 | $archdir = "MS32"; | ||
45 | } elseif ('${{ inputs.arch }}' -eq 'x64') { | ||
46 | $archdir = "MS64"; | ||
47 | } else { | ||
48 | write-host "Invalid arch=${{ inputs.arch }}" | ||
49 | exit 1 | ||
50 | } | ||
51 | $libusb_incdir = "C:\temp\libusb-${{ inputs.version }}\include"; | ||
52 | $libusb_libdir = "C:\temp\libusb-${{ inputs.version }}\VS2022\${archdir}\dll"; | ||
53 | |||
54 | $libusb_header = "${libusb_incdir}\libusb.h"; | ||
55 | $libusb_implib = "${libusb_libdir}\libusb-1.0.lib"; | ||
56 | $libusb_dll = "${libusb_libdir}\libusb-1.0.dll"; | ||
57 | |||
58 | if (!(Test-Path "${libusb_header}")) { | ||
59 | write-host "${libusb_header} does not exist!" | ||
60 | exit 1 | ||
61 | } | ||
62 | if (!(Test-Path "${libusb_implib}")){ | ||
63 | write-host "${libusb_implib} does not exist!" | ||
64 | exit 1 | ||
65 | } | ||
66 | if (!(Test-Path "${libusb_dll}")) { | ||
67 | write-host "${libusb_dll} does not exist!" | ||
68 | exit 1 | ||
69 | } | ||
70 | echo "root=${libusb_incdir};${libusb_libdir}" >> $env:GITHUB_OUTPUT | ||
71 | echo "LibUSB_ROOT=${libusb_incdir};${libusb_libdir}" >> $env:GITHUB_ENV | ||
diff --git a/src/contrib/SDL-3.2.20/.github/actions/setup-ninja/action.yml b/src/contrib/SDL-3.2.20/.github/actions/setup-ninja/action.yml new file mode 100644 index 0000000..a1d3ad9 --- /dev/null +++ b/src/contrib/SDL-3.2.20/.github/actions/setup-ninja/action.yml | |||
@@ -0,0 +1,62 @@ | |||
1 | name: 'Setup ninja' | ||
2 | description: 'Download ninja and add it to the PATH environment variable' | ||
3 | inputs: | ||
4 | version: | ||
5 | description: 'Ninja version' | ||
6 | default: '1.12.1' | ||
7 | runs: | ||
8 | using: 'composite' | ||
9 | steps: | ||
10 | - name: 'Calculate variables' | ||
11 | id: calc | ||
12 | shell: sh | ||
13 | run: | | ||
14 | case "${{ runner.os }}-${{ runner.arch }}" in | ||
15 | "Linux-X86" | "Linux-X64") | ||
16 | archive="ninja-linux.zip" | ||
17 | ;; | ||
18 | "Linux-ARM64") | ||
19 | archive="ninja-linux-aarch64.zip" | ||
20 | ;; | ||
21 | "macOS-X86" | "macOS-X64" | "macOS-ARM64") | ||
22 | archive="ninja-mac.zip" | ||
23 | ;; | ||
24 | "Windows-X86" | "Windows-X64") | ||
25 | archive="ninja-win.zip" | ||
26 | ;; | ||
27 | "Windows-ARM64") | ||
28 | archive="ninja-winarm64.zip" | ||
29 | ;; | ||
30 | *) | ||
31 | echo "Unsupported ${{ runner.os }}-${{ runner.arch }}" | ||
32 | exit 1; | ||
33 | ;; | ||
34 | esac | ||
35 | echo "archive=${archive}" >> ${GITHUB_OUTPUT} | ||
36 | echo "cache-key=${archive}-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}" >> ${GITHUB_OUTPUT} | ||
37 | - name: 'Restore cached ${{ steps.calc.outputs.archive }}' | ||
38 | id: cache-restore | ||
39 | uses: actions/cache/restore@v4 | ||
40 | with: | ||
41 | path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}' | ||
42 | key: ${{ steps.calc.outputs.cache-key }} | ||
43 | - name: 'Download ninja ${{ inputs.version }} for ${{ runner.os }} (${{ runner.arch }})' | ||
44 | if: ${{ !steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false' }} | ||
45 | shell: pwsh | ||
46 | run: | | ||
47 | Invoke-WebRequest "https://github.com/ninja-build/ninja/releases/download/v${{ inputs.version }}/${{ steps.calc.outputs.archive }}" -OutFile "${{ runner.temp }}/${{ steps.calc.outputs.archive }}" | ||
48 | - name: 'Cache ${{ steps.calc.outputs.archive }}' | ||
49 | if: ${{ !steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false' }} | ||
50 | uses: actions/cache/save@v4 | ||
51 | with: | ||
52 | path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}' | ||
53 | key: ${{ steps.calc.outputs.cache-key }} | ||
54 | - name: 'Extract ninja' | ||
55 | shell: pwsh | ||
56 | run: | | ||
57 | 7z "-o${{ runner.temp }}/ninja-${{ inputs.version }}-${{ runner.arch }}" x "${{ runner.temp }}/${{ steps.calc.outputs.archive }}" | ||
58 | - name: 'Set output variables' | ||
59 | id: final | ||
60 | shell: pwsh | ||
61 | run: | | ||
62 | echo "${{ runner.temp }}/ninja-${{ inputs.version }}-${{ runner.arch }}" >> $env:GITHUB_PATH | ||
diff --git a/src/contrib/SDL-3.2.20/.github/actions/setup-vita-gles/action.yml b/src/contrib/SDL-3.2.20/.github/actions/setup-vita-gles/action.yml new file mode 100644 index 0000000..e263737 --- /dev/null +++ b/src/contrib/SDL-3.2.20/.github/actions/setup-vita-gles/action.yml | |||
@@ -0,0 +1,93 @@ | |||
1 | name: 'Setup GLES for PlayStation Vita' | ||
2 | description: 'Download GLES for VITA (PVR or PIB), and copy it into the vita sdk' | ||
3 | inputs: | ||
4 | pib-version: | ||
5 | description: 'PIB version' | ||
6 | default: '1.1.4' | ||
7 | pvr-version: | ||
8 | description: 'PVR_PSP2 version' | ||
9 | default: '3.9' | ||
10 | type: | ||
11 | description: '"pib" or "pvr"' | ||
12 | default: '' | ||
13 | runs: | ||
14 | using: 'composite' | ||
15 | steps: | ||
16 | - name: 'Calculate variables' | ||
17 | id: calc | ||
18 | shell: sh | ||
19 | run: | | ||
20 | if test "x${VITASDK}" = "x"; then | ||
21 | echo "VITASDK must be defined" | ||
22 | exit 1; | ||
23 | fi | ||
24 | case "x${{ inputs.type }}" in | ||
25 | "xpvr") | ||
26 | echo "cache-key=SDL-vita-gles-pvr-${{ inputs.pvr-version}}" >> ${GITHUB_OUTPUT} | ||
27 | ;; | ||
28 | "xpib") | ||
29 | echo "cache-key=SDL-vita-gles-pib-${{ inputs.pib-version}}" >> ${GITHUB_OUTPUT} | ||
30 | ;; | ||
31 | *) | ||
32 | echo "Invalid type. Must be 'pib' or 'pvr'." | ||
33 | exit 1 | ||
34 | ;; | ||
35 | esac | ||
36 | - uses: actions/cache/restore@v4 | ||
37 | id: restore-cache | ||
38 | with: | ||
39 | path: /vita/dependencies | ||
40 | key: '${{ steps.calc.outputs.cache-key }}' | ||
41 | - name: 'Download PVR_PSP2 (GLES)' | ||
42 | if: ${{ !steps.restore-cache.outputs.cache-hit && inputs.type == 'pvr' }} | ||
43 | shell: sh | ||
44 | run: | | ||
45 | pvr_psp2_version=${{ inputs.pvr-version }} | ||
46 | |||
47 | mkdir -p /vita/dependencies/include | ||
48 | mkdir -p /vita/dependencies/lib | ||
49 | |||
50 | # Configure PVR_PSP2 headers | ||
51 | wget https://github.com/GrapheneCt/PVR_PSP2/archive/refs/tags/v$pvr_psp2_version.zip -P/tmp | ||
52 | unzip /tmp/v$pvr_psp2_version.zip -d/tmp | ||
53 | cp -r /tmp/PVR_PSP2-$pvr_psp2_version/include/* /vita/dependencies/include | ||
54 | rm /tmp/v$pvr_psp2_version.zip | ||
55 | |||
56 | # include guard of PVR_PSP2's khrplatform.h does not match the usual one | ||
57 | sed -i -e s/__drvkhrplatform_h_/__khrplatform_h_/ /vita/dependencies/include/KHR/khrplatform.h | ||
58 | |||
59 | # Configure PVR_PSP2 stub libraries | ||
60 | wget https://github.com/GrapheneCt/PVR_PSP2/releases/download/v$pvr_psp2_version/vitasdk_stubs.zip -P/tmp | ||
61 | unzip /tmp/vitasdk_stubs.zip -d/tmp/pvr_psp2_stubs | ||
62 | find /tmp/pvr_psp2_stubs -type f -name "*.a" -exec cp {} /vita/dependencies/lib \; | ||
63 | rm /tmp/vitasdk_stubs.zip | ||
64 | rm -rf /tmp/pvr_psp2_stubs | ||
65 | |||
66 | - name: 'Download gl4es4vita (OpenGL)' | ||
67 | if: ${{ !steps.restore-cache.outputs.cache-hit && inputs.type == 'pib' }} | ||
68 | shell: sh | ||
69 | run: | | ||
70 | gl4es4vita_version=${{ inputs.pib-version }} | ||
71 | |||
72 | mkdir -p /vita/dependencies/include | ||
73 | mkdir -p /vita/dependencies/lib | ||
74 | |||
75 | # Configure gl4es4vita headers | ||
76 | wget https://github.com/SonicMastr/gl4es4vita/releases/download/v$gl4es4vita_version-vita/include.zip -P/tmp | ||
77 | unzip -o /tmp/include.zip -d/vita/dependencies/include | ||
78 | rm /tmp/include.zip | ||
79 | |||
80 | # Configure gl4es4vita stub libraries | ||
81 | wget https://github.com/SonicMastr/gl4es4vita/releases/download/v$gl4es4vita_version-vita/vitasdk_stubs.zip -P/tmp | ||
82 | unzip /tmp/vitasdk_stubs.zip -d/vita/dependencies/lib | ||
83 | |||
84 | - uses: actions/cache/save@v4 | ||
85 | if: ${{ !steps.restore-cache.outputs.cache-hit }} | ||
86 | with: | ||
87 | path: /vita/dependencies | ||
88 | key: '${{ steps.calc.outputs.cache-key }}' | ||
89 | |||
90 | - name: Copy PVR_PSP2 (GLES) or gl4es4vita (OpenGL) to vita toolchain dir | ||
91 | shell: sh | ||
92 | run: | | ||
93 | cp -rv /vita/dependencies/* ${VITASDK}/arm-vita-eabi | ||
diff --git a/src/contrib/SDL-3.2.20/.github/cmake/CMakeLists.txt b/src/contrib/SDL-3.2.20/.github/cmake/CMakeLists.txt new file mode 100644 index 0000000..4875701 --- /dev/null +++ b/src/contrib/SDL-3.2.20/.github/cmake/CMakeLists.txt | |||
@@ -0,0 +1,16 @@ | |||
1 | cmake_minimum_required(VERSION 3.0...3.5) | ||
2 | project(ci_utils C CXX) | ||
3 | |||
4 | set(txt "CC=${CMAKE_C_COMPILER} | ||
5 | CXX=${CMAKE_CXX_COMPILER} | ||
6 | CFLAGS=${CMAKE_C_FLAGS} | ||
7 | CXXFLAGS=${CMAKE_CXX_FLAGS} | ||
8 | LDFLAGS=${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_C_STANDARD_LIBRARIES} | ||
9 | ") | ||
10 | |||
11 | message("${txt}") | ||
12 | |||
13 | set(VAR_PATH "/tmp/env.txt" CACHE PATH "Where to write environment file") | ||
14 | message(STATUS "Writing CC/CXX/CFLAGS/CXXFLAGS/LDFLAGS environment to ${VAR_PATH}") | ||
15 | |||
16 | file(WRITE "${VAR_PATH}" "${txt}") | ||
diff --git a/src/contrib/SDL-3.2.20/.github/workflows/build.yml b/src/contrib/SDL-3.2.20/.github/workflows/build.yml new file mode 100644 index 0000000..09652e0 --- /dev/null +++ b/src/contrib/SDL-3.2.20/.github/workflows/build.yml | |||
@@ -0,0 +1,48 @@ | |||
1 | name: 'Build (All)' | ||
2 | |||
3 | on: [push, pull_request] | ||
4 | |||
5 | concurrency: | ||
6 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} | ||
7 | cancel-in-progress: true | ||
8 | |||
9 | jobs: | ||
10 | controller: | ||
11 | name: 'Create test plan' | ||
12 | runs-on: 'ubuntu-latest' | ||
13 | outputs: | ||
14 | platforms-level1: ${{ steps.plan.outputs.platforms-level1 }} | ||
15 | platforms-others: ${{ steps.plan.outputs.platforms-others }} | ||
16 | steps: | ||
17 | - uses: actions/setup-python@main | ||
18 | with: | ||
19 | python-version: 3.x | ||
20 | - uses: actions/checkout@main | ||
21 | with: | ||
22 | sparse-checkout: '.github/workflows/create-test-plan.py' | ||
23 | - name: 'Create plan' | ||
24 | id: plan | ||
25 | run: | | ||
26 | # Adding [sdl-ci-filter GLOB] to the commit message will limit the jobs | ||
27 | # e.g. [sdl-ci-filter msvc-*] | ||
28 | EOF=$(openssl rand -hex 32) | ||
29 | cat >/tmp/commit_message.txt <<$EOF | ||
30 | ${{ github.event.head_commit.message }} | ||
31 | $EOF | ||
32 | |||
33 | python .github/workflows/create-test-plan.py \ | ||
34 | --github-variable-prefix platforms \ | ||
35 | --github-ci \ | ||
36 | --verbose \ | ||
37 | ${{ (github.repository_owner != 'libsdl-org' && '--no-artifact') || '' }} \ | ||
38 | --commit-message-file /tmp/commit_message.txt | ||
39 | level1: | ||
40 | needs: [controller] | ||
41 | uses: './.github/workflows/generic.yml' | ||
42 | with: | ||
43 | platforms: ${{ needs.controller.outputs.platforms-level1 }} | ||
44 | level2: | ||
45 | needs: [controller, level1] | ||
46 | uses: './.github/workflows/generic.yml' | ||
47 | with: | ||
48 | platforms: ${{ needs.controller.outputs.platforms-others }} | ||
diff --git a/src/contrib/SDL-3.2.20/.github/workflows/create-test-plan.py b/src/contrib/SDL-3.2.20/.github/workflows/create-test-plan.py new file mode 100755 index 0000000..5e2ab02 --- /dev/null +++ b/src/contrib/SDL-3.2.20/.github/workflows/create-test-plan.py | |||
@@ -0,0 +1,870 @@ | |||
1 | #!/usr/bin/env python | ||
2 | import argparse | ||
3 | import dataclasses | ||
4 | import fnmatch | ||
5 | from enum import Enum | ||
6 | import json | ||
7 | import logging | ||
8 | import os | ||
9 | import re | ||
10 | from typing import Optional | ||
11 | |||
12 | logger = logging.getLogger(__name__) | ||
13 | |||
14 | |||
15 | class AppleArch(Enum): | ||
16 | Aarch64 = "aarch64" | ||
17 | X86_64 = "x86_64" | ||
18 | |||
19 | |||
20 | class MsvcArch(Enum): | ||
21 | X86 = "x86" | ||
22 | X64 = "x64" | ||
23 | Arm32 = "arm" | ||
24 | Arm64 = "arm64" | ||
25 | |||
26 | |||
27 | class JobOs(Enum): | ||
28 | WindowsLatest = "windows-latest" | ||
29 | UbuntuLatest = "ubuntu-latest" | ||
30 | MacosLatest = "macos-latest" | ||
31 | Ubuntu22_04 = "ubuntu-22.04" | ||
32 | Ubuntu24_04 = "ubuntu-24.04" | ||
33 | Ubuntu24_04_arm = "ubuntu-24.04-arm" | ||
34 | Macos13 = "macos-13" | ||
35 | |||
36 | |||
37 | class SdlPlatform(Enum): | ||
38 | Android = "android" | ||
39 | Emscripten = "emscripten" | ||
40 | Haiku = "haiku" | ||
41 | LoongArch64 = "loongarch64" | ||
42 | Msys2 = "msys2" | ||
43 | Linux = "linux" | ||
44 | MacOS = "macos" | ||
45 | Ios = "ios" | ||
46 | Tvos = "tvos" | ||
47 | Msvc = "msvc" | ||
48 | N3ds = "n3ds" | ||
49 | PowerPC = "powerpc" | ||
50 | PowerPC64 = "powerpc64" | ||
51 | Ps2 = "ps2" | ||
52 | Psp = "psp" | ||
53 | Vita = "vita" | ||
54 | Riscos = "riscos" | ||
55 | FreeBSD = "freebsd" | ||
56 | NetBSD = "netbsd" | ||
57 | |||
58 | |||
59 | class Msys2Platform(Enum): | ||
60 | Mingw32 = "mingw32" | ||
61 | Mingw64 = "mingw64" | ||
62 | Clang64 = "clang64" | ||
63 | Ucrt64 = "ucrt64" | ||
64 | |||
65 | |||
66 | class IntelCompiler(Enum): | ||
67 | Icc = "icc" | ||
68 | Icx = "icx" | ||
69 | |||
70 | |||
71 | class VitaGLES(Enum): | ||
72 | Pib = "pib" | ||
73 | Pvr = "pvr" | ||
74 | |||
75 | |||
76 | @dataclasses.dataclass(slots=True) | ||
77 | class JobSpec: | ||
78 | name: str | ||
79 | os: JobOs | ||
80 | platform: SdlPlatform | ||
81 | artifact: Optional[str] | ||
82 | container: Optional[str] = None | ||
83 | no_cmake: bool = False | ||
84 | xcode: bool = False | ||
85 | android_mk: bool = False | ||
86 | android_gradle: bool = False | ||
87 | lean: bool = False | ||
88 | android_arch: Optional[str] = None | ||
89 | android_abi: Optional[str] = None | ||
90 | android_platform: Optional[int] = None | ||
91 | msys2_platform: Optional[Msys2Platform] = None | ||
92 | intel: Optional[IntelCompiler] = None | ||
93 | apple_framework: Optional[bool] = None | ||
94 | apple_archs: Optional[set[AppleArch]] = None | ||
95 | msvc_project: Optional[str] = None | ||
96 | msvc_arch: Optional[MsvcArch] = None | ||
97 | clang_cl: bool = False | ||
98 | gdk: bool = False | ||
99 | vita_gles: Optional[VitaGLES] = None | ||
100 | |||
101 | |||
102 | JOB_SPECS = { | ||
103 | "msys2-mingw32": JobSpec(name="Windows (msys2, mingw32)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw32", msys2_platform=Msys2Platform.Mingw32, ), | ||
104 | "msys2-mingw64": JobSpec(name="Windows (msys2, mingw64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64", msys2_platform=Msys2Platform.Mingw64, ), | ||
105 | "msys2-clang64": JobSpec(name="Windows (msys2, clang64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64-clang", msys2_platform=Msys2Platform.Clang64, ), | ||
106 | "msys2-ucrt64": JobSpec(name="Windows (msys2, ucrt64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64-ucrt", msys2_platform=Msys2Platform.Ucrt64, ), | ||
107 | "msvc-x64": JobSpec(name="Windows (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x64", msvc_arch=MsvcArch.X64, msvc_project="VisualC/SDL.sln", ), | ||
108 | "msvc-x86": JobSpec(name="Windows (MSVC, x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x86", msvc_arch=MsvcArch.X86, msvc_project="VisualC/SDL.sln", ), | ||
109 | "msvc-clang-x64": JobSpec(name="Windows (MSVC, clang-cl x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x64", msvc_arch=MsvcArch.X64, clang_cl=True, ), | ||
110 | "msvc-clang-x86": JobSpec(name="Windows (MSVC, clang-cl x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x86", msvc_arch=MsvcArch.X86, clang_cl=True, ), | ||
111 | "msvc-arm32": JobSpec(name="Windows (MSVC, ARM)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm32", msvc_arch=MsvcArch.Arm32, ), | ||
112 | "msvc-arm64": JobSpec(name="Windows (MSVC, ARM64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm64", msvc_arch=MsvcArch.Arm64, ), | ||
113 | "msvc-gdk-x64": JobSpec(name="GDK (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-GDK", msvc_arch=MsvcArch.X64, msvc_project="VisualC-GDK/SDL.sln", gdk=True, no_cmake=True, ), | ||
114 | "ubuntu-22.04": JobSpec(name="Ubuntu 22.04", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04", ), | ||
115 | "ubuntu-24.04-arm64": JobSpec(name="Ubuntu 24.04 (ARM64)", os=JobOs.Ubuntu24_04_arm, platform=SdlPlatform.Linux, artifact="SDL-ubuntu24.04-arm64", ), | ||
116 | "steamrt-sniper": JobSpec(name="Steam Linux Runtime (Sniper)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Linux, artifact="SDL-slrsniper", container="registry.gitlab.steamos.cloud/steamrt/sniper/sdk:beta", ), | ||
117 | "ubuntu-intel-icx": JobSpec(name="Ubuntu 22.04 (Intel oneAPI)", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04-oneapi", intel=IntelCompiler.Icx, ), | ||
118 | "ubuntu-intel-icc": JobSpec(name="Ubuntu 22.04 (Intel Compiler)", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04-icc", intel=IntelCompiler.Icc, ), | ||
119 | "macos-framework-x64": JobSpec(name="MacOS (Framework) (x64)", os=JobOs.Macos13, platform=SdlPlatform.MacOS, artifact="SDL-macos-framework", apple_framework=True, apple_archs={AppleArch.Aarch64, AppleArch.X86_64, }, xcode=True, ), | ||
120 | "macos-framework-arm64": JobSpec(name="MacOS (Framework) (arm64)", os=JobOs.MacosLatest, platform=SdlPlatform.MacOS, artifact=None, apple_framework=True, apple_archs={AppleArch.Aarch64, AppleArch.X86_64, }, ), | ||
121 | "macos-gnu-arm64": JobSpec(name="MacOS (GNU prefix)", os=JobOs.MacosLatest, platform=SdlPlatform.MacOS, artifact="SDL-macos-arm64-gnu", apple_framework=False, apple_archs={AppleArch.Aarch64, }, ), | ||
122 | "ios": JobSpec(name="iOS (CMake & xcode)", os=JobOs.MacosLatest, platform=SdlPlatform.Ios, artifact="SDL-ios-arm64", xcode=True, ), | ||
123 | "tvos": JobSpec(name="tvOS (CMake & xcode)", os=JobOs.MacosLatest, platform=SdlPlatform.Tvos, artifact="SDL-tvos-arm64", xcode=True, ), | ||
124 | "android-cmake": JobSpec(name="Android (CMake)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact="SDL-android-arm64", android_abi="arm64-v8a", android_arch="aarch64", android_platform=23, ), | ||
125 | "android-cmake-lean": JobSpec(name="Android (CMake, lean)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact="SDL-lean-android-arm64", android_abi="arm64-v8a", android_arch="aarch64", android_platform=23, lean=True, ), | ||
126 | "android-mk": JobSpec(name="Android (Android.mk)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact=None, no_cmake=True, android_mk=True, ), | ||
127 | "android-gradle": JobSpec(name="Android (Gradle)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact=None, no_cmake=True, android_gradle=True, ), | ||
128 | "emscripten": JobSpec(name="Emscripten", os=JobOs.UbuntuLatest, platform=SdlPlatform.Emscripten, artifact="SDL-emscripten", ), | ||
129 | "haiku": JobSpec(name="Haiku", os=JobOs.UbuntuLatest, platform=SdlPlatform.Haiku, artifact="SDL-haiku-x64", container="ghcr.io/haiku/cross-compiler:x86_64-r1beta5", ), | ||
130 | "loongarch64": JobSpec(name="LoongArch64", os=JobOs.UbuntuLatest, platform=SdlPlatform.LoongArch64, artifact="SDL-loongarch64", ), | ||
131 | "n3ds": JobSpec(name="Nintendo 3DS", os=JobOs.UbuntuLatest, platform=SdlPlatform.N3ds, artifact="SDL-n3ds", container="devkitpro/devkitarm:latest", ), | ||
132 | "ppc": JobSpec(name="PowerPC", os=JobOs.UbuntuLatest, platform=SdlPlatform.PowerPC, artifact="SDL-ppc", container="dockcross/linux-ppc:latest", ), | ||
133 | "ppc64": JobSpec(name="PowerPC64", os=JobOs.UbuntuLatest, platform=SdlPlatform.PowerPC64, artifact="SDL-ppc64le", container="dockcross/linux-ppc64le:latest", ), | ||
134 | "ps2": JobSpec(name="Sony PlayStation 2", os=JobOs.UbuntuLatest, platform=SdlPlatform.Ps2, artifact="SDL-ps2", container="ps2dev/ps2dev:latest", ), | ||
135 | "psp": JobSpec(name="Sony PlayStation Portable", os=JobOs.UbuntuLatest, platform=SdlPlatform.Psp, artifact="SDL-psp", container="pspdev/pspdev:latest", ), | ||
136 | "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, ), | ||
137 | "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, ), | ||
138 | "riscos": JobSpec(name="RISC OS", os=JobOs.UbuntuLatest, platform=SdlPlatform.Riscos, artifact="SDL-riscos", container="riscosdotinfo/riscos-gccsdk-4.7:latest", ), | ||
139 | "netbsd": JobSpec(name="NetBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.NetBSD, artifact="SDL-netbsd-x64", ), | ||
140 | "freebsd": JobSpec(name="FreeBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.FreeBSD, artifact="SDL-freebsd-x64", ), | ||
141 | } | ||
142 | |||
143 | |||
144 | class StaticLibType(Enum): | ||
145 | MSVC = "SDL3-static.lib" | ||
146 | A = "libSDL3.a" | ||
147 | |||
148 | |||
149 | class SharedLibType(Enum): | ||
150 | WIN32 = "SDL3.dll" | ||
151 | SO_0 = "libSDL3.so.0" | ||
152 | SO = "libSDL3.so" | ||
153 | DYLIB = "libSDL3.0.dylib" | ||
154 | FRAMEWORK = "SDL3.framework/Versions/A/SDL3" | ||
155 | |||
156 | |||
157 | @dataclasses.dataclass(slots=True) | ||
158 | class JobDetails: | ||
159 | name: str | ||
160 | key: str | ||
161 | os: str | ||
162 | platform: str | ||
163 | artifact: str | ||
164 | no_cmake: bool | ||
165 | ccache: bool = False | ||
166 | build_tests: bool = True | ||
167 | container: str = "" | ||
168 | cmake_build_type: str = "RelWithDebInfo" | ||
169 | shell: str = "sh" | ||
170 | sudo: str = "sudo" | ||
171 | cmake_config_emulator: str = "" | ||
172 | apk_packages: list[str] = dataclasses.field(default_factory=list) | ||
173 | apt_packages: list[str] = dataclasses.field(default_factory=list) | ||
174 | brew_packages: list[str] = dataclasses.field(default_factory=list) | ||
175 | cmake_toolchain_file: str = "" | ||
176 | cmake_arguments: list[str] = dataclasses.field(default_factory=list) | ||
177 | cmake_generator: str = "Ninja" | ||
178 | cmake_build_arguments: list[str] = dataclasses.field(default_factory=list) | ||
179 | clang_tidy: bool = True | ||
180 | cppflags: list[str] = dataclasses.field(default_factory=list) | ||
181 | cc: str = "" | ||
182 | cxx: str = "" | ||
183 | cflags: list[str] = dataclasses.field(default_factory=list) | ||
184 | cxxflags: list[str] = dataclasses.field(default_factory=list) | ||
185 | ldflags: list[str] = dataclasses.field(default_factory=list) | ||
186 | pollute_directories: list[str] = dataclasses.field(default_factory=list) | ||
187 | use_cmake: bool = True | ||
188 | shared: bool = True | ||
189 | static: bool = True | ||
190 | shared_lib: Optional[SharedLibType] = None | ||
191 | static_lib: Optional[StaticLibType] = None | ||
192 | run_tests: bool = True | ||
193 | test_pkg_config: bool = True | ||
194 | cc_from_cmake: bool = False | ||
195 | source_cmd: str = "" | ||
196 | pretest_cmd: str = "" | ||
197 | java: bool = False | ||
198 | android_apks: list[str] = dataclasses.field(default_factory=list) | ||
199 | android_ndk: bool = False | ||
200 | android_mk: bool = False | ||
201 | android_gradle: bool = False | ||
202 | minidump: bool = False | ||
203 | intel: bool = False | ||
204 | msys2_msystem: str = "" | ||
205 | msys2_env: str = "" | ||
206 | msys2_no_perl: bool = False | ||
207 | werror: bool = True | ||
208 | msvc_vcvars_arch: str = "" | ||
209 | msvc_vcvars_sdk: str = "" | ||
210 | msvc_project: str = "" | ||
211 | msvc_project_flags: list[str] = dataclasses.field(default_factory=list) | ||
212 | setup_ninja: bool = False | ||
213 | setup_libusb_arch: str = "" | ||
214 | xcode_sdk: str = "" | ||
215 | cpactions: bool = False | ||
216 | setup_gdk_folder: str = "" | ||
217 | cpactions_os: str = "" | ||
218 | cpactions_version: str = "" | ||
219 | cpactions_arch: str = "" | ||
220 | cpactions_setup_cmd: str = "" | ||
221 | cpactions_install_cmd: str = "" | ||
222 | setup_vita_gles_type: str = "" | ||
223 | check_sources: bool = False | ||
224 | setup_python: bool = False | ||
225 | pypi_packages: list[str] = dataclasses.field(default_factory=list) | ||
226 | binutils_strings: str = "strings" | ||
227 | |||
228 | def to_workflow(self, enable_artifacts: bool) -> dict[str, str|bool]: | ||
229 | data = { | ||
230 | "name": self.name, | ||
231 | "key": self.key, | ||
232 | "os": self.os, | ||
233 | "ccache": self.ccache, | ||
234 | "container": self.container if self.container else "", | ||
235 | "platform": self.platform, | ||
236 | "artifact": self.artifact, | ||
237 | "enable-artifacts": enable_artifacts, | ||
238 | "shell": self.shell, | ||
239 | "msys2-msystem": self.msys2_msystem, | ||
240 | "msys2-env": self.msys2_env, | ||
241 | "msys2-no-perl": self.msys2_no_perl, | ||
242 | "android-ndk": self.android_ndk, | ||
243 | "java": self.java, | ||
244 | "intel": self.intel, | ||
245 | "apk-packages": my_shlex_join(self.apk_packages), | ||
246 | "apt-packages": my_shlex_join(self.apt_packages), | ||
247 | "test-pkg-config": self.test_pkg_config, | ||
248 | "brew-packages": my_shlex_join(self.brew_packages), | ||
249 | "pollute-directories": my_shlex_join(self.pollute_directories), | ||
250 | "no-cmake": self.no_cmake, | ||
251 | "build-tests": self.build_tests, | ||
252 | "source-cmd": self.source_cmd, | ||
253 | "pretest-cmd": self.pretest_cmd, | ||
254 | "cmake-config-emulator": self.cmake_config_emulator, | ||
255 | "cc": self.cc, | ||
256 | "cxx": self.cxx, | ||
257 | "cflags": my_shlex_join(self.cppflags + self.cflags), | ||
258 | "cxxflags": my_shlex_join(self.cppflags + self.cxxflags), | ||
259 | "ldflags": my_shlex_join(self.ldflags), | ||
260 | "cmake-generator": self.cmake_generator, | ||
261 | "cmake-toolchain-file": self.cmake_toolchain_file, | ||
262 | "clang-tidy": self.clang_tidy, | ||
263 | "cmake-arguments": my_shlex_join(self.cmake_arguments), | ||
264 | "cmake-build-arguments": my_shlex_join(self.cmake_build_arguments), | ||
265 | "shared": self.shared, | ||
266 | "static": self.static, | ||
267 | "shared-lib": self.shared_lib.value if self.shared_lib else None, | ||
268 | "static-lib": self.static_lib.value if self.static_lib else None, | ||
269 | "cmake-build-type": self.cmake_build_type, | ||
270 | "run-tests": self.run_tests, | ||
271 | "android-apks": my_shlex_join(self.android_apks), | ||
272 | "android-gradle": self.android_gradle, | ||
273 | "android-mk": self.android_mk, | ||
274 | "werror": self.werror, | ||
275 | "sudo": self.sudo, | ||
276 | "msvc-vcvars-arch": self.msvc_vcvars_arch, | ||
277 | "msvc-vcvars-sdk": self.msvc_vcvars_sdk, | ||
278 | "msvc-project": self.msvc_project, | ||
279 | "msvc-project-flags": my_shlex_join(self.msvc_project_flags), | ||
280 | "setup-ninja": self.setup_ninja, | ||
281 | "setup-libusb-arch": self.setup_libusb_arch, | ||
282 | "cc-from-cmake": self.cc_from_cmake, | ||
283 | "xcode-sdk": self.xcode_sdk, | ||
284 | "cpactions": self.cpactions, | ||
285 | "cpactions-os": self.cpactions_os, | ||
286 | "cpactions-version": self.cpactions_version, | ||
287 | "cpactions-arch": self.cpactions_arch, | ||
288 | "cpactions-setup-cmd": self.cpactions_setup_cmd, | ||
289 | "cpactions-install-cmd": self.cpactions_install_cmd, | ||
290 | "setup-vita-gles-type": self.setup_vita_gles_type, | ||
291 | "setup-gdk-folder": self.setup_gdk_folder, | ||
292 | "check-sources": self.check_sources, | ||
293 | "setup-python": self.setup_python, | ||
294 | "pypi-packages": my_shlex_join(self.pypi_packages), | ||
295 | "binutils-strings": self.binutils_strings, | ||
296 | } | ||
297 | return {k: v for k, v in data.items() if v != ""} | ||
298 | |||
299 | |||
300 | def my_shlex_join(s): | ||
301 | def escape(s): | ||
302 | if s[:1] == "'" and s[-1:] == "'": | ||
303 | return s | ||
304 | if set(s).intersection(set("; \t")): | ||
305 | return f'"{s}"' | ||
306 | return s | ||
307 | |||
308 | return " ".join(escape(s)) | ||
309 | |||
310 | |||
311 | def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDetails: | ||
312 | job = JobDetails( | ||
313 | name=spec.name, | ||
314 | key=key, | ||
315 | os=spec.os.value, | ||
316 | artifact=spec.artifact or "", | ||
317 | container=spec.container or "", | ||
318 | platform=spec.platform.value, | ||
319 | sudo="sudo", | ||
320 | no_cmake=spec.no_cmake, | ||
321 | ) | ||
322 | if job.os.startswith("ubuntu"): | ||
323 | job.apt_packages.extend([ | ||
324 | "ninja-build", | ||
325 | "pkg-config", | ||
326 | ]) | ||
327 | pretest_cmd = [] | ||
328 | if trackmem_symbol_names: | ||
329 | pretest_cmd.append("export SDL_TRACKMEM_SYMBOL_NAMES=1") | ||
330 | else: | ||
331 | pretest_cmd.append("export SDL_TRACKMEM_SYMBOL_NAMES=0") | ||
332 | win32 = spec.platform in (SdlPlatform.Msys2, SdlPlatform.Msvc) | ||
333 | fpic = None | ||
334 | build_parallel = True | ||
335 | if spec.lean: | ||
336 | job.cppflags.append("-DSDL_LEAN_AND_MEAN=1") | ||
337 | if win32: | ||
338 | job.cmake_arguments.append("-DSDLTEST_PROCDUMP=ON") | ||
339 | job.minidump = True | ||
340 | if spec.intel is not None: | ||
341 | match spec.intel: | ||
342 | case IntelCompiler.Icx: | ||
343 | job.cc = "icx" | ||
344 | job.cxx = "icpx" | ||
345 | case IntelCompiler.Icc: | ||
346 | job.cc = "icc" | ||
347 | job.cxx = "icpc" | ||
348 | # Disable deprecation warning | ||
349 | job.cppflags.append("-diag-disable=10441") | ||
350 | # Avoid 'Catastrophic error: cannot open precompiled header file' | ||
351 | job.cmake_arguments.append("-DCMAKE_DISABLE_PRECOMPILE_HEADERS:BOOL=ON") | ||
352 | job.clang_tidy = False | ||
353 | case _: | ||
354 | raise ValueError(f"Invalid intel={spec.intel}") | ||
355 | job.source_cmd = f"source /opt/intel/oneapi/setvars.sh;" | ||
356 | job.intel = True | ||
357 | job.shell = "bash" | ||
358 | job.cmake_arguments.extend(( | ||
359 | f"-DCMAKE_C_COMPILER={job.cc}", | ||
360 | f"-DCMAKE_CXX_COMPILER={job.cxx}", | ||
361 | "-DCMAKE_SYSTEM_NAME=Linux", | ||
362 | )) | ||
363 | match spec.platform: | ||
364 | case SdlPlatform.Msvc: | ||
365 | job.setup_ninja = not spec.gdk | ||
366 | job.clang_tidy = False # complains about \threadsafety: "unknown command tag name [clang-diagnostic-documentation-unknown-command]" | ||
367 | job.msvc_project = spec.msvc_project if spec.msvc_project else "" | ||
368 | job.msvc_project_flags.append("-p:TreatWarningsAsError=true") | ||
369 | job.test_pkg_config = False | ||
370 | job.shared_lib = SharedLibType.WIN32 | ||
371 | job.static_lib = StaticLibType.MSVC | ||
372 | job.cmake_arguments.extend(( | ||
373 | "-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=ProgramDatabase", | ||
374 | "-DCMAKE_EXE_LINKER_FLAGS=-DEBUG", | ||
375 | "-DCMAKE_SHARED_LINKER_FLAGS=-DEBUG", | ||
376 | )) | ||
377 | |||
378 | job.cmake_arguments.append("'-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>'") | ||
379 | |||
380 | if spec.clang_cl: | ||
381 | job.cmake_arguments.extend(( | ||
382 | "-DCMAKE_C_COMPILER=clang-cl", | ||
383 | "-DCMAKE_CXX_COMPILER=clang-cl", | ||
384 | )) | ||
385 | match spec.msvc_arch: | ||
386 | case MsvcArch.X86: | ||
387 | job.cflags.append("/clang:-m32") | ||
388 | job.ldflags.append("/MACHINE:X86") | ||
389 | case MsvcArch.X64: | ||
390 | job.cflags.append("/clang:-m64") | ||
391 | job.ldflags.append("/MACHINE:X64") | ||
392 | case _: | ||
393 | raise ValueError(f"Unsupported clang-cl architecture (arch={spec.msvc_arch})") | ||
394 | if spec.msvc_project: | ||
395 | match spec.msvc_arch: | ||
396 | case MsvcArch.X86: | ||
397 | msvc_platform = "Win32" | ||
398 | case MsvcArch.X64: | ||
399 | msvc_platform = "x64" | ||
400 | case _: | ||
401 | raise ValueError(f"Unsupported vcxproj architecture (arch={spec.msvc_arch})") | ||
402 | if spec.gdk: | ||
403 | msvc_platform = f"Gaming.Desktop.{msvc_platform}" | ||
404 | job.msvc_project_flags.append(f"-p:Platform={msvc_platform}") | ||
405 | match spec.msvc_arch: | ||
406 | case MsvcArch.X86: | ||
407 | job.msvc_vcvars_arch = "x64_x86" | ||
408 | case MsvcArch.X64: | ||
409 | job.msvc_vcvars_arch = "x64" | ||
410 | case MsvcArch.Arm32: | ||
411 | job.msvc_vcvars_arch = "x64_arm" | ||
412 | job.msvc_vcvars_sdk = "10.0.22621.0" # 10.0.26100.0 dropped ARM32 um and ucrt libraries | ||
413 | job.run_tests = False | ||
414 | case MsvcArch.Arm64: | ||
415 | job.msvc_vcvars_arch = "x64_arm64" | ||
416 | job.run_tests = False | ||
417 | if spec.gdk: | ||
418 | job.setup_gdk_folder = "VisualC-GDK" | ||
419 | else: | ||
420 | match spec.msvc_arch: | ||
421 | case MsvcArch.X86: | ||
422 | job.setup_libusb_arch = "x86" | ||
423 | case MsvcArch.X64: | ||
424 | job.setup_libusb_arch = "x64" | ||
425 | case SdlPlatform.Linux: | ||
426 | if spec.name.startswith("Ubuntu"): | ||
427 | assert spec.os.value.startswith("ubuntu-") | ||
428 | job.apt_packages.extend(( | ||
429 | "ccache", | ||
430 | "gnome-desktop-testing", | ||
431 | "libasound2-dev", | ||
432 | "libpulse-dev", | ||
433 | "libaudio-dev", | ||
434 | "libjack-dev", | ||
435 | "libsndio-dev", | ||
436 | "libusb-1.0-0-dev", | ||
437 | "libx11-dev", | ||
438 | "libxext-dev", | ||
439 | "libxrandr-dev", | ||
440 | "libxcursor-dev", | ||
441 | "libxfixes-dev", | ||
442 | "libxi-dev", | ||
443 | "libxss-dev", | ||
444 | "libwayland-dev", | ||
445 | "libxkbcommon-dev", | ||
446 | "libdrm-dev", | ||
447 | "libgbm-dev", | ||
448 | "libgl1-mesa-dev", | ||
449 | "libgles2-mesa-dev", | ||
450 | "libegl1-mesa-dev", | ||
451 | "libdbus-1-dev", | ||
452 | "libibus-1.0-dev", | ||
453 | "libudev-dev", | ||
454 | "fcitx-libs-dev", | ||
455 | )) | ||
456 | match = re.match(r"ubuntu-(?P<year>[0-9]+)\.(?P<month>[0-9]+).*", spec.os.value) | ||
457 | ubuntu_year, ubuntu_month = [int(match["year"]), int(match["month"])] | ||
458 | if ubuntu_year >= 22: | ||
459 | job.apt_packages.extend(("libpipewire-0.3-dev", "libdecor-0-dev")) | ||
460 | job.apt_packages.extend(( | ||
461 | "libunwind-dev", # For SDL_test memory tracking | ||
462 | )) | ||
463 | job.ccache = True | ||
464 | if trackmem_symbol_names: | ||
465 | # older libunwind is slow | ||
466 | job.cmake_arguments.append("-DSDLTEST_TIMEOUT_MULTIPLIER=2") | ||
467 | job.shared_lib = SharedLibType.SO_0 | ||
468 | job.static_lib = StaticLibType.A | ||
469 | fpic = True | ||
470 | case SdlPlatform.Ios | SdlPlatform.Tvos: | ||
471 | job.brew_packages.extend([ | ||
472 | "ccache", | ||
473 | "ninja", | ||
474 | ]) | ||
475 | job.ccache = True | ||
476 | job.clang_tidy = False | ||
477 | job.run_tests = False | ||
478 | job.test_pkg_config = False | ||
479 | job.shared_lib = SharedLibType.DYLIB | ||
480 | job.static_lib = StaticLibType.A | ||
481 | match spec.platform: | ||
482 | case SdlPlatform.Ios: | ||
483 | if spec.xcode: | ||
484 | job.xcode_sdk = 'iphoneos' | ||
485 | job.cmake_arguments.extend([ | ||
486 | "-DCMAKE_SYSTEM_NAME=iOS", | ||
487 | "-DCMAKE_OSX_ARCHITECTURES=\"arm64\"", | ||
488 | "-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0", | ||
489 | ]) | ||
490 | case SdlPlatform.Tvos: | ||
491 | if spec.xcode: | ||
492 | job.xcode_sdk = 'appletvos' | ||
493 | job.cmake_arguments.extend([ | ||
494 | "-DCMAKE_SYSTEM_NAME=tvOS", | ||
495 | "-DCMAKE_OSX_ARCHITECTURES=\"arm64\"", | ||
496 | "-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0", | ||
497 | ]) | ||
498 | case SdlPlatform.MacOS: | ||
499 | if spec.apple_framework: | ||
500 | job.static = False | ||
501 | job.clang_tidy = False | ||
502 | job.test_pkg_config = False | ||
503 | job.cmake_arguments.extend(( | ||
504 | "'-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64'", | ||
505 | "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13", | ||
506 | "-DSDL_FRAMEWORK=ON", | ||
507 | )) | ||
508 | job.shared_lib = SharedLibType.FRAMEWORK | ||
509 | else: | ||
510 | job.clang_tidy = True | ||
511 | job.cmake_arguments.extend(( | ||
512 | "-DCMAKE_OSX_ARCHITECTURES=arm64", | ||
513 | "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13", | ||
514 | "-DCLANG_TIDY_BINARY=$(brew --prefix llvm)/bin/clang-tidy", | ||
515 | )) | ||
516 | job.shared_lib = SharedLibType.DYLIB | ||
517 | job.static_lib = StaticLibType.A | ||
518 | job.ccache = True | ||
519 | job.apt_packages = [] | ||
520 | job.brew_packages.extend(( | ||
521 | "ccache", | ||
522 | "ninja", | ||
523 | )) | ||
524 | if job.clang_tidy: | ||
525 | job.brew_packages.append("llvm") | ||
526 | if spec.xcode: | ||
527 | job.xcode_sdk = "macosx" | ||
528 | case SdlPlatform.Android: | ||
529 | job.android_gradle = spec.android_gradle | ||
530 | job.android_mk = spec.android_mk | ||
531 | job.apt_packages.append("ccache") | ||
532 | job.run_tests = False | ||
533 | job.shared_lib = SharedLibType.SO | ||
534 | job.static_lib = StaticLibType.A | ||
535 | if spec.android_mk or not spec.no_cmake: | ||
536 | job.android_ndk = True | ||
537 | if spec.android_gradle or not spec.no_cmake: | ||
538 | job.java = True | ||
539 | if spec.android_mk or spec.android_gradle: | ||
540 | job.apt_packages = [] | ||
541 | if not spec.no_cmake: | ||
542 | job.ccache = True | ||
543 | job.cmake_arguments.extend(( | ||
544 | f"-DANDROID_PLATFORM={spec.android_platform}", | ||
545 | f"-DANDROID_ABI={spec.android_abi}", | ||
546 | )) | ||
547 | job.cmake_toolchain_file = "${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake" | ||
548 | job.cc = f"${{ANDROID_NDK_HOME}}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target={spec.android_arch}-none-linux-androideabi{spec.android_platform}" | ||
549 | |||
550 | job.android_apks = [ | ||
551 | "testaudiorecording-apk", | ||
552 | "testautomation-apk", | ||
553 | "testcontroller-apk", | ||
554 | "testmultiaudio-apk", | ||
555 | "testsprite-apk", | ||
556 | ] | ||
557 | case SdlPlatform.Emscripten: | ||
558 | job.clang_tidy = False # clang-tidy does not understand -gsource-map | ||
559 | job.shared = False | ||
560 | job.ccache = True | ||
561 | job.apt_packages.append("ccache") | ||
562 | job.cmake_config_emulator = "emcmake" | ||
563 | job.cmake_build_type = "Debug" | ||
564 | job.test_pkg_config = False | ||
565 | job.cmake_arguments.extend(( | ||
566 | "-DSDLTEST_BROWSER=chrome", | ||
567 | "-DSDLTEST_TIMEOUT_MULTIPLIER=4", | ||
568 | "-DSDLTEST_CHROME_BINARY=${CHROME_BINARY}", | ||
569 | )) | ||
570 | job.cflags.extend(( | ||
571 | "-gsource-map", | ||
572 | "-ffile-prefix-map=${PWD}=/SDL", | ||
573 | )) | ||
574 | job.ldflags.extend(( | ||
575 | "--source-map-base", "/", | ||
576 | )) | ||
577 | pretest_cmd.extend(( | ||
578 | "# Start local HTTP server", | ||
579 | "cmake --build build --target serve-sdl-tests --verbose &", | ||
580 | "chrome --version", | ||
581 | "chromedriver --version", | ||
582 | )) | ||
583 | job.static_lib = StaticLibType.A | ||
584 | job.setup_python = True | ||
585 | job.pypi_packages.append("selenium") | ||
586 | case SdlPlatform.Ps2: | ||
587 | job.ccache = False # actions/ccache does not work in psp container (incompatible tar of busybox) | ||
588 | build_parallel = False | ||
589 | job.shared = False | ||
590 | job.sudo = "" | ||
591 | job.apt_packages = [] | ||
592 | job.apk_packages = ["ccache", "cmake", "gmp", "mpc1", "mpfr4", "ninja", "pkgconf", "git", ] | ||
593 | job.cmake_toolchain_file = "${PS2DEV}/ps2sdk/ps2dev.cmake" | ||
594 | job.clang_tidy = False | ||
595 | job.run_tests = False | ||
596 | job.shared = False | ||
597 | job.cc = "mips64r5900el-ps2-elf-gcc" | ||
598 | job.ldflags = ["-L${PS2DEV}/ps2sdk/ee/lib", "-L${PS2DEV}/gsKit/lib", "-L${PS2DEV}/ps2sdk/ports/lib", ] | ||
599 | job.static_lib = StaticLibType.A | ||
600 | case SdlPlatform.Psp: | ||
601 | job.ccache = False # actions/ccache does not work in psp container (incompatible tar of busybox) | ||
602 | build_parallel = False | ||
603 | job.sudo = "" | ||
604 | job.apt_packages = [] | ||
605 | job.apk_packages = ["ccache", "cmake", "gmp", "mpc1", "mpfr4", "ninja", "pkgconf", ] | ||
606 | job.cmake_toolchain_file = "${PSPDEV}/psp/share/pspdev.cmake" | ||
607 | job.clang_tidy = False | ||
608 | job.run_tests = False | ||
609 | job.shared = False | ||
610 | job.cc = "psp-gcc" | ||
611 | job.ldflags = ["-L${PSPDEV}/lib", "-L${PSPDEV}/psp/lib", "-L${PSPDEV}/psp/sdk/lib", ] | ||
612 | job.pollute_directories = ["${PSPDEV}/include", "${PSPDEV}/psp/include", "${PSPDEV}/psp/sdk/include", ] | ||
613 | job.static_lib = StaticLibType.A | ||
614 | case SdlPlatform.Vita: | ||
615 | job.ccache = True | ||
616 | job.sudo = "" | ||
617 | job.apt_packages = [] | ||
618 | job.apk_packages = ["ccache", "cmake", "ninja", "pkgconf", "bash", "tar"] | ||
619 | job.cmake_toolchain_file = "${VITASDK}/share/vita.toolchain.cmake" | ||
620 | assert spec.vita_gles is not None | ||
621 | job.setup_vita_gles_type = { | ||
622 | VitaGLES.Pib: "pib", | ||
623 | VitaGLES.Pvr: "pvr", | ||
624 | }[spec.vita_gles] | ||
625 | job.cmake_arguments.extend(( | ||
626 | f"-DVIDEO_VITA_PIB={ 'true' if spec.vita_gles == VitaGLES.Pib else 'false' }", | ||
627 | f"-DVIDEO_VITA_PVR={ 'true' if spec.vita_gles == VitaGLES.Pvr else 'false' }", | ||
628 | "-DSDL_ARMNEON=ON", | ||
629 | "-DSDL_ARMSIMD=ON", | ||
630 | )) | ||
631 | # Fix vita.toolchain.cmake (https://github.com/vitasdk/vita-toolchain/pull/253) | ||
632 | job.source_cmd = r"""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""" | ||
633 | job.clang_tidy = False | ||
634 | job.run_tests = False | ||
635 | job.shared = False | ||
636 | job.cc = "arm-vita-eabi-gcc" | ||
637 | job.static_lib = StaticLibType.A | ||
638 | case SdlPlatform.Haiku: | ||
639 | job.ccache = True | ||
640 | fpic = False | ||
641 | job.run_tests = False | ||
642 | job.apt_packages.append("ccache") | ||
643 | job.cc = "x86_64-unknown-haiku-gcc" | ||
644 | job.cxx = "x86_64-unknown-haiku-g++" | ||
645 | job.sudo = "" | ||
646 | job.cmake_arguments.extend(( | ||
647 | f"-DCMAKE_C_COMPILER={job.cc}", | ||
648 | f"-DCMAKE_CXX_COMPILER={job.cxx}", | ||
649 | "-DSDL_UNIX_CONSOLE_BUILD=ON", | ||
650 | )) | ||
651 | job.shared_lib = SharedLibType.SO_0 | ||
652 | job.static_lib = StaticLibType.A | ||
653 | case SdlPlatform.PowerPC64 | SdlPlatform.PowerPC: | ||
654 | job.ccache = True | ||
655 | # FIXME: Enable SDL_WERROR | ||
656 | job.werror = False | ||
657 | job.clang_tidy = False | ||
658 | job.run_tests = False | ||
659 | job.sudo = "" | ||
660 | job.apt_packages = ["ccache"] | ||
661 | job.shared_lib = SharedLibType.SO_0 | ||
662 | job.static_lib = StaticLibType.A | ||
663 | job.cmake_arguments.extend(( | ||
664 | "-DSDL_UNIX_CONSOLE_BUILD=ON", | ||
665 | )) | ||
666 | case SdlPlatform.LoongArch64: | ||
667 | job.ccache = True | ||
668 | fpic = True | ||
669 | job.run_tests = False | ||
670 | job.apt_packages.append("ccache") | ||
671 | job.cc = "${LOONGARCH64_CC}" | ||
672 | job.cxx = "${LOONGARCH64_CXX}" | ||
673 | job.cmake_arguments.extend(( | ||
674 | f"-DCMAKE_C_COMPILER={job.cc}", | ||
675 | f"-DCMAKE_CXX_COMPILER={job.cxx}", | ||
676 | "-DSDL_UNIX_CONSOLE_BUILD=ON", | ||
677 | "-DCMAKE_SYSTEM_NAME=Linux", | ||
678 | )) | ||
679 | job.shared_lib = SharedLibType.SO_0 | ||
680 | job.static_lib = StaticLibType.A | ||
681 | case SdlPlatform.N3ds: | ||
682 | job.cmake_generator = "Unix Makefiles" | ||
683 | job.cmake_build_arguments.append("-j$(nproc)") | ||
684 | job.ccache = False | ||
685 | job.shared = False | ||
686 | job.apt_packages = [] | ||
687 | job.clang_tidy = False | ||
688 | job.run_tests = False | ||
689 | job.cc_from_cmake = True | ||
690 | job.cmake_toolchain_file = "${DEVKITPRO}/cmake/3DS.cmake" | ||
691 | job.binutils_strings = "/opt/devkitpro/devkitARM/bin/arm-none-eabi-strings" | ||
692 | job.static_lib = StaticLibType.A | ||
693 | case SdlPlatform.Msys2: | ||
694 | job.ccache = True | ||
695 | job.shell = "msys2 {0}" | ||
696 | assert spec.msys2_platform | ||
697 | job.msys2_msystem = spec.msys2_platform.value | ||
698 | job.msys2_env = { | ||
699 | "mingw32": "mingw-w64-i686", | ||
700 | "mingw64": "mingw-w64-x86_64", | ||
701 | "clang64": "mingw-w64-clang-x86_64", | ||
702 | "ucrt64": "mingw-w64-ucrt-x86_64", | ||
703 | }[spec.msys2_platform.value] | ||
704 | job.msys2_no_perl = spec.msys2_platform in (Msys2Platform.Mingw32, ) | ||
705 | job.shared_lib = SharedLibType.WIN32 | ||
706 | job.static_lib = StaticLibType.A | ||
707 | case SdlPlatform.Riscos: | ||
708 | job.ccache = False # FIXME: enable when container gets upgrade | ||
709 | # FIXME: Enable SDL_WERROR | ||
710 | job.werror = False | ||
711 | job.apt_packages = ["ccache", "cmake", "ninja-build"] | ||
712 | job.test_pkg_config = False | ||
713 | job.shared = False | ||
714 | job.run_tests = False | ||
715 | job.sudo = "" | ||
716 | job.cmake_arguments.extend(( | ||
717 | "-DRISCOS:BOOL=ON", | ||
718 | "-DCMAKE_DISABLE_PRECOMPILE_HEADERS:BOOL=ON", | ||
719 | "-DSDL_GCC_ATOMICS:BOOL=OFF", | ||
720 | )) | ||
721 | job.cmake_toolchain_file = "/home/riscos/env/toolchain-riscos.cmake" | ||
722 | job.static_lib = StaticLibType.A | ||
723 | case SdlPlatform.FreeBSD | SdlPlatform.NetBSD: | ||
724 | job.cpactions = True | ||
725 | job.no_cmake = True | ||
726 | job.run_tests = False | ||
727 | job.apt_packages = [] | ||
728 | job.shared_lib = SharedLibType.SO_0 | ||
729 | job.static_lib = StaticLibType.A | ||
730 | match spec.platform: | ||
731 | case SdlPlatform.FreeBSD: | ||
732 | job.cpactions_os = "freebsd" | ||
733 | job.cpactions_version = "14.2" | ||
734 | job.cpactions_arch = "x86-64" | ||
735 | job.cpactions_setup_cmd = "sudo pkg update" | ||
736 | job.cpactions_install_cmd = "sudo pkg install -y cmake ninja pkgconf libXcursor libXext libXinerama libXi libXfixes libXrandr libXScrnSaver libXxf86vm wayland wayland-protocols libxkbcommon mesa-libs libglvnd evdev-proto libinotify alsa-lib jackit pipewire pulseaudio sndio dbus zh-fcitx ibus libudev-devd" | ||
737 | job.cmake_arguments.extend(( | ||
738 | "-DSDL_CHECK_REQUIRED_INCLUDES=/usr/local/include", | ||
739 | "-DSDL_CHECK_REQUIRED_LINK_OPTIONS=-L/usr/local/lib", | ||
740 | )) | ||
741 | case SdlPlatform.NetBSD: | ||
742 | job.cpactions_os = "netbsd" | ||
743 | job.cpactions_version = "10.1" | ||
744 | job.cpactions_arch = "x86-64" | ||
745 | job.cpactions_setup_cmd = "export PATH=\"/usr/pkg/sbin:/usr/pkg/bin:/sbin:$PATH\"; export PKG_CONFIG_PATH=\"/usr/pkg/lib/pkgconfig\";export PKG_PATH=\"https://cdn.netBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r|cut -f \"1 2\" -d.)/All/\";echo \"PKG_PATH=$PKG_PATH\";echo \"uname -a -> \"$(uname -a)\"\";sudo -E sysctl -w security.pax.aslr.enabled=0;sudo -E sysctl -w security.pax.aslr.global=0;sudo -E pkgin clean;sudo -E pkgin update" | ||
746 | job.cpactions_install_cmd = "sudo -E pkgin -y install cmake dbus pkgconf ninja-build pulseaudio libxkbcommon wayland wayland-protocols libinotify libusb1" | ||
747 | case _: | ||
748 | raise ValueError(f"Unsupported platform={spec.platform}") | ||
749 | |||
750 | if "ubuntu" in spec.name.lower(): | ||
751 | job.check_sources = True | ||
752 | job.setup_python = True | ||
753 | |||
754 | if job.ccache: | ||
755 | job.cmake_arguments.extend(( | ||
756 | "-DCMAKE_C_COMPILER_LAUNCHER=ccache", | ||
757 | "-DCMAKE_CXX_COMPILER_LAUNCHER=ccache", | ||
758 | )) | ||
759 | if not build_parallel: | ||
760 | job.cmake_build_arguments.append("-j1") | ||
761 | if job.cflags or job.cppflags: | ||
762 | job.cmake_arguments.append(f"-DCMAKE_C_FLAGS=\"{my_shlex_join(job.cflags + job.cppflags)}\"") | ||
763 | if job.cxxflags or job.cppflags: | ||
764 | job.cmake_arguments.append(f"-DCMAKE_CXX_FLAGS=\"{my_shlex_join(job.cxxflags + job.cppflags)}\"") | ||
765 | if job.ldflags: | ||
766 | job.cmake_arguments.append(f"-DCMAKE_SHARED_LINKER_FLAGS=\"{my_shlex_join(job.ldflags)}\"") | ||
767 | job.cmake_arguments.append(f"-DCMAKE_EXE_LINKER_FLAGS=\"{my_shlex_join(job.ldflags)}\"") | ||
768 | job.pretest_cmd = "\n".join(pretest_cmd) | ||
769 | def tf(b): | ||
770 | return "ON" if b else "OFF" | ||
771 | |||
772 | if fpic is not None: | ||
773 | job.cmake_arguments.append(f"-DCMAKE_POSITION_INDEPENDENT_CODE={tf(fpic)}") | ||
774 | |||
775 | if job.no_cmake: | ||
776 | job.cmake_arguments = [] | ||
777 | |||
778 | return job | ||
779 | |||
780 | |||
781 | def spec_to_platform(spec: JobSpec, key: str, enable_artifacts: bool, trackmem_symbol_names: bool) -> dict[str, str|bool]: | ||
782 | logger.info("spec=%r", spec) | ||
783 | job = spec_to_job(spec, key=key, trackmem_symbol_names=trackmem_symbol_names) | ||
784 | logger.info("job=%r", job) | ||
785 | platform = job.to_workflow(enable_artifacts=enable_artifacts) | ||
786 | logger.info("platform=%r", platform) | ||
787 | return platform | ||
788 | |||
789 | |||
790 | def main(): | ||
791 | parser = argparse.ArgumentParser(allow_abbrev=False) | ||
792 | parser.add_argument("--github-variable-prefix", default="platforms") | ||
793 | parser.add_argument("--github-ci", action="store_true") | ||
794 | parser.add_argument("--verbose", action="store_true") | ||
795 | parser.add_argument("--commit-message-file") | ||
796 | parser.add_argument("--no-artifact", dest="enable_artifacts", action="store_false") | ||
797 | parser.add_argument("--trackmem-symbol-names", dest="trackmem_symbol_names", action="store_true") | ||
798 | args = parser.parse_args() | ||
799 | |||
800 | logging.basicConfig(level=logging.INFO if args.verbose else logging.WARNING) | ||
801 | |||
802 | remaining_keys = set(JOB_SPECS.keys()) | ||
803 | |||
804 | all_level_keys = ( | ||
805 | # Level 1 | ||
806 | ( | ||
807 | "haiku", | ||
808 | ), | ||
809 | ) | ||
810 | |||
811 | filters = [] | ||
812 | if args.commit_message_file: | ||
813 | with open(args.commit_message_file, "r") as f: | ||
814 | commit_message = f.read() | ||
815 | for m in re.finditer(r"\[sdl-ci-filter (.*)]", commit_message, flags=re.M): | ||
816 | filters.append(m.group(1).strip(" \t\n\r\t'\"")) | ||
817 | |||
818 | if re.search(r"\[sdl-ci-artifacts?]", commit_message, flags=re.M): | ||
819 | args.enable_artifacts = True | ||
820 | |||
821 | if re.search(r"\[sdl-ci-(full-)?trackmem(-symbol-names)?]", commit_message, flags=re.M): | ||
822 | args.trackmem_symbol_names = True | ||
823 | |||
824 | if not filters: | ||
825 | filters.append("*") | ||
826 | |||
827 | logger.info("filters: %r", filters) | ||
828 | |||
829 | all_level_platforms = {} | ||
830 | |||
831 | all_platforms = {key: spec_to_platform(spec, key=key, enable_artifacts=args.enable_artifacts, trackmem_symbol_names=args.trackmem_symbol_names) for key, spec in JOB_SPECS.items()} | ||
832 | |||
833 | for level_i, level_keys in enumerate(all_level_keys, 1): | ||
834 | level_key = f"level{level_i}" | ||
835 | logger.info("Level %d: keys=%r", level_i, level_keys) | ||
836 | assert all(k in remaining_keys for k in level_keys) | ||
837 | level_platforms = tuple(all_platforms[key] for key in level_keys) | ||
838 | remaining_keys.difference_update(level_keys) | ||
839 | all_level_platforms[level_key] = level_platforms | ||
840 | logger.info("=" * 80) | ||
841 | |||
842 | logger.info("Keys before filter: %r", remaining_keys) | ||
843 | |||
844 | filtered_remaining_keys = set() | ||
845 | for filter in filters: | ||
846 | filtered_remaining_keys.update(fnmatch.filter(remaining_keys, filter)) | ||
847 | |||
848 | logger.info("Keys after filter: %r", filtered_remaining_keys) | ||
849 | |||
850 | remaining_keys = filtered_remaining_keys | ||
851 | |||
852 | logger.info("Remaining: %r", remaining_keys) | ||
853 | all_level_platforms["others"] = tuple(all_platforms[key] for key in remaining_keys) | ||
854 | |||
855 | if args.github_ci: | ||
856 | for level, platforms in all_level_platforms.items(): | ||
857 | platforms_json = json.dumps(platforms) | ||
858 | txt = f"{args.github_variable_prefix}-{level}={platforms_json}" | ||
859 | logger.info("%s", txt) | ||
860 | if "GITHUB_OUTPUT" in os.environ: | ||
861 | with open(os.environ["GITHUB_OUTPUT"], "a") as f: | ||
862 | f.write(txt) | ||
863 | f.write("\n") | ||
864 | else: | ||
865 | logger.warning("GITHUB_OUTPUT not defined") | ||
866 | return 0 | ||
867 | |||
868 | |||
869 | if __name__ == "__main__": | ||
870 | raise SystemExit(main()) | ||
diff --git a/src/contrib/SDL-3.2.20/.github/workflows/generic.yml b/src/contrib/SDL-3.2.20/.github/workflows/generic.yml new file mode 100644 index 0000000..c2846ba --- /dev/null +++ b/src/contrib/SDL-3.2.20/.github/workflows/generic.yml | |||
@@ -0,0 +1,431 @@ | |||
1 | name: 'Build' | ||
2 | run-name: 'Configure, Build and Test SDL' | ||
3 | |||
4 | on: | ||
5 | workflow_call: | ||
6 | inputs: | ||
7 | platforms: | ||
8 | description: 'JSON-encoded test properties' | ||
9 | type: string | ||
10 | required: true | ||
11 | |||
12 | jobs: | ||
13 | build: | ||
14 | name: ${{ matrix.platform.name }} | ||
15 | runs-on: ${{ matrix.platform.os }} | ||
16 | container: ${{ matrix.platform.container }} | ||
17 | defaults: | ||
18 | run: | ||
19 | shell: ${{ matrix.platform.shell }} | ||
20 | strategy: | ||
21 | fail-fast: false | ||
22 | matrix: | ||
23 | platform: ${{ fromJSON(inputs.platforms) }} | ||
24 | steps: | ||
25 | - name: 'Set up MSYS2' | ||
26 | if: ${{ matrix.platform.platform == 'msys2' }} | ||
27 | uses: msys2/setup-msys2@v2 | ||
28 | with: | ||
29 | msystem: ${{ matrix.platform.msys2-msystem }} | ||
30 | install: >- | ||
31 | ${{ matrix.platform.msys2-env }}-cc | ||
32 | ${{ matrix.platform.msys2-env }}-cmake | ||
33 | ${{ matrix.platform.msys2-env }}-ninja | ||
34 | ${{ (!matrix.platform.msys2-no-perl && format('{0}-perl', matrix.platform.msys2-env)) || '' }} | ||
35 | ${{ matrix.platform.msys2-env }}-pkg-config | ||
36 | ${{ matrix.platform.msys2-env }}-clang-tools-extra | ||
37 | ${{ (matrix.platform.ccache && format('{0}-ccache', matrix.platform.msys2-env)) || '' }} | ||
38 | - name: 'About this job' | ||
39 | run: | | ||
40 | echo "key=${{ matrix.platform.key }}" | ||
41 | echo "name=${{ matrix.platform.name }}" | ||
42 | echo "os=${{ matrix.platform.os }}" | ||
43 | echo "" | ||
44 | echo "Add [sdl-ci-filter ${{ matrix.platform.key }}] to your commit message to reduce the number of jobs." | ||
45 | - uses: actions/checkout@v4 | ||
46 | - name: 'Set up ninja' | ||
47 | if: ${{ matrix.platform.setup-ninja }} | ||
48 | uses: ./.github/actions/setup-ninja | ||
49 | - name: 'Set up libusb for MSVC' | ||
50 | if: ${{ matrix.platform.setup-libusb-arch != '' }} | ||
51 | uses: ./.github/actions/setup-msvc-libusb | ||
52 | with: | ||
53 | arch: ${{ matrix.platform.setup-libusb-arch }} | ||
54 | - uses: mymindstorm/setup-emsdk@v14 | ||
55 | if: ${{ matrix.platform.platform == 'emscripten' }} | ||
56 | with: | ||
57 | version: 3.1.35 | ||
58 | - uses: browser-actions/setup-chrome@v1 | ||
59 | id: setup-chrome | ||
60 | if: ${{ matrix.platform.platform == 'emscripten' }} | ||
61 | with: | ||
62 | install-chromedriver: true | ||
63 | - name: 'Add chrome to PATH' | ||
64 | if: ${{ matrix.platform.platform == 'emscripten' }} | ||
65 | run: | | ||
66 | chrome_dir="$(dirname "${{ steps.setup-chrome.outputs.chrome-path }}")" | ||
67 | chromedriver_dir="$(dirname "${{ steps.setup-chrome.outputs.chromedriver-path }}")" | ||
68 | echo "CHROME_BINARY=${{ steps.setup-chrome.outputs.chrome-path }}" >>$GITHUB_ENV | ||
69 | echo "CHROMEDRIVER_BINARY=${{ steps.setup-chrome.outputs.chromedriver-path }}" >>$GITHUB_ENV | ||
70 | echo "chrome_dir=${chrome_dir}" | ||
71 | echo "chromedriver_dir=${chromedriver_dir}" | ||
72 | echo "${chrome_dir}" >>${GITHUB_PATH} | ||
73 | echo "${chromedriver_dir}" >>${GITHUB_PATH} | ||
74 | - uses: nttld/setup-ndk@v1 | ||
75 | if: ${{ matrix.platform.android-ndk }} | ||
76 | id: setup-ndk | ||
77 | with: | ||
78 | local-cache: true | ||
79 | ndk-version: r21e | ||
80 | - name: 'Configure Android NDK variables' | ||
81 | if: ${{ matrix.platform.android-ndk }} | ||
82 | shell: sh | ||
83 | run: | | ||
84 | # We cannot use GitHub expressions in the controller job | ||
85 | echo "ANDROID_NDK_HOME=${{ steps.setup-ndk.outputs.ndk-path }}" >>$GITHUB_ENV | ||
86 | - uses: actions/setup-java@v4 | ||
87 | if: ${{ matrix.platform.java }} | ||
88 | with: | ||
89 | distribution: 'temurin' | ||
90 | java-version: '17' | ||
91 | - uses: ilammy/msvc-dev-cmd@v1 | ||
92 | if: ${{ matrix.platform.platform == 'msvc' }} | ||
93 | with: | ||
94 | arch: ${{ matrix.platform.msvc-vcvars-arch }} | ||
95 | sdk: ${{ matrix.platform.msvc-vcvars-sdk }} | ||
96 | - name: 'Set up Windows GDK Desktop' | ||
97 | uses: ./.github/actions/setup-gdk-desktop | ||
98 | if: ${{ matrix.platform.setup-gdk-folder != '' }} | ||
99 | with: | ||
100 | folder: '${{ matrix.platform.setup-gdk-folder }}' | ||
101 | - name: 'Set up LoongArch64 toolchain' | ||
102 | uses: ./.github/actions/setup-loongarch64-toolchain | ||
103 | id: setup-loongarch64-toolchain | ||
104 | if: ${{ matrix.platform.platform == 'loongarch64' }} | ||
105 | - name: 'Setup Intel oneAPI toolchain' | ||
106 | id: intel | ||
107 | if: ${{ matrix.platform.intel }} | ||
108 | run: | | ||
109 | # Download the key to system keyring | ||
110 | wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ | ||
111 | | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null | ||
112 | |||
113 | # Add signed entry to apt sources and configure the APT client to use Intel repository: | ||
114 | echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list | ||
115 | |||
116 | # Update package list | ||
117 | sudo apt-get update -y | ||
118 | |||
119 | # Install oneAPI | ||
120 | sudo apt-get install -y intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic | ||
121 | - name: 'Install apk packages' | ||
122 | if: ${{ matrix.platform.apk-packages != '' }} | ||
123 | run: | | ||
124 | ${{ matrix.platform.sudo }} apk update | ||
125 | ${{ matrix.platform.sudo }} apk add ${{ matrix.platform.apk-packages }} | ||
126 | - name: 'Install apt packages' | ||
127 | if: ${{ matrix.platform.apt-packages != '' }} | ||
128 | run: | | ||
129 | ${{ matrix.platform.sudo }} apt-get update | ||
130 | ${{ matrix.platform.sudo }} apt-get install -y ${{ matrix.platform.apt-packages }} | ||
131 | - name: 'Install brew packages' | ||
132 | if: ${{ matrix.platform.brew-packages != '' }} | ||
133 | run: | | ||
134 | export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 | ||
135 | brew update | ||
136 | brew install ${{ matrix.platform.brew-packages }} | ||
137 | - name: 'Setup Python' | ||
138 | uses: 'actions/setup-python@main' | ||
139 | if: ${{ matrix.platform.setup-python }} | ||
140 | with: | ||
141 | python-version: '3.x' | ||
142 | - name: 'Install PyPI packages' | ||
143 | if: ${{ matrix.platform.pypi-packages != '' }} | ||
144 | run: | | ||
145 | python -m pip install --user ${{ matrix.platform.pypi-packages }} | ||
146 | - name: 'Set up GLES for VITA' # Must be after apk | ||
147 | if: ${{ matrix.platform.setup-vita-gles-type != '' }} | ||
148 | uses: ./.github/actions/setup-vita-gles | ||
149 | with: | ||
150 | type: ${{ matrix.platform.setup-vita-gles-type }} | ||
151 | |||
152 | - name: 'Pollute toolchain with "bad" SDL headers' | ||
153 | if: ${{ matrix.platform.pollute-directories != '' }} | ||
154 | #shell: ${{ matrix.platform.shell }} | ||
155 | run: | | ||
156 | # Create "bad" SDL headers in the toolchain. | ||
157 | # SDL sources should not use these. | ||
158 | for include in ${{ matrix.platform.pollute-directories }}; do | ||
159 | toolchain_directory="${include}/SDL3" | ||
160 | echo "Creating directory ${toolchain_directory}" | ||
161 | mkdir -p "${toolchain_directory}/SDL3" | ||
162 | for header in include/SDL3/*.h; do | ||
163 | dest="${toolchain_directory}/SDL3/$(basename "${header}")" | ||
164 | echo "Creating ${dest}" | ||
165 | echo '#error "System SDL headers must not be used by build system"' >"$dest" | ||
166 | done | ||
167 | done | ||
168 | |||
169 | - name: 'Calculate ccache key' | ||
170 | if: ${{ matrix.platform.ccache }} | ||
171 | id: prepare-restore-ccache | ||
172 | run: | | ||
173 | echo "timestamp=$(date -u "+%Y%m%d%H%M_%S")" >> "$GITHUB_OUTPUT" | ||
174 | - name: 'Restore ccache' | ||
175 | if: ${{ matrix.platform.ccache }} | ||
176 | uses: actions/cache/restore@v4 | ||
177 | id: restore-ccache | ||
178 | with: | ||
179 | path: ${{ runner.temp }}/ccache | ||
180 | key: ccache-${{ matrix.platform.key }}-${{ steps.prepare-restore-ccache.outputs.timestamp }} | ||
181 | restore-keys: | | ||
182 | ccache-${{matrix.platform.key}} | ||
183 | - name: 'Configure ccache' | ||
184 | if: ${{ matrix.platform.ccache }} | ||
185 | run: | | ||
186 | echo 'CCACHE_DIR=${{ runner.temp }}/ccache' >>${GITHUB_ENV} | ||
187 | - name: 'Prepare ccache' | ||
188 | if: ${{ matrix.platform.ccache && steps.restore-ccache.outputs.cache-hit }} | ||
189 | run: | | ||
190 | if [ "x${{ runner.os }}" = "xmacOS" ]; then | ||
191 | touch_date="2025-02-01T12:00:00Z" | ||
192 | else | ||
193 | touch_date="2025-02-01" | ||
194 | fi | ||
195 | find "${CCACHE_DIR}" -type f -exec touch -a -m -d "$touch_date" {} + | ||
196 | ccache -s | ||
197 | ccache -z | ||
198 | |||
199 | - name: 'Configure (CMake)' | ||
200 | if: ${{ !matrix.platform.no-cmake }} | ||
201 | #shell: ${{ matrix.platform.shell }} | ||
202 | run: | | ||
203 | ${{ matrix.platform.source-cmd }} | ||
204 | ${{ matrix.platform.cmake-config-emulator }} cmake -S . -B build -G "${{ matrix.platform.cmake-generator }}" \ | ||
205 | -Wdeprecated -Wdev -Werror \ | ||
206 | ${{ matrix.platform.cmake-toolchain-file != '' && format('-DCMAKE_TOOLCHAIN_FILE={0}', matrix.platform.cmake-toolchain-file) || '' }} \ | ||
207 | -DSDL_WERROR=${{ matrix.platform.werror }} \ | ||
208 | -DSDL_EXAMPLES=${{ matrix.platform.build-tests }} \ | ||
209 | -DSDL_TESTS=${{ matrix.platform.build-tests }} \ | ||
210 | -DSDLTEST_TRACKMEM=ON \ | ||
211 | -DSDL_INSTALL_TESTS=${{ matrix.platform.build-tests }} \ | ||
212 | -DSDL_CLANG_TIDY=${{ matrix.platform.clang-tidy }} \ | ||
213 | -DSDL_INSTALL_DOCS=ON \ | ||
214 | -DSDL_INSTALL_CPACK=ON \ | ||
215 | -DSDL_INSTALL_DOCS=ON \ | ||
216 | ${{ matrix.platform.cmake-arguments }} \ | ||
217 | -DSDL_SHARED=${{ matrix.platform.shared }} \ | ||
218 | -DSDL_STATIC=${{ matrix.platform.static }} \ | ||
219 | -DSDL_VENDOR_INFO="Github Workflow" \ | ||
220 | -DCMAKE_INSTALL_PREFIX=prefix \ | ||
221 | -DCMAKE_INSTALL_LIBDIR=lib \ | ||
222 | -DCMAKE_BUILD_TYPE=${{ matrix.platform.cmake-build-type }} | ||
223 | - name: 'Build (CMake)' | ||
224 | id: build | ||
225 | if: ${{ !matrix.platform.no-cmake }} | ||
226 | # shell: ${{ matrix.platform.shell }} | ||
227 | run: | | ||
228 | ${{ matrix.platform.source-cmd }} | ||
229 | cmake --build build --config ${{ matrix.platform.cmake-build-type }} --verbose -- ${{ matrix.platform.cmake-build-arguments }} | ||
230 | - name: 'Verify SDL_REVISION' | ||
231 | if: ${{ !matrix.platform.no-cmake }} | ||
232 | run: | | ||
233 | echo "This should show us the SDL_REVISION" | ||
234 | echo "Shared library:" | ||
235 | ${{ (matrix.platform.shared-lib && format('{0} build/{1} | grep "Github Workflow"', matrix.platform.binutils-strings, matrix.platform.shared-lib)) || 'echo "<Shared library not supported by platform>"' }} | ||
236 | echo "Static library:" | ||
237 | ${{ (matrix.platform.static-lib && format('{0} build/{1} | grep "Github Workflow"', matrix.platform.binutils-strings, matrix.platform.static-lib)) || 'echo "<Static library not supported by platform>"' }} | ||
238 | - name: 'Run build-time tests (CMake)' | ||
239 | id: tests | ||
240 | if: ${{ !matrix.platform.no-cmake && matrix.platform.run-tests }} | ||
241 | # shell: ${{ matrix.platform.shell }} | ||
242 | run: | | ||
243 | ${{ matrix.platform.source-cmd }} | ||
244 | ${{ matrix.platform.pretest-cmd }} | ||
245 | set -eu | ||
246 | export SDL_TESTS_QUICK=1 | ||
247 | ctest -VV --test-dir build/ -j2 | ||
248 | - name: "Build test apk's (CMake)" | ||
249 | id: apks | ||
250 | if: ${{ always() && steps.build.outcome == 'success' && matrix.platform.android-apks != '' }} | ||
251 | # shell: ${{ matrix.platform.shell }} | ||
252 | run: | | ||
253 | ${{ matrix.platform.source-cmd }} | ||
254 | cmake --build build --config ${{ matrix.platform.cmake-build-type }} \ | ||
255 | --target \ | ||
256 | ${{ matrix.platform.android-apks }} \ | ||
257 | --verbose \ | ||
258 | -- ${{ matrix.platform.cmake-build-arguments }} | ||
259 | - name: 'Install (CMake)' | ||
260 | id: install | ||
261 | if: ${{ always() && steps.build.outcome == 'success' }} | ||
262 | # shell: ${{ matrix.platform.shell }} | ||
263 | run: | | ||
264 | ${{ matrix.platform.source-cmd }} | ||
265 | cmake --install build --config ${{ matrix.platform.cmake-build-type }} | ||
266 | echo "prefix=$(pwd)/prefix" >> $GITHUB_OUTPUT | ||
267 | ( cd prefix; find . ) | LC_ALL=C sort -u | ||
268 | - name: 'Package (CPack)' | ||
269 | id: package | ||
270 | if: ${{ always() && steps.build.outcome == 'success' }} | ||
271 | # shell: ${{ matrix.platform.shell }} | ||
272 | run: | | ||
273 | # DMG creation on macOS occasionally fails, so try multiple times | ||
274 | # https://gitlab.kitware.com/cmake/cmake/-/issues/25671 | ||
275 | success=0 | ||
276 | max_tries=10 | ||
277 | for i in $(seq $max_tries); do | ||
278 | cmake --build build/ --config ${{ matrix.platform.cmake-build-type }} --target package -- ${{ matrix.platform.cmake-build-arguments }} && success=1 | ||
279 | if test $success = 1; then | ||
280 | break | ||
281 | fi | ||
282 | echo "Package creation failed. Sleep 1 second and try again." | ||
283 | sleep 1 | ||
284 | done | ||
285 | if test $success = 0; then | ||
286 | echo "Package creation failed after $max_tries attempts." | ||
287 | exit 1 | ||
288 | fi | ||
289 | - name: 'Verify CMake configuration files' | ||
290 | if: ${{ steps.install.outcome == 'success' }} | ||
291 | # shell: ${{ matrix.platform.shell }} | ||
292 | run: | | ||
293 | ${{ matrix.platform.source-cmd }} | ||
294 | ${{ matrix.platform.cmake-config-emulator }} cmake -S cmake/test -B cmake_test_build -GNinja \ | ||
295 | ${{ matrix.platform.cmake-toolchain-file != '' && format('-DCMAKE_TOOLCHAIN_FILE={0}', matrix.platform.cmake-toolchain-file) || '' }} \ | ||
296 | -DTEST_SHARED=${{ matrix.platform.shared }} \ | ||
297 | -DTEST_STATIC=${{ matrix.platform.static }} \ | ||
298 | ${{ matrix.platform.cmake-arguments }} \ | ||
299 | -DCMAKE_BUILD_TYPE=${{ matrix.platform.cmake-build-type }} \ | ||
300 | -DCMAKE_PREFIX_PATH="${{ steps.install.outputs.prefix }}" | ||
301 | cmake --build cmake_test_build --verbose --config ${{ matrix.platform.cmake-build-type }} -- ${{ matrix.platform.cmake-build-arguments }} | ||
302 | - name: 'Extract CC/CXX/CFLAGS/CXXFLAGS from CMake toolchain' | ||
303 | if: ${{ steps.install.outcome == 'success' && matrix.platform.cc-from-cmake }} | ||
304 | # shell: ${{ matrix.platform.shell }} | ||
305 | run: | | ||
306 | cmake -S .github/cmake -B /tmp/cmake_extract \ | ||
307 | ${{ matrix.platform.cmake-toolchain-file != '' && format('-DCMAKE_TOOLCHAIN_FILE={0}', matrix.platform.cmake-toolchain-file) || '' }} \ | ||
308 | -DCMAKE_BUILD_TYPE=${{ matrix.platform.cmake-build-type }} \ | ||
309 | -DVAR_PATH=/tmp/env.txt | ||
310 | cat /tmp/env.txt >> $GITHUB_ENV | ||
311 | - name: 'Verify sdl3.pc' | ||
312 | # shell: ${{ matrix.platform.shell }} | ||
313 | if: ${{ steps.install.outcome == 'success' && matrix.platform.test-pkg-config }} | ||
314 | run: | | ||
315 | ${{ matrix.platform.source-cmd }} | ||
316 | ${{ matrix.platform.cc && format('export CC="{0}"', matrix.platform.cc) || '' }} | ||
317 | ${{ matrix.platform.cflags && format('export CFLAGS="{0}"', matrix.platform.cflags) || '' }} | ||
318 | ${{ matrix.platform.ldflags && format('export LDFLAGS="{0}"', matrix.platform.ldflags) || '' }} | ||
319 | export PKG_CONFIG_PATH=${{ steps.install.outputs.prefix }}/lib/pkgconfig | ||
320 | cmake/test/test_pkgconfig.sh | ||
321 | - name: 'Build (cross-platform-actions, BSD)' | ||
322 | id: cpactions | ||
323 | if: ${{ matrix.platform.cpactions }} | ||
324 | uses: cross-platform-actions/action@v0.27.0 | ||
325 | with: | ||
326 | operating_system: '${{ matrix.platform.cpactions-os }}' | ||
327 | architecture: '${{ matrix.platform.cpactions-arch }}' | ||
328 | version: '${{ matrix.platform.cpactions-version }}' | ||
329 | run: | | ||
330 | ${{ matrix.platform.cpactions-setup-cmd }} | ||
331 | ${{ matrix.platform.cpactions-install-cmd }} | ||
332 | cmake -S . -B build -GNinja \ | ||
333 | ${{ matrix.platform.cmake-toolchain-file != '' && format('-DCMAKE_TOOLCHAIN_FILE={0}', matrix.platform.cmake-toolchain-file) || '' }} \ | ||
334 | -Wdeprecated -Wdev -Werror \ | ||
335 | -DSDL_WERROR=${{ matrix.platform.werror }} \ | ||
336 | -DSDL_INSTALL_DOCS=ON \ | ||
337 | ${{ matrix.platform.cmake-arguments }} \ | ||
338 | -DSDL_SHARED=${{ matrix.platform.shared }} \ | ||
339 | -DSDL_STATIC=${{ matrix.platform.static }} \ | ||
340 | -DSDL_VENDOR_INFO="Github Workflow" \ | ||
341 | -DCMAKE_INSTALL_PREFIX=prefix \ | ||
342 | -DCMAKE_INSTALL_LIBDIR=lib \ | ||
343 | -DCMAKE_BUILD_TYPE=${{ matrix.platform.cmake-build-type }} | ||
344 | cmake --build build/ --config ${{ matrix.platform.cmake-build-type }} --verbose | ||
345 | cmake --build build/ --config ${{ matrix.platform.cmake-build-type }} --target package | ||
346 | |||
347 | cmake --build build/ --config ${{ matrix.platform.cmake-build-type }} --target clean | ||
348 | rm -rf build/dist/_CPack_Packages | ||
349 | rm -rf build/CMakeFiles | ||
350 | rm -rf build/docs | ||
351 | - name: Add msbuild to PATH | ||
352 | id: setup-msbuild | ||
353 | if: ${{ matrix.platform.msvc-project != '' }} | ||
354 | uses: microsoft/setup-msbuild@v2 | ||
355 | - name: Build msbuild | ||
356 | if: ${{ matrix.platform.msvc-project != '' }} | ||
357 | run: | | ||
358 | "$(cygpath -u '${{ steps.setup-msbuild.outputs.msbuildPath }}\msbuild.exe')" ${{ matrix.platform.msvc-project }} -m -p:BuildInParallel=true -p:Configuration=Release ${{ matrix.platform.msvc-project-flags }} | ||
359 | - name: 'Build (Android.mk)' | ||
360 | if: ${{ matrix.platform.android-mk }} | ||
361 | run: | | ||
362 | ./build-scripts/androidbuildlibs.sh | ||
363 | - name: 'Create Gradle project (Android)' | ||
364 | if: ${{ matrix.platform.android-gradle }} | ||
365 | run: | | ||
366 | for folder in build-ndk-build build-cmake; do | ||
367 | python build-scripts/create-android-project.py \ | ||
368 | --output "${folder}" \ | ||
369 | --variant copy \ | ||
370 | org.libsdl.testspriteminimal \ | ||
371 | test/testspriteminimal.c test/icon.h | ||
372 | done | ||
373 | echo "" | ||
374 | echo "Project contents:" | ||
375 | echo "" | ||
376 | find "build-ndk-build/org.libsdl.testspriteminimal" | ||
377 | - name: 'Build Android app (Gradle & ndk-build)' | ||
378 | if: ${{ matrix.platform.android-gradle }} | ||
379 | run: | | ||
380 | cd build-ndk-build/org.libsdl.testspriteminimal | ||
381 | ./gradlew -i assembleRelease | ||
382 | - name: 'Build Android app (Gradle & CMake)' | ||
383 | if: ${{ matrix.platform.android-gradle }} | ||
384 | run: | | ||
385 | cd build-cmake/org.libsdl.testspriteminimal | ||
386 | ./gradlew -i assembleRelease -PBUILD_WITH_CMAKE=1 | ||
387 | - name: 'Build (xcode)' | ||
388 | if: ${{ matrix.platform.xcode-sdk != '' }} | ||
389 | run: | | ||
390 | xcodebuild -project Xcode/SDL/SDL.xcodeproj -target SDL3 -configuration Release -sdk ${{ matrix.platform.xcode-sdk }} clean build | ||
391 | - name: 'Prune old ccache files' | ||
392 | if: ${{ matrix.platform.ccache }} | ||
393 | run: | | ||
394 | ccache --evict-older-than=1d | ||
395 | ccache -s | ||
396 | - name: 'Save ccache' | ||
397 | if: ${{ matrix.platform.ccache }} | ||
398 | uses: actions/cache/save@v4 | ||
399 | with: | ||
400 | path: ${{ runner.temp }}/ccache | ||
401 | key: ${{ steps.restore-ccache.outputs.cache-primary-key }} | ||
402 | - name: 'Check Sources' | ||
403 | if: ${{ matrix.platform.check-sources }} | ||
404 | run: | | ||
405 | set -e | ||
406 | build-scripts/test-versioning.sh | ||
407 | python build-scripts/check_android_jni.py | ||
408 | python build-scripts/check_stdlib_usage.py | ||
409 | - name: 'Upload binary package' | ||
410 | uses: actions/upload-artifact@v4 | ||
411 | if: ${{ always() && matrix.platform.artifact != '' && (steps.package.outcome == 'success' || steps.cpactions.outcome == 'success') && (matrix.platform.enable-artifacts || steps.tests.outcome == 'failure') }} | ||
412 | with: | ||
413 | if-no-files-found: error | ||
414 | name: '${{ matrix.platform.artifact }}' | ||
415 | path: | | ||
416 | build/dist/SDL3* | ||
417 | build/include* | ||
418 | - name: 'Upload minidumps' | ||
419 | uses: actions/upload-artifact@v4 | ||
420 | if: ${{ always() && steps.tests.outcome == 'failure' && (matrix.platform.platform == 'msvc' || matrix.platform.platform == 'msys2') }} | ||
421 | with: | ||
422 | if-no-files-found: ignore | ||
423 | name: '${{ matrix.platform.artifact }}-minidumps' | ||
424 | path: build/**/*.dmp | ||
425 | - name: "Upload Android test apk's" | ||
426 | uses: actions/upload-artifact@v4 | ||
427 | if: ${{ matrix.platform.enable-artifacts && always() && matrix.platform.artifact != '' && steps.apks.outcome == 'success' }} | ||
428 | with: | ||
429 | if-no-files-found: error | ||
430 | name: '${{ matrix.platform.artifact }}-apks' | ||
431 | path: build/test/*.apk \ No newline at end of file | ||
diff --git a/src/contrib/SDL-3.2.20/.github/workflows/release.yml b/src/contrib/SDL-3.2.20/.github/workflows/release.yml new file mode 100644 index 0000000..01eaee9 --- /dev/null +++ b/src/contrib/SDL-3.2.20/.github/workflows/release.yml | |||
@@ -0,0 +1,652 @@ | |||
1 | name: 'release' | ||
2 | run-name: 'Create SDL release artifacts for ${{ inputs.commit }}' | ||
3 | |||
4 | on: | ||
5 | workflow_dispatch: | ||
6 | inputs: | ||
7 | commit: | ||
8 | description: 'Commit of SDL' | ||
9 | required: true | ||
10 | |||
11 | jobs: | ||
12 | |||
13 | src: | ||
14 | runs-on: ubuntu-latest | ||
15 | outputs: | ||
16 | project: ${{ steps.releaser.outputs.project }} | ||
17 | version: ${{ steps.releaser.outputs.version }} | ||
18 | src-tar-gz: ${{ steps.releaser.outputs.src-tar-gz }} | ||
19 | src-tar-xz: ${{ steps.releaser.outputs.src-tar-xz }} | ||
20 | src-zip: ${{ steps.releaser.outputs.src-zip }} | ||
21 | steps: | ||
22 | - name: 'Set up Python' | ||
23 | uses: actions/setup-python@v5 | ||
24 | with: | ||
25 | python-version: '3.11' | ||
26 | - name: 'Fetch build-release.py' | ||
27 | uses: actions/checkout@v4 | ||
28 | with: | ||
29 | sparse-checkout: 'build-scripts/build-release.py' | ||
30 | - name: 'Set up SDL sources' | ||
31 | uses: actions/checkout@v4 | ||
32 | with: | ||
33 | path: 'SDL' | ||
34 | fetch-depth: 0 | ||
35 | - name: 'Build Source archive' | ||
36 | id: releaser | ||
37 | shell: bash | ||
38 | run: | | ||
39 | python build-scripts/build-release.py \ | ||
40 | --actions source \ | ||
41 | --commit ${{ inputs.commit }} \ | ||
42 | --root "${{ github.workspace }}/SDL" \ | ||
43 | --github \ | ||
44 | --debug | ||
45 | - name: 'Store source archives' | ||
46 | uses: actions/upload-artifact@v4 | ||
47 | with: | ||
48 | name: sources | ||
49 | path: '${{ github.workspace}}/dist' | ||
50 | - name: 'Generate summary' | ||
51 | run: | | ||
52 | echo "Run the following commands to download all artifacts:" >> $GITHUB_STEP_SUMMARY | ||
53 | echo '```' >> $GITHUB_STEP_SUMMARY | ||
54 | echo "mkdir -p /tmp/${{ steps.releaser.outputs.project }}-${{ steps.releaser.outputs.version }}" >> $GITHUB_STEP_SUMMARY | ||
55 | echo "cd /tmp/${{ steps.releaser.outputs.project }}-${{ steps.releaser.outputs.version }}" >> $GITHUB_STEP_SUMMARY | ||
56 | echo "gh run -R ${{ github.repository }} download ${{ github.run_id }}" >> $GITHUB_STEP_SUMMARY | ||
57 | echo '```' >> $GITHUB_STEP_SUMMARY | ||
58 | |||
59 | linux-verify: | ||
60 | needs: [src] | ||
61 | runs-on: ubuntu-latest | ||
62 | steps: | ||
63 | - name: 'Download source archives' | ||
64 | uses: actions/download-artifact@v4 | ||
65 | with: | ||
66 | name: sources | ||
67 | path: '${{ github.workspace }}' | ||
68 | - name: 'Unzip ${{ needs.src.outputs.src-zip }}' | ||
69 | id: zip | ||
70 | run: | | ||
71 | mkdir /tmp/zipdir | ||
72 | cd /tmp/zipdir | ||
73 | unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}" | ||
74 | echo "path=/tmp/zipdir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT | ||
75 | - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}' | ||
76 | id: tar | ||
77 | run: | | ||
78 | mkdir -p /tmp/tardir | ||
79 | tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}" | ||
80 | echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT | ||
81 | - name: 'Compare contents of ${{ needs.src.outputs.src-zip }} and ${{ needs.src.outputs.src-tar-gz }}' | ||
82 | run: | | ||
83 | diff /tmp/zipdir /tmp/tardir | ||
84 | - name: 'Test versioning' | ||
85 | shell: bash | ||
86 | run: | | ||
87 | ${{ steps.tar.outputs.path }}/build-scripts/test-versioning.sh | ||
88 | - name: 'Install Linux dependencies' | ||
89 | run: | | ||
90 | sudo apt-get update -y | ||
91 | sudo apt-get install -y \ | ||
92 | gnome-desktop-testing libasound2-dev libpulse-dev libaudio-dev libjack-dev libsndio-dev \ | ||
93 | libusb-1.0-0-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev \ | ||
94 | libxss-dev libwayland-dev libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \ | ||
95 | libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev | ||
96 | - name: 'CMake (configure + build + tests + examples)' | ||
97 | run: | | ||
98 | cmake -S ${{ steps.tar.outputs.path }} -B /tmp/build -DSDL_TEST_LIBRARY=TRUE -DSDL_TESTS=TRUE -DSDL_EXAMPLES=TRUE | ||
99 | cmake --build /tmp/build --verbose | ||
100 | ctest --test-dir /tmp/build --no-tests=error --output-on-failure | ||
101 | |||
102 | dmg: | ||
103 | needs: [src] | ||
104 | runs-on: macos-latest | ||
105 | outputs: | ||
106 | dmg: ${{ steps.releaser.outputs.dmg }} | ||
107 | steps: | ||
108 | - name: 'Set up Python' | ||
109 | uses: actions/setup-python@v5 | ||
110 | with: | ||
111 | python-version: '3.11' | ||
112 | - name: 'Fetch build-release.py' | ||
113 | uses: actions/checkout@v4 | ||
114 | with: | ||
115 | sparse-checkout: 'build-scripts/build-release.py' | ||
116 | - name: 'Download source archives' | ||
117 | uses: actions/download-artifact@v4 | ||
118 | with: | ||
119 | name: sources | ||
120 | path: '${{ github.workspace }}' | ||
121 | - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}' | ||
122 | id: tar | ||
123 | run: | | ||
124 | mkdir -p "${{ github.workspace }}/tardir" | ||
125 | tar -C "${{ github.workspace }}/tardir" -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}" | ||
126 | echo "path=${{ github.workspace }}/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT | ||
127 | - name: 'Build SDL3.dmg' | ||
128 | id: releaser | ||
129 | shell: bash | ||
130 | run: | | ||
131 | python build-scripts/build-release.py \ | ||
132 | --actions dmg \ | ||
133 | --commit ${{ inputs.commit }} \ | ||
134 | --root "${{ steps.tar.outputs.path }}" \ | ||
135 | --github \ | ||
136 | --debug | ||
137 | - name: 'Store DMG image file' | ||
138 | uses: actions/upload-artifact@v4 | ||
139 | with: | ||
140 | name: dmg | ||
141 | path: '${{ github.workspace }}/dist' | ||
142 | |||
143 | dmg-verify: | ||
144 | needs: [dmg, src] | ||
145 | runs-on: macos-latest | ||
146 | steps: | ||
147 | - name: 'Download source archives' | ||
148 | uses: actions/download-artifact@v4 | ||
149 | with: | ||
150 | name: sources | ||
151 | path: '${{ github.workspace }}' | ||
152 | - name: 'Download ${{ needs.dmg.outputs.dmg }}' | ||
153 | uses: actions/download-artifact@v4 | ||
154 | with: | ||
155 | name: dmg | ||
156 | path: '${{ github.workspace }}' | ||
157 | - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}' | ||
158 | id: src | ||
159 | run: | | ||
160 | mkdir -p /tmp/tardir | ||
161 | tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}" | ||
162 | echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT | ||
163 | - name: 'Mount ${{ needs.dmg.outputs.dmg }}' | ||
164 | id: mount | ||
165 | run: | | ||
166 | hdiutil attach '${{ github.workspace }}/${{ needs.dmg.outputs.dmg }}' | ||
167 | mount_point="/Volumes/${{ needs.src.outputs.project }}" | ||
168 | if [ ! -d "$mount_point/${{ needs.src.outputs.project }}.xcframework" ]; then | ||
169 | echo "Cannot find ${{ needs.src.outputs.project }}.xcframework!" | ||
170 | exit 1 | ||
171 | fi | ||
172 | echo "mount_point=$mount_point">>$GITHUB_OUTPUT | ||
173 | - name: 'CMake (configure + build) Darwin' | ||
174 | run: | | ||
175 | cmake -S "${{ steps.src.outputs.path }}/cmake/test" \ | ||
176 | -DTEST_FULL=FALSE \ | ||
177 | -DTEST_STATIC=FALSE \ | ||
178 | -DTEST_TEST=FALSE \ | ||
179 | -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \ | ||
180 | -DCMAKE_SYSTEM_NAME=Darwin \ | ||
181 | -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \ | ||
182 | -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 \ | ||
183 | -Werror=dev \ | ||
184 | -B build_darwin | ||
185 | cmake --build build_darwin --config Release --verbose | ||
186 | |||
187 | cmake -S "${{ steps.src.outputs.path }}/cmake/test" \ | ||
188 | -DTEST_FULL=FALSE \ | ||
189 | -DTEST_STATIC=FALSE \ | ||
190 | -DTEST_TEST=FALSE \ | ||
191 | -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}/SDL3.xcframework/macos-arm64_x86_64" \ | ||
192 | -DCMAKE_SYSTEM_NAME=Darwin \ | ||
193 | -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \ | ||
194 | -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 \ | ||
195 | -Werror=dev \ | ||
196 | -B build_darwin_2 | ||
197 | cmake --build build_darwin --config Release --verbose | ||
198 | - name: 'CMake (configure + build) iOS' | ||
199 | run: | | ||
200 | cmake -S "${{ steps.src.outputs.path }}/cmake/test" \ | ||
201 | -DTEST_FULL=FALSE \ | ||
202 | -DTEST_STATIC=FALSE \ | ||
203 | -DTEST_TEST=FALSE \ | ||
204 | -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \ | ||
205 | -DCMAKE_SYSTEM_NAME=iOS \ | ||
206 | -DCMAKE_OSX_ARCHITECTURES="arm64" \ | ||
207 | -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \ | ||
208 | -Werror=dev \ | ||
209 | -B build_ios | ||
210 | cmake --build build_ios --config Release --verbose | ||
211 | - name: 'CMake (configure + build) tvOS' | ||
212 | run: | | ||
213 | cmake -S "${{ steps.src.outputs.path }}/cmake/test" \ | ||
214 | -DTEST_FULL=FALSE \ | ||
215 | -DTEST_STATIC=FALSE \ | ||
216 | -DTEST_TEST=FALSE \ | ||
217 | -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \ | ||
218 | -DCMAKE_SYSTEM_NAME=tvOS \ | ||
219 | -DCMAKE_OSX_ARCHITECTURES="arm64" \ | ||
220 | -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \ | ||
221 | -Werror=dev \ | ||
222 | -B build_tvos | ||
223 | cmake --build build_tvos --config Release --verbose | ||
224 | - name: 'CMake (configure + build) iOS simulator' | ||
225 | run: | | ||
226 | sysroot=$(xcodebuild -version -sdk iphonesimulator Path) | ||
227 | echo "sysroot=$sysroot" | ||
228 | cmake -S "${{ steps.src.outputs.path }}/cmake/test" \ | ||
229 | -DTEST_FULL=FALSE \ | ||
230 | -DTEST_STATIC=FALSE \ | ||
231 | -DTEST_TEST=FALSE \ | ||
232 | -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \ | ||
233 | -DCMAKE_SYSTEM_NAME=iOS \ | ||
234 | -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \ | ||
235 | -DCMAKE_OSX_SYSROOT="${sysroot}" \ | ||
236 | -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \ | ||
237 | -Werror=dev \ | ||
238 | -B build_ios_simulator | ||
239 | cmake --build build_ios_simulator --config Release --verbose | ||
240 | - name: 'CMake (configure + build) tvOS simulator' | ||
241 | run: | | ||
242 | sysroot=$(xcodebuild -version -sdk appletvsimulator Path) | ||
243 | echo "sysroot=$sysroot" | ||
244 | cmake -S "${{ steps.src.outputs.path }}/cmake/test" \ | ||
245 | -DTEST_FULL=FALSE \ | ||
246 | -DTEST_STATIC=FALSE \ | ||
247 | -DTEST_TEST=FALSE \ | ||
248 | -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \ | ||
249 | -DCMAKE_SYSTEM_NAME=tvOS \ | ||
250 | -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \ | ||
251 | -DCMAKE_OSX_SYSROOT="${sysroot}" \ | ||
252 | -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \ | ||
253 | -Werror=dev \ | ||
254 | -B build_tvos_simulator | ||
255 | cmake --build build_tvos_simulator --config Release --verbose | ||
256 | |||
257 | msvc: | ||
258 | needs: [src] | ||
259 | runs-on: windows-2025 | ||
260 | outputs: | ||
261 | VC-x86: ${{ steps.releaser.outputs.VC-x86 }} | ||
262 | VC-x64: ${{ steps.releaser.outputs.VC-x64 }} | ||
263 | VC-arm64: ${{ steps.releaser.outputs.VC-arm64 }} | ||
264 | VC-devel: ${{ steps.releaser.outputs.VC-devel }} | ||
265 | steps: | ||
266 | - name: 'Set up Python' | ||
267 | uses: actions/setup-python@v5 | ||
268 | with: | ||
269 | python-version: '3.11' | ||
270 | - name: 'Fetch build-release.py' | ||
271 | uses: actions/checkout@v4 | ||
272 | with: | ||
273 | sparse-checkout: 'build-scripts/build-release.py' | ||
274 | - name: 'Download source archives' | ||
275 | uses: actions/download-artifact@v4 | ||
276 | with: | ||
277 | name: sources | ||
278 | path: '${{ github.workspace }}' | ||
279 | - name: 'Unzip ${{ needs.src.outputs.src-zip }}' | ||
280 | id: zip | ||
281 | run: | | ||
282 | New-Item C:\temp -ItemType Directory -ErrorAction SilentlyContinue | ||
283 | cd C:\temp | ||
284 | unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}" | ||
285 | echo "path=C:\temp\${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$Env:GITHUB_OUTPUT | ||
286 | - name: 'Build MSVC binary archives' | ||
287 | id: releaser | ||
288 | run: | | ||
289 | python build-scripts/build-release.py ` | ||
290 | --actions msvc ` | ||
291 | --commit ${{ inputs.commit }} ` | ||
292 | --root "${{ steps.zip.outputs.path }}" ` | ||
293 | --github ` | ||
294 | --debug | ||
295 | - name: 'Store MSVC archives' | ||
296 | uses: actions/upload-artifact@v4 | ||
297 | with: | ||
298 | name: win32 | ||
299 | path: '${{ github.workspace }}/dist' | ||
300 | |||
301 | msvc-verify: | ||
302 | needs: [msvc, src] | ||
303 | runs-on: windows-latest | ||
304 | steps: | ||
305 | - name: 'Fetch .github/actions/setup-ninja/action.yml' | ||
306 | uses: actions/checkout@v4 | ||
307 | with: | ||
308 | sparse-checkout: '.github/actions/setup-ninja/action.yml' | ||
309 | - name: 'Download source archives' | ||
310 | uses: actions/download-artifact@v4 | ||
311 | with: | ||
312 | name: sources | ||
313 | path: '${{ github.workspace }}' | ||
314 | - name: 'Download MSVC binaries' | ||
315 | uses: actions/download-artifact@v4 | ||
316 | with: | ||
317 | name: win32 | ||
318 | path: '${{ github.workspace }}' | ||
319 | - name: 'Unzip ${{ needs.src.outputs.src-zip }}' | ||
320 | id: src | ||
321 | run: | | ||
322 | mkdir '${{ github.workspace }}/sources' | ||
323 | cd '${{ github.workspace }}/sources' | ||
324 | unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}" | ||
325 | echo "path=${{ github.workspace }}/sources/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$env:GITHUB_OUTPUT | ||
326 | - name: 'Unzip ${{ needs.msvc.outputs.VC-devel }}' | ||
327 | id: bin | ||
328 | run: | | ||
329 | mkdir '${{ github.workspace }}/vc' | ||
330 | cd '${{ github.workspace }}/vc' | ||
331 | unzip "${{ github.workspace }}/${{ needs.msvc.outputs.VC-devel }}" | ||
332 | echo "path=${{ github.workspace }}/vc/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$env:GITHUB_OUTPUT | ||
333 | - name: Set up ninja | ||
334 | uses: ./.github/actions/setup-ninja | ||
335 | - name: 'Configure vcvars x86' | ||
336 | uses: ilammy/msvc-dev-cmd@v1 | ||
337 | with: | ||
338 | arch: x64_x86 | ||
339 | - name: 'CMake (configure + build + tests) x86' | ||
340 | run: | | ||
341 | cmake -S "${{ steps.src.outputs.path }}/cmake/test" ` | ||
342 | -B build_x86 ` | ||
343 | -GNinja ` | ||
344 | -DCMAKE_BUILD_TYPE=Debug ` | ||
345 | -Werror=dev ` | ||
346 | -DTEST_FULL=TRUE ` | ||
347 | -DTEST_STATIC=FALSE ` | ||
348 | -DTEST_SHARED=TRUE ` | ||
349 | -DTEST_TEST=TRUE ` | ||
350 | -DCMAKE_SUPPRESS_REGENERATION=TRUE ` | ||
351 | -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" | ||
352 | Start-Sleep -Seconds 2 | ||
353 | cmake --build build_x86 --config Release --verbose | ||
354 | ctest --test-dir build_x86 --no-tests=error -C Release --output-on-failure | ||
355 | - name: 'Configure vcvars x64' | ||
356 | uses: ilammy/msvc-dev-cmd@v1 | ||
357 | with: | ||
358 | arch: x64 | ||
359 | - name: 'CMake (configure + build + tests) x64' | ||
360 | run: | | ||
361 | cmake -S "${{ steps.src.outputs.path }}/cmake/test" ` | ||
362 | -B build_x64 ` | ||
363 | -GNinja ` | ||
364 | -DCMAKE_BUILD_TYPE=Debug ` | ||
365 | -Werror=dev ` | ||
366 | -DTEST_FULL=TRUE ` | ||
367 | -DTEST_STATIC=FALSE ` | ||
368 | -DTEST_SHARED=TRUE ` | ||
369 | -DTEST_TEST=TRUE ` | ||
370 | -DCMAKE_SUPPRESS_REGENERATION=TRUE ` | ||
371 | -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" | ||
372 | Start-Sleep -Seconds 2 | ||
373 | cmake --build build_x64 --config Release --verbose | ||
374 | ctest --test-dir build_x64 --no-tests=error -C Release --output-on-failure | ||
375 | - name: 'Configure vcvars arm64' | ||
376 | uses: ilammy/msvc-dev-cmd@v1 | ||
377 | with: | ||
378 | arch: x64_arm64 | ||
379 | - name: 'CMake (configure + build) arm64' | ||
380 | run: | | ||
381 | cmake -S "${{ steps.src.outputs.path }}/cmake/test" ` | ||
382 | -B build_arm64 ` | ||
383 | -GNinja ` | ||
384 | -DCMAKE_BUILD_TYPE=Debug ` | ||
385 | -Werror=dev ` | ||
386 | -DTEST_FULL=TRUE ` | ||
387 | -DTEST_STATIC=FALSE ` | ||
388 | -DTEST_SHARED=TRUE ` | ||
389 | -DTEST_TEST=TRUE ` | ||
390 | -DCMAKE_SUPPRESS_REGENERATION=TRUE ` | ||
391 | -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" | ||
392 | Start-Sleep -Seconds 2 | ||
393 | cmake --build build_arm64 --config Release --verbose | ||
394 | - name: 'CMake (configure + build) arm64ec' | ||
395 | run: | | ||
396 | cmake -S "${{ steps.src.outputs.path }}/cmake/test" ` | ||
397 | -B build_arm64ec ` | ||
398 | -GNinja ` | ||
399 | -DCMAKE_BUILD_TYPE=Debug ` | ||
400 | -Werror=dev ` | ||
401 | -DTEST_FULL=TRUE ` | ||
402 | -DTEST_STATIC=FALSE ` | ||
403 | -DTEST_SHARED=TRUE ` | ||
404 | -DTEST_TEST=TRUE ` | ||
405 | -DSDL_DISABLE_AVX=TRUE ` | ||
406 | -DSDL_DISABLE_AVX2=TRUE ` | ||
407 | -DSDL_DISABLE_AVX512F=TRUE ` | ||
408 | -DCMAKE_SUPPRESS_REGENERATION=TRUE ` | ||
409 | -DCMAKE_C_FLAGS="/arm64EC" ` | ||
410 | -DCMAKE_CXX_FLAGS="/arm64EC" ` | ||
411 | -DCMAKE_EXE_LINKER_FLAGS="/MACHINE:ARM64EC" ` | ||
412 | -DCMAKE_SHARED_LINKER_FLAGS="/MACHINE:ARM64EC" ` | ||
413 | -DCMAKE_STATIC_LINKER_FLAGS="/MACHINE:ARM64EC" ` | ||
414 | -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" | ||
415 | Start-Sleep -Seconds 2 | ||
416 | cmake --build build_arm64ec --config Release --verbose | ||
417 | |||
418 | mingw: | ||
419 | needs: [src] | ||
420 | runs-on: ubuntu-24.04 # FIXME: current ubuntu-latest ships an outdated mingw, replace with ubuntu-latest once 24.04 becomes the new default | ||
421 | outputs: | ||
422 | mingw-devel-tar-gz: ${{ steps.releaser.outputs.mingw-devel-tar-gz }} | ||
423 | mingw-devel-tar-xz: ${{ steps.releaser.outputs.mingw-devel-tar-xz }} | ||
424 | steps: | ||
425 | - name: 'Set up Python' | ||
426 | uses: actions/setup-python@v5 | ||
427 | with: | ||
428 | python-version: '3.11' | ||
429 | - name: 'Fetch build-release.py' | ||
430 | uses: actions/checkout@v4 | ||
431 | with: | ||
432 | sparse-checkout: 'build-scripts/build-release.py' | ||
433 | - name: 'Install Mingw toolchain' | ||
434 | run: | | ||
435 | sudo apt-get update -y | ||
436 | sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build | ||
437 | - name: 'Download source archives' | ||
438 | uses: actions/download-artifact@v4 | ||
439 | with: | ||
440 | name: sources | ||
441 | path: '${{ github.workspace }}' | ||
442 | - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}' | ||
443 | id: tar | ||
444 | run: | | ||
445 | mkdir -p /tmp/tardir | ||
446 | tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}" | ||
447 | echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT | ||
448 | - name: 'Build MinGW binary archives' | ||
449 | id: releaser | ||
450 | run: | | ||
451 | python build-scripts/build-release.py \ | ||
452 | --actions mingw \ | ||
453 | --commit ${{ inputs.commit }} \ | ||
454 | --root "${{ steps.tar.outputs.path }}" \ | ||
455 | --github \ | ||
456 | --debug | ||
457 | - name: 'Store MinGW archives' | ||
458 | uses: actions/upload-artifact@v4 | ||
459 | with: | ||
460 | name: mingw | ||
461 | path: '${{ github.workspace }}/dist' | ||
462 | |||
463 | mingw-verify: | ||
464 | needs: [mingw, src] | ||
465 | runs-on: ubuntu-latest | ||
466 | steps: | ||
467 | - name: 'Install Mingw toolchain' | ||
468 | run: | | ||
469 | sudo apt-get update -y | ||
470 | sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build | ||
471 | - name: 'Download source archives' | ||
472 | uses: actions/download-artifact@v4 | ||
473 | with: | ||
474 | name: sources | ||
475 | path: '${{ github.workspace }}' | ||
476 | - name: 'Download MinGW binaries' | ||
477 | uses: actions/download-artifact@v4 | ||
478 | with: | ||
479 | name: mingw | ||
480 | path: '${{ github.workspace }}' | ||
481 | - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}' | ||
482 | id: src | ||
483 | run: | | ||
484 | mkdir -p /tmp/tardir | ||
485 | tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}" | ||
486 | echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT | ||
487 | - name: 'Untar ${{ needs.mingw.outputs.mingw-devel-tar-gz }}' | ||
488 | id: bin | ||
489 | run: | | ||
490 | mkdir -p /tmp/mingw-tardir | ||
491 | tar -C /tmp/mingw-tardir -v -x -f "${{ github.workspace }}/${{ needs.mingw.outputs.mingw-devel-tar-gz }}" | ||
492 | echo "path=/tmp/mingw-tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT | ||
493 | - name: 'CMake (configure + build) i686' | ||
494 | run: | | ||
495 | cmake -S "${{ steps.src.outputs.path }}/cmake/test" \ | ||
496 | -DCMAKE_BUILD_TYPE="Release" \ | ||
497 | -DTEST_FULL=TRUE \ | ||
498 | -DTEST_STATIC=FALSE \ | ||
499 | -DTEST_TEST=TRUE \ | ||
500 | -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" \ | ||
501 | -DCMAKE_TOOLCHAIN_FILE="${{ steps.src.outputs.path }}/build-scripts/cmake-toolchain-mingw64-i686.cmake" \ | ||
502 | -DCMAKE_C_FLAGS="-DSDL_DISABLE_SSE4_2" \ | ||
503 | -Werror=dev \ | ||
504 | -B build_x86 | ||
505 | cmake --build build_x86 --config Release --verbose | ||
506 | - name: 'CMake (configure + build) x86_64' | ||
507 | run: | | ||
508 | cmake -S "${{ steps.src.outputs.path }}/cmake/test" \ | ||
509 | -DCMAKE_BUILD_TYPE="Release" \ | ||
510 | -DTEST_FULL=TRUE \ | ||
511 | -DTEST_STATIC=false \ | ||
512 | -DTEST_TEST=TRUE \ | ||
513 | -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" \ | ||
514 | -DCMAKE_TOOLCHAIN_FILE="${{ steps.src.outputs.path }}/build-scripts/cmake-toolchain-mingw64-x86_64.cmake" \ | ||
515 | -DCMAKE_C_FLAGS="-DSDL_DISABLE_SSE4_2" \ | ||
516 | -Werror=dev \ | ||
517 | -B build_x64 | ||
518 | cmake --build build_x64 --config Release --verbose | ||
519 | |||
520 | android: | ||
521 | needs: [src] | ||
522 | runs-on: ubuntu-latest | ||
523 | outputs: | ||
524 | android-aar: ${{ steps.releaser.outputs.android-aar }} | ||
525 | steps: | ||
526 | - name: 'Set up Python' | ||
527 | uses: actions/setup-python@v5 | ||
528 | with: | ||
529 | python-version: '3.11' | ||
530 | - name: 'Fetch build-release.py' | ||
531 | uses: actions/checkout@v4 | ||
532 | with: | ||
533 | sparse-checkout: 'build-scripts/build-release.py' | ||
534 | - name: 'Setup Android NDK' | ||
535 | uses: nttld/setup-ndk@v1 | ||
536 | with: | ||
537 | local-cache: true | ||
538 | ndk-version: r21e | ||
539 | - name: 'Setup Java JDK' | ||
540 | uses: actions/setup-java@v4 | ||
541 | with: | ||
542 | distribution: 'temurin' | ||
543 | java-version: '11' | ||
544 | - name: 'Install ninja' | ||
545 | run: | | ||
546 | sudo apt-get update -y | ||
547 | sudo apt-get install -y ninja-build | ||
548 | - name: 'Download source archives' | ||
549 | uses: actions/download-artifact@v4 | ||
550 | with: | ||
551 | name: sources | ||
552 | path: '${{ github.workspace }}' | ||
553 | - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}' | ||
554 | id: tar | ||
555 | run: | | ||
556 | mkdir -p /tmp/tardir | ||
557 | tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}" | ||
558 | echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT | ||
559 | - name: 'Build Android prefab binary archive(s)' | ||
560 | id: releaser | ||
561 | run: | | ||
562 | python build-scripts/build-release.py \ | ||
563 | --actions android \ | ||
564 | --commit ${{ inputs.commit }} \ | ||
565 | --root "${{ steps.tar.outputs.path }}" \ | ||
566 | --github \ | ||
567 | --debug | ||
568 | - name: 'Store Android archive(s)' | ||
569 | uses: actions/upload-artifact@v4 | ||
570 | with: | ||
571 | name: android | ||
572 | path: '${{ github.workspace }}/dist' | ||
573 | |||
574 | android-verify: | ||
575 | needs: [android, src] | ||
576 | runs-on: ubuntu-latest | ||
577 | steps: | ||
578 | - name: 'Set up Python' | ||
579 | uses: actions/setup-python@v5 | ||
580 | with: | ||
581 | python-version: '3.11' | ||
582 | - uses: actions/setup-java@v4 | ||
583 | with: | ||
584 | distribution: 'temurin' | ||
585 | java-version: '17' | ||
586 | - name: 'Download source archives' | ||
587 | uses: actions/download-artifact@v4 | ||
588 | with: | ||
589 | name: sources | ||
590 | path: '${{ github.workspace }}' | ||
591 | - name: 'Download Android .aar archive' | ||
592 | uses: actions/download-artifact@v4 | ||
593 | with: | ||
594 | name: android | ||
595 | path: '${{ github.workspace }}' | ||
596 | - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}' | ||
597 | id: src | ||
598 | run: | | ||
599 | mkdir -p /tmp/tardir | ||
600 | tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}" | ||
601 | echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT | ||
602 | - name: 'Extract Android SDK from AAR' | ||
603 | id: sdk | ||
604 | run: | | ||
605 | cd /tmp | ||
606 | unzip "${{ github.workspace }}/${{ needs.android.outputs.android-aar }}" | ||
607 | python "${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}.aar" -o /tmp/SDL3-android | ||
608 | echo "prefix=/tmp/SDL3-android" >>$GITHUB_OUTPUT | ||
609 | echo "sdl3-aar=/tmp/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}.aar" >>$GITHUB_OUTPUT | ||
610 | - name: 'CMake (configure + build) x86, x64, arm32, arm64' | ||
611 | run: | | ||
612 | android_abis="x86 x86_64 armeabi-v7a arm64-v8a" | ||
613 | for android_abi in ${android_abis}; do | ||
614 | echo "Configuring ${android_abi}..." | ||
615 | cmake -S "${{ steps.src.outputs.path }}/cmake/test" \ | ||
616 | -DTEST_FULL=TRUE \ | ||
617 | -DTEST_STATIC=FALSE \ | ||
618 | -DTEST_TEST=TRUE \ | ||
619 | -DCMAKE_PREFIX_PATH="${{ steps.sdk.outputs.prefix }}" \ | ||
620 | -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \ | ||
621 | -DANDROID_ABI=${android_abi} \ | ||
622 | -DCMAKE_BUILD_TYPE=Release \ | ||
623 | -B "${android_abi}" | ||
624 | echo "Building ${android_abi}..." | ||
625 | cmake --build "${android_abi}" --config Release --verbose | ||
626 | done | ||
627 | - name: 'Create gradle project' | ||
628 | id: create-gradle-project | ||
629 | run: | | ||
630 | python ${{ steps.src.outputs.path }}/build-scripts/create-android-project.py \ | ||
631 | org.libsdl.testspriteminimal \ | ||
632 | ${{ steps.src.outputs.path }}/test/testspriteminimal.c \ | ||
633 | ${{ steps.src.outputs.path }}/test/icon.h \ | ||
634 | --variant aar \ | ||
635 | --output "/tmp/projects" | ||
636 | echo "path=/tmp/projects/org.libsdl.testspriteminimal" >>$GITHUB_OUTPUT | ||
637 | - name: 'Copy SDL3 aar into Gradle project' | ||
638 | run: | | ||
639 | cp "${{ steps.sdk.outputs.sdl3-aar }}" "${{ steps.create-gradle-project.outputs.path }}/app/libs" | ||
640 | |||
641 | echo "" | ||
642 | echo "Project contents:" | ||
643 | echo "" | ||
644 | find "${{ steps.create-gradle-project.outputs.path }}" | ||
645 | - name: 'Build app (Gradle & CMake)' | ||
646 | run: | | ||
647 | cd "${{ steps.create-gradle-project.outputs.path }}" | ||
648 | ./gradlew -i assembleRelease -Pandroid.native.buildOutput=verbose -PBUILD_WITH_CMAKE=1 | ||
649 | - name: 'Build app (Gradle & ndk-build)' | ||
650 | run: | | ||
651 | cd "${{ steps.create-gradle-project.outputs.path }}" | ||
652 | ./gradlew -i assembleRelease -Pandroid.native.buildOutput=verbose | ||