From 90c602d3c787090faf1353019c48d0e6842f561d Mon Sep 17 00:00:00 2001 From: Fons Rademakers <Fons.Rademakers@cern.ch> Date: Mon, 25 Nov 2013 17:03:29 +0100 Subject: [PATCH] fix build for ios and iossim. Still not completelt working due to LLVM including files not supported on iOS. --- config/Makefile.ios | 11 +++++++++-- config/Makefile.iossim | 11 +++++++++-- configure | 20 +++++++++++++++++--- core/lzma/Module.mk | 2 -- graf2d/freetype/Module.mk | 2 -- sql/sqlite/Module.mk | 2 +- 6 files changed, 36 insertions(+), 12 deletions(-) diff --git a/config/Makefile.ios b/config/Makefile.ios index 6ef89241889..9acf88fb340 100644 --- a/config/Makefile.ios +++ b/config/Makefile.ios @@ -21,13 +21,20 @@ IOS_MAJOR := $(shell echo $(IOSVERS) | cut -d . -f 1) ifeq ($(subst $(IOS_MAJOR),,1234),1234) CXX := $(shell xcrun -find clang++) CC := $(shell xcrun -find clang) +ifeq ($(CXX11),yes) +CXX11FLAGS = -std=c++11 +endif +ifeq ($(LIBCXX),yes) +CXX11FLAGS += -stdlib=libc++ +CXX11LDFLAGS = -stdlib=libc++ +endif else CXX := $(shell xcrun -find g++) CC := $(shell xcrun -find gcc) endif CXXFLAGS = -arch armv7 -pipe -Wshadow -W -Wall -Woverloaded-virtual \ -fsigned-char -fno-common -fvisibility-inlines-hidden \ - $(EXTRA_CXXFLAGS) -isysroot $(IOSSDK) + $(EXTRA_CXXFLAGS) -isysroot $(IOSSDK) $(CXX11FLAGS) CFLAGS = -arch armv7 -pipe -Wshadow -W -Wall -fsigned-char -fno-common \ $(EXTRA_CFLAGS) -isysroot $(IOSSDK) COMPILER = gnu @@ -39,7 +46,7 @@ else LD := $(shell xcrun -find g++) endif LDFLAGS = $(OPT) -arch armv7 -isysroot $(IOSSDK) \ - -miphoneos-version-min=$(IOSVERS) + -miphoneos-version-min=$(IOSVERS) $(CXX11LDFLAGS) # this is set for 64 but not for 32 bit (for iOS too???) CXXFLAGS += -D__DARWIN_UNIX03=1 diff --git a/config/Makefile.iossim b/config/Makefile.iossim index 4f3f2099cdb..25d712d869b 100644 --- a/config/Makefile.iossim +++ b/config/Makefile.iossim @@ -21,13 +21,20 @@ IOS_MAJOR := $(shell echo $(IOSVERS) | cut -d . -f 1) ifeq ($(subst $(IOS_MAJOR),,1234),1234) CXX := $(shell xcrun -find clang++) CC := $(shell xcrun -find clang) +ifeq ($(CXX11),yes) +CXX11FLAGS = -std=c++11 +endif +ifeq ($(LIBCXX),yes) +CXX11FLAGS += -stdlib=libc++ +CXX11LDFLAGS = -stdlib=libc++ +endif else CXX := $(shell xcrun -find g++) CC := $(shell xcrun -find gcc) endif CXXFLAGS = -arch i386 -pipe -Wshadow -W -Wall -Woverloaded-virtual \ -fsigned-char -fno-common -fvisibility-inlines-hidden \ - $(EXTRA_CXXFLAGS) -isysroot $(IOSSDK) + $(EXTRA_CXXFLAGS) -isysroot $(IOSSDK) $(CXX11FLAGS) CFLAGS = -arch i386 -pipe -Wshadow -W -Wall -fsigned-char -fno-common \ $(EXTRA_CFLAGS) -isysroot $(IOSSDK) COMPILER = gnu @@ -39,7 +46,7 @@ else LD := $(shell xcrun -find g++) endif LDFLAGS = $(OPT) -arch i386 -isysroot $(IOSSDK) \ - -miphoneos-version-min=$(IOSVERS) + -miphoneos-version-min=$(IOSVERS) $(CXX11LDFLAGS) # this is set for 64 but not for 32 bit (for iOS too???) CXXFLAGS += -D__DARWIN_UNIX03=1 diff --git a/configure b/configure index 1831348a011..e271c423009 100755 --- a/configure +++ b/configure @@ -1904,9 +1904,9 @@ macosx*) # get most recent SDK version macosxminor=`sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2` macosxvers=10.$macosxminor - # make available to conftest.mk scripts - export MACOSXVERS=$macosxvers fi + # make available to conftest.mk scripts + export MACOSXVERS=$macosxvers ;; ios*) logmsg "Will check iOS SDK libraries" @@ -1915,8 +1915,15 @@ ios*) # get most recent SDK version iosvers=`xcodebuild -showsdks | sed -n '/iphoneos/s/.*iOS //p' | sed 's/ .*//'|awk 'END{print}'` fi + if [ `echo $iosvers | cut -d . -f 1` -ge 7 ]; then + ios7=yes + fi xcodepath=`/usr/bin/xcode-select -print-path` - iossdk=$xcodepath/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS$iosvers.sdk + if test "x$arch" = "xios"; then + iossdk=$xcodepath/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS$iosvers.sdk + else + iossdk=$xcodepath/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator$iosvers.sdk + fi result "$iossdk" if [ ! -d $iossdk ]; then result "`basename $0`: no iOS SDK found at $iossdk" @@ -1924,6 +1931,9 @@ ios*) result "or make sure the desired SDK version is installed" exit 1 fi + # make available to conftest.mk scripts + export IOSSDK=$iossdk + export IOSVERS=$iosvers enable_genvector="no" enable_tmva="no" ;; @@ -2514,6 +2524,10 @@ fi if test "x$macosx109" = "xyes" && echo $altcxx | grep 'clang++' > /dev/null 2>&1; then enable_libcxx="yes" fi +# iOS 7.0 only has libc++ with clang so make sure this option is turned on +if test "x$ios7" = "xyes" && echo $altcxx | grep 'clang++' > /dev/null 2>&1; then + enable_libcxx="yes" +fi uselibcxx="undef" if test "x$enable_libcxx" = "xyes" ; then diff --git a/core/lzma/Module.mk b/core/lzma/Module.mk index 783aa7c64bb..c9fb2956e0a 100644 --- a/core/lzma/Module.mk +++ b/core/lzma/Module.mk @@ -143,12 +143,10 @@ else LZMA_CFLAGS="-m64"; \ fi; \ if [ $(ARCH) = "iossim" ]; then \ - LZMACC="$$LZMACC -arch i386"; \ LZMA_CFLAGS="-arch i386 -isysroot $(IOSSDK) -miphoneos-version-min=$(IOSVERS)"; \ LZMA_HOST="--host=i686-apple-darwin10"; \ fi; \ if [ $(ARCH) = "ios" ]; then \ - LZMACC="$$LZMACC -arch armv7"; \ LZMA_CFLAGS="-arch armv7 -isysroot $(IOSSDK) -miphoneos-version-min=$(IOSVERS)"; \ LZMA_HOST="--host=arm-apple-darwin10"; \ fi; \ diff --git a/graf2d/freetype/Module.mk b/graf2d/freetype/Module.mk index 1f3c0f5dab9..54554a43c3a 100644 --- a/graf2d/freetype/Module.mk +++ b/graf2d/freetype/Module.mk @@ -135,12 +135,10 @@ else FREE_CFLAGS="-m64"; \ fi; \ if [ $(ARCH) = "iossim" ]; then \ - FREECC="$$FREECC -arch i386"; \ FREE_CFLAGS="-arch i386 -isysroot $(IOSSDK) -miphoneos-version-min=$(IOSVERS)"; \ FREE_HOST="--host=i686-apple-darwin10"; \ fi; \ if [ $(ARCH) = "ios" ]; then \ - FREECC="$$FREECC -arch armv7"; \ FREE_CFLAGS="-arch armv7 -isysroot $(IOSSDK) -miphoneos-version-min=$(IOSVERS)"; \ FREE_HOST="--host=arm-apple-darwin10"; \ fi; \ diff --git a/sql/sqlite/Module.mk b/sql/sqlite/Module.mk index caad67d80ab..20390c9edc9 100644 --- a/sql/sqlite/Module.mk +++ b/sql/sqlite/Module.mk @@ -54,7 +54,7 @@ $(SQLITEDS): $(SQLITEH) $(SQLITEL) $(ROOTCINTTMPDEP) $(call pcmdep,SQLITE) $(MAKEDIR) @echo "Generating dictionary $@..." $(ROOTCINTTMP) -f $@ $(call dictModule,SQLITE) \ - -c $(SQLITEINCDIR:%=-I%) $(SQLITEH) $(SQLITEL) + -c $(SQLITEH) $(SQLITEL) $(SQLITEMAP): $(RLIBMAP) $(MAKEFILEDEP) $(SQLITEL) $(RLIBMAP) -o $@ -l $(SQLITELIB) \ -- GitLab