Skip to content

Commit

Permalink
Update compilation and wheels action
Browse files Browse the repository at this point in the history
  • Loading branch information
gregogiudici committed Feb 13, 2025
1 parent bb8a356 commit 7517e01
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-12, macos-14, windows-latest]
os: [ubuntu-latest, macos-13, macos-14, windows-latest]

steps:
- uses: actions/checkout@v4
Expand Down
19 changes: 16 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,28 @@ nanobind_add_module(
src/signalsmith-bindings.cpp
)

if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
execute_process(
COMMAND ${CMAKE_CXX_COMPILER} --version
OUTPUT_VARIABLE CLANG_VERSION_OUTPUT
OUTPUT_STRIP_TRAILING_WHITESPACE
)

string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)" CLANG_VERSION_MATCH "${CLANG_VERSION_OUTPUT}")
set(CLANG_MAJOR_VERSION ${CMAKE_MATCH_1})
set(CLANG_MINOR_VERSION ${CMAKE_MATCH_2})
set(CLANG_PATCH_VERSION ${CMAKE_MATCH_3})
endif()

# Optimize Signalsmith library
if (MSVC)
target_compile_options(Signalsmith PRIVATE /O2 /fp:fast)
target_link_options(Signalsmith PRIVATE /GL /LTCG)
else()
if(NOT APPLE)
target_compile_options(Signalsmith PRIVATE -O3 -ffast-math)
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)
target_compile_options(Signalsmith PRIVATE -O3)
else()
target_compile_options(Signalsmith PRIVATE -O3)
target_compile_options(Signalsmith PRIVATE -O3 -ffast-math)
endif()
target_link_options(Signalsmith PRIVATE -flto)
endif()
Expand Down

0 comments on commit 7517e01

Please sign in to comment.