mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
pref: add -m32, -m64 command-line options (#7011)
This commit is contained in:
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`,
|
||||
`netbsd`, `dragonfly`, `solaris`, `android` and `haiku`.
|
||||
|
||||
-m32, -m64
|
||||
Specify whether 32-bit or 64-bit machine code is generated.
|
||||
|
||||
-sanitize
|
||||
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.
|
||||
// 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'.
|
||||
m64 bool // true = generate 64-bit code, defaults to x64
|
||||
ccompiler string // the name of the C compiler used
|
||||
ccompiler_type CompilerType // the type of the C compiler used
|
||||
third_party_option string
|
||||
@ -138,6 +139,9 @@ pub mut:
|
||||
|
||||
pub fn parse_args(args []string) (&Preferences, string) {
|
||||
mut res := &Preferences{}
|
||||
$if x64 {
|
||||
res.m64 = true // follow V model by default
|
||||
}
|
||||
mut command := ''
|
||||
mut command_pos := 0
|
||||
// for i, arg in args {
|
||||
@ -239,6 +243,10 @@ pub fn parse_args(args []string) (&Preferences, string) {
|
||||
'-color' {
|
||||
res.use_color = .always
|
||||
}
|
||||
'-m32', '-m64' {
|
||||
res.m64 = arg[2] == `6`
|
||||
res.cflags += ' $arg'
|
||||
}
|
||||
'-nocolor' {
|
||||
res.use_color = .never
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user