Skip to content

Commit bd73c56

Browse files
committed
Build and test on Windows MSYS2
New GitHub workflow to build and test on a Windows MSYS2 build in 32 and 64 bits. This patch sets the `LANGUAGES` to `CXX` in the cmake project to avoid setting up the `C` language which is not used by the project. Due to a bug in cmake ninja generator with MSYS we can't set a prefix on the target because it creates a duplicated ninja rule.
1 parent d8da1e3 commit bd73c56

File tree

2 files changed

+54
-3
lines changed

2 files changed

+54
-3
lines changed

.github/workflows/build_test.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,52 @@ jobs:
5555
path: ~/.cache/bazel
5656
key: bazel-${{ runner.os }}
5757
- run: bazel build //...
58+
59+
windows_msys2:
60+
name: Windows MSYS2 / ${{ matrix.arch }}
61+
runs-on: windows-latest
62+
strategy:
63+
fail-fast: false
64+
matrix:
65+
include:
66+
- arch: x86_64
67+
msystem: mingw64
68+
- arch: i686
69+
msystem: mingw32
70+
defaults:
71+
run:
72+
shell: msys2 {0}
73+
steps:
74+
- uses: actions/checkout@v2
75+
- uses: msys2/setup-msys2@v2
76+
with:
77+
msystem: ${{ matrix.msystem }}
78+
update: true
79+
install: >-
80+
base-devel
81+
git
82+
mingw-w64-${{ matrix.arch }}-cmake
83+
mingw-w64-${{ matrix.arch }}-gcc
84+
mingw-w64-${{ matrix.arch }}-gtest
85+
mingw-w64-${{ matrix.arch }}-ninja
86+
87+
- name: CMake configure
88+
# TODO(deymo): Set HWY_WARNINGS_ARE_ERRORS=ON once the warnings are
89+
# resolved.
90+
run: |
91+
cmake \
92+
-DCMAKE_BUILD_TYPE=Release \
93+
-DHWY_WARNINGS_ARE_ERRORS=OFF \
94+
-DHWY_SYSTEM_GTEST=ON \
95+
-B out \
96+
-G Ninja
97+
- name: CMake build
98+
run: cmake --build out
99+
- name: Test
100+
run: ctest --test-dir out --parallel 2 --output-on-failure
101+
102+
- uses: actions/upload-artifact@v2
103+
if: failure()
104+
with:
105+
name: my-artifact
106+
path: out/

CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if(POLICY CMP0083)
1919
cmake_policy(SET CMP0083 NEW)
2020
endif()
2121

22-
project(hwy VERSION 0.14.2) # Keep in sync with highway.h version
22+
project(hwy LANGUAGES CXX VERSION 0.14.2) # Keep in sync with highway.h version
2323

2424
set(CMAKE_CXX_STANDARD 11)
2525
set(CMAKE_CXX_EXTENSIONS OFF)
@@ -374,8 +374,10 @@ foreach (TESTFILE IN LISTS HWY_TEST_FILES)
374374
else()
375375
target_link_libraries(${TESTNAME} hwy hwy_contrib hwy_test gtest gtest_main)
376376
endif()
377-
# Output test targets in the test directory.
378-
set_target_properties(${TESTNAME} PROPERTIES PREFIX "tests/")
377+
if(!MSYS)
378+
# Output test targets in the test directory.
379+
set_target_properties(${TESTNAME} PROPERTIES PREFIX "tests/")
380+
endif()
379381

380382
if (HWY_EMSCRIPTEN)
381383
set_target_properties(${TESTNAME} PROPERTIES LINK_FLAGS "-s SINGLE_FILE=1")

0 commit comments

Comments
 (0)