From 22dd9a0633d4f7b4fd02c0aab27ccc7a1e2dec07 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 20 Jul 2018 21:14:19 -0400 Subject: [PATCH] Add platform-specific flags for NEON. --- setup.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 0d52893..de59811 100644 --- a/setup.py +++ b/setup.py @@ -44,7 +44,6 @@ sources = [ 'pyfastnoisesimd/fastnoisesimd/FastNoiseSIMD.cpp', 'pyfastnoisesimd/fastnoisesimd/FastNoiseSIMD_internal.cpp', - 'pyfastnoisesimd/fastnoisesimd/FastNoiseSIMD_neon.cpp', 'pyfastnoisesimd/wrapper.cpp' ] inc_dirs = [get_include(), 'pyfastnoisesimd', 'pyfastnoisesimd/fastnoisesimd/'] @@ -73,6 +72,14 @@ '/arch:AVX2', ] } + neon = { + 'sources': [ + 'pyfastnoisesimd/fastnoisesimd/FastNoiseSIMD_neon.cpp', + ], + 'cflags': [ + '/Oi', + ], + } if platform.machine() == 'AMD64': # 64-bit windows #`/arch:SSE2` doesn't exist on Windows x64 builds, and generates a needless warnings @@ -146,6 +153,15 @@ '-msse2', ], } + neon = { + 'sources': [ + 'pyfastnoisesimd/fastnoisesimd/FastNoiseSIMD_neon.cpp', + ], + 'cflags': [ + '-std=c++11', + '-mfpu=neon', + ], + } fma_flags = ['-mfma'] clibs = [ @@ -153,6 +169,7 @@ ('avx2', avx2), ('sse41', sse41), ('sse2', sse2), + ('neon', neon), ] @@ -162,6 +179,7 @@ class build(_build): ('with-avx2=', None, 'Use AVX2 instructions: auto|yes|no'), ('with-sse41=', None, 'Use SSE4.1 instructions: auto|yes|no'), ('with-sse2=', None, 'Use SSE2 instructions: auto|yes|no'), + ('with-neon=', None, 'Use NEON instructions: auto|yes|no'), ('with-fma=', None, 'Use FMA instructions: auto|yes|no'), ] @@ -171,6 +189,7 @@ def initialize_options(self): self.with_avx2 = 'auto' self.with_sse41 = 'auto' self.with_sse2 = 'auto' + self.with_neon = 'auto' self.with_fma = 'auto' def finalize_options(self):