-
Notifications
You must be signed in to change notification settings - Fork 3
/
wscript
60 lines (47 loc) · 1.81 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
import Options, glob
from os.path import join, dirname, abspath, exists
from shutil import copy, rmtree
from os import unlink
import sys, os
srcdir = "."
blddir = "build"
VERSION = "0.0.1"
def set_options(opt):
opt.tool_options("compiler_cxx")
opt.tool_options("compiler_cc")
def configure(conf):
conf.check_tool("compiler_cxx")
conf.check_tool("compiler_cc")
conf.check_tool("node_addon")
conf.check_cfg(package='gl', mandatory=1, args='--cflags --libs')
conf.check_cfg(package='glu', mandatory=1, args='--cflags --libs')
conf.check_cfg(package='xrandr', mandatory=1, args='--cflags --libs')
conf.env.append_value("LIBPATH_GLFW", abspath("./build/default/lib/"))
conf.env.append_value("STATICLIB_GLFW",["glfw"])
conf.env.append_value("CPPPATH_GLFW", abspath("./build/default/include/"))
# TODO: add support for more platforms..
buildpath = abspath("build/default")
cmd = "cd \"deps/glfw\" && CFLAGS=-fPIC PREFIX=%s make x11-dist-install"
if os.system(cmd % (buildpath)) != 0:
conf.fatal("Building glfw failed.")
def clean(ctx):
if exists("lib/node-ogl.node"): unlink("lib/node-ogl.node")
if exists("build"): rmtree("build")
# TODO: add support for more platforms..
buildpath = abspath("build/default")
cmd = "cd \"deps/glfw\" && PREFIX=%s make x11-dist-clean"
if os.system(cmd % (buildpath)) != 0:
conf.fatal("Building glfw failed.")
def build(bld):
# build node-avro
node_ogl = bld.new_task_gen("cxx", "shlib", "node_addon")
node_ogl.source = bld.glob("src/*.cc")
node_ogl.name = "node-ogl"
node_ogl.target = "node-ogl"
node_ogl.uselib = ["GL", "GLU", "GLFW", "XRANDR"]
bld.add_post_fun(copynode)
def copynode(ctx):
if exists('build/default/node-ogl.node'):
copy('build/default/node-ogl.node','lib/node-ogl.node')
def test(tst):
os.system("node test/sanity.js")