cross compile ZThread for ios && android

success for android ,here is the Android.mk

LOCAL_PATH := $(realpath $(call my-dir)/../.. )

include $(CLEAR_VARS)

LOCAL_MODULE    := zthreads

LOCAL_CPP_EXTENSION := .cxx

### Add all source file names to be included in lib separated by a whitespace
LOCAL_SRC_FILES := \
ZThread/src/AtomicCount.cxx \
ZThread/src/Condition.cxx \
ZThread/src/ConcurrentExecutor.cxx \
ZThread/src/CountingSemaphore.cxx \
ZThread/src/FastMutex.cxx \
ZThread/src/FastRecursiveMutex.cxx \
ZThread/src/Mutex.cxx \
ZThread/src/RecursiveMutexImpl.cxx \
ZThread/src/RecursiveMutex.cxx \
ZThread/src/Monitor.cxx \
ZThread/src/PoolExecutor.cxx \
ZThread/src/PriorityCondition.cxx \
ZThread/src/PriorityInheritanceMutex.cxx \
ZThread/src/PriorityMutex.cxx \
ZThread/src/PrioritySemaphore.cxx \
ZThread/src/Semaphore.cxx \
ZThread/src/SynchronousExecutor.cxx \
ZThread/src/Thread.cxx \
ZThread/src/ThreadedExecutor.cxx \
ZThread/src/ThreadImpl.cxx \
ZThread/src/ThreadLocalImpl.cxx \
ZThread/src/ThreadQueue.cxx \
ZThread/src/Time.cxx \
ZThread/src/ThreadOps.cxx

LOCAL_C_INCLUDES := $(LOCAL_PATH)/ZThread/include $(LOCAL_PATH)/ZThread/src

LOCAL_CPPFLAGS := -DANDROID -fexceptions -fpermissive

ifeq ($(TARGET_ARCH_ABI),x86)
LOCAL_CPPFLAGS += -fno-stack-protector 
endif

#include $(BUILD_SHARED_LIBRARY)
include $(BUILD_STATIC_LIBRARY)

 

 

 

更新 config.guess 和config.sub

http://opensource.apple.com/source/llvmgcc42/llvmgcc42-2118/config.guess?txt

http://opensource.apple.com/source/llvmgcc42/llvmgcc42-2336.9/config.sub

 

 

./configure --host="arm-apple-darwin10-llvm" --enable-static --disable-shared

  

./configure --prefix=/usr/local/iphone --host=arm-apple-darwin --enable-static=yes --enable-shared=no CC=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc  CFLAGS="-arch armv7 -pipe -mdynamic-no-pic -std=c99 -Wno-trigraphs -fpascal-strings -O2 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden -miphoneos-version-min=5.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk" CPP=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-g++ AR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar LDFLAGS="-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk -miphoneos-version-min=5.1"

 

 

关键是苹果没有像谷歌一样提供arm架构的一些库呀

posted @ 2012-04-06 14:07  maadiah  阅读(850)  评论(0编辑  收藏  举报