aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorPavol Rusnak <pavol@rusnak.io>2023-04-30 20:48:38 +0200
committerGitHub <noreply@github.com>2023-04-30 20:48:38 +0200
commit6f796992869f306c48484d62a39f2a181ae2fd6f (patch)
tree3adef9653fbe9f8573f3b97ac838c0476670adb9 /CMakeLists.txt
parenta5d30b1f53677cb50791fec41c43e93274347303 (diff)
build: add armv{6,7,8} support to cmake (#1251)
- flags copied from Makefile - updated comments in both CMakeLists.txt and Makefile to match reality
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt15
1 files changed, 14 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bbf5995..0983061 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -258,9 +258,22 @@ if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES
# TODO: arm msvc?
else()
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
+ # Apple M1, M2, etc.
+ # Raspberry Pi 3, 4, Zero 2 (64-bit)
add_compile_options(-mcpu=native)
endif()
- # TODO: armv6,7,8 version specific flags
+ if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "armv6")
+ # Raspberry Pi 1, Zero
+ add_compile_options(-mfpu=neon-fp-armv8 -mfp16-format=ieee -mno-unaligned-access)
+ endif()
+ if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "armv7")
+ # Raspberry Pi 2
+ add_compile_options(-mfpu=neon-fp-armv8 -mfp16-format=ieee -mno-unaligned-access -funsafe-math-optimizations)
+ endif()
+ if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "armv8")
+ # Raspberry Pi 3, 4, Zero 2 (32-bit)
+ add_compile_options(-mfp16-format=ieee -mno-unaligned-access)
+ endif()
endif()
elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^(x86_64|i686|AMD64)$")
message(STATUS "x86 detected")