Add cross-compile to GitHub build actions

This commit is contained in:
Marius Greuel
2021-12-29 15:40:55 +01:00
parent 8b1ba161c3
commit 0d69645936
2 changed files with 44 additions and 4 deletions

View File

@@ -95,7 +95,8 @@ jobs:
name: macos-x86_64 name: macos-x86_64
path: | path: |
${{github.workspace}}/build/* ${{github.workspace}}/build/*
msvc:
msvc-x86_64:
runs-on: windows-latest runs-on: windows-latest
defaults: defaults:
run: run:
@@ -114,15 +115,17 @@ jobs:
-D CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO="/DEBUG /INCREMENTAL:NO /LTCG /OPT:REF /OPT:ICF" -D CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO="/DEBUG /INCREMENTAL:NO /LTCG /OPT:REF /OPT:ICF"
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-D USE_EXTERNAL=1 -D USE_EXTERNAL=1
-B ../build -B ${{github.workspace}}/build
- name: Build - name: Build
run: cmake --build ../build --config ${{env.BUILD_TYPE}} run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Archive build artifacts - name: Archive build artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: msvc-x64 name: msvc-x86_64
path: | path: |
${{github.workspace}}/build/* ${{github.workspace}}/build/*
!${{github.workspace}}/build/_deps/*
mingw: mingw:
runs-on: windows-latest runs-on: windows-latest
defaults: defaults:
@@ -165,3 +168,38 @@ jobs:
name: mingw-${{matrix.env}} name: mingw-${{matrix.env}}
path: | path: |
${{github.workspace}}/build/* ${{github.workspace}}/build/*
cross:
runs-on: ubuntu-latest
container: debian:11
defaults:
run:
working-directory: ./src
strategy:
matrix:
include:
- { arch: i386, env: i686, compiler: i686-linux-gnu-gcc }
- { arch: armhf, env: armhf, compiler: arm-linux-gnueabihf-gcc }
- { arch: arm64, env: arm64, compiler: aarch64-linux-gnu-gcc }
steps:
- uses: actions/checkout@v2
- name: Install prerequisites
run: |
dpkg --add-architecture ${{matrix.arch}}
apt-get update
apt-get install -y cmake flex bison crossbuild-essential-${{matrix.arch}} libusb-dev:${{matrix.arch}}
- name: Configure
run: >-
cmake
-D DEBUG_CMAKE=1
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-D CMAKE_C_COMPILER=${{matrix.compiler}}
-B ${{github.workspace}}/build
- name: Build
run: cmake --build ${{github.workspace}}/build
- name: Archive build artifacts
uses: actions/upload-artifact@v2
with:
name: linux-${{matrix.env}}
path: |
${{github.workspace}}/build/*

View File

@@ -375,6 +375,8 @@ message(STATUS "----------------------")
if (DEBUG_CMAKE) if (DEBUG_CMAKE)
message(STATUS "CMAKE_HOST_SYSTEM: ${CMAKE_HOST_SYSTEM}") message(STATUS "CMAKE_HOST_SYSTEM: ${CMAKE_HOST_SYSTEM}")
message(STATUS "CMAKE_SYSTEM: ${CMAKE_SYSTEM}") message(STATUS "CMAKE_SYSTEM: ${CMAKE_SYSTEM}")
message(STATUS "CMAKE_FIND_ROOT_PATH: ${CMAKE_FIND_ROOT_PATH}")
message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
message(STATUS "CONFIG_DIR: ${CONFIG_DIR}") message(STATUS "CONFIG_DIR: ${CONFIG_DIR}")
message(STATUS "AVRDUDE_FULL_VERSION: ${AVRDUDE_FULL_VERSION}") message(STATUS "AVRDUDE_FULL_VERSION: ${AVRDUDE_FULL_VERSION}")
message(STATUS "USE_EXTERNAL: ${USE_EXTERNAL}") message(STATUS "USE_EXTERNAL: ${USE_EXTERNAL}")