summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJukka Ojanen <jukka.ojanen@linkotec.net>2015-11-24 11:55:21 +0200
committerJukka Ojanen <jukka.ojanen@linkotec.net>2015-11-24 11:55:21 +0200
commitc3e325911ae15524c814db75fe701df91d6f7c2a (patch)
treec38619b88c0d04061b0f6fc25472921b2585ebf0
parent42546982a254031a5ead53e53ba2a5872b582651 (diff)
downloadffts-c3e325911ae15524c814db75fe701df91d6f7c2a.zip
ffts-c3e325911ae15524c814db75fe701df91d6f7c2a.tar.gz
Fix ARM 'softfp' detection, broken by ARM 'hard' float detection
-rw-r--r--CMakeLists.txt50
1 files changed, 29 insertions, 21 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f6f5c4c..6536ef0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -129,16 +129,34 @@ if(NOT CMAKE_CROSSCOMPILING)
}"
)
- # Test running with -mfpu=neon
+ # Test running with -mfpu=neon and -mfloat-abi=hard
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS_SAVE} -mfpu=neon -mfloat-abi=hard")
- check_c_source_runs("${TEST_SOURCE_CODE}" NEON_SUPPORTED)
-
- if(NOT NEON_SUPPORTED)
- # Fallback using VFP if NEON is not supported
- if(ENABLE_NEON)
- message(FATAL_ERROR "FFTS cannot enable NEON on this platform")
- endif(ENABLE_NEON)
+ check_c_source_runs("${TEST_SOURCE_CODE}" NEON_HARDFP_SUPPORTED)
+
+ if(NOT NEON_HARDFP_SUPPORTED)
+ # Test running with -mfpu=neon and -mfloat-abi=softfp
+ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS_SAVE} -mfpu=neon -mfloat-abi=softfp")
+ check_c_source_runs("${TEST_SOURCE_CODE}" NEON_SOFTFP_SUPPORTED)
+
+ if(NOT NEON_SOFTFP_SUPPORTED)
+ if(ENABLE_NEON)
+ message(FATAL_ERROR "FFTS cannot enable NEON on this platform")
+ endif(ENABLE_NEON)
+ else()
+ message("FFTS is using 'neon' FPU and 'softfp' float ABI")
+ set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -mfpu=neon -mfloat-abi=softfp")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon -mfloat-abi=softfp")
+ set(ENABLE_NEON ON)
+ endif(NOT NEON_SOFTFP_SUPPORTED)
+ else()
+ message("FFTS is using 'neon' FPU and 'hard' float ABI")
+ set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -mfpu=neon -mfloat-abi=hard")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon -mfloat-abi=hard")
+ set(ENABLE_NEON ON)
+ endif(NOT NEON_HARDFP_SUPPORTED)
+ # Fallback using VFP if NEON is not supported
+ if(NOT NEON_HARDFP_SUPPORTED AND NOT NEON_SOFTFP_SUPPORTED)
# Test for ARM VFP support
set(TEST_SOURCE_CODE "
double sum(double a, double b)
@@ -169,19 +187,9 @@ if(NOT CMAKE_CROSSCOMPILING)
message("FFTS is using 'vfp' FPU")
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -mfpu=vfp")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=vfp")
+ set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
set(ENABLE_VFP ON)
endif(NOT VFP_SUPPORTED)
- else()
- message("FFTS is using 'neon' FPU")
- set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -mfpu=neon")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon")
- set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS_SAVE} -mfpu=neon")
- set(ENABLE_NEON ON)
- endif(NOT NEON_SUPPORTED)
-
- # Determinate float ABI if NEON or VFP is used
- if(NEON_SUPPORTED OR VFP_SUPPORTED)
- set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
# Test running with -mfloat-abi=hard
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS_SAVE} -mfloat-abi=hard")
@@ -193,7 +201,7 @@ if(NOT CMAKE_CROSSCOMPILING)
# Test running with -mfloat-abi=softfp
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS_SAVE} -mfloat-abi=softfp")
check_c_source_runs("${TEST_SOURCE_CODE}" SOFTFP_SUPPORTED)
-
+
if(NOT SOFTFP_SUPPORTED)
# Most likely development libraries are missing
message(WARNING "FFTS is using 'soft' float ABI")
@@ -207,7 +215,7 @@ if(NOT CMAKE_CROSSCOMPILING)
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -mfloat-abi=hard")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfloat-abi=hard")
endif(NOT HARDFP_SUPPORTED)
- endif(NEON_SUPPORTED OR VFP_SUPPORTED)
+ endif(NOT NEON_HARDFP_SUPPORTED AND NOT NEON_SOFTFP_SUPPORTED)
else()
set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
OpenPOWER on IntegriCloud