mirror of
https://github.com/opencv/opencv.git
synced 2024-11-23 18:50:21 +08:00
cmake: reuse OpenCV NEON detection in carotene
- use carotene if NEON available only
This commit is contained in:
parent
504cd8a9f5
commit
ffaf15d0d9
16
3rdparty/carotene/hal/CMakeLists.txt
vendored
16
3rdparty/carotene/hal/CMakeLists.txt
vendored
@ -58,22 +58,6 @@ function(compile_carotene)
|
||||
endif()
|
||||
|
||||
add_subdirectory("${CAROTENE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/carotene")
|
||||
|
||||
if(ARM OR AARCH64)
|
||||
if(CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_TRY_COMPILE_CONFIGURATION ${CMAKE_BUILD_TYPE})
|
||||
endif()
|
||||
check_cxx_compiler_flag("-mfpu=neon" CXX_HAS_MFPU_NEON)
|
||||
check_c_compiler_flag("-mfpu=neon" C_HAS_MFPU_NEON)
|
||||
if(${CXX_HAS_MFPU_NEON} AND ${C_HAS_MFPU_NEON} AND NOT "${CMAKE_CXX_FLAGS} " MATCHES "-mfpu=neon[^ ]*")
|
||||
get_target_property(old_flags "carotene_objs" COMPILE_FLAGS)
|
||||
if(old_flags)
|
||||
set_target_properties("carotene_objs" PROPERTIES COMPILE_FLAGS "${old_flags} -mfpu=neon")
|
||||
else()
|
||||
set_target_properties("carotene_objs" PROPERTIES COMPILE_FLAGS "-mfpu=neon")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
compile_carotene()
|
||||
|
@ -797,9 +797,13 @@ endif()
|
||||
|
||||
foreach(hal ${OpenCV_HAL})
|
||||
if(hal STREQUAL "carotene")
|
||||
add_subdirectory(3rdparty/carotene/hal)
|
||||
ocv_hal_register(CAROTENE_HAL_LIBRARIES CAROTENE_HAL_HEADERS CAROTENE_HAL_INCLUDE_DIRS)
|
||||
list(APPEND OpenCV_USED_HAL "carotene (ver ${CAROTENE_HAL_VERSION})")
|
||||
if(";${CPU_BASELINE_FINAL};" MATCHES ";NEON;")
|
||||
add_subdirectory(3rdparty/carotene/hal)
|
||||
ocv_hal_register(CAROTENE_HAL_LIBRARIES CAROTENE_HAL_HEADERS CAROTENE_HAL_INCLUDE_DIRS)
|
||||
list(APPEND OpenCV_USED_HAL "carotene (ver ${CAROTENE_HAL_VERSION})")
|
||||
else()
|
||||
message(STATUS "Carotene: NEON is not available, disabling carotene...")
|
||||
endif()
|
||||
elseif(hal STREQUAL "openvx")
|
||||
add_subdirectory(3rdparty/openvx)
|
||||
ocv_hal_register(OPENVX_HAL_LIBRARIES OPENVX_HAL_HEADERS OPENVX_HAL_INCLUDE_DIRS)
|
||||
|
Loading…
Reference in New Issue
Block a user