From 85b1f774c8fc7603834a8fcb8f42b1d83025a0f8 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Sat, 10 May 2025 08:40:04 +0200 Subject: [PATCH 1/7] CMake: use newer way to detect compiler endianness TestBigEndian seems to rely on the C compiler but we only use a C++ compiler. --- CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e4b56078..b23123fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,8 +123,16 @@ if(WIN32) target_compile_definitions(ebml PRIVATE _CRT_SECURE_NO_WARNINGS) endif() -include(TestBigEndian) -test_big_endian(BUILD_BIG_ENDIAN) +if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.20") + if(${CMAKE_CXX_BYTE_ORDER} STREQUAL "BIG_ENDIAN") + set(BUILD_BIG_ENDIAN 1) + else() + set(BUILD_BIG_ENDIAN 0) + endif() +else() + include(TestBigEndian) + test_big_endian(BUILD_BIG_ENDIAN) +endif() if(BUILD_BIG_ENDIAN) target_compile_definitions(ebml PRIVATE BUILD_BIG_ENDIAN) else() From 10e6b33d235554a80f9c5e7dafa8f5ba6f2a44ad Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Sat, 10 May 2025 08:50:10 +0200 Subject: [PATCH 2/7] CMake: use new add_test syntax It can run tests through the CMAKE_CROSSCOMPILING_EMULATOR. --- CMakeLists.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b23123fe..4572a472 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -155,35 +155,35 @@ if (BUILD_TESTING) add_executable(test_id test/test_id.cxx) target_link_libraries(test_id PUBLIC ebml) - add_test(test_id test_id) + add_test(NAME test_id COMMAND test_id) add_executable(test_header test/test_header.cxx) target_link_libraries(test_header PUBLIC ebml) - add_test(test_header test_header) + add_test(NAME test_header COMMAND test_header) add_executable(test_infinite test/test_infinite.cxx) target_link_libraries(test_infinite PUBLIC ebml) - add_test(test_infinite test_infinite) + add_test(NAME test_infinite COMMAND test_infinite) add_executable(test_utfstring test/test_utfstring.cxx) target_link_libraries(test_utfstring PUBLIC ebml) - add_test(test_utfstring test_utfstring) + add_test(NAME test_utfstring COMMAND test_utfstring) add_executable(test_macros test/test_macros.cxx) target_link_libraries(test_macros PUBLIC ebml) - add_test(test_macros test_macros) + add_test(NAME test_macros COMMAND test_macros) add_executable(test_crc test/test_crc.cxx) target_link_libraries(test_crc PUBLIC ebml) - add_test(test_crc test_crc) + add_test(NAME test_crc COMMAND test_crc) add_executable(test_missing test/test_missing.cxx) target_link_libraries(test_missing PUBLIC ebml) - add_test(test_missing test_missing) + add_test(NAME test_missing COMMAND test_missing) add_executable(test_versioning test/test_versioning.cxx) target_link_libraries(test_versioning PUBLIC ebml) - add_test(test_versioning test_versioning) + add_test(NAME test_versioning COMMAND test_versioning) endif(BUILD_TESTING) From 090a9eef834a7faa70b26e32678e473953261091 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Sat, 10 May 2025 08:08:39 +0200 Subject: [PATCH 3/7] CI: add s390x target Fixes #297 --- .github/workflows/linux.yaml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index e2faff3c..ff6e7fad 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -97,3 +97,31 @@ jobs: - name: Run tests run: ctest --test-dir _build + + s390X-BigEndian: + runs-on: ubuntu-latest + env: + CMAKE_OPTIONS: -DDEV_MODE=ON -DBUILD_TESTING=ON -DCMAKE_SYSTEM_PROCESSOR=s390x -DCMAKE_CROSSCOMPILING_EMULATOR="qemu-s390x;-L;/usr/s390x-linux-gnu/" -DCMAKE_CXX_COMPILER=s390x-linux-gnu-g++ -G Ninja + steps: + - name: install toolchain + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends qemu-user crossbuild-essential-s390x qemu-system-s390x + + - name: list compilers + run: dpkg --list | grep compiler + + - name: Get pushed code + uses: actions/checkout@v4 + + - name: Configure + run: cmake -S . -B _build ${{ env.CMAKE_OPTIONS }} -DCMAKE_INSTALL_PREFIX:STRING=${GITHUB_WORKSPACE}/_built + + - name: Build + run: cmake --build _build --parallel + + - name: Test installation + run: cmake --install _build --prefix ${GITHUB_WORKSPACE}/_built + + - name: Run tests + run: ctest --test-dir _build From 3adcf053ca61b46796329cc09409338cb7c547d0 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Sat, 10 May 2025 08:59:06 +0200 Subject: [PATCH 4/7] CI: run Windows tests with the proper configuration --- .github/workflows/windows.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index 56dd85cb..bdb00188 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -36,5 +36,5 @@ jobs: - name: Run tests run: | if ($env:PROCESSOR_ARCHITECTURE -match "${{ matrix.arch.env }}") { - ctest --test-dir _build + ctest --test-dir _build --build-config ${{ matrix.config }} } From e90ad2375a9dc98a440556795636d562b0113144 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Sat, 10 May 2025 08:59:38 +0200 Subject: [PATCH 5/7] CI: allow running x86 builds on win64 --- .github/workflows/windows.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index bdb00188..27116adb 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -15,7 +15,7 @@ jobs: config: [Debug, Release] arch: [ { "name": "x64", "option": "x64", "env": "AMD64"}, - { "name": "x86", "option": "win32", "env": "X86"}, + { "name": "x86", "option": "win32", "env": "AMD64"}, { "name": "arm64", "option": "arm64", "env": "ARM64"}, ] env: From 1aae025b8e4f045dde692f7a60c751f251b3e128 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Sat, 10 May 2025 09:01:53 +0200 Subject: [PATCH 6/7] CI: build and run tests for Windows ARM on Windows ARM runner --- .github/workflows/windows.yaml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index 27116adb..8bfee689 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -8,15 +8,15 @@ on: jobs: build_libebml: name: libebml ${{ matrix.arch.name }} ${{ matrix.config }} - runs-on: windows-latest + runs-on: ${{ matrix.arch.runner }} strategy: fail-fast: false matrix: config: [Debug, Release] arch: [ - { "name": "x64", "option": "x64", "env": "AMD64"}, - { "name": "x86", "option": "win32", "env": "AMD64"}, - { "name": "arm64", "option": "arm64", "env": "ARM64"}, + { "name": "x64", "option": "x64", "runner": "windows-latest"}, + { "name": "x86", "option": "win32", "runner": "windows-latest"}, + { "name": "arm64", "option": "arm64", "runner": "windows-11-arm"}, ] env: CMAKE_OPTIONS: -DDEV_MODE=ON -DCMAKE_CXX_FLAGS_INIT="-DWINVER=0x0501" -DBUILD_TESTING=ON @@ -34,7 +34,4 @@ jobs: run: cmake --install _build --config ${{ matrix.config }} --prefix ${GITHUB_WORKSPACE}/_built - name: Run tests - run: | - if ($env:PROCESSOR_ARCHITECTURE -match "${{ matrix.arch.env }}") { - ctest --test-dir _build --build-config ${{ matrix.config }} - } + run: ctest --test-dir _build --build-config ${{ matrix.config }} From 1081033c98559b9c05663614b4edffeeb7a665cc Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Sat, 10 May 2025 09:15:23 +0200 Subject: [PATCH 7/7] CI: don't install old compilers They are already in the Docker image. --- .github/workflows/linux.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index ff6e7fad..ddef9ebd 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -45,11 +45,6 @@ jobs: - name: list compilers run: dpkg --list | grep compiler - - name: install ${{matrix.cxx}} - run: | - sudo add-apt-repository --yes --update ppa:ubuntu-toolchain-r/test - sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends ${{matrix.cxx}} - - name: Get pushed code uses: actions/checkout@v4