aboutsummaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
authorChristian Fetzer <fetzer.ch@gmail.com>2016-09-04 16:31:49 +0200
committerChristian Fetzer <fetzer.ch@gmail.com>2016-09-05 22:18:42 +0200
commit262ebc90ee36054e7eac1baeda7ccbae9995f606 (patch)
tree743f53d988edc703ee60913801d6266e10659833 /project
parent204c0033bd75b0be9d2eb6ce778bdc8edad21b01 (diff)
[cmake] Add support for NEON optimization
Diffstat (limited to 'project')
-rw-r--r--project/cmake/scripts/android/ArchSetup.cmake2
-rw-r--r--project/cmake/scripts/common/ArchSetup.cmake8
-rw-r--r--project/cmake/scripts/ios/ArchSetup.cmake1
-rw-r--r--project/cmake/scripts/linux/ArchSetup.cmake4
-rw-r--r--project/cmake/scripts/osx/ArchSetup.cmake1
-rw-r--r--project/cmake/scripts/rbpi/ArchSetup.cmake2
6 files changed, 18 insertions, 0 deletions
diff --git a/project/cmake/scripts/android/ArchSetup.cmake b/project/cmake/scripts/android/ArchSetup.cmake
index 6e84b9a525..3ae9505309 100644
--- a/project/cmake/scripts/android/ArchSetup.cmake
+++ b/project/cmake/scripts/android/ArchSetup.cmake
@@ -13,8 +13,10 @@ if(WITH_ARCH)
else()
if(CPU STREQUAL armeabi-v7a)
set(ARCH arm)
+ set(NEON True)
elseif(CPU STREQUAL i686)
set(ARCH i486-linux)
+ set(NEON False)
else()
message(SEND_ERROR "Unknown CPU: ${CPU}")
endif()
diff --git a/project/cmake/scripts/common/ArchSetup.cmake b/project/cmake/scripts/common/ArchSetup.cmake
index dcd392ab0e..eed1dbb27e 100644
--- a/project/cmake/scripts/common/ArchSetup.cmake
+++ b/project/cmake/scripts/common/ArchSetup.cmake
@@ -121,3 +121,11 @@ foreach(_sse SSE SSE2 SSE3 SSSE3 SSE4_1 SSE4_2 AVX AVX2)
list(APPEND ARCH_DEFINES -DHAVE_${_sse}=1)
endif()
endforeach()
+
+if(NOT DEFINED NEON OR NEON)
+ option(ENABLE_NEON "Enable NEON optimization" ${NEON})
+ if(ENABLE_NEON)
+ message(STATUS "NEON optimization enabled")
+ add_options(CXX ALL_BUILDS "-mfpu=neon -mvectorize-with-neon-quad")
+ endif()
+endif()
diff --git a/project/cmake/scripts/ios/ArchSetup.cmake b/project/cmake/scripts/ios/ArchSetup.cmake
index 4ce0d3df9d..56661e22da 100644
--- a/project/cmake/scripts/ios/ArchSetup.cmake
+++ b/project/cmake/scripts/ios/ArchSetup.cmake
@@ -14,6 +14,7 @@ if(WITH_ARCH)
else()
if(CPU STREQUAL armv7 OR CPU STREQUAL arm64)
set(ARCH arm-osx)
+ set(NEON False)
else()
message(SEND_ERROR "Unknown CPU: ${CPU}")
endif()
diff --git a/project/cmake/scripts/linux/ArchSetup.cmake b/project/cmake/scripts/linux/ArchSetup.cmake
index abca06ccbf..3cf5562d8c 100644
--- a/project/cmake/scripts/linux/ArchSetup.cmake
+++ b/project/cmake/scripts/linux/ArchSetup.cmake
@@ -8,13 +8,17 @@ if(WITH_ARCH)
else()
if(CPU STREQUAL x86_64)
set(ARCH x86_64-linux)
+ set(NEON False)
elseif(CPU MATCHES "i.86")
set(ARCH i486-linux)
+ set(NEON False)
add_options(CXX ALL_BUILDS "-msse")
elseif(CPU MATCHES arm)
set(ARCH arm)
+ set(NEON True)
elseif(CPU MATCHES aarch64 OR CPU MATCHES arm64)
set(ARCH aarch64)
+ set(NEON False)
else()
message(SEND_ERROR "Unknown CPU: ${CPU}")
endif()
diff --git a/project/cmake/scripts/osx/ArchSetup.cmake b/project/cmake/scripts/osx/ArchSetup.cmake
index ee9bf8b1a7..30478636e6 100644
--- a/project/cmake/scripts/osx/ArchSetup.cmake
+++ b/project/cmake/scripts/osx/ArchSetup.cmake
@@ -16,6 +16,7 @@ if(WITH_ARCH)
else()
if(CPU STREQUAL x86_64 OR CPU STREQUAL i386)
set(ARCH x86-osx)
+ set(NEON False)
else()
message(SEND_ERROR "Unknown CPU: ${CPU}")
endif()
diff --git a/project/cmake/scripts/rbpi/ArchSetup.cmake b/project/cmake/scripts/rbpi/ArchSetup.cmake
index c225ea8ef8..0fc3422c16 100644
--- a/project/cmake/scripts/rbpi/ArchSetup.cmake
+++ b/project/cmake/scripts/rbpi/ArchSetup.cmake
@@ -16,8 +16,10 @@ if(WITH_ARCH)
else()
if(CPU STREQUAL arm1176jzf-s)
set(ARCH arm-linux-gnueabihf)
+ set(NEON False)
elseif(CPU MATCHES "cortex-a7" OR CPU MATCHES "cortex-a53")
set(ARCH arm-linux-gnueabihf)
+ set(NEON True)
else()
message(SEND_ERROR "Unknown CPU: ${CPU}")
endif()