Skip to content

Commit 11544d4

Browse files
authored
compile: support -d no_gc_threads (#331)
1 parent 43a51e1 commit 11544d4

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

android/compile.v

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ pub fn (opt CompileOptions) uses_gc() bool {
5757
return uses_gc
5858
}
5959

60+
// has_v_d_flag returns true if `d_flag` (-d <ident>) can be found among the passed v flags.
61+
pub fn (opt CompileOptions) has_v_d_flag(d_flag string) bool {
62+
for v_flag in opt.v_flags {
63+
if v_flag.contains('-d ${d_flag}') {
64+
return true
65+
}
66+
}
67+
return false
68+
}
69+
6070
// is_debug_build returns true if either `-cg` or `-g` flags is found among the passed v flags.
6171
pub fn (opt CompileOptions) is_debug_build() bool {
6272
return '-cg' in opt.v_flags || '-g' in opt.v_flags
@@ -695,7 +705,9 @@ pub fn compile_v_c_dependencies(opt CompileOptions, v_meta_info VMetaInfo) !VImp
695705
defines << '-DGC_ASSERTIONS'
696706
defines << '-DGC_ANDROID_LOG'
697707
}
698-
defines << '-DGC_THREADS=1'
708+
if !opt.has_v_d_flag('no_gc_threads') {
709+
defines << '-DGC_THREADS=1'
710+
}
699711
defines << '-DGC_BUILTIN_ATOMIC=1'
700712
defines << '-D_REENTRANT'
701713
// NOTE it's currently a little unclear why this is needed.

0 commit comments

Comments
 (0)