forked from creationix/node-sdl
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwscript
More file actions
41 lines (32 loc) · 1.16 KB
/
wscript
File metadata and controls
41 lines (32 loc) · 1.16 KB
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
#!/usr/bin/env python
from os import popen
srcdir = '.'
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')
sdl_config = conf.find_program('sdl-config', var='SDL_CONFIG', mandatory=True)
sdl_libs = popen("%s --libs" % sdl_config).readline().strip()
sdl_cflags = popen("%s --cflags" % sdl_config).readline().strip()
sdl_addpaths = []
sdl_addlibs = []
for item in sdl_libs.split(' '):
# -L items are lib paths, -l are additional libraries
if item.find("-L") == 0:
sdl_addpaths.append(item[2:])
if item.find("-l") == 0:
sdl_addlibs.append(item[2:])
conf.env.append_value("LIBPATH_SDL", sdl_addpaths)
conf.env.append_value("LIB_SDL", sdl_addlibs)
conf.env.append_value("CPPFLAGS_SDL", sdl_cflags.split(' '))
def build(bld):
obj = bld.new_task_gen('cxx', 'shlib', 'node_addon')
obj.target = "node-sdl"
obj.cxxflags = ["-pthread", "-Wall"]
obj.linkflags = ["-lSDL_ttf", "-lSDL_image", "-lSDL_mixer"]
obj.includes = ["/usr/include/SDL"]
obj.source = ["src/sdl.cc", "src/helpers.cc"]
obj.uselib = "SDL"