2020-03-13 22:52:49 +03:00
|
|
|
Usage: v [build flags] ['build'] <file.v|directory>
|
|
|
|
|
|
|
|
This command compiles the given target, along with their dependencies, into an executable.
|
|
|
|
|
|
|
|
This help topic explores C-backend specific build flags.
|
|
|
|
For help regarding building an executable, see `v help build`.
|
|
|
|
|
|
|
|
These build flags are enabled on `build` and `run` as long as the backend is set to `c`:
|
|
|
|
|
|
|
|
-arch <architecture>
|
2020-03-14 16:20:44 +03:00
|
|
|
Change the architecture that V will tell the C compiler to build.
|
2020-03-13 22:52:49 +03:00
|
|
|
List of supported architectures: `x86` and `x64` (default).
|
|
|
|
|
2020-04-25 11:15:51 +03:00
|
|
|
-cc <compiler>
|
2020-03-14 16:20:44 +03:00
|
|
|
Change the C compiler V invokes to the specified compiler.
|
2020-03-13 22:52:49 +03:00
|
|
|
The C compiler is required to support C99.
|
|
|
|
Officially supported/tested C compilers include: `clang`, `gcc`, `tcc`, `mingw-w64` and `msvc`.
|
|
|
|
|
2020-04-25 11:15:51 +03:00
|
|
|
-cflags <flag>
|
2020-03-14 16:20:44 +03:00
|
|
|
Pass the provided flag as is to the C compiler.
|
2020-03-13 22:52:49 +03:00
|
|
|
Can be specified multiple times to provide multiple flags.
|
|
|
|
Use quotes to wrap the flag argument if it contains spaces.
|
|
|
|
|
2020-04-25 11:15:51 +03:00
|
|
|
-printfn <fn_name>
|
|
|
|
Prints the content of the generated C function named fn_name. You can repeat that many times.
|
|
|
|
This is useful when you just want to quickly tweak the generated C code,
|
|
|
|
without opening the generated .c file in an text editor.
|
|
|
|
|
|
|
|
-cg
|
|
|
|
Enable generating more debug information in the compiled executable.
|
|
|
|
This makes program backtraces more useful.
|
|
|
|
Using debuggers like gdb/lldb with such executables is easier too.
|
2020-03-13 22:52:49 +03:00
|
|
|
|
|
|
|
-compress
|
2020-03-14 16:20:44 +03:00
|
|
|
Strip the compiled executable to compress it.
|
2020-03-13 22:52:49 +03:00
|
|
|
|
2020-04-25 11:15:51 +03:00
|
|
|
-keepc
|
|
|
|
Specify that you want V to not delete the intermediate generated C source code.
|
|
|
|
Use with -cg for best debugging experience.
|
2020-03-13 22:52:49 +03:00
|
|
|
|
|
|
|
-freestanding
|
2020-03-14 16:20:44 +03:00
|
|
|
Build the executable without dependency on libc.
|
2020-03-13 22:52:49 +03:00
|
|
|
Supported only on `linux` targets currently.
|
|
|
|
|
|
|
|
-live
|
2020-03-14 16:20:44 +03:00
|
|
|
Build the executable with live capabilities (`[live]`).
|
2020-03-13 22:52:49 +03:00
|
|
|
|
|
|
|
-manual-free
|
2020-03-14 16:20:44 +03:00
|
|
|
Enable manually freeing on all V code. This will cause memory leaks in vlib.
|
2020-03-13 22:52:49 +03:00
|
|
|
Currently enabled until a stable auto-free system is in place.
|
|
|
|
|
|
|
|
-os <os>, -target-os <os>
|
2020-03-14 16:20:44 +03:00
|
|
|
Change the target OS that V tries to compile for.
|
2020-03-13 22:52:49 +03:00
|
|
|
By default, the target OS is the host system.
|
|
|
|
When OS is `cross`, V will attempt to output cross-platform C code.
|
|
|
|
List of OS supported by V: `linux`, `windows`, `mac`, `freebsd`, `openbsd`, `netbsd`,
|
|
|
|
`dragonfly`, `solaris`, `android` and `haiku`.
|
|
|
|
|
|
|
|
-sanitize
|
2020-03-14 16:20:44 +03:00
|
|
|
Pass flags related to sanitization to the C compiler.
|
2020-03-13 22:52:49 +03:00
|
|
|
|
|
|
|
-shared
|
2020-03-14 16:20:44 +03:00
|
|
|
Tell V to compile a shared object instead of an executable.
|
2020-03-13 22:52:49 +03:00
|
|
|
The resulting file extension will be `.dll` on Windows and `.so` on Unix systems
|