9942 commits 0 issues 0 pull requests 439 contributors 0 branches 0 releases
Additions: 37 Deletions: 9
vlib/dl/dl_nix.c.v
1
2 #include <dlfcn.h>
3
4+$if linux {
5+ #flag -ldl
6+}
7+
8 pub const (
9 rtld_now = C.RTLD_NOW
10 rtld_lazy = C.RTLD_LAZY
11
vlib/fontstash/fontstash.v
1 }
2 #include "fontstash.h"
3 #flag -I /usr/local/Cellar/freetype/2.10.2/include/freetype2
4+
5+$if windows {
6+ $if tinyc {
7+ #flag @VEXEROOT/thirdparty/tcc/lib/openlibm.o
8+ }
9+} $else {
10+ #flag -lm
11+}
12+
13 //#flag -lfreetype
14 pub const (
15 // TODO: fontstash.used_import is used to keep v from warning about unused imports
16
vlib/math/math.c.v
1 module math
2
3 #include <math.h>
4+
5 $if windows {
6 $if tinyc {
7 #flag @VEXEROOT/thirdparty/tcc/lib/openlibm.o
8 }
9+} $else {
10+ #flag -lm
11 }
12+
13 fn C.acos(x f64) f64
14
15 fn C.asin(x f64) f64
16
vlib/sokol/c/declaration.c.v
1 #flag solaris -DSOKOL_NO_ENTRY
2 // TODO end
3
4+#flag linux -ldl
5+
6 $if gcboehm ? {
7 #define SOKOL_MALLOC GC_MALLOC
8 #define SOKOL_CALLOC(n,m) GC_MALLOC((n)*(m))
9
vlib/sync/threads/threads.c.v
1new file mode 100644
2+module threads
3+
4+// This module adds the necessary compiler flags for using threads.
5+// It is automatically imported by code that does `go func()` .
6+// See vlib/v/parser/pratt.v, search for ast.GoExpr .
7+// The goal is that programs, that do not use threads at all will not need
8+// to link to -lpthread etc.
9+// NB: on some platforms like Android, linking -lpthread is not needed too.
10+// See https://stackoverflow.com/a/31277163/1904615
11+
12+$if !windows && !android {
13+ #flag -lpthread
14+}
15
vlib/sync/threads/threads.v
1new file mode 100644
2+module threads
3+
4+// This file is just a placeholder.
5+// The actual implementation is backend/platform specific, so see threads.c.v, threads.js.v etc.
6
vlib/v/builder/cc.v
1 // || os.user_os() == 'linux'
2 if !v.pref.is_bare && v.pref.build_mode != .build_module
3 && v.pref.os in [.linux, .freebsd, .openbsd, .netbsd, .dragonfly, .solaris, .haiku] {
4- ccoptions.linker_flags << '-lm'
5- ccoptions.linker_flags << '-lpthread'
6- // -ldl is a Linux only thing. BSDs have it in libc.
7- if v.pref.os == .linux {
8- ccoptions.linker_flags << '-ldl'
9- }
10 if v.pref.os in [.freebsd, .netbsd] {
11 // Free/NetBSD: backtrace needs execinfo library while linking
12 ccoptions.linker_flags << '-lexecinfo'
13 }
14 }
15- if !v.pref.is_bare && v.pref.os == .js && os.user_os() == 'linux' {
16- ccoptions.linker_flags << '-lm'
17- }
18 ccoptions.env_cflags = os.getenv('CFLAGS')
19 ccoptions.env_ldflags = os.getenv('LDFLAGS')
20 $if trace_ccoptions ? {
21
vlib/v/parser/pratt.v
1 }
2 }
3 pos := spos.extend(p.prev_tok.position())
4+ p.register_auto_import('sync.threads')
5 return ast.GoExpr{
6 call_expr: call_expr
7 pos: pos
8