DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit a40eafdf187d6cba5ec68a2d1a3b4ced44b22361
parent 4b375f7a5f0474c802c9bc533cc3791b1b9ba501
Author: JP Cimalando <jp-dev@inbox.ru>
Date:   Thu, 31 Oct 2019 21:15:09 +0100

Detect the processor type, enable SSE2 only when possible (#191)

* Detect the processor type, enable SSE2 on Intel only

* Add some default optimizations for ARM

Diffstat:
MMakefile.base.mk | 35+++++++++++++++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)

diff --git a/Makefile.base.mk b/Makefile.base.mk @@ -11,6 +11,8 @@ CXX ?= g++ # --------------------------------------------------------------------------------------------------------------------- # Auto-detect OS if not defined +TARGET_MACHINE := $(shell $(CC) -dumpmachine) + ifneq ($(BSD),true) ifneq ($(HAIKU),true) ifneq ($(HURD),true) @@ -18,7 +20,6 @@ ifneq ($(LINUX),true) ifneq ($(MACOS),true) ifneq ($(WINDOWS),true) -TARGET_MACHINE := $(shell $(CC) -dumpmachine) ifneq (,$(findstring bsd,$(TARGET_MACHINE))) BSD=true endif @@ -46,6 +47,28 @@ endif endif # --------------------------------------------------------------------------------------------------------------------- +# Auto-detect the processor + +TARGET_PROCESSOR := $(firstword $(subst -, ,$(TARGET_MACHINE))) + +ifneq (,$(filter i%86,$(TARGET_PROCESSOR))) +CPU_I386=true +CPU_I386_OR_X86_64=true +endif +ifneq (,$(filter x86_64,$(TARGET_PROCESSOR))) +CPU_X86_64=true +CPU_I386_OR_X86_64=true +endif +ifneq (,$(filter arm%,$(TARGET_PROCESSOR))) +CPU_ARM=true +CPU_ARM_OR_AARCH64=true +endif +ifneq (,$(filter aarch64%,$(TARGET_PROCESSOR))) +CPU_AARCH64=true +CPU_ARM_OR_AARCH64=true +endif + +# --------------------------------------------------------------------------------------------------------------------- # Set PKG_CONFIG (can be overridden by environment variable) ifeq ($(WINDOWS),true) @@ -106,7 +129,15 @@ endif # Set build and link flags BASE_FLAGS = -Wall -Wextra -pipe -MD -MP -BASE_OPTS = -O3 -ffast-math -mtune=generic -msse -msse2 -fdata-sections -ffunction-sections +BASE_OPTS = -O3 -ffast-math -mtune=generic -fdata-sections -ffunction-sections + +ifeq ($(CPU_I386_OR_X86_64),true) +BASE_OPTS += -msse -msse2 +endif + +ifeq ($(CPU_ARM),true) +BASE_OPTS += -mfpu=neon-vfpv4 -mfloat-abi=hard +endif ifeq ($(MACOS),true) # MacOS linker flags