Support iOS builds with CMake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ed799cd..45b1b34 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,14 +11,14 @@
OPTION(BUILD_MOCK_TESTS "Build C++ mock tests (need googletest)" ON)
# ---[ Build flags
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
IF(NOT MSVC)
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2 -fPIC")
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
ENDIF()
IF(NOT CMAKE_SYSTEM_PROCESSOR)
MESSAGE(FATAL_ERROR "CMAKE_SYSTEM_PROCESSOR not defined")
-ELSEIF(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^(i686|x86_64|armv5te|armv7-a|armv7l|aarch64)$")
+ELSEIF(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^(i686|x86_64|armv5te|armv7|armv7f|armv7s|armv7k|armv7-a|armv7l|arm64|aarch64)$")
MESSAGE(FATAL_ERROR "Unrecognized CMAKE_SYSTEM_PROCESSOR = ${CMAKE_SYSTEM_PROCESSOR}")
ENDIF()
@@ -55,7 +55,7 @@
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
LIST(APPEND CPUINFO_SRCS src/x86/mach/init.c)
ENDIF()
-ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv5te|armv7-a|armv7l|aarch64)$")
+ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv5te|armv7|armv7f|armv7s|armv7k|armv7-a|armv7l|arm64|aarch64)$")
LIST(APPEND CPUINFO_SRCS
src/arm/uarch.c
src/arm/cache.c)
@@ -66,19 +66,21 @@
src/arm/linux/clusters.c
src/arm/linux/chipset.c
src/arm/linux/midr.c)
+ IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv5te|armv7l|armv7-a)$")
+ LIST(APPEND CPUINFO_SRCS src/arm/linux/arm32-isa.c)
+ IF(CMAKE_SYSTEM_NAME STREQUAL "Android" AND ANDROID_ABI STREQUAL "armeabi")
+ SET_SOURCE_FILES_PROPERTIES(src/arm/linux/arm32-isa.c PROPERTIES COMPILE_FLAGS -marm)
+ ENDIF()
+ ELSEIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
+ LIST(APPEND CPUINFO_SRCS src/arm/linux/arm64-isa.c)
+ ENDIF()
+ ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ LIST(APPEND CPUINFO_SRCS src/arm/mach/init.c)
ENDIF()
IF(CMAKE_SYSTEM_NAME STREQUAL "Android")
LIST(APPEND CPUINFO_SRCS
src/arm/Android/properties.c)
ENDIF()
- IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv5te|armv7l|armv7-a)$")
- LIST(APPEND CPUINFO_SRCS src/arm/linux/arm32-isa.c)
- IF(CMAKE_SYSTEM_NAME STREQUAL "Android" AND ANDROID_ABI STREQUAL "armeabi")
- SET_SOURCE_FILES_PROPERTIES(src/arm/linux/arm32-isa.c PROPERTIES COMPILE_FLAGS -marm)
- ENDIF()
- ELSEIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
- LIST(APPEND CPUINFO_SRCS src/arm/linux/arm64-isa.c)
- ENDIF()
ENDIF()
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android")