diff --git a/build/mktargets.py b/build/mktargets.py index 842440a0..ef6e7a2e 100755 --- a/build/mktargets.py +++ b/build/mktargets.py @@ -113,11 +113,13 @@ if len(cfiles) > 0: if len(asm) > 0: f.write("ifeq ($(USE_ASM), Yes)\n") + f.write("ifeq ($(ASM_ARCH), x86)\n") f.write("%s_ASM_SRCS=\\\n"%(PREFIX)) for c in asm: f.write("\t$(%s_SRCDIR)/%s\\\n"%(PREFIX, c)) f.write("\n") f.write("%s_OBJS += $(%s_ASM_SRCS:.asm=.o)\n"%(PREFIX, PREFIX)) + f.write("endif\n") f.write("endif\n\n") f.write("OBJS += $(%s_OBJS)\n"%PREFIX) diff --git a/build/platform-android.mk b/build/platform-android.mk index 081992ea..5ad97422 100644 --- a/build/platform-android.mk +++ b/build/platform-android.mk @@ -1,4 +1,3 @@ -USE_ASM = No ARCH = arm SHAREDLIBSUFFIX = so GCCVERSION = 4.8 @@ -9,23 +8,22 @@ ifeq ($(ARCH), arm) GCCPATHPREFIX = arm-linux-androideabi GCCPREFIX = arm-linux-androideabi CFLAGS += -march=armv7-a -mfloat-abi=softfp -ifeq (Yes, $(HAVE_NEON)) + ifeq (Yes, $(HAVE_NEON)) CFLAGS += -mfpu=neon -else + else CFLAGS += -mfpu=vfpv3-d16 -endif + endif LDFLAGS += -march=armv7-a -Wl,--fix-cortex-a8 APP_ABI = armeabi-v7a else GCCPATHPREFIX = x86 GCCPREFIX = i686-linux-android APP_ABI = x86 - USE_ASM = Yes -ifeq (Yes, $(USE_ASM)) - ASM = nasm + ifeq (Yes, $(USE_ASM)) + ASM_ARCH = x86 CFLAGS += -DX86_ASM ASMFLAGS += -DNOPREFIX -f elf32 -DX86_32 -endif + endif endif ifndef NDKROOT diff --git a/build/platform-arch.mk b/build/platform-arch.mk new file mode 100644 index 00000000..75f467b1 --- /dev/null +++ b/build/platform-arch.mk @@ -0,0 +1,3 @@ +ifneq ($(filter %86 x86_64, $(ARCH)),) +include build/platform-x86-common.mk +endif diff --git a/build/platform-darwin.mk b/build/platform-darwin.mk index 8ad6691f..2d3a63c2 100644 --- a/build/platform-darwin.mk +++ b/build/platform-darwin.mk @@ -1,9 +1,9 @@ -include build/platform-x86-common.mk -ASM = nasm +include build/platform-arch.mk SHAREDLIBSUFFIX = dylib SHARED = -dynamiclib CFLAGS += -Werror -fPIC -DMACOS -DMT_ENABLED -MMD -MP LDFLAGS += -lpthread +ifeq ($(ASM_ARCH), x86) ASMFLAGS += --prefix _ -DNOPREFIX ifeq ($(ENABLE64BIT), Yes) ASMFLAGS += -f macho64 @@ -11,4 +11,5 @@ else ASMFLAGS += -f macho LDFLAGS += -read_only_relocs suppress endif +endif diff --git a/build/platform-freebsd.mk b/build/platform-freebsd.mk index eba34ac7..acbdc391 100644 --- a/build/platform-freebsd.mk +++ b/build/platform-freebsd.mk @@ -1,5 +1,4 @@ -include build/platform-x86-common.mk -ASM = nasm +include build/platform-arch.mk SHAREDLIBSUFFIX = so CFLAGS += -fPIC -DMT_ENABLED LDFLAGS += -lpthread diff --git a/build/platform-ios.mk b/build/platform-ios.mk new file mode 100644 index 00000000..e8c3a65a --- /dev/null +++ b/build/platform-ios.mk @@ -0,0 +1,15 @@ +include build/platform-darwin.mk +CXX = clang++ +CC = clang +SDK = 7.0 +ifneq ($(filter %86 x86_64, $(ARCH)),) +SDKTYPE = iPhoneSimulator +else +SDKTYPE = iPhoneOS +endif +SDK_MIN = 5.1 + +SDKROOT = /Applications/Xcode.app/Contents/Developer/Platforms/$(SDKTYPE).platform/Developer/SDKs/$(SDKTYPE)$(SDK).sdk +CFLAGS += -arch $(ARCH) -isysroot $(SDKROOT) -miphoneos-version-min=$(SDK_MIN) +LDFLAGS += -arch $(ARCH) -isysroot $(SDKROOT) -miphoneos-version-min=$(SDK_MIN) + diff --git a/build/platform-linux.mk b/build/platform-linux.mk index 1377bc0b..bd21b933 100644 --- a/build/platform-linux.mk +++ b/build/platform-linux.mk @@ -1,5 +1,4 @@ -include build/platform-x86-common.mk -ASM = nasm +include build/platform-arch.mk SHAREDLIBSUFFIX = so CFLAGS += -Werror -fPIC -DLINUX -DMT_ENABLED -MMD -MP LDFLAGS += -lpthread diff --git a/build/platform-mingw_nt.mk b/build/platform-mingw_nt.mk index f7450f6e..d0a60985 100644 --- a/build/platform-mingw_nt.mk +++ b/build/platform-mingw_nt.mk @@ -1,5 +1,4 @@ include build/platform-x86-common.mk -ASM = nasm SHAREDLIBSUFFIX = dll CFLAGS += -DMT_ENABLED -MMD -MP LDFLAGS += diff --git a/build/platform-msvc.mk b/build/platform-msvc.mk index b86123f9..48c741b0 100644 --- a/build/platform-msvc.mk +++ b/build/platform-msvc.mk @@ -1,6 +1,5 @@ include build/platform-x86-common.mk include build/platform-msvc-common.mk -ASM = nasm CFLAGS += -DMT_ENABLED LDFLAGS += user32.lib ifeq ($(ENABLE64BIT), Yes) diff --git a/build/platform-x86-common.mk b/build/platform-x86-common.mk index b81ed73d..9ac9c6de 100644 --- a/build/platform-x86-common.mk +++ b/build/platform-x86-common.mk @@ -16,5 +16,7 @@ ASMFLAGS_PLATFORM = -DX86_32 endif ifeq ($(USE_ASM),Yes) CFLAGS += -DX86_ASM +ASM_ARCH = x86 endif +ASM = nasm ASMFLAGS += $(ASMFLAGS_PLATFORM) -DNO_DYNAMIC_VP diff --git a/codec/common/targets.mk b/codec/common/targets.mk index 3cd76eb2..2f005fc5 100644 --- a/codec/common/targets.mk +++ b/codec/common/targets.mk @@ -9,6 +9,7 @@ COMMON_CPP_SRCS=\ COMMON_OBJS += $(COMMON_CPP_SRCS:.cpp=.o) ifeq ($(USE_ASM), Yes) +ifeq ($(ASM_ARCH), x86) COMMON_ASM_SRCS=\ $(COMMON_SRCDIR)/asm_inc.asm\ $(COMMON_SRCDIR)/cpuid.asm\ @@ -22,6 +23,7 @@ COMMON_ASM_SRCS=\ COMMON_OBJS += $(COMMON_ASM_SRCS:.asm=.o) endif +endif OBJS += $(COMMON_OBJS) $(COMMON_SRCDIR)/%.o: $(COMMON_SRCDIR)/%.cpp diff --git a/codec/decoder/targets.mk b/codec/decoder/targets.mk index ebb28795..cd04d941 100644 --- a/codec/decoder/targets.mk +++ b/codec/decoder/targets.mk @@ -26,6 +26,7 @@ DECODER_CPP_SRCS=\ DECODER_OBJS += $(DECODER_CPP_SRCS:.cpp=.o) ifeq ($(USE_ASM), Yes) +ifeq ($(ASM_ARCH), x86) DECODER_ASM_SRCS=\ $(DECODER_SRCDIR)/core/asm/block_add.asm\ $(DECODER_SRCDIR)/core/asm/dct.asm\ @@ -33,6 +34,7 @@ DECODER_ASM_SRCS=\ DECODER_OBJS += $(DECODER_ASM_SRCS:.asm=.o) endif +endif OBJS += $(DECODER_OBJS) $(DECODER_SRCDIR)/%.o: $(DECODER_SRCDIR)/%.cpp diff --git a/codec/encoder/targets.mk b/codec/encoder/targets.mk index 640d026d..1bb8173f 100644 --- a/codec/encoder/targets.mk +++ b/codec/encoder/targets.mk @@ -36,6 +36,7 @@ ENCODER_CPP_SRCS=\ ENCODER_OBJS += $(ENCODER_CPP_SRCS:.cpp=.o) ifeq ($(USE_ASM), Yes) +ifeq ($(ASM_ARCH), x86) ENCODER_ASM_SRCS=\ $(ENCODER_SRCDIR)/core/asm/coeff.asm\ $(ENCODER_SRCDIR)/core/asm/dct.asm\ @@ -46,6 +47,7 @@ ENCODER_ASM_SRCS=\ ENCODER_OBJS += $(ENCODER_ASM_SRCS:.asm=.o) endif +endif OBJS += $(ENCODER_OBJS) $(ENCODER_SRCDIR)/%.o: $(ENCODER_SRCDIR)/%.cpp diff --git a/codec/processing/targets.mk b/codec/processing/targets.mk index e873f2cb..8c2d61d6 100644 --- a/codec/processing/targets.mk +++ b/codec/processing/targets.mk @@ -21,6 +21,7 @@ PROCESSING_CPP_SRCS=\ PROCESSING_OBJS += $(PROCESSING_CPP_SRCS:.cpp=.o) ifeq ($(USE_ASM), Yes) +ifeq ($(ASM_ARCH), x86) PROCESSING_ASM_SRCS=\ $(PROCESSING_SRCDIR)/src/asm/denoisefilter.asm\ $(PROCESSING_SRCDIR)/src/asm/downsample_bilinear.asm\ @@ -28,6 +29,7 @@ PROCESSING_ASM_SRCS=\ PROCESSING_OBJS += $(PROCESSING_ASM_SRCS:.asm=.o) endif +endif OBJS += $(PROCESSING_OBJS) $(PROCESSING_SRCDIR)/%.o: $(PROCESSING_SRCDIR)/%.cpp