From b895711b01f60437727b94eb75383304e9c09347 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Mon, 3 Feb 2014 15:40:56 -0800 Subject: [PATCH] png is a new dependency in sprite.cpp - add it to build system --- configure | 21 ++++++++++++++++++++- llmr.gyp | 37 ++++++++++++++++++++++--------------- 2 files changed, 42 insertions(+), 16 deletions(-) diff --git a/configure b/configure index 0c6ddf70c..bd64442e7 100755 --- a/configure +++ b/configure @@ -29,10 +29,15 @@ parser.add_option("--glfw3", dest="glfw3", help="Path to gflw3 (defaults to using pkg-config)") +parser.add_option("--png", + action="store", + dest="png", + help="Path to png (defaults to using pkg-config)") + (options, args) = parser.parse_args() def pkg_config(pkg): - cmd = os.popen('pkg-config --libs %s' % pkg, 'r') + cmd = os.popen('pkg-config --static --libs %s' % pkg, 'r') libs = cmd.readline().strip() ret = cmd.close() if (ret): return None @@ -64,6 +69,19 @@ def configure_glfw3(o): o['variables']['glfw3_libraries'] = ret[0].split() o['variables']['glfw3_cflags'] = ret[1].split() +def configure_png(o): + if options.glfw3: + o['variables']['png_libraries'] = '-L'+os.path.join(options.png,'lib') + o['variables']['png_libraries'] += '-lpng' + o['variables']['png_cflags'] += '-I'+os.path.join(options.png,'lib') + else: + ret = pkg_config('libpng') + if not ret: + sys.stderr.write('could not find libpng with pkg-config') + sys.exit(-1) + o['variables']['png_libraries'] = ret[0].split() + o['variables']['png_cflags'] = ret[1].split() + def write(filename, data): filename = os.path.join(root_dir, filename) print "creating ", filename @@ -89,6 +107,7 @@ def run_gyp(args): if __name__ == '__main__': configure_llmr(output) configure_glfw3(output) + configure_png(output) pprint.pprint(output, indent=2) write('config.gypi', "# Do not edit. Generated by the configure script.\n" + diff --git a/llmr.gyp b/llmr.gyp index d68c92703..3961dccc5 100644 --- a/llmr.gyp +++ b/llmr.gyp @@ -6,44 +6,46 @@ 'targets': [ { 'target_name': 'llmr-osx', - 'product_name': 'libllmr-osx', + 'product_name': 'llmr-osx', 'type': 'static_library', 'sources': [ '