diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index a8adbea8..730979cf 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -50,7 +50,7 @@ jobs: - name: Build native libraries run: | - bash ./platforms/build-android.sh ${{ matrix.config.arch }} complete_rebuild release + bash ./platforms/build-android.sh ${{ matrix.config.arch }} complete_rebuild release CI cp -r ./assets/ platforms/android/app/src/main - name: Build APK diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1376f987..5efb93f5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,6 +21,7 @@ jobs: environment: msvc shell: pwsh static: false + fatal_warnings: false # TODO: enable fatal warnings, once cpp-httplib is patched either by ourselves or by the maintainers - name: Windows MSVC (static) os: windows @@ -28,6 +29,7 @@ jobs: environment: msvc shell: pwsh static: true + fatal_warnings: false # TODO: enable fatal warnings, once cpp-httplib is patched either by ourselves or by the maintainers - name: Windows MingGW os: windows @@ -35,6 +37,7 @@ jobs: environment: mingw architecture: x86_64 shell: 'msys2 {0}' + fatal_warnings: true - name: Windows UCRT os: windows @@ -42,6 +45,7 @@ jobs: environment: ucrt architecture: ucrt-x86_64 shell: 'msys2 {0}' + fatal_warnings: true - name: Linux (ARM64) os: ubuntu @@ -49,6 +53,7 @@ jobs: use-clang: false arm: true shell: bash + fatal_warnings: true - name: Linux os: ubuntu @@ -56,6 +61,7 @@ jobs: use-clang: false arm: false shell: bash + fatal_warnings: true - name: Linux Clang (libstdc++) os: ubuntu @@ -64,6 +70,7 @@ jobs: use-clang_stdlib: false arm: false shell: bash + fatal_warnings: true - name: Linux Clang (libc++) os: ubuntu @@ -72,18 +79,21 @@ jobs: use-clang_stdlib: true arm: false shell: bash + fatal_warnings: true - name: MacOS os: macos os-version: 13 arm: false shell: bash + fatal_warnings: true - name: MacOS (Arm64) os: macos os-version: 14 arm: true shell: bash + fatal_warnings: true defaults: run: @@ -199,7 +209,7 @@ jobs: brew install sdl2 sdl2_ttf sdl2_mixer sdl2_image - name: Configure - run: meson setup build -Dbuildtype=release -Ddefault_library=${{( matrix.config.os == 'windows' && matrix.config.environment == 'msvc' && matrix.config.static ) && 'static' ||'shared' }} -Dclang_libcpp=${{ ( ( matrix.config.os == 'ubuntu' && matrix.config.use-clang == true && matrix.config.use-clang_stdlib ) || matrix.config.os == 'macos' ) && 'enabled' || 'disabled' }} + run: meson setup build -Dbuildtype=release -Ddefault_library=${{( matrix.config.os == 'windows' && matrix.config.environment == 'msvc' && matrix.config.static ) && 'static' ||'shared' }} -Dclang_libcpp=${{ ( ( matrix.config.os == 'ubuntu' && matrix.config.use-clang == true && matrix.config.use-clang_stdlib ) || matrix.config.os == 'macos' ) && 'enabled' || 'disabled' }} -Drun_in_ci=true ${{( matrix.config.fatal_warnings ) && '--fatal-meson-warnings' || '' }} - name: Build run: meson compile -C build diff --git a/.github/workflows/flatpak.yml b/.github/workflows/flatpak.yml index fbd79e57..57e8baab 100644 --- a/.github/workflows/flatpak.yml +++ b/.github/workflows/flatpak.yml @@ -28,7 +28,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: flathub-infra/flatpak-github-actions/flatpak-builder@9386d85446c0f8c6b93dea3774002af2abcac3d5 + - uses: flatpak/flatpak-github-actions/flatpak-builder@v6 with: bundle: oopetris.flatpak manifest-path: io.github.openbrickprotocolfoundation.oopetris.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ad4814af..448d3dcc 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -34,7 +34,7 @@ jobs: sudo apt-get update sudo apt-get install ninja-build libsdl2-2.0-0 libsdl2-dev libsdl2-ttf* libsdl2-mixer* libsdl2-image* desktop-file-utils -y --no-install-recommends - meson setup build -Dbuildtype=release -Dclang_libcpp=disabled -Dtests=true + meson setup build -Dbuildtype=release -Dclang_libcpp=disabled -Dtests=true -Drun_in_ci=true --fatal-meson-warnings meson compile -C build git_version.hpp - uses: cpp-linter/cpp-linter-action@v2 diff --git a/.github/workflows/musl.yml b/.github/workflows/musl.yml index 70d7f281..bf35bd61 100644 --- a/.github/workflows/musl.yml +++ b/.github/workflows/musl.yml @@ -41,7 +41,7 @@ jobs: fetch-depth: '0' - name: Configure - run: meson setup build -Dbuildtype=release -Ddefault_library=shared -Dclang_libcpp=${{ ( matrix.config.use-clang == true && matrix.config.use-clang_stdlib ) && 'enabled' || 'disabled' }} + run: meson setup build -Dbuildtype=release -Ddefault_library=shared -Dclang_libcpp=${{ ( matrix.config.use-clang == true && matrix.config.use-clang_stdlib ) && 'enabled' || 'disabled' }} -Drun_in_ci=true --fatal-meson-warnings - name: Build run: meson compile -C build diff --git a/.github/workflows/nintendo.yml b/.github/workflows/nintendo.yml index 4598034b..da1f5de5 100644 --- a/.github/workflows/nintendo.yml +++ b/.github/workflows/nintendo.yml @@ -11,7 +11,7 @@ jobs: name: Nintendo ${{ matrix.config.name }} CI runs-on: ubuntu-24.04 container: - image: devkitpro/${{ matrix.config.container }} ## base on debian:buster-slim + image: devkitpro/${{ matrix.config.container }}:${{ matrix.config.revision }} ## based on debian:buster-slim strategy: fail-fast: false matrix: @@ -19,10 +19,12 @@ jobs: - name: 3ds extension: 3dsx container: devkitarm + revision: "20250102" - name: switch extension: nro container: devkita64 + revision: "20241023" steps: - uses: actions/checkout@v4 @@ -43,7 +45,7 @@ jobs: - name: Configure and Build run: | - bash ./platforms/build-${{ matrix.config.name }}.sh complete_rebuild release + bash ./platforms/build-${{ matrix.config.name }}.sh complete_rebuild release CI - name: Upload artifacts uses: actions/upload-artifact@v4 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6f0894a1..9894eb1b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,7 +35,7 @@ jobs: sudo apt-get install ninja-build libsdl2-2.0-0 libsdl2-dev libsdl2-ttf* libsdl2-mixer* libsdl2-image* gcovr desktop-file-utils -y --no-install-recommends - name: Configure - run: meson setup build -Dbuildtype=debug -Db_coverage=true -Dtests=true -Dclang_libcpp=enabled + run: meson setup build -Dbuildtype=debug -Db_coverage=true -Dtests=true -Dclang_libcpp=enabled -Drun_in_ci=true --fatal-meson-warnings - name: Run tests run: meson test -C build --verbose diff --git a/.github/workflows/web_build.yml b/.github/workflows/web_build.yml index 0eaa2c7c..d3542fa8 100644 --- a/.github/workflows/web_build.yml +++ b/.github/workflows/web_build.yml @@ -29,7 +29,7 @@ jobs: - name: Build run: | - ENABLE_TESTING=1 bash ./platforms/build-web.sh + ENABLE_TESTING=1 bash ./platforms/build-web.sh complete_rebuild release CI # TODO upload page to gh-pages! - name: Upload artifacts diff --git a/.github/workflows/windows_installer.yml b/.github/workflows/windows_installer.yml index 2100a2ff..f3ed85aa 100644 --- a/.github/workflows/windows_installer.yml +++ b/.github/workflows/windows_installer.yml @@ -41,7 +41,8 @@ jobs: run: 7z x "-oC:/Program Files (x86)/NSIS" "${{ github.workspace }}/envar_plugin.zip" - name: Configure - run: meson setup build -Dbuildtype=release -Ddefault_library=shared -Dbuild_installer=true + run: meson setup build -Dbuildtype=release -Ddefault_library=shared -Dbuild_installer=true -Drun_in_ci=true + # TODO: enable fatal warnings, once cpp-httplib is patched either by ourselves or by the maintainers: --fatal-meson-warnings - name: Build installer run: | diff --git a/io.github.openbrickprotocolfoundation.oopetris.yml b/io.github.openbrickprotocolfoundation.oopetris.yml index 414010e3..e9644bb4 100644 --- a/io.github.openbrickprotocolfoundation.oopetris.yml +++ b/io.github.openbrickprotocolfoundation.oopetris.yml @@ -12,6 +12,8 @@ modules: - -Dbuild_installer=true - --libdir=lib - -Dtests=true + - --fatal-meson-warnings + - -Drun_in_ci=true # note we always want the CI checks in the case we built the flatpak - --force-fallback-for=fmt # note, the freedesktop sdk has this installed, but it is not copiable into the runtime, so we need to build it ourself, to be able to install it correctly builddir: true build-options: diff --git a/meson.options b/meson.options index 9902188b..1e99a7cd 100644 --- a/meson.options +++ b/meson.options @@ -25,3 +25,11 @@ option( value: false, description: 'if you only want to build the libs, enable this', ) + + +option( + 'run_in_ci', + type: 'boolean', + value: false, + description: 'enable this, if it is run in CI', +) diff --git a/platforms/build-3ds.sh b/platforms/build-3ds.sh index d1b71405..410316d8 100755 --- a/platforms/build-3ds.sh +++ b/platforms/build-3ds.sh @@ -2,6 +2,44 @@ set -e +## options: "smart, complete_rebuild" +export COMPILE_TYPE="smart" + +export BUILDTYPE="debug" + +export RUN_IN_CI="false" + +if [ "$#" -eq 0 ]; then + # nothing + echo "Using compile type '$COMPILE_TYPE'" +elif [ "$#" -eq 1 ]; then + COMPILE_TYPE="$1" +elif [ "$#" -eq 2 ]; then + COMPILE_TYPE="$1" + BUILDTYPE="$2" +elif [ "$#" -eq 3 ]; then + COMPILE_TYPE="$1" + BUILDTYPE="$2" + + if [ -z "$3" ]; then + RUN_IN_CI="false" + else + RUN_IN_CI="true" + fi +else + echo "Too many arguments given, expected 1, 2 or 3" + exit 1 +fi + +if [ "$COMPILE_TYPE" == "smart" ]; then + : # noop +elif [ "$COMPILE_TYPE" == "complete_rebuild" ]; then + : # noop +else + echo "Invalid COMPILE_TYPE, expected: 'smart' or 'complete_rebuild'" + exit 1 +fi + export DEVKITPRO="/opt/devkitpro" export ARCH_DEVKIT_FOLDER="$DEVKITPRO/devkitARM" export COMPILER_BIN="$ARCH_DEVKIT_FOLDER/bin" @@ -214,33 +252,6 @@ fi cd .. -## options: "smart, complete_rebuild" -export COMPILE_TYPE="smart" - -export BUILDTYPE="debug" - -if [ "$#" -eq 0 ]; then - # nothing - echo "Using compile type '$COMPILE_TYPE'" -elif [ "$#" -eq 1 ]; then - COMPILE_TYPE="$1" -elif [ "$#" -eq 2 ]; then - COMPILE_TYPE="$1" - BUILDTYPE="$2" -else - echo "Too many arguments given, expected 1 or 2" - exit 1 -fi - -if [ "$COMPILE_TYPE" == "smart" ]; then - : # noop -elif [ "$COMPILE_TYPE" == "complete_rebuild" ]; then - : # noop -else - echo "Invalid COMPILE_TYPE, expected: 'smart' or 'complete_rebuild'" - exit 1 -fi - if [ ! -d "$ROMFS" ]; then mkdir -p "$ROMFS" @@ -260,7 +271,9 @@ if [ "$COMPILE_TYPE" == "complete_rebuild" ] || [ ! -e "$BUILD_DIR" ]; then -Dcurl:unittests=disabled \ -Dcurl:bearer-auth=enabled \ -Dcurl:brotli=enabled \ - -Dcurl:libz=enabled + -Dcurl:libz=enabled \ + "-Drun_in_ci=$RUN_IN_CI" \ + --fatal-meson-warnings fi diff --git a/platforms/build-android.sh b/platforms/build-android.sh index 4ead5af1..309fd096 100755 --- a/platforms/build-android.sh +++ b/platforms/build-android.sh @@ -51,10 +51,12 @@ export COMPILE_TYPE="smart" export BUILDTYPE="debug" +export RUN_IN_CI="false" + if [ "$#" -eq 0 ]; then # nothing echo "Using all architectures" -elif [ "$#" -eq 1 ] || [ "$#" -eq 2 ] || [ "$#" -eq 3 ]; then +elif [ "$#" -eq 1 ] || [ "$#" -eq 2 ] || [ "$#" -eq 3 ] || [ "$#" -eq 4 ]; then ARCH=$1 FOUND="" @@ -77,10 +79,20 @@ elif [ "$#" -eq 1 ] || [ "$#" -eq 2 ] || [ "$#" -eq 3 ]; then elif [ "$#" -eq 3 ]; then COMPILE_TYPE="$2" BUILDTYPE="$3" + elif [ "$#" -eq 4 ]; then + COMPILE_TYPE="$2" + BUILDTYPE="$3" + + if [ -z "$4" ]; then + RUN_IN_CI="false" + else + RUN_IN_CI="true" + fi + fi else - echo "Too many arguments given, expected 1 ,2 or 3" + echo "Too many arguments given, expected 1, 2, 3 or 4" exit 1 fi @@ -270,7 +282,6 @@ for INDEX in "${ARCH_KEYS_INDEX[@]}"; do -DBUILD_SHARED_LIBS=OFF \ -DINSTALL_PKGCONFIG_MODULES=ON - cmake --build . cmake --install . @@ -436,7 +447,9 @@ EOF --cross-file "./platforms/crossbuild-android-$ARM_TARGET_ARCH.ini" \ "-Dbuildtype=$BUILDTYPE" \ -Dsdl2:use_hidapi=enabled \ - -Dclang_libcpp=disabled + -Dclang_libcpp=disabled \ + "-Drun_in_ci=$RUN_IN_CI" \ + --fatal-meson-warnings fi diff --git a/platforms/build-switch.sh b/platforms/build-switch.sh index 55810e6a..31ae71a7 100755 --- a/platforms/build-switch.sh +++ b/platforms/build-switch.sh @@ -2,6 +2,44 @@ set -e +## options: "smart, complete_rebuild" +export COMPILE_TYPE="smart" + +export BUILDTYPE="debug" + +export RUN_IN_CI="false" + +if [ "$#" -eq 0 ]; then + # nothing + echo "Using compile type '$COMPILE_TYPE'" +elif [ "$#" -eq 1 ]; then + COMPILE_TYPE="$1" +elif [ "$#" -eq 2 ]; then + COMPILE_TYPE="$1" + BUILDTYPE="$2" +elif [ "$#" -eq 3 ]; then + COMPILE_TYPE="$1" + BUILDTYPE="$2" + + if [ -z "$3" ]; then + RUN_IN_CI="false" + else + RUN_IN_CI="true" + fi +else + echo "Too many arguments given, expected 1, 2 or 3" + exit 1 +fi + +if [ "$COMPILE_TYPE" == "smart" ]; then + : # noop +elif [ "$COMPILE_TYPE" == "complete_rebuild" ]; then + : # noop +else + echo "Invalid COMPILE_TYPE, expected: 'smart' or 'complete_rebuild'" + exit 1 +fi + export DEVKITPRO="/opt/devkitpro" export ARCH_DEVKIT_FOLDER="$DEVKITPRO/devkitA64" export COMPILER_BIN="$ARCH_DEVKIT_FOLDER/bin" @@ -111,33 +149,6 @@ APP_ROMFS='$ROMFS' EOF -## options: "smart, complete_rebuild" -export COMPILE_TYPE="smart" - -export BUILDTYPE="debug" - -if [ "$#" -eq 0 ]; then - # nothing - echo "Using compile type '$COMPILE_TYPE'" -elif [ "$#" -eq 1 ]; then - COMPILE_TYPE="$1" -elif [ "$#" -eq 2 ]; then - COMPILE_TYPE="$1" - BUILDTYPE="$2" -else - echo "Too many arguments given, expected 1 or 2" - exit 1 -fi - -if [ "$COMPILE_TYPE" == "smart" ]; then - : # noop -elif [ "$COMPILE_TYPE" == "complete_rebuild" ]; then - : # noop -else - echo "Invalid COMPILE_TYPE, expected: 'smart' or 'complete_rebuild'" - exit 1 -fi - if [ ! -d "$ROMFS" ]; then mkdir -p "$ROMFS" @@ -157,7 +168,9 @@ if [ "$COMPILE_TYPE" == "complete_rebuild" ] || [ ! -e "$BUILD_DIR" ]; then -Dcurl:unittests=disabled \ -Dcurl:bearer-auth=enabled \ -Dcurl:brotli=enabled \ - -Dcurl:libz=enabled + -Dcurl:libz=enabled \ + "-Drun_in_ci=$RUN_IN_CI" \ + --fatal-meson-warnings fi diff --git a/platforms/build-web.sh b/platforms/build-web.sh index cd5f6905..eff79458 100755 --- a/platforms/build-web.sh +++ b/platforms/build-web.sh @@ -2,18 +2,59 @@ set -e +## options: "smart, complete_rebuild" +export COMPILE_TYPE="smart" + +export BUILDTYPE="debug" + +export RUN_IN_CI="false" + +if [ "$#" -eq 0 ]; then + # nothing + echo "Using compile type '$COMPILE_TYPE'" +elif [ "$#" -eq 1 ]; then + COMPILE_TYPE="$1" +elif [ "$#" -eq 2 ]; then + COMPILE_TYPE="$1" + BUILDTYPE="$2" +elif [ "$#" -eq 3 ]; then + COMPILE_TYPE="$1" + BUILDTYPE="$2" + + if [ -z "$3" ]; then + RUN_IN_CI="false" + else + RUN_IN_CI="true" + fi +else + echo "Too many arguments given, expected 1, 2 or 3" + exit 1 +fi + +if [ "$COMPILE_TYPE" == "smart" ]; then + : # noop +elif [ "$COMPILE_TYPE" == "complete_rebuild" ]; then + : # noop +else + echo "Invalid COMPILE_TYPE, expected: 'smart' or 'complete_rebuild'" + exit 1 +fi + if [ ! -d "toolchains" ]; then mkdir -p toolchains fi export EMSCRIPTEN_ROOT="$(pwd)/toolchains/emsdk" +export EMSCRIPTEN_RELEASE_TAG="4.0.8" + if [ ! -d "$EMSCRIPTEN_ROOT" ]; then git clone https://github.com/emscripten-core/emsdk.git "$EMSCRIPTEN_ROOT" + git -C "$EMSCRIPTEN_ROOT" checkout "$EMSCRIPTEN_RELEASE_TAG" fi -"$EMSCRIPTEN_ROOT/emsdk" install latest -"$EMSCRIPTEN_ROOT/emsdk" activate latest +"$EMSCRIPTEN_ROOT/emsdk" install "$EMSCRIPTEN_RELEASE_TAG" +"$EMSCRIPTEN_ROOT/emsdk" activate "$EMSCRIPTEN_RELEASE_TAG" EMSCRIPTEN_UPSTREAM_ROOT="$EMSCRIPTEN_ROOT/upstream/emscripten" @@ -112,33 +153,6 @@ APP_ROMFS='$ROMFS/assets/' EOF -## options: "smart, complete_rebuild" -export COMPILE_TYPE="smart" - -export BUILDTYPE="debug" - -if [ "$#" -eq 0 ]; then - # nothing - echo "Using compile type '$COMPILE_TYPE'" -elif [ "$#" -eq 1 ]; then - COMPILE_TYPE="$1" -elif [ "$#" -eq 2 ]; then - COMPILE_TYPE="$1" - BUILDTYPE="$2" -else - echo "Too many arguments given, expected 1 or 2" - exit 1 -fi - -if [ "$COMPILE_TYPE" == "smart" ]; then - : # noop -elif [ "$COMPILE_TYPE" == "complete_rebuild" ]; then - : # noop -else - echo "Invalid COMPILE_TYPE, expected: 'smart' or 'complete_rebuild'" - exit 1 -fi - if [ ! -d "$ROMFS" ]; then mkdir -p "$ROMFS" @@ -154,7 +168,9 @@ if [ "$COMPILE_TYPE" == "complete_rebuild" ] || [ ! -e "$BUILD_DIR" ]; then --cross-file "$CROSS_FILE" \ "-Dbuildtype=$BUILDTYPE" \ -Ddefault_library=static \ - -Dtests=false + -Dtests=false \ + "-Drun_in_ci=$RUN_IN_CI" \ + --fatal-meson-warnings fi diff --git a/platforms/emscripten/sdl2_image_port.diff b/platforms/emscripten/sdl2_image_port.diff index 6f765537..31f725a6 100644 --- a/platforms/emscripten/sdl2_image_port.diff +++ b/platforms/emscripten/sdl2_image_port.diff @@ -1,28 +1,24 @@ diff --git a/tools/ports/sdl2_image.py b/tools/ports/sdl2_image.py -index 7a7d0aa..145bc6d 100644 +index f4a358b..d1fea5d 100644 --- a/tools/ports/sdl2_image.py +++ b/tools/ports/sdl2_image.py -@@ -18,7 +18,8 @@ variants = { - } +@@ -18,6 +18,7 @@ variants = { OPTIONS = { -- 'formats': 'A comma separated list of formats (ex: --use-port=sdl2_image:formats=png,jpg)' -+ 'formats': 'A comma separated list of formats (ex: --use-port=sdl2_image:formats=png,jpg)', + 'formats': 'A comma separated list of formats (ex: --use-port=sdl2_image:formats=png,jpg)', + 'mt': 'use pthread' } SUPPORTED_FORMATS = {'avif', 'bmp', 'gif', 'jpg', 'jxl', 'lbm', 'pcx', 'png', -@@ -26,7 +27,8 @@ SUPPORTED_FORMATS = {'avif', 'bmp', 'gif', 'jpg', 'jxl', 'lbm', 'pcx', 'png', - +@@ -26,6 +27,7 @@ SUPPORTED_FORMATS = {'avif', 'bmp', 'gif', 'jpg', 'jxl', 'lbm', 'pcx', 'png', # user options (from --use-port) opts: Dict[str, Set] = { -- 'formats': set() -+ 'formats': set(), + 'formats': set(), + 'mt': 0 } -@@ -44,7 +46,7 @@ def get_lib_name(settings): +@@ -43,7 +45,7 @@ def get_lib_name(settings): libname = 'libSDL2_image' if formats != '': libname += '-' + formats @@ -31,7 +27,7 @@ index 7a7d0aa..145bc6d 100644 libname += '-mt' if settings.SUPPORT_LONGJMP == 'wasm': libname += '-wasm-sjlj' -@@ -76,7 +78,7 @@ def get(ports, settings, shared): +@@ -73,7 +75,7 @@ def get(ports, settings, shared): if 'jpg' in formats: flags += ['-sUSE_LIBJPEG'] @@ -40,7 +36,7 @@ index 7a7d0aa..145bc6d 100644 flags += ['-pthread'] if settings.SUPPORT_LONGJMP == 'wasm': -@@ -111,6 +113,12 @@ def handle_options(options, error_handler): +@@ -108,6 +110,12 @@ def handle_options(options, error_handler): else: opts['formats'].add(format) diff --git a/src/lobby/web_client.cpp b/src/lobby/web_client.cpp index fb81fe18..96def579 100644 --- a/src/lobby/web_client.cpp +++ b/src/lobby/web_client.cpp @@ -1,6 +1,7 @@ #include "./web_client.hpp" +#include #include // Note: this uses emscripten fetch @@ -150,7 +151,7 @@ namespace { emscripten_fetch_attr_t attr{}; emscripten_fetch_attr_init(&attr); - assert(method.size() <= (max_method_size - 1)); + ASSERT(method.size() <= (max_method_size - 1)); std::memcpy(attr.requestMethod, method.c_str(), method.size() + 1); //TODO(Totto): once the http Implementation "Interface" support async thing, use that: diff --git a/tools/dependencies/meson.build b/tools/dependencies/meson.build index 647ac776..6a7b4b38 100644 --- a/tools/dependencies/meson.build +++ b/tools/dependencies/meson.build @@ -297,6 +297,20 @@ if build_application } endif + ## the switch sdl2 packages are not findable with '--fatal-meson-warnings' and cmake, so prefind it and than override the dependency + if (meson.is_cross_build() and host_machine.system() == 'switch') + sdl2_ttf_switch_dep = dependency( + 'sdl2_ttf', + 'SDL2_ttf', + method: 'pkg-config', + allow_fallback: not only_allow_native_libs, + required: true, + ) + + meson.override_dependency('sdl2_ttf', sdl2_ttf_switch_dep) + + endif + sdl2_ttf_dep = dependency( 'sdl2_ttf', 'SDL2_ttf', diff --git a/tools/options/meson.build b/tools/options/meson.build index a1e40bf2..d2492e03 100644 --- a/tools/options/meson.build +++ b/tools/options/meson.build @@ -23,6 +23,134 @@ graphics_lib = { 'deps': [], } +# check if running in CI, than we only support certain versions, this helps in checking if the Ci installs the correct tool version in e.g. msys2 +if get_option('run_in_ci') + + c = meson.get_compiler('c') + + system_name = host_machine.system() + + if meson.is_cross_build() + system_name = 'cross_' + host_machine.system() + + endif + + # Detect if compiling in an MSYS2-based MinGW/Clang environment + host_is_msys2 = host_machine.system() == 'windows' and c.get_argument_syntax() == 'gcc' + if host_is_msys2 + system_name = 'msys2' + endif + + clang_19_compiler = { + 'id': 'clang', + 'checks': ['>=19', '<20'], + } + clang_20_compiler = { + 'id': 'clang', + 'checks': ['>=20', '<21'], + } + + gcc_14_compiler = { + 'id': 'gcc', + 'checks': ['>=14', '<15'], + } + + msvc_compiler_current = { + 'id': 'msvc', + 'checks': ['>=19.43', '<20'], + } + + emscripten_compiler_current = { + 'id': 'emscripten', + 'checks': ['>=4', '<5'], + } + + ci_config = { + 'cross_android': { + 'compilers': [clang_20_compiler], + }, + 'cross_3ds': { + 'compilers': [gcc_14_compiler], + }, + 'cross_switch': { + 'compilers': [gcc_14_compiler], + }, + 'cross_emscripten': { + 'compilers': [emscripten_compiler_current], + }, + 'windows': { + 'compilers': [msvc_compiler_current], + }, + 'msys2': { + # TODO: this needs to be 14, but we can't pin the package atm, see https://github.com/OpenBrickProtocolFoundation/oopetris/pull/224 + 'compilers': [ + { + 'id': 'gcc', + 'checks': ['>=15', '<16'], + }, + ], + }, + 'linux': { + 'compilers': [clang_19_compiler, gcc_14_compiler], + }, + 'darwin': { + 'compilers': [clang_19_compiler], + }, + } + + if not ci_config.has_key(system_name) + error('CI config doesn\'t know what to expect from the system "' + system_name + '"') + endif + + config_for_system = ci_config.get(system_name) + + compilers_for_system = config_for_system.get('compilers', []) + + if compilers_for_system.length() == 0 + error('Expected the CI config to have at least one compiler') + endif + + found_compiler_for_ci_config = false + + foreach compiler_for_system : compilers_for_system + compiler_for_system_name = compiler_for_system.get('id') + version_checks_for_compiler = compiler_for_system.get('checks') + + if c.get_id() != compiler_for_system_name + continue + endif + + found_compiler_for_ci_config = true + + if version_checks_for_compiler.length() == 0 + error('Expected the version checks for a compiler to not be empty') + endif + + compiler_version = c.version() + + foreach version_check_for_compiler : version_checks_for_compiler + + if not compiler_version.version_compare(version_check_for_compiler) + error( + 'The compiler "' + c.get_id() + '" with version "' + compiler_version + '" doesn\'t meet the version check "' + version_check_for_compiler + '"' + ) + endif + + endforeach + + + endforeach + + if not found_compiler_for_ci_config + error( + 'Couldn\'t find a valid compiler for the CI config, compiler was: "' + c.get_id() + '"' + ) + endif + +endif + + + if meson.is_cross_build() and host_machine.system() == 'serenity' temp = core_lib.get('compile_args') temp += ['-D__SERENITY__', '-DINSTALL_FILES', '-DINSTALL_LOCATION=' + get_option('prefix')]