From a230763d55220a28517967ae46a72b4eb7fc3454 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 13:04:19 +0200 Subject: [PATCH 01/20] feat: add option for meson, to know if we are running in Ci or not, enable it on every possible CI run --- .github/workflows/android.yml | 2 +- .github/workflows/build.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/musl.yml | 2 +- .github/workflows/nintendo.yml | 2 +- .github/workflows/test.yml | 2 +- .github/workflows/web_build.yml | 2 +- .github/workflows/windows_installer.yml | 2 +- ...b.openbrickprotocolfoundation.oopetris.yml | 1 + meson.options | 8 ++++++++ platforms/build-3ds.sh | 16 +++++++++++++-- platforms/build-android.sh | 20 +++++++++++++++---- platforms/build-switch.sh | 16 +++++++++++++-- 13 files changed, 61 insertions(+), 16 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index a8adbea82..730979cff 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 1376f987e..5f905aafc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -199,7 +199,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 - name: Build run: meson compile -C build diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ad4814afe..b269d890e 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 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 70d7f2813..48c1fe0d6 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 - name: Build run: meson compile -C build diff --git a/.github/workflows/nintendo.yml b/.github/workflows/nintendo.yml index 4598034b6..86f20e108 100644 --- a/.github/workflows/nintendo.yml +++ b/.github/workflows/nintendo.yml @@ -43,7 +43,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 6f0894a1f..7a3560208 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 - name: Run tests run: meson test -C build --verbose diff --git a/.github/workflows/web_build.yml b/.github/workflows/web_build.yml index 0eaa2c7c7..2f65faa8c 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 RUN_IN_CI=true bash ./platforms/build-web.sh # TODO upload page to gh-pages! - name: Upload artifacts diff --git a/.github/workflows/windows_installer.yml b/.github/workflows/windows_installer.yml index 2100a2ffa..b589997f8 100644 --- a/.github/workflows/windows_installer.yml +++ b/.github/workflows/windows_installer.yml @@ -41,7 +41,7 @@ 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 - name: Build installer run: | diff --git a/io.github.openbrickprotocolfoundation.oopetris.yml b/io.github.openbrickprotocolfoundation.oopetris.yml index 414010e34..94bcc6057 100644 --- a/io.github.openbrickprotocolfoundation.oopetris.yml +++ b/io.github.openbrickprotocolfoundation.oopetris.yml @@ -12,6 +12,7 @@ modules: - -Dbuild_installer=true - --libdir=lib - -Dtests=true + - -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 9902188b2..1e99a7cdb 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 d1b714055..79dee05de 100755 --- a/platforms/build-3ds.sh +++ b/platforms/build-3ds.sh @@ -219,6 +219,8 @@ export COMPILE_TYPE="smart" export BUILDTYPE="debug" +export RUN_IN_CI="false" + if [ "$#" -eq 0 ]; then # nothing echo "Using compile type '$COMPILE_TYPE'" @@ -227,8 +229,17 @@ elif [ "$#" -eq 1 ]; then 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 or 2" + echo "Too many arguments given, expected 1, 2 or 3" exit 1 fi @@ -260,7 +271,8 @@ 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" fi diff --git a/platforms/build-android.sh b/platforms/build-android.sh index 4ead5af1d..adba09baa 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,8 @@ 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" fi diff --git a/platforms/build-switch.sh b/platforms/build-switch.sh index 55810e6ac..3a2a2f58d 100755 --- a/platforms/build-switch.sh +++ b/platforms/build-switch.sh @@ -116,6 +116,8 @@ export COMPILE_TYPE="smart" export BUILDTYPE="debug" +export RUN_IN_CI="false" + if [ "$#" -eq 0 ]; then # nothing echo "Using compile type '$COMPILE_TYPE'" @@ -124,8 +126,17 @@ elif [ "$#" -eq 1 ]; then 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 or 2" + echo "Too many arguments given, expected 1, 2 or 3" exit 1 fi @@ -157,7 +168,8 @@ 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" fi From 08da21a6166b5604e8e6bd52fa40fa74b9d28667 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 13:20:30 +0200 Subject: [PATCH 02/20] feat: add Ci compiler checks, so that the Ci never uses a version, that it is not supposed to use --- tools/options/meson.build | 89 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/tools/options/meson.build b/tools/options/meson.build index a1e40bf20..dfff2daf4 100644 --- a/tools/options/meson.build +++ b/tools/options/meson.build @@ -23,6 +23,95 @@ 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 + + ci_config = { + 'cross_android': { + 'compilers': [['clang', ['>=20', '<21']]], + }, + 'cross_3ds': { + 'compilers': [['clang', ['>=20', '<21']]], + }, + 'cross_switch': { + 'compilers': [['clang', ['>=20', '<21']]], + }, + 'cross_emscripten': { + 'compilers': [['clang', ['>=20', '<21']]], + }, + 'windows': { + 'compilers': [['clang', ['>=20', '<21']]], + }, + 'linux': { + 'compilers': [['clang', ['>=20', '<21']]], + }, + 'darwin': { + 'compilers': [['clang', ['>=20', '<21']]], + }, + } + + 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[0] + version_checks_for_compiler = compiler_for_system[1] + + 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() + '" 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')] From caa3857c8c7dbb203e085e046a88c4713a7d650c Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 13:26:40 +0200 Subject: [PATCH 03/20] fix: refactor web-build.sh to correctly detect the option RUN_IN_CI --- .github/workflows/web_build.yml | 2 +- platforms/build-web.sh | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/web_build.yml b/.github/workflows/web_build.yml index 2f65faa8c..d3542fa85 100644 --- a/.github/workflows/web_build.yml +++ b/.github/workflows/web_build.yml @@ -29,7 +29,7 @@ jobs: - name: Build run: | - ENABLE_TESTING=1 RUN_IN_CI=true 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/platforms/build-web.sh b/platforms/build-web.sh index cd5f6905a..8e5a815f3 100755 --- a/platforms/build-web.sh +++ b/platforms/build-web.sh @@ -117,6 +117,8 @@ export COMPILE_TYPE="smart" export BUILDTYPE="debug" +export RUN_IN_CI="false" + if [ "$#" -eq 0 ]; then # nothing echo "Using compile type '$COMPILE_TYPE'" @@ -125,8 +127,17 @@ elif [ "$#" -eq 1 ]; then 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 or 2" + echo "Too many arguments given, expected 1, 2 or 3" exit 1 fi @@ -154,7 +165,8 @@ 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" fi From cd084f5496401842264921cb8883a6e56456a252 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 13:28:15 +0200 Subject: [PATCH 04/20] feat: add the flag "--fatal-meson-warnings" to every meson setup command --- .github/workflows/build.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/musl.yml | 2 +- .github/workflows/test.yml | 2 +- .github/workflows/windows_installer.yml | 2 +- io.github.openbrickprotocolfoundation.oopetris.yml | 1 + platforms/build-3ds.sh | 3 ++- platforms/build-android.sh | 3 ++- platforms/build-switch.sh | 3 ++- platforms/build-web.sh | 3 ++- 10 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5f905aafc..af527f0cc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -199,7 +199,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' }} -Drun_in_ci=true + 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 --fatal-meson-warnings - name: Build run: meson compile -C build diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b269d890e..448d3dcce 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 -Drun_in_ci=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 48c1fe0d6..bf35bd612 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' }} -Drun_in_ci=true + 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/test.yml b/.github/workflows/test.yml index 7a3560208..9894eb1b9 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 -Drun_in_ci=true + 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/windows_installer.yml b/.github/workflows/windows_installer.yml index b589997f8..bf697c3b1 100644 --- a/.github/workflows/windows_installer.yml +++ b/.github/workflows/windows_installer.yml @@ -41,7 +41,7 @@ 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 -Drun_in_ci=true + run: meson setup build -Dbuildtype=release -Ddefault_library=shared -Dbuild_installer=true -Drun_in_ci=true --fatal-meson-warnings - name: Build installer run: | diff --git a/io.github.openbrickprotocolfoundation.oopetris.yml b/io.github.openbrickprotocolfoundation.oopetris.yml index 94bcc6057..e9644bb42 100644 --- a/io.github.openbrickprotocolfoundation.oopetris.yml +++ b/io.github.openbrickprotocolfoundation.oopetris.yml @@ -12,6 +12,7 @@ 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 diff --git a/platforms/build-3ds.sh b/platforms/build-3ds.sh index 79dee05de..b7460fad5 100755 --- a/platforms/build-3ds.sh +++ b/platforms/build-3ds.sh @@ -272,7 +272,8 @@ if [ "$COMPILE_TYPE" == "complete_rebuild" ] || [ ! -e "$BUILD_DIR" ]; then -Dcurl:bearer-auth=enabled \ -Dcurl:brotli=enabled \ -Dcurl:libz=enabled \ - "-Drun_in_ci=$RUN_IN_CI" + "-Drun_in_ci=$RUN_IN_CI" \ + --fatal-meson-warnings fi diff --git a/platforms/build-android.sh b/platforms/build-android.sh index adba09baa..309fd096e 100755 --- a/platforms/build-android.sh +++ b/platforms/build-android.sh @@ -448,7 +448,8 @@ EOF "-Dbuildtype=$BUILDTYPE" \ -Dsdl2:use_hidapi=enabled \ -Dclang_libcpp=disabled \ - "-Drun_in_ci=$RUN_IN_CI" + "-Drun_in_ci=$RUN_IN_CI" \ + --fatal-meson-warnings fi diff --git a/platforms/build-switch.sh b/platforms/build-switch.sh index 3a2a2f58d..ac1330a38 100755 --- a/platforms/build-switch.sh +++ b/platforms/build-switch.sh @@ -169,7 +169,8 @@ if [ "$COMPILE_TYPE" == "complete_rebuild" ] || [ ! -e "$BUILD_DIR" ]; then -Dcurl:bearer-auth=enabled \ -Dcurl:brotli=enabled \ -Dcurl:libz=enabled \ - "-Drun_in_ci=$RUN_IN_CI" + "-Drun_in_ci=$RUN_IN_CI" \ + --fatal-meson-warnings fi diff --git a/platforms/build-web.sh b/platforms/build-web.sh index 8e5a815f3..d7264f1c8 100755 --- a/platforms/build-web.sh +++ b/platforms/build-web.sh @@ -166,7 +166,8 @@ if [ "$COMPILE_TYPE" == "complete_rebuild" ] || [ ! -e "$BUILD_DIR" ]; then "-Dbuildtype=$BUILDTYPE" \ -Ddefault_library=static \ -Dtests=false \ - "-Drun_in_ci=$RUN_IN_CI" + "-Drun_in_ci=$RUN_IN_CI" \ + --fatal-meson-warnings fi From 2c4074f909e9f1c4949fd7d8788744f87f085c69 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 13:28:33 +0200 Subject: [PATCH 05/20] fix: use correct flatpak action repo again, after it moving twice --- .github/workflows/flatpak.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/flatpak.yml b/.github/workflows/flatpak.yml index fbd79e57b..57e8baabc 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 From 904c7aa81f8c63a0252c9ca89a17573f56dda110 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 13:29:55 +0200 Subject: [PATCH 06/20] fix: move option parsing in shell scripts to the beginning, where possible --- platforms/build-3ds.sh | 76 +++++++++++++++++++-------------------- platforms/build-switch.sh | 76 +++++++++++++++++++-------------------- platforms/build-web.sh | 76 +++++++++++++++++++-------------------- 3 files changed, 114 insertions(+), 114 deletions(-) diff --git a/platforms/build-3ds.sh b/platforms/build-3ds.sh index b7460fad5..410316d8b 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,44 +252,6 @@ fi cd .. -## 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 "$ROMFS" ]; then mkdir -p "$ROMFS" diff --git a/platforms/build-switch.sh b/platforms/build-switch.sh index ac1330a38..31ae71a78 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,44 +149,6 @@ APP_ROMFS='$ROMFS' EOF -## 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 "$ROMFS" ]; then mkdir -p "$ROMFS" diff --git a/platforms/build-web.sh b/platforms/build-web.sh index d7264f1c8..107d9898f 100755 --- a/platforms/build-web.sh +++ b/platforms/build-web.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 + if [ ! -d "toolchains" ]; then mkdir -p toolchains fi @@ -112,44 +150,6 @@ APP_ROMFS='$ROMFS/assets/' EOF -## 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 "$ROMFS" ]; then mkdir -p "$ROMFS" From c112b759821cbdd8d2166fd561d6e5b6a7677532 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 19:16:38 +0200 Subject: [PATCH 07/20] fix: refactor compiler settings for CI detection --- tools/options/meson.build | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tools/options/meson.build b/tools/options/meson.build index dfff2daf4..62e9988bd 100644 --- a/tools/options/meson.build +++ b/tools/options/meson.build @@ -35,27 +35,30 @@ if get_option('run_in_ci') endif + clang_20_compiler = ['clang', ['>=20', '<21']] + gcc_14_compiler = ['gcc', ['>=14', '<15']] + ci_config = { 'cross_android': { - 'compilers': [['clang', ['>=20', '<21']]], + 'compilers': [clang_20_compiler], }, 'cross_3ds': { - 'compilers': [['clang', ['>=20', '<21']]], + 'compilers': [clang_20_compiler], }, 'cross_switch': { - 'compilers': [['clang', ['>=20', '<21']]], + 'compilers': [clang_20_compiler], }, 'cross_emscripten': { - 'compilers': [['clang', ['>=20', '<21']]], + 'compilers': [clang_20_compiler], }, 'windows': { - 'compilers': [['clang', ['>=20', '<21']]], + 'compilers': [clang_20_compiler], }, 'linux': { - 'compilers': [['clang', ['>=20', '<21']]], + 'compilers': [clang_20_compiler, gcc_14_compiler], }, 'darwin': { - 'compilers': [['clang', ['>=20', '<21']]], + 'compilers': [clang_20_compiler], }, } From 0fda4d5b71741969f742f12f958ecc807de92a0d Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 23:27:44 +0200 Subject: [PATCH 08/20] fix: use clang 19 as needed compiler, not clang 20 --- tools/options/meson.build | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/options/meson.build b/tools/options/meson.build index 62e9988bd..982ab76a6 100644 --- a/tools/options/meson.build +++ b/tools/options/meson.build @@ -35,30 +35,30 @@ if get_option('run_in_ci') endif - clang_20_compiler = ['clang', ['>=20', '<21']] + clang_19_compiler = ['clang', ['>=19', '<20']] gcc_14_compiler = ['gcc', ['>=14', '<15']] ci_config = { 'cross_android': { - 'compilers': [clang_20_compiler], + 'compilers': [clang_19_compiler], }, 'cross_3ds': { - 'compilers': [clang_20_compiler], + 'compilers': [clang_19_compiler], }, 'cross_switch': { - 'compilers': [clang_20_compiler], + 'compilers': [clang_19_compiler], }, 'cross_emscripten': { - 'compilers': [clang_20_compiler], + 'compilers': [clang_19_compiler], }, 'windows': { - 'compilers': [clang_20_compiler], + 'compilers': [clang_19_compiler], }, 'linux': { - 'compilers': [clang_20_compiler, gcc_14_compiler], + 'compilers': [clang_19_compiler, gcc_14_compiler], }, 'darwin': { - 'compilers': [clang_20_compiler], + 'compilers': [clang_19_compiler], }, } From dad8d85e3f9bc7d2e2b5f9f976ade19cc969bd7a Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 19:25:42 +0200 Subject: [PATCH 09/20] fix: fix more CI configs for current compilers --- tools/options/meson.build | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/options/meson.build b/tools/options/meson.build index 982ab76a6..d726e2d5b 100644 --- a/tools/options/meson.build +++ b/tools/options/meson.build @@ -37,22 +37,23 @@ if get_option('run_in_ci') clang_19_compiler = ['clang', ['>=19', '<20']] gcc_14_compiler = ['gcc', ['>=14', '<15']] + msvc_compiler_current = ['msvc', ['>=19.43', '<20']] ci_config = { 'cross_android': { 'compilers': [clang_19_compiler], }, 'cross_3ds': { - 'compilers': [clang_19_compiler], + 'compilers': [clang_19_compiler, gcc_14_compiler], }, 'cross_switch': { - 'compilers': [clang_19_compiler], + 'compilers': [clang_19_compiler, gcc_14_compiler], }, 'cross_emscripten': { 'compilers': [clang_19_compiler], }, 'windows': { - 'compilers': [clang_19_compiler], + 'compilers': [msvc_compiler_current], }, 'linux': { 'compilers': [clang_19_compiler, gcc_14_compiler], From f44de024175f433e80c701a357e51eb8d3179103 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 19:26:11 +0200 Subject: [PATCH 10/20] feat: add container revision tags for nintendo CI --- .github/workflows/nintendo.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nintendo.yml b/.github/workflows/nintendo.yml index 86f20e108..bd27cbe41 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: latest - name: switch extension: nro container: devkita64 + revision: latest steps: - uses: actions/checkout@v4 From 7a4921e5b62f27e8f2ab1d07da0de3e2c9b071a5 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 19:29:46 +0200 Subject: [PATCH 11/20] fix: use container images with gcc-14 for nintendo CI --- .github/workflows/nintendo.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nintendo.yml b/.github/workflows/nintendo.yml index bd27cbe41..da1f5de58 100644 --- a/.github/workflows/nintendo.yml +++ b/.github/workflows/nintendo.yml @@ -19,12 +19,12 @@ jobs: - name: 3ds extension: 3dsx container: devkitarm - revision: latest + revision: "20250102" - name: switch extension: nro container: devkita64 - revision: latest + revision: "20241023" steps: - uses: actions/checkout@v4 From 3049d07eb4ea3de939a940c2c7cf25154f8e6e56 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 19:32:42 +0200 Subject: [PATCH 12/20] fix: refactor the ci config meson code, to be easier to read --- tools/options/meson.build | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/tools/options/meson.build b/tools/options/meson.build index d726e2d5b..3b43b3daa 100644 --- a/tools/options/meson.build +++ b/tools/options/meson.build @@ -35,9 +35,18 @@ if get_option('run_in_ci') endif - clang_19_compiler = ['clang', ['>=19', '<20']] - gcc_14_compiler = ['gcc', ['>=14', '<15']] - msvc_compiler_current = ['msvc', ['>=19.43', '<20']] + clang_19_compiler = { + 'id': 'clang', + 'checks': ['>=19', '<20'], + } + gcc_14_compiler = { + 'id': 'gcc', + 'checks': ['>=14', '<15'], + } + msvc_compiler_current = { + 'id': 'msvc', + 'checks': ['>=19.43', '<20'], + } ci_config = { 'cross_android': { @@ -78,8 +87,8 @@ if get_option('run_in_ci') found_compiler_for_ci_config = false foreach compiler_for_system : compilers_for_system - compiler_for_system_name = compiler_for_system[0] - version_checks_for_compiler = compiler_for_system[1] + 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 @@ -97,7 +106,7 @@ if get_option('run_in_ci') if not compiler_version.version_compare(version_check_for_compiler) error( - 'The compiler "' + c.get_id() + '" doesn\'t meet the version check ' + version_check_for_compiler + 'The compiler "' + c.get_id() + '" doesn\'t meet the version check "' + version_check_for_compiler + '"' ) endif From 6382aeb316be65e72bda09a2787a3665e5a61afd Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 19:46:51 +0200 Subject: [PATCH 13/20] fix: fix emscripten patch for sdl2_image --- platforms/emscripten/sdl2_image_port.diff | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/platforms/emscripten/sdl2_image_port.diff b/platforms/emscripten/sdl2_image_port.diff index 6f765537f..31f725a62 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) From 3e55f3d2b92852400fa6c5f47f153507b3af5065 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 19:47:08 +0200 Subject: [PATCH 14/20] fix: pin emscripten and emsdk to a release, so that it has to be updated manually --- platforms/build-web.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/platforms/build-web.sh b/platforms/build-web.sh index 107d9898f..eff794580 100755 --- a/platforms/build-web.sh +++ b/platforms/build-web.sh @@ -46,12 +46,15 @@ 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" From b4376c3ce3d6304bf63a4ef5360e69d60d3e62ae Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 19:53:21 +0200 Subject: [PATCH 15/20] fix: correctly handle msys2 in CI config checks --- tools/options/meson.build | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tools/options/meson.build b/tools/options/meson.build index 3b43b3daa..095c161a2 100644 --- a/tools/options/meson.build +++ b/tools/options/meson.build @@ -35,6 +35,12 @@ if get_option('run_in_ci') 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'], @@ -53,10 +59,10 @@ if get_option('run_in_ci') 'compilers': [clang_19_compiler], }, 'cross_3ds': { - 'compilers': [clang_19_compiler, gcc_14_compiler], + 'compilers': [gcc_14_compiler], }, 'cross_switch': { - 'compilers': [clang_19_compiler, gcc_14_compiler], + 'compilers': [gcc_14_compiler], }, 'cross_emscripten': { 'compilers': [clang_19_compiler], @@ -64,6 +70,15 @@ if get_option('run_in_ci') '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], }, From 48314e2b9dbf4d7f4601b74cf8777a249ba0f1b7 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 19:55:08 +0200 Subject: [PATCH 16/20] fix: use clang 20 for android, as the ndk we use, already uses that --- tools/options/meson.build | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/options/meson.build b/tools/options/meson.build index 095c161a2..4777150d3 100644 --- a/tools/options/meson.build +++ b/tools/options/meson.build @@ -45,10 +45,16 @@ if get_option('run_in_ci') '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'], @@ -56,7 +62,7 @@ if get_option('run_in_ci') ci_config = { 'cross_android': { - 'compilers': [clang_19_compiler], + 'compilers': [clang_20_compiler], }, 'cross_3ds': { 'compilers': [gcc_14_compiler], From 7d928b2218ab00b3bac14462ba391f7e038f62e0 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 22:19:41 +0200 Subject: [PATCH 17/20] fix: fix the web compiler check in the CI config --- tools/options/meson.build | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/options/meson.build b/tools/options/meson.build index 4777150d3..d2492e032 100644 --- a/tools/options/meson.build +++ b/tools/options/meson.build @@ -60,6 +60,11 @@ if get_option('run_in_ci') 'checks': ['>=19.43', '<20'], } + emscripten_compiler_current = { + 'id': 'emscripten', + 'checks': ['>=4', '<5'], + } + ci_config = { 'cross_android': { 'compilers': [clang_20_compiler], @@ -71,7 +76,7 @@ if get_option('run_in_ci') 'compilers': [gcc_14_compiler], }, 'cross_emscripten': { - 'compilers': [clang_19_compiler], + 'compilers': [emscripten_compiler_current], }, 'windows': { 'compilers': [msvc_compiler_current], @@ -127,7 +132,7 @@ if get_option('run_in_ci') if not compiler_version.version_compare(version_check_for_compiler) error( - 'The compiler "' + c.get_id() + '" doesn\'t meet the version check "' + version_check_for_compiler + '"' + 'The compiler "' + c.get_id() + '" with version "' + compiler_version + '" doesn\'t meet the version check "' + version_check_for_compiler + '"' ) endif From 36100ccc8cde6578089df51369e7f28244c630eb Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 22:30:09 +0200 Subject: [PATCH 18/20] fix: fix switch compilation with fatal warnings --- tools/dependencies/meson.build | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/dependencies/meson.build b/tools/dependencies/meson.build index 647ac7766..6a7b4b38c 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', From 41ca45eb4c74396ecde07c1336078d2a82fe51c9 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 22:45:37 +0200 Subject: [PATCH 19/20] fix: use the macro ASSERT in web_client.cpp use it, so that in release mode every used variable is declared as unused and the compilation doesn't fail because of that --- src/lobby/web_client.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lobby/web_client.cpp b/src/lobby/web_client.cpp index fb81fe18b..96def579c 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: From 84ea54bc33a866a080643e86780ee59491f8ba0e Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 23:00:06 +0200 Subject: [PATCH 20/20] fix: disable fatal-meson-warnings, where it is too much effort, to fix the errors, especially in subprojects --- .github/workflows/build.yml | 12 +++++++++++- .github/workflows/windows_installer.yml | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index af527f0cc..5efb93f5d 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' }} -Drun_in_ci=true --fatal-meson-warnings + 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/windows_installer.yml b/.github/workflows/windows_installer.yml index bf697c3b1..f3ed85aae 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 -Drun_in_ci=true --fatal-meson-warnings + 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: |