urho/MakeiOS

70 строки
4.1 KiB
Plaintext

# armv7s, armv7, arm64, i386, x86_64
ARCH=i386
SDK_VER=12.1
MIN_IOS_VER=8.0
# MIN_IOS_VER must be 8.0 or higher
OUTPUT_DIR=Bin/iOS
URHO_DIR=Urho3D/Urho3D_iOS
URHO_SOURCE_DIR=Urho3D/Source
ifeq ($(ARCH), i386)
TARGET=iPhoneSimulator
else ifeq ($(ARCH), x86_64)
TARGET=iPhoneSimulator
else
TARGET=iPhoneOS
endif
URHO_FLAGS=-I$(URHO_DIR)/include -I$(URHO_DIR)/include/Urho3D/ThirdParty -I$(URHO_DIR)/include/Urho3D/ThirdParty/Bullet -DURHO3D_NEON -DSTBI_NEON -DURHO3D_FILEWATCHER -DURHO3D_PROFILING -DURHO3D_LOGGING -DKNET_UNIX -DURHO3D_OPENGL -DURHO3D_NAVIGATION -DURHO3D_NETWORK -DURHO3D_PHYSICS -DURHO3D_URHO2D -DURHO3D_STATIC_DEFINE -DIOS
URHO_LIBS=-framework AudioToolbox -framework AVFoundation -framework CoreAudio -framework CoreGraphics -framework Foundation -framework OpenGLES -framework QuartzCore -framework UIKit -framework GameController -framework CoreMotion -Wl,-search_paths_first -Wl,-headerpad_max_install_names $(URHO_DIR)/lib/libUrho3D.a -ldl -lpthread
CXXFLAGS=-g -stdlib=libc++ -std=c++0x -Wno-address-of-temporary -Wno-return-type-c-linkage -Wno-c++11-extensions $(URHO_FLAGS)
XCODE_BASE=/Applications/Xcode.app/Contents
TARGET_BASE=$(XCODE_BASE)/Developer/Platforms/$(TARGET).platform
XCODE_FRAMEWORKS=$(TARGET_BASE)/Developer/SDKs/$(TARGET)$(SDK_VER).sdk/System/Library/Frameworks/
XCODE_INCLUDES=$(TARGET_BASE)/Developer/SDKs/$(TARGET)$(SDK_VER).sdk/usr/include
XCODE_SDK=$(XCODE_BASE)/Developer/Platforms/$(TARGET).platform/Developer/SDKs/$(TARGET)$(SDK_VER).sdk
CPP=clang++ -arch $(ARCH) -F$(XCODE_FRAMEWORKS) -I$(XCODE_INCLUDES) -fapplication-extension -mios-simulator-version-min=$(MIN_IOS_VER) -miphoneos-version-min=$(MIN_IOS_VER) -isysroot $(XCODE_SDK) $(CXXFLAGS) -msse3
Urho3D_IOS:
rm -rf $(URHO_DIR) && mkdir -p $(URHO_DIR) && $(URHO_SOURCE_DIR)/./cmake_ios.sh $(URHO_DIR) -DURHO3D_PCH=0 -DIPHONEOS_DEPLOYMENT_TARGET=$(MIN_IOS_VER) -DURHO3D_TOOLS=0 -DURHO3D_LUA=0 -DURHO3D_WEBP=0 -DURHO3D_ANGELSCRIPT=0 -DURHO3D_C++11=1
libUrho3D.a: Urho3D_IOS
ifeq ($(ARCH), i386)
cd $(URHO_DIR) && xcodebuild -arch "i386" IPHONEOS_DEPLOYMENT_TARGET=$(MIN_IOS_VER) ONLY_ACTIVE_ARCH=NO VALID_ARCHS="i386" -target Urho3D -sdk iphonesimulator$(SDK_VER)
else ifeq ($(ARCH), x86_64)
cd $(URHO_DIR) && xcodebuild -arch "x86_64" IPHONEOS_DEPLOYMENT_TARGET=$(MIN_IOS_VER) ONLY_ACTIVE_ARCH=NO VALID_ARCHS="x86_64" -target Urho3D -sdk iphonesimulator$(SDK_VER)
else
cd $(URHO_DIR) && xcodebuild ARCHS=$(ARCH) IPHONEOS_DEPLOYMENT_TARGET=$(MIN_IOS_VER) ONLY_ACTIVE_ARCH=NO -target Urho3D -configuration Release
endif
MakeBinDirectory:
mkdir -p $(OUTPUT_DIR)
libmono-urho.dylib: MakeBinDirectory libUrho3D.a vector.o binding.o glue.o events.o ApplicationProxy.o
mkdir -p $(OUTPUT_DIR) && $(CPP) -dynamiclib -g -o $(OUTPUT_DIR)/libmono-urho_$(ARCH).dylib -g $(URHO_LIBS) $(OUTPUT_DIR)/binding.o $(OUTPUT_DIR)/glue.o $(OUTPUT_DIR)/vector.o $(OUTPUT_DIR)/events.o $(OUTPUT_DIR)/ApplicationProxy.o
fat-libmono-urho.dylib:
make libmono-urho.dylib -f MakeiOS ARCH="i386" && make libmono-urho.dylib -f MakeiOS ARCH="x86_64" && make libmono-urho.dylib -f MakeiOS ARCH="armv7" && make libmono-urho.dylib -f MakeiOS ARCH="arm64" && cd $(OUTPUT_DIR) && lipo -create libmono-urho_i386.dylib libmono-urho_x86_64.dylib libmono-urho_armv7.dylib libmono-urho_arm64.dylib -output libmono-urho.dylib
Urho.framework: fat-libmono-urho.dylib
rm -rf $(OUTPUT_DIR)/Urho.framework && mkdir $(OUTPUT_DIR)/Urho.framework && cp Bindings/iOS/Urho.framework.plist $(OUTPUT_DIR)/Urho.framework/Info.plist && cd $(OUTPUT_DIR) && cp libmono-Urho.dylib Urho.framework/Urho && install_name_tool -id @rpath/Urho.framework/Urho Urho.framework/Urho && zip -r Urho.framework.zip Urho.framework
binding.o:
$(CPP) -c -o $(OUTPUT_DIR)/binding.o Bindings/Portable/Generated/binding.cpp
glue.o:
$(CPP) -c -o $(OUTPUT_DIR)/glue.o Bindings/Native/glue.cpp
vector.o:
$(CPP) -c -o $(OUTPUT_DIR)/vector.o Bindings/Native/vector.cpp
events.o:
$(CPP) -c -o $(OUTPUT_DIR)/events.o Bindings/Portable/Generated/events.cpp
ApplicationProxy.o:
$(CPP) -c -o $(OUTPUT_DIR)/ApplicationProxy.o Bindings/Native/ApplicationProxy.cpp
Urho.iOS.dll:
/Applications/Xamarin\ Studio.app/Contents/MacOS/mdtool -v build "--configuration:Release" -p:Urho.iOS Urho.sln