Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
first pass at universal libpng for iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Dane Springmeyer committed Feb 4, 2014
1 parent 23b3e99 commit 8b4b91f
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 11 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
40 changes: 29 additions & 11 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit 8b4b91f

Please sign in to comment.