rpi-libcamera-apps: fix flags used in aarch64 builds

* the CMakeLists.txt recognizes only 2 values:

IF (NOT ENABLE_COMPILE_FLAGS_FOR_TARGET)
    # On a Pi this will give us armhf or arm64.
    execute_process(COMMAND dpkg-architecture -qDEB_HOST_ARCH
        OUTPUT_VARIABLE ENABLE_COMPILE_FLAGS_FOR_TARGET OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
message(STATUS "Platform: ${ENABLE_COMPILE_FLAGS_FOR_TARGET}")
if ("${ENABLE_COMPILE_FLAGS_FOR_TARGET}" STREQUAL "arm64")
    # 64-bit binaries can be fully optimised.
    add_definitions(-ftree-vectorize)
elseif ("${ENABLE_COMPILE_FLAGS_FOR_TARGET}" STREQUAL "armv8-neon")
    # Only build with 32-bit Pi 3/4 specific optimisations if requested on the command line.
    add_definitions(-mfpu=neon-fp-armv8 -ftree-vectorize)
endif()

  the value from dpkg-architecture on host is useless
  when cross-compiling, so we always need to pass something

  for raspberrypi4-64 we were passing "armv8-neon" which results in:
  aarch64-oe-linux-g++: error: unrecognized command-line option '-mfpu=neon-fp-armv8'
  as all -mfpu options are rejected in aarch64 builds, pass better
  ENABLE_COMPILE_FLAGS_FOR_TARGET value for all MACHINEs

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
This commit is contained in:
Martin Jansa
2023-05-04 19:56:18 +02:00
committed by Andrei Gherzan
parent bf948e0aa8
commit f16219293a

View File

@ -26,8 +26,10 @@ EXTRA_OECMAKE = "\
-DCMAKE_LIBRARY_PATH=${STAGING_LIBDIR} \
"
EXTRA_OECMAKE:append:raspberrypi3 = " -DENABLE_COMPILE_FLAGS_FOR_TARGET=armv8-neon"
EXTRA_OECMAKE:append:raspberrypi4 = " -DENABLE_COMPILE_FLAGS_FOR_TARGET=armv8-neon"
LIBCAMERA_ARCH = "${TARGET_ARCH}"
LIBCAMERA_ARCH:aarch64 = "arm64"
LIBCAMERA_ARCH:arm = "armv8-neon"
EXTRA_OECMAKE += "-DENABLE_COMPILE_FLAGS_FOR_TARGET=${LIBCAMERA_ARCH}"
PACKAGECONFIG[x11] = "-DENABLE_X11=1,-DENABLE_X11=0"
PACKAGECONFIG[qt] = "-DENABLE_QT=1,-DENABLE_QT=0"