From 4597b054e2be71ca3a677037febac5ddf1ed4c01 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Wed, 29 May 2024 11:26:28 +0200 Subject: [PATCH] github-actions: add cross-compiling --- .github/workflows/compile.yml | 42 +++++++++++++++++++++++++++ cmake/aarch64-linux-gnu-clang.cmake | 5 ++++ cmake/aarch64-linux-gnu-gcc.cmake | 5 ++++ cmake/arm-linux-gnueabihf-clang.cmake | 5 ++++ cmake/arm-linux-gnueabihf-gcc.cmake | 5 ++++ cmake/mips-linux-gnu-gcc.cmake | 5 ++++ 6 files changed, 67 insertions(+) create mode 100644 cmake/aarch64-linux-gnu-clang.cmake create mode 100644 cmake/aarch64-linux-gnu-gcc.cmake create mode 100644 cmake/arm-linux-gnueabihf-clang.cmake create mode 100644 cmake/arm-linux-gnueabihf-gcc.cmake create mode 100644 cmake/mips-linux-gnu-gcc.cmake diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 8235c70..a08c9d8 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -32,6 +32,9 @@ jobs: clang \ cmake \ gcc \ + gcc-aarch64-linux-gnu \ + gcc-arm-linux-gnueabihf \ + gcc-mips-linux-gnu \ make - name: Configure & Build with gcc @@ -48,6 +51,45 @@ jobs: podman exec -i stable cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=${cc} -DENABLE_WERROR=ON -B build-${cc} podman exec -i stable cmake --build build-${cc} + - name: Configure & Build with arm-linux-gnueabihf-gcc + env: + toolchain: arm-linux-gnueabihf-gcc + run: | + podman exec -i stable cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=cmake/${toolchain}.cmake -DENABLE_WERROR=ON -B build-${toolchain} + podman exec -i stable cmake --build build-${toolchain} + + - name: Configure & Build with arm-linux-gnueabihf-clang + if: + ${{ matrix.release != 'ubuntu:20.04' && matrix.release != 'debian:oldstable-slim' }} + env: + toolchain: arm-linux-gnueabihf-clang + run: | + podman exec -i stable cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=cmake/${toolchain}.cmake -DENABLE_WERROR=ON -B build-${toolchain} + podman exec -i stable cmake --build build-${toolchain} + + - name: Configure & Build with aarch64-linux-gnu-gcc + env: + toolchain: aarch64-linux-gnu-gcc + run: | + podman exec -i stable cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=cmake/${toolchain}.cmake -DENABLE_WERROR=ON -B build-${toolchain} + podman exec -i stable cmake --build build-${toolchain} + + - name: Configure & Build with aarch64-linux-gnu-clang + if: + ${{ matrix.release != 'ubuntu:20.04' && matrix.release != 'debian:oldstable-slim' }} + env: + toolchain: aarch64-linux-gnu-clang + run: | + podman exec -i stable cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=cmake/${toolchain}.cmake -DENABLE_WERROR=ON -B build-${toolchain} + podman exec -i stable cmake --build build-${toolchain} + + - name: Configure & Build with mips-linux-gnu-gcc + env: + toolchain: mips-linux-gnu-gcc + run: | + podman exec -i stable cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=cmake/${toolchain}.cmake -DENABLE_WERROR=ON -B build-${toolchain} + podman exec -i stable cmake --build build-${toolchain} + - name: Show logs if: ${{ failure() }} run: | diff --git a/cmake/aarch64-linux-gnu-clang.cmake b/cmake/aarch64-linux-gnu-clang.cmake new file mode 100644 index 0000000..d67f80f --- /dev/null +++ b/cmake/aarch64-linux-gnu-clang.cmake @@ -0,0 +1,5 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR aarch64) + +set(CMAKE_C_COMPILER clang) +set(CMAKE_C_COMPILER_TARGET aarch64-linux-gnu) diff --git a/cmake/aarch64-linux-gnu-gcc.cmake b/cmake/aarch64-linux-gnu-gcc.cmake new file mode 100644 index 0000000..56c99df --- /dev/null +++ b/cmake/aarch64-linux-gnu-gcc.cmake @@ -0,0 +1,5 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR aarch64) + +set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc) +set(CMAKE_C_COMPILER_TARGET aarch64-linux-gnu) diff --git a/cmake/arm-linux-gnueabihf-clang.cmake b/cmake/arm-linux-gnueabihf-clang.cmake new file mode 100644 index 0000000..c64eb96 --- /dev/null +++ b/cmake/arm-linux-gnueabihf-clang.cmake @@ -0,0 +1,5 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR arm) + +set(CMAKE_C_COMPILER clang) +set(CMAKE_C_COMPILER_TARGET arm-linux-gnueabihf) diff --git a/cmake/arm-linux-gnueabihf-gcc.cmake b/cmake/arm-linux-gnueabihf-gcc.cmake new file mode 100644 index 0000000..ef52ce7 --- /dev/null +++ b/cmake/arm-linux-gnueabihf-gcc.cmake @@ -0,0 +1,5 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR arm) + +set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc) +set(CMAKE_C_COMPILER_TARGET arm-linux-gnueabihf) diff --git a/cmake/mips-linux-gnu-gcc.cmake b/cmake/mips-linux-gnu-gcc.cmake new file mode 100644 index 0000000..44013bb --- /dev/null +++ b/cmake/mips-linux-gnu-gcc.cmake @@ -0,0 +1,5 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR mips) + +set(CMAKE_C_COMPILER mips-linux-gnu-gcc) +set(CMAKE_C_COMPILER_TARGET mips-linux-gnu)