From 2e2625a055ed554472287ec81ec4e4b90792db6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC?= Date: Wed, 6 Nov 2024 19:52:57 +0300 Subject: [PATCH] Windows build add --- .github/workflows/cmake-build.yml | 48 +++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cmake-build.yml b/.github/workflows/cmake-build.yml index 28187d3a..a209dc7e 100644 --- a/.github/workflows/cmake-build.yml +++ b/.github/workflows/cmake-build.yml @@ -45,11 +45,9 @@ jobs: - os: ubuntu-latest c_compiler: gcc cpp_compiler: g++ - pre_run_command: docker run --rm -v ${{ github.workspace }}:/KNP -w /KNP ${{ vars.DOCKERHUB_LOGIN }}/knp-build-image - os: ubuntu-latest c_compiler: clang cpp_compiler: clang++ - pre_run_command: docker run --rm -v ${{ github.workspace }}:/KNP -w /KNP ${{ vars.DOCKERHUB_LOGIN }}/knp-build-image exclude: - os: windows-latest c_compiler: gcc @@ -67,26 +65,60 @@ jobs: run: | echo "build-output-dir=build_${{ matrix.c_compiler }}" >> "$GITHUB_OUTPUT" - - name: Configure CMake + - name: Install Windows boost + uses: MarkusJx/install-boost@v2.4.5 + id: install-boost + if: ${{ matrix.os }} == 'windows-latest' + with: + boost_version: 1.81.0 + boost_install_dir: C:\boost + platform_version: 2022 + toolset: msvc + + - name: Configure non Windows CMake + if: ${{ matrix.os }} != 'windows-latest' run: > - ${{ matrix.pre_run_comman }} cmake -B ${{ steps.strings.outputs.build-output-dir }}_${{ matrix.c_compiler }} + docker run --rm -v ${{ github.workspace }}:/KNP -w /KNP ${{ vars.DOCKERHUB_LOGIN }}/knp-build-image cmake -B ${{ steps.strings.outputs.build-output-dir }}_${{ matrix.c_compiler }} -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -S . - - name: Build + - name: Configure Windows CMake + if: ${{ matrix.os }} == 'windows-latest' + run: > + cmake -B ${{ steps.strings.outputs.build-output-dir }}_${{ matrix.c_compiler }} + -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} + -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -S . + + - name: Build for non Windows + if: ${{ matrix.os }} != 'windows-latest' # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). run: docker run --rm -v ${{ github.workspace }}:/KNP -w /KNP ${{ vars.DOCKERHUB_LOGIN }}/knp-build-image cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --parallel 8 timeout-minutes: 180 - - name: Test + - name: Build for Windows + if: ${{ matrix.os }} == 'windows-latest' + # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --parallel 8 + timeout-minutes: 180 + + - name: Test for non Windows + if: ${{ matrix.os }} != 'windows-latest' + run: docker run --rm -v ${{ github.workspace }}:/KNP -w /KNP/${{ steps.strings.outputs.build-output-dir }}/knp/tests ${{ vars.DOCKERHUB_LOGIN }}/knp-build-image ctest -V + timeout-minutes: 180 + + - name: Test for Windows + if: ${{ matrix.os }} == 'windows-latest' # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - run: docker run --rm -v ${{ github.workspace }}:/KNP -w /KNP/${{ steps.strings.outputs.build-output-dir }}/knp/tests ${{ vars.DOCKERHUB_LOGIN }}/knp-build-image ctest --build-config ${{ matrix.build_type }} -V + run: ctest --build-config ${{ matrix.build_type }} -V timeout-minutes: 180 - - name: Create packages + - name: Create deb packages + if: ${{ matrix.os }} != 'windows-latest' run: docker run --rm -v ${{ github.workspace }}:/KNP -w /KNP/${{ steps.strings.outputs.build-output-dir }} ${{ vars.DOCKERHUB_LOGIN }}/knp-build-image cpack -G DEB timeout-minutes: 180