Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make enable_cross_compiler more open-closed #196

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions .github/workflows/ci.cross.arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,31 @@ jobs:
cmake:
- true
task:
- rpi3:build.cross
- rpi3:build.cross.bare-metal
- rpi4:build.cross
- rpi4-vcpkg:build.cross
- rpi4:build.cross.aarch64
- rpi4:build.cross.custom-toolchain
- rpi3:build.cross
- rpi4-vcpkg:build.cross
include:
- task: rpi3:build.cross
install-cross-compiler: gcc-arm-linux-gnueabi g++-arm-linux-gnueabi gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
target: arm-linux-gnueabi
- task: rpi3:build.cross.bare-metal
install-cross-compiler: gcc-arm-none-eabi binutils-arm-none-eabi libnewlib-arm-none-eabi
target: arm-none-eabi
- task: rpi4:build.cross
install-cross-compiler: g++-aarch64-linux-gnu gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
target: aarch64-linux-gnu
- task: rpi4-vcpkg:build.cross
- task: rpi4:build.cross.aarch64
install-cross-compiler: g++-aarch64-linux-gnu gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
target: aarch64-linux-gnu
- task: rpi4:build.cross.custom-toolchain
install-cross-compiler: g++-aarch64-linux-gnu gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
target: aarch64-linux-gnu
- task: rpi3:build.cross
install-cross-compiler: gcc-arm-none-eabi binutils-arm-none-eabi libnewlib-arm-none-eabi
target: arm-none-eabi
- task: rpi4-vcpkg:build.cross
install-cross-compiler: g++-aarch64-linux-gnu gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
target: aarch64-linux-gnu
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -64,13 +72,10 @@ jobs:
clangtidy: true
task: true
doxygen: true
powershell: true

- name: Setup ARM (Cross) Compiler
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: ${{ matrix.install-cross-compiler }}
version: 1.0
run: sudo apt-get install -y ${{ matrix.install-cross-compiler }}
shell: bash

- name: Build (Task)
run: |
Expand Down
17 changes: 16 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,23 @@ services:
context: .
dockerfile: ./docker/Dockerfile.aarch64
target: build-vcpkg
build-rpi4-vcpkg-custom:
build:
context: .
dockerfile: ./docker/Dockerfile.aarch64
target: build-vcpkg-custom
build-rpi4-custom:
build:
context: .
dockerfile: ./docker/Dockerfile.aarch64
target: build-custom
target: build-custom
build-rpi4-aarch64:
build:
context: .
dockerfile: ./docker/Dockerfile.aarch64
target: build-aarch64
build-rpi3-bare-metal:
build:
context: .
dockerfile: ./docker/Dockerfile.arm-bare-metal
target: build
22 changes: 22 additions & 0 deletions docker/Dockerfile.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ WORKDIR /home/project_options
RUN git submodule update --init
CMD ["/bin/bash", "-c", "task rpi4:build.cross.custom-toolchain"]

FROM setup AS build-vcpkg-custom
COPY . /home/project_options
WORKDIR /home/project_options
RUN git submodule update --init
CMD ["/bin/bash", "-c", "task rpi4-vcpkg:build.cross.custom-toolchain"]

FROM setup AS build-aarch64
COPY . /home/project_options
WORKDIR /home/project_options
RUN git submodule update --init
CMD ["/bin/bash", "-c", "task rpi4:build.cross.aarch64"]

FROM setup AS test
RUN apt-get update && apt-get install -y \
Expand All @@ -55,3 +66,14 @@ WORKDIR /home/project_options
RUN git submodule update --init
ENV QEMU_LD_PREFIX /usr/aarch64-linux-gnu
CMD ["/bin/bash", "-c", "task rpi4:build.cross && qemu-aarch64 /home/project_options/tests/rpi4/build/Release/example"]


FROM setup AS test-aarch64
RUN apt-get update && apt-get install -y \
qemu-user \
&& rm -rf /var/lib/apt/lists/*
COPY . /home/project_options
WORKDIR /home/project_options
RUN git submodule update --init
ENV QEMU_LD_PREFIX /usr/aarch64-linux-gnu
CMD ["/bin/bash", "-c", "task rpi4:build.aarch64 && qemu-aarch64 /home/project_options/tests/rpi4/build/Release/example"]
4 changes: 2 additions & 2 deletions docker/Dockerfile.arm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ FROM base AS setup
RUN setup-cpp --clangtidy true --clangformat true --cmake true --ninja true --ccache true --cppcheck true --vcpkg true --conan true --task true

RUN apt-get update && apt-get install -y \
gcc-arm-none-eabi binutils-arm-none-eabi libnewlib-arm-none-eabi \
gcc-arm-linux-gnueabi g++-arm-linux-gnueabi gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf \
&& rm -rf /var/lib/apt/lists/*

COPY ./docker/entrypoint.sh /docker-entrypoint.sh
Expand All @@ -32,4 +32,4 @@ FROM setup AS build-debug
COPY . /home/project_options
WORKDIR /home/project_options
RUN git submodule update --init
CMD ["/bin/bash", "-c", "task rpi3:build.cross.debug"]
CMD ["/bin/bash", "-c", "task rpi3:build.cross.debug"]
27 changes: 27 additions & 0 deletions docker/Dockerfile.arm-bare-metal
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM ubuntu:22.04 AS base

# add setup-cpp https://github.com/aminya/setup-cpp
RUN apt-get update && apt-get install -y \
npm \
&& rm -rf /var/lib/apt/lists/*
RUN npm install -g setup-cpp


FROM base AS setup

# install cmake, ninja, and ccache
RUN setup-cpp --clangtidy true --clangformat true --cmake true --ninja true --ccache true --cppcheck true --vcpkg true --conan true --task true

RUN apt-get update && apt-get install -y \
gcc-arm-none-eabi binutils-arm-none-eabi libnewlib-arm-none-eabi \
&& rm -rf /var/lib/apt/lists/*

COPY ./docker/entrypoint.sh /docker-entrypoint.sh
ENTRYPOINT [ "/docker-entrypoint.sh" ]


FROM setup AS build
COPY . /home/project_options
WORKDIR /home/project_options
RUN git submodule update --init
CMD ["/bin/bash", "-c", "task rpi3:build.cross.bare-metal"]
18 changes: 15 additions & 3 deletions docker/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ tasks:
rpi3.debug:
- docker-compose up --build build-rpi3-debug
- docker-compose down

rpi3.bare-metal:
- docker-compose up --build build-rpi3-bare-metal
- docker-compose down

rpi4:
- docker-compose up --build build-rpi4
Expand All @@ -42,10 +46,18 @@ tasks:
- docker-compose up --build test-rpi4
- docker-compose down

rpi4.custom:
- docker-compose up --build build-rpi4-custom
- docker-compose down

rpi4.aarch64:
- docker-compose up --build build-rpi4-aarch64
- docker-compose down

rpi4.vcpkg:
- docker-compose up --build build-rpi4-vcpkg
- docker-compose down

rpi4.custom:
- docker-compose up --build build-rpi4-custom
- docker-compose down
rpi4.vcpkg-custsom:
- docker-compose up --build build-rpi4-vcpkg-custom
- docker-compose down
Loading