From 8b4b91f6cc272c001c2a2cd956a28d2b8b619b26 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Mon, 3 Feb 2014 17:31:33 -0800 Subject: [PATCH] first pass at universal libpng for iOS --- README.md | 21 +++++++++++++++++++++ configure | 40 +++++++++++++++++++++++++++++----------- 2 files changed, 50 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index d22b3fe1bbc..2d1680e55d2 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,27 @@ Or generate a dual iOS/OS X-compatible Xcode project for `libllmr` to include as make xcode # then open llmr.xcodeproj +## iOS + +For iOS you'll likely need `armv7` and `armv7s` libs for targeting devices and `i386` libs for the simulator. The best way to handle this is to build for all those architectures and then combine the libs into a single universal lib. We'll do this with the scripts from [mapnik-packaging](https://github.com/mapnik/mapnik-packaging.git) + +From within the `llmr-native` directory: + + git clone --depth=0 https://github.com/mapnik/mapnik-packaging.git + cd mapnik-packaging/osx/ + export CXX11=true + (source iPhoneSimulator.sh; ./scripts/build_png.sh; \ + source MacOSX.sh; ./scripts/build_png.sh; \ + source iPhoneOS.sh; ./scripts/build_png.sh; \ + source iPhoneOSs.sh; ./scripts/build_png.sh; \ + ./scripts/make_universal.sh) + export UNIVERSAL_LIBS=`pwd`/out/build-cpp11-libcpp-universal/ + export PNG_INCLUDES=`pwd`/out/build-cpp11-libcpp-i386/ + cd ../../ + ./configure --png-libpath=${UNIVERSAL_LIBS} --png-includes=${PNG_INCLUDES} + + + ## Ubuntu Ensure you have git and other build essentials: diff --git a/configure b/configure index 7e7df519f22..434a39e80cf 100755 --- a/configure +++ b/configure @@ -34,6 +34,16 @@ parser.add_option("--png", dest="png", help="Path to png (defaults to using pkg-config)") +parser.add_option("--png-includes", + action="store", + dest="png_includes", + help="Path to png includes") + +parser.add_option("--png-libpath", + action="store", + dest="png_libpath", + help="Path to png libs") + (options, args) = parser.parse_args() def pkg_config(pkg): @@ -60,11 +70,11 @@ def configure_glfw3(o): if options.glfw3: libpath = os.path.join(options.glfw3,'lib') if os.path.exists(libpath): - o['variables']['glfw3_libraries'] = '-L'+libpath - o['variables']['glfw3_libraries'] += ' -lglfw3' + o['variables']['glfw3_libraries'] = ['-L'+libpath] + o['variables']['glfw3_libraries'] += ['-lglfw3'] incpath = os.path.join(options.glfw3,'include') if os.path.exists(incpath): - o['variables']['glfw3_cflags'] = '-I'+include + o['variables']['glfw3_cflags'] = ['-I'+incpath] else: ret = pkg_config('glfw3') if not ret: @@ -74,14 +84,22 @@ def configure_glfw3(o): o['variables']['glfw3_cflags'] = ret[1].split() def configure_png(o): - if options.png: - libpath = os.path.join(options.png,'lib') - if os.path.exists(libpath): - o['variables']['png_libraries'] = '-L'+libpath - o['variables']['png_libraries'] += ' -lpng -lz' - incpath = os.path.join(options.png,'include') - if os.path.exists(incpath): - o['variables']['png_cflags'] = '-I'+include + if options.png or options.png_libpath or options.png_includes: + libpath = None + if options.png_libpath: + libpath = options.png_libpath + elif options.png: + libpath = os.path.join(options.png,'lib') + if libpath and os.path.exists(libpath): + o['variables']['png_libraries'] = ['-L'+libpath] + o['variables']['png_libraries'] += ['-lpng','-lz'] + incpath = None + if options.png_includes: + incpath = options.png_includes + elif options.png: + incpath = os.path.join(options.png,'include') + if incpath and os.path.exists(incpath): + o['variables']['png_cflags'] = '-I'+incpath else: ret = pkg_config('libpng') if not ret: