Skip to content

Commit

Permalink
various build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Knifa committed Nov 29, 2024
1 parent 6b91444 commit 7d6911c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
uses: docker/build-push-action@v6
with:
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64, linux/arm, linux/arm64
platforms: linux/amd64, linux/arm/v7, linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
target: run
32 changes: 19 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ set(LMZ_COMPILE_FEATURES cxx_std_20)
set(LMZ_COMPILE_OPTIONS -O3 -Wall -Wextra)

find_package(PkgConfig REQUIRED)
find_package(RpiRgbLedMatrix REQUIRED)
pkg_check_modules(ZMQ REQUIRED libzmq)

include(FetchContent)
Expand All @@ -24,19 +23,26 @@ FetchContent_Declare(
)
FetchContent_MakeAvailable(argparse plog)

add_executable(led-matrix-zmq-server
src/server_main.cpp
src/color_temp.cpp
if(
CMAKE_SYSTEM_PROCESSOR MATCHES "arm"
OR CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64"
)
target_link_libraries(led-matrix-zmq-server PRIVATE
argparse
plog
pthread
RpiRgbLedMatrix::RpiRgbLedMatrix
zmq
)
target_compile_features(led-matrix-zmq-server PRIVATE ${LMZ_COMPILE_FEATURES})
target_compile_options(led-matrix-zmq-server PRIVATE ${LMZ_COMPILE_OPTIONS})
find_package(RpiRgbLedMatrix REQUIRED)

add_executable(led-matrix-zmq-server
src/server_main.cpp
src/color_temp.cpp
)
target_link_libraries(led-matrix-zmq-server PRIVATE
argparse
plog
pthread
RpiRgbLedMatrix::RpiRgbLedMatrix
zmq
)
target_compile_features(led-matrix-zmq-server PRIVATE ${LMZ_COMPILE_FEATURES})
target_compile_options(led-matrix-zmq-server PRIVATE ${LMZ_COMPILE_OPTIONS})
endif()

add_executable(led-matrix-zmq-control
src/control_main.cpp
Expand Down
32 changes: 15 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM alpine:latest as build

Check warning on line 1 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

RUN apk add --no-cache --virtual .build-deps-base \
clang \
cmake \
cppzmq \
git \
make \
pkgconf
clang \
cmake \
cppzmq \
git \
make \
pkgconf

ENV CC=clang
ENV CXX=clang++
Expand All @@ -20,30 +20,28 @@ WORKDIR /build
RUN git clone --depth 1 https://github.com/Knifa/rpi-rgb-led-matrix.git
WORKDIR /build/rpi-rgb-led-matrix
RUN cd lib \
&& make
&& make

RUN mkdir -p /build/led-matrix-zmq-server
WORKDIR /build/led-matrix-zmq-server
ADD . .
RUN mkdir -p build \
&& cd build \
&& cmake -DRPI_RGB_LED_MATRIX_DIR=/build/rpi-rgb-led-matrix .. \
&& make
&& cd build \
&& cmake -DRPI_RGB_LED_MATRIX_DIR=/build/rpi-rgb-led-matrix .. \
&& make

FROM alpine:latest as run

Check warning on line 33 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

RUN apk add --no-cache \
libc++ \
libzmq
libc++ \
libzmq

RUN mkdir -p /opt/led-matrix-zmq-server
WORKDIR /opt/led-matrix-zmq-server

COPY --from=build \
/build/led-matrix-zmq-server/build/led-matrix-zmq-server \
/build/led-matrix-zmq-server/build/led-matrix-zmq-control \
/build/led-matrix-zmq-server/build/led-matrix-zmq-pipe \
./
/build/led-matrix-zmq-server/build/led-matrix-zmq-* \
./

ENV PATH="/opt/led-matrix-zmq-server:$PATH"
CMD ["./led-matrix-zmq-server"]
CMD ["echo", "Please run a specific led-matrix-zmq binary!"]

0 comments on commit 7d6911c

Please sign in to comment.