System information (version)
- OpenCV => 3.4.3-p2, various
- Operating System / Platform => macOS Mojave 10.14.1
- Compiler => Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Detailed description
Despite the workaround in this commit, generally CMAKE_SYSTEM_PROCESSOR
does not get set, which leads to both AARCH64
and ARM
never getting set, which leads to NEON not getting detected i.e.
-- CPU/HW features:
-- Baseline:
There's a good discussion on why CMAKE_SYSTEM_PROCESSOR needs to be set in ruslo/hunter#954 but it appears the workaround currently in polly is insufficient. OpenCVDetectCXXCompiler.cmake and OpenCVCompilerOptimizations.cmake depend on a value here in order to know to even run the checks for NEON (or SSE).
The problem is that the attempted fix:
set(_all_archs ${IPHONESIMULATOR_ARCHS} ${IPHONEOS_ARCHS})
list(LENGTH _all_archs _all_archs_len)
if(_all_archs_len EQUAL 1)
set(CMAKE_SYSTEM_PROCESSOR ${_all_archs})
else()
set(CMAKE_SYSTEM_PROCESSOR "")
endif()
doesn't work when _all_archs_len is greater than 1, which is the case when I use any ios-*.cmake, where _all_archs ends up being x86_64;arm64
(simulator arch ; iPhone arch).
Note we are seeing NEON always properly detected with hunter targeting Android and this problem is specific to iOS.
Steps to reproduce
We run:
POLLY_IOS_DEVELOPMENT_TEAM="<our 10-digit ID>" POLLY_IOS_BUNDLE_IDENTIFIER="<our com.company.appname id>" \
cmake -DCMAKE_TOOLCHAIN_FILE=~/polly/ios.cmake -G Xcode "<source dir>"
where the top-level CMake file does hunter_add_package(OpenCV)
. When detecting CPU baseline features the output will just show Baseline:
i.e. did not find NEON.
Compare that to the base case of grabbing non-hunter opencv's 3.4.3 tag and running:
python platforms/ios/build_framework.py build/ios
Then the output will show successful detection of Baseline: NEON
or Baseline: NEON,FP16
.