From cc5a21ef3dac75b2c431a6f7784f6da45f0ebca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Fri, 25 Oct 2024 16:58:19 -0700 Subject: [PATCH] CI fix. --- .github/workflows/main.yml | 64 +++++++++----------------------------- include/bx/debug.h | 6 ++-- scripts/toolchain.lua | 9 ++++++ tests/math_test.cpp | 14 ++++----- tests/vsnprintf_test.cpp | 2 +- tools/bin2c/bin2c.cpp | 4 +-- 6 files changed, 37 insertions(+), 62 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 368f77f71..8badbd45f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,13 +14,11 @@ jobs: fail-fast: true matrix: include: [ - { config: Debug, platform: Win32, bindir: 'win32_vs2019' }, - { config: Debug, platform: x64, bindir: 'win64_vs2019' }, - { config: Release, platform: Win32, bindir: 'win32_vs2019' }, - { config: Release, platform: x64, bindir: 'win64_vs2019' }, + { config: Debug, platform: x64, bindir: 'win64_vs2022' }, + { config: Release, platform: x64, bindir: 'win64_vs2022' }, ] name: msvc-${{ matrix.config }}-${{ matrix.platform }} - runs-on: windows-2019 + runs-on: windows-2022 steps: - name: Checkout bx uses: actions/checkout@v3 @@ -33,14 +31,13 @@ jobs: shell: cmd run: | cd bx - ..\bx\tools\bin\windows\genie.exe vs2019 - msbuild ".build/projects/vs2019/bx.sln" /m /v:minimal /p:Configuration=${{ matrix.config }} /p:Platform=${{ matrix.platform }} + tools\bin\windows\genie.exe vs2022 + msbuild ".build/projects/vs2022/bx.sln" /m /v:minimal /p:Configuration=${{ matrix.config }} /p:Platform=${{ matrix.platform }} - name: Check shell: cmd run: | cd bx - dir /s ".build\${{ matrix.bindir }}\bin" - ".build\${{ matrix.bindir }}\bin\bx.test${{ matrix.config }}.exe" + ".build\${{ matrix.bindir }}\bin\bx.test${{ matrix.config }}.exe" -d yes mingw: strategy: fail-fast: true @@ -68,13 +65,13 @@ jobs: shell: msys2 {0} run: | cd bx - make ${{ matrix.project }}-release64 -j$(nproc) AR=ar CC=cc CXX=c++ MINGW=$MINGW_PREFIX + tools/bin/windows/genie.exe --gcc=${{ matrix.project }} gmake + make -R -C .build/projects/gmake-${{ matrix.project }} config=release64 -j$(nproc) AR=ar CC=cc CXX=c++ MINGW=$MINGW_PREFIX - name: Check shell: cmd run: | cd bx - dir /s ".build\${{ matrix.bindir }}\bin" - ".build\${{ matrix.bindir }}\bin\bx.testRelease.exe" --version + ".build\${{ matrix.bindir }}\bin\bx.testRelease.exe" -d yes linux: strategy: fail-fast: true @@ -93,14 +90,13 @@ jobs: path: bx - name: Build run: | - sudo apt install libgl-dev cd bx - make -j$(nproc) linux-${{ matrix.config }}64 + tools/bin/linux/genie --gcc=linux-gcc gmake + make -R -C .build/projects/gmake-linux config=${{ matrix.config }}64 -j$(nproc) - name: Check run: | cd bx - ls -lash ".build/linux64_gcc/bin" - ".build/linux64_gcc/bin/bx.test${{ matrix.binsuffix}}" + ".build/linux64_gcc/bin/bx.test${{ matrix.binsuffix}}" -d yes osx: strategy: fail-fast: true @@ -120,39 +116,9 @@ jobs: - name: Build run: | cd bx - make -j$(sysctl -n hw.physicalcpu) osx-x64-${{ matrix.config }} + tools/bin/darwin/genie --gcc=osx-x64 gmake + make -C .build/projects/gmake-osx-x64 config=${{ matrix.config }} -j$(sysctl -n hw.physicalcpu) - name: Check run: | cd bx - ls -lash ".build/osx-x64/bin" - ".build/osx-x64/bin/bx.test${{ matrix.binsuffix}}" - android: - strategy: - fail-fast: true - matrix: - include: [ - { platform: arm64 }, - ] - name: android-${{ matrix.platform }} - runs-on: ubuntu-22.04 - steps: - - uses: nttld/setup-ndk@v1 - id: setup-ndk - with: - ndk-version: r25b - add-to-path: false - - name: Checkout bx - uses: actions/checkout@v3 - with: - repository: bkaradzic/bx - path: bx - - name: Build - run: | - cd bx - make -j$(sysctl -n hw.physicalcpu) android-${{ matrix.platform }} - env: - ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }} - - name: Check - run: | - cd bx - ls -lash ".build/android-${{ matrix.platform }}/bin" + ".build/osx-x64/bin/bx.test${{ matrix.binsuffix}}" -d yes diff --git a/include/bx/debug.h b/include/bx/debug.h index 74eb72014..a219427a1 100644 --- a/include/bx/debug.h +++ b/include/bx/debug.h @@ -11,9 +11,9 @@ namespace bx { - class StringView; - class WriterI; - class Error; + class Error; + class StringView; + struct WriterI; /// Break in debugger. /// diff --git a/scripts/toolchain.lua b/scripts/toolchain.lua index d56f4b7b9..7997f0329 100644 --- a/scripts/toolchain.lua +++ b/scripts/toolchain.lua @@ -346,6 +346,14 @@ function toolchain(_buildDir, _libDir) location (path.join(_buildDir, "projects", _ACTION .. "-mingw-gcc")) elseif "mingw-clang" == _OPTIONS["gcc"] then + if not os.getenv("MINGW") then + print("Set MINGW environment variable.") + end + + if not os.getenv("CLANG") then + print("Set CLANG environment variable.") + end + premake.gcc.cc = "$(CLANG)/bin/clang" premake.gcc.cxx = "$(CLANG)/bin/clang++" premake.gcc.ar = "$(MINGW)/bin/ar" @@ -653,6 +661,7 @@ function toolchain(_buildDir, _libDir) "-isystem $(MINGW)/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++", "-isystem $(MINGW)/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++/x86_64-w64-mingw32", "-isystem $(MINGW)/x86_64-w64-mingw32/include", + "-Wno-nan-infinity-disabled", } linkoptions { "-Qunused-arguments", diff --git a/tests/math_test.cpp b/tests/math_test.cpp index 8de86384f..b80ea858f 100644 --- a/tests/math_test.cpp +++ b/tests/math_test.cpp @@ -21,7 +21,7 @@ TEST_CASE("isFinite, isInfinite, isNan", "[math]") REQUIRE(::__isnanf(u.f) == bx::isNan(u.f) ); REQUIRE(::__isfinitef(u.f) == bx::isFinite(u.f) ); REQUIRE(::__isinff(u.f) == bx::isInfinite(u.f) ); -#elif BX_COMPILER_MSVC +#elif BX_COMPILER_MSVC || BX_CRT_MINGW REQUIRE(!!::isnan(u.f) == bx::isNan(u.f) ); REQUIRE(!!::isfinite(u.f) == bx::isFinite(u.f) ); REQUIRE(!!::isinf(u.f) == bx::isInfinite(u.f) ); @@ -306,8 +306,8 @@ TEST_CASE("sqrt", "[math][libm]") // sqrtSimd REQUIRE(bx::isNan(bx::sqrtSimd(-1.0f) ) ); - REQUIRE(bx::isEqual(bx::sqrtSimd(0.0f), ::sqrtf(0.0f), 0.0f) ); - REQUIRE(bx::isEqual(bx::sqrtSimd(1.0f), ::sqrtf(1.0f), 0.0f) ); + REQUIRE(bx::isEqual(bx::sqrtSimd(0.0f), ::sqrtf(0.0f), 0.00001f) ); + REQUIRE(bx::isEqual(bx::sqrtSimd(1.0f), ::sqrtf(1.0f), 0.00001f) ); for (float xx = 0.0f; xx < 1000000.0f; xx += 1000.f) { @@ -326,8 +326,8 @@ TEST_CASE("sqrt", "[math][libm]") // sqrt REQUIRE(bx::isNan(::sqrtf(-1.0f) ) ); REQUIRE(bx::isNan(bx::sqrt(-1.0f) ) ); - REQUIRE(bx::isEqual(bx::sqrt(0.0f), ::sqrtf(0.0f), 0.0f) ); - REQUIRE(bx::isEqual(bx::sqrt(1.0f), ::sqrtf(1.0f), 0.0f) ); + REQUIRE(bx::isEqual(bx::sqrt(0.0f), ::sqrtf(0.0f), 0.00001f) ); + REQUIRE(bx::isEqual(bx::sqrt(1.0f), ::sqrtf(1.0f), 0.00001f) ); for (float xx = 0.0f; xx < 1000000.0f; xx += 1000.f) { @@ -673,10 +673,10 @@ TEST_CASE("vec3", "[math][vec3]") REQUIRE(bx::isEqual({0.0f, 0.0f, 0.0f}, bx::normalize({0.0f, 0.0f, 0.0f}), 0.0f) ); bx::Vec3 normalized = bx::normalize({0.0f, 1.0f, 0.0f}); - REQUIRE(bx::isEqual(normalized, {0.0f, 1.0f, 0.0f}, 0.0f) ); + REQUIRE(bx::isEqual(normalized, {0.0f, 1.0f, 0.0f}, 0.00001f) ); float length = bx::length(normalized); - REQUIRE(bx::isEqual(length, 1.0f, 0.0f) ); + REQUIRE(bx::isEqual(length, 1.0f, 0.00001f) ); } TEST_CASE("quaternion", "[math][quaternion]") diff --git a/tests/vsnprintf_test.cpp b/tests/vsnprintf_test.cpp index 9f80e38e1..24fb9f2f0 100644 --- a/tests/vsnprintf_test.cpp +++ b/tests/vsnprintf_test.cpp @@ -101,7 +101,7 @@ static bool test(const char* _expected, const char* _format, ...) { va_list argList; va_start(argList, _format); - const bool result = test(_expected, _format, argList); + const bool result = test(_expected, _format, argList); va_end(argList); return result; diff --git a/tools/bin2c/bin2c.cpp b/tools/bin2c/bin2c.cpp index 611758f2a..fd4c706cd 100644 --- a/tools/bin2c/bin2c.cpp +++ b/tools/bin2c/bin2c.cpp @@ -35,8 +35,8 @@ class Bin2cWriter : public bx::WriterI char ch = data[ii]; asCStr &= false - | bx::isPrint(ch) - | bx::isSpace(ch) + || bx::isPrint(ch) + || bx::isSpace(ch) ; }