Skip to content

Commit

Permalink
Build and test on Windows MSYS2
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
deymo committed Oct 20, 2021
1 parent d8da1e3 commit bd73c56
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 3 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,52 @@ jobs:
path: ~/.cache/bazel
key: bazel-${{ runner.os }}
- run: bazel build //...

windows_msys2:
name: Windows MSYS2 / ${{ matrix.arch }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
msystem: mingw64
- arch: i686
msystem: mingw32
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v2
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
update: true
install: >-
base-devel
git
mingw-w64-${{ matrix.arch }}-cmake
mingw-w64-${{ matrix.arch }}-gcc
mingw-w64-${{ matrix.arch }}-gtest
mingw-w64-${{ matrix.arch }}-ninja
- name: CMake configure
# TODO(deymo): Set HWY_WARNINGS_ARE_ERRORS=ON once the warnings are
# resolved.
run: |
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DHWY_WARNINGS_ARE_ERRORS=OFF \
-DHWY_SYSTEM_GTEST=ON \
-B out \
-G Ninja
- name: CMake build
run: cmake --build out
- name: Test
run: ctest --test-dir out --parallel 2 --output-on-failure

- uses: actions/upload-artifact@v2
if: failure()
with:
name: my-artifact
path: out/
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if(POLICY CMP0083)
cmake_policy(SET CMP0083 NEW)
endif()

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

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_EXTENSIONS OFF)
Expand Down Expand Up @@ -374,8 +374,10 @@ foreach (TESTFILE IN LISTS HWY_TEST_FILES)
else()
target_link_libraries(${TESTNAME} hwy hwy_contrib hwy_test gtest gtest_main)
endif()
# Output test targets in the test directory.
set_target_properties(${TESTNAME} PROPERTIES PREFIX "tests/")
if(!MSYS)
# Output test targets in the test directory.
set_target_properties(${TESTNAME} PROPERTIES PREFIX "tests/")
endif()

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

0 comments on commit bd73c56

Please sign in to comment.