Repository: lbl-srg/funnel (language: python)

Issue:
arm64 support for macOS
On an M1 processor I get:
```
RuntimeError: Could not load funnel library with this path: /opt/homebrew/lib/python3.9/site-packages/pyfunnel/lib/darwin64/libfunnel.dylib. dlopen(/opt/homebrew/lib/python3.9/site-packages/pyfunnel/lib/darwin64/libfunnel.dylib, 0x0006): tried: '/opt/homebrew/lib/python3.9/site-packages/pyfunnel/lib/darwin64/libfunnel.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
```

I'll propose a fix!


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml
index 333d7123..399a31e8 100644
--- a/.github/workflows/cmake.yml
+++ b/.github/workflows/cmake.yml
@@ -65,13 +65,13 @@ jobs:
         shell: bash
         run: ctest -C $BUILD_TYPE --verbose
 
-      - name: Push changes to remote
-        if: contains(matrix.os, 'latest') && contains(matrix.python-version, '3.9')
+      - name: Push binaries
+        if: contains(matrix.os, 'latest') && contains(matrix.python-version, '3.9') && github.event.pull_request.merged == true
         run: |
           git config --global user.name $GH_USERNAME
           git config --global user.email $GH_USERNAME@users.noreply.github.com
           git config --global pull.rebase false
-          git add ${{ github.workspace }}/pyfunnel/lib
-          git commit -m "Add ${{ matrix.os }} binaries" --allow-empty
           git pull
+          git add ${{ github.workspace }}/pyfunnel/lib
+          git diff-index --quiet HEAD || git commit -m "Add ${{ matrix.os }} binaries"
           git push
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d64f13fb..15662945 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,9 +1,16 @@
 # Change Log
 
+## Version 1.0.0
+
+- Add macOS universal build
+- Add support for headless Linux
+- Other bug fixes and improvements
+
 ## Version 0.3.1
 
 - Add tube size limit to avoid vanishing tube size in case of relative tolerance and low variable value
 - Change print format for higher precision (`%.16g`)
+
 ## Version 0.3.0
 
 - Add local tolerance parameters `ltolx` and `ltoly`
diff --git a/CMakeLists.txt b/CMakeLists.txt
index da1c2fc4..7fd8330a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,6 +16,14 @@
 cmake_policy(SET CMP0048 NEW)
 cmake_minimum_required(VERSION 3.22)
 file(READ "${CMAKE_SOURCE_DIR}/pyfunnel/VERSION" VERSION)
+
+# Configure macOS universal build.
+# This should be set prior to the first project() or enable_language() command invocation because
+# it may influence configuration of the toolchain and flags.
+# This is ignored on platforms other than Apple.
+set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "")
+
+# Set up project.
 project(funnel VERSION ${VERSION} LANGUAGES C)
 enable_testing()
 
@@ -30,7 +38,7 @@ elseif(CMAKE_SYSTEM_NAME MATCHES Darwin)
     set(MACOSX 1)
     message("Mac OS X system detected.")
 else()
-    message(WARNING "OS unknown!")
+    message(FATAL_ERROR "OS unknown!")
 endif()
 
 # Set compiling and linking options.
diff --git a/README.md b/README.md
index d1814cd9..aa489fce 100644
--- a/README.md
+++ b/README.md
@@ -65,9 +65,9 @@ By convention, the error is `max(0, y - y_up) - min(0, y - y_low)` and hence it
 
 The software is tested on the following platforms.
 
-  * Linux x64
-  * Windows x64
-  * macOS
+  * Linux x64 (Ubuntu 22.04)
+  * Windows x64 (Windows Server 2022)
+  * macOS x64 and arm64 (macOS 12)
 
 A Python binding is available to access the library. It is supported on Python versions 3.8 through 3.9.
 
diff --git a/pyfunnel/VERSION b/pyfunnel/VERSION
index a2268e2d..afaf360d 100644
--- a/pyfunnel/VERSION
+++ b/pyfunnel/VERSION
@@ -1,1 +1,1 @@
-0.3.1
\ No newline at end of file
+1.0.0
\ No newline at end of file
diff --git a/pyfunnel/lib/darwin64/libfunnel.dylib b/pyfunnel/lib/darwin64/libfunnel.dylib
index 84ae731d..aa21b5a1 100755
Binary files a/pyfunnel/lib/darwin64/libfunnel.dylib and b/pyfunnel/lib/darwin64/libfunnel.dylib differ
diff --git a/pyfunnel/lib/win64/funnel.dll b/pyfunnel/lib/win64/funnel.dll
index e633af18..9eac1637 100644
Binary files a/pyfunnel/lib/win64/funnel.dll and b/pyfunnel/lib/win64/funnel.dll differ
diff --git a/pyfunnel/lib/win64/funnel.lib b/pyfunnel/lib/win64/funnel.lib
index f8823af9..37e19991 100644
Binary files a/pyfunnel/lib/win64/funnel.lib and b/pyfunnel/lib/win64/funnel.lib differ


Test patch:
diff --git a/tests/test_bin/results/upperBound.csv b/tests/test_bin/results/upperBound.csv
index 32fc2e15..c207fcbb 100644
--- a/tests/test_bin/results/upperBound.csv
+++ b/tests/test_bin/results/upperBound.csv
@@ -3,7 +3,7 @@ x,y
 0.048,0.002
 0.098,1.002
 0.202,1.002
-0.249,0.06200000000000061
+0.249,0.06199999999999956
 0.298,3.002
 0.352,3.002
 0.402,0.002