From 7e167c3c9c6c31134c189ed288f3fd9399ca4387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Morales?= Date: Wed, 1 Nov 2023 16:21:09 -0600 Subject: [PATCH] Revert "move logic to cmake" This reverts commit e0abcac18abf7940c2f5d1c2e51fdb5069531b34. --- .github/workflows/ci.yaml | 1 + CMakeLists.txt | 4 ---- scripts/disable_omp_arm64.py | 11 +++++++++++ 3 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 scripts/disable_omp_arm64.py diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index bc89e28..7b21eef 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -42,6 +42,7 @@ jobs: CIBW_ARCHS: all CIBW_TEST_SKIP: '*-macosx_arm64' CIBW_BUILD_VERBOSITY: 3 + CIBW_BEFORE_BUILD_MACOS: pip install toml && python scripts/disable_omp_arm64.py - uses: actions/upload-artifact@v3 with: diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b65ca1..9a792da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,10 +7,6 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) endif() -if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm") - set(USE_OPENMP OFF) -endif() - set(CMAKE_CXX_STANDARD 17) if(USE_OPENMP) if(APPLE) diff --git a/scripts/disable_omp_arm64.py b/scripts/disable_omp_arm64.py new file mode 100644 index 0000000..4a9b162 --- /dev/null +++ b/scripts/disable_omp_arm64.py @@ -0,0 +1,11 @@ +import platform + +import toml + + +if platform.processor() == 'arm': + with open('pyproject.toml', 'rt') as f: + cfg = toml.load(f) + cfg['tool']['scikit-build']['cmake']['args'] = ['-DUSE_OPENMP=OFF'] + with open('pyproject.toml', 'wt') as f: + toml.dump(cfg, f)