forked from Automattic/node-canvas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wscript
41 lines (32 loc) · 1.54 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
import glob
import Options
srcdir = '.'
blddir = 'build'
VERSION = '0.0.1'
def set_options(opt):
opt.tool_options('compiler_cxx')
opt.add_option('--profile', action='store_true', help='Enable profiling', dest='profile', default=False)
def configure(conf):
o = Options.options
conf.env['USE_PROFILING'] = o.profile
conf.check_tool('compiler_cxx')
conf.check_tool('node_addon')
conf.env.append_value('CPPFLAGS', '-DNDEBUG')
if conf.check(lib='gif', libpath=['/lib', '/usr/lib', '/usr/local/lib', '/opt/local/lib'], uselib_store='GIF', mandatory=False):
conf.env.append_value('CPPFLAGS', '-DHAVE_GIF=1')
if conf.check(lib='jpeg', libpath=['/lib', '/usr/lib', '/usr/local/lib', '/opt/local/lib'], uselib_store='JPEG', mandatory=False):
conf.env.append_value('CPPFLAGS', '-DHAVE_JPEG=1')
if conf.env['USE_PROFILING'] == True:
conf.env.append_value('CXXFLAGS', ['-pg'])
conf.env.append_value('LINKFLAGS', ['-pg'])
conf.check_cfg(package='cairo', args='--cflags --libs', mandatory=True)
conf.check_cfg(package='pango',arg='--cflags --libs', mandatory=True, uselib_store='PANGO')
conf.check_cfg(package='pangocairo', args='--cflags --libs', mandatory=True, uselib_store='PANGOCAIRO')
flags = ['-O3', '-Wall', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE_SOURCE']
conf.env.append_value('CCFLAGS', flags)
conf.env.append_value('CXXFLAGS', flags)
def build(bld):
obj = bld.new_task_gen('cxx', 'shlib', 'node_addon')
obj.target = 'canvas'
obj.source = bld.glob('src/*.cc')
obj.uselib = ['CAIRO', 'GIF', 'JPEG', 'PANGO', 'PANGOCAIRO']