Skip to content

Commit

Permalink
Merge pull request #2 from jetsonhacks/ARM-SSE-fix
Browse files Browse the repository at this point in the history
Improve Makefile to determine platform and use SSE instructions only if the processor is not ARM.
  • Loading branch information
Maghoumi committed Jun 5, 2016
2 parents 79056fb + 23da0fd commit 94274fe
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@ LIBUSB_FLAGS := `pkg-config --cflags --libs libusb-1.0`
CFLAGS := -std=c11 -fPIC -pedantic -DRS_USE_$(BACKEND)_BACKEND $(LIBUSB_FLAGS)
CXXFLAGS := -std=c++11 -fPIC -pedantic -Ofast -Wno-missing-field-initializers

# Don't use ssse3 if on ARM
UNAME_P := $(shell uname -p)
ifneq ($(filter arm%,$(UNAME_P)),)
CXXFLAGS += -mssse3
# Use SSE if feature is available - cpuinfo has features such as SSE on x86, NEON on ARM
cpufeature = $(if $(findstring $(1),$(shell cat /proc/cpuinfo)),$(2))
PARAMS_SSE = $(call cpufeature,sse,-msse) $(call cpufeature,sse2,-msse2) $(call cpufeature,sse3,-msse3) \
$(call cpufeature,sse4,-msse4) $(call cpufeature,sse4_1,-msse4.1) \
$(call cpufeature,sse4_2,-msse4.2)

ifneq ($(strip $(PARAMS_SSE)),)
CFLAGS += $(PARAMS_SSE)
CXXFLAGS += $(PARAMS_SSE)
endif


CXXFLAGS += -Wno-switch -Wno-multichar -DRS_USE_$(BACKEND)_BACKEND $(LIBUSB_FLAGS)

# Add specific include paths for OSX
Expand Down

0 comments on commit 94274fe

Please sign in to comment.