pref: add -m32, -m64 command-line options (#7011)
parent
9772306ae9
commit
8f15af6adc
|
@ -44,6 +44,9 @@ These build flags are enabled on `build` and `run` as long as the backend is set
|
||||||
List of OS supported by V: `linux`, `windows`, `ios`, `mac`, `freebsd`, `openbsd`,
|
List of OS supported by V: `linux`, `windows`, `ios`, `mac`, `freebsd`, `openbsd`,
|
||||||
`netbsd`, `dragonfly`, `solaris`, `android` and `haiku`.
|
`netbsd`, `dragonfly`, `solaris`, `android` and `haiku`.
|
||||||
|
|
||||||
|
-m32, -m64
|
||||||
|
Specify whether 32-bit or 64-bit machine code is generated.
|
||||||
|
|
||||||
-sanitize
|
-sanitize
|
||||||
Pass flags related to sanitization to the C compiler.
|
Pass flags related to sanitization to the C compiler.
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,7 @@ pub mut:
|
||||||
// For example, passing -cflags -Os will cause the C compiler to optimize the generated binaries for size.
|
// For example, passing -cflags -Os will cause the C compiler to optimize the generated binaries for size.
|
||||||
// You could pass several -cflags XXX arguments. They will be merged with each other.
|
// You could pass several -cflags XXX arguments. They will be merged with each other.
|
||||||
// You can also quote several options at the same time: -cflags '-Os -fno-inline-small-functions'.
|
// You can also quote several options at the same time: -cflags '-Os -fno-inline-small-functions'.
|
||||||
|
m64 bool // true = generate 64-bit code, defaults to x64
|
||||||
ccompiler string // the name of the C compiler used
|
ccompiler string // the name of the C compiler used
|
||||||
ccompiler_type CompilerType // the type of the C compiler used
|
ccompiler_type CompilerType // the type of the C compiler used
|
||||||
third_party_option string
|
third_party_option string
|
||||||
|
@ -138,6 +139,9 @@ pub mut:
|
||||||
|
|
||||||
pub fn parse_args(args []string) (&Preferences, string) {
|
pub fn parse_args(args []string) (&Preferences, string) {
|
||||||
mut res := &Preferences{}
|
mut res := &Preferences{}
|
||||||
|
$if x64 {
|
||||||
|
res.m64 = true // follow V model by default
|
||||||
|
}
|
||||||
mut command := ''
|
mut command := ''
|
||||||
mut command_pos := 0
|
mut command_pos := 0
|
||||||
// for i, arg in args {
|
// for i, arg in args {
|
||||||
|
@ -239,6 +243,10 @@ pub fn parse_args(args []string) (&Preferences, string) {
|
||||||
'-color' {
|
'-color' {
|
||||||
res.use_color = .always
|
res.use_color = .always
|
||||||
}
|
}
|
||||||
|
'-m32', '-m64' {
|
||||||
|
res.m64 = arg[2] == `6`
|
||||||
|
res.cflags += ' $arg'
|
||||||
|
}
|
||||||
'-nocolor' {
|
'-nocolor' {
|
||||||
res.use_color = .never
|
res.use_color = .never
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue