jones-ndb
Version:
Native NDB (MySQL Cluster) Service Provider for Database Jones
64 lines (50 loc) • 2.1 kB
JavaScript
/*
Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights
reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA
*/
;
var path = require("path");
var fs = require("fs");
var ndb_dir = __dirname; /* /impl/ndb */
var impl_dir = path.dirname(ndb_dir); /* /impl */
var root_dir = path.dirname(impl_dir); /* / */
var converters_dir = path.join(root_dir, "Converters");
var suites_dir = path.join(root_dir, "test");
/* Find the build directory */
var existsSync = fs.existsSync || path.existsSync;
var binary_dir;
var build1 = path.join(root_dir, "build"); // gyp builds under root dir
var build2 = path.join(impl_dir, "build"); // waf builds under impl dir
var build = existsSync(build1) ? build1 : build2;
binary_dir = path.join(build, "Release");
// The Static build is linked with ndbclient_static and created by CMake
if(existsSync(path.join(build, "Static", "ndb_adapter.node"))) {
binary_dir = path.join(build, "Static");
}
// Prefer the Debug build if one exists
if(existsSync(path.join(build, "Debug", "ndb_adapter.node"))) {
binary_dir = path.join(build, "Debug");
}
/* binary_dir may not exist, but that is an error that we leave for
for loadRequiredModules() to catch.
*/
module.exports = {
"binary" : path.join(binary_dir, "ndb_adapter.node"),
"root_dir" : root_dir,
"impl_dir" : impl_dir,
"impl_js_dir" : ndb_dir,
"converters_dir" : converters_dir,
"suites_dir" : suites_dir
};