Add cross-compile to GitHub build actions

This commit is contained in:
Marius Greuel 2021-12-29 15:40:55 +01:00
parent b87b527b3a
commit 428f5828b4
2 changed files with 88 additions and 13 deletions

View File

@ -1,5 +1,5 @@
#
# build_cmake.yml - GitHub build action for AVRDUDE
# build.yml - GitHub build action for AVRDUDE
# Copyright (C) 2021 Marius Greuel
#
# This program is free software; you can redistribute it and/or modify
@ -43,23 +43,83 @@ jobs:
bison
libelf-dev
libusb-dev
libftdi1-dev
libusb-1.0-0-dev
libhidapi-dev
libftdi1-dev
libreadline-dev
- name: Configure
run: >-
cmake
-D DEBUG_CMAKE=1
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-B ${{github.workspace}}/build
-B ../build
- name: Build
run: cmake --build ${{github.workspace}}/build
run: cmake --build ../build
- name: Archive build artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: linux-x86_64
path: |
${{github.workspace}}/build/*
build/
!**/*.d
!**/*.o
linux:
runs-on: ubuntu-latest
container: debian:11
defaults:
run:
working-directory: ./src
strategy:
matrix:
include:
- { arch: i386, processor: i686, prefix: i686-linux-gnu, inc-lib: i386-linux-gnu }
- { arch: armhf, processor: armhf, prefix: arm-linux-gnueabihf, inc-lib: arm-linux-gnueabihf }
- { arch: arm64, processor: aarch64, prefix: aarch64-linux-gnu, inc-lib: aarch64-linux-gnu }
steps:
- uses: actions/checkout@v2
- name: Add architecture
run: |
dpkg --add-architecture ${{matrix.arch}}
apt-get update
- name: Install prerequisites
run: >-
apt-get install -y
git
cmake
flex
bison
crossbuild-essential-${{matrix.arch}}
libelf-dev:${{matrix.arch}}
libusb-dev:${{matrix.arch}}
libusb-1.0-0-dev:${{matrix.arch}}
libhidapi-dev:${{matrix.arch}}
libftdi1-dev:${{matrix.arch}}
libreadline-dev:${{matrix.arch}}
- name: Configure
run: >-
cmake
-D DEBUG_CMAKE=1
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-D CMAKE_SYSTEM_NAME=Linux
-D CMAKE_SYSTEM_PROCESSOR=${{matrix.processor}}
-D CMAKE_C_COMPILER=${{matrix.prefix}}-gcc
-D CMAKE_FIND_ROOT_PATH=/usr/${{matrix.prefix}}
-D CMAKE_INCLUDE_PATH=/usr/include/${{matrix.inc-lib}}
-D CMAKE_LIBRARY_PATH=/usr/lib/${{matrix.inc-lib}}
-B ../build
- name: Build
run: cmake --build ../build
- name: Archive build artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: linux-${{matrix.processor}}
path: |
build/
!**/*.d
!**/*.o
macos-x86_64:
runs-on: macos-latest
@ -76,8 +136,8 @@ jobs:
bison
libelf
libusb
libftdi
hidapi
libftdi
- name: Configure
run: >-
cmake
@ -85,21 +145,30 @@ jobs:
-D CMAKE_EXE_LINKER_FLAGS=-L/usr/local/Cellar
-D DEBUG_CMAKE=1
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-B ${{github.workspace}}/build
-B ../build
- name: Build
run: cmake --build ${{github.workspace}}/build
run: cmake --build ../build
- name: Archive build artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: macos-x86_64
path: |
${{github.workspace}}/build/*
msvc-x86_64:
build/
!**/*.d
!**/*.o
msvc:
runs-on: windows-latest
defaults:
run:
working-directory: ./src
strategy:
matrix:
include:
- { arch: x86, platform: Win32 }
- { arch: x64, platform: x64 }
- { arch: arm64, platform: ARM64 }
steps:
- uses: actions/checkout@v2
- name: Install prerequisites
@ -107,6 +176,7 @@ jobs:
- name: Configure
run: >-
cmake
-A ${{matrix.platform}}
-D DEBUG_CMAKE=1
-D CMAKE_SYSTEM_VERSION=11
-D CMAKE_C_FLAGS_RELWITHDEBINFO="/MT /GL /Zi /O2 /Ob1 /DNDEBUG"
@ -118,11 +188,15 @@ jobs:
- name: Build
run: cmake --build ../build --config ${{env.BUILD_TYPE}}
- name: Archive build artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: msvc-x86_64
name: msvc-${{matrix.arch}}
path: |
${{github.workspace}}/build/*
build/
!**/_deps/
!**/*.obj
mingw:
runs-on: windows-latest
defaults:

View File

@ -42,7 +42,6 @@ include(GNUInstallDirs)
set(CONFIG_DIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}")
set(AVRDUDE_FULL_VERSION ${CMAKE_PROJECT_VERSION})
set(AVRDUDE_EXTERNAL_PATH "${PROJECT_SOURCE_DIR}/external")
# =====================================
# Get Git commit info
@ -356,6 +355,8 @@ message(STATUS "----------------------")
if (DEBUG_CMAKE)
message(STATUS "CMAKE_HOST_SYSTEM: ${CMAKE_HOST_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 "AVRDUDE_FULL_VERSION: ${AVRDUDE_FULL_VERSION}")
message(STATUS "USE_EXTERNAL: ${USE_EXTERNAL}")