diff --git a/.github/workflows/ci_macos.yml b/.github/workflows/ci_macos.yml index cf582456..51a801ec 100644 --- a/.github/workflows/ci_macos.yml +++ b/.github/workflows/ci_macos.yml @@ -27,7 +27,7 @@ defaults: jobs: build: name: ${{ matrix.compiler }} - runs-on: macos-12 + runs-on: macos-14 if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch' || github.event.label.name == 'lint' strategy: fail-fast: false @@ -43,10 +43,11 @@ jobs: compiler: ${{ matrix.compiler }} ccache_size: 75M - - name: Install CMake - uses: seqan/actions/setup-cmake@main + - name: Patch M1 GCC + if: contains(matrix.compiler, 'gcc') && matrix.compiler != 'gcc-14' + uses: seqan/actions/patch-m1-gcc@main with: - cmake: 3.28.5 + compiler: ${{ matrix.compiler }} - name: Configure tests run: | diff --git a/.github/workflows/ci_sanitizer.yml b/.github/workflows/ci_sanitizer.yml index 190ef61f..a5e5bfcb 100644 --- a/.github/workflows/ci_sanitizer.yml +++ b/.github/workflows/ci_sanitizer.yml @@ -32,11 +32,11 @@ jobs: fail-fast: false matrix: name: [ASan, TSan, UBSan] - os: [ubuntu-latest, macos-12] + os: [ubuntu-latest, macos-14] build_type: [Release, RelWithDebInfo, Debug] exclude: - name: "TSan" - os: macos-12 + os: macos-14 include: - name: "ASan" @@ -46,14 +46,14 @@ jobs: cxx_flags: "-fno-omit-frame-pointer -fsanitize=thread" - name: "UBSan" - os: macos-12 + os: macos-14 cxx_flags: "-fno-omit-frame-pointer -fsanitize=undefined,float-divide-by-zero,implicit-conversion,local-bounds,nullability -Wno-pass-failed" - name: "UBSan" os: ubuntu-latest cxx_flags: "-fno-omit-frame-pointer -fsanitize=undefined,float-divide-by-zero" - - os: macos-12 + - os: macos-14 compiler: clang-18 - os: ubuntu-latest @@ -78,6 +78,12 @@ jobs: with: compiler: ${{ matrix.compiler }} + - name: Patch M1 GCC + if: contains(matrix.os, 'macos') && contains(matrix.compiler, 'gcc') && matrix.compiler != 'gcc-14' + uses: seqan/actions/patch-m1-gcc@main + with: + compiler: ${{ matrix.compiler }} + - name: Configure tests run: | mkdir build && cd build diff --git a/cmake/configuration.cmake b/cmake/configuration.cmake index a04a565e..19a62da3 100644 --- a/cmake/configuration.cmake +++ b/cmake/configuration.cmake @@ -228,8 +228,19 @@ else () set (HIBF_IS_DEBUG FALSE) endif () +# Apple M1 with GCC sets `march=apple-m1` when using `-march=native`. This option is only available with GCC >= 14. +if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm64" + AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" + AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14) + set (HIBF_M1_NO_NATIVE TRUE) +else () + set (HIBF_M1_NO_NATIVE FALSE) +endif () + option (HIBF_NATIVE_BUILD "Optimize build for current architecture." ON) -if (HIBF_IS_DEBUG) +if (HIBF_M1_NO_NATIVE) + hibf_config_print ("Optimize build: disabled (Apple M1 with GCC < 14)") +elseif (HIBF_IS_DEBUG) hibf_config_print ("Optimize build: disabled") elseif (HIBF_NATIVE_BUILD) set (HIBF_CXX_FLAGS "${HIBF_CXX_FLAGS} -march=native")