Skip to content
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
32 changes: 32 additions & 0 deletions .github/workflows/docker-matrix-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Docker Matrix Build

on:
push:
# Run on all branches (no branch filter)
pull_request:
# Run on all branches (no branch filter)

jobs:
docker-matrix-build:
runs-on: ubuntu-latest
strategy:
matrix:
config: [Debug, Release, RelWithDebInfo, MinSizeRel]
arch: [x86_64-linux-gnu, x86_64-w64-mingw32]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Build Docker image
run: |
docker build -t cpp-project:${{ matrix.config }}-${{ matrix.arch }} .

- name: Run build script in Docker
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
--user root \
cpp-project:${{ matrix.config }}-${{ matrix.arch }} \
./scripts/build.sh ${{ matrix.config }} ${{ matrix.arch }}
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,20 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

add_subdirectory( ${CMAKE_SOURCE_DIR}/src )

# Copy MinGW runtime DLLs for Windows builds
if(CMAKE_SYSTEM_NAME STREQUAL "Windows" AND BUILD_ARCH STREQUAL "x86_64-w64-mingw32")
# Ensure bin directory exists
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

# Copy runtime DLLs
if(EXISTS /usr/lib/gcc/x86_64-w64-mingw32/14-win32/libstdc++-6.dll)
file(COPY /usr/lib/gcc/x86_64-w64-mingw32/14-win32/libstdc++-6.dll
DESTINATION ${CMAKE_BINARY_DIR}/bin/)
endif()

if(EXISTS /usr/lib/gcc/x86_64-w64-mingw32/14-win32/libgcc_s_seh-1.dll)
file(COPY /usr/lib/gcc/x86_64-w64-mingw32/14-win32/libgcc_s_seh-1.dll
DESTINATION ${CMAKE_BINARY_DIR}/bin/)
endif()
endif()

36 changes: 36 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM debian:trixie

ARG USER=user
ENV DEBIAN_FRONTEND=noninteractive

# misc tools
RUN apt update -y && apt install -y \
clangd \
clang-format \
sudo \
locales \
doxygen \
git \
build-essential \
make \
pkg-config \
cmake \
ninja-build \
yq \
jq

# optional cross compile to windows
RUN apt update -y && apt install -y \
gcc-mingw-w64-x86-64 \
g++-mingw-w64-x86-64

RUN locale-gen en_GB.UTF-8 && update-locale

RUN useradd -m $USER && echo "$USER:$USER" | chpasswd && adduser $USER sudo
RUN echo "user ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers

RUN printf "alias ll='ls -la'" >> /home/$USER/.bashrc

WORKDIR /workspace

CMD /bin/bash
6 changes: 2 additions & 4 deletions toolchain/cmake-x86_64-w64-mingw32.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,5 @@ set(CMAKE_SYSTEM_INCLUDE_PATH /usr/x86_64-w64-mingw32/include)
# Ensure dbghelp is available
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ldbghelp")

# runtime deps for mingw
file( COPY /usr/lib/gcc/x86_64-w64-mingw32/14-win32/libstdc++-6.dll build-${BUILD_ARCH}/bin/libstdc++-6.dll
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/libgcc_s_seh-1.dll build-${BUILD_ARCH}/bin/libgcc_s_seh-1.dll
DESTINATION ${CMAKE_BINARY_DIR}/bin/ )
# runtime deps for mingw - these will be copied after the build directory is created
# The actual copying is moved to a post-build step in the main CMakeLists.txt