Merge pull request #364 from mstorsjo/build-ios-make

Decouple architecture (x86) from platforms in the make build system
This commit is contained in:
Licai Guo 2014-02-28 16:44:37 +08:00
commit 07bc7e0766
14 changed files with 41 additions and 16 deletions

View File

@ -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)

View File

@ -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

3
build/platform-arch.mk Normal file
View File

@ -0,0 +1,3 @@
ifneq ($(filter %86 x86_64, $(ARCH)),)
include build/platform-x86-common.mk
endif

View File

@ -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

View File

@ -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

15
build/platform-ios.mk Normal file
View File

@ -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)

View File

@ -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

View File

@ -1,5 +1,4 @@
include build/platform-x86-common.mk
ASM = nasm
SHAREDLIBSUFFIX = dll
CFLAGS += -DMT_ENABLED -MMD -MP
LDFLAGS +=

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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