|
1 | 1 | { |
2 | | - "targets": [ |
3 | | - { |
4 | | - "target_name": "pact", |
5 | | - "sources": [ |
6 | | - "native/addon.cc", |
7 | | - "native/ffi.cc", |
8 | | - "native/consumer.cc", |
9 | | - "native/provider.cc", |
10 | | - "native/plugin.cc" |
11 | | - ], |
12 | | - "include_dirs": [ |
13 | | - "<!(node -p \"require('node-addon-api').include_dir\")", |
14 | | - "<(module_root_dir)/native", |
15 | | - "<(module_root_dir)/ffi", |
16 | | - ], |
17 | | - "conditions": [ |
18 | | - [ |
19 | | - "OS=='win'", |
20 | | - { |
21 | | - "libraries": [ |
22 | | - "<(module_root_dir)/ffi/pact_ffi.dll.lib" |
| 2 | + "variables": { |
| 3 | + "is_alpine": "<!(grep -q Alpine /etc/os-release && echo true || echo false)" |
| 4 | + }, |
| 5 | + "targets": [ |
| 6 | + { |
| 7 | + "target_name": "pact", |
| 8 | + "sources": [ |
| 9 | + "native/addon.cc", |
| 10 | + "native/ffi.cc", |
| 11 | + "native/consumer.cc", |
| 12 | + "native/provider.cc", |
| 13 | + "native/plugin.cc" |
23 | 14 | ], |
24 | | - "defines": [ |
25 | | - "_HAS_EXCEPTIONS=1" |
| 15 | + "include_dirs": [ |
| 16 | + "<!(node -p \"require('node-addon-api').include_dir\")", |
| 17 | + "<(module_root_dir)/native", |
| 18 | + "<(module_root_dir)/ffi", |
26 | 19 | ], |
27 | | - "msvs_settings": { |
28 | | - "VCCLCompilerTool": { |
29 | | - "ExceptionHandling": 1 |
30 | | - } |
31 | | - }, |
32 | | - "copies":[{ |
33 | | - "files": [ "<(module_root_dir)/ffi/pact_ffi.dll"], |
34 | | - "destination": "<(PRODUCT_DIR)" |
35 | | - }], |
36 | | - } |
37 | | - ], |
38 | | - [ |
39 | | - "OS==\"mac\" and target_arch ==\"x64\"", |
40 | | - { |
41 | | - "xcode_settings": { |
42 | | - "GCC_SYMBOLS_PRIVATE_EXTERN": "YES", |
43 | | - "GCC_ENABLE_CPP_EXCEPTIONS": "YES", |
44 | | - "GCC_TREAT_WARNINGS_AS_ERRORS": "YES", |
45 | | - "CLANG_CXX_LIBRARY": "libc++", |
46 | | - "MACOSX_DEPLOYMENT_TARGET": "10.7" |
47 | | - }, |
48 | | - "link_settings": { |
49 | | - "libraries": [ |
50 | | - "-lpact_ffi", |
51 | | - "-L<(module_root_dir)/ffi", |
52 | | - "-Wl,-rpath,@loader_path" |
53 | | - ] |
54 | | - }, |
55 | | - "copies":[{ |
56 | | - "files": [ "<(module_root_dir)/ffi/libpact_ffi.dylib"], |
57 | | - "destination": "<(PRODUCT_DIR)" |
58 | | - }], |
59 | | - } |
60 | | - ], |
61 | | - [ |
62 | | - "OS==\"mac\" and target_arch ==\"arm64\"", |
63 | | - { |
64 | | - "xcode_settings": { |
65 | | - "GCC_SYMBOLS_PRIVATE_EXTERN": "YES", |
66 | | - "GCC_ENABLE_CPP_EXCEPTIONS": "YES", |
67 | | - "GCC_TREAT_WARNINGS_AS_ERRORS": "YES", |
68 | | - "CLANG_CXX_LIBRARY": "libc++", |
69 | | - "MACOSX_DEPLOYMENT_TARGET": "10.7" |
70 | | - }, |
71 | | - "link_settings": { |
72 | | - "libraries": [ |
73 | | - "-lpact_ffi", |
74 | | - "-L<(module_root_dir)/ffi", |
75 | | - "-Wl,-rpath,@loader_path" |
76 | | - ] |
77 | | - }, |
78 | | - "copies":[{ |
79 | | - "files": [ "<(module_root_dir)/ffi/osxaarch64/libpact_ffi.dylib"], |
80 | | - "destination": "<(PRODUCT_DIR)" |
81 | | - }], |
82 | | - } |
83 | | - ], |
84 | | - [ |
85 | | - "OS==\"linux\" and target_arch ==\"x64\"", |
86 | | - { |
87 | | - "link_settings": { |
88 | | - "libraries": [ |
89 | | - "-lpact_ffi", |
90 | | - "-L<(module_root_dir)/ffi", |
91 | | - "-Wl,-rpath,'$$ORIGIN'" |
92 | | - ] |
93 | | - }, |
94 | | - "copies":[{ |
95 | | - "files": [ "<(module_root_dir)/ffi/libpact_ffi.so"], |
96 | | - "destination": "<(PRODUCT_DIR)" |
97 | | - }], |
98 | | - } |
99 | | - ], |
100 | | - [ |
101 | | - "OS==\"linux\" and target_arch ==\"arm64\"", |
102 | | - { |
103 | | - "link_settings": { |
104 | | - "libraries": [ |
105 | | - "-lpact_ffi", |
106 | | - "-L<(module_root_dir)/ffi/linuxaarch64", |
107 | | - "-Wl,-rpath,'$$ORIGIN'" |
108 | | - ] |
109 | | - }, |
110 | | - "copies":[{ |
111 | | - "files": [ "<(module_root_dir)/ffi/linuxaarch64/libpact_ffi.so"], |
112 | | - "destination": "<(PRODUCT_DIR)" |
113 | | - }], |
114 | | - } |
115 | | - ] |
116 | | - ], |
117 | | - "library_dirs": [ |
118 | | - "<(module_root_dir)/native" |
119 | | - ], |
120 | | - "cflags_cc!": [ |
121 | | - "-fno-exceptions", |
122 | | - ], |
123 | | - "cflags_cc": [ "-Werror" ], |
124 | | - "defines": [ |
125 | | - "NAPI_CPP_EXCEPTIONS" |
126 | | - ] |
127 | | - }, |
128 | | - # Need to set the library install name to enable the rpath settings to work on OSX |
129 | | - { |
130 | | - "target_name": "set_osx_install_name", |
131 | | - "dependencies": ["pact"], |
132 | | - "type": "none", |
133 | | - "target_conditions":[ |
134 | | - [ |
135 | | - "OS==\"mac\"", |
136 | | - { |
137 | | - "actions": [ |
138 | | - { |
139 | | - "action_name": "modify install_name on osx", |
140 | | - "inputs": ["<(module_root_dir)/build/Release/pact.node"], |
141 | | - "outputs": ["<(module_root_dir)/build/Release/pact.node"], |
142 | | - 'action': ['install_name_tool', '-change', 'libpact_ffi.dylib', '@rpath/libpact_ffi.dylib', '<(module_root_dir)/build/Release/pact.node'], |
143 | | - } |
| 20 | + "conditions": [ |
| 21 | + [ |
| 22 | + "OS=='win'", |
| 23 | + { |
| 24 | + "libraries": [ |
| 25 | + "<(module_root_dir)/ffi/windows-x86_64/pact_ffi.dll.lib" |
| 26 | + ], |
| 27 | + "defines": [ |
| 28 | + "_HAS_EXCEPTIONS=1" |
| 29 | + ], |
| 30 | + "msvs_settings": { |
| 31 | + "VCCLCompilerTool": { |
| 32 | + "ExceptionHandling": 1 |
| 33 | + } |
| 34 | + }, |
| 35 | + "copies": [{ |
| 36 | + "files": ["<(module_root_dir)/ffi/windows-x86_64/pact_ffi.dll"], |
| 37 | + "destination": "<(PRODUCT_DIR)" |
| 38 | + }], |
| 39 | + } |
| 40 | + ], |
| 41 | + [ |
| 42 | + "OS==\"mac\" and target_arch ==\"x64\"", |
| 43 | + { |
| 44 | + "xcode_settings": { |
| 45 | + "GCC_SYMBOLS_PRIVATE_EXTERN": "YES", |
| 46 | + "GCC_ENABLE_CPP_EXCEPTIONS": "YES", |
| 47 | + "GCC_TREAT_WARNINGS_AS_ERRORS": "YES", |
| 48 | + "CLANG_CXX_LIBRARY": "libc++", |
| 49 | + "MACOSX_DEPLOYMENT_TARGET": "10.7" |
| 50 | + }, |
| 51 | + "link_settings": { |
| 52 | + "libraries": [ |
| 53 | + "-lpact_ffi", |
| 54 | + "-L<(module_root_dir)/ffi", |
| 55 | + "-Wl,-rpath,@loader_path" |
| 56 | + ] |
| 57 | + }, |
| 58 | + "copies": [{ |
| 59 | + "files": ["<(module_root_dir)/ffi/osx-x86_64/libpact_ffi.dylib"], |
| 60 | + "destination": "<(PRODUCT_DIR)" |
| 61 | + }], |
| 62 | + } |
| 63 | + ], |
| 64 | + [ |
| 65 | + "OS==\"mac\" and target_arch ==\"arm64\"", |
| 66 | + { |
| 67 | + "xcode_settings": { |
| 68 | + "GCC_SYMBOLS_PRIVATE_EXTERN": "YES", |
| 69 | + "GCC_ENABLE_CPP_EXCEPTIONS": "YES", |
| 70 | + "GCC_TREAT_WARNINGS_AS_ERRORS": "YES", |
| 71 | + "CLANG_CXX_LIBRARY": "libc++", |
| 72 | + "MACOSX_DEPLOYMENT_TARGET": "10.7" |
| 73 | + }, |
| 74 | + "link_settings": { |
| 75 | + "libraries": [ |
| 76 | + "-lpact_ffi", |
| 77 | + "-L<(module_root_dir)/ffi", |
| 78 | + "-Wl,-rpath,@loader_path" |
| 79 | + ] |
| 80 | + }, |
| 81 | + "copies": [{ |
| 82 | + "files": ["<(module_root_dir)/ffi/osx-aarch64/libpact_ffi.dylib"], |
| 83 | + "destination": "<(PRODUCT_DIR)" |
| 84 | + }], |
| 85 | + } |
| 86 | + ], |
| 87 | + [ |
| 88 | + "OS==\"linux\" and target_arch ==\"x64\" and is_alpine ==\"true\"", |
| 89 | + { |
| 90 | + "link_settings": { |
| 91 | + "libraries": [ |
| 92 | + "-lpact_ffi_musl", |
| 93 | + "-L<(module_root_dir)/ffi/linux-musl-x86_64/", |
| 94 | + "-Wl,-rpath,'$$ORIGIN'" |
| 95 | + ] |
| 96 | + }, |
| 97 | + "copies": [{ |
| 98 | + "files": ["<(module_root_dir)/ffi/linux-musl-x86_64/libpact_ffi_musl.so"], |
| 99 | + "destination": "<(PRODUCT_DIR)" |
| 100 | + }], |
| 101 | + } |
| 102 | + ], |
| 103 | + [ |
| 104 | + "OS==\"linux\" and target_arch ==\"arm64\" and is_alpine ==\"true\"", |
| 105 | + { |
| 106 | + "link_settings": { |
| 107 | + "libraries": [ |
| 108 | + "-lpact_ffi_musl", |
| 109 | + "-L<(module_root_dir)/ffi/linux-musl-aarch64/", |
| 110 | + "-Wl,-rpath,'$$ORIGIN'" |
| 111 | + ] |
| 112 | + }, |
| 113 | + "copies": [{ |
| 114 | + "files": ["<(module_root_dir)/ffi/linux-musl-aarch64/libpact_ffi_musl.so"], |
| 115 | + "destination": "<(PRODUCT_DIR)" |
| 116 | + }], |
| 117 | + } |
| 118 | + ], |
| 119 | + [ |
| 120 | + "OS==\"linux\" and target_arch ==\"x64\" and is_alpine ==\"false\"", |
| 121 | + { |
| 122 | + "link_settings": { |
| 123 | + "libraries": [ |
| 124 | + "-lpact_ffi", |
| 125 | + "-L<(module_root_dir)/ffi/linux-x86_64/", |
| 126 | + "-Wl,-rpath,'$$ORIGIN'" |
| 127 | + ] |
| 128 | + }, |
| 129 | + "copies": [{ |
| 130 | + "files": ["<(module_root_dir)/ffi/linux-x86_64/libpact_ffi.so"], |
| 131 | + "destination": "<(PRODUCT_DIR)" |
| 132 | + }], |
| 133 | + } |
| 134 | + ], |
| 135 | + [ |
| 136 | + "OS==\"linux\" and target_arch ==\"arm64\" and is_alpine ==\"false\"", |
| 137 | + { |
| 138 | + "link_settings": { |
| 139 | + "libraries": [ |
| 140 | + "-lpact_ffi", |
| 141 | + "-L<(module_root_dir)/ffi/linux-aarch64", |
| 142 | + "-Wl,-rpath,'$$ORIGIN'" |
| 143 | + ] |
| 144 | + }, |
| 145 | + "copies": [{ |
| 146 | + "files": ["<(module_root_dir)/ffi/linux-aarch64/libpact_ffi.so"], |
| 147 | + "destination": "<(PRODUCT_DIR)" |
| 148 | + }], |
| 149 | + } |
| 150 | + ], |
| 151 | + ], |
| 152 | + "library_dirs": [ |
| 153 | + "<(module_root_dir)/native" |
| 154 | + ], |
| 155 | + "cflags_cc!": [ |
| 156 | + "-fno-exceptions", |
| 157 | + ], |
| 158 | + "cflags_cc": ["-Werror"], |
| 159 | + "defines": [ |
| 160 | + "NAPI_CPP_EXCEPTIONS" |
| 161 | + ] |
| 162 | + }, |
| 163 | + # Need to set the library install name to enable the rpath settings to work on OSX |
| 164 | + { |
| 165 | + "target_name": "set_osx_install_name", |
| 166 | + "dependencies": ["pact"], |
| 167 | + "type": "none", |
| 168 | + "target_conditions": [ |
| 169 | + [ |
| 170 | + "OS==\"mac\"", |
| 171 | + { |
| 172 | + "actions": [ |
| 173 | + { |
| 174 | + "action_name": "modify install_name on osx", |
| 175 | + "inputs": ["<(module_root_dir)/build/Release/pact.node"], |
| 176 | + "outputs": ["<(module_root_dir)/build/Release/pact.node"], |
| 177 | + 'action': ['install_name_tool', '-change', 'libpact_ffi.dylib', '@rpath/libpact_ffi.dylib', '<(module_root_dir)/build/Release/pact.node'], |
| 178 | + } |
| 179 | + ] |
| 180 | + } |
| 181 | + ] |
144 | 182 | ] |
145 | | - } |
146 | | - ] |
147 | | - ] |
148 | | - } |
149 | | - ] |
| 183 | + } |
| 184 | + ] |
150 | 185 | } |
0 commit comments