-
Notifications
You must be signed in to change notification settings - Fork 414
/
libffi.gyp
177 lines (170 loc) · 4.51 KB
/
libffi.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# This file is used with the GYP meta build system.
# http://code.google.com/p/gyp
# To build try this:
# svn co http://gyp.googlecode.com/svn/trunk gyp
# ./gyp/gyp -f make --depth=`pwd` libffi.gyp
# make
# ./out/Debug/test
{
'variables': {
'target_arch%': 'ia32', # built for a 32-bit CPU by default
},
'target_defaults': {
'default_configuration': 'Debug',
'configurations': {
# TODO: hoist these out and put them somewhere common, because
# RuntimeLibrary MUST MATCH across the entire project
'Debug': {
'defines': [ 'DEBUG', '_DEBUG' ],
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 1, # static debug
},
},
},
'Release': {
'defines': [ 'NDEBUG' ],
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 0, # static release
},
},
}
},
'msvs_settings': {
'VCCLCompilerTool': {
},
'VCLibrarianTool': {
},
'VCLinkerTool': {
'GenerateDebugInformation': 'true',
},
},
'conditions': [
['OS == "win"', {
'defines': [
'WIN32'
],
}]
],
},
# Compile .asm files on Windows
'conditions': [
['OS=="win"', {
'target_defaults': {
'conditions': [
['target_arch=="ia32"', {
'variables': { 'ml': ['ml', '/nologo', '/safeseh' ] }
}, {
'variables': { 'ml': ['ml64', '/nologo' ] }
}]
],
'rules': [
{
'rule_name': 'assembler',
'msvs_cygwin_shell': 0,
'extension': 'asm',
'inputs': [
],
'outputs': [
'<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj',
],
'action': [
'<@(ml)', '/c', '/Fo<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj', '<(RULE_INPUT_PATH)'
],
'message': 'Building assembly file <(RULE_INPUT_PATH)',
'process_outputs_as_sources': 1,
},
],
},
}],
],
'targets': [
{
'target_name': 'ffi',
'product_prefix': 'lib',
'type': 'static_library',
# for CentOS 5 support: https://github.com/rbranson/node-ffi/issues/110
'standalone_static_library': 1,
'sources': [
'src/prep_cif.c',
'src/types.c',
'src/raw_api.c',
'src/java_raw_api.c',
'src/closures.c',
],
'defines': [
'PIC',
'FFI_BUILDING',
'HAVE_CONFIG_H'
],
'include_dirs': [
'include',
# platform and arch-specific headers
'config/<(OS)/<(target_arch)'
],
'direct_dependent_settings': {
'include_dirs': [
'include',
# platform and arch-specific headers
'config/<(OS)/<(target_arch)'
],
},
'conditions': [
['target_arch=="arm"', {
'sources': [ 'src/arm/ffi.c' ],
'conditions': [
['OS=="linux"', {
'sources': [ 'src/arm/sysv.S' ]
}]
]
}, { # ia32 or x64
'sources': [
'src/x86/ffi.c',
'src/x86/ffi64.c'
],
'conditions': [
['OS=="mac"', {
'sources': [
'src/x86/darwin.S',
'src/x86/darwin64.S'
]
}],
['OS=="win"', {
# the libffi dlmalloc.c file has a bunch of implicit conversion
# warnings, and the main ffi.c file contains one, so silence them
'msvs_disabled_warnings': [ 4267 ],
# the ffi64.c file is never compiled on Windows
'sources!': [ 'src/x86/ffi64.c' ],
'conditions': [
['target_arch=="ia32"', {
'sources': [ 'src/x86/win32.asm' ]
}, { # target_arch=="x64"
'sources': [ 'src/x86/win64.asm' ]
}]
]
}],
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
'sources': [
'src/x86/unix64.S',
'src/x86/sysv.S'
]
}]
]
}],
]
},
{
'target_name': 'test',
'type': 'executable',
'dependencies': [ 'ffi' ],
'sources': [ 'test.c' ]
},
{
'target_name': 'closure-test',
'type': 'executable',
'dependencies': [ 'ffi' ],
'sources': [ 'closure.c' ]
}
]
}