From d329213a28b7edab2a63ff39bed6b87b2a563ae7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 19 Sep 2025 14:16:01 +0000 Subject: [PATCH 1/2] Initial plan From 53078c839c09f2d9a11186664c2e6ac33d8ba58c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 19 Sep 2025 14:24:30 +0000 Subject: [PATCH 2/2] Add Docker matrix build workflow with Dockerfile and fixes Co-authored-by: cracked-machine <7586660+cracked-machine@users.noreply.github.com> --- .github/workflows/docker-matrix-build.yml | 32 ++++++++++++++++++++ CMakeLists.txt | 17 +++++++++++ Dockerfile | 36 +++++++++++++++++++++++ toolchain/cmake-x86_64-w64-mingw32.cmake | 6 ++-- 4 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/docker-matrix-build.yml create mode 100644 Dockerfile diff --git a/.github/workflows/docker-matrix-build.yml b/.github/workflows/docker-matrix-build.yml new file mode 100644 index 0000000..fe819c6 --- /dev/null +++ b/.github/workflows/docker-matrix-build.yml @@ -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 }} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 96c4982..ba088e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..695aaaa --- /dev/null +++ b/Dockerfile @@ -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 \ No newline at end of file diff --git a/toolchain/cmake-x86_64-w64-mingw32.cmake b/toolchain/cmake-x86_64-w64-mingw32.cmake index f998603..b5b64f3 100755 --- a/toolchain/cmake-x86_64-w64-mingw32.cmake +++ b/toolchain/cmake-x86_64-w64-mingw32.cmake @@ -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