Browse Source

Merge pull request #185 from LearnBoost/gyp

Better node-gyp support
v1.x
TJ Holowaychuk 13 years ago
parent
commit
5249f3ef85
  1. 8
      Makefile
  2. 84
      binding.gyp
  3. 4
      package.json
  4. 2
      src/Canvas.cc
  5. 2
      src/Canvas.h
  6. 2
      src/init.cc

8
Makefile

@ -1,9 +1,9 @@
ADDON = build/default/canvas.node
ADDON = build/Release/canvas.node
REPORTER = dot
$(ADDON): src/*.cc
node-waf configure build
node-gyp rebuild
test: $(ADDON)
@./node_modules/.bin/mocha \
@ -19,6 +19,6 @@ benchmark:
@node benchmarks/run.js
clean:
node-waf distclean
node-gyp clean
.PHONY: test test-server benchmark clean
.PHONY: test test-server benchmark clean

84
binding.gyp

@ -1,30 +1,74 @@
{
'variables': {
# Set the location of GTK all-in-one bundle
'GTK_Root': 'C:/GTK',
'GTK_Root%': 'C:/GTK', # Set the location of GTK all-in-one bundle
'with_jpeg%': 'false',
'with_gif%': 'false'
},
'targets': [
{
'target_name': 'canvas',
'sources': [
'src/Canvas.cc',
'src/CanvasGradient.cc',
'src/CanvasPattern.cc',
'src/CanvasRenderingContext2d.cc',
'src/color.cc',
'src/Image.cc',
'src/ImageData.cc',
'src/init.cc',
'src/PixelArray.cc',
],
'libraries': ['-l<(GTK_Root)/lib/cairo.lib' ],
'include_dirs': [
'<(GTK_Root)/include/cairo',
],
'defines': [
'snprintf=_snprintf',
'_USE_MATH_DEFINES' # for M_PI
],
'src/Canvas.cc',
'src/CanvasGradient.cc',
'src/CanvasPattern.cc',
'src/CanvasRenderingContext2d.cc',
'src/color.cc',
'src/Image.cc',
'src/ImageData.cc',
'src/init.cc',
'src/PixelArray.cc',
],
'conditions': [
['OS=="win"', {
'libraries': [
'-l<(GTK_Root)/lib/cairo.lib'
],
'include_dirs': [
'<(GTK_Root)/include',
],
'defines': [
'snprintf=_snprintf',
'_USE_MATH_DEFINES' # for M_PI
]
}, { # 'OS!="win"'
'libraries': [
'-lpixman-1',
'-lcairo'
],
}],
['with_jpeg=="true"', {
'defines': [
'HAVE_JPEG'
],
'conditions': [
['OS=="win"', {
'libraries': [
'-l<(GTK_Root)/lib/jpeg.lib'
]
}, {
'libraries': [
'-ljpeg'
]
}]
]
}],
['with_gif=="true"', {
'defines': [
'HAVE_GIF'
],
'conditions': [
['OS=="win"', {
'libraries': [
'-l<(GTK_Root)/lib/gif.lib'
]
}, {
'libraries': [
'-lgif'
]
}]
]
}]
]
}
]
}

4
package.json

@ -6,7 +6,7 @@
, "homepage": "https://github.com/learnboost/node-canvas"
, "repository": "git://github.com/learnboost/node-canvas"
, "scripts": {
"preinstall": "node-waf configure build"
"test": "make test"
}
, "devDependencies": {
"express": ">= 2.3.7 && < 3.0.0"
@ -16,4 +16,4 @@
}
, "engines": { "node": ">= 0.4.0" }
, "main": "./lib/canvas.js"
}
}

2
src/Canvas.cc

@ -12,7 +12,7 @@
#include <string.h>
#include <node_buffer.h>
#include <node_version.h>
#include <cairo-pdf.h>
#include <cairo/cairo-pdf.h>
#include "closure.h"
#ifdef HAVE_JPEG

2
src/Canvas.h

@ -12,7 +12,7 @@
#include <node.h>
#include <node_object_wrap.h>
#include <node_version.h>
#include <cairo.h>
#include <cairo/cairo.h>
using namespace v8;
using namespace node;

2
src/init.cc

@ -26,4 +26,4 @@ init (Handle<Object> target) {
target->Set(String::New("cairoVersion"), String::New(cairo_version_string()));
}
NODE_MODULE(canvas,init);
NODE_MODULE(canvas,init);

Loading…
Cancel
Save