forked from mariano/node-db-drizzle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wscript
67 lines (54 loc) · 2.3 KB
/
wscript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
####
# Copyright by Mariano Iglesias
# See contributors list in README.md
#
# See license text in LICENSE file
####
import Options, Utils
from os import unlink, symlink, chdir, environ
from os.path import exists
srcdir = "."
blddir = "build"
VERSION = "0.6.6"
def set_options(opt):
opt.tool_options("compiler_cxx")
opt.add_option('--debug', action='store_true', help='Run tests with nodeunit_g')
opt.add_option('--warn', action='store_true', help='Enable extra -W* compiler flags')
def configure(conf):
conf.check_tool("compiler_cxx")
conf.check_tool("node_addon")
# Enables all the warnings that are easy to avoid
conf.env.append_unique('CXXFLAGS', ["-Wall"])
if Options.options.warn:
# Extra warnings
conf.env.append_unique('CXXFLAGS', ["-Wextra"])
# Extra warnings, gcc 4.4
conf.env.append_unique('CXXFLAGS', ["-Wconversion", "-Wshadow", "-Wsign-conversion", "-Wunreachable-code", "-Wredundant-decls", "-Wcast-qual"])
drizzle_include = environ.get("DRIZZLE_INCLUDE_DIR", "/usr/include/libdrizzle")
if drizzle_include:
conf.env.append_unique('CXXFLAGS', [ '-I' + drizzle_include ])
drizzle_lib = environ.get("DRIZZLE_LIB_DIR", "/usr/lib")
if drizzle_lib:
conf.env.append_unique('LINKFLAGS', [ '-L' + drizzle_lib ])
if not conf.check_cxx(lib='drizzle'):
conf.fatal("Missing libdrizzle from drizzle package")
if not conf.check_cxx(header_name='drizzle.h'):
conf.fatal("Missing drizzle.h header from drizzle package")
def build(bld):
obj = bld.new_task_gen("cxx", "shlib", "node_addon")
obj.target = "drizzle_bindings"
obj.source = "lib/node-db/binding.cc lib/node-db/connection.cc lib/node-db/exception.cc lib/node-db/query.cc lib/node-db/result.cc src/connection.cc src/drizzle.cc src/query.cc src/result.cc src/drizzle_bindings.cc"
obj.includes = "lib/"
obj.uselib = "DRIZZLE"
def test(tst):
test_binary = 'nodeunit'
if Options.options.debug:
test_binary = 'nodeunit_g'
Utils.exec_command(test_binary + ' tests.js')
def lint(lnt):
# Bindings C++ source code
print("Run CPPLint:")
Utils.exec_command('cpplint --filter=-whitespace/line_length ./lib/node-db/*.h ./lib/node-db/*.cc ./src/*.h ./src/*.cc')
# Bindings javascript code, and tools
print("Run Nodelint for sources:")
Utils.exec_command('nodelint ./package.json ./db-drizzle.js')