png is a new dependency in sprite.cpp - add it to build system

This commit is contained in:
Dane Springmeyer
2014-02-03 15:40:56 -08:00
parent 0052211278
commit b895711b01
2 changed files with 42 additions and 16 deletions

21
configure vendored
View File

@@ -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" +

View File

@@ -6,44 +6,46 @@
'targets': [
{
'target_name': 'llmr-osx',
'product_name': 'libllmr-osx',
'product_name': 'llmr-osx',
'type': 'static_library',
'sources': [
'<!@(find src -name "*.cpp")',
'<!@(find include -name "*.hpp")'
],
'libraries': [
'<@(png_libraries)',
],
'xcode_settings': {
'SDKROOT': 'macosx',
'SUPPORTED_PLATFORMS':'macosx',
'MACOSX_DEPLOYMENT_TARGET':'10.8',
'PUBLIC_HEADERS_FOLDER_PATH': 'include'
},
'conditions': [
['OS == "mac"', {
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/OpenGL.framework',
],
},
}],
],
'include_dirs':[
'./include'
'./include',
'<@(png_cflags)'
],
'direct_dependent_settings': {
'include_dirs':[
'./include'
'./include',
'<@(png_cflags)'
],
'libraries': [
'<@(png_libraries)',
]
}
},
{
'target_name': 'llmr-ios',
'product_name': 'libllmr-ios',
'product_name': 'llmr-ios',
'type': 'static_library',
'sources': [
'<!@(find src -name "*.cpp")',
'<!@(find include -name "*.hpp")'
],
'libraries': [
'<@(png_libraries)',
],
'xcode_settings': {
'SDKROOT': 'iphoneos',
'SUPPORTED_PLATFORMS':'iphonesimulator iphoneos',
@@ -53,12 +55,17 @@
'PUBLIC_HEADERS_FOLDER_PATH': 'include'
},
'include_dirs':[
'./include'
'./include',
'<@(png_cflags)'
],
'direct_dependent_settings': {
'include_dirs':[
'./include'
'./include',
'<@(png_cflags)'
],
'libraries': [
'<@(png_libraries)',
]
}
}
]