forked from pact-foundation/pact-js-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
binding.gyp
159 lines (159 loc) · 4.44 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
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
{
"targets": [
{
"target_name": "pact",
"sources": [
"native/addon.cc",
"native/ffi.cc",
"native/consumer.cc",
"native/provider.cc",
"native/plugin.cc"
],
"include_dirs": [
"<!(node -p \"require('node-addon-api').include_dir\")",
"<(module_root_dir)/native",
"<(module_root_dir)/ffi",
],
"conditions": [
[
"OS=='win'",
{
"libraries": [
"<(module_root_dir)/ffi/pact_ffi.dll.lib"
],
"defines": [
"_HAS_EXCEPTIONS=1"
],
"msvs_settings": {
"VCCLCompilerTool": {
"ExceptionHandling": 1
}
}
}
],
[
"OS==\"mac\" and target_arch ==\"x64\"",
{
"xcode_settings": {
"GCC_SYMBOLS_PRIVATE_EXTERN": "YES",
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
"GCC_TREAT_WARNINGS_AS_ERRORS": "YES",
"CLANG_CXX_LIBRARY": "libc++",
"MACOSX_DEPLOYMENT_TARGET": "10.7"
},
"link_settings": {
"libraries": [
"-lpact_ffi",
"-L<(module_root_dir)/ffi",
"-Wl,-rpath,@loader_path"
]
}
}
],
[
"OS==\"mac\" and target_arch ==\"arm64\"",
{
"xcode_settings": {
"GCC_SYMBOLS_PRIVATE_EXTERN": "YES",
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
"GCC_TREAT_WARNINGS_AS_ERRORS": "YES",
"CLANG_CXX_LIBRARY": "libc++",
"MACOSX_DEPLOYMENT_TARGET": "10.7"
},
"link_settings": {
"libraries": [
"-lpact_ffi",
"-L<(module_root_dir)/ffi/osxaarch64",
"-Wl,-rpath,@loader_path/osxaarch64"
]
}
}
],
[
"OS==\"linux\" and target_arch ==\"x64\"",
{
"link_settings": {
"libraries": [
"-lpact_ffi",
"-L<(module_root_dir)/ffi",
"-Wl,-rpath,'$$ORIGIN'"
]
}
}
],
[
"OS==\"linux\" and target_arch ==\"arm64\"",
{
"link_settings": {
"libraries": [
"-lpact_ffi",
"-L<(module_root_dir)/ffi/linuxaarch64",
"-Wl,-rpath,'$$ORIGIN'/linuxaarch64"
]
}
}
]
],
"library_dirs": [
"<(module_root_dir)/native"
],
"cflags_cc!": [
"-fno-exceptions",
],
"cflags_cc": [ "-Werror" ],
"defines": [
"NAPI_CPP_EXCEPTIONS"
]
},
# Copy the shared libraries into the build/Release folder for distribution
{
"target_name": "copy_release_artifacts",
"dependencies": ["pact"],
"type": "none",
"copies": [
{
# must use module_root_dir here, because it uses proper windows paths
"files": [
"<(module_root_dir)/ffi/libpact_ffi.dylib",
"<(module_root_dir)/ffi/libpact_ffi.so",
"<(module_root_dir)/ffi/pact_ffi.dll",
],
"destination": "<(PRODUCT_DIR)"
},
{
"files": [
"<(module_root_dir)/ffi/osxaarch64/libpact_ffi.dylib",
],
"destination": "<(PRODUCT_DIR)/osxaarch64"
},
{
"files": [
"<(module_root_dir)/ffi/linuxaarch64/libpact_ffi.so",
],
"destination": "<(PRODUCT_DIR)/linuxaarch64"
}
]
},
# Need to set the library install name to enable the rpath settings to work on OSX
{
"target_name": "set_osx_install_name",
"dependencies": ["pact", "copy_release_artifacts"],
"type": "none",
"target_conditions":[
[
"OS==\"mac\"",
{
"actions": [
{
"action_name": "modify install_name on osx",
"inputs": ["<(module_root_dir)/build/Release/pact.node"],
"outputs": ["<(module_root_dir)/build/Release/pact.node"],
'action': ['install_name_tool', '-change', 'libpact_ffi.dylib', '@rpath/libpact_ffi.dylib', '<(module_root_dir)/build/Release/pact.node'],
}
]
}
]
]
}
]
}