@@ -26,8 +26,17 @@ project('janet', 'c',
26
26
janet_path = join_paths (get_option (' prefix' ), get_option (' libdir' ), ' janet' )
27
27
header_path = join_paths (get_option (' prefix' ), get_option (' includedir' ), ' janet' )
28
28
29
- # Link math library on all systems
29
+ # Compilers
30
30
cc = meson .get_compiler(' c' )
31
+ native_cc = meson .get_compiler(' c' , native : true )
32
+
33
+ # Native deps
34
+ native_m_dep = native_cc.find_library (' m' , required : false )
35
+ native_dl_dep = native_cc.find_library (' dl' , required : false )
36
+ native_android_spawn_dep = native_cc.find_library (' android-spawn' , required : false )
37
+ native_thread_dep = dependency (' threads' , native : true )
38
+
39
+ # Deps
31
40
m_dep = cc.find_library (' m' , required : false )
32
41
dl_dep = cc.find_library (' dl' , required : false )
33
42
android_spawn_dep = cc.find_library (' android-spawn' , required : false )
@@ -164,11 +173,18 @@ mainclient_src = [
164
173
' src/mainclient/shell.c'
165
174
]
166
175
176
+ janet_dependencies = [m_dep, dl_dep, android_spawn_dep]
177
+ janet_native_dependencies = [native_m_dep, native_dl_dep, native_android_spawn_dep]
178
+ if not get_option (' single_threaded' )
179
+ janet_dependencies += thread_dep
180
+ janet_native_dependencies += native_thread_dep
181
+ endif
182
+
167
183
# Build boot binary
168
184
janet_boot = executable (' janet-boot' , core_src, boot_src,
169
185
include_directories : incdir,
170
186
c_args : ' -DJANET_BOOTSTRAP' ,
171
- dependencies : [m_dep, dl_dep, thread_dep, android_spawn_dep] ,
187
+ dependencies : janet_native_dependencies ,
172
188
native : true )
173
189
174
190
# Build janet.c
@@ -181,11 +197,6 @@ janetc = custom_target('janetc',
181
197
' JANET_PATH' , janet_path
182
198
])
183
199
184
- janet_dependencies = [m_dep, dl_dep, android_spawn_dep]
185
- if not get_option (' single_threaded' )
186
- janet_dependencies += thread_dep
187
- endif
188
-
189
200
# Allow building with no shared library
190
201
if cc.has_argument(' -fvisibility=hidden' )
191
202
lib_cflags = [' -fvisibility=hidden' ]
@@ -231,7 +242,7 @@ if meson.is_cross_build()
231
242
endif
232
243
janet_nativeclient = executable (' janet-native' , janetc, mainclient_src,
233
244
include_directories : incdir,
234
- dependencies : janet_dependencies ,
245
+ dependencies : janet_native_dependencies ,
235
246
c_args : extra_native_cflags,
236
247
native : true )
237
248
else
0 commit comments