forked from danprice142/Cemu-Libretro
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
243 lines (231 loc) · 10.9 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
243 lines (231 loc) · 10.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
# DESCRIPTION: GitLab CI/CD for libRetro (NOT FOR GitLab-proper)
##############################################################################
################################# BOILERPLATE ################################
##############################################################################
# Core definitions
.core-defs:
variables:
CORENAME: cemu
# CMake writes cemu_libretro.so to <source>/bin (see src/CMakeLists.txt),
# which is outside of BUILD_DIR, so climb back out of build/linux-$ARCH.
EXTRA_PATH: ../../bin
CORE_ARGS: >-
-DENABLE_LIBRETRO=ON
-DENABLE_BLUEZ=OFF
-DENABLE_FERAL_GAMEMODE=OFF
# Cemu is C++20; the image default compiler is too old for it.
CC: gcc-12
CXX: g++-12
# arm64-linux is a community triplet - vcpkg ships no prebuilt tools for it
# and has to use the ones from the image.
VCPKG_FORCE_SYSTEM_BINARIES: 1
variables:
GIT_SUBMODULE_STRATEGY: recursive
# Inclusion templates, required for the build to work
include:
################################## DESKTOPS ################################
# Linux
- project: 'libretro-infrastructure/ci-templates'
file: '/linux-cmake.yml'
# Windows
- project: 'libretro-infrastructure/ci-templates'
file: '/windows-cmake-mingw.yml'
################################## CELLULAR ################################
# Android
- project: 'libretro-infrastructure/ci-templates'
file: '/android-cmake.yml'
# Stages for building
stages:
- build-prepare
- build-shared
##############################################################################
#################################### STAGES ##################################
##############################################################################
#
################################### DESKTOPS #################################
# Both Linux jobs want the same packages and the same extra time, and a job
# defining before_script replaces the template's instead of adding to it - so
# the repeated part lives here.
.core-defs-linux:
extends: .core-defs
# vcpkg builds every dependency from source (~30 ports, Boost among them),
# which does not fit in the default one hour.
timeout: 3h
variables:
# Wayland is dead weight in a core build and the x86_64 image cannot even
# satisfy it: find_package(WaylandProtocols 1.15) fails there against the
# image's 1.13. HAS_WAYLAND only reaches wxgui - which ENABLE_LIBRETRO
# forces off - and VulkanRenderer's surface creation, which returns before
# any of it in libretro mode, where the frontend hands the core a surface.
CORE_ARGS: >-
-DENABLE_LIBRETRO=ON
-DENABLE_BLUEZ=OFF
-DENABLE_FERAL_GAMEMODE=OFF
-DENABLE_WAYLAND=OFF
before_script:
# Repeated from .libretro-linux-cmake, whose before_script this replaces.
- export NUMPROC=$(($(nproc)/5))
- if builtin type -P ccache &> /dev/null; then ccache -V &> /dev/null; fi
# libdbus-1-dev is not optional here: dependencies/vcpkg_overlay_ports_linux/dbus
# is an empty package on purpose (see the portfile), so sdl2[dbus] has only
# the system headers to build against. The rest is what the other vcpkg
# ports (SDL2, libusb) and the core itself (GL/EGL/X11) need.
- apt-get update -qq
- apt-get install -y --no-install-recommends
nasm autoconf automake libtool pkg-config python3
libglm-dev libgl1-mesa-dev libegl1-mesa-dev
libx11-dev libxext-dev libxrandr-dev libxi-dev libxcursor-dev
libxss-dev libxkbcommon-dev libwayland-dev wayland-protocols
libudev-dev libdbus-1-dev libgcrypt20-dev
# Linux aarch64
libretro-build-linux-aarch64:
extends:
- .libretro-linux-cmake-aarch64
- .core-defs-linux
# Linux x86_64
libretro-build-linux-x64:
extends:
- .libretro-linux-cmake-x86_64
- .core-defs-linux
# The template's x86_64 image is Ubuntu Xenial with GCC 9, which cannot build
# C++20 at all; backports is the same family of image with newer compilers,
# gcc-12 among them (the same one the aarch64 image is held to).
image: $CI_SERVER_HOST:5050/libretro-infrastructure/libretro-build-amd64-ubuntu:backports
before_script:
- !reference [.core-defs-linux, before_script]
# x64-linux is a first-class triplet, so let vcpkg fetch its own cmake and
# ninja rather than holding it to whatever the image ships. That variable
# belongs to the aarch64 job, where the community triplet has no prebuilt
# tools to fetch; here it only gets in the way.
- unset VCPKG_FORCE_SYSTEM_BINARIES
# Windows x86_64
# Windows has only ever been built with MSVC so far (the GitHub Actions workflow
# does that on windows-2022, and the CMakeLists' Windows bits - SEH exception
# handler, /WHOLEARCHIVE, the MSVC runtime property - are written for it). This
# cross build with MXE's MinGW is new ground, on top of a vcpkg dependency set
# that has never been brought up for the mingw triplet, so keep it from failing
# the pipeline while it is worked out.
libretro-build-windows-x64:
extends:
- .libretro-windows-cmake-x86_64
- .core-defs
allow_failure: true
# Same reason as the Linux jobs: everything is built from source.
timeout: 3h
before_script:
# Repeated from .libretro-windows-cmake, whose before_script this replaces.
- export NUMPROC=$(($(nproc)/5))
- if builtin type -P ccache &> /dev/null; then ccache -V &> /dev/null; fi
# The host here is x86_64 Linux, the same as in the Linux x64 job above.
- unset VCPKG_FORCE_SYSTEM_BINARIES
# .core-defs asks for gcc-12, a package name from the Ubuntu images. The
# compilers here come from MXE's cmake wrapper
# (x86_64-w64-mingw32.static-cmake), which the top-level CMakeLists hands to
# vcpkg as a chainload toolchain; leaving CC/CXX set would only mislead the
# ports that build with their own configure scripts.
- unset CC CXX
# What the ports configure with; the MXE image carries the cross toolchain
# and not much else.
- apt-get update -qq
- apt-get install -y --no-install-recommends
nasm autoconf automake libtool pkg-config python3
# vcpkg builds the ports with its own scripts/toolchains/mingw.cmake (the
# chainload set in CMakeLists only covers the core's own build), and that
# file looks the compiler up as x86_64-w64-mingw32-gcc. MXE spells its
# tools x86_64-w64-mingw32.static-gcc, so the find_program() comes up empty
# and CMake falls back to the host cc/c++ - which is then handed MinGW link
# flags and dies on "ld: unrecognized option '--major-image-version'"
# before the first port is built. Give every MXE tool the name vcpkg looks
# for.
- |
for tool in /usr/lib/mxe/usr/bin/x86_64-w64-mingw32.static-*; do
[ -e "$tool" ] || continue
name=$(basename "$tool")
ln -sf "$tool" "/usr/local/bin/${name/.static-/-}"
done
variables:
# CMakeLists picks x64-windows-static as soon as WIN32 is set, which is an
# MSVC triplet; MinGW needs its own. A -D from the command line wins over
# the set(... CACHE) there, and the triplet is also what tells that code
# which port overlay to use, as WIN32 is not set yet on a Unix host.
CORE_ARGS: >-
-DENABLE_LIBRETRO=ON
-DENABLE_WXWIDGETS=OFF
-DENABLE_DISCORD_RPC=OFF
-DENABLE_CUBEB=OFF
-DVCPKG_TARGET_TRIPLET=x64-mingw-static
-DVCPKG_HOST_TRIPLET=x64-linux
################################### CELLULAR #################################
# Android is a fresh target for this core: unlike the Linux job it has to build
# the whole vcpkg dependency set for a cross triplet, and none of it has run
# before - so keep these from failing the pipeline while they are brought up.
.core-defs-android:
extends: .core-defs
allow_failure: true
# Same reason as the Linux job, plus a cross toolchain on top.
timeout: 3h
before_script:
# Repeated from the template, whose before_script this one replaces.
- export NUMPROC=$(($(nproc)/5))
# The Android image carries the SDK and the NDK and not much else, while
# vcpkg needs a host compiler for the x64-linux ports it builds first, the
# autotools most of its ports configure with, and make - the generator the
# template's cmake line falls back to. Without these the job dies in
# "Detecting compiler hash for triplet x64-linux" before anything is built.
- apt-get update -qq
- apt-get install -y --no-install-recommends
build-essential make ninja-build nasm autoconf automake libtool
pkg-config python3 zip unzip curl git ca-certificates
# .core-defs asks for gcc-12, which the Linux image has and this one does
# not. Leaving CC/CXX set to anything at all is worse than dropping them:
# the cmake ports ignore them and take the NDK's clang, but openssl builds
# with its own Configure and a makefile, which honours $CC and so feeds the
# clang flags to the host gcc ("unrecognized command-line option
# '--target=aarch64-none-linux-android28'"). Unset, openssl picks up the
# NDK clang the port puts on PATH and the host triplet - which only builds
# vcpkg's own helper tools - finds the image's cc, the same as on GitHub
# Actions, where neither variable is set to begin with.
- unset CC CXX
# The host here is x86_64, so vcpkg can fetch its own cmake and ninja
# instead of being held to the image's. That flag belongs to the aarch64
# Linux job, where the community triplet has no prebuilt tools to fetch.
- unset VCPKG_FORCE_SYSTEM_BINARIES
# The ports are built with vcpkg's own scripts/toolchains/android.cmake -
# the chainload set in CMakeLists only covers the core's own build - and
# that file looks the NDK up in ANDROID_NDK_HOME, falling back to Windows
# paths that do not exist here. The image calls it NDK_ROOT instead, so
# "Detecting compiler hash for triplet arm64-android" dies right there.
# (GitHub Actions runners set ANDROID_NDK_HOME, hence the green build.)
- export ANDROID_NDK_HOME="$NDK_ROOT"
- export ANDROID_NDK_ROOT="$NDK_ROOT"
variables:
# The template defaults to API 16, which is nowhere near enough for C++20.
# 28 is the floor that works: bionic only got iconv (SDL2 links it) and
# aligned_alloc there.
API_LEVEL: 28
# Cemu's CMakeLists hands the template's NDK toolchain to vcpkg as a
# chainload toolchain (see the comment there); this picks the triplet the
# ports are built for.
VCPKG_DEFAULT_TRIPLET: $VCPKG_TRIPLET
CORE_ARGS: >-
-DENABLE_LIBRETRO=ON
-DENABLE_BLUEZ=OFF
-DENABLE_FERAL_GAMEMODE=OFF
-DENABLE_WAYLAND=OFF
-DENABLE_DISCORD_RPC=OFF
-DVCPKG_TARGET_TRIPLET=$VCPKG_TRIPLET
-DVCPKG_HOST_TRIPLET=x64-linux
# Android aarch64
android-arm64-v8a:
extends:
- .libretro-android-cmake-arm64-v8a
- .core-defs-android
variables:
VCPKG_TRIPLET: arm64-android
# Android x86_64
android-x86_64:
extends:
- .libretro-android-cmake-x86_64
- .core-defs-android
variables:
VCPKG_TRIPLET: x64-android