Skip to content

Commit

Permalink
Add msys2 workflow for CMake (HDFGroup#4991)
Browse files Browse the repository at this point in the history
Also updates CMake configure checks to build HDF5 w/ MSYS2
  • Loading branch information
byrnHDF authored and brtnfld committed Oct 31, 2024
1 parent bd46ecc commit b15f2db
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 7 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,14 @@ jobs:
name: "CMake TestExpress Workflows"
uses: ./.github/workflows/testxpr-cmake.yml

# call-release-cmake-julia:
# name: "CMake Julia Workflows"
# uses: ./.github/workflows/julia-cmake.yml
# with:
# build_mode: "Release"
# call-release-cmake-julia:
# name: "CMake Julia Workflows"
# uses: ./.github/workflows/julia-cmake.yml
# with:
# build_mode: "Release"

call-release-cmake-msys2:
name: "CMake Msys2 Workflows"
uses: ./.github/workflows/msys2-cmake.yml
with:
build_mode: "Release"
91 changes: 91 additions & 0 deletions .github/workflows/msys2-cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: hdf5 dev CMake MSys2 CI

# Triggers the workflow on a call from another workflow
on:
workflow_call:
inputs:
build_mode:
description: "release vs. debug build"
required: true
type: string

permissions:
contents: read

jobs:

CMake_build_and_test:

# The type of runner that the job will run on
runs-on: windows-latest
strategy:
matrix:
include:
- { icon: '⬛', sys: mingw32 }
- { icon: '🟦', sys: mingw64 }
- { icon: '🟨', sys: ucrt64 }
- { icon: '🟧', sys: clang64 }
name: ${{ matrix.icon }} MSYS2-${{ matrix.sys }}-${{ inputs.build_mode }}
defaults:
run:
shell: msys2 {0}

steps:
- name: '${{ matrix.icon }} Setup MSYS2'
uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.sys}}
update: true
install: >-
base-devel
git
gcc
make
development
pacboy: >-
toolchain:p
cmake:p
ninja:p
- name: Set git to use LF
run: |
git config --global core.autocrlf input
- name: Get Sources
uses: actions/[email protected]

- name: CMake Configure
run: |
mkdir "${{ runner.workspace }}/build"
cd "${{ runner.workspace }}/build"
cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake \
-G Ninja \
-DCMAKE_BUILD_TYPE=${{ inputs.build_mode }} \
-DCMAKE_TOOLCHAIN_FILE="" \
-DHDF5_GENERATE_HEADERS=OFF \
-DBUILD_SHARED_LIBS=ON \
-DHDF5_ENABLE_ALL_WARNINGS=ON \
-DHDF5_ENABLE_PARALLEL:BOOL=OFF \
-DHDF5_BUILD_CPP_LIB:BOOL=OFF \
-DHDF5_BUILD_FORTRAN=OFF \
-DHDF5_BUILD_JAVA=OFF \
-DHDF5_BUILD_DOC=OFF \
-DLIBAEC_USE_LOCALCONTENT=OFF \
-DZLIB_USE_LOCALCONTENT=OFF \
$GITHUB_WORKSPACE
- name: CMake Build
run: |
cmake --build . --parallel 3 --config ${{ inputs.build_mode }}
working-directory: ${{ runner.workspace }}/build

- name: CMake Run Tests
run: |
ctest . --parallel 2 -C ${{ inputs.build_mode }} -V -E "tfloatsattrs|testhdf5-base|cache_api|dt_arith|H5TEST-dtypes|err_compat"
working-directory: ${{ runner.workspace }}/build

- name: CMake Run Expected to Fail Tests
run: |
ctest . --parallel 2 -C ${{ inputs.build_mode }} -V -R "tfloatsattrs|testhdf5-base|cache_api|dt_arith|H5TEST-dtypes|err_compat"
working-directory: ${{ runner.workspace }}/build
continue-on-error: true
9 changes: 7 additions & 2 deletions config/cmake/ConfigureChecks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ else ()
set(C_INCLUDE_QUADMATH_H 0)
endif ()

if (CYGWIN)
if (MINGW OR CYGWIN)
set (CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE")
add_definitions ("-D_GNU_SOURCE")
endif ()
Expand Down Expand Up @@ -399,7 +399,12 @@ endif ()
#-----------------------------------------------------------------------------
# Check for some functions that are used
#
CHECK_FUNCTION_EXISTS (alarm ${HDF_PREFIX}_HAVE_ALARM)
if (NOT MINGW)
# alarm(2) support is spotty in MinGW, so assume it doesn't exist
#
# https://lists.gnu.org/archive/html/bug-gnulib/2013-03/msg00040.html
CHECK_FUNCTION_EXISTS (alarm ${HDF_PREFIX}_HAVE_ALARM)
endif ()
CHECK_FUNCTION_EXISTS (fcntl ${HDF_PREFIX}_HAVE_FCNTL)
CHECK_FUNCTION_EXISTS (flock ${HDF_PREFIX}_HAVE_FLOCK)
CHECK_FUNCTION_EXISTS (fork ${HDF_PREFIX}_HAVE_FORK)
Expand Down
12 changes: 12 additions & 0 deletions release_docs/RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ New Features

Configuration:
-------------
- Added support for MinGW + MSYS2 when building with CMake

We previously added support for this to the Autotools and the appropriate
configure-time checks have been added to CMake.

CMake + MinGW + MSYS2 is now tested with the following environments:

* mingw32
* mingw64
* ucrt64
* clang64

- Added CMake build mode flags to the libhdf5.settings file

Flags from the CMake build mode (e.g., optimization) are not a part of
Expand Down

0 comments on commit b15f2db

Please sign in to comment.