forked from laverdet/node-fibers
-
Notifications
You must be signed in to change notification settings - Fork 2
/
binding.gyp
75 lines (75 loc) · 1.78 KB
/
binding.gyp
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
68
69
70
71
72
73
74
75
{
'target_defaults': {
'default_configuration': 'Release',
'configurations': {
'Release': {
'cflags': [ '-O3' ],
'xcode_settings': {
'GCC_OPTIMIZATION_LEVEL': '3',
'GCC_GENERATE_DEBUGGING_SYMBOLS': 'NO',
},
'msvs_settings': {
'VCCLCompilerTool': {
'Optimization': 3,
'FavorSizeOrSpeed': 1,
},
},
}
},
},
'targets': [
{
'target_name': 'fibers',
'sources': [
'src/fibers.cc',
'src/coroutine.cc',
'src/libcoro/coro.c',
# Rebuild on header changes
'src/coroutine.h',
'src/libcoro/coro.h',
],
'cflags!': ['-ansi'],
'conditions': [
['OS == "win"',
{'defines': ['CORO_FIBER', 'WINDOWS']},
# else
{
'defines': ['USE_CORO', 'CORO_GUARDPAGES=1'],
'ldflags': ['-pthread'],
}
],
['OS == "linux"',
{
'cflags_c': [ '-std=gnu11' ],
'variables': {
'USE_MUSL': '<!(ldd --version 2>&1 | head -n1 | grep "musl" | wc -l)',
},
'conditions': [
['<(USE_MUSL) == 1',
{'defines': ['CORO_ASM', '__MUSL__']},
{'defines': ['CORO_UCONTEXT']}
],
],
},
],
['OS == "solaris" or OS == "sunos" or OS == "freebsd" or OS == "aix"', {'defines': ['CORO_UCONTEXT']}],
['OS == "mac"', {'defines': ['CORO_ASM']}],
['OS == "openbsd"', {'defines': ['CORO_ASM']}],
['target_arch == "arm"',
{
# There's been problems getting real fibers working on arm
'defines': ['CORO_PTHREAD'],
'defines!': ['CORO_UCONTEXT', 'CORO_SJLJ', 'CORO_ASM'],
},
],
['target_arch == "arm64"',
{
# There's been problems getting real fibers working on arm
'defines': ['CORO_UCONTEXT', '_XOPEN_SOURCE'],
'defines!': ['CORO_PTHREAD', 'CORO_SJLJ', 'CORO_ASM'],
},
],
],
},
],
}