mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
compiler: rename is_so to is_shared
This commit is contained in:
parent
392986b763
commit
86df486988
@ -123,8 +123,8 @@ fn parse_args(args []string) (&pref.Preferences, string) {
|
||||
'-v' { res.is_verbose = true }
|
||||
'-cg' { res.is_debug = true }
|
||||
'-live' { res.is_live = true }
|
||||
'-solive' { res.is_solive = true res.is_so = true }
|
||||
'-shared' { res.is_so = true }
|
||||
'-sharedlive' { res.is_live = true res.is_shared = true }
|
||||
'-shared' { res.is_shared = true }
|
||||
'-autofree' { res.autofree = true }
|
||||
'-compress' { res.compress = true }
|
||||
'-freestanding' { res.is_bare = true }
|
||||
|
@ -69,7 +69,7 @@ pub fn (b mut Builder) compile_c() {
|
||||
println(files)
|
||||
}
|
||||
mut out_name_c := get_vtmp_filename(b.pref.out_name, '.tmp.c')
|
||||
if b.pref.is_so {
|
||||
if b.pref.is_shared {
|
||||
out_name_c = get_vtmp_filename(b.pref.out_name, '.tmp.so.c')
|
||||
}
|
||||
b.build_c(files, out_name_c)
|
||||
|
@ -126,7 +126,7 @@ fn (v mut Builder) cc() {
|
||||
}
|
||||
}
|
||||
|
||||
if !v.pref.is_so
|
||||
if !v.pref.is_shared
|
||||
&& v.pref.build_mode != .build_module
|
||||
&& os.user_os() == 'windows'
|
||||
&& !v.pref.out_name.ends_with('.exe')
|
||||
@ -136,7 +136,7 @@ fn (v mut Builder) cc() {
|
||||
|
||||
// linux_host := os.user_os() == 'linux'
|
||||
v.log('cc() isprod=$v.pref.is_prod outname=$v.pref.out_name')
|
||||
if v.pref.is_so {
|
||||
if v.pref.is_shared {
|
||||
a << '-shared -fPIC ' // -Wl,-z,defs'
|
||||
v.pref.out_name += '.so'
|
||||
}
|
||||
@ -210,8 +210,13 @@ fn (v mut Builder) cc() {
|
||||
if v.pref.ccompiler != 'msvc' && v.pref.os != .freebsd {
|
||||
a << '-Werror=implicit-function-declaration'
|
||||
}
|
||||
for f in v.generate_hotcode_reloading_compiler_flags() {
|
||||
a << f
|
||||
if v.pref.is_shared || v.pref.is_live {
|
||||
if v.pref.os == .linux || os.user_os() == 'linux' {
|
||||
a << '-rdynamic'
|
||||
}
|
||||
if v.pref.os == .mac || os.user_os() == 'mac' {
|
||||
a << '-flat_namespace'
|
||||
}
|
||||
}
|
||||
mut libs := '' // builtin.o os.o http.o etc
|
||||
if v.pref.build_mode == .build_module {
|
||||
|
@ -160,7 +160,7 @@ pub fn (v Builder) get_user_files() []string {
|
||||
if v.pref.is_live {
|
||||
user_files << os.join_path(preludes_path, 'live_main.v')
|
||||
}
|
||||
if v.pref.is_solive {
|
||||
if v.pref.is_live && v.pref.is_shared {
|
||||
user_files << os.join_path(preludes_path, 'live_shared.v')
|
||||
}
|
||||
if v.pref.is_test {
|
||||
|
@ -5,20 +5,6 @@ import (
|
||||
time
|
||||
)
|
||||
|
||||
fn (v &Builder) generate_hotcode_reloading_compiler_flags() []string {
|
||||
mut a := []string
|
||||
if v.pref.is_live || v.pref.is_so {
|
||||
// See 'man dlopen', and test running a GUI program compiled with -live
|
||||
if v.pref.os == .linux || os.user_os() == 'linux' {
|
||||
a << '-rdynamic'
|
||||
}
|
||||
if v.pref.os == .mac || os.user_os() == 'mac' {
|
||||
a << '-flat_namespace'
|
||||
}
|
||||
}
|
||||
return a
|
||||
}
|
||||
|
||||
fn (v &Builder) generate_hotcode_reloading_declarations() {
|
||||
/*
|
||||
QTODO
|
||||
|
@ -209,7 +209,7 @@ pub fn (v mut Builder) cc_msvc() {
|
||||
a << '/Zi'
|
||||
a << '/MDd'
|
||||
}
|
||||
if v.pref.is_so {
|
||||
if v.pref.is_shared {
|
||||
if !v.pref.out_name.ends_with('.dll') {
|
||||
v.pref.out_name += '.dll'
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ pub fn (c mut Checker) check_files(ast_files []ast.File) {
|
||||
if c.pref.build_mode == .build_module || c.pref.is_test {
|
||||
return
|
||||
}
|
||||
if c.pref.is_so {
|
||||
if c.pref.is_shared {
|
||||
// shared libs do not need to have a main
|
||||
return
|
||||
}
|
||||
|
@ -29,8 +29,7 @@ pub mut:
|
||||
is_test bool // `v test string_test.v`
|
||||
is_script bool // single file mode (`v program.v`), main function can be skipped
|
||||
is_live bool // main program that contains live/hot code
|
||||
is_solive bool // a shared library, that will be used in a -live main program
|
||||
is_so bool // an ordinary shared library, -shared, no matter if it is live or not
|
||||
is_shared bool // an ordinary shared library, -shared, no matter if it is live or not
|
||||
is_prof bool // benchmark every function
|
||||
translated bool // `v translate doom.v` are we running V code translated from C? allow globals, ++ expressions, etc
|
||||
is_prod bool // use "-O2"
|
||||
|
Loading…
Reference in New Issue
Block a user