Skip to content

Commit

Permalink
Windows build add
Browse files Browse the repository at this point in the history
  • Loading branch information
artiomn authored Nov 6, 2024
1 parent e1eed72 commit 2e2625a
Showing 1 changed file with 40 additions and 8 deletions.
48 changes: 40 additions & 8 deletions .github/workflows/cmake-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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/[email protected]
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

Expand Down

0 comments on commit 2e2625a

Please sign in to comment.