aboutsummaryrefslogtreecommitdiff
path: root/python/python3-soxr/fix_arm_and_i686.patch
blob: c3aff84b20d0bbbe9997b811d7da1b499aeb9165 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
From 20c26bb5f8402f12f1a2452a7228c258c64d5b95 Mon Sep 17 00:00:00 2001
From: dofuuz <dofu@nate.com>
Date: Wed, 14 Jul 2021 19:15:15 +0900
Subject: [PATCH] Fix ARM, linux_i686 compile

---
 .github/workflows/build-dist.yml |  2 +-
 setup.py                         | 12 +++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/build-dist.yml b/.github/workflows/build-dist.yml
index 1cccbec..3a406a7 100644
--- a/.github/workflows/build-dist.yml
+++ b/.github/workflows/build-dist.yml
@@ -33,7 +33,7 @@ jobs:
         uses: joerick/cibuildwheel@v1.11.0
         env:
           # Skip build errors
-          CIBW_SKIP: "*-manylinux_i686 pp*-macosx_x86_64 pp*-win32"
+          CIBW_SKIP: "pp*-macosx_x86_64 pp*-win32"
 
       - uses: actions/upload-artifact@v2
         with:
diff --git a/setup.py b/setup.py
index b7b6a85..66f8ff1 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,8 @@
 from setuptools import find_packages
 from setuptools import setup, Extension
 
+import distutils.util
+
 
 class CySoxrExtension(Extension):
     def __init__(self, *args, **kwargs):
@@ -48,13 +50,21 @@ def include_dirs(self, dirs):
     'soxr/cysoxr.pyx'
 ]
 
+compile_args = ['-DSOXR_LIB']
+platform = distutils.util.get_platform()
+
+if '-arm' in platform or '-aarch' in platform:
+    compile_args.append('-mfpu=neon')
+elif '-i686' in platform:
+    compile_args.append('-msse')
+
 extensions = [
     CySoxrExtension(
         "soxr.cysoxr",
         src,
         include_dirs=['libsoxr/src', 'soxr'],
         language="c",
-        extra_compile_args=['-DSOXR_LIB'])
+        extra_compile_args=compile_args)
 ]