Skip to content

Commit

Permalink
feat: make enable_cross_compiler more open-closed (aminya#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
abeimler committed Jan 25, 2023
1 parent 7a0987f commit 742777c
Show file tree
Hide file tree
Showing 20 changed files with 403 additions and 103 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/ci.cross.arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,33 @@ jobs:
- true
task:
- rpi4:build.cross
- rpi4-vcpkg:build.cross
- rpi4:build.cross.custom-toolchain
- rpi4-vcpkg:build.cross
- rpi4-vcpkg:build.cross.custom-toolchain
- rpi4:build.cross.aarch64
- rpi3:build.cross
- rpi3:build.cross.bare-metal
include:
- 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:build.cross.custom-toolchain
install-cross-compiler: g++-aarch64-linux-gnu gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
target: aarch64-linux-gnu
- task: rpi4-vcpkg:build.cross
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
- task: rpi4-vcpkg:build.cross.custom-toolchain
install-cross-compiler: g++-aarch64-linux-gnu gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
target: aarch64-linux-gnu
- 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: rpi3:build.cross
install-cross-compiler: gcc-arm-none-eabi binutils-arm-none-eabi libnewlib-arm-none-eabi
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 g++-arm-none-eabi binutils-arm-none-eabi libnewlib-arm-none-eabi
target: arm-none-eabi
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -64,7 +76,6 @@ jobs:
clangtidy: true
task: true
doxygen: true
powershell: true

- name: Setup ARM (Cross) Compiler
uses: awalsh128/cache-apt-pkgs-action@latest
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"]
12 changes: 12 additions & 0 deletions docker/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,15 @@ tasks:
rpi4.custom:
- docker-compose up --build build-rpi4-custom
- docker-compose down

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

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

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

0 comments on commit 742777c

Please sign in to comment.