Skip to content

Commit 7517e01

Browse files
committed
Update compilation and wheels action
1 parent bb8a356 commit 7517e01

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

.github/workflows/wheels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
strategy:
3838
fail-fast: false
3939
matrix:
40-
os: [ubuntu-latest, macos-12, macos-14, windows-latest]
40+
os: [ubuntu-latest, macos-13, macos-14, windows-latest]
4141

4242
steps:
4343
- uses: actions/checkout@v4

CMakeLists.txt

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,28 @@ nanobind_add_module(
6363
src/signalsmith-bindings.cpp
6464
)
6565

66+
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
67+
execute_process(
68+
COMMAND ${CMAKE_CXX_COMPILER} --version
69+
OUTPUT_VARIABLE CLANG_VERSION_OUTPUT
70+
OUTPUT_STRIP_TRAILING_WHITESPACE
71+
)
72+
73+
string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)" CLANG_VERSION_MATCH "${CLANG_VERSION_OUTPUT}")
74+
set(CLANG_MAJOR_VERSION ${CMAKE_MATCH_1})
75+
set(CLANG_MINOR_VERSION ${CMAKE_MATCH_2})
76+
set(CLANG_PATCH_VERSION ${CMAKE_MATCH_3})
77+
endif()
78+
6679
# Optimize Signalsmith library
6780
if (MSVC)
6881
target_compile_options(Signalsmith PRIVATE /O2 /fp:fast)
6982
target_link_options(Signalsmith PRIVATE /GL /LTCG)
7083
else()
71-
if(NOT APPLE)
72-
target_compile_options(Signalsmith PRIVATE -O3 -ffast-math)
84+
if(APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CLANG_MAJOR_VERSION EQUAL 16 AND CLANG_MINOR_VERSION EQUAL 0 AND CLANG_PATCH_VERSION EQUAL 0)
85+
target_compile_options(Signalsmith PRIVATE -O3)
7386
else()
74-
target_compile_options(Signalsmith PRIVATE -O3)
87+
target_compile_options(Signalsmith PRIVATE -O3 -ffast-math)
7588
endif()
7689
target_link_options(Signalsmith PRIVATE -flto)
7790
endif()

0 commit comments

Comments
 (0)