From a03d9d38029562565c6e9f1400d2705f9ac1a4c4 Mon Sep 17 00:00:00 2001 From: Johny Jose Date: Fri, 15 Mar 2013 07:36:43 +0530 Subject: [PATCH] now builds with node-gyp --- binding.gyp | 23 +++++++++++++++++++++++ swipl.js | 6 +++--- wscript | 33 --------------------------------- 3 files changed, 26 insertions(+), 36 deletions(-) create mode 100644 binding.gyp delete mode 100644 wscript diff --git a/binding.gyp b/binding.gyp new file mode 100644 index 0000000..e69043d --- /dev/null +++ b/binding.gyp @@ -0,0 +1,23 @@ +{ + "targets": [ + { + "target_name": "libswipl", + "sources": [ + "./src/libswipl.cc" + ], + "include_dirs": [ + "./src", + "$(SWI_PROLOG_HOME)" + ], + "direct_dependent_settings": { + "linkflags": [ + "-D_FILE_OFFSET_BITS=64", + "-D_LARGEFILE_SOURCE" + ] + }, + "libraries": [ + "-lswipl" + ] + } + ] +} diff --git a/swipl.js b/swipl.js index bff41e7..9f95050 100644 --- a/swipl.js +++ b/swipl.js @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -var swipl = require("./libswipl"); +var swipl = require("./build/Release/swipl"); function Module(mod) { this.module_name = mod; @@ -31,7 +31,7 @@ Module.prototype = { module : function(mod) { return new Module(mod); }, - + term_type : function(term) { var r = swipl.term_type(term); if(this.DEBUG) console.log("[libswipl] term_type: " + r + " " + term); @@ -48,7 +48,7 @@ Module.prototype = { var r = query.next_solution(); if (r) { result = r; - if(this.DEBUG) console.log("[libswipl] call_predicate: " + if(this.DEBUG) console.log("[libswipl] call_predicate: " + JSON.stringify(r)); } else { var ex = query.exception(); diff --git a/wscript b/wscript deleted file mode 100644 index cdf953c..0000000 --- a/wscript +++ /dev/null @@ -1,33 +0,0 @@ -import Options -from os import unlink, symlink, popen -from os.path import exists - -srcdir = "src" -blddir = "build" -VERSION = "0.0.1" - -def set_options(opt): - opt.tool_options("compiler_cxx") - -def configure(conf): - conf.check_tool("compiler_cxx") - conf.check_tool("node_addon") - -def build(bld): - obj = bld.new_task_gen("cxx", "shlib", "node_addon") - obj.target = "libswipl" - obj.find_sources_in_dirs("src") - obj.lib = [ "swipl" ] - obj.includes = ["./src"] - obj.cxxflags = ["-D_FILE_OFFSET_BITS=64", "-D_LARGEFILE_SOURCE"] - -def shutdown(): - if Options.commands['clean']: - if exists('libswipl.node'): unlink('libswipl.node') - else: - if exists('build/default/libswipl.node') and not exists('libswipl.node'): - symlink('build/default/libswipl.node', 'libswipl.node') - else: - if exists('build/Release/libswipl.node') and not exists('libswipl.node'): - symlink('build/Release/libswipl.node', 'libswipl.node') -