From b56e9125db34614b2157516df3ee724180f2084f Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Sat, 13 Jul 2024 09:59:26 +0200 Subject: [PATCH] CMakeLists.txt: do not force compiler flags The compiler flags enforced by CMakeLists.txt can be problematic: - When CROSS_COMPILE_ARM is set, one is not necessarily building for armv6 with soft float-abi: one may be using ARMv7 with hard float - When CROSS_COMPILE_ARM is not set, forcing -mfloat-abi=hard is similarly wrong Those compiler flags should be passed by the user depending on the exact target platform. Inspired from https://gitweb.gentoo.org/repo/gentoo.git/tree/media-libs/x265/files/arm-r1.patch, and earlier work from Bertrand Jacquin and Bernd Kuhls . Upstream: https://bitbucket.org/multicoreware/x265_git/pull-requests/26 Signed-off-by: Thomas Petazzoni [Bernd: rebased for 4.1] Signed-off-by: Bernd Kuhls --- source/CMakeLists.txt | 6 +++--- source/dynamicHDR10/CMakeLists.txt | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index c14489ea6..fa331e8af 100755 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -270,14 +270,14 @@ if(GCC) endif() if(ARM AND CROSS_COMPILE_ARM) message(STATUS "cross compile arm") - set(ARM_ARGS -march=armv6 -mfloat-abi=soft -mfpu=vfp -marm -fPIC) + set(ARM_ARGS -fPIC) elseif(ARM) find_package(Neon) if(CPU_HAS_NEON) - set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=neon -marm -fPIC) + set(ARM_ARGS -mfpu=neon -fPIC) add_definitions(-DHAVE_NEON) else() - set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=vfp -marm) + set(ARM_ARGS -fPIC) endif() endif() if(ARM64) diff --git a/source/dynamicHDR10/CMakeLists.txt b/source/dynamicHDR10/CMakeLists.txt index 4243338c6..62853a06b 100644 --- a/source/dynamicHDR10/CMakeLists.txt +++ b/source/dynamicHDR10/CMakeLists.txt @@ -43,14 +43,14 @@ if(GCC) endif() endif() if(ARM AND CROSS_COMPILE_ARM) - set(ARM_ARGS -march=armv6 -mfloat-abi=soft -mfpu=vfp -marm -fPIC) + set(ARM_ARGS -fPIC) elseif(ARM) find_package(Neon) if(CPU_HAS_NEON) - set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=neon -marm -fPIC) + set(ARM_ARGS -fPIC) add_definitions(-DHAVE_NEON) else() - set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=vfp -marm) + set(ARM_ARGS -fPIC) endif() endif() add_definitions(${ARM_ARGS}) -- 2.45.2