Submodule update #117
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Build, test, and install on different versions of MacOS | |
| name: MacOS | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| build-test-install: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [macos-latest] | |
| build_type: [serial, openmp, debug] | |
| include: | |
| - build_type: serial | |
| extra_flags: "-DELEMENTS_ENABLE_SERIAL=ON -DELEMENTS_ENABLE_OPENMP=OFF" | |
| - build_type: openmp | |
| extra_flags: "-DELEMENTS_ENABLE_SERIAL=ON -DELEMENTS_ENABLE_OPENMP=ON" | |
| - build_type: debug | |
| extra_flags: "-DELEMENTS_ENABLE_SERIAL=ON -DELEMENTS_ENABLE_OPENMP=OFF" | |
| runs-on: ${{matrix.os}} | |
| steps: | |
| - uses: actions/checkout@v4 # Updated to v4 for latest node support | |
| with: | |
| submodules: true | |
| - name: Install Fortran | |
| uses: fortran-lang/setup-fortran@v1 | |
| with: | |
| compiler: gcc | |
| - name: Install dependencies | |
| run: | | |
| brew install openmpi libomp gcc bison flex | |
| # Add Bison and Flex to PATH dynamically | |
| echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH | |
| echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH | |
| - name: Configure CMake (${{matrix.build_type}}) | |
| run: | | |
| # Explicitly hint Bison to CMake just in case | |
| BISON_PATH=$(brew --prefix bison)/bin/bison | |
| FLEX_PATH=$(brew --prefix flex)/bin/flex | |
| # Determine build type | |
| BUILD_TYPE="Release" | |
| if [[ "${{ matrix.build_type }}" == "debug" ]]; then | |
| BUILD_TYPE="Debug" | |
| fi | |
| # Initialize flags array | |
| CMAKE_OPTS=( | |
| "-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install" | |
| "-DCMAKE_BUILD_TYPE=$BUILD_TYPE" | |
| "-DBISON_EXECUTABLE=$BISON_PATH" | |
| "-DFLEX_EXECUTABLE=$FLEX_PATH" | |
| ) | |
| # Specific logic for OpenMP on macOS | |
| if [[ "${{ matrix.build_type }}" == "openmp" ]]; then | |
| OMP_PREFIX=$(brew --prefix libomp) | |
| # These flags help CMake find the Homebrew-installed OpenMP | |
| CMAKE_OPTS+=( | |
| "-DOpenMP_ROOT=$OMP_PREFIX" | |
| "-DOpenMP_C_FLAGS=-Xpreprocessor -fopenmp" | |
| "-DOpenMP_CXX_FLAGS=-Xpreprocessor -fopenmp" | |
| "-DOpenMP_C_LIB_NAMES=omp" | |
| "-DOpenMP_CXX_LIB_NAMES=omp" | |
| "-DOpenMP_omp_LIBRARY=$OMP_PREFIX/lib/libomp.dylib" | |
| ) | |
| fi | |
| # Execute configuration | |
| cmake -B build-${{matrix.build_type}} \ | |
| ${{matrix.extra_flags}} \ | |
| "${CMAKE_OPTS[@]}" | |
| - name: Build (${{matrix.build_type}}) | |
| run: cmake --build build-${{matrix.build_type}} | |
| - name: Install (${{matrix.build_type}}) | |
| run: cmake --install build-${{matrix.build_type}} |